@donotdev/core 0.0.14 → 0.0.16

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,8 +1,8 @@
1
- var ro=Object.create;var Kr=Object.defineProperty;var so=Object.getOwnPropertyDescriptor;var no=Object.getOwnPropertyNames;var io=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var ie=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Yr=(e,t)=>()=>(e&&(t=e(e=0)),t);var q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ao=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of no(t))!oo.call(e,n)&&n!==r&&Kr(e,n,{get:()=>t[n],enumerable:!(s=so(t,n))||s.enumerable});return e};var lo=(e,t,r)=>(r=e!=null?ro(io(e)):{},ao(t||!e||!e.__esModule?Kr(r,"default",{value:e,enumerable:!0}):r,e));function es(e,t=null){let r=ke[e];if(!r)throw new Error(`Unknown pattern type: ${e}`);return t&&r.framework?{...r,framework:r.framework.map(s=>`${t}/${s}`)}:r}function Mt(e){return Qr[e]||Qr.base}var dr,ee,ve,ue,gr,Ge,Lt,ke,at,Zr,pr,mr,Qr,ge=Yr(()=>{"use strict";g();dr={HOMEPAGE_FILE:"HomePage.tsx",HOMEPAGE_PATH:"/",HOMEPAGE_COMPONENT:"HomePage"},ee={routes:"virtual:routes",themes:"virtual:themes",i18n:"virtual:i18n-mapping",assets:"virtual:assets",env:"virtual:env"},ve={routes:"routes",themes:"themes",i18n:"i18n",assets:"assets",env:"env"},ue={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",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"}},gr={package:"@donotdev/ui",assetsPath:"packages/ui/assets",browserTargets:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"]},Ge={public:"public",fonts:"fonts",nodeModules:"node_modules",packages:"packages",core:"core",ui:"ui"},Lt={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"},ke={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"],framework:{eager:[`${Lt.SOURCE_EAGER}/*_*.json`],lazy:[`${Lt.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/**"]},at={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","@donotdev/core","@donotdev/components","@donotdev/ui","@donotdev/templates","@donotdev/firebase"],optionalFeatures:["@donotdev/adv-comps","@donotdev/auth","@donotdev/billing","@donotdev/crud","@donotdev/oauth","shiki","@tiptap/react","@tiptap/starter-kit","@tiptap/extension-placeholder"],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"]},Zr=["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"],pr={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)/}},mr=[{name:"light",displayName:"Light",icon:"Sun",isDark:!1}],Qr={base:{absolute:!0,onlyFiles:!0,ignore:ke.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...ke.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...ke.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:ke.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:ke.globalIgnore}}});import{Buffer as v}from"node:buffer";import{createRequire as uo}from"node:module";import{dirname as fo,resolve as Sf}from"node:path";import p from"node:process";import{fileURLToPath as ho}from"node:url";var go,y,w,g=Yr(()=>{"use strict";go=uo(import.meta.url),y=ho(import.meta.url),w=fo(y);typeof globalThis<"u"&&(globalThis.require=go,globalThis.__filename=y,globalThis.__dirname=w,globalThis.Buffer=v,globalThis.process=p,typeof global>"u"&&(globalThis.global=globalThis))});var Oe=q((xh,vs)=>{g();var bs=e=>typeof e<"u"&&e!==null,Fo=e=>typeof e=="object",Oo=e=>Object.prototype.toString.call(e)==="[object Object]",jo=e=>typeof e=="function",Lo=e=>typeof e=="boolean",Mo=e=>e instanceof v,zo=e=>{if(bs(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},Bo=e=>e instanceof ArrayBuffer,Uo=e=>typeof e=="string"&&e.length>0,Go=e=>typeof e=="number"&&!Number.isNaN(e),qo=e=>Number.isInteger(e),Wo=(e,t,r)=>e>=t&&e<=r,Ho=(e,t)=>t.includes(e),Vo=(e,t,r)=>new Error(`Expected ${t} for ${e} but received ${r} of type ${typeof r}`),Jo=(e,t)=>(t.message=e.message,t);vs.exports={defined:bs,object:Fo,plainObject:Oo,fn:jo,bool:Lo,buffer:Mo,typedArray:zo,arrayBuffer:Bo,string:Uo,number:Go,integer:qo,inRange:Wo,inArray:Ho,invalidParameterError:Vo,nativeError:Jo}});var Es=q((Rh,ws)=>{"use strict";g();var ys=()=>p.platform==="linux",Ut=null,Xo=()=>{if(!Ut)if(ys()&&p.report){let e=p.report.excludeNetwork;p.report.excludeNetwork=!0,Ut=p.report.getReport(),p.report.excludeNetwork=e}else Ut={};return Ut};ws.exports={isLinux:ys,getReport:Xo}});var Ps=q(($h,xs)=>{"use strict";g();var mt=ie("fs"),Ko="/usr/bin/ldd",Yo="/proc/self/exe",Gt=2048,Qo=e=>{let t=mt.openSync(e,"r"),r=v.alloc(Gt),s=mt.readSync(t,r,0,Gt,0);return mt.close(t,()=>{}),r.subarray(0,s)},Zo=e=>new Promise((t,r)=>{mt.open(e,"r",(s,n)=>{if(s)r(s);else{let i=v.alloc(Gt);mt.read(n,i,0,Gt,0,(o,a)=>{t(i.subarray(0,a)),mt.close(n,()=>{})})}})});xs.exports={LDD_PATH:Ko,SELF_PATH:Yo,readFileSync:Qo,readFile:Zo}});var Ss=q((Ah,Rs)=>{"use strict";g();var ea=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),s=e.readUInt16LE(56);for(let n=0;n<s;n++){let i=t+n*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),c=e.readUInt32LE(i+32);return e.subarray(a,a+c).toString().replace(/\0.*$/g,"")}}return null};Rs.exports={interpreterPath:ea}});var Wt=q((Nh,Gs)=>{"use strict";g();var ks=ie("child_process"),{isLinux:bt,getReport:As}=Es(),{LDD_PATH:qt,SELF_PATH:_s,readFile:vr,readFileSync:yr}=Ps(),{interpreterPath:Ns}=Ss(),je,Le,Me,Is="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",et="",Ts=()=>et||new Promise(e=>{ks.exec(Is,(t,r)=>{et=t?" ":r,e(et)})}),Ds=()=>{if(!et)try{et=ks.execSync(Is,{encoding:"utf8"})}catch{et=" "}return et},We="glibc",Cs=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,lt="musl",ta=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),Fs=()=>{let e=As();return e.header&&e.header.glibcVersionRuntime?We:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(ta)?lt:null},Os=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(We)?We:r&&r.includes(lt)?lt:null},js=e=>{if(e){if(e.includes("/ld-musl-"))return lt;if(e.includes("/ld-linux-"))return We}return null},Ls=e=>(e=e.toString(),e.includes("musl")?lt:e.includes("GNU C Library")?We:null),ra=async()=>{if(Le!==void 0)return Le;Le=null;try{let e=await vr(qt);Le=Ls(e)}catch{}return Le},sa=()=>{if(Le!==void 0)return Le;Le=null;try{let e=yr(qt);Le=Ls(e)}catch{}return Le},na=async()=>{if(je!==void 0)return je;je=null;try{let e=await vr(_s),t=Ns(e);je=js(t)}catch{}return je},ia=()=>{if(je!==void 0)return je;je=null;try{let e=yr(_s),t=Ns(e);je=js(t)}catch{}return je},Ms=async()=>{let e=null;if(bt()&&(e=await na(),!e&&(e=await ra(),e||(e=Fs()),!e))){let t=await Ts();e=Os(t)}return e},zs=()=>{let e=null;if(bt()&&(e=ia(),!e&&(e=sa(),e||(e=Fs()),!e))){let t=Ds();e=Os(t)}return e},oa=async()=>bt()&&await Ms()!==We,aa=()=>bt()&&zs()!==We,la=async()=>{if(Me!==void 0)return Me;Me=null;try{let t=(await vr(qt)).match(Cs);t&&(Me=t[1])}catch{}return Me},ca=()=>{if(Me!==void 0)return Me;Me=null;try{let t=yr(qt).match(Cs);t&&(Me=t[1])}catch{}return Me},Bs=()=>{let e=As();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},$s=e=>e.trim().split(/\s+/)[1],Us=e=>{let[t,r,s]=e.split(/[\r\n]+/);return t&&t.includes(We)?$s(t):r&&s&&r.includes(lt)?$s(s):null},ua=async()=>{let e=null;if(bt()&&(e=await la(),e||(e=Bs()),!e)){let t=await Ts();e=Us(t)}return e},fa=()=>{let e=null;if(bt()&&(e=ca(),e||(e=Bs()),!e)){let t=Ds();e=Us(t)}return e};Gs.exports={GLIBC:We,MUSL:lt,family:Ms,familySync:zs,isNonGlibcLinux:oa,isNonGlibcLinuxSync:aa,version:ua,versionSync:fa}});var Nt=q((Th,qs)=>{"use strict";g();var ha=typeof p=="object"&&p.env&&p.env.NODE_DEBUG&&/\bsemver\b/i.test(p.env.NODE_DEBUG)?(...e)=>{}:()=>{};qs.exports=ha});var Ht=q((Ch,Ws)=>{"use strict";g();var da="2.0.0",ga=Number.MAX_SAFE_INTEGER||9007199254740991,pa=16,ma=250,ba=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ws.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:pa,MAX_SAFE_BUILD_LENGTH:ma,MAX_SAFE_INTEGER:ga,RELEASE_TYPES:ba,SEMVER_SPEC_VERSION:da,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var It=q((ze,Hs)=>{"use strict";g();var{MAX_SAFE_COMPONENT_LENGTH:wr,MAX_SAFE_BUILD_LENGTH:va,MAX_LENGTH:ya}=Ht(),wa=Nt();ze=Hs.exports={};var Ea=ze.re=[],xa=ze.safeRe=[],N=ze.src=[],Pa=ze.safeSrc=[],I=ze.t={},Ra=0,Er="[a-zA-Z0-9-]",Sa=[["\\s",1],["\\d",ya],[Er,va]],$a=e=>{for(let[t,r]of Sa)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},B=(e,t,r)=>{let s=$a(t),n=Ra++;wa(e,n,t),I[e]=n,N[n]=t,Pa[n]=s,Ea[n]=new RegExp(t,r?"g":void 0),xa[n]=new RegExp(s,r?"g":void 0)};B("NUMERICIDENTIFIER","0|[1-9]\\d*");B("NUMERICIDENTIFIERLOOSE","\\d+");B("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Er}*`);B("MAINVERSION",`(${N[I.NUMERICIDENTIFIER]})\\.(${N[I.NUMERICIDENTIFIER]})\\.(${N[I.NUMERICIDENTIFIER]})`);B("MAINVERSIONLOOSE",`(${N[I.NUMERICIDENTIFIERLOOSE]})\\.(${N[I.NUMERICIDENTIFIERLOOSE]})\\.(${N[I.NUMERICIDENTIFIERLOOSE]})`);B("PRERELEASEIDENTIFIER",`(?:${N[I.NONNUMERICIDENTIFIER]}|${N[I.NUMERICIDENTIFIER]})`);B("PRERELEASEIDENTIFIERLOOSE",`(?:${N[I.NONNUMERICIDENTIFIER]}|${N[I.NUMERICIDENTIFIERLOOSE]})`);B("PRERELEASE",`(?:-(${N[I.PRERELEASEIDENTIFIER]}(?:\\.${N[I.PRERELEASEIDENTIFIER]})*))`);B("PRERELEASELOOSE",`(?:-?(${N[I.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${N[I.PRERELEASEIDENTIFIERLOOSE]})*))`);B("BUILDIDENTIFIER",`${Er}+`);B("BUILD",`(?:\\+(${N[I.BUILDIDENTIFIER]}(?:\\.${N[I.BUILDIDENTIFIER]})*))`);B("FULLPLAIN",`v?${N[I.MAINVERSION]}${N[I.PRERELEASE]}?${N[I.BUILD]}?`);B("FULL",`^${N[I.FULLPLAIN]}$`);B("LOOSEPLAIN",`[v=\\s]*${N[I.MAINVERSIONLOOSE]}${N[I.PRERELEASELOOSE]}?${N[I.BUILD]}?`);B("LOOSE",`^${N[I.LOOSEPLAIN]}$`);B("GTLT","((?:<|>)?=?)");B("XRANGEIDENTIFIERLOOSE",`${N[I.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);B("XRANGEIDENTIFIER",`${N[I.NUMERICIDENTIFIER]}|x|X|\\*`);B("XRANGEPLAIN",`[v=\\s]*(${N[I.XRANGEIDENTIFIER]})(?:\\.(${N[I.XRANGEIDENTIFIER]})(?:\\.(${N[I.XRANGEIDENTIFIER]})(?:${N[I.PRERELEASE]})?${N[I.BUILD]}?)?)?`);B("XRANGEPLAINLOOSE",`[v=\\s]*(${N[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${N[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${N[I.XRANGEIDENTIFIERLOOSE]})(?:${N[I.PRERELEASELOOSE]})?${N[I.BUILD]}?)?)?`);B("XRANGE",`^${N[I.GTLT]}\\s*${N[I.XRANGEPLAIN]}$`);B("XRANGELOOSE",`^${N[I.GTLT]}\\s*${N[I.XRANGEPLAINLOOSE]}$`);B("COERCEPLAIN",`(^|[^\\d])(\\d{1,${wr}})(?:\\.(\\d{1,${wr}}))?(?:\\.(\\d{1,${wr}}))?`);B("COERCE",`${N[I.COERCEPLAIN]}(?:$|[^\\d])`);B("COERCEFULL",N[I.COERCEPLAIN]+`(?:${N[I.PRERELEASE]})?(?:${N[I.BUILD]})?(?:$|[^\\d])`);B("COERCERTL",N[I.COERCE],!0);B("COERCERTLFULL",N[I.COERCEFULL],!0);B("LONETILDE","(?:~>?)");B("TILDETRIM",`(\\s*)${N[I.LONETILDE]}\\s+`,!0);ze.tildeTrimReplace="$1~";B("TILDE",`^${N[I.LONETILDE]}${N[I.XRANGEPLAIN]}$`);B("TILDELOOSE",`^${N[I.LONETILDE]}${N[I.XRANGEPLAINLOOSE]}$`);B("LONECARET","(?:\\^)");B("CARETTRIM",`(\\s*)${N[I.LONECARET]}\\s+`,!0);ze.caretTrimReplace="$1^";B("CARET",`^${N[I.LONECARET]}${N[I.XRANGEPLAIN]}$`);B("CARETLOOSE",`^${N[I.LONECARET]}${N[I.XRANGEPLAINLOOSE]}$`);B("COMPARATORLOOSE",`^${N[I.GTLT]}\\s*(${N[I.LOOSEPLAIN]})$|^$`);B("COMPARATOR",`^${N[I.GTLT]}\\s*(${N[I.FULLPLAIN]})$|^$`);B("COMPARATORTRIM",`(\\s*)${N[I.GTLT]}\\s*(${N[I.LOOSEPLAIN]}|${N[I.XRANGEPLAIN]})`,!0);ze.comparatorTrimReplace="$1$2$3";B("HYPHENRANGE",`^\\s*(${N[I.XRANGEPLAIN]})\\s+-\\s+(${N[I.XRANGEPLAIN]})\\s*$`);B("HYPHENRANGELOOSE",`^\\s*(${N[I.XRANGEPLAINLOOSE]})\\s+-\\s+(${N[I.XRANGEPLAINLOOSE]})\\s*$`);B("STAR","(<|>)?=?\\s*\\*");B("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");B("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Vt=q((jh,Vs)=>{"use strict";g();var ka=Object.freeze({loose:!0}),Aa=Object.freeze({}),_a=e=>e?typeof e!="object"?ka:e:Aa;Vs.exports=_a});var Ys=q((Mh,Ks)=>{"use strict";g();var Js=/^[0-9]+$/,Xs=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;let r=Js.test(e),s=Js.test(t);return r&&s&&(e=+e,t=+t),e===t?0:r&&!s?-1:s&&!r?1:e<t?-1:1},Na=(e,t)=>Xs(t,e);Ks.exports={compareIdentifiers:Xs,rcompareIdentifiers:Na}});var vt=q((Bh,Zs)=>{"use strict";g();var Jt=Nt(),{MAX_LENGTH:Qs,MAX_SAFE_INTEGER:Xt}=Ht(),{safeRe:Kt,t:Yt}=It(),Ia=Vt(),{compareIdentifiers:xr}=Ys(),Pr=class e{constructor(t,r){if(r=Ia(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Qs)throw new TypeError(`version is longer than ${Qs} characters`);Jt("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=t.trim().match(r.loose?Kt[Yt.LOOSE]:Kt[Yt.FULL]);if(!s)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>Xt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Xt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Xt||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<Xt)return i}return n}):this.prerelease=[],this.build=s[5]?s[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Jt("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let s=this.prerelease[r],n=t.prerelease[r];if(Jt("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return xr(s,n)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let s=this.build[r],n=t.build[r];if(Jt("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return xr(s,n)}while(++r)}inc(t,r,s){if(t.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?Kt[Yt.PRERELEASELOOSE]:Kt[Yt.PRERELEASE]);if(!n||n[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];s===!1&&(i=[r]),xr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Zs.exports=Pr});var rn=q((Gh,tn)=>{"use strict";g();var en=vt(),Ta=(e,t,r=!1)=>{if(e instanceof en)return e;try{return new en(e,t)}catch(s){if(!r)return null;throw s}};tn.exports=Ta});var nn=q((Wh,sn)=>{"use strict";g();var Da=vt(),Ca=rn(),{safeRe:Qt,t:Zt}=It(),Fa=(e,t)=>{if(e instanceof Da)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Qt[Zt.COERCEFULL]:Qt[Zt.COERCE]);else{let c=t.includePrerelease?Qt[Zt.COERCERTLFULL]:Qt[Zt.COERCERTL],u;for(;(u=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Ca(`${s}.${n}.${i}${o}${a}`,t)};sn.exports=Fa});var ct=q((Vh,an)=>{"use strict";g();var on=vt(),Oa=(e,t,r)=>new on(e,r).compare(new on(t,r));an.exports=Oa});var Rr=q((Xh,ln)=>{"use strict";g();var ja=ct(),La=(e,t,r)=>ja(e,t,r)>=0;ln.exports=La});var un=q((Yh,cn)=>{"use strict";g();var Sr=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(t,r)}return this}};cn.exports=Sr});var hn=q((Zh,fn)=>{"use strict";g();var Ma=ct(),za=(e,t,r)=>Ma(e,t,r)===0;fn.exports=za});var gn=q((td,dn)=>{"use strict";g();var Ba=ct(),Ua=(e,t,r)=>Ba(e,t,r)!==0;dn.exports=Ua});var mn=q((sd,pn)=>{"use strict";g();var Ga=ct(),qa=(e,t,r)=>Ga(e,t,r)>0;pn.exports=qa});var vn=q((id,bn)=>{"use strict";g();var Wa=ct(),Ha=(e,t,r)=>Wa(e,t,r)<0;bn.exports=Ha});var wn=q((ad,yn)=>{"use strict";g();var Va=ct(),Ja=(e,t,r)=>Va(e,t,r)<=0;yn.exports=Ja});var xn=q((cd,En)=>{"use strict";g();var Xa=hn(),Ka=gn(),Ya=mn(),Qa=Rr(),Za=vn(),el=wn(),tl=(e,t,r,s)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Xa(e,r,s);case"!=":return Ka(e,r,s);case">":return Ya(e,r,s);case">=":return Qa(e,r,s);case"<":return Za(e,r,s);case"<=":return el(e,r,s);default:throw new TypeError(`Invalid operator: ${t}`)}};En.exports=tl});var _n=q((fd,An)=>{"use strict";g();var Tt=Symbol("SemVer ANY"),Ar=class e{static get ANY(){return Tt}constructor(t,r){if(r=Pn(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),kr("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===Tt?this.value="":this.value=this.operator+this.semver.version,kr("comp",this)}parse(t){let r=this.options.loose?Rn[Sn.COMPARATORLOOSE]:Rn[Sn.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new $n(s[2],this.options.loose):this.semver=Tt}toString(){return this.value}test(t){if(kr("Comparator.test",t,this.options.loose),this.semver===Tt||t===Tt)return!0;if(typeof t=="string")try{t=new $n(t,this.options)}catch{return!1}return $r(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new kn(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new kn(this.value,r).test(t.semver):(r=Pn(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||$r(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||$r(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};An.exports=Ar;var Pn=Vt(),{safeRe:Rn,t:Sn}=It(),$r=xn(),kr=Nt(),$n=vt(),kn=_r()});var _r=q((dd,Dn)=>{"use strict";g();var rl=/\s+/g,Nr=class e{constructor(t,r){if(r=nl(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Ir)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(rl," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!In(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&fl(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let s=((this.options.includePrerelease&&cl)|(this.options.loose&&ul))+":"+t,n=Nn.get(s);if(n)return n;let i=this.options.loose,o=i?we[be.HYPHENRANGELOOSE]:we[be.HYPHENRANGE];t=t.replace(o,El(this.options.includePrerelease)),te("hyphen replace",t),t=t.replace(we[be.COMPARATORTRIM],ol),te("comparator trim",t),t=t.replace(we[be.TILDETRIM],al),te("tilde trim",t),t=t.replace(we[be.CARETTRIM],ll),te("caret trim",t);let a=t.split(" ").map(b=>hl(b,this.options)).join(" ").split(/\s+/).map(b=>wl(b,this.options));i&&(a=a.filter(b=>(te("loose invalid filter",b,this.options),!!b.match(we[be.COMPARATORLOOSE])))),te("range list",a);let c=new Map,u=a.map(b=>new Ir(b,this.options));for(let b of u){if(In(b))return[b];c.set(b.value,b)}c.size>1&&c.has("")&&c.delete("");let f=[...c.values()];return Nn.set(s,f),f}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(s=>Tn(s,r)&&t.set.some(n=>Tn(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new il(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(xl(this.set[r],t,this.options))return!0;return!1}};Dn.exports=Nr;var sl=un(),Nn=new sl,nl=Vt(),Ir=_n(),te=Nt(),il=vt(),{safeRe:we,t:be,comparatorTrimReplace:ol,tildeTrimReplace:al,caretTrimReplace:ll}=It(),{FLAG_INCLUDE_PRERELEASE:cl,FLAG_LOOSE:ul}=Ht(),In=e=>e.value==="<0.0.0-0",fl=e=>e.value==="",Tn=(e,t)=>{let r=!0,s=e.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,t)),n=s.pop();return r},hl=(e,t)=>(e=e.replace(we[be.BUILD],""),te("comp",e,t),e=pl(e,t),te("caret",e),e=dl(e,t),te("tildes",e),e=bl(e,t),te("xrange",e),e=yl(e,t),te("stars",e),e),Ee=e=>!e||e.toLowerCase()==="x"||e==="*",dl=(e,t)=>e.trim().split(/\s+/).map(r=>gl(r,t)).join(" "),gl=(e,t)=>{let r=t.loose?we[be.TILDELOOSE]:we[be.TILDE];return e.replace(r,(s,n,i,o,a)=>{te("tilde",e,s,n,i,o,a);let c;return Ee(n)?c="":Ee(i)?c=`>=${n}.0.0 <${+n+1}.0.0-0`:Ee(o)?c=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(te("replaceTilde pr",a),c=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):c=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,te("tilde return",c),c})},pl=(e,t)=>e.trim().split(/\s+/).map(r=>ml(r,t)).join(" "),ml=(e,t)=>{te("caret",e,t);let r=t.loose?we[be.CARETLOOSE]:we[be.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,(n,i,o,a,c)=>{te("caret",e,n,i,o,a,c);let u;return Ee(i)?u="":Ee(o)?u=`>=${i}.0.0${s} <${+i+1}.0.0-0`:Ee(a)?i==="0"?u=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:c?(te("replaceCaret pr",c),i==="0"?o==="0"?u=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(te("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${a}${s} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),te("caret return",u),u})},bl=(e,t)=>(te("replaceXRanges",e,t),e.split(/\s+/).map(r=>vl(r,t)).join(" ")),vl=(e,t)=>{e=e.trim();let r=t.loose?we[be.XRANGELOOSE]:we[be.XRANGE];return e.replace(r,(s,n,i,o,a,c)=>{te("xRange",e,s,n,i,o,a,c);let u=Ee(i),f=u||Ee(o),b=f||Ee(a),m=b;return n==="="&&m&&(n=""),c=t.includePrerelease?"-0":"",u?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&m?(f&&(o=0),a=0,n===">"?(n=">=",f?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",f?i=+i+1:o=+o+1),n==="<"&&(c="-0"),s=`${n+i}.${o}.${a}${c}`):f?s=`>=${i}.0.0${c} <${+i+1}.0.0-0`:b&&(s=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),te("xRange return",s),s})},yl=(e,t)=>(te("replaceStars",e,t),e.trim().replace(we[be.STAR],"")),wl=(e,t)=>(te("replaceGTE0",e,t),e.trim().replace(we[t.includePrerelease?be.GTE0PRE:be.GTE0],"")),El=e=>(t,r,s,n,i,o,a,c,u,f,b,m)=>(Ee(s)?r="":Ee(n)?r=`>=${s}.0.0${e?"-0":""}`:Ee(i)?r=`>=${s}.${n}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,Ee(u)?c="":Ee(f)?c=`<${+u+1}.0.0-0`:Ee(b)?c=`<${u}.${+f+1}.0-0`:m?c=`<=${u}.${f}.${b}-${m}`:e?c=`<${u}.${f}.${+b+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),xl=(e,t,r)=>{for(let s=0;s<e.length;s++)if(!e[s].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let s=0;s<e.length;s++)if(te(e[s].semver),e[s].semver!==Ir.ANY&&e[s].semver.prerelease.length>0){let n=e[s].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}});var Fn=q((pd,Cn)=>{"use strict";g();var Pl=_r(),Rl=(e,t,r)=>{try{t=new Pl(t,r)}catch{return!1}return t.test(e)};Cn.exports=Rl});var Tr=q((bd,Sl)=>{Sl.exports={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.34.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unneb\xE4ck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix B\xFCnemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","J\xE9r\xE9my Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kot\u011B\u0161ovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouci\xF1o <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugu\xE9 <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>"],scripts:{build:"node install/build.js",install:"node install/check.js || npm run build",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-types":"tsd --files ./test/types/sharp.test-d.ts","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",main:"lib/index.js",types:"lib/index.d.ts",files:["install","lib","src/*.{cc,h,gyp}"],repository:{type:"git",url:"git://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.0.0","detect-libc":"^2.1.2",semver:"^7.7.3"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.34.5","@img/sharp-darwin-x64":"0.34.5","@img/sharp-libvips-darwin-arm64":"1.2.4","@img/sharp-libvips-darwin-x64":"1.2.4","@img/sharp-libvips-linux-arm":"1.2.4","@img/sharp-libvips-linux-arm64":"1.2.4","@img/sharp-libvips-linux-ppc64":"1.2.4","@img/sharp-libvips-linux-riscv64":"1.2.4","@img/sharp-libvips-linux-s390x":"1.2.4","@img/sharp-libvips-linux-x64":"1.2.4","@img/sharp-libvips-linuxmusl-arm64":"1.2.4","@img/sharp-libvips-linuxmusl-x64":"1.2.4","@img/sharp-linux-arm":"0.34.5","@img/sharp-linux-arm64":"0.34.5","@img/sharp-linux-ppc64":"0.34.5","@img/sharp-linux-riscv64":"0.34.5","@img/sharp-linux-s390x":"0.34.5","@img/sharp-linux-x64":"0.34.5","@img/sharp-linuxmusl-arm64":"0.34.5","@img/sharp-linuxmusl-x64":"0.34.5","@img/sharp-wasm32":"0.34.5","@img/sharp-win32-arm64":"0.34.5","@img/sharp-win32-ia32":"0.34.5","@img/sharp-win32-x64":"0.34.5"},devDependencies:{"@biomejs/biome":"^2.3.4","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.7.0","@img/sharp-libvips-dev":"1.2.4","@img/sharp-libvips-dev-wasm32":"1.2.4","@img/sharp-libvips-win32-arm64":"1.2.4","@img/sharp-libvips-win32-ia32":"1.2.4","@img/sharp-libvips-win32-x64":"1.2.4","@types/node":"*",emnapi:"^1.7.0","exif-reader":"^2.0.2","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^9.1.3","node-addon-api":"^8.5.0","node-gyp":"^11.5.0","tar-fs":"^3.1.1",tsd:"^0.33.0"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.17.3"},funding:{url:"https://opencollective.com/libvips"}}});var Cr=q((vd,Wn)=>{g();var{spawnSync:er}=ie("node:child_process"),{createHash:$l}=ie("node:crypto"),Mn=nn(),kl=Rr(),Al=Fn(),On=Wt(),{config:_l,engines:jn,optionalDependencies:Nl}=Tr(),Il=p.env.npm_package_config_libvips||_l.libvips,zn=Mn(Il).version,Tl=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],tr={encoding:"utf8",shell:!0},Dl=e=>{e instanceof Error},Bn=()=>On.isNonGlibcLinuxSync()?On.familySync():"",Cl=()=>`${p.platform}${Bn()}-${p.arch}`,yt=()=>{if(Un())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=p.env,s=typeof r=="string"?r:Bn();return`${t||p.platform}${s}-${e||p.arch}`},Fl=()=>{try{return ie(`@img/sharp-libvips-dev-${yt()}/include`)}catch{try{return ie("@img/sharp-libvips-dev/include")}catch{}}return""},Ol=()=>{try{return ie("@img/sharp-libvips-dev/cplusplus")}catch{}return""},jl=()=>{try{return ie(`@img/sharp-libvips-dev-${yt()}/lib`)}catch{try{return ie(`@img/sharp-libvips-${yt()}/lib`)}catch{}}return""},Ll=()=>{if(p.release?.name==="node"&&p.versions&&!Al(p.versions.node,jn.node))return{found:p.versions.node,expected:jn.node}},Un=()=>{let{CC:e}=p.env;return!!e?.endsWith("/emcc")},Ml=()=>p.platform==="darwin"&&p.arch==="x64"?(er("sysctl sysctl.proc_translated",tr).stdout||"").trim()==="sysctl.proc_translated: 1":!1,Ln=e=>$l("sha512").update(e).digest("hex"),zl=()=>{try{let e=Ln(`imgsharp-libvips-${yt()}`),t=Mn(Nl[`@img/sharp-libvips-${yt()}`],{includePrerelease:!0}).version;return Ln(`${e}npm:${t}`).slice(0,10)}catch{}return""},Bl=()=>er(`node-gyp rebuild --directory=src ${Un()?"--nodedir=emscripten":""}`,{...tr,stdio:"inherit"}).status,Gn=()=>p.platform!=="win32"?(er("pkg-config --modversion vips-cpp",{...tr,env:{...p.env,PKG_CONFIG_PATH:qn()}}).stdout||"").trim():"",qn=()=>p.platform!=="win32"?[(er('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',tr).stdout||"").trim(),p.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",Dr=(e,t,r)=>(r&&r(`Detected ${t}, skipping search for globally-installed libvips`),e),Ul=e=>{if(p.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return Dr(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(p.env.SHARP_FORCE_GLOBAL_LIBVIPS)return Dr(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(Ml())return Dr(!1,"Rosetta",e);let t=Gn();return!!t&&kl(t,zn)};Wn.exports={minimumLibvipsVersion:zn,prebuiltPlatforms:Tl,buildPlatformArch:yt,buildSharpLibvipsIncludeDir:Fl,buildSharpLibvipsCPlusPlusDir:Ol,buildSharpLibvipsLibDir:jl,isUnsupportedNodeRuntime:Ll,runtimePlatformArch:Cl,log:Dl,yarnLocator:zl,spawnRebuild:Bl,globalLibvipsVersion:Gn,pkgConfigPath:qn,useGlobalLibvips:Ul}});var Ct=q((Ed,Vn)=>{g();var{familySync:Gl,versionSync:ql}=Wt(),{runtimePlatformArch:Wl,isUnsupportedNodeRuntime:Hn,prebuiltPlatforms:Hl,minimumLibvipsVersion:Vl}=Cr(),ut=Wl(),Jl=[`../src/build/Release/sharp-${ut}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${ut}/sharp.node`,"@img/sharp-wasm32/sharp.node"],Fr,wt,Dt=[];for(Fr of Jl)try{wt=ie(Fr);break}catch(e){Dt.push(e)}if(wt&&Fr.startsWith("@img/sharp-linux-x64")&&!wt._isUsingX64V2()){let e=new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");e.code="Unsupported CPU",Dt.push(e),wt=null}if(wt)Vn.exports=wt;else{let[e,t,r]=["linux","darwin","win32"].map(i=>ut.startsWith(i)),s=[`Could not load the "sharp" module using the ${ut} runtime`];Dt.forEach(i=>{i.code!=="MODULE_NOT_FOUND"&&s.push(`${i.code}: ${i.message}`)});let n=Dt.map(i=>i.message).join(" ");if(s.push("Possible solutions:"),Hn()){let{found:i,expected:o}=Hn();s.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(Hl.includes(ut)){let[i,o]=ut.split("-"),a=i.endsWith("musl")?" --libc=musl":"";s.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else s.push(`- Manually install libvips >= ${Vl}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(n))try{let{config:i}=ie(`@img/sharp-libvips-${ut}/package`),o=`${Gl()} ${ql()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;s.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(n)&&s.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node"),t&&/Incompatible library version/.test(n)&&s.push("- Update Homebrew:"," brew update && brew upgrade vips"),Dt.some(i=>i.code==="ERR_DLOPEN_DISABLED")&&s.push("- Run Node.js without using the --no-addons flag"),r&&/The specified procedure could not be found/.test(n)&&s.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp"),s.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(s.join(`
2
- `))}});var Xn=q((Rd,Jn)=>{g();var Xl=ie("node:util"),Or=ie("node:stream"),Kl=Oe();Ct();var Yl=Xl.debuglog("sharp"),Ql=e=>{ft.queue.emit("change",e)},ft=function(e,t){if(arguments.length===1&&!Kl.defined(e))throw new Error("Invalid input");return this instanceof ft?(Or.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:r=>{this.emit("warning",r),Yl(r)},queueListener:Ql},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this):new ft(e,t)};Object.setPrototypeOf(ft.prototype,Or.Duplex.prototype);Object.setPrototypeOf(ft,Or.Duplex);function Zl(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...s}=this.options;return e.options=structuredClone(s),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput()&&this.on("finish",()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")}),e}Object.assign(ft.prototype,{clone:Zl});Jn.exports=ft});var Qn=q(($d,Yn)=>{g();var h=Oe(),tt=Ct(),ec={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},tc=["failOn","limitInputPixels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","failOnError","openSlideLevel","pdfBackground","tiffSubifd"];function Kn(e){let t=tc.filter(r=>h.defined(e[r])).map(r=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function rc(e,t,r){let s={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(h.string(e))s.file=e;else if(h.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");s.buffer=e}else if(h.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");s.buffer=v.from(e,0,e.byteLength)}else if(h.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");s.buffer=v.from(e.buffer,e.byteOffset,e.byteLength)}else if(h.plainObject(e)&&!h.defined(t))t=e,Kn(t)&&(s.buffer=[]);else if(!h.defined(e)&&!h.defined(t)&&h.object(r)&&r.allowStream)s.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(n=>this._createInputDescriptor(n));else throw new Error("Recursive join is unsupported");else throw new Error("Expected at least two images to join");else throw new Error(`Unsupported input '${e}' of type ${typeof e}${h.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(h.object(t)){if(h.defined(t.failOnError))if(h.bool(t.failOnError))s.failOn=t.failOnError?"warning":"none";else throw h.invalidParameterError("failOnError","boolean",t.failOnError);if(h.defined(t.failOn))if(h.string(t.failOn)&&h.inArray(t.failOn,["none","truncated","error","warning"]))s.failOn=t.failOn;else throw h.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(h.defined(t.autoOrient))if(h.bool(t.autoOrient))s.autoOrient=t.autoOrient;else throw h.invalidParameterError("autoOrient","boolean",t.autoOrient);if(h.defined(t.density))if(h.inRange(t.density,1,1e5))s.density=t.density;else throw h.invalidParameterError("density","number between 1 and 100000",t.density);if(h.defined(t.ignoreIcc))if(h.bool(t.ignoreIcc))s.ignoreIcc=t.ignoreIcc;else throw h.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(h.defined(t.limitInputPixels))if(h.bool(t.limitInputPixels))s.limitInputPixels=t.limitInputPixels?16383**2:0;else if(h.integer(t.limitInputPixels)&&h.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))s.limitInputPixels=t.limitInputPixels;else throw h.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(h.defined(t.unlimited))if(h.bool(t.unlimited))s.unlimited=t.unlimited;else throw h.invalidParameterError("unlimited","boolean",t.unlimited);if(h.defined(t.sequentialRead))if(h.bool(t.sequentialRead))s.sequentialRead=t.sequentialRead;else throw h.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(h.defined(t.raw)){if(h.object(t.raw)&&h.integer(t.raw.width)&&t.raw.width>0&&h.integer(t.raw.height)&&t.raw.height>0&&h.integer(t.raw.channels)&&h.inRange(t.raw.channels,1,4))switch(s.rawWidth=t.raw.width,s.rawHeight=t.raw.height,s.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:s.rawDepth="uchar";break;case Int8Array:s.rawDepth="char";break;case Uint16Array:s.rawDepth="ushort";break;case Int16Array:s.rawDepth="short";break;case Uint32Array:s.rawDepth="uint";break;case Int32Array:s.rawDepth="int";break;case Float32Array:s.rawDepth="float";break;case Float64Array:s.rawDepth="double";break;default:s.rawDepth="uchar";break}else throw new Error("Expected width, height and channels for raw pixel input");if(s.rawPremultiplied=!1,h.defined(t.raw.premultiplied))if(h.bool(t.raw.premultiplied))s.rawPremultiplied=t.raw.premultiplied;else throw h.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(s.rawPageHeight=0,h.defined(t.raw.pageHeight))if(h.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw new Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);s.rawPageHeight=t.raw.pageHeight}else throw h.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(h.defined(t.animated))if(h.bool(t.animated))s.pages=t.animated?-1:1;else throw h.invalidParameterError("animated","boolean",t.animated);if(h.defined(t.pages))if(h.integer(t.pages)&&h.inRange(t.pages,-1,1e5))s.pages=t.pages;else throw h.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(h.defined(t.page))if(h.integer(t.page)&&h.inRange(t.page,0,1e5))s.page=t.page;else throw h.invalidParameterError("page","integer between 0 and 100000",t.page);if(h.object(t.openSlide)&&h.defined(t.openSlide.level))if(h.integer(t.openSlide.level)&&h.inRange(t.openSlide.level,0,256))s.openSlideLevel=t.openSlide.level;else throw h.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(h.defined(t.level))if(h.integer(t.level)&&h.inRange(t.level,0,256))s.openSlideLevel=t.level;else throw h.invalidParameterError("level","integer between 0 and 256",t.level);if(h.object(t.tiff)&&h.defined(t.tiff.subifd))if(h.integer(t.tiff.subifd)&&h.inRange(t.tiff.subifd,-1,1e5))s.tiffSubifd=t.tiff.subifd;else throw h.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(h.defined(t.subifd))if(h.integer(t.subifd)&&h.inRange(t.subifd,-1,1e5))s.tiffSubifd=t.subifd;else throw h.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(h.object(t.svg)){if(h.defined(t.svg.stylesheet))if(h.string(t.svg.stylesheet))s.svgStylesheet=t.svg.stylesheet;else throw h.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(h.defined(t.svg.highBitdepth))if(h.bool(t.svg.highBitdepth))s.svgHighBitdepth=t.svg.highBitdepth;else throw h.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(h.object(t.pdf)&&h.defined(t.pdf.background)?s.pdfBackground=this._getBackgroundColourOption(t.pdf.background):h.defined(t.pdfBackground)&&(s.pdfBackground=this._getBackgroundColourOption(t.pdfBackground)),h.object(t.jp2)&&h.defined(t.jp2.oneshot))if(h.bool(t.jp2.oneshot))s.jp2Oneshot=t.jp2.oneshot;else throw h.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(h.defined(t.create))if(h.object(t.create)&&h.integer(t.create.width)&&t.create.width>0&&h.integer(t.create.height)&&t.create.height>0&&h.integer(t.create.channels)){if(s.createWidth=t.create.width,s.createHeight=t.create.height,s.createChannels=t.create.channels,s.createPageHeight=0,h.defined(t.create.pageHeight))if(h.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw new Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);s.createPageHeight=t.create.pageHeight}else throw h.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(h.defined(t.create.noise)){if(!h.object(t.create.noise))throw new Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw new Error("Only gaussian noise is supported at the moment");if(s.createNoiseType=t.create.noise.type,!h.inRange(t.create.channels,1,4))throw h.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(s.createNoiseMean=128,h.defined(t.create.noise.mean))if(h.number(t.create.noise.mean)&&h.inRange(t.create.noise.mean,0,1e4))s.createNoiseMean=t.create.noise.mean;else throw h.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(s.createNoiseSigma=30,h.defined(t.create.noise.sigma))if(h.number(t.create.noise.sigma)&&h.inRange(t.create.noise.sigma,0,1e4))s.createNoiseSigma=t.create.noise.sigma;else throw h.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(h.defined(t.create.background)){if(!h.inRange(t.create.channels,3,4))throw h.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);s.createBackground=this._getBackgroundColourOption(t.create.background)}else throw new Error("Expected valid noise or background to create a new input image");delete s.buffer}else throw new Error("Expected valid width, height and channels to create a new input image");if(h.defined(t.text))if(h.object(t.text)&&h.string(t.text.text)){if(s.textValue=t.text.text,h.defined(t.text.height)&&h.defined(t.text.dpi))throw new Error("Expected only one of dpi or height");if(h.defined(t.text.font))if(h.string(t.text.font))s.textFont=t.text.font;else throw h.invalidParameterError("text.font","string",t.text.font);if(h.defined(t.text.fontfile))if(h.string(t.text.fontfile))s.textFontfile=t.text.fontfile;else throw h.invalidParameterError("text.fontfile","string",t.text.fontfile);if(h.defined(t.text.width))if(h.integer(t.text.width)&&t.text.width>0)s.textWidth=t.text.width;else throw h.invalidParameterError("text.width","positive integer",t.text.width);if(h.defined(t.text.height))if(h.integer(t.text.height)&&t.text.height>0)s.textHeight=t.text.height;else throw h.invalidParameterError("text.height","positive integer",t.text.height);if(h.defined(t.text.align))if(h.string(t.text.align)&&h.string(this.constructor.align[t.text.align]))s.textAlign=this.constructor.align[t.text.align];else throw h.invalidParameterError("text.align","valid alignment",t.text.align);if(h.defined(t.text.justify))if(h.bool(t.text.justify))s.textJustify=t.text.justify;else throw h.invalidParameterError("text.justify","boolean",t.text.justify);if(h.defined(t.text.dpi))if(h.integer(t.text.dpi)&&h.inRange(t.text.dpi,1,1e6))s.textDpi=t.text.dpi;else throw h.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(h.defined(t.text.rgba))if(h.bool(t.text.rgba))s.textRgba=t.text.rgba;else throw h.invalidParameterError("text.rgba","bool",t.text.rgba);if(h.defined(t.text.spacing))if(h.integer(t.text.spacing)&&h.inRange(t.text.spacing,-1e6,1e6))s.textSpacing=t.text.spacing;else throw h.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(h.defined(t.text.wrap))if(h.string(t.text.wrap)&&h.inArray(t.text.wrap,["word","char","word-char","none"]))s.textWrap=t.text.wrap;else throw h.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete s.buffer}else throw new Error("Expected a valid string to create an image with text.");if(h.defined(t.join))if(h.defined(this.options.join)){if(h.defined(t.join.animated))if(h.bool(t.join.animated))s.joinAnimated=t.join.animated;else throw h.invalidParameterError("join.animated","boolean",t.join.animated);if(h.defined(t.join.across))if(h.integer(t.join.across)&&h.inRange(t.join.across,1,1e6))s.joinAcross=t.join.across;else throw h.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(h.defined(t.join.shim))if(h.integer(t.join.shim)&&h.inRange(t.join.shim,0,1e6))s.joinShim=t.join.shim;else throw h.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(h.defined(t.join.background)&&(s.joinBackground=this._getBackgroundColourOption(t.join.background)),h.defined(t.join.halign))if(h.string(t.join.halign)&&h.string(this.constructor.align[t.join.halign]))s.joinHalign=this.constructor.align[t.join.halign];else throw h.invalidParameterError("join.halign","valid alignment",t.join.halign);if(h.defined(t.join.valign))if(h.string(t.join.valign)&&h.string(this.constructor.align[t.join.valign]))s.joinValign=this.constructor.align[t.join.valign];else throw h.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw new Error("Expected input to be an array of images to join")}else if(h.defined(t))throw new Error(`Invalid input options ${t}`);return s}function sc(e,t,r){Array.isArray(this.options.input.buffer)?h.buffer(e)?(this.options.input.buffer.length===0&&this.on("finish",()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),r()):r(new Error("Non-Buffer data on Writable Stream")):r(new Error("Unexpected data on Writable Stream"))}function nc(){this._isStreamInput()&&(this.options.input.buffer=v.concat(this.options.input.buffer))}function ic(){return Array.isArray(this.options.input.buffer)}function oc(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),tt.metadata(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)})}):tt.metadata(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)}),this):this._isStreamInput()?new Promise((r,s)=>{let n=()=>{this._flattenBufferIn(),tt.metadata(this.options,(i,o)=>{i?s(h.nativeError(i,t)):r(o)})};this.writableFinished?n():this.once("finish",n)}):new Promise((r,s)=>{tt.metadata(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}function ac(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),tt.stats(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)})}):tt.stats(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)}),this):this._isStreamInput()?new Promise((r,s)=>{this.on("finish",function(){this._flattenBufferIn(),tt.stats(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}):new Promise((r,s)=>{tt.stats(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}Yn.exports=e=>{Object.assign(e.prototype,{_inputOptionsFromObject:Kn,_createInputDescriptor:rc,_write:sc,_flattenBufferIn:nc,_isStreamInput:ic,metadata:oc,stats:ac}),e.align=ec}});var ni=q((Ad,si)=>{g();var D=Oe(),ei={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},ti={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},Zn={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},ri={entropy:16,attention:17},jr={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},lc={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},cc={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function Lr(e){return e.angle%360!==0||e.rotationAngle!==0}function rr(e){return e.width!==-1||e.height!==-1}function uc(e,t,r){if(rr(this.options)&&this.options.debuglog("ignoring previous resize options"),this.options.widthPost!==-1&&this.options.debuglog("operation order will be: extract, resize, extract"),D.defined(e))if(D.object(e)&&!D.defined(r))r=e;else if(D.integer(e)&&e>0)this.options.width=e;else throw D.invalidParameterError("width","positive integer",e);else this.options.width=-1;if(D.defined(t))if(D.integer(t)&&t>0)this.options.height=t;else throw D.invalidParameterError("height","positive integer",t);else this.options.height=-1;if(D.object(r)){if(D.defined(r.width))if(D.integer(r.width)&&r.width>0)this.options.width=r.width;else throw D.invalidParameterError("width","positive integer",r.width);if(D.defined(r.height))if(D.integer(r.height)&&r.height>0)this.options.height=r.height;else throw D.invalidParameterError("height","positive integer",r.height);if(D.defined(r.fit)){let s=cc[r.fit];if(D.string(s))this.options.canvas=s;else throw D.invalidParameterError("fit","valid fit",r.fit)}if(D.defined(r.position)){let s=D.integer(r.position)?r.position:ri[r.position]||ti[r.position]||ei[r.position];if(D.integer(s)&&(D.inRange(s,0,8)||D.inRange(s,16,17)))this.options.position=s;else throw D.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),D.defined(r.kernel))if(D.string(jr[r.kernel]))this.options.kernel=jr[r.kernel];else throw D.invalidParameterError("kernel","valid kernel name",r.kernel);D.defined(r.withoutEnlargement)&&this._setBooleanOption("withoutEnlargement",r.withoutEnlargement),D.defined(r.withoutReduction)&&this._setBooleanOption("withoutReduction",r.withoutReduction),D.defined(r.fastShrinkOnLoad)&&this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}return Lr(this.options)&&rr(this.options)&&(this.options.rotateBefore=!0),this}function fc(e){if(D.integer(e)&&e>0)this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else if(D.object(e)){if(D.defined(e.top))if(D.integer(e.top)&&e.top>=0)this.options.extendTop=e.top;else throw D.invalidParameterError("top","positive integer",e.top);if(D.defined(e.bottom))if(D.integer(e.bottom)&&e.bottom>=0)this.options.extendBottom=e.bottom;else throw D.invalidParameterError("bottom","positive integer",e.bottom);if(D.defined(e.left))if(D.integer(e.left)&&e.left>=0)this.options.extendLeft=e.left;else throw D.invalidParameterError("left","positive integer",e.left);if(D.defined(e.right))if(D.integer(e.right)&&e.right>=0)this.options.extendRight=e.right;else throw D.invalidParameterError("right","positive integer",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),D.defined(e.extendWith))if(D.string(Zn[e.extendWith]))this.options.extendWith=Zn[e.extendWith];else throw D.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw D.invalidParameterError("extend","integer or object",e);return this}function hc(e){let t=rr(this.options)||this.options.widthPre!==-1?"Post":"Pre";return this.options[`width${t}`]!==-1&&this.options.debuglog("ignoring previous extract options"),["left","top","width","height"].forEach(function(r){let s=e[r];if(D.integer(s)&&s>=0)this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=s;else throw D.invalidParameterError(r,"integer",s)},this),Lr(this.options)&&!rr(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function dc(e){if(this.options.trimThreshold=10,D.defined(e))if(D.object(e)){if(D.defined(e.background)&&this._setBackgroundColourOption("trimBackground",e.background),D.defined(e.threshold))if(D.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw D.invalidParameterError("threshold","positive number",e.threshold);D.defined(e.lineArt)&&this._setBooleanOption("trimLineArt",e.lineArt)}else throw D.invalidParameterError("trim","object",e);return Lr(this.options)&&(this.options.rotateBefore=!0),this}si.exports=e=>{Object.assign(e.prototype,{resize:uc,extend:fc,extract:hc,trim:dc}),e.gravity=ei,e.strategy=ri,e.kernel=jr,e.fit=lc,e.position=ti}});var oi=q((Nd,ii)=>{g();var Q=Oe(),Mr={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"};function gc(e){if(!Array.isArray(e))throw Q.invalidParameterError("images to composite","array",e);return this.options.composite=e.map(t=>{if(!Q.object(t))throw Q.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),s={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(Q.defined(t.blend))if(Q.string(Mr[t.blend]))s.blend=Mr[t.blend];else throw Q.invalidParameterError("blend","valid blend name",t.blend);if(Q.defined(t.tile))if(Q.bool(t.tile))s.tile=t.tile;else throw Q.invalidParameterError("tile","boolean",t.tile);if(Q.defined(t.left))if(Q.integer(t.left))s.left=t.left;else throw Q.invalidParameterError("left","integer",t.left);if(Q.defined(t.top))if(Q.integer(t.top))s.top=t.top;else throw Q.invalidParameterError("top","integer",t.top);if(Q.defined(t.top)!==Q.defined(t.left))throw new Error("Expected both left and top to be set");if(s.hasOffset=Q.integer(t.top)&&Q.integer(t.left),Q.defined(t.gravity))if(Q.integer(t.gravity)&&Q.inRange(t.gravity,0,8))s.gravity=t.gravity;else if(Q.string(t.gravity)&&Q.integer(this.constructor.gravity[t.gravity]))s.gravity=this.constructor.gravity[t.gravity];else throw Q.invalidParameterError("gravity","valid gravity",t.gravity);if(Q.defined(t.premultiplied))if(Q.bool(t.premultiplied))s.premultiplied=t.premultiplied;else throw Q.invalidParameterError("premultiplied","boolean",t.premultiplied);return s}),this}ii.exports=e=>{e.prototype.composite=gc,e.blend=Mr}});var fi=q((Td,ui)=>{g();var d=Oe(),ai={integer:"integer",float:"float",approximate:"approximate"};function pc(e,t){if(!d.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0),d.integer(e)&&!(e%90))this.options.angle=e;else if(d.number(e))this.options.rotationAngle=e,d.object(t)&&t.background&&this._setBackgroundColourOption("rotationBackground",t.background);else throw d.invalidParameterError("angle","numeric",e);return this}function mc(){return this.options.input.autoOrient=!0,this}function bc(e){return this.options.flip=d.bool(e)?e:!0,this}function vc(e){return this.options.flop=d.bool(e)?e:!0,this}function yc(e,t){let r=[].concat(...e);if(r.length===4&&r.every(d.number))this.options.affineMatrix=r;else throw d.invalidParameterError("matrix","1x4 or 2x2 array",e);if(d.defined(t))if(d.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),d.defined(t.idx))if(d.number(t.idx))this.options.affineIdx=t.idx;else throw d.invalidParameterError("options.idx","number",t.idx);if(d.defined(t.idy))if(d.number(t.idy))this.options.affineIdy=t.idy;else throw d.invalidParameterError("options.idy","number",t.idy);if(d.defined(t.odx))if(d.number(t.odx))this.options.affineOdx=t.odx;else throw d.invalidParameterError("options.odx","number",t.odx);if(d.defined(t.ody))if(d.number(t.ody))this.options.affineOdy=t.ody;else throw d.invalidParameterError("options.ody","number",t.ody);if(d.defined(t.interpolator))if(d.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw d.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw d.invalidParameterError("options","object",t);return this}function wc(e,t,r){if(!d.defined(e))this.options.sharpenSigma=-1;else if(d.bool(e))this.options.sharpenSigma=e?-1:0;else if(d.number(e)&&d.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,d.defined(t))if(d.number(t)&&d.inRange(t,0,1e4))this.options.sharpenM1=t;else throw d.invalidParameterError("flat","number between 0 and 10000",t);if(d.defined(r))if(d.number(r)&&d.inRange(r,0,1e4))this.options.sharpenM2=r;else throw d.invalidParameterError("jagged","number between 0 and 10000",r)}else if(d.plainObject(e)){if(d.number(e.sigma)&&d.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw d.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(d.defined(e.m1))if(d.number(e.m1)&&d.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw d.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(d.defined(e.m2))if(d.number(e.m2)&&d.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw d.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(d.defined(e.x1))if(d.number(e.x1)&&d.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw d.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(d.defined(e.y2))if(d.number(e.y2)&&d.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw d.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(d.defined(e.y3))if(d.number(e.y3)&&d.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw d.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else throw d.invalidParameterError("sigma","number between 0.01 and 10000",e);return this}function Ec(e){if(!d.defined(e))this.options.medianSize=3;else if(d.integer(e)&&d.inRange(e,1,1e3))this.options.medianSize=e;else throw d.invalidParameterError("size","integer between 1 and 1000",e);return this}function xc(e){let t;if(d.number(e))t=e;else if(d.plainObject(e)){if(!d.number(e.sigma))throw d.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(d.string(ai[e.precision]))this.options.precision=ai[e.precision];else throw d.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(d.number(e.minAmplitude)&&d.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw d.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!d.defined(e))this.options.blurSigma=-1;else if(d.bool(e))this.options.blurSigma=e?-1:0;else if(d.number(t)&&d.inRange(t,.3,1e3))this.options.blurSigma=t;else throw d.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function li(e){if(!d.defined(e))this.options.dilateWidth=1;else if(d.integer(e)&&e>0)this.options.dilateWidth=e;else throw d.invalidParameterError("dilate","positive integer",li);return this}function ci(e){if(!d.defined(e))this.options.erodeWidth=1;else if(d.integer(e)&&e>0)this.options.erodeWidth=e;else throw d.invalidParameterError("erode","positive integer",ci);return this}function Pc(e){return this.options.flatten=d.bool(e)?e:!0,d.object(e)&&this._setBackgroundColourOption("flattenBackground",e.background),this}function Rc(){return this.options.unflatten=!0,this}function Sc(e,t){if(!d.defined(e))this.options.gamma=2.2;else if(d.number(e)&&d.inRange(e,1,3))this.options.gamma=e;else throw d.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!d.defined(t))this.options.gammaOut=this.options.gamma;else if(d.number(t)&&d.inRange(t,1,3))this.options.gammaOut=t;else throw d.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function $c(e){if(this.options.negate=d.bool(e)?e:!0,d.plainObject(e)&&"alpha"in e)if(d.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw d.invalidParameterError("alpha","should be boolean value",e.alpha);return this}function kc(e){if(d.plainObject(e)){if(d.defined(e.lower))if(d.number(e.lower)&&d.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw d.invalidParameterError("lower","number between 0 and 99",e.lower);if(d.defined(e.upper))if(d.number(e.upper)&&d.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw d.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw d.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function Ac(e){return this.normalise(e)}function _c(e){if(d.plainObject(e)){if(d.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw d.invalidParameterError("width","integer greater than zero",e.width);if(d.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw d.invalidParameterError("height","integer greater than zero",e.height);if(d.defined(e.maxSlope))if(d.integer(e.maxSlope)&&d.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw d.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw d.invalidParameterError("options","plain object",e);return this}function Nc(e){if(!d.object(e)||!Array.isArray(e.kernel)||!d.integer(e.width)||!d.integer(e.height)||!d.inRange(e.width,3,1001)||!d.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw new Error("Invalid convolution kernel");return d.integer(e.scale)||(e.scale=e.kernel.reduce((t,r)=>t+r,0)),e.scale<1&&(e.scale=1),d.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function Ic(e,t){if(!d.defined(e))this.options.threshold=128;else if(d.bool(e))this.options.threshold=e?128:0;else if(d.integer(e)&&d.inRange(e,0,255))this.options.threshold=e;else throw d.invalidParameterError("threshold","integer between 0 and 255",e);return!d.object(t)||t.greyscale===!0||t.grayscale===!0?this.options.thresholdGrayscale=!0:this.options.thresholdGrayscale=!1,this}function Tc(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),d.string(t)&&d.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw d.invalidParameterError("operator","one of: and, or, eor",t);return this}function Dc(e,t){if(!d.defined(e)&&d.number(t)?e=1:d.number(e)&&!d.defined(t)&&(t=0),!d.defined(e))this.options.linearA=[];else if(d.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(d.number))this.options.linearA=e;else throw d.invalidParameterError("a","number or array of numbers",e);if(!d.defined(t))this.options.linearB=[];else if(d.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&t.length&&t.every(d.number))this.options.linearB=t;else throw d.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw new Error("Expected a and b to be arrays of the same length");return this}function Cc(e){if(!Array.isArray(e))throw d.invalidParameterError("inputMatrix","array",e);if(e.length!==3&&e.length!==4)throw d.invalidParameterError("inputMatrix","3x3 or 4x4 array",e.length);let t=e.flat().map(Number);if(t.length!==9&&t.length!==16)throw d.invalidParameterError("inputMatrix","cardinality of 9 or 16",t.length);return this.options.recombMatrix=t,this}function Fc(e){if(!d.plainObject(e))throw d.invalidParameterError("options","plain object",e);if("brightness"in e)if(d.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw d.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(d.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw d.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(d.integer(e.hue))this.options.hue=e.hue%360;else throw d.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(d.number(e.lightness))this.options.lightness=e.lightness;else throw d.invalidParameterError("lightness","number",e.lightness);return this}ui.exports=e=>{Object.assign(e.prototype,{autoOrient:mc,rotate:pc,flip:bc,flop:vc,affine:yc,sharpen:wc,erode:ci,dilate:li,median:Ec,blur:xc,flatten:Pc,unflatten:Rc,gamma:Sc,negate:$c,normalise:kc,normalize:Ac,clahe:_c,convolve:Nc,threshold:Ic,boolean:Tc,linear:Dc,recomb:Cc,modulate:Fc})}});var bi=q((Cd,mi)=>{g();var Gr=Object.defineProperty,Oc=Object.getOwnPropertyDescriptor,jc=Object.getOwnPropertyNames,Lc=Object.prototype.hasOwnProperty,Mc=(e,t)=>{for(var r in t)Gr(e,r,{get:t[r],enumerable:!0})},zc=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of jc(t))!Lc.call(e,n)&&n!==r&&Gr(e,n,{get:()=>t[n],enumerable:!(s=Oc(t,n))||s.enumerable});return e},Bc=e=>zc(Gr({},"__esModule",{value:!0}),e),hi={};Mc(hi,{default:()=>tu});mi.exports=Bc(hi);var Be={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},di=Object.create(null);for(let e in Be)Object.hasOwn(Be,e)&&(di[Be[e]]=e);var Pe={to:{},get:{}};Pe.get=function(e){let t=e.slice(0,3).toLowerCase(),r,s;switch(t){case"hsl":{r=Pe.get.hsl(e),s="hsl";break}case"hwb":{r=Pe.get.hwb(e),s="hwb";break}default:{r=Pe.get.rgb(e),s="rgb";break}}return r?{model:s,value:r}:null};Pe.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,s=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,o=[0,0,0,1],a,c,u;if(a=e.match(r)){for(u=a[2],a=a[1],c=0;c<3;c++){let f=c*2;o[c]=Number.parseInt(a.slice(f,f+2),16)}u&&(o[3]=Number.parseInt(u,16)/255)}else if(a=e.match(t)){for(a=a[1],u=a[3],c=0;c<3;c++)o[c]=Number.parseInt(a[c]+a[c],16);u&&(o[3]=Number.parseInt(u+u,16)/255)}else if(a=e.match(s)){for(c=0;c<3;c++)o[c]=Number.parseInt(a[c+1],10);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else if(a=e.match(n)){for(c=0;c<3;c++)o[c]=Math.round(Number.parseFloat(a[c+1])*2.55);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else return(a=e.match(i))?a[1]==="transparent"?[0,0,0,0]:Object.hasOwn(Be,a[1])?(o=Be[a[1]],o[3]=1,o):null:null;for(c=0;c<3;c++)o[c]=rt(o[c],0,255);return o[3]=rt(o[3],0,1),o};Pe.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){let s=Number.parseFloat(r[4]),n=(Number.parseFloat(r[1])%360+360)%360,i=rt(Number.parseFloat(r[2]),0,100),o=rt(Number.parseFloat(r[3]),0,100),a=rt(Number.isNaN(s)?1:s,0,1);return[n,i,o,a]}return null};Pe.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){let s=Number.parseFloat(r[4]),n=(Number.parseFloat(r[1])%360+360)%360,i=rt(Number.parseFloat(r[2]),0,100),o=rt(Number.parseFloat(r[3]),0,100),a=rt(Number.isNaN(s)?1:s,0,1);return[n,i,o,a]}return null};Pe.to.hex=function(...e){return"#"+sr(e[0])+sr(e[1])+sr(e[2])+(e[3]<1?sr(Math.round(e[3]*255)):"")};Pe.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};Pe.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),s=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+s+"%)":"rgba("+t+"%, "+r+"%, "+s+"%, "+e[3]+")"};Pe.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};Pe.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};Pe.to.keyword=function(...e){return di[e.slice(0,3)]};function rt(e,t,r){return Math.min(Math.max(t,e),r)}function sr(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var Et=Pe,gi={};for(let e of Object.keys(Be))gi[Be[e]]=e;var _={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},ht=_,He=(6/29)**3;function Pt(e){let t=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,t),1)}function Rt(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(_)){if(!("channels"in _[e]))throw new Error("missing channels property: "+e);if(!("labels"in _[e]))throw new Error("missing channel labels property: "+e);if(_[e].labels.length!==_[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=_[e];delete _[e].channels,delete _[e].labels,Object.defineProperty(_[e],"channels",{value:t}),Object.defineProperty(_[e],"labels",{value:r})}_.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.min(t,r,s),i=Math.max(t,r,s),o=i-n,a,c;switch(i){case n:{a=0;break}case t:{a=(r-s)/o;break}case r:{a=2+(s-t)/o;break}case s:{a=4+(t-r)/o;break}}a=Math.min(a*60,360),a<0&&(a+=360);let u=(n+i)/2;return i===n?c=0:u<=.5?c=o/(i+n):c=o/(2-i-n),[a,c*100,u*100]};_.rgb.hsv=function(e){let t,r,s,n,i,o=e[0]/255,a=e[1]/255,c=e[2]/255,u=Math.max(o,a,c),f=u-Math.min(o,a,c),b=function(m){return(u-m)/6/f+1/2};if(f===0)n=0,i=0;else{switch(i=f/u,t=b(o),r=b(a),s=b(c),u){case o:{n=s-r;break}case a:{n=1/3+t-s;break}case c:{n=2/3+r-t;break}}n<0?n+=1:n>1&&(n-=1)}return[n*360,i*100,u*100]};_.rgb.hwb=function(e){let t=e[0],r=e[1],s=e[2],n=_.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(r,s));return s=1-1/255*Math.max(t,Math.max(r,s)),[n,i*100,s*100]};_.rgb.oklab=function(e){let t=Rt(e[0]/255),r=Rt(e[1]/255),s=Rt(e[2]/255),n=Math.cbrt(.4122214708*t+.5363325363*r+.0514459929*s),i=Math.cbrt(.2119034982*t+.6806995451*r+.1073969566*s),o=Math.cbrt(.0883024619*t+.2817188376*r+.6299787005*s),a=.2104542553*n+.793617785*i-.0040720468*o,c=1.9779984951*n-2.428592205*i+.4505937099*o,u=.0259040371*n+.7827717662*i-.808675766*o;return[a*100,c*100,u*100]};_.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.min(1-t,1-r,1-s),i=(1-t-n)/(1-n)||0,o=(1-r-n)/(1-n)||0,a=(1-s-n)/(1-n)||0;return[i*100,o*100,a*100,n*100]};function Uc(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}_.rgb.keyword=function(e){let t=gi[e];if(t)return t;let r=Number.POSITIVE_INFINITY,s;for(let n of Object.keys(Be)){let i=Be[n],o=Uc(e,i);o<r&&(r=o,s=n)}return s};_.keyword.rgb=function(e){return Be[e]};_.rgb.xyz=function(e){let t=Rt(e[0]/255),r=Rt(e[1]/255),s=Rt(e[2]/255),n=t*.4124564+r*.3575761+s*.1804375,i=t*.2126729+r*.7151522+s*.072175,o=t*.0193339+r*.119192+s*.9503041;return[n*100,i*100,o*100]};_.rgb.lab=function(e){let t=_.rgb.xyz(e),r=t[0],s=t[1],n=t[2];r/=95.047,s/=100,n/=108.883,r=r>He?r**(1/3):7.787*r+16/116,s=s>He?s**(1/3):7.787*s+16/116,n=n>He?n**(1/3):7.787*n+16/116;let i=116*s-16,o=500*(r-s),a=200*(s-n);return[i,o,a]};_.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100,n,i;if(r===0)return i=s*255,[i,i,i];let o=s<.5?s*(1+r):s+r-s*r,a=2*s-o,c=[0,0,0];for(let u=0;u<3;u++)n=t+1/3*-(u-1),n<0&&n++,n>1&&n--,6*n<1?i=a+(o-a)*6*n:2*n<1?i=o:3*n<2?i=a+(o-a)*(2/3-n)*6:i=a,c[u]=i*255;return c};_.hsl.hsv=function(e){let t=e[0],r=e[1]/100,s=e[2]/100,n=r,i=Math.max(s,.01);s*=2,r*=s<=1?s:2-s,n*=i<=1?i:2-i;let o=(s+r)/2,a=s===0?2*n/(i+n):2*r/(s+r);return[t,a*100,o*100]};_.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,s=e[2]/100,n=Math.floor(t)%6,i=t-Math.floor(t),o=255*s*(1-r),a=255*s*(1-r*i),c=255*s*(1-r*(1-i));switch(s*=255,n){case 0:return[s,c,o];case 1:return[a,s,o];case 2:return[o,s,c];case 3:return[o,a,s];case 4:return[c,o,s];case 5:return[s,o,a]}};_.hsv.hsl=function(e){let t=e[0],r=e[1]/100,s=e[2]/100,n=Math.max(s,.01),i,o;o=(2-r)*s;let a=(2-r)*n;return i=r*n,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};_.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100,n=r+s,i;n>1&&(r/=n,s/=n);let o=Math.floor(6*t),a=1-s;i=6*t-o,(o&1)!==0&&(i=1-i);let c=r+i*(a-r),u,f,b;switch(o){default:case 6:case 0:{u=a,f=c,b=r;break}case 1:{u=c,f=a,b=r;break}case 2:{u=r,f=a,b=c;break}case 3:{u=r,f=c,b=a;break}case 4:{u=c,f=r,b=a;break}case 5:{u=a,f=r,b=c;break}}return[u*255,f*255,b*255]};_.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=e[3]/100,i=1-Math.min(1,t*(1-n)+n),o=1-Math.min(1,r*(1-n)+n),a=1-Math.min(1,s*(1-n)+n);return[i*255,o*255,a*255]};_.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n,i,o;return n=t*3.2404542+r*-1.5371385+s*-.4985314,i=t*-.969266+r*1.8760108+s*.041556,o=t*.0556434+r*-.2040259+s*1.0572252,n=Pt(n),i=Pt(i),o=Pt(o),[n*255,i*255,o*255]};_.xyz.lab=function(e){let t=e[0],r=e[1],s=e[2];t/=95.047,r/=100,s/=108.883,t=t>He?t**(1/3):7.787*t+16/116,r=r>He?r**(1/3):7.787*r+16/116,s=s>He?s**(1/3):7.787*s+16/116;let n=116*r-16,i=500*(t-r),o=200*(r-s);return[n,i,o]};_.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=Math.cbrt(.8189330101*t+.3618667424*r-.1288597137*s),i=Math.cbrt(.0329845436*t+.9293118715*r+.0361456387*s),o=Math.cbrt(.0482003018*t+.2643662691*r+.633851707*s),a=.2104542553*n+.793617785*i-.0040720468*o,c=1.9779984951*n-2.428592205*i+.4505937099*o,u=.0259040371*n+.7827717662*i-.808675766*o;return[a*100,c*100,u*100]};_.oklab.oklch=function(e){return _.lab.lch(e)};_.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=(.999999998*t+.396337792*r+.215803758*s)**3,i=(1.000000008*t-.105561342*r-.063854175*s)**3,o=(1.000000055*t-.089484182*r-1.291485538*s)**3,a=1.227013851*n-.55779998*i+.281256149*o,c=-.040580178*n+1.11225687*i-.071676679*o,u=-.076381285*n-.421481978*i+1.58616322*o;return[a*100,c*100,u*100]};_.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=(t+.3963377774*r+.2158037573*s)**3,i=(t-.1055613458*r-.0638541728*s)**3,o=(t-.0894841775*r-1.291485548*s)**3,a=Pt(4.0767416621*n-3.3077115913*i+.2309699292*o),c=Pt(-1.2684380046*n+2.6097574011*i-.3413193965*o),u=Pt(-.0041960863*n-.7034186147*i+1.707614701*o);return[a*255,c*255,u*255]};_.oklch.oklab=function(e){return _.lch.lab(e)};_.lab.xyz=function(e){let t=e[0],r=e[1],s=e[2],n,i,o;i=(t+16)/116,n=r/500+i,o=i-s/200;let a=i**3,c=n**3,u=o**3;return i=a>He?a:(i-16/116)/7.787,n=c>He?c:(n-16/116)/7.787,o=u>He?u:(o-16/116)/7.787,n*=95.047,i*=100,o*=108.883,[n,i,o]};_.lab.lch=function(e){let t=e[0],r=e[1],s=e[2],n;n=Math.atan2(s,r)*360/2/Math.PI,n<0&&(n+=360);let o=Math.sqrt(r*r+s*s);return[t,o,n]};_.lch.lab=function(e){let t=e[0],r=e[1],n=e[2]/360*2*Math.PI,i=r*Math.cos(n),o=r*Math.sin(n);return[t,i,o]};_.rgb.ansi16=function(e,t=null){let[r,s,n]=e,i=t===null?_.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(n/255)<<2|Math.round(s/255)<<1|Math.round(r/255));return i===2&&(o+=60),o};_.hsv.ansi16=function(e){return _.rgb.ansi16(_.hsv.rgb(e),e[2])};_.rgb.ansi256=function(e){let t=e[0],r=e[1],s=e[2];return t>>4===r>>4&&r>>4===s>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5)};_.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let r=(Math.trunc(e>50)+1)*.5,s=(t&1)*r*255,n=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[s,n,i]};_.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,s=Math.floor((t=e%36)/6)/5*255,n=t%6/5*255;return[r,s,n]};_.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};_.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=[...r].map(a=>a+a).join(""));let s=Number.parseInt(r,16),n=s>>16&255,i=s>>8&255,o=s&255;return[n,i,o]};_.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.max(Math.max(t,r),s),i=Math.min(Math.min(t,r),s),o=n-i,a,c=o<1?i/(1-o):0;return o<=0?a=0:n===t?a=(r-s)/o%6:n===r?a=2+(s-t)/o:a=4+(t-r)/o,a/=6,a%=1,[a*360,o*100,c*100]};_.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,s=r<.5?2*t*r:2*t*(1-r),n=0;return s<1&&(n=(r-.5*s)/(1-s)),[e[0],s*100,n*100]};_.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,s=t*r,n=0;return s<1&&(n=(r-s)/(1-s)),[e[0],s*100,n*100]};_.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100;if(r===0)return[s*255,s*255,s*255];let n=[0,0,0],i=t%1*6,o=i%1,a=1-o,c=0;switch(Math.floor(i)){case 0:{n[0]=1,n[1]=o,n[2]=0;break}case 1:{n[0]=a,n[1]=1,n[2]=0;break}case 2:{n[0]=0,n[1]=1,n[2]=o;break}case 3:{n[0]=0,n[1]=a,n[2]=1;break}case 4:{n[0]=o,n[1]=0,n[2]=1;break}default:n[0]=1,n[1]=0,n[2]=a}return c=(1-r)*s,[(r*n[0]+c)*255,(r*n[1]+c)*255,(r*n[2]+c)*255]};_.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,s=t+r*(1-t),n=0;return s>0&&(n=t/s),[e[0],n*100,s*100]};_.hcg.hsl=function(e){let t=e[1]/100,s=e[2]/100*(1-t)+.5*t,n=0;return s>0&&s<.5?n=t/(2*s):s>=.5&&s<1&&(n=t/(2*(1-s))),[e[0],n*100,s*100]};_.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,s=t+r*(1-t);return[e[0],(s-t)*100,(1-s)*100]};_.hwb.hcg=function(e){let t=e[1]/100,s=1-e[2]/100,n=s-t,i=0;return n<1&&(i=(s-n)/(1-n)),[e[0],n*100,i*100]};_.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};_.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};_.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};_.gray.hsl=function(e){return[0,0,e[0]]};_.gray.hsv=_.gray.hsl;_.gray.hwb=function(e){return[0,100,e[0]]};_.gray.cmyk=function(e){return[0,0,0,e[0]]};_.gray.lab=function(e){return[e[0],0,0]};_.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,s=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(s.length)+s};_.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function Gc(){let e={},t=Object.keys(ht);for(let{length:r}=t,s=0;s<r;s++)e[t[s]]={distance:-1,parent:null};return e}function qc(e){let t=Gc(),r=[e];for(t[e].distance=0;r.length>0;){let s=r.pop(),n=Object.keys(ht[s]);for(let{length:i}=n,o=0;o<i;o++){let a=n[o],c=t[a];c.distance===-1&&(c.distance=t[s].distance+1,c.parent=s,r.unshift(a))}}return t}function Wc(e,t){return function(r){return t(e(r))}}function Hc(e,t){let r=[t[e].parent,e],s=ht[t[e].parent][e],n=t[e].parent;for(;t[n].parent;)r.unshift(t[n].parent),s=Wc(ht[t[n].parent][n],s),n=t[n].parent;return s.conversion=r,s}function Vc(e){let t=qc(e),r={},s=Object.keys(t);for(let{length:n}=s,i=0;i<n;i++){let o=s[i];t[o].parent!==null&&(r[o]=Hc(o,t))}return r}var Jc=Vc,xt={},Xc=Object.keys(ht);function Kc(e){let t=function(...r){let s=r[0];return s==null?s:(s.length>1&&(r=s),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function Yc(e){let t=function(...r){let s=r[0];if(s==null)return s;s.length>1&&(r=s);let n=e(r);if(typeof n=="object")for(let{length:i}=n,o=0;o<i;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}for(let e of Xc){xt[e]={},Object.defineProperty(xt[e],"channels",{value:ht[e].channels}),Object.defineProperty(xt[e],"labels",{value:ht[e].labels});let t=Jc(e),r=Object.keys(t);for(let s of r){let n=t[s];xt[e][s]=Yc(n),xt[e][s].raw=Kc(n)}}var Se=xt,pi=["keyword","gray","hex"],zr={};for(let e of Object.keys(Se))zr[[...Se[e].labels].sort().join("")]=e;var Br={};function he(e,t){if(!(this instanceof he))return new he(e,t);if(t&&t in pi&&(t=null),t&&!(t in Se))throw new Error("Unknown model: "+t);let r,s;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof he)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){let n=Et.get(e);if(n===null)throw new Error("Unable to parse color from string: "+e);this.model=n.model,s=Se[this.model].channels,this.color=n.value.slice(0,s),this.valpha=typeof n.value[s]=="number"?n.value[s]:1}else if(e.length>0){this.model=t||"rgb",s=Se[this.model].channels;let n=Array.prototype.slice.call(e,0,s);this.color=Ur(n,s),this.valpha=typeof e[s]=="number"?e[s]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let n=Object.keys(e);"alpha"in e&&(n.splice(n.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);let i=n.sort().join("");if(!(i in zr))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=zr[i];let{labels:o}=Se[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=Ur(a)}if(Br[this.model])for(s=Se[this.model].channels,r=0;r<s;r++){let n=Br[this.model][r];n&&(this.color[r]=n(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}he.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in Et.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return Et.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e=="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return Et.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=Se[this.model],{labels:r}=Se[this.model];for(let s=0;s<t;s++)e[r[s]]=this.color[s];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new he([...this.color.map(Zc(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new he([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:oe("rgb",0,ce(255)),green:oe("rgb",1,ce(255)),blue:oe("rgb",2,ce(255)),hue:oe(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:oe("hsl",1,ce(100)),lightness:oe("hsl",2,ce(100)),saturationv:oe("hsv",1,ce(100)),value:oe("hsv",2,ce(100)),chroma:oe("hcg",1,ce(100)),gray:oe("hcg",2,ce(100)),white:oe("hwb",1,ce(100)),wblack:oe("hwb",2,ce(100)),cyan:oe("cmyk",0,ce(100)),magenta:oe("cmyk",1,ce(100)),yellow:oe("cmyk",2,ce(100)),black:oe("cmyk",3,ce(100)),x:oe("xyz",0,ce(95.047)),y:oe("xyz",1,ce(100)),z:oe("xyz",2,ce(108.833)),l:oe("lab",0,ce(100)),a:oe("lab",1),b:oe("lab",2),keyword(e){return e!==void 0?new he(e):Se[this.model].keyword(this.color)},hex(e){return e!==void 0?new he(e):Et.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new he(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();return r.length===1&&(r="0"+r),Et.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,s]of e.entries()){let n=s/255;t[r]=n<=.04045?n/12.92:((n+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return he.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),s=this.rgb(),n=t===void 0?.5:t,i=2*n-1,o=r.alpha()-s.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,c=1-a;return he.rgb(a*r.red()+c*s.red(),a*r.green()+c*s.green(),a*r.blue()+c*s.blue(),r.alpha()*n+s.alpha()*(1-n))}};for(let e of Object.keys(Se)){if(pi.includes(e))continue;let{channels:t}=Se[e];he.prototype[e]=function(...r){return this.model===e?new he(this):r.length>0?new he(r,e):new he([...eu(Se[this.model][e].raw(this.color)),this.valpha],e)},he[e]=function(...r){let s=r[0];return typeof s=="number"&&(s=Ur(r,t)),new he(s,e)}}function Qc(e,t){return Number(e.toFixed(t))}function Zc(e){return function(t){return Qc(t,e)}}function oe(e,t,r){e=Array.isArray(e)?e:[e];for(let s of e)(Br[s]||=[])[t]=r;return e=e[0],function(s){let n;return s!==void 0?(r&&(s=r(s)),n=this[e](),n.color[t]=s,n):(n=this[e]().color[t],r&&(n=r(n)),n)}}function ce(e){return function(t){return Math.max(0,Math.min(e,t))}}function eu(e){return Array.isArray(e)?e:[e]}function Ur(e,t){for(let r=0;r<t;r++)typeof e[r]!="number"&&(e[r]=0);return e}var tu=he});var yi=q((Od,vi)=>{g();vi.exports=bi().default});var Pi=q((Ld,xi)=>{g();var ru=yi(),Ve=Oe(),wi={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function su(e){return this._setBackgroundColourOption("tint",e),this}function nu(e){return this.options.greyscale=Ve.bool(e)?e:!0,this}function iu(e){return this.greyscale(e)}function ou(e){if(!Ve.string(e))throw Ve.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function au(e){return this.pipelineColourspace(e)}function lu(e){if(!Ve.string(e))throw Ve.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function cu(e){return this.toColourspace(e)}function Ei(e){if(Ve.object(e)||Ve.string(e)&&e.length>=3&&e.length<=200){let t=ru(e);return[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}else throw Ve.invalidParameterError("background","object or string",e)}function uu(e,t){Ve.defined(t)&&(this.options[e]=Ei(t))}xi.exports=e=>{Object.assign(e.prototype,{tint:su,greyscale:nu,grayscale:iu,pipelineColourspace:ou,pipelineColorspace:au,toColourspace:lu,toColorspace:cu,_getBackgroundColourOption:Ei,_setBackgroundColourOption:uu}),e.colourspace=wi,e.colorspace=wi}});var Si=q((zd,Ri)=>{g();var Ue=Oe(),fu={and:"and",or:"or",eor:"eor"};function hu(){return this.options.removeAlpha=!0,this}function du(e){if(Ue.defined(e))if(Ue.number(e)&&Ue.inRange(e,0,1))this.options.ensureAlpha=e;else throw Ue.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function gu(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e)&&(e=t[e]),Ue.integer(e)&&Ue.inRange(e,0,4))this.options.extractChannel=e;else throw Ue.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function pu(e,t){return Array.isArray(e)?e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this):this.options.joinChannelIn.push(this._createInputDescriptor(e,t)),this}function mu(e){if(Ue.string(e)&&Ue.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw Ue.invalidParameterError("boolOp","one of: and, or, eor",e);return this}Ri.exports=e=>{Object.assign(e.prototype,{removeAlpha:hu,ensureAlpha:du,extractChannel:gu,joinChannel:pu,bandbool:mu}),e.bool=fu}});var Ni=q((Ud,_i)=>{g();var qr=ie("node:path"),l=Oe(),St=Ct(),$i=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),bu=/\.(jp[2x]|j2[kc])$/i,ki=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),Ai=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function vu(e,t){let r;if(l.string(e)?l.string(this.options.input.file)&&qr.resolve(this.options.input.file)===qr.resolve(e)?r=new Error("Cannot use same file for input and output"):bu.test(qr.extname(e))&&!this.constructor.format.jp2k.output.file&&(r=ki()):r=new Error("Missing output file path"),r)if(l.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let s=Error();return this._pipeline(t,s)}return this}function yu(e,t){l.object(e)?this._setBooleanOption("resolveWithObject",e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut="";let r=Error();return this._pipeline(l.fn(e)?e:t,r)}function wu(){return this.options.keepMetadata|=1,this}function Eu(e){if(l.object(e))for(let[t,r]of Object.entries(e))if(l.object(r))for(let[s,n]of Object.entries(r))if(l.string(n))this.options.withExif[`exif-${t.toLowerCase()}-${s}`]=n;else throw l.invalidParameterError(`${t}.${s}`,"string",n);else throw l.invalidParameterError(t,"object",r);else throw l.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function xu(e){return this.withExif(e),this.options.withExifMerge=!0,this}function Pu(){return this.options.keepMetadata|=8,this}function Ru(e,t){if(l.string(e))this.options.withIccProfile=e;else throw l.invalidParameterError("icc","string",e);if(this.keepIccProfile(),l.object(t)&&l.defined(t.attach))if(l.bool(t.attach))t.attach||(this.options.keepMetadata&=-9);else throw l.invalidParameterError("attach","boolean",t.attach);return this}function Su(){return this.options.keepMetadata|=2,this}function $u(e){if(l.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw l.invalidParameterError("xmp","non-empty string",e);return this}function ku(){return this.options.keepMetadata=31,this}function Au(e){if(this.keepMetadata(),this.withIccProfile("srgb"),l.object(e)){if(l.defined(e.orientation))if(l.integer(e.orientation)&&l.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw l.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(l.defined(e.density))if(l.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw l.invalidParameterError("density","positive number",e.density);l.defined(e.icc)&&this.withIccProfile(e.icc),l.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function _u(e,t){let r=$i.get((l.object(e)&&l.string(e.id)?e.id:e).toLowerCase());if(!r)throw l.invalidParameterError("format",`one of: ${[...$i.keys()].join(", ")}`,e);return this[r](t)}function Nu(e){if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.progressive)&&this._setBooleanOption("jpegProgressive",e.progressive),l.defined(e.chromaSubsampling))if(l.string(e.chromaSubsampling)&&l.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw l.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=l.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(l.defined(t)&&this._setBooleanOption("jpegOptimiseCoding",t),l.defined(e.mozjpeg))if(l.bool(e.mozjpeg))e.mozjpeg&&(this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3);else throw l.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=l.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;l.defined(r)&&this._setBooleanOption("jpegTrellisQuantisation",r),l.defined(e.overshootDeringing)&&this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let s=l.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;l.defined(s)&&(this._setBooleanOption("jpegOptimiseScans",s),s&&(this.options.jpegProgressive=!0));let n=l.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(l.defined(n))if(l.integer(n)&&l.inRange(n,0,8))this.options.jpegQuantisationTable=n;else throw l.invalidParameterError("quantisationTable","integer between 0 and 8",n)}return this._updateFormatOut("jpeg",e)}function Iu(e){if(l.object(e)){if(l.defined(e.progressive)&&this._setBooleanOption("pngProgressive",e.progressive),l.defined(e.compressionLevel))if(l.integer(e.compressionLevel)&&l.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw l.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);l.defined(e.adaptiveFiltering)&&this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(l.defined(t))if(l.integer(t)&&l.inRange(t,2,256))this.options.pngBitdepth=Ai(t);else throw l.invalidParameterError("colours","integer between 2 and 256",t);if(l.defined(e.palette)?this._setBooleanOption("pngPalette",e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(l.defined)&&this._setBooleanOption("pngPalette",!0),this.options.pngPalette){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw l.invalidParameterError("quality","integer between 0 and 100",e.quality);if(l.defined(e.effort))if(l.integer(e.effort)&&l.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw l.invalidParameterError("effort","integer between 1 and 10",e.effort);if(l.defined(e.dither))if(l.number(e.dither)&&l.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw l.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function Tu(e){if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.alphaQuality))if(l.integer(e.alphaQuality)&&l.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw l.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(l.defined(e.lossless)&&this._setBooleanOption("webpLossless",e.lossless),l.defined(e.nearLossless)&&this._setBooleanOption("webpNearLossless",e.nearLossless),l.defined(e.smartSubsample)&&this._setBooleanOption("webpSmartSubsample",e.smartSubsample),l.defined(e.smartDeblock)&&this._setBooleanOption("webpSmartDeblock",e.smartDeblock),l.defined(e.preset))if(l.string(e.preset)&&l.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw l.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(l.defined(e.effort))if(l.integer(e.effort)&&l.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw l.invalidParameterError("effort","integer between 0 and 6",e.effort);l.defined(e.minSize)&&this._setBooleanOption("webpMinSize",e.minSize),l.defined(e.mixed)&&this._setBooleanOption("webpMixed",e.mixed)}return Wr(e,this.options),this._updateFormatOut("webp",e)}function Du(e){if(l.object(e)){l.defined(e.reuse)&&this._setBooleanOption("gifReuse",e.reuse),l.defined(e.progressive)&&this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(l.defined(t))if(l.integer(t)&&l.inRange(t,2,256))this.options.gifBitdepth=Ai(t);else throw l.invalidParameterError("colours","integer between 2 and 256",t);if(l.defined(e.effort))if(l.number(e.effort)&&l.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw l.invalidParameterError("effort","integer between 1 and 10",e.effort);if(l.defined(e.dither))if(l.number(e.dither)&&l.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw l.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(l.defined(e.interFrameMaxError))if(l.number(e.interFrameMaxError)&&l.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw l.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(l.defined(e.interPaletteMaxError))if(l.number(e.interPaletteMaxError)&&l.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw l.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(l.defined(e.keepDuplicateFrames))if(l.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw l.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Wr(e,this.options),this._updateFormatOut("gif",e)}function Cu(e){if(!this.constructor.format.jp2k.output.buffer)throw ki();if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.lossless))if(l.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw l.invalidParameterError("lossless","boolean",e.lossless);if(l.defined(e.tileWidth))if(l.integer(e.tileWidth)&&l.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw l.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(l.defined(e.tileHeight))if(l.integer(e.tileHeight)&&l.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw l.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(l.defined(e.chromaSubsampling))if(l.string(e.chromaSubsampling)&&l.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw l.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Wr(e,t){if(l.object(e)&&l.defined(e.loop))if(l.integer(e.loop)&&l.inRange(e.loop,0,65535))t.loop=e.loop;else throw l.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(l.object(e)&&l.defined(e.delay))if(l.integer(e.delay)&&l.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(l.integer)&&e.delay.every(r=>l.inRange(r,0,65535)))t.delay=e.delay;else throw l.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function Fu(e){if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.bitdepth))if(l.integer(e.bitdepth)&&l.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw l.invalidParameterError("bitdepth","1, 2, 4 or 8",e.bitdepth);if(l.defined(e.tile)&&this._setBooleanOption("tiffTile",e.tile),l.defined(e.tileWidth))if(l.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw l.invalidParameterError("tileWidth","integer greater than zero",e.tileWidth);if(l.defined(e.tileHeight))if(l.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw l.invalidParameterError("tileHeight","integer greater than zero",e.tileHeight);if(l.defined(e.miniswhite)&&this._setBooleanOption("tiffMiniswhite",e.miniswhite),l.defined(e.pyramid)&&this._setBooleanOption("tiffPyramid",e.pyramid),l.defined(e.xres))if(l.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw l.invalidParameterError("xres","number greater than zero",e.xres);if(l.defined(e.yres))if(l.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw l.invalidParameterError("yres","number greater than zero",e.yres);if(l.defined(e.compression))if(l.string(e.compression)&&l.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw l.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(l.defined(e.bigtiff)&&this._setBooleanOption("tiffBigtiff",e.bigtiff),l.defined(e.predictor))if(l.string(e.predictor)&&l.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw l.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(l.defined(e.resolutionUnit))if(l.string(e.resolutionUnit)&&l.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw l.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function Ou(e){return this.heif({...e,compression:"av1"})}function ju(e){if(l.object(e)){if(l.string(e.compression)&&l.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw l.invalidParameterError("compression","one of: av1, hevc",e.compression);if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.lossless))if(l.bool(e.lossless))this.options.heifLossless=e.lossless;else throw l.invalidParameterError("lossless","boolean",e.lossless);if(l.defined(e.effort))if(l.integer(e.effort)&&l.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw l.invalidParameterError("effort","integer between 0 and 9",e.effort);if(l.defined(e.chromaSubsampling))if(l.string(e.chromaSubsampling)&&l.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw l.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(l.defined(e.bitdepth))if(l.integer(e.bitdepth)&&l.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw l.invalidParameterError("bitdepth when using prebuilt binaries",8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw l.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth)}else throw l.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function Lu(e){if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?.1+(100-e.quality)*.09:53/3e3*e.quality*e.quality-23/20*e.quality+25;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(l.defined(e.distance))if(l.number(e.distance)&&l.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw l.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(l.defined(e.decodingTier))if(l.integer(e.decodingTier)&&l.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw l.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(l.defined(e.lossless))if(l.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw l.invalidParameterError("lossless","boolean",e.lossless);if(l.defined(e.effort))if(l.integer(e.effort)&&l.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw l.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Wr(e,this.options),this._updateFormatOut("jxl",e)}function Mu(e){if(l.object(e)&&l.defined(e.depth))if(l.string(e.depth)&&l.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw l.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth);return this._updateFormatOut("raw")}function zu(e){if(l.object(e)){if(l.defined(e.size))if(l.integer(e.size)&&l.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw l.invalidParameterError("size","integer between 1 and 8192",e.size);if(l.defined(e.overlap))if(l.integer(e.overlap)&&l.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw l.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw l.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(l.defined(e.container))if(l.string(e.container)&&l.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw l.invalidParameterError("container","one of: fs, zip",e.container);if(l.defined(e.layout))if(l.string(e.layout)&&l.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw l.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(l.defined(e.angle))if(l.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw l.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),l.defined(e.depth))if(l.string(e.depth)&&l.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw l.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(l.defined(e.skipBlanks))if(l.integer(e.skipBlanks)&&l.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw l.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else l.defined(e.layout)&&e.layout==="google"&&(this.options.tileSkipBlanks=5);let t=l.bool(e.center)?e.center:e.centre;if(l.defined(t)&&this._setBooleanOption("tileCentre",t),l.defined(e.id))if(l.string(e.id))this.options.tileId=e.id;else throw l.invalidParameterError("id","string",e.id);if(l.defined(e.basename))if(l.string(e.basename))this.options.tileBasename=e.basename;else throw l.invalidParameterError("basename","string",e.basename)}if(l.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw l.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function Bu(e){if(!l.plainObject(e))throw l.invalidParameterError("options","object",e);if(l.integer(e.seconds)&&l.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw l.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function Uu(e,t){return l.object(t)&&t.force===!1||(this.options.formatOut=e),this}function Gu(e,t){if(l.bool(t))this.options[e]=t;else throw l.invalidParameterError(e,"boolean",t)}function qu(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function Wu(e,t){return typeof e=="function"?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),St.pipeline(this.options,(r,s,n)=>{r?e(l.nativeError(r,t)):e(null,s,n)})}):St.pipeline(this.options,(r,s,n)=>{r?e(l.nativeError(r,t)):e(null,s,n)}),this):this.options.streamOut?(this._isStreamInput()?(this.once("finish",()=>{this._flattenBufferIn(),St.pipeline(this.options,(r,s,n)=>{r?this.emit("error",l.nativeError(r,t)):(this.emit("info",n),this.push(s)),this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished&&this.emit("finish")):St.pipeline(this.options,(r,s,n)=>{r?this.emit("error",l.nativeError(r,t)):(this.emit("info",n),this.push(s)),this.push(null),this.on("end",()=>this.emit("close"))}),this):this._isStreamInput()?new Promise((r,s)=>{this.once("finish",()=>{this._flattenBufferIn(),St.pipeline(this.options,(n,i,o)=>{n?s(l.nativeError(n,t)):this.options.resolveWithObject?r({data:i,info:o}):r(i)})})}):new Promise((r,s)=>{St.pipeline(this.options,(n,i,o)=>{n?s(l.nativeError(n,t)):this.options.resolveWithObject?r({data:i,info:o}):r(i)})})}_i.exports=e=>{Object.assign(e.prototype,{toFile:vu,toBuffer:yu,keepExif:wu,withExif:Eu,withExifMerge:xu,keepIccProfile:Pu,withIccProfile:Ru,keepXmp:Su,withXmp:$u,keepMetadata:ku,withMetadata:Au,toFormat:_u,jpeg:Nu,jp2:Cu,png:Iu,webp:Tu,tiff:Fu,avif:Ou,heif:ju,jxl:Lu,gif:Du,raw:Mu,tile:zu,timeout:Bu,_updateFormatOut:Uu,_setBooleanOption:Gu,_read:qu,_pipeline:Wu})}});var Ci=q((qd,Di)=>{g();var Hu=ie("node:events"),nr=Wt(),Ne=Oe(),{runtimePlatformArch:Vu}=Cr(),xe=Ct(),Ii=Vu(),Hr=xe.libvipsVersion(),st=xe.format();st.heif.output.alias=["avif","heic"];st.jpeg.output.alias=["jpe","jpg"];st.tiff.output.alias=["tif"];st.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var Ju={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},$t={vips:Hr.semver};if(!Hr.isGlobal)if(Hr.isWasm)try{$t=ie("@img/sharp-wasm32/versions")}catch{}else try{$t=ie(`@img/sharp-${Ii}/versions`)}catch{try{$t=ie(`@img/sharp-libvips-${Ii}/versions`)}catch{}}$t.sharp=Tr().version;$t.heif&&st.heif&&(st.heif.input.fileSuffix=[".avif"],st.heif.output.alias=["avif"]);function Ti(e){return Ne.bool(e)?e?xe.cache(50,20,100):xe.cache(0,0,0):Ne.object(e)?xe.cache(e.memory,e.files,e.items):xe.cache()}Ti(!0);function Xu(e){return xe.concurrency(Ne.integer(e)?e:null)}nr.familySync()===nr.GLIBC&&!xe._isUsingJemalloc()?xe.concurrency(1):nr.familySync()===nr.MUSL&&xe.concurrency()===1024&&xe.concurrency(ie("node:os").availableParallelism());var Ku=new Hu.EventEmitter;function Yu(){return xe.counters()}function Qu(e){return xe.simd(Ne.bool(e)?e:null)}function Zu(e){if(Ne.object(e))if(Array.isArray(e.operation)&&e.operation.every(Ne.string))xe.block(e.operation,!0);else throw Ne.invalidParameterError("operation","Array<string>",e.operation);else throw Ne.invalidParameterError("options","object",e)}function ef(e){if(Ne.object(e))if(Array.isArray(e.operation)&&e.operation.every(Ne.string))xe.block(e.operation,!1);else throw Ne.invalidParameterError("operation","Array<string>",e.operation);else throw Ne.invalidParameterError("options","object",e)}Di.exports=e=>{e.cache=Ti,e.concurrency=Xu,e.counters=Yu,e.simd=Qu,e.format=st,e.interpolators=Ju,e.versions=$t,e.queue=Ku,e.block=Zu,e.unblock=ef}});var Oi=q((Vd,Fi)=>{g();var Je=Xn();Qn()(Je);ni()(Je);oi()(Je);fi()(Je);Pi()(Je);Si()(Je);Ni()(Je);Ci()(Je);Fi.exports=Je});g();g();g();import $o from"@rollup/plugin-strip";import{visualizer as ko}from"rollup-plugin-visualizer";g();var br=["/react/","/react-dom/","/scheduler/","/react-router","/@radix-ui/","/react-day-picker/","/react-hook-form/","/react-i18next/","/clsx/","/class-variance-authority/"],po={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 mo(e){let t=e.match(/(?:^|\0)virtual:([^?]+)/);if(t)return t[1]}function rs(e){let t=e.replace(/\\/g,"/");if(t.includes("/node_modules/"))return t.split("?")[0]}function ss(e,t=br){return t.some(r=>e.includes(r))}function bo(e){for(let[t,r]of Object.entries(po))if(r.some(s=>e.includes(s)))return t}function vo(e){let t=mo(e);if(t)return t==="i18n-mapping"?"virtual-i18n-mapping":"virtual-modules";let r=rs(e);if(!r)return;if(ss(r))return"react-core";let s=bo(r);if(s)return s}function yo(e=[]){let t=e.filter(s=>!br.includes(s)),r=[...br,...t];return function(s){let n=rs(s);if(n&&ss(n,r))return"react-core"}}var ts={development:{manualChunks:void 0},production:{manualChunks:vo}};function ns(e,t={}){let r=ts[e]||ts.production,s=t.reactCore||[];return s.length>0?{manualChunks:yo(s)}:r}g();import*as Re from"@clack/prompts";g();import{createRequire as wo}from"node:module";import{resolve as zt,join as qe,dirname as Qe,relative as is,normalize as Eo,sep as os,extname as xo}from"node:path";import{fileURLToPath as Po}from"node:url";import*as W from"node:fs";ge();import Ro from"fast-glob";var pt={getGlobOptionsFor:Mt||void 0,SCAN_PATTERNS:ke||void 0,getPatternsFor:es||void 0,I18N_PATHS:Lt||void 0},fe={error:(e,t)=>{},warn:(e,t)=>{},info:e=>{}};function as(e,t){return e().catch(r=>{throw new Error(`${t}: ${r instanceof Error?r.message:String(r)}`)})}var ls={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"},ne=class e{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(t={}){return e._instance||(e._instance=new e(t)),e._instance}static _reset(){e._instance=null}constructor(t={}){if(e._instance)return e._instance;this.options={maxLevels:t.maxLevels??10,customMarkers:t.customMarkers||[],cache:t.cache??!1,debug:t.debug??!1};try{let r=p.cwd();if(!r)throw new Error("PathResolver: process.cwd() returned undefined. This should never happen.");this._repoRoot=this._findRepoRoot(r)}catch(r){throw new Error(`PathResolver constructor failed: ${r instanceof Error?r.message:String(r)}. cwd: ${p.cwd()}`)}this._appRoot=null,e._instance=this}normalizePath(t){if(!t)return"";try{return Eo(t).split(os).join("/")}catch{return String(t).split(os).join("/")}}getRelativePath(t){let r=this.getAppRoot(),s=is(r,t);return this.normalizePath(s)}getBasename(t){if(!t)return"";let s=this.normalizePath(t).split("/");return s[s.length-1]||""}getDirname(t){return t?this.normalizePath(Qe(t)):""}resolvePackage(t,r=null){try{let s=r||this.getAppRoot(),i=wo(qe(s,"package.json")).resolve(t);return this.normalizePath(i)}catch{return null}}resolveFrameworkPackage(t,r=null){let s=this.resolvePackage(`${t}/package.json`,r);if(s)return this.getDirname(s);if(this.isMonorepo()&&t.startsWith("@donotdev/")){let o=t.replace("@donotdev/",""),a=this.resolveRepoPath(`packages/${o}`);if(this.pathExists(a))return a;if(["auth","billing","crud","oauth"].includes(o)){let c=this.resolveRepoPath(`packages/features/${o}`);if(this.pathExists(c))return c}if(o==="firebase"){let c=this.resolveRepoPath(`packages/providers/${o}`);if(this.pathExists(c))return c}}let n=this.resolveAppPath(`node_modules/${t}`);if(this.pathExists(n))return n;let i=this.resolveRepoPath(`node_modules/${t}`);return this.pathExists(i)?i:null}resolvePackageAsset(t,r=null){return this.resolvePackage(t,r)}resolveAppPath(t){let r=this.getAppRoot(),s=zt(r,t);return this.normalizePath(s)}resolveRepoPath(t){let r=this.getRepoRoot(),s=this.normalizePath(t),n=zt(r,s);return this.normalizePath(n)}resolvePath(t,r){let s=this.normalizePath(r),n=this.normalizePath(t),i=zt(s,n);return this.normalizePath(i)}createImportPath(t){return"./"+this.getRelativePath(t)}getFileInfo(t){try{let r=W.statSync(t);return{absolutePath:this.normalizePath(t),relativePath:this.getRelativePath(t),importPath:this.createImportPath(t),size:r.size,isFile:r.isFile(),isDirectory:r.isDirectory()}}catch{return null}}_detectFormat(t,r){return r&&r!=="auto"?r:xo(t).toLowerCase()===".json"?"json":"text"}async read(t,r={}){let{format:s="auto",encoding:n="utf8"}=r,i=this._detectFormat(t,s);try{if(i==="buffer")return await W.promises.readFile(t);let o=await W.promises.readFile(t,n),a=this.stripBom(o);return i==="json"?JSON.parse(a):a}catch(o){return this.options.debug&&fe.warn(`Failed to read file: ${t}`,o),null}}readSync(t,r={}){let{format:s="auto",encoding:n="utf8"}=r,i=this._detectFormat(t,s);try{if(i==="buffer")return W.readFileSync(t);let o=W.readFileSync(t,n),a=this.stripBom(o);return i==="json"?JSON.parse(a):a}catch(o){return this.options.debug&&fe.warn(`Failed to read file: ${t}`,o),null}}async write(t,r,s={}){let{format:n="auto",overwrite:i=!1,dryRun:o=!1,verbose:a=!1}=s,c=this.normalizePath(t),u=this.normalizePath(Qe(c)),f=this.pathExists(c);if(f&&!i)return a&&fe.info(`Skipping existing file: ${c}`),!1;if(o)return fe.info(`[DRY RUN] Would write file: ${c}`),!0;try{await W.promises.mkdir(u,{recursive:!0})}catch(T){if(T?.code!=="EEXIST")throw T}let b=this._detectFormat(t,n),m;v.isBuffer(r)?m=r:b==="json"&&typeof r=="object"?m=JSON.stringify(r,null,2):m=String(r);try{return await as(async()=>(v.isBuffer(m)?await W.promises.writeFile(c,m):await W.promises.writeFile(c,m,"utf8"),a&&fe.info(`${f?"Updated":"Created"} file: ${c}`),!0),`Failed to write file: ${c}`)}catch{return!1}}writeSync(t,r,s={}){let{format:n="auto",overwrite:i=!1,dryRun:o=!1,verbose:a=!1}=s,c=this.normalizePath(t),u=this.normalizePath(Qe(c)),f=this.pathExists(c);if(f&&!i)return a&&fe.info(`Skipping existing file: ${c}`),!1;if(o)return fe.info(`[DRY RUN] Would write file: ${c}`),!0;try{W.mkdirSync(u,{recursive:!0})}catch(T){if(T?.code!=="EEXIST")throw T}let b=this._detectFormat(t,n),m;v.isBuffer(r)?m=r:b==="json"&&typeof r=="object"?m=JSON.stringify(r,null,2):m=String(r);try{return v.isBuffer(m)?W.writeFileSync(c,m):W.writeFileSync(c,m,"utf8"),a&&fe.info(`${f?"Updated":"Created"} file: ${c}`),!0}catch(T){throw new Error(`Failed to write file: ${c}: ${T instanceof Error?T.message:String(T)}`)}}async copy(t,r,s={}){let{overwrite:n=!1,dryRun:i=!1,verbose:o=!1}=s,a=this.normalizePath(r),c=this.pathExists(a);if(c&&!n)return o&&fe.info(`Skipping existing file: ${a}`),!1;if(i)return fe.info(`[DRY RUN] Would copy file: ${a}`),!0;let u=this.normalizePath(Qe(a));try{await W.promises.mkdir(u,{recursive:!0})}catch(f){if(f?.code!=="EEXIST")throw f}try{return await as(async()=>(await W.promises.copyFile(t,a),o&&fe.info(`${c?"Updated":"Created"} file: ${a}`),!0),`Failed to copy file from ${t} to ${a}`)}catch{return!1}}copySync(t,r,s={}){let{overwrite:n=!1,dryRun:i=!1,verbose:o=!1}=s,a=this.normalizePath(r),c=this.pathExists(a);if(c&&!n)return o&&fe.info(`Skipping existing file: ${a}`),!1;if(i)return fe.info(`[DRY RUN] Would copy file: ${a}`),!0;let u=this.normalizePath(Qe(a));try{W.mkdirSync(u,{recursive:!0})}catch(f){if(f?.code!=="EEXIST")throw f}try{return W.copyFileSync(t,a),o&&fe.info(`${c?"Updated":"Created"} file: ${a}`),!0}catch{return!1}}pathExists(t,r=!1){try{return W.existsSync(t)}catch(s){return r||fe.error(`Error checking path existence: ${t}`,s),!1}}mkdir(t){try{let r=t.startsWith("/")||t.match(/^[A-Z]:/)?this.normalizePath(t):this.resolveAppPath(t);return W.existsSync(r)||W.mkdirSync(r,{recursive:!0}),!0}catch{return!1}}readdirSync(t,r){try{return W.readdirSync(t,r)}catch(s){return this.options.debug&&fe.warn(`Failed to read directory: ${t}`,s),r&&typeof r=="object"&&"withFileTypes"in r&&r.withFileTypes?[]:[]}}statSync(t){try{return W.statSync(t)}catch(r){return this.options.debug&&fe.warn(`Failed to stat file: ${t}`,r),null}}lstatSync(t){try{return W.lstatSync(t)}catch(r){return this.options.debug&&fe.warn(`Failed to lstat file: ${t}`,r),null}}async ensureDir(t){try{await W.promises.mkdir(t,{recursive:!0})}catch(r){if(r?.code!=="EEXIST")throw r}}ensureDirSync(t){try{W.mkdirSync(t,{recursive:!0})}catch(r){if(r?.code!=="EEXIST")throw r}}async remove(t){await W.promises.rm(t,{recursive:!0,force:!0})}removeSync(t){W.rmSync(t,{recursive:!0,force:!0})}async readdir(t,r){return W.promises.readdir(t,r)}stripBom(t){return t.charCodeAt(0)===65279?t.slice(1):t}getRepoRoot(){return this._repoRoot||p.cwd()}getAppRoot(){return this._appRoot?this._appRoot:this._repoRoot}setAppRoot(t){if(!t)throw new Error("PathResolver.setAppRoot: root cannot be undefined or null");this._appRoot=this.normalizePath(t)}isMonorepo(){let t=qe(this._repoRoot,"packages");return this.pathExists(t)}isWithinApp(t){let r=this.normalizePath(zt(t)),s=this.getAppRoot(),n=is(s,r),i=this.normalizePath(n);return!i.startsWith("../")&&!i.startsWith("/")}async findFiles(t,r,s={}){let n=this.normalizePath(qe(t,r)),i=this.getAppRoot(),o=this.normalizePath(i),a=n.startsWith(o)?n.slice(o.length+1):n,c={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:i,ignore:pt.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([a],{...c,...s})}clearCache(){}async _resolveFrameworkI18nPattern(t){let r=pt.I18N_PATHS;if(!r)return null;let s=t.replace(r.SOURCE_ROOT+"/",""),n=this.resolveFrameworkPackage("@donotdev/core");if(!n)return null;let i=this.normalizePath(qe(n,r.PUBLISHED_ROOT,s)),o=i.replace(/\/[^/]*\*.*$/,"");return this.pathExists(o),i}async _globWithNormalization(t,r){return(await Ro(t,r)).map(n=>{let i=typeof n=="string"?n:n.path;return this.normalizePath(i)})}async resolveFiles(t,r="css"){if(!t||typeof t!="object")return{frameworkFiles:[],consumerFiles:[]};if(r==="i18n")return{frameworkFiles:[],consumerFiles:[]};if(Array.isArray(t.framework)||(t.framework=[]),!Array.isArray(t.consumer))return{frameworkFiles:[],consumerFiles:[]};let s=[...t.framework,...t.consumer];for(let f of s)if(typeof f!="string"||f.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let n=this.getAppRoot(),i=pt.getGlobOptionsFor?pt.getGlobOptionsFor(r):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},o=this.normalizePath(n),a=t.framework.map(f=>{let b=this.normalizePath(f);return b.startsWith(o)?b.slice(o.length+1):b}),c=t.consumer.map(f=>{let b=this.normalizePath(f);return b.startsWith(o)?b.slice(o.length+1):b}),u={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:n};try{let f=a.length>0?await this._globWithNormalization(a,u):[],b=await this._globWithNormalization(c,u);return{frameworkFiles:f,consumerFiles:b}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(t){if(!pt.getPatternsFor)return{framework:[],consumer:[],all:[]};let r=this.getAppRoot(),s=this.getRepoRoot();if(t==="i18n"&&(!r||r===s))throw new Error(`Cannot resolve i18n patterns: appRoot not set (appRoot: ${r}, repoRoot: ${s}). Ensure configResolved hook has run before discovery.`);let n=pt.getPatternsFor(t),i=this.isMonorepo();if(t==="i18n"){let c=n,u={eager:c.eager.map(f=>f.startsWith("!")?"!"+this.resolveAppPath(f.slice(1)):this.resolveAppPath(f)),lazy:c.lazy.map(f=>f.startsWith("!")?"!"+this.resolveAppPath(f.slice(1)):this.resolveAppPath(f)),framework:{eager:i?(c.framework?.eager||[]).map(f=>this.resolveRepoPath(f)).filter(Boolean):await Promise.all((c.framework?.eager||[]).map(f=>this._resolveFrameworkI18nPattern(f))).then(f=>f.filter(Boolean)),lazy:i?(c.framework?.lazy||[]).map(f=>this.resolveRepoPath(f)).filter(Boolean):await Promise.all((c.framework?.lazy||[]).map(f=>this._resolveFrameworkI18nPattern(f))).then(f=>f.filter(Boolean))},all:[]};return u.all=[...u.eager,...u.lazy,...u.framework.eager,...u.framework.lazy],u}let o=n,a={framework:i?(o.framework||[]).map(c=>this.resolveRepoPath(c)).filter(Boolean):[],consumer:(o.consumer||[]).map(c=>this.resolveAppPath(c)),all:[]};return a.all=[...a.consumer,...a.framework],a}getEmptyModulePath(t=!1){if(t)return"@donotdev/core/empty";let r=this.resolvePackage("@donotdev/core/empty");if(r)return r;let s=Qe(Po(import.meta.url));return this.normalizePath(qe(s,"../empty.js"))}_findRepoRoot(t){let r=this.normalizePath(t),s=0,n=this.options.maxLevels;for(;s<n;){let i=this.normalizePath(qe(r,ls.TOOLING)),o=this.normalizePath(qe(r,ls.CORE));if(this.pathExists(i)&&this.pathExists(o))return r;let a=qe(r,"apps");if(this.pathExists(a)&&this.statSync(a)?.isDirectory())return this.normalizePath(r);let c=this.normalizePath(qe(r,"package.json"));if(this.pathExists(c)&&this.normalizePath(Qe(r))===r)return r;let u=this.normalizePath(Qe(r));if(u===r)break;r=u,s++}return this.normalizePath(t)}};var De={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 So(){return p.env.NO_COLOR?!1:p.platform==="win32"?!0:p.stdout.isTTY===!0}function Ce(e,t){return So()?`${t}${e}${De.reset}`:e}function Z(e,t,r,s={}){let{logDir:n=".dndev-logs",fileLogging:i=!1}=s,o=ne.getInstance(),a=null;if(i){let f=o.resolveAppPath(n);o.pathExists(f)||o.mkdir(f),a=o.resolveAppPath(`${n}/${e.replace(/[^a-zA-Z0-9]/g,"-")}.log`);let b=`=== ${e} Log Started at ${new Date().toISOString()} ===
1
+ var so=Object.create;var Yr=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var oo=Object.getPrototypeOf,ao=Object.prototype.hasOwnProperty;var ie=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Qr=(e,t)=>()=>(e&&(t=e(e=0)),t);var q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var lo=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of io(t))!ao.call(e,n)&&n!==r&&Yr(e,n,{get:()=>t[n],enumerable:!(s=no(t,n))||s.enumerable});return e};var co=(e,t,r)=>(r=e!=null?so(oo(e)):{},lo(t||!e||!e.__esModule?Yr(r,"default",{value:e,enumerable:!0}):r,e));function ts(e,t=null){let r=ke[e];if(!r)throw new Error(`Unknown pattern type: ${e}`);return t&&r.framework?{...r,framework:r.framework.map(s=>`${t}/${s}`)}:r}function Mt(e){return Zr[e]||Zr.base}var dr,ee,ve,ue,gr,Ge,Lt,ke,at,es,pr,mr,br,Zr,ge=Qr(()=>{"use strict";g();dr={HOMEPAGE_FILE:"HomePage.tsx",HOMEPAGE_PATH:"/",HOMEPAGE_COMPONENT:"HomePage"},ee={routes:"virtual:routes",themes:"virtual:themes",i18n:"virtual:i18n-mapping",assets:"virtual:assets",env:"virtual:env"},ve={routes:"routes",themes:"themes",i18n:"i18n",assets:"assets",env:"env"},ue={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",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"}},gr={package:"@donotdev/ui",assetsPath:"packages/ui/assets",browserTargets:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"]},Ge={public:"public",fonts:"fonts",nodeModules:"node_modules",packages:"packages",core:"core",ui:"ui"},Lt={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"},ke={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"],framework:{eager:[`${Lt.SOURCE_EAGER}/*_*.json`],lazy:[`${Lt.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/**"]},at={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","@donotdev/core","@donotdev/components","@donotdev/ui","@donotdev/templates","@donotdev/firebase"],optionalFeatures:["@donotdev/adv-comps","@donotdev/auth","@donotdev/billing","@donotdev/crud","@donotdev/oauth","shiki","@tiptap/react","@tiptap/starter-kit","@tiptap/extension-placeholder"],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"]},es=["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"],pr=["@donotdev/core/eslint","@donotdev/core/functions","@donotdev/core/server"],mr={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)/}},br=[{name:"light",displayName:"Light",icon:"Sun",isDark:!1}],Zr={base:{absolute:!0,onlyFiles:!0,ignore:ke.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...ke.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...ke.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:ke.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:ke.globalIgnore}}});import{Buffer as v}from"node:buffer";import{createRequire as fo}from"node:module";import{dirname as ho,resolve as $f}from"node:path";import p from"node:process";import{fileURLToPath as go}from"node:url";var po,y,w,g=Qr(()=>{"use strict";po=fo(import.meta.url),y=go(import.meta.url),w=ho(y);typeof globalThis<"u"&&(globalThis.require=po,globalThis.__filename=y,globalThis.__dirname=w,globalThis.Buffer=v,globalThis.process=p,typeof global>"u"&&(globalThis.global=globalThis))});var Oe=q((Ph,ys)=>{g();var vs=e=>typeof e<"u"&&e!==null,Oo=e=>typeof e=="object",jo=e=>Object.prototype.toString.call(e)==="[object Object]",Lo=e=>typeof e=="function",Mo=e=>typeof e=="boolean",zo=e=>e instanceof v,Bo=e=>{if(vs(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},Uo=e=>e instanceof ArrayBuffer,Go=e=>typeof e=="string"&&e.length>0,qo=e=>typeof e=="number"&&!Number.isNaN(e),Wo=e=>Number.isInteger(e),Ho=(e,t,r)=>e>=t&&e<=r,Vo=(e,t)=>t.includes(e),Jo=(e,t,r)=>new Error(`Expected ${t} for ${e} but received ${r} of type ${typeof r}`),Xo=(e,t)=>(t.message=e.message,t);ys.exports={defined:vs,object:Oo,plainObject:jo,fn:Lo,bool:Mo,buffer:zo,typedArray:Bo,arrayBuffer:Uo,string:Go,number:qo,integer:Wo,inRange:Ho,inArray:Vo,invalidParameterError:Jo,nativeError:Xo}});var xs=q((Sh,Es)=>{"use strict";g();var ws=()=>p.platform==="linux",Ut=null,Ko=()=>{if(!Ut)if(ws()&&p.report){let e=p.report.excludeNetwork;p.report.excludeNetwork=!0,Ut=p.report.getReport(),p.report.excludeNetwork=e}else Ut={};return Ut};Es.exports={isLinux:ws,getReport:Ko}});var Rs=q((kh,Ps)=>{"use strict";g();var mt=ie("fs"),Yo="/usr/bin/ldd",Qo="/proc/self/exe",Gt=2048,Zo=e=>{let t=mt.openSync(e,"r"),r=v.alloc(Gt),s=mt.readSync(t,r,0,Gt,0);return mt.close(t,()=>{}),r.subarray(0,s)},ea=e=>new Promise((t,r)=>{mt.open(e,"r",(s,n)=>{if(s)r(s);else{let i=v.alloc(Gt);mt.read(n,i,0,Gt,0,(o,a)=>{t(i.subarray(0,a)),mt.close(n,()=>{})})}})});Ps.exports={LDD_PATH:Yo,SELF_PATH:Qo,readFileSync:Zo,readFile:ea}});var $s=q((_h,Ss)=>{"use strict";g();var ta=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),s=e.readUInt16LE(56);for(let n=0;n<s;n++){let i=t+n*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),c=e.readUInt32LE(i+32);return e.subarray(a,a+c).toString().replace(/\0.*$/g,"")}}return null};Ss.exports={interpreterPath:ta}});var Wt=q((Ih,qs)=>{"use strict";g();var As=ie("child_process"),{isLinux:bt,getReport:_s}=xs(),{LDD_PATH:qt,SELF_PATH:Ns,readFile:yr,readFileSync:wr}=Rs(),{interpreterPath:Is}=$s(),je,Le,Me,Ts="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",et="",Ds=()=>et||new Promise(e=>{As.exec(Ts,(t,r)=>{et=t?" ":r,e(et)})}),Cs=()=>{if(!et)try{et=As.execSync(Ts,{encoding:"utf8"})}catch{et=" "}return et},We="glibc",Fs=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,lt="musl",ra=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),Os=()=>{let e=_s();return e.header&&e.header.glibcVersionRuntime?We:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(ra)?lt:null},js=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(We)?We:r&&r.includes(lt)?lt:null},Ls=e=>{if(e){if(e.includes("/ld-musl-"))return lt;if(e.includes("/ld-linux-"))return We}return null},Ms=e=>(e=e.toString(),e.includes("musl")?lt:e.includes("GNU C Library")?We:null),sa=async()=>{if(Le!==void 0)return Le;Le=null;try{let e=await yr(qt);Le=Ms(e)}catch{}return Le},na=()=>{if(Le!==void 0)return Le;Le=null;try{let e=wr(qt);Le=Ms(e)}catch{}return Le},ia=async()=>{if(je!==void 0)return je;je=null;try{let e=await yr(Ns),t=Is(e);je=Ls(t)}catch{}return je},oa=()=>{if(je!==void 0)return je;je=null;try{let e=wr(Ns),t=Is(e);je=Ls(t)}catch{}return je},zs=async()=>{let e=null;if(bt()&&(e=await ia(),!e&&(e=await sa(),e||(e=Os()),!e))){let t=await Ds();e=js(t)}return e},Bs=()=>{let e=null;if(bt()&&(e=oa(),!e&&(e=na(),e||(e=Os()),!e))){let t=Cs();e=js(t)}return e},aa=async()=>bt()&&await zs()!==We,la=()=>bt()&&Bs()!==We,ca=async()=>{if(Me!==void 0)return Me;Me=null;try{let t=(await yr(qt)).match(Fs);t&&(Me=t[1])}catch{}return Me},ua=()=>{if(Me!==void 0)return Me;Me=null;try{let t=wr(qt).match(Fs);t&&(Me=t[1])}catch{}return Me},Us=()=>{let e=_s();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},ks=e=>e.trim().split(/\s+/)[1],Gs=e=>{let[t,r,s]=e.split(/[\r\n]+/);return t&&t.includes(We)?ks(t):r&&s&&r.includes(lt)?ks(s):null},fa=async()=>{let e=null;if(bt()&&(e=await ca(),e||(e=Us()),!e)){let t=await Ds();e=Gs(t)}return e},ha=()=>{let e=null;if(bt()&&(e=ua(),e||(e=Us()),!e)){let t=Cs();e=Gs(t)}return e};qs.exports={GLIBC:We,MUSL:lt,family:zs,familySync:Bs,isNonGlibcLinux:aa,isNonGlibcLinuxSync:la,version:fa,versionSync:ha}});var Nt=q((Dh,Ws)=>{"use strict";g();var da=typeof p=="object"&&p.env&&p.env.NODE_DEBUG&&/\bsemver\b/i.test(p.env.NODE_DEBUG)?(...e)=>{}:()=>{};Ws.exports=da});var Ht=q((Fh,Hs)=>{"use strict";g();var ga="2.0.0",pa=Number.MAX_SAFE_INTEGER||9007199254740991,ma=16,ba=250,va=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Hs.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:ma,MAX_SAFE_BUILD_LENGTH:ba,MAX_SAFE_INTEGER:pa,RELEASE_TYPES:va,SEMVER_SPEC_VERSION:ga,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var It=q((ze,Vs)=>{"use strict";g();var{MAX_SAFE_COMPONENT_LENGTH:Er,MAX_SAFE_BUILD_LENGTH:ya,MAX_LENGTH:wa}=Ht(),Ea=Nt();ze=Vs.exports={};var xa=ze.re=[],Pa=ze.safeRe=[],N=ze.src=[],Ra=ze.safeSrc=[],I=ze.t={},Sa=0,xr="[a-zA-Z0-9-]",$a=[["\\s",1],["\\d",wa],[xr,ya]],ka=e=>{for(let[t,r]of $a)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},B=(e,t,r)=>{let s=ka(t),n=Sa++;Ea(e,n,t),I[e]=n,N[n]=t,Ra[n]=s,xa[n]=new RegExp(t,r?"g":void 0),Pa[n]=new RegExp(s,r?"g":void 0)};B("NUMERICIDENTIFIER","0|[1-9]\\d*");B("NUMERICIDENTIFIERLOOSE","\\d+");B("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${xr}*`);B("MAINVERSION",`(${N[I.NUMERICIDENTIFIER]})\\.(${N[I.NUMERICIDENTIFIER]})\\.(${N[I.NUMERICIDENTIFIER]})`);B("MAINVERSIONLOOSE",`(${N[I.NUMERICIDENTIFIERLOOSE]})\\.(${N[I.NUMERICIDENTIFIERLOOSE]})\\.(${N[I.NUMERICIDENTIFIERLOOSE]})`);B("PRERELEASEIDENTIFIER",`(?:${N[I.NONNUMERICIDENTIFIER]}|${N[I.NUMERICIDENTIFIER]})`);B("PRERELEASEIDENTIFIERLOOSE",`(?:${N[I.NONNUMERICIDENTIFIER]}|${N[I.NUMERICIDENTIFIERLOOSE]})`);B("PRERELEASE",`(?:-(${N[I.PRERELEASEIDENTIFIER]}(?:\\.${N[I.PRERELEASEIDENTIFIER]})*))`);B("PRERELEASELOOSE",`(?:-?(${N[I.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${N[I.PRERELEASEIDENTIFIERLOOSE]})*))`);B("BUILDIDENTIFIER",`${xr}+`);B("BUILD",`(?:\\+(${N[I.BUILDIDENTIFIER]}(?:\\.${N[I.BUILDIDENTIFIER]})*))`);B("FULLPLAIN",`v?${N[I.MAINVERSION]}${N[I.PRERELEASE]}?${N[I.BUILD]}?`);B("FULL",`^${N[I.FULLPLAIN]}$`);B("LOOSEPLAIN",`[v=\\s]*${N[I.MAINVERSIONLOOSE]}${N[I.PRERELEASELOOSE]}?${N[I.BUILD]}?`);B("LOOSE",`^${N[I.LOOSEPLAIN]}$`);B("GTLT","((?:<|>)?=?)");B("XRANGEIDENTIFIERLOOSE",`${N[I.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);B("XRANGEIDENTIFIER",`${N[I.NUMERICIDENTIFIER]}|x|X|\\*`);B("XRANGEPLAIN",`[v=\\s]*(${N[I.XRANGEIDENTIFIER]})(?:\\.(${N[I.XRANGEIDENTIFIER]})(?:\\.(${N[I.XRANGEIDENTIFIER]})(?:${N[I.PRERELEASE]})?${N[I.BUILD]}?)?)?`);B("XRANGEPLAINLOOSE",`[v=\\s]*(${N[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${N[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${N[I.XRANGEIDENTIFIERLOOSE]})(?:${N[I.PRERELEASELOOSE]})?${N[I.BUILD]}?)?)?`);B("XRANGE",`^${N[I.GTLT]}\\s*${N[I.XRANGEPLAIN]}$`);B("XRANGELOOSE",`^${N[I.GTLT]}\\s*${N[I.XRANGEPLAINLOOSE]}$`);B("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Er}})(?:\\.(\\d{1,${Er}}))?(?:\\.(\\d{1,${Er}}))?`);B("COERCE",`${N[I.COERCEPLAIN]}(?:$|[^\\d])`);B("COERCEFULL",N[I.COERCEPLAIN]+`(?:${N[I.PRERELEASE]})?(?:${N[I.BUILD]})?(?:$|[^\\d])`);B("COERCERTL",N[I.COERCE],!0);B("COERCERTLFULL",N[I.COERCEFULL],!0);B("LONETILDE","(?:~>?)");B("TILDETRIM",`(\\s*)${N[I.LONETILDE]}\\s+`,!0);ze.tildeTrimReplace="$1~";B("TILDE",`^${N[I.LONETILDE]}${N[I.XRANGEPLAIN]}$`);B("TILDELOOSE",`^${N[I.LONETILDE]}${N[I.XRANGEPLAINLOOSE]}$`);B("LONECARET","(?:\\^)");B("CARETTRIM",`(\\s*)${N[I.LONECARET]}\\s+`,!0);ze.caretTrimReplace="$1^";B("CARET",`^${N[I.LONECARET]}${N[I.XRANGEPLAIN]}$`);B("CARETLOOSE",`^${N[I.LONECARET]}${N[I.XRANGEPLAINLOOSE]}$`);B("COMPARATORLOOSE",`^${N[I.GTLT]}\\s*(${N[I.LOOSEPLAIN]})$|^$`);B("COMPARATOR",`^${N[I.GTLT]}\\s*(${N[I.FULLPLAIN]})$|^$`);B("COMPARATORTRIM",`(\\s*)${N[I.GTLT]}\\s*(${N[I.LOOSEPLAIN]}|${N[I.XRANGEPLAIN]})`,!0);ze.comparatorTrimReplace="$1$2$3";B("HYPHENRANGE",`^\\s*(${N[I.XRANGEPLAIN]})\\s+-\\s+(${N[I.XRANGEPLAIN]})\\s*$`);B("HYPHENRANGELOOSE",`^\\s*(${N[I.XRANGEPLAINLOOSE]})\\s+-\\s+(${N[I.XRANGEPLAINLOOSE]})\\s*$`);B("STAR","(<|>)?=?\\s*\\*");B("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");B("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Vt=q((Lh,Js)=>{"use strict";g();var Aa=Object.freeze({loose:!0}),_a=Object.freeze({}),Na=e=>e?typeof e!="object"?Aa:e:_a;Js.exports=Na});var Qs=q((zh,Ys)=>{"use strict";g();var Xs=/^[0-9]+$/,Ks=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;let r=Xs.test(e),s=Xs.test(t);return r&&s&&(e=+e,t=+t),e===t?0:r&&!s?-1:s&&!r?1:e<t?-1:1},Ia=(e,t)=>Ks(t,e);Ys.exports={compareIdentifiers:Ks,rcompareIdentifiers:Ia}});var vt=q((Uh,en)=>{"use strict";g();var Jt=Nt(),{MAX_LENGTH:Zs,MAX_SAFE_INTEGER:Xt}=Ht(),{safeRe:Kt,t:Yt}=It(),Ta=Vt(),{compareIdentifiers:Pr}=Qs(),Rr=class e{constructor(t,r){if(r=Ta(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Zs)throw new TypeError(`version is longer than ${Zs} characters`);Jt("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=t.trim().match(r.loose?Kt[Yt.LOOSE]:Kt[Yt.FULL]);if(!s)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>Xt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Xt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Xt||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<Xt)return i}return n}):this.prerelease=[],this.build=s[5]?s[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Jt("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let s=this.prerelease[r],n=t.prerelease[r];if(Jt("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return Pr(s,n)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let s=this.build[r],n=t.build[r];if(Jt("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return Pr(s,n)}while(++r)}inc(t,r,s){if(t.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?Kt[Yt.PRERELEASELOOSE]:Kt[Yt.PRERELEASE]);if(!n||n[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];s===!1&&(i=[r]),Pr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};en.exports=Rr});var sn=q((qh,rn)=>{"use strict";g();var tn=vt(),Da=(e,t,r=!1)=>{if(e instanceof tn)return e;try{return new tn(e,t)}catch(s){if(!r)return null;throw s}};rn.exports=Da});var on=q((Hh,nn)=>{"use strict";g();var Ca=vt(),Fa=sn(),{safeRe:Qt,t:Zt}=It(),Oa=(e,t)=>{if(e instanceof Ca)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Qt[Zt.COERCEFULL]:Qt[Zt.COERCE]);else{let c=t.includePrerelease?Qt[Zt.COERCERTLFULL]:Qt[Zt.COERCERTL],u;for(;(u=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Fa(`${s}.${n}.${i}${o}${a}`,t)};nn.exports=Oa});var ct=q((Jh,ln)=>{"use strict";g();var an=vt(),ja=(e,t,r)=>new an(e,r).compare(new an(t,r));ln.exports=ja});var Sr=q((Kh,cn)=>{"use strict";g();var La=ct(),Ma=(e,t,r)=>La(e,t,r)>=0;cn.exports=Ma});var fn=q((Qh,un)=>{"use strict";g();var $r=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(t,r)}return this}};un.exports=$r});var dn=q((ed,hn)=>{"use strict";g();var za=ct(),Ba=(e,t,r)=>za(e,t,r)===0;hn.exports=Ba});var pn=q((rd,gn)=>{"use strict";g();var Ua=ct(),Ga=(e,t,r)=>Ua(e,t,r)!==0;gn.exports=Ga});var bn=q((nd,mn)=>{"use strict";g();var qa=ct(),Wa=(e,t,r)=>qa(e,t,r)>0;mn.exports=Wa});var yn=q((od,vn)=>{"use strict";g();var Ha=ct(),Va=(e,t,r)=>Ha(e,t,r)<0;vn.exports=Va});var En=q((ld,wn)=>{"use strict";g();var Ja=ct(),Xa=(e,t,r)=>Ja(e,t,r)<=0;wn.exports=Xa});var Pn=q((ud,xn)=>{"use strict";g();var Ka=dn(),Ya=pn(),Qa=bn(),Za=Sr(),el=yn(),tl=En(),rl=(e,t,r,s)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Ka(e,r,s);case"!=":return Ya(e,r,s);case">":return Qa(e,r,s);case">=":return Za(e,r,s);case"<":return el(e,r,s);case"<=":return tl(e,r,s);default:throw new TypeError(`Invalid operator: ${t}`)}};xn.exports=rl});var Nn=q((hd,_n)=>{"use strict";g();var Tt=Symbol("SemVer ANY"),_r=class e{static get ANY(){return Tt}constructor(t,r){if(r=Rn(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),Ar("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===Tt?this.value="":this.value=this.operator+this.semver.version,Ar("comp",this)}parse(t){let r=this.options.loose?Sn[$n.COMPARATORLOOSE]:Sn[$n.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new kn(s[2],this.options.loose):this.semver=Tt}toString(){return this.value}test(t){if(Ar("Comparator.test",t,this.options.loose),this.semver===Tt||t===Tt)return!0;if(typeof t=="string")try{t=new kn(t,this.options)}catch{return!1}return kr(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new An(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new An(this.value,r).test(t.semver):(r=Rn(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||kr(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||kr(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};_n.exports=_r;var Rn=Vt(),{safeRe:Sn,t:$n}=It(),kr=Pn(),Ar=Nt(),kn=vt(),An=Nr()});var Nr=q((gd,Cn)=>{"use strict";g();var sl=/\s+/g,Ir=class e{constructor(t,r){if(r=il(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof Tr)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(sl," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!Tn(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&hl(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let s=((this.options.includePrerelease&&ul)|(this.options.loose&&fl))+":"+t,n=In.get(s);if(n)return n;let i=this.options.loose,o=i?we[be.HYPHENRANGELOOSE]:we[be.HYPHENRANGE];t=t.replace(o,xl(this.options.includePrerelease)),te("hyphen replace",t),t=t.replace(we[be.COMPARATORTRIM],al),te("comparator trim",t),t=t.replace(we[be.TILDETRIM],ll),te("tilde trim",t),t=t.replace(we[be.CARETTRIM],cl),te("caret trim",t);let a=t.split(" ").map(b=>dl(b,this.options)).join(" ").split(/\s+/).map(b=>El(b,this.options));i&&(a=a.filter(b=>(te("loose invalid filter",b,this.options),!!b.match(we[be.COMPARATORLOOSE])))),te("range list",a);let c=new Map,u=a.map(b=>new Tr(b,this.options));for(let b of u){if(Tn(b))return[b];c.set(b.value,b)}c.size>1&&c.has("")&&c.delete("");let f=[...c.values()];return In.set(s,f),f}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(s=>Dn(s,r)&&t.set.some(n=>Dn(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new ol(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Pl(this.set[r],t,this.options))return!0;return!1}};Cn.exports=Ir;var nl=fn(),In=new nl,il=Vt(),Tr=Nn(),te=Nt(),ol=vt(),{safeRe:we,t:be,comparatorTrimReplace:al,tildeTrimReplace:ll,caretTrimReplace:cl}=It(),{FLAG_INCLUDE_PRERELEASE:ul,FLAG_LOOSE:fl}=Ht(),Tn=e=>e.value==="<0.0.0-0",hl=e=>e.value==="",Dn=(e,t)=>{let r=!0,s=e.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,t)),n=s.pop();return r},dl=(e,t)=>(e=e.replace(we[be.BUILD],""),te("comp",e,t),e=ml(e,t),te("caret",e),e=gl(e,t),te("tildes",e),e=vl(e,t),te("xrange",e),e=wl(e,t),te("stars",e),e),Ee=e=>!e||e.toLowerCase()==="x"||e==="*",gl=(e,t)=>e.trim().split(/\s+/).map(r=>pl(r,t)).join(" "),pl=(e,t)=>{let r=t.loose?we[be.TILDELOOSE]:we[be.TILDE];return e.replace(r,(s,n,i,o,a)=>{te("tilde",e,s,n,i,o,a);let c;return Ee(n)?c="":Ee(i)?c=`>=${n}.0.0 <${+n+1}.0.0-0`:Ee(o)?c=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(te("replaceTilde pr",a),c=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):c=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,te("tilde return",c),c})},ml=(e,t)=>e.trim().split(/\s+/).map(r=>bl(r,t)).join(" "),bl=(e,t)=>{te("caret",e,t);let r=t.loose?we[be.CARETLOOSE]:we[be.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,(n,i,o,a,c)=>{te("caret",e,n,i,o,a,c);let u;return Ee(i)?u="":Ee(o)?u=`>=${i}.0.0${s} <${+i+1}.0.0-0`:Ee(a)?i==="0"?u=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:c?(te("replaceCaret pr",c),i==="0"?o==="0"?u=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(te("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${a}${s} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),te("caret return",u),u})},vl=(e,t)=>(te("replaceXRanges",e,t),e.split(/\s+/).map(r=>yl(r,t)).join(" ")),yl=(e,t)=>{e=e.trim();let r=t.loose?we[be.XRANGELOOSE]:we[be.XRANGE];return e.replace(r,(s,n,i,o,a,c)=>{te("xRange",e,s,n,i,o,a,c);let u=Ee(i),f=u||Ee(o),b=f||Ee(a),m=b;return n==="="&&m&&(n=""),c=t.includePrerelease?"-0":"",u?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&m?(f&&(o=0),a=0,n===">"?(n=">=",f?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",f?i=+i+1:o=+o+1),n==="<"&&(c="-0"),s=`${n+i}.${o}.${a}${c}`):f?s=`>=${i}.0.0${c} <${+i+1}.0.0-0`:b&&(s=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),te("xRange return",s),s})},wl=(e,t)=>(te("replaceStars",e,t),e.trim().replace(we[be.STAR],"")),El=(e,t)=>(te("replaceGTE0",e,t),e.trim().replace(we[t.includePrerelease?be.GTE0PRE:be.GTE0],"")),xl=e=>(t,r,s,n,i,o,a,c,u,f,b,m)=>(Ee(s)?r="":Ee(n)?r=`>=${s}.0.0${e?"-0":""}`:Ee(i)?r=`>=${s}.${n}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,Ee(u)?c="":Ee(f)?c=`<${+u+1}.0.0-0`:Ee(b)?c=`<${u}.${+f+1}.0-0`:m?c=`<=${u}.${f}.${b}-${m}`:e?c=`<${u}.${f}.${+b+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Pl=(e,t,r)=>{for(let s=0;s<e.length;s++)if(!e[s].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let s=0;s<e.length;s++)if(te(e[s].semver),e[s].semver!==Tr.ANY&&e[s].semver.prerelease.length>0){let n=e[s].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}});var On=q((md,Fn)=>{"use strict";g();var Rl=Nr(),Sl=(e,t,r)=>{try{t=new Rl(t,r)}catch{return!1}return t.test(e)};Fn.exports=Sl});var Dr=q((vd,$l)=>{$l.exports={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.34.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unneb\xE4ck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix B\xFCnemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","J\xE9r\xE9my Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kot\u011B\u0161ovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouci\xF1o <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugu\xE9 <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>"],scripts:{build:"node install/build.js",install:"node install/check.js || npm run build",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-types":"tsd --files ./test/types/sharp.test-d.ts","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",main:"lib/index.js",types:"lib/index.d.ts",files:["install","lib","src/*.{cc,h,gyp}"],repository:{type:"git",url:"git://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.0.0","detect-libc":"^2.1.2",semver:"^7.7.3"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.34.5","@img/sharp-darwin-x64":"0.34.5","@img/sharp-libvips-darwin-arm64":"1.2.4","@img/sharp-libvips-darwin-x64":"1.2.4","@img/sharp-libvips-linux-arm":"1.2.4","@img/sharp-libvips-linux-arm64":"1.2.4","@img/sharp-libvips-linux-ppc64":"1.2.4","@img/sharp-libvips-linux-riscv64":"1.2.4","@img/sharp-libvips-linux-s390x":"1.2.4","@img/sharp-libvips-linux-x64":"1.2.4","@img/sharp-libvips-linuxmusl-arm64":"1.2.4","@img/sharp-libvips-linuxmusl-x64":"1.2.4","@img/sharp-linux-arm":"0.34.5","@img/sharp-linux-arm64":"0.34.5","@img/sharp-linux-ppc64":"0.34.5","@img/sharp-linux-riscv64":"0.34.5","@img/sharp-linux-s390x":"0.34.5","@img/sharp-linux-x64":"0.34.5","@img/sharp-linuxmusl-arm64":"0.34.5","@img/sharp-linuxmusl-x64":"0.34.5","@img/sharp-wasm32":"0.34.5","@img/sharp-win32-arm64":"0.34.5","@img/sharp-win32-ia32":"0.34.5","@img/sharp-win32-x64":"0.34.5"},devDependencies:{"@biomejs/biome":"^2.3.4","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.7.0","@img/sharp-libvips-dev":"1.2.4","@img/sharp-libvips-dev-wasm32":"1.2.4","@img/sharp-libvips-win32-arm64":"1.2.4","@img/sharp-libvips-win32-ia32":"1.2.4","@img/sharp-libvips-win32-x64":"1.2.4","@types/node":"*",emnapi:"^1.7.0","exif-reader":"^2.0.2","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^9.1.3","node-addon-api":"^8.5.0","node-gyp":"^11.5.0","tar-fs":"^3.1.1",tsd:"^0.33.0"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.17.3"},funding:{url:"https://opencollective.com/libvips"}}});var Fr=q((yd,Hn)=>{g();var{spawnSync:er}=ie("node:child_process"),{createHash:kl}=ie("node:crypto"),zn=on(),Al=Sr(),_l=On(),jn=Wt(),{config:Nl,engines:Ln,optionalDependencies:Il}=Dr(),Tl=p.env.npm_package_config_libvips||Nl.libvips,Bn=zn(Tl).version,Dl=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],tr={encoding:"utf8",shell:!0},Cl=e=>{e instanceof Error},Un=()=>jn.isNonGlibcLinuxSync()?jn.familySync():"",Fl=()=>`${p.platform}${Un()}-${p.arch}`,yt=()=>{if(Gn())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=p.env,s=typeof r=="string"?r:Un();return`${t||p.platform}${s}-${e||p.arch}`},Ol=()=>{try{return ie(`@img/sharp-libvips-dev-${yt()}/include`)}catch{try{return ie("@img/sharp-libvips-dev/include")}catch{}}return""},jl=()=>{try{return ie("@img/sharp-libvips-dev/cplusplus")}catch{}return""},Ll=()=>{try{return ie(`@img/sharp-libvips-dev-${yt()}/lib`)}catch{try{return ie(`@img/sharp-libvips-${yt()}/lib`)}catch{}}return""},Ml=()=>{if(p.release?.name==="node"&&p.versions&&!_l(p.versions.node,Ln.node))return{found:p.versions.node,expected:Ln.node}},Gn=()=>{let{CC:e}=p.env;return!!e?.endsWith("/emcc")},zl=()=>p.platform==="darwin"&&p.arch==="x64"?(er("sysctl sysctl.proc_translated",tr).stdout||"").trim()==="sysctl.proc_translated: 1":!1,Mn=e=>kl("sha512").update(e).digest("hex"),Bl=()=>{try{let e=Mn(`imgsharp-libvips-${yt()}`),t=zn(Il[`@img/sharp-libvips-${yt()}`],{includePrerelease:!0}).version;return Mn(`${e}npm:${t}`).slice(0,10)}catch{}return""},Ul=()=>er(`node-gyp rebuild --directory=src ${Gn()?"--nodedir=emscripten":""}`,{...tr,stdio:"inherit"}).status,qn=()=>p.platform!=="win32"?(er("pkg-config --modversion vips-cpp",{...tr,env:{...p.env,PKG_CONFIG_PATH:Wn()}}).stdout||"").trim():"",Wn=()=>p.platform!=="win32"?[(er('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',tr).stdout||"").trim(),p.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",Cr=(e,t,r)=>(r&&r(`Detected ${t}, skipping search for globally-installed libvips`),e),Gl=e=>{if(p.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return Cr(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(p.env.SHARP_FORCE_GLOBAL_LIBVIPS)return Cr(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(zl())return Cr(!1,"Rosetta",e);let t=qn();return!!t&&Al(t,Bn)};Hn.exports={minimumLibvipsVersion:Bn,prebuiltPlatforms:Dl,buildPlatformArch:yt,buildSharpLibvipsIncludeDir:Ol,buildSharpLibvipsCPlusPlusDir:jl,buildSharpLibvipsLibDir:Ll,isUnsupportedNodeRuntime:Ml,runtimePlatformArch:Fl,log:Cl,yarnLocator:Bl,spawnRebuild:Ul,globalLibvipsVersion:qn,pkgConfigPath:Wn,useGlobalLibvips:Gl}});var Ct=q((xd,Jn)=>{g();var{familySync:ql,versionSync:Wl}=Wt(),{runtimePlatformArch:Hl,isUnsupportedNodeRuntime:Vn,prebuiltPlatforms:Vl,minimumLibvipsVersion:Jl}=Fr(),ut=Hl(),Xl=[`../src/build/Release/sharp-${ut}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${ut}/sharp.node`,"@img/sharp-wasm32/sharp.node"],Or,wt,Dt=[];for(Or of Xl)try{wt=ie(Or);break}catch(e){Dt.push(e)}if(wt&&Or.startsWith("@img/sharp-linux-x64")&&!wt._isUsingX64V2()){let e=new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");e.code="Unsupported CPU",Dt.push(e),wt=null}if(wt)Jn.exports=wt;else{let[e,t,r]=["linux","darwin","win32"].map(i=>ut.startsWith(i)),s=[`Could not load the "sharp" module using the ${ut} runtime`];Dt.forEach(i=>{i.code!=="MODULE_NOT_FOUND"&&s.push(`${i.code}: ${i.message}`)});let n=Dt.map(i=>i.message).join(" ");if(s.push("Possible solutions:"),Vn()){let{found:i,expected:o}=Vn();s.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(Vl.includes(ut)){let[i,o]=ut.split("-"),a=i.endsWith("musl")?" --libc=musl":"";s.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else s.push(`- Manually install libvips >= ${Jl}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(n))try{let{config:i}=ie(`@img/sharp-libvips-${ut}/package`),o=`${ql()} ${Wl()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;s.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(n)&&s.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node"),t&&/Incompatible library version/.test(n)&&s.push("- Update Homebrew:"," brew update && brew upgrade vips"),Dt.some(i=>i.code==="ERR_DLOPEN_DISABLED")&&s.push("- Run Node.js without using the --no-addons flag"),r&&/The specified procedure could not be found/.test(n)&&s.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp"),s.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(s.join(`
2
+ `))}});var Kn=q((Sd,Xn)=>{g();var Kl=ie("node:util"),jr=ie("node:stream"),Yl=Oe();Ct();var Ql=Kl.debuglog("sharp"),Zl=e=>{ft.queue.emit("change",e)},ft=function(e,t){if(arguments.length===1&&!Yl.defined(e))throw new Error("Invalid input");return this instanceof ft?(jr.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:r=>{this.emit("warning",r),Ql(r)},queueListener:Zl},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this):new ft(e,t)};Object.setPrototypeOf(ft.prototype,jr.Duplex.prototype);Object.setPrototypeOf(ft,jr.Duplex);function ec(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...s}=this.options;return e.options=structuredClone(s),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput()&&this.on("finish",()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")}),e}Object.assign(ft.prototype,{clone:ec});Xn.exports=ft});var Zn=q((kd,Qn)=>{g();var h=Oe(),tt=Ct(),tc={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},rc=["failOn","limitInputPixels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","failOnError","openSlideLevel","pdfBackground","tiffSubifd"];function Yn(e){let t=rc.filter(r=>h.defined(e[r])).map(r=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function sc(e,t,r){let s={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(h.string(e))s.file=e;else if(h.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");s.buffer=e}else if(h.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");s.buffer=v.from(e,0,e.byteLength)}else if(h.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");s.buffer=v.from(e.buffer,e.byteOffset,e.byteLength)}else if(h.plainObject(e)&&!h.defined(t))t=e,Yn(t)&&(s.buffer=[]);else if(!h.defined(e)&&!h.defined(t)&&h.object(r)&&r.allowStream)s.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(n=>this._createInputDescriptor(n));else throw new Error("Recursive join is unsupported");else throw new Error("Expected at least two images to join");else throw new Error(`Unsupported input '${e}' of type ${typeof e}${h.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(h.object(t)){if(h.defined(t.failOnError))if(h.bool(t.failOnError))s.failOn=t.failOnError?"warning":"none";else throw h.invalidParameterError("failOnError","boolean",t.failOnError);if(h.defined(t.failOn))if(h.string(t.failOn)&&h.inArray(t.failOn,["none","truncated","error","warning"]))s.failOn=t.failOn;else throw h.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(h.defined(t.autoOrient))if(h.bool(t.autoOrient))s.autoOrient=t.autoOrient;else throw h.invalidParameterError("autoOrient","boolean",t.autoOrient);if(h.defined(t.density))if(h.inRange(t.density,1,1e5))s.density=t.density;else throw h.invalidParameterError("density","number between 1 and 100000",t.density);if(h.defined(t.ignoreIcc))if(h.bool(t.ignoreIcc))s.ignoreIcc=t.ignoreIcc;else throw h.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(h.defined(t.limitInputPixels))if(h.bool(t.limitInputPixels))s.limitInputPixels=t.limitInputPixels?16383**2:0;else if(h.integer(t.limitInputPixels)&&h.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))s.limitInputPixels=t.limitInputPixels;else throw h.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(h.defined(t.unlimited))if(h.bool(t.unlimited))s.unlimited=t.unlimited;else throw h.invalidParameterError("unlimited","boolean",t.unlimited);if(h.defined(t.sequentialRead))if(h.bool(t.sequentialRead))s.sequentialRead=t.sequentialRead;else throw h.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(h.defined(t.raw)){if(h.object(t.raw)&&h.integer(t.raw.width)&&t.raw.width>0&&h.integer(t.raw.height)&&t.raw.height>0&&h.integer(t.raw.channels)&&h.inRange(t.raw.channels,1,4))switch(s.rawWidth=t.raw.width,s.rawHeight=t.raw.height,s.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:s.rawDepth="uchar";break;case Int8Array:s.rawDepth="char";break;case Uint16Array:s.rawDepth="ushort";break;case Int16Array:s.rawDepth="short";break;case Uint32Array:s.rawDepth="uint";break;case Int32Array:s.rawDepth="int";break;case Float32Array:s.rawDepth="float";break;case Float64Array:s.rawDepth="double";break;default:s.rawDepth="uchar";break}else throw new Error("Expected width, height and channels for raw pixel input");if(s.rawPremultiplied=!1,h.defined(t.raw.premultiplied))if(h.bool(t.raw.premultiplied))s.rawPremultiplied=t.raw.premultiplied;else throw h.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(s.rawPageHeight=0,h.defined(t.raw.pageHeight))if(h.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw new Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);s.rawPageHeight=t.raw.pageHeight}else throw h.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(h.defined(t.animated))if(h.bool(t.animated))s.pages=t.animated?-1:1;else throw h.invalidParameterError("animated","boolean",t.animated);if(h.defined(t.pages))if(h.integer(t.pages)&&h.inRange(t.pages,-1,1e5))s.pages=t.pages;else throw h.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(h.defined(t.page))if(h.integer(t.page)&&h.inRange(t.page,0,1e5))s.page=t.page;else throw h.invalidParameterError("page","integer between 0 and 100000",t.page);if(h.object(t.openSlide)&&h.defined(t.openSlide.level))if(h.integer(t.openSlide.level)&&h.inRange(t.openSlide.level,0,256))s.openSlideLevel=t.openSlide.level;else throw h.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(h.defined(t.level))if(h.integer(t.level)&&h.inRange(t.level,0,256))s.openSlideLevel=t.level;else throw h.invalidParameterError("level","integer between 0 and 256",t.level);if(h.object(t.tiff)&&h.defined(t.tiff.subifd))if(h.integer(t.tiff.subifd)&&h.inRange(t.tiff.subifd,-1,1e5))s.tiffSubifd=t.tiff.subifd;else throw h.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(h.defined(t.subifd))if(h.integer(t.subifd)&&h.inRange(t.subifd,-1,1e5))s.tiffSubifd=t.subifd;else throw h.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(h.object(t.svg)){if(h.defined(t.svg.stylesheet))if(h.string(t.svg.stylesheet))s.svgStylesheet=t.svg.stylesheet;else throw h.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(h.defined(t.svg.highBitdepth))if(h.bool(t.svg.highBitdepth))s.svgHighBitdepth=t.svg.highBitdepth;else throw h.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(h.object(t.pdf)&&h.defined(t.pdf.background)?s.pdfBackground=this._getBackgroundColourOption(t.pdf.background):h.defined(t.pdfBackground)&&(s.pdfBackground=this._getBackgroundColourOption(t.pdfBackground)),h.object(t.jp2)&&h.defined(t.jp2.oneshot))if(h.bool(t.jp2.oneshot))s.jp2Oneshot=t.jp2.oneshot;else throw h.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(h.defined(t.create))if(h.object(t.create)&&h.integer(t.create.width)&&t.create.width>0&&h.integer(t.create.height)&&t.create.height>0&&h.integer(t.create.channels)){if(s.createWidth=t.create.width,s.createHeight=t.create.height,s.createChannels=t.create.channels,s.createPageHeight=0,h.defined(t.create.pageHeight))if(h.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw new Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);s.createPageHeight=t.create.pageHeight}else throw h.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(h.defined(t.create.noise)){if(!h.object(t.create.noise))throw new Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw new Error("Only gaussian noise is supported at the moment");if(s.createNoiseType=t.create.noise.type,!h.inRange(t.create.channels,1,4))throw h.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(s.createNoiseMean=128,h.defined(t.create.noise.mean))if(h.number(t.create.noise.mean)&&h.inRange(t.create.noise.mean,0,1e4))s.createNoiseMean=t.create.noise.mean;else throw h.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(s.createNoiseSigma=30,h.defined(t.create.noise.sigma))if(h.number(t.create.noise.sigma)&&h.inRange(t.create.noise.sigma,0,1e4))s.createNoiseSigma=t.create.noise.sigma;else throw h.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(h.defined(t.create.background)){if(!h.inRange(t.create.channels,3,4))throw h.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);s.createBackground=this._getBackgroundColourOption(t.create.background)}else throw new Error("Expected valid noise or background to create a new input image");delete s.buffer}else throw new Error("Expected valid width, height and channels to create a new input image");if(h.defined(t.text))if(h.object(t.text)&&h.string(t.text.text)){if(s.textValue=t.text.text,h.defined(t.text.height)&&h.defined(t.text.dpi))throw new Error("Expected only one of dpi or height");if(h.defined(t.text.font))if(h.string(t.text.font))s.textFont=t.text.font;else throw h.invalidParameterError("text.font","string",t.text.font);if(h.defined(t.text.fontfile))if(h.string(t.text.fontfile))s.textFontfile=t.text.fontfile;else throw h.invalidParameterError("text.fontfile","string",t.text.fontfile);if(h.defined(t.text.width))if(h.integer(t.text.width)&&t.text.width>0)s.textWidth=t.text.width;else throw h.invalidParameterError("text.width","positive integer",t.text.width);if(h.defined(t.text.height))if(h.integer(t.text.height)&&t.text.height>0)s.textHeight=t.text.height;else throw h.invalidParameterError("text.height","positive integer",t.text.height);if(h.defined(t.text.align))if(h.string(t.text.align)&&h.string(this.constructor.align[t.text.align]))s.textAlign=this.constructor.align[t.text.align];else throw h.invalidParameterError("text.align","valid alignment",t.text.align);if(h.defined(t.text.justify))if(h.bool(t.text.justify))s.textJustify=t.text.justify;else throw h.invalidParameterError("text.justify","boolean",t.text.justify);if(h.defined(t.text.dpi))if(h.integer(t.text.dpi)&&h.inRange(t.text.dpi,1,1e6))s.textDpi=t.text.dpi;else throw h.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(h.defined(t.text.rgba))if(h.bool(t.text.rgba))s.textRgba=t.text.rgba;else throw h.invalidParameterError("text.rgba","bool",t.text.rgba);if(h.defined(t.text.spacing))if(h.integer(t.text.spacing)&&h.inRange(t.text.spacing,-1e6,1e6))s.textSpacing=t.text.spacing;else throw h.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(h.defined(t.text.wrap))if(h.string(t.text.wrap)&&h.inArray(t.text.wrap,["word","char","word-char","none"]))s.textWrap=t.text.wrap;else throw h.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete s.buffer}else throw new Error("Expected a valid string to create an image with text.");if(h.defined(t.join))if(h.defined(this.options.join)){if(h.defined(t.join.animated))if(h.bool(t.join.animated))s.joinAnimated=t.join.animated;else throw h.invalidParameterError("join.animated","boolean",t.join.animated);if(h.defined(t.join.across))if(h.integer(t.join.across)&&h.inRange(t.join.across,1,1e6))s.joinAcross=t.join.across;else throw h.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(h.defined(t.join.shim))if(h.integer(t.join.shim)&&h.inRange(t.join.shim,0,1e6))s.joinShim=t.join.shim;else throw h.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(h.defined(t.join.background)&&(s.joinBackground=this._getBackgroundColourOption(t.join.background)),h.defined(t.join.halign))if(h.string(t.join.halign)&&h.string(this.constructor.align[t.join.halign]))s.joinHalign=this.constructor.align[t.join.halign];else throw h.invalidParameterError("join.halign","valid alignment",t.join.halign);if(h.defined(t.join.valign))if(h.string(t.join.valign)&&h.string(this.constructor.align[t.join.valign]))s.joinValign=this.constructor.align[t.join.valign];else throw h.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw new Error("Expected input to be an array of images to join")}else if(h.defined(t))throw new Error(`Invalid input options ${t}`);return s}function nc(e,t,r){Array.isArray(this.options.input.buffer)?h.buffer(e)?(this.options.input.buffer.length===0&&this.on("finish",()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),r()):r(new Error("Non-Buffer data on Writable Stream")):r(new Error("Unexpected data on Writable Stream"))}function ic(){this._isStreamInput()&&(this.options.input.buffer=v.concat(this.options.input.buffer))}function oc(){return Array.isArray(this.options.input.buffer)}function ac(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),tt.metadata(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)})}):tt.metadata(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)}),this):this._isStreamInput()?new Promise((r,s)=>{let n=()=>{this._flattenBufferIn(),tt.metadata(this.options,(i,o)=>{i?s(h.nativeError(i,t)):r(o)})};this.writableFinished?n():this.once("finish",n)}):new Promise((r,s)=>{tt.metadata(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}function lc(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),tt.stats(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)})}):tt.stats(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)}),this):this._isStreamInput()?new Promise((r,s)=>{this.on("finish",function(){this._flattenBufferIn(),tt.stats(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}):new Promise((r,s)=>{tt.stats(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}Qn.exports=e=>{Object.assign(e.prototype,{_inputOptionsFromObject:Yn,_createInputDescriptor:sc,_write:nc,_flattenBufferIn:ic,_isStreamInput:oc,metadata:ac,stats:lc}),e.align=tc}});var ii=q((_d,ni)=>{g();var D=Oe(),ti={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},ri={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},ei={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},si={entropy:16,attention:17},Lr={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},cc={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},uc={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function Mr(e){return e.angle%360!==0||e.rotationAngle!==0}function rr(e){return e.width!==-1||e.height!==-1}function fc(e,t,r){if(rr(this.options)&&this.options.debuglog("ignoring previous resize options"),this.options.widthPost!==-1&&this.options.debuglog("operation order will be: extract, resize, extract"),D.defined(e))if(D.object(e)&&!D.defined(r))r=e;else if(D.integer(e)&&e>0)this.options.width=e;else throw D.invalidParameterError("width","positive integer",e);else this.options.width=-1;if(D.defined(t))if(D.integer(t)&&t>0)this.options.height=t;else throw D.invalidParameterError("height","positive integer",t);else this.options.height=-1;if(D.object(r)){if(D.defined(r.width))if(D.integer(r.width)&&r.width>0)this.options.width=r.width;else throw D.invalidParameterError("width","positive integer",r.width);if(D.defined(r.height))if(D.integer(r.height)&&r.height>0)this.options.height=r.height;else throw D.invalidParameterError("height","positive integer",r.height);if(D.defined(r.fit)){let s=uc[r.fit];if(D.string(s))this.options.canvas=s;else throw D.invalidParameterError("fit","valid fit",r.fit)}if(D.defined(r.position)){let s=D.integer(r.position)?r.position:si[r.position]||ri[r.position]||ti[r.position];if(D.integer(s)&&(D.inRange(s,0,8)||D.inRange(s,16,17)))this.options.position=s;else throw D.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),D.defined(r.kernel))if(D.string(Lr[r.kernel]))this.options.kernel=Lr[r.kernel];else throw D.invalidParameterError("kernel","valid kernel name",r.kernel);D.defined(r.withoutEnlargement)&&this._setBooleanOption("withoutEnlargement",r.withoutEnlargement),D.defined(r.withoutReduction)&&this._setBooleanOption("withoutReduction",r.withoutReduction),D.defined(r.fastShrinkOnLoad)&&this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}return Mr(this.options)&&rr(this.options)&&(this.options.rotateBefore=!0),this}function hc(e){if(D.integer(e)&&e>0)this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else if(D.object(e)){if(D.defined(e.top))if(D.integer(e.top)&&e.top>=0)this.options.extendTop=e.top;else throw D.invalidParameterError("top","positive integer",e.top);if(D.defined(e.bottom))if(D.integer(e.bottom)&&e.bottom>=0)this.options.extendBottom=e.bottom;else throw D.invalidParameterError("bottom","positive integer",e.bottom);if(D.defined(e.left))if(D.integer(e.left)&&e.left>=0)this.options.extendLeft=e.left;else throw D.invalidParameterError("left","positive integer",e.left);if(D.defined(e.right))if(D.integer(e.right)&&e.right>=0)this.options.extendRight=e.right;else throw D.invalidParameterError("right","positive integer",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),D.defined(e.extendWith))if(D.string(ei[e.extendWith]))this.options.extendWith=ei[e.extendWith];else throw D.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw D.invalidParameterError("extend","integer or object",e);return this}function dc(e){let t=rr(this.options)||this.options.widthPre!==-1?"Post":"Pre";return this.options[`width${t}`]!==-1&&this.options.debuglog("ignoring previous extract options"),["left","top","width","height"].forEach(function(r){let s=e[r];if(D.integer(s)&&s>=0)this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=s;else throw D.invalidParameterError(r,"integer",s)},this),Mr(this.options)&&!rr(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function gc(e){if(this.options.trimThreshold=10,D.defined(e))if(D.object(e)){if(D.defined(e.background)&&this._setBackgroundColourOption("trimBackground",e.background),D.defined(e.threshold))if(D.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw D.invalidParameterError("threshold","positive number",e.threshold);D.defined(e.lineArt)&&this._setBooleanOption("trimLineArt",e.lineArt)}else throw D.invalidParameterError("trim","object",e);return Mr(this.options)&&(this.options.rotateBefore=!0),this}ni.exports=e=>{Object.assign(e.prototype,{resize:fc,extend:hc,extract:dc,trim:gc}),e.gravity=ti,e.strategy=si,e.kernel=Lr,e.fit=cc,e.position=ri}});var ai=q((Id,oi)=>{g();var Z=Oe(),zr={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"};function pc(e){if(!Array.isArray(e))throw Z.invalidParameterError("images to composite","array",e);return this.options.composite=e.map(t=>{if(!Z.object(t))throw Z.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),s={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(Z.defined(t.blend))if(Z.string(zr[t.blend]))s.blend=zr[t.blend];else throw Z.invalidParameterError("blend","valid blend name",t.blend);if(Z.defined(t.tile))if(Z.bool(t.tile))s.tile=t.tile;else throw Z.invalidParameterError("tile","boolean",t.tile);if(Z.defined(t.left))if(Z.integer(t.left))s.left=t.left;else throw Z.invalidParameterError("left","integer",t.left);if(Z.defined(t.top))if(Z.integer(t.top))s.top=t.top;else throw Z.invalidParameterError("top","integer",t.top);if(Z.defined(t.top)!==Z.defined(t.left))throw new Error("Expected both left and top to be set");if(s.hasOffset=Z.integer(t.top)&&Z.integer(t.left),Z.defined(t.gravity))if(Z.integer(t.gravity)&&Z.inRange(t.gravity,0,8))s.gravity=t.gravity;else if(Z.string(t.gravity)&&Z.integer(this.constructor.gravity[t.gravity]))s.gravity=this.constructor.gravity[t.gravity];else throw Z.invalidParameterError("gravity","valid gravity",t.gravity);if(Z.defined(t.premultiplied))if(Z.bool(t.premultiplied))s.premultiplied=t.premultiplied;else throw Z.invalidParameterError("premultiplied","boolean",t.premultiplied);return s}),this}oi.exports=e=>{e.prototype.composite=pc,e.blend=zr}});var hi=q((Dd,fi)=>{g();var d=Oe(),li={integer:"integer",float:"float",approximate:"approximate"};function mc(e,t){if(!d.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0),d.integer(e)&&!(e%90))this.options.angle=e;else if(d.number(e))this.options.rotationAngle=e,d.object(t)&&t.background&&this._setBackgroundColourOption("rotationBackground",t.background);else throw d.invalidParameterError("angle","numeric",e);return this}function bc(){return this.options.input.autoOrient=!0,this}function vc(e){return this.options.flip=d.bool(e)?e:!0,this}function yc(e){return this.options.flop=d.bool(e)?e:!0,this}function wc(e,t){let r=[].concat(...e);if(r.length===4&&r.every(d.number))this.options.affineMatrix=r;else throw d.invalidParameterError("matrix","1x4 or 2x2 array",e);if(d.defined(t))if(d.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),d.defined(t.idx))if(d.number(t.idx))this.options.affineIdx=t.idx;else throw d.invalidParameterError("options.idx","number",t.idx);if(d.defined(t.idy))if(d.number(t.idy))this.options.affineIdy=t.idy;else throw d.invalidParameterError("options.idy","number",t.idy);if(d.defined(t.odx))if(d.number(t.odx))this.options.affineOdx=t.odx;else throw d.invalidParameterError("options.odx","number",t.odx);if(d.defined(t.ody))if(d.number(t.ody))this.options.affineOdy=t.ody;else throw d.invalidParameterError("options.ody","number",t.ody);if(d.defined(t.interpolator))if(d.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw d.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw d.invalidParameterError("options","object",t);return this}function Ec(e,t,r){if(!d.defined(e))this.options.sharpenSigma=-1;else if(d.bool(e))this.options.sharpenSigma=e?-1:0;else if(d.number(e)&&d.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,d.defined(t))if(d.number(t)&&d.inRange(t,0,1e4))this.options.sharpenM1=t;else throw d.invalidParameterError("flat","number between 0 and 10000",t);if(d.defined(r))if(d.number(r)&&d.inRange(r,0,1e4))this.options.sharpenM2=r;else throw d.invalidParameterError("jagged","number between 0 and 10000",r)}else if(d.plainObject(e)){if(d.number(e.sigma)&&d.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw d.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(d.defined(e.m1))if(d.number(e.m1)&&d.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw d.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(d.defined(e.m2))if(d.number(e.m2)&&d.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw d.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(d.defined(e.x1))if(d.number(e.x1)&&d.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw d.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(d.defined(e.y2))if(d.number(e.y2)&&d.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw d.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(d.defined(e.y3))if(d.number(e.y3)&&d.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw d.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else throw d.invalidParameterError("sigma","number between 0.01 and 10000",e);return this}function xc(e){if(!d.defined(e))this.options.medianSize=3;else if(d.integer(e)&&d.inRange(e,1,1e3))this.options.medianSize=e;else throw d.invalidParameterError("size","integer between 1 and 1000",e);return this}function Pc(e){let t;if(d.number(e))t=e;else if(d.plainObject(e)){if(!d.number(e.sigma))throw d.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(d.string(li[e.precision]))this.options.precision=li[e.precision];else throw d.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(d.number(e.minAmplitude)&&d.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw d.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!d.defined(e))this.options.blurSigma=-1;else if(d.bool(e))this.options.blurSigma=e?-1:0;else if(d.number(t)&&d.inRange(t,.3,1e3))this.options.blurSigma=t;else throw d.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function ci(e){if(!d.defined(e))this.options.dilateWidth=1;else if(d.integer(e)&&e>0)this.options.dilateWidth=e;else throw d.invalidParameterError("dilate","positive integer",ci);return this}function ui(e){if(!d.defined(e))this.options.erodeWidth=1;else if(d.integer(e)&&e>0)this.options.erodeWidth=e;else throw d.invalidParameterError("erode","positive integer",ui);return this}function Rc(e){return this.options.flatten=d.bool(e)?e:!0,d.object(e)&&this._setBackgroundColourOption("flattenBackground",e.background),this}function Sc(){return this.options.unflatten=!0,this}function $c(e,t){if(!d.defined(e))this.options.gamma=2.2;else if(d.number(e)&&d.inRange(e,1,3))this.options.gamma=e;else throw d.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!d.defined(t))this.options.gammaOut=this.options.gamma;else if(d.number(t)&&d.inRange(t,1,3))this.options.gammaOut=t;else throw d.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function kc(e){if(this.options.negate=d.bool(e)?e:!0,d.plainObject(e)&&"alpha"in e)if(d.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw d.invalidParameterError("alpha","should be boolean value",e.alpha);return this}function Ac(e){if(d.plainObject(e)){if(d.defined(e.lower))if(d.number(e.lower)&&d.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw d.invalidParameterError("lower","number between 0 and 99",e.lower);if(d.defined(e.upper))if(d.number(e.upper)&&d.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw d.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw d.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function _c(e){return this.normalise(e)}function Nc(e){if(d.plainObject(e)){if(d.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw d.invalidParameterError("width","integer greater than zero",e.width);if(d.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw d.invalidParameterError("height","integer greater than zero",e.height);if(d.defined(e.maxSlope))if(d.integer(e.maxSlope)&&d.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw d.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw d.invalidParameterError("options","plain object",e);return this}function Ic(e){if(!d.object(e)||!Array.isArray(e.kernel)||!d.integer(e.width)||!d.integer(e.height)||!d.inRange(e.width,3,1001)||!d.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw new Error("Invalid convolution kernel");return d.integer(e.scale)||(e.scale=e.kernel.reduce((t,r)=>t+r,0)),e.scale<1&&(e.scale=1),d.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function Tc(e,t){if(!d.defined(e))this.options.threshold=128;else if(d.bool(e))this.options.threshold=e?128:0;else if(d.integer(e)&&d.inRange(e,0,255))this.options.threshold=e;else throw d.invalidParameterError("threshold","integer between 0 and 255",e);return!d.object(t)||t.greyscale===!0||t.grayscale===!0?this.options.thresholdGrayscale=!0:this.options.thresholdGrayscale=!1,this}function Dc(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),d.string(t)&&d.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw d.invalidParameterError("operator","one of: and, or, eor",t);return this}function Cc(e,t){if(!d.defined(e)&&d.number(t)?e=1:d.number(e)&&!d.defined(t)&&(t=0),!d.defined(e))this.options.linearA=[];else if(d.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(d.number))this.options.linearA=e;else throw d.invalidParameterError("a","number or array of numbers",e);if(!d.defined(t))this.options.linearB=[];else if(d.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&t.length&&t.every(d.number))this.options.linearB=t;else throw d.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw new Error("Expected a and b to be arrays of the same length");return this}function Fc(e){if(!Array.isArray(e))throw d.invalidParameterError("inputMatrix","array",e);if(e.length!==3&&e.length!==4)throw d.invalidParameterError("inputMatrix","3x3 or 4x4 array",e.length);let t=e.flat().map(Number);if(t.length!==9&&t.length!==16)throw d.invalidParameterError("inputMatrix","cardinality of 9 or 16",t.length);return this.options.recombMatrix=t,this}function Oc(e){if(!d.plainObject(e))throw d.invalidParameterError("options","plain object",e);if("brightness"in e)if(d.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw d.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(d.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw d.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(d.integer(e.hue))this.options.hue=e.hue%360;else throw d.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(d.number(e.lightness))this.options.lightness=e.lightness;else throw d.invalidParameterError("lightness","number",e.lightness);return this}fi.exports=e=>{Object.assign(e.prototype,{autoOrient:bc,rotate:mc,flip:vc,flop:yc,affine:wc,sharpen:Ec,erode:ui,dilate:ci,median:xc,blur:Pc,flatten:Rc,unflatten:Sc,gamma:$c,negate:kc,normalise:Ac,normalize:_c,clahe:Nc,convolve:Ic,threshold:Tc,boolean:Dc,linear:Cc,recomb:Fc,modulate:Oc})}});var vi=q((Fd,bi)=>{g();var qr=Object.defineProperty,jc=Object.getOwnPropertyDescriptor,Lc=Object.getOwnPropertyNames,Mc=Object.prototype.hasOwnProperty,zc=(e,t)=>{for(var r in t)qr(e,r,{get:t[r],enumerable:!0})},Bc=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Lc(t))!Mc.call(e,n)&&n!==r&&qr(e,n,{get:()=>t[n],enumerable:!(s=jc(t,n))||s.enumerable});return e},Uc=e=>Bc(qr({},"__esModule",{value:!0}),e),di={};zc(di,{default:()=>ru});bi.exports=Uc(di);var Be={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},gi=Object.create(null);for(let e in Be)Object.hasOwn(Be,e)&&(gi[Be[e]]=e);var Pe={to:{},get:{}};Pe.get=function(e){let t=e.slice(0,3).toLowerCase(),r,s;switch(t){case"hsl":{r=Pe.get.hsl(e),s="hsl";break}case"hwb":{r=Pe.get.hwb(e),s="hwb";break}default:{r=Pe.get.rgb(e),s="rgb";break}}return r?{model:s,value:r}:null};Pe.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,s=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,o=[0,0,0,1],a,c,u;if(a=e.match(r)){for(u=a[2],a=a[1],c=0;c<3;c++){let f=c*2;o[c]=Number.parseInt(a.slice(f,f+2),16)}u&&(o[3]=Number.parseInt(u,16)/255)}else if(a=e.match(t)){for(a=a[1],u=a[3],c=0;c<3;c++)o[c]=Number.parseInt(a[c]+a[c],16);u&&(o[3]=Number.parseInt(u+u,16)/255)}else if(a=e.match(s)){for(c=0;c<3;c++)o[c]=Number.parseInt(a[c+1],10);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else if(a=e.match(n)){for(c=0;c<3;c++)o[c]=Math.round(Number.parseFloat(a[c+1])*2.55);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else return(a=e.match(i))?a[1]==="transparent"?[0,0,0,0]:Object.hasOwn(Be,a[1])?(o=Be[a[1]],o[3]=1,o):null:null;for(c=0;c<3;c++)o[c]=rt(o[c],0,255);return o[3]=rt(o[3],0,1),o};Pe.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){let s=Number.parseFloat(r[4]),n=(Number.parseFloat(r[1])%360+360)%360,i=rt(Number.parseFloat(r[2]),0,100),o=rt(Number.parseFloat(r[3]),0,100),a=rt(Number.isNaN(s)?1:s,0,1);return[n,i,o,a]}return null};Pe.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){let s=Number.parseFloat(r[4]),n=(Number.parseFloat(r[1])%360+360)%360,i=rt(Number.parseFloat(r[2]),0,100),o=rt(Number.parseFloat(r[3]),0,100),a=rt(Number.isNaN(s)?1:s,0,1);return[n,i,o,a]}return null};Pe.to.hex=function(...e){return"#"+sr(e[0])+sr(e[1])+sr(e[2])+(e[3]<1?sr(Math.round(e[3]*255)):"")};Pe.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};Pe.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),s=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+s+"%)":"rgba("+t+"%, "+r+"%, "+s+"%, "+e[3]+")"};Pe.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};Pe.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};Pe.to.keyword=function(...e){return gi[e.slice(0,3)]};function rt(e,t,r){return Math.min(Math.max(t,e),r)}function sr(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var Et=Pe,pi={};for(let e of Object.keys(Be))pi[Be[e]]=e;var _={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},ht=_,He=(6/29)**3;function Pt(e){let t=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,t),1)}function Rt(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(_)){if(!("channels"in _[e]))throw new Error("missing channels property: "+e);if(!("labels"in _[e]))throw new Error("missing channel labels property: "+e);if(_[e].labels.length!==_[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=_[e];delete _[e].channels,delete _[e].labels,Object.defineProperty(_[e],"channels",{value:t}),Object.defineProperty(_[e],"labels",{value:r})}_.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.min(t,r,s),i=Math.max(t,r,s),o=i-n,a,c;switch(i){case n:{a=0;break}case t:{a=(r-s)/o;break}case r:{a=2+(s-t)/o;break}case s:{a=4+(t-r)/o;break}}a=Math.min(a*60,360),a<0&&(a+=360);let u=(n+i)/2;return i===n?c=0:u<=.5?c=o/(i+n):c=o/(2-i-n),[a,c*100,u*100]};_.rgb.hsv=function(e){let t,r,s,n,i,o=e[0]/255,a=e[1]/255,c=e[2]/255,u=Math.max(o,a,c),f=u-Math.min(o,a,c),b=function(m){return(u-m)/6/f+1/2};if(f===0)n=0,i=0;else{switch(i=f/u,t=b(o),r=b(a),s=b(c),u){case o:{n=s-r;break}case a:{n=1/3+t-s;break}case c:{n=2/3+r-t;break}}n<0?n+=1:n>1&&(n-=1)}return[n*360,i*100,u*100]};_.rgb.hwb=function(e){let t=e[0],r=e[1],s=e[2],n=_.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(r,s));return s=1-1/255*Math.max(t,Math.max(r,s)),[n,i*100,s*100]};_.rgb.oklab=function(e){let t=Rt(e[0]/255),r=Rt(e[1]/255),s=Rt(e[2]/255),n=Math.cbrt(.4122214708*t+.5363325363*r+.0514459929*s),i=Math.cbrt(.2119034982*t+.6806995451*r+.1073969566*s),o=Math.cbrt(.0883024619*t+.2817188376*r+.6299787005*s),a=.2104542553*n+.793617785*i-.0040720468*o,c=1.9779984951*n-2.428592205*i+.4505937099*o,u=.0259040371*n+.7827717662*i-.808675766*o;return[a*100,c*100,u*100]};_.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.min(1-t,1-r,1-s),i=(1-t-n)/(1-n)||0,o=(1-r-n)/(1-n)||0,a=(1-s-n)/(1-n)||0;return[i*100,o*100,a*100,n*100]};function Gc(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}_.rgb.keyword=function(e){let t=pi[e];if(t)return t;let r=Number.POSITIVE_INFINITY,s;for(let n of Object.keys(Be)){let i=Be[n],o=Gc(e,i);o<r&&(r=o,s=n)}return s};_.keyword.rgb=function(e){return Be[e]};_.rgb.xyz=function(e){let t=Rt(e[0]/255),r=Rt(e[1]/255),s=Rt(e[2]/255),n=t*.4124564+r*.3575761+s*.1804375,i=t*.2126729+r*.7151522+s*.072175,o=t*.0193339+r*.119192+s*.9503041;return[n*100,i*100,o*100]};_.rgb.lab=function(e){let t=_.rgb.xyz(e),r=t[0],s=t[1],n=t[2];r/=95.047,s/=100,n/=108.883,r=r>He?r**(1/3):7.787*r+16/116,s=s>He?s**(1/3):7.787*s+16/116,n=n>He?n**(1/3):7.787*n+16/116;let i=116*s-16,o=500*(r-s),a=200*(s-n);return[i,o,a]};_.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100,n,i;if(r===0)return i=s*255,[i,i,i];let o=s<.5?s*(1+r):s+r-s*r,a=2*s-o,c=[0,0,0];for(let u=0;u<3;u++)n=t+1/3*-(u-1),n<0&&n++,n>1&&n--,6*n<1?i=a+(o-a)*6*n:2*n<1?i=o:3*n<2?i=a+(o-a)*(2/3-n)*6:i=a,c[u]=i*255;return c};_.hsl.hsv=function(e){let t=e[0],r=e[1]/100,s=e[2]/100,n=r,i=Math.max(s,.01);s*=2,r*=s<=1?s:2-s,n*=i<=1?i:2-i;let o=(s+r)/2,a=s===0?2*n/(i+n):2*r/(s+r);return[t,a*100,o*100]};_.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,s=e[2]/100,n=Math.floor(t)%6,i=t-Math.floor(t),o=255*s*(1-r),a=255*s*(1-r*i),c=255*s*(1-r*(1-i));switch(s*=255,n){case 0:return[s,c,o];case 1:return[a,s,o];case 2:return[o,s,c];case 3:return[o,a,s];case 4:return[c,o,s];case 5:return[s,o,a]}};_.hsv.hsl=function(e){let t=e[0],r=e[1]/100,s=e[2]/100,n=Math.max(s,.01),i,o;o=(2-r)*s;let a=(2-r)*n;return i=r*n,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};_.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100,n=r+s,i;n>1&&(r/=n,s/=n);let o=Math.floor(6*t),a=1-s;i=6*t-o,(o&1)!==0&&(i=1-i);let c=r+i*(a-r),u,f,b;switch(o){default:case 6:case 0:{u=a,f=c,b=r;break}case 1:{u=c,f=a,b=r;break}case 2:{u=r,f=a,b=c;break}case 3:{u=r,f=c,b=a;break}case 4:{u=c,f=r,b=a;break}case 5:{u=a,f=r,b=c;break}}return[u*255,f*255,b*255]};_.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=e[3]/100,i=1-Math.min(1,t*(1-n)+n),o=1-Math.min(1,r*(1-n)+n),a=1-Math.min(1,s*(1-n)+n);return[i*255,o*255,a*255]};_.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n,i,o;return n=t*3.2404542+r*-1.5371385+s*-.4985314,i=t*-.969266+r*1.8760108+s*.041556,o=t*.0556434+r*-.2040259+s*1.0572252,n=Pt(n),i=Pt(i),o=Pt(o),[n*255,i*255,o*255]};_.xyz.lab=function(e){let t=e[0],r=e[1],s=e[2];t/=95.047,r/=100,s/=108.883,t=t>He?t**(1/3):7.787*t+16/116,r=r>He?r**(1/3):7.787*r+16/116,s=s>He?s**(1/3):7.787*s+16/116;let n=116*r-16,i=500*(t-r),o=200*(r-s);return[n,i,o]};_.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=Math.cbrt(.8189330101*t+.3618667424*r-.1288597137*s),i=Math.cbrt(.0329845436*t+.9293118715*r+.0361456387*s),o=Math.cbrt(.0482003018*t+.2643662691*r+.633851707*s),a=.2104542553*n+.793617785*i-.0040720468*o,c=1.9779984951*n-2.428592205*i+.4505937099*o,u=.0259040371*n+.7827717662*i-.808675766*o;return[a*100,c*100,u*100]};_.oklab.oklch=function(e){return _.lab.lch(e)};_.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=(.999999998*t+.396337792*r+.215803758*s)**3,i=(1.000000008*t-.105561342*r-.063854175*s)**3,o=(1.000000055*t-.089484182*r-1.291485538*s)**3,a=1.227013851*n-.55779998*i+.281256149*o,c=-.040580178*n+1.11225687*i-.071676679*o,u=-.076381285*n-.421481978*i+1.58616322*o;return[a*100,c*100,u*100]};_.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=(t+.3963377774*r+.2158037573*s)**3,i=(t-.1055613458*r-.0638541728*s)**3,o=(t-.0894841775*r-1.291485548*s)**3,a=Pt(4.0767416621*n-3.3077115913*i+.2309699292*o),c=Pt(-1.2684380046*n+2.6097574011*i-.3413193965*o),u=Pt(-.0041960863*n-.7034186147*i+1.707614701*o);return[a*255,c*255,u*255]};_.oklch.oklab=function(e){return _.lch.lab(e)};_.lab.xyz=function(e){let t=e[0],r=e[1],s=e[2],n,i,o;i=(t+16)/116,n=r/500+i,o=i-s/200;let a=i**3,c=n**3,u=o**3;return i=a>He?a:(i-16/116)/7.787,n=c>He?c:(n-16/116)/7.787,o=u>He?u:(o-16/116)/7.787,n*=95.047,i*=100,o*=108.883,[n,i,o]};_.lab.lch=function(e){let t=e[0],r=e[1],s=e[2],n;n=Math.atan2(s,r)*360/2/Math.PI,n<0&&(n+=360);let o=Math.sqrt(r*r+s*s);return[t,o,n]};_.lch.lab=function(e){let t=e[0],r=e[1],n=e[2]/360*2*Math.PI,i=r*Math.cos(n),o=r*Math.sin(n);return[t,i,o]};_.rgb.ansi16=function(e,t=null){let[r,s,n]=e,i=t===null?_.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(n/255)<<2|Math.round(s/255)<<1|Math.round(r/255));return i===2&&(o+=60),o};_.hsv.ansi16=function(e){return _.rgb.ansi16(_.hsv.rgb(e),e[2])};_.rgb.ansi256=function(e){let t=e[0],r=e[1],s=e[2];return t>>4===r>>4&&r>>4===s>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5)};_.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let r=(Math.trunc(e>50)+1)*.5,s=(t&1)*r*255,n=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[s,n,i]};_.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,s=Math.floor((t=e%36)/6)/5*255,n=t%6/5*255;return[r,s,n]};_.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};_.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=[...r].map(a=>a+a).join(""));let s=Number.parseInt(r,16),n=s>>16&255,i=s>>8&255,o=s&255;return[n,i,o]};_.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.max(Math.max(t,r),s),i=Math.min(Math.min(t,r),s),o=n-i,a,c=o<1?i/(1-o):0;return o<=0?a=0:n===t?a=(r-s)/o%6:n===r?a=2+(s-t)/o:a=4+(t-r)/o,a/=6,a%=1,[a*360,o*100,c*100]};_.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,s=r<.5?2*t*r:2*t*(1-r),n=0;return s<1&&(n=(r-.5*s)/(1-s)),[e[0],s*100,n*100]};_.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,s=t*r,n=0;return s<1&&(n=(r-s)/(1-s)),[e[0],s*100,n*100]};_.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100;if(r===0)return[s*255,s*255,s*255];let n=[0,0,0],i=t%1*6,o=i%1,a=1-o,c=0;switch(Math.floor(i)){case 0:{n[0]=1,n[1]=o,n[2]=0;break}case 1:{n[0]=a,n[1]=1,n[2]=0;break}case 2:{n[0]=0,n[1]=1,n[2]=o;break}case 3:{n[0]=0,n[1]=a,n[2]=1;break}case 4:{n[0]=o,n[1]=0,n[2]=1;break}default:n[0]=1,n[1]=0,n[2]=a}return c=(1-r)*s,[(r*n[0]+c)*255,(r*n[1]+c)*255,(r*n[2]+c)*255]};_.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,s=t+r*(1-t),n=0;return s>0&&(n=t/s),[e[0],n*100,s*100]};_.hcg.hsl=function(e){let t=e[1]/100,s=e[2]/100*(1-t)+.5*t,n=0;return s>0&&s<.5?n=t/(2*s):s>=.5&&s<1&&(n=t/(2*(1-s))),[e[0],n*100,s*100]};_.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,s=t+r*(1-t);return[e[0],(s-t)*100,(1-s)*100]};_.hwb.hcg=function(e){let t=e[1]/100,s=1-e[2]/100,n=s-t,i=0;return n<1&&(i=(s-n)/(1-n)),[e[0],n*100,i*100]};_.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};_.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};_.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};_.gray.hsl=function(e){return[0,0,e[0]]};_.gray.hsv=_.gray.hsl;_.gray.hwb=function(e){return[0,100,e[0]]};_.gray.cmyk=function(e){return[0,0,0,e[0]]};_.gray.lab=function(e){return[e[0],0,0]};_.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,s=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(s.length)+s};_.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function qc(){let e={},t=Object.keys(ht);for(let{length:r}=t,s=0;s<r;s++)e[t[s]]={distance:-1,parent:null};return e}function Wc(e){let t=qc(),r=[e];for(t[e].distance=0;r.length>0;){let s=r.pop(),n=Object.keys(ht[s]);for(let{length:i}=n,o=0;o<i;o++){let a=n[o],c=t[a];c.distance===-1&&(c.distance=t[s].distance+1,c.parent=s,r.unshift(a))}}return t}function Hc(e,t){return function(r){return t(e(r))}}function Vc(e,t){let r=[t[e].parent,e],s=ht[t[e].parent][e],n=t[e].parent;for(;t[n].parent;)r.unshift(t[n].parent),s=Hc(ht[t[n].parent][n],s),n=t[n].parent;return s.conversion=r,s}function Jc(e){let t=Wc(e),r={},s=Object.keys(t);for(let{length:n}=s,i=0;i<n;i++){let o=s[i];t[o].parent!==null&&(r[o]=Vc(o,t))}return r}var Xc=Jc,xt={},Kc=Object.keys(ht);function Yc(e){let t=function(...r){let s=r[0];return s==null?s:(s.length>1&&(r=s),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function Qc(e){let t=function(...r){let s=r[0];if(s==null)return s;s.length>1&&(r=s);let n=e(r);if(typeof n=="object")for(let{length:i}=n,o=0;o<i;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}for(let e of Kc){xt[e]={},Object.defineProperty(xt[e],"channels",{value:ht[e].channels}),Object.defineProperty(xt[e],"labels",{value:ht[e].labels});let t=Xc(e),r=Object.keys(t);for(let s of r){let n=t[s];xt[e][s]=Qc(n),xt[e][s].raw=Yc(n)}}var Se=xt,mi=["keyword","gray","hex"],Br={};for(let e of Object.keys(Se))Br[[...Se[e].labels].sort().join("")]=e;var Ur={};function he(e,t){if(!(this instanceof he))return new he(e,t);if(t&&t in mi&&(t=null),t&&!(t in Se))throw new Error("Unknown model: "+t);let r,s;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof he)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){let n=Et.get(e);if(n===null)throw new Error("Unable to parse color from string: "+e);this.model=n.model,s=Se[this.model].channels,this.color=n.value.slice(0,s),this.valpha=typeof n.value[s]=="number"?n.value[s]:1}else if(e.length>0){this.model=t||"rgb",s=Se[this.model].channels;let n=Array.prototype.slice.call(e,0,s);this.color=Gr(n,s),this.valpha=typeof e[s]=="number"?e[s]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let n=Object.keys(e);"alpha"in e&&(n.splice(n.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);let i=n.sort().join("");if(!(i in Br))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Br[i];let{labels:o}=Se[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=Gr(a)}if(Ur[this.model])for(s=Se[this.model].channels,r=0;r<s;r++){let n=Ur[this.model][r];n&&(this.color[r]=n(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}he.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in Et.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return Et.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e=="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return Et.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=Se[this.model],{labels:r}=Se[this.model];for(let s=0;s<t;s++)e[r[s]]=this.color[s];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new he([...this.color.map(eu(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new he([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:oe("rgb",0,ce(255)),green:oe("rgb",1,ce(255)),blue:oe("rgb",2,ce(255)),hue:oe(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:oe("hsl",1,ce(100)),lightness:oe("hsl",2,ce(100)),saturationv:oe("hsv",1,ce(100)),value:oe("hsv",2,ce(100)),chroma:oe("hcg",1,ce(100)),gray:oe("hcg",2,ce(100)),white:oe("hwb",1,ce(100)),wblack:oe("hwb",2,ce(100)),cyan:oe("cmyk",0,ce(100)),magenta:oe("cmyk",1,ce(100)),yellow:oe("cmyk",2,ce(100)),black:oe("cmyk",3,ce(100)),x:oe("xyz",0,ce(95.047)),y:oe("xyz",1,ce(100)),z:oe("xyz",2,ce(108.833)),l:oe("lab",0,ce(100)),a:oe("lab",1),b:oe("lab",2),keyword(e){return e!==void 0?new he(e):Se[this.model].keyword(this.color)},hex(e){return e!==void 0?new he(e):Et.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new he(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();return r.length===1&&(r="0"+r),Et.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,s]of e.entries()){let n=s/255;t[r]=n<=.04045?n/12.92:((n+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return he.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),s=this.rgb(),n=t===void 0?.5:t,i=2*n-1,o=r.alpha()-s.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,c=1-a;return he.rgb(a*r.red()+c*s.red(),a*r.green()+c*s.green(),a*r.blue()+c*s.blue(),r.alpha()*n+s.alpha()*(1-n))}};for(let e of Object.keys(Se)){if(mi.includes(e))continue;let{channels:t}=Se[e];he.prototype[e]=function(...r){return this.model===e?new he(this):r.length>0?new he(r,e):new he([...tu(Se[this.model][e].raw(this.color)),this.valpha],e)},he[e]=function(...r){let s=r[0];return typeof s=="number"&&(s=Gr(r,t)),new he(s,e)}}function Zc(e,t){return Number(e.toFixed(t))}function eu(e){return function(t){return Zc(t,e)}}function oe(e,t,r){e=Array.isArray(e)?e:[e];for(let s of e)(Ur[s]||=[])[t]=r;return e=e[0],function(s){let n;return s!==void 0?(r&&(s=r(s)),n=this[e](),n.color[t]=s,n):(n=this[e]().color[t],r&&(n=r(n)),n)}}function ce(e){return function(t){return Math.max(0,Math.min(e,t))}}function tu(e){return Array.isArray(e)?e:[e]}function Gr(e,t){for(let r=0;r<t;r++)typeof e[r]!="number"&&(e[r]=0);return e}var ru=he});var wi=q((jd,yi)=>{g();yi.exports=vi().default});var Ri=q((Md,Pi)=>{g();var su=wi(),Ve=Oe(),Ei={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function nu(e){return this._setBackgroundColourOption("tint",e),this}function iu(e){return this.options.greyscale=Ve.bool(e)?e:!0,this}function ou(e){return this.greyscale(e)}function au(e){if(!Ve.string(e))throw Ve.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function lu(e){return this.pipelineColourspace(e)}function cu(e){if(!Ve.string(e))throw Ve.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function uu(e){return this.toColourspace(e)}function xi(e){if(Ve.object(e)||Ve.string(e)&&e.length>=3&&e.length<=200){let t=su(e);return[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}else throw Ve.invalidParameterError("background","object or string",e)}function fu(e,t){Ve.defined(t)&&(this.options[e]=xi(t))}Pi.exports=e=>{Object.assign(e.prototype,{tint:nu,greyscale:iu,grayscale:ou,pipelineColourspace:au,pipelineColorspace:lu,toColourspace:cu,toColorspace:uu,_getBackgroundColourOption:xi,_setBackgroundColourOption:fu}),e.colourspace=Ei,e.colorspace=Ei}});var $i=q((Bd,Si)=>{g();var Ue=Oe(),hu={and:"and",or:"or",eor:"eor"};function du(){return this.options.removeAlpha=!0,this}function gu(e){if(Ue.defined(e))if(Ue.number(e)&&Ue.inRange(e,0,1))this.options.ensureAlpha=e;else throw Ue.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function pu(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e)&&(e=t[e]),Ue.integer(e)&&Ue.inRange(e,0,4))this.options.extractChannel=e;else throw Ue.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function mu(e,t){return Array.isArray(e)?e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this):this.options.joinChannelIn.push(this._createInputDescriptor(e,t)),this}function bu(e){if(Ue.string(e)&&Ue.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw Ue.invalidParameterError("boolOp","one of: and, or, eor",e);return this}Si.exports=e=>{Object.assign(e.prototype,{removeAlpha:du,ensureAlpha:gu,extractChannel:pu,joinChannel:mu,bandbool:bu}),e.bool=hu}});var Ii=q((Gd,Ni)=>{g();var Wr=ie("node:path"),l=Oe(),St=Ct(),ki=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),vu=/\.(jp[2x]|j2[kc])$/i,Ai=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),_i=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function yu(e,t){let r;if(l.string(e)?l.string(this.options.input.file)&&Wr.resolve(this.options.input.file)===Wr.resolve(e)?r=new Error("Cannot use same file for input and output"):vu.test(Wr.extname(e))&&!this.constructor.format.jp2k.output.file&&(r=Ai()):r=new Error("Missing output file path"),r)if(l.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let s=Error();return this._pipeline(t,s)}return this}function wu(e,t){l.object(e)?this._setBooleanOption("resolveWithObject",e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut="";let r=Error();return this._pipeline(l.fn(e)?e:t,r)}function Eu(){return this.options.keepMetadata|=1,this}function xu(e){if(l.object(e))for(let[t,r]of Object.entries(e))if(l.object(r))for(let[s,n]of Object.entries(r))if(l.string(n))this.options.withExif[`exif-${t.toLowerCase()}-${s}`]=n;else throw l.invalidParameterError(`${t}.${s}`,"string",n);else throw l.invalidParameterError(t,"object",r);else throw l.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function Pu(e){return this.withExif(e),this.options.withExifMerge=!0,this}function Ru(){return this.options.keepMetadata|=8,this}function Su(e,t){if(l.string(e))this.options.withIccProfile=e;else throw l.invalidParameterError("icc","string",e);if(this.keepIccProfile(),l.object(t)&&l.defined(t.attach))if(l.bool(t.attach))t.attach||(this.options.keepMetadata&=-9);else throw l.invalidParameterError("attach","boolean",t.attach);return this}function $u(){return this.options.keepMetadata|=2,this}function ku(e){if(l.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw l.invalidParameterError("xmp","non-empty string",e);return this}function Au(){return this.options.keepMetadata=31,this}function _u(e){if(this.keepMetadata(),this.withIccProfile("srgb"),l.object(e)){if(l.defined(e.orientation))if(l.integer(e.orientation)&&l.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw l.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(l.defined(e.density))if(l.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw l.invalidParameterError("density","positive number",e.density);l.defined(e.icc)&&this.withIccProfile(e.icc),l.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function Nu(e,t){let r=ki.get((l.object(e)&&l.string(e.id)?e.id:e).toLowerCase());if(!r)throw l.invalidParameterError("format",`one of: ${[...ki.keys()].join(", ")}`,e);return this[r](t)}function Iu(e){if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.progressive)&&this._setBooleanOption("jpegProgressive",e.progressive),l.defined(e.chromaSubsampling))if(l.string(e.chromaSubsampling)&&l.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw l.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=l.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(l.defined(t)&&this._setBooleanOption("jpegOptimiseCoding",t),l.defined(e.mozjpeg))if(l.bool(e.mozjpeg))e.mozjpeg&&(this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3);else throw l.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=l.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;l.defined(r)&&this._setBooleanOption("jpegTrellisQuantisation",r),l.defined(e.overshootDeringing)&&this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let s=l.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;l.defined(s)&&(this._setBooleanOption("jpegOptimiseScans",s),s&&(this.options.jpegProgressive=!0));let n=l.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(l.defined(n))if(l.integer(n)&&l.inRange(n,0,8))this.options.jpegQuantisationTable=n;else throw l.invalidParameterError("quantisationTable","integer between 0 and 8",n)}return this._updateFormatOut("jpeg",e)}function Tu(e){if(l.object(e)){if(l.defined(e.progressive)&&this._setBooleanOption("pngProgressive",e.progressive),l.defined(e.compressionLevel))if(l.integer(e.compressionLevel)&&l.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw l.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);l.defined(e.adaptiveFiltering)&&this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(l.defined(t))if(l.integer(t)&&l.inRange(t,2,256))this.options.pngBitdepth=_i(t);else throw l.invalidParameterError("colours","integer between 2 and 256",t);if(l.defined(e.palette)?this._setBooleanOption("pngPalette",e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(l.defined)&&this._setBooleanOption("pngPalette",!0),this.options.pngPalette){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw l.invalidParameterError("quality","integer between 0 and 100",e.quality);if(l.defined(e.effort))if(l.integer(e.effort)&&l.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw l.invalidParameterError("effort","integer between 1 and 10",e.effort);if(l.defined(e.dither))if(l.number(e.dither)&&l.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw l.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function Du(e){if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.alphaQuality))if(l.integer(e.alphaQuality)&&l.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw l.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(l.defined(e.lossless)&&this._setBooleanOption("webpLossless",e.lossless),l.defined(e.nearLossless)&&this._setBooleanOption("webpNearLossless",e.nearLossless),l.defined(e.smartSubsample)&&this._setBooleanOption("webpSmartSubsample",e.smartSubsample),l.defined(e.smartDeblock)&&this._setBooleanOption("webpSmartDeblock",e.smartDeblock),l.defined(e.preset))if(l.string(e.preset)&&l.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw l.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(l.defined(e.effort))if(l.integer(e.effort)&&l.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw l.invalidParameterError("effort","integer between 0 and 6",e.effort);l.defined(e.minSize)&&this._setBooleanOption("webpMinSize",e.minSize),l.defined(e.mixed)&&this._setBooleanOption("webpMixed",e.mixed)}return Hr(e,this.options),this._updateFormatOut("webp",e)}function Cu(e){if(l.object(e)){l.defined(e.reuse)&&this._setBooleanOption("gifReuse",e.reuse),l.defined(e.progressive)&&this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(l.defined(t))if(l.integer(t)&&l.inRange(t,2,256))this.options.gifBitdepth=_i(t);else throw l.invalidParameterError("colours","integer between 2 and 256",t);if(l.defined(e.effort))if(l.number(e.effort)&&l.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw l.invalidParameterError("effort","integer between 1 and 10",e.effort);if(l.defined(e.dither))if(l.number(e.dither)&&l.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw l.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(l.defined(e.interFrameMaxError))if(l.number(e.interFrameMaxError)&&l.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw l.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(l.defined(e.interPaletteMaxError))if(l.number(e.interPaletteMaxError)&&l.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw l.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(l.defined(e.keepDuplicateFrames))if(l.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw l.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Hr(e,this.options),this._updateFormatOut("gif",e)}function Fu(e){if(!this.constructor.format.jp2k.output.buffer)throw Ai();if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.lossless))if(l.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw l.invalidParameterError("lossless","boolean",e.lossless);if(l.defined(e.tileWidth))if(l.integer(e.tileWidth)&&l.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw l.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(l.defined(e.tileHeight))if(l.integer(e.tileHeight)&&l.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw l.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(l.defined(e.chromaSubsampling))if(l.string(e.chromaSubsampling)&&l.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw l.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Hr(e,t){if(l.object(e)&&l.defined(e.loop))if(l.integer(e.loop)&&l.inRange(e.loop,0,65535))t.loop=e.loop;else throw l.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(l.object(e)&&l.defined(e.delay))if(l.integer(e.delay)&&l.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(l.integer)&&e.delay.every(r=>l.inRange(r,0,65535)))t.delay=e.delay;else throw l.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function Ou(e){if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.bitdepth))if(l.integer(e.bitdepth)&&l.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw l.invalidParameterError("bitdepth","1, 2, 4 or 8",e.bitdepth);if(l.defined(e.tile)&&this._setBooleanOption("tiffTile",e.tile),l.defined(e.tileWidth))if(l.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw l.invalidParameterError("tileWidth","integer greater than zero",e.tileWidth);if(l.defined(e.tileHeight))if(l.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw l.invalidParameterError("tileHeight","integer greater than zero",e.tileHeight);if(l.defined(e.miniswhite)&&this._setBooleanOption("tiffMiniswhite",e.miniswhite),l.defined(e.pyramid)&&this._setBooleanOption("tiffPyramid",e.pyramid),l.defined(e.xres))if(l.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw l.invalidParameterError("xres","number greater than zero",e.xres);if(l.defined(e.yres))if(l.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw l.invalidParameterError("yres","number greater than zero",e.yres);if(l.defined(e.compression))if(l.string(e.compression)&&l.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw l.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(l.defined(e.bigtiff)&&this._setBooleanOption("tiffBigtiff",e.bigtiff),l.defined(e.predictor))if(l.string(e.predictor)&&l.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw l.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(l.defined(e.resolutionUnit))if(l.string(e.resolutionUnit)&&l.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw l.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function ju(e){return this.heif({...e,compression:"av1"})}function Lu(e){if(l.object(e)){if(l.string(e.compression)&&l.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw l.invalidParameterError("compression","one of: av1, hevc",e.compression);if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);if(l.defined(e.lossless))if(l.bool(e.lossless))this.options.heifLossless=e.lossless;else throw l.invalidParameterError("lossless","boolean",e.lossless);if(l.defined(e.effort))if(l.integer(e.effort)&&l.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw l.invalidParameterError("effort","integer between 0 and 9",e.effort);if(l.defined(e.chromaSubsampling))if(l.string(e.chromaSubsampling)&&l.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw l.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(l.defined(e.bitdepth))if(l.integer(e.bitdepth)&&l.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw l.invalidParameterError("bitdepth when using prebuilt binaries",8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw l.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth)}else throw l.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function Mu(e){if(l.object(e)){if(l.defined(e.quality))if(l.integer(e.quality)&&l.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?.1+(100-e.quality)*.09:53/3e3*e.quality*e.quality-23/20*e.quality+25;else throw l.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(l.defined(e.distance))if(l.number(e.distance)&&l.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw l.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(l.defined(e.decodingTier))if(l.integer(e.decodingTier)&&l.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw l.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(l.defined(e.lossless))if(l.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw l.invalidParameterError("lossless","boolean",e.lossless);if(l.defined(e.effort))if(l.integer(e.effort)&&l.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw l.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Hr(e,this.options),this._updateFormatOut("jxl",e)}function zu(e){if(l.object(e)&&l.defined(e.depth))if(l.string(e.depth)&&l.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw l.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth);return this._updateFormatOut("raw")}function Bu(e){if(l.object(e)){if(l.defined(e.size))if(l.integer(e.size)&&l.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw l.invalidParameterError("size","integer between 1 and 8192",e.size);if(l.defined(e.overlap))if(l.integer(e.overlap)&&l.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw l.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw l.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(l.defined(e.container))if(l.string(e.container)&&l.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw l.invalidParameterError("container","one of: fs, zip",e.container);if(l.defined(e.layout))if(l.string(e.layout)&&l.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw l.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(l.defined(e.angle))if(l.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw l.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),l.defined(e.depth))if(l.string(e.depth)&&l.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw l.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(l.defined(e.skipBlanks))if(l.integer(e.skipBlanks)&&l.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw l.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else l.defined(e.layout)&&e.layout==="google"&&(this.options.tileSkipBlanks=5);let t=l.bool(e.center)?e.center:e.centre;if(l.defined(t)&&this._setBooleanOption("tileCentre",t),l.defined(e.id))if(l.string(e.id))this.options.tileId=e.id;else throw l.invalidParameterError("id","string",e.id);if(l.defined(e.basename))if(l.string(e.basename))this.options.tileBasename=e.basename;else throw l.invalidParameterError("basename","string",e.basename)}if(l.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw l.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function Uu(e){if(!l.plainObject(e))throw l.invalidParameterError("options","object",e);if(l.integer(e.seconds)&&l.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw l.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function Gu(e,t){return l.object(t)&&t.force===!1||(this.options.formatOut=e),this}function qu(e,t){if(l.bool(t))this.options[e]=t;else throw l.invalidParameterError(e,"boolean",t)}function Wu(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function Hu(e,t){return typeof e=="function"?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),St.pipeline(this.options,(r,s,n)=>{r?e(l.nativeError(r,t)):e(null,s,n)})}):St.pipeline(this.options,(r,s,n)=>{r?e(l.nativeError(r,t)):e(null,s,n)}),this):this.options.streamOut?(this._isStreamInput()?(this.once("finish",()=>{this._flattenBufferIn(),St.pipeline(this.options,(r,s,n)=>{r?this.emit("error",l.nativeError(r,t)):(this.emit("info",n),this.push(s)),this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished&&this.emit("finish")):St.pipeline(this.options,(r,s,n)=>{r?this.emit("error",l.nativeError(r,t)):(this.emit("info",n),this.push(s)),this.push(null),this.on("end",()=>this.emit("close"))}),this):this._isStreamInput()?new Promise((r,s)=>{this.once("finish",()=>{this._flattenBufferIn(),St.pipeline(this.options,(n,i,o)=>{n?s(l.nativeError(n,t)):this.options.resolveWithObject?r({data:i,info:o}):r(i)})})}):new Promise((r,s)=>{St.pipeline(this.options,(n,i,o)=>{n?s(l.nativeError(n,t)):this.options.resolveWithObject?r({data:i,info:o}):r(i)})})}Ni.exports=e=>{Object.assign(e.prototype,{toFile:yu,toBuffer:wu,keepExif:Eu,withExif:xu,withExifMerge:Pu,keepIccProfile:Ru,withIccProfile:Su,keepXmp:$u,withXmp:ku,keepMetadata:Au,withMetadata:_u,toFormat:Nu,jpeg:Iu,jp2:Fu,png:Tu,webp:Du,tiff:Ou,avif:ju,heif:Lu,jxl:Mu,gif:Cu,raw:zu,tile:Bu,timeout:Uu,_updateFormatOut:Gu,_setBooleanOption:qu,_read:Wu,_pipeline:Hu})}});var Fi=q((Wd,Ci)=>{g();var Vu=ie("node:events"),nr=Wt(),Ne=Oe(),{runtimePlatformArch:Ju}=Fr(),xe=Ct(),Ti=Ju(),Vr=xe.libvipsVersion(),st=xe.format();st.heif.output.alias=["avif","heic"];st.jpeg.output.alias=["jpe","jpg"];st.tiff.output.alias=["tif"];st.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var Xu={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},$t={vips:Vr.semver};if(!Vr.isGlobal)if(Vr.isWasm)try{$t=ie("@img/sharp-wasm32/versions")}catch{}else try{$t=ie(`@img/sharp-${Ti}/versions`)}catch{try{$t=ie(`@img/sharp-libvips-${Ti}/versions`)}catch{}}$t.sharp=Dr().version;$t.heif&&st.heif&&(st.heif.input.fileSuffix=[".avif"],st.heif.output.alias=["avif"]);function Di(e){return Ne.bool(e)?e?xe.cache(50,20,100):xe.cache(0,0,0):Ne.object(e)?xe.cache(e.memory,e.files,e.items):xe.cache()}Di(!0);function Ku(e){return xe.concurrency(Ne.integer(e)?e:null)}nr.familySync()===nr.GLIBC&&!xe._isUsingJemalloc()?xe.concurrency(1):nr.familySync()===nr.MUSL&&xe.concurrency()===1024&&xe.concurrency(ie("node:os").availableParallelism());var Yu=new Vu.EventEmitter;function Qu(){return xe.counters()}function Zu(e){return xe.simd(Ne.bool(e)?e:null)}function ef(e){if(Ne.object(e))if(Array.isArray(e.operation)&&e.operation.every(Ne.string))xe.block(e.operation,!0);else throw Ne.invalidParameterError("operation","Array<string>",e.operation);else throw Ne.invalidParameterError("options","object",e)}function tf(e){if(Ne.object(e))if(Array.isArray(e.operation)&&e.operation.every(Ne.string))xe.block(e.operation,!1);else throw Ne.invalidParameterError("operation","Array<string>",e.operation);else throw Ne.invalidParameterError("options","object",e)}Ci.exports=e=>{e.cache=Di,e.concurrency=Ku,e.counters=Qu,e.simd=Zu,e.format=st,e.interpolators=Xu,e.versions=$t,e.queue=Yu,e.block=ef,e.unblock=tf}});var ji=q((Jd,Oi)=>{g();var Je=Kn();Zn()(Je);ii()(Je);ai()(Je);hi()(Je);Ri()(Je);$i()(Je);Ii()(Je);Fi()(Je);Oi.exports=Je});g();g();g();import ko from"@rollup/plugin-strip";import{visualizer as Ao}from"rollup-plugin-visualizer";g();var vr=["/react/","/react-dom/","/scheduler/","/react-router","/@radix-ui/","/react-day-picker/","/react-hook-form/","/react-i18next/","/clsx/","/class-variance-authority/"],mo={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 bo(e){let t=e.match(/(?:^|\0)virtual:([^?]+)/);if(t)return t[1]}function ss(e){let t=e.replace(/\\/g,"/");if(t.includes("/node_modules/"))return t.split("?")[0]}function ns(e,t=vr){return t.some(r=>e.includes(r))}function vo(e){for(let[t,r]of Object.entries(mo))if(r.some(s=>e.includes(s)))return t}function yo(e){let t=bo(e);if(t)return t==="i18n-mapping"?"virtual-i18n-mapping":"virtual-modules";let r=ss(e);if(!r)return;if(ns(r))return"react-core";let s=vo(r);if(s)return s}function wo(e=[]){let t=e.filter(s=>!vr.includes(s)),r=[...vr,...t];return function(s){let n=ss(s);if(n&&ns(n,r))return"react-core"}}var rs={development:{manualChunks:void 0},production:{manualChunks:yo}};function is(e,t={}){let r=rs[e]||rs.production,s=t.reactCore||[];return s.length>0?{manualChunks:wo(s)}:r}g();import*as Re from"@clack/prompts";g();import{createRequire as Eo}from"node:module";import{resolve as zt,join as qe,dirname as Qe,relative as os,normalize as xo,sep as as,extname as Po}from"node:path";import{fileURLToPath as Ro}from"node:url";import*as W from"node:fs";ge();import So from"fast-glob";var pt={getGlobOptionsFor:Mt||void 0,SCAN_PATTERNS:ke||void 0,getPatternsFor:ts||void 0,I18N_PATHS:Lt||void 0},fe={error:(e,t)=>{},warn:(e,t)=>{},info:e=>{}};function ls(e,t){return e().catch(r=>{throw new Error(`${t}: ${r instanceof Error?r.message:String(r)}`)})}var cs={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"},ne=class e{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(t={}){return e._instance||(e._instance=new e(t)),e._instance}static _reset(){e._instance=null}constructor(t={}){if(e._instance)return e._instance;this.options={maxLevels:t.maxLevels??10,customMarkers:t.customMarkers||[],cache:t.cache??!1,debug:t.debug??!1};try{let r=p.cwd();if(!r)throw new Error("PathResolver: process.cwd() returned undefined. This should never happen.");this._repoRoot=this._findRepoRoot(r)}catch(r){throw new Error(`PathResolver constructor failed: ${r instanceof Error?r.message:String(r)}. cwd: ${p.cwd()}`)}this._appRoot=null,e._instance=this}normalizePath(t){if(!t)return"";try{return xo(t).split(as).join("/")}catch{return String(t).split(as).join("/")}}getRelativePath(t){let r=this.getAppRoot(),s=os(r,t);return this.normalizePath(s)}getBasename(t){if(!t)return"";let s=this.normalizePath(t).split("/");return s[s.length-1]||""}getDirname(t){return t?this.normalizePath(Qe(t)):""}resolvePackage(t,r=null){try{let s=r||this.getAppRoot(),i=Eo(qe(s,"package.json")).resolve(t);return this.normalizePath(i)}catch{return null}}resolveFrameworkPackage(t,r=null){let s=this.resolvePackage(`${t}/package.json`,r);if(s)return this.getDirname(s);if(this.isMonorepo()&&t.startsWith("@donotdev/")){let o=t.replace("@donotdev/",""),a=this.resolveRepoPath(`packages/${o}`);if(this.pathExists(a))return a;if(["auth","billing","crud","oauth"].includes(o)){let c=this.resolveRepoPath(`packages/features/${o}`);if(this.pathExists(c))return c}if(o==="firebase"){let c=this.resolveRepoPath(`packages/providers/${o}`);if(this.pathExists(c))return c}}let n=this.resolveAppPath(`node_modules/${t}`);if(this.pathExists(n))return n;let i=this.resolveRepoPath(`node_modules/${t}`);return this.pathExists(i)?i:null}resolvePackageAsset(t,r=null){return this.resolvePackage(t,r)}resolveAppPath(t){let r=this.getAppRoot(),s=zt(r,t);return this.normalizePath(s)}resolveRepoPath(t){let r=this.getRepoRoot(),s=this.normalizePath(t),n=zt(r,s);return this.normalizePath(n)}resolvePath(t,r){let s=this.normalizePath(r),n=this.normalizePath(t),i=zt(s,n);return this.normalizePath(i)}createImportPath(t){return"./"+this.getRelativePath(t)}getFileInfo(t){try{let r=W.statSync(t);return{absolutePath:this.normalizePath(t),relativePath:this.getRelativePath(t),importPath:this.createImportPath(t),size:r.size,isFile:r.isFile(),isDirectory:r.isDirectory()}}catch{return null}}_detectFormat(t,r){return r&&r!=="auto"?r:Po(t).toLowerCase()===".json"?"json":"text"}async read(t,r={}){let{format:s="auto",encoding:n="utf8"}=r,i=this._detectFormat(t,s);try{if(i==="buffer")return await W.promises.readFile(t);let o=await W.promises.readFile(t,n),a=this.stripBom(o);return i==="json"?JSON.parse(a):a}catch(o){return this.options.debug&&fe.warn(`Failed to read file: ${t}`,o),null}}readSync(t,r={}){let{format:s="auto",encoding:n="utf8"}=r,i=this._detectFormat(t,s);try{if(i==="buffer")return W.readFileSync(t);let o=W.readFileSync(t,n),a=this.stripBom(o);return i==="json"?JSON.parse(a):a}catch(o){return this.options.debug&&fe.warn(`Failed to read file: ${t}`,o),null}}async write(t,r,s={}){let{format:n="auto",overwrite:i=!1,dryRun:o=!1,verbose:a=!1}=s,c=this.normalizePath(t),u=this.normalizePath(Qe(c)),f=this.pathExists(c);if(f&&!i)return a&&fe.info(`Skipping existing file: ${c}`),!1;if(o)return fe.info(`[DRY RUN] Would write file: ${c}`),!0;try{await W.promises.mkdir(u,{recursive:!0})}catch(T){if(T?.code!=="EEXIST")throw T}let b=this._detectFormat(t,n),m;v.isBuffer(r)?m=r:b==="json"&&typeof r=="object"?m=JSON.stringify(r,null,2):m=String(r);try{return await ls(async()=>(v.isBuffer(m)?await W.promises.writeFile(c,m):await W.promises.writeFile(c,m,"utf8"),a&&fe.info(`${f?"Updated":"Created"} file: ${c}`),!0),`Failed to write file: ${c}`)}catch{return!1}}writeSync(t,r,s={}){let{format:n="auto",overwrite:i=!1,dryRun:o=!1,verbose:a=!1}=s,c=this.normalizePath(t),u=this.normalizePath(Qe(c)),f=this.pathExists(c);if(f&&!i)return a&&fe.info(`Skipping existing file: ${c}`),!1;if(o)return fe.info(`[DRY RUN] Would write file: ${c}`),!0;try{W.mkdirSync(u,{recursive:!0})}catch(T){if(T?.code!=="EEXIST")throw T}let b=this._detectFormat(t,n),m;v.isBuffer(r)?m=r:b==="json"&&typeof r=="object"?m=JSON.stringify(r,null,2):m=String(r);try{return v.isBuffer(m)?W.writeFileSync(c,m):W.writeFileSync(c,m,"utf8"),a&&fe.info(`${f?"Updated":"Created"} file: ${c}`),!0}catch(T){throw new Error(`Failed to write file: ${c}: ${T instanceof Error?T.message:String(T)}`)}}async copy(t,r,s={}){let{overwrite:n=!1,dryRun:i=!1,verbose:o=!1}=s,a=this.normalizePath(r),c=this.pathExists(a);if(c&&!n)return o&&fe.info(`Skipping existing file: ${a}`),!1;if(i)return fe.info(`[DRY RUN] Would copy file: ${a}`),!0;let u=this.normalizePath(Qe(a));try{await W.promises.mkdir(u,{recursive:!0})}catch(f){if(f?.code!=="EEXIST")throw f}try{return await ls(async()=>(await W.promises.copyFile(t,a),o&&fe.info(`${c?"Updated":"Created"} file: ${a}`),!0),`Failed to copy file from ${t} to ${a}`)}catch{return!1}}copySync(t,r,s={}){let{overwrite:n=!1,dryRun:i=!1,verbose:o=!1}=s,a=this.normalizePath(r),c=this.pathExists(a);if(c&&!n)return o&&fe.info(`Skipping existing file: ${a}`),!1;if(i)return fe.info(`[DRY RUN] Would copy file: ${a}`),!0;let u=this.normalizePath(Qe(a));try{W.mkdirSync(u,{recursive:!0})}catch(f){if(f?.code!=="EEXIST")throw f}try{return W.copyFileSync(t,a),o&&fe.info(`${c?"Updated":"Created"} file: ${a}`),!0}catch{return!1}}pathExists(t,r=!1){try{return W.existsSync(t)}catch(s){return r||fe.error(`Error checking path existence: ${t}`,s),!1}}mkdir(t){try{let r=t.startsWith("/")||t.match(/^[A-Z]:/)?this.normalizePath(t):this.resolveAppPath(t);return W.existsSync(r)||W.mkdirSync(r,{recursive:!0}),!0}catch{return!1}}readdirSync(t,r){try{return W.readdirSync(t,r)}catch(s){return this.options.debug&&fe.warn(`Failed to read directory: ${t}`,s),r&&typeof r=="object"&&"withFileTypes"in r&&r.withFileTypes?[]:[]}}statSync(t){try{return W.statSync(t)}catch(r){return this.options.debug&&fe.warn(`Failed to stat file: ${t}`,r),null}}lstatSync(t){try{return W.lstatSync(t)}catch(r){return this.options.debug&&fe.warn(`Failed to lstat file: ${t}`,r),null}}async ensureDir(t){try{await W.promises.mkdir(t,{recursive:!0})}catch(r){if(r?.code!=="EEXIST")throw r}}ensureDirSync(t){try{W.mkdirSync(t,{recursive:!0})}catch(r){if(r?.code!=="EEXIST")throw r}}async remove(t){await W.promises.rm(t,{recursive:!0,force:!0})}removeSync(t){W.rmSync(t,{recursive:!0,force:!0})}async readdir(t,r){return W.promises.readdir(t,r)}stripBom(t){return t.charCodeAt(0)===65279?t.slice(1):t}getRepoRoot(){return this._repoRoot||p.cwd()}getAppRoot(){return this._appRoot?this._appRoot:this._repoRoot}setAppRoot(t){if(!t)throw new Error("PathResolver.setAppRoot: root cannot be undefined or null");this._appRoot=this.normalizePath(t)}isMonorepo(){let t=qe(this._repoRoot,"packages");return this.pathExists(t)}isWithinApp(t){let r=this.normalizePath(zt(t)),s=this.getAppRoot(),n=os(s,r),i=this.normalizePath(n);return!i.startsWith("../")&&!i.startsWith("/")}async findFiles(t,r,s={}){let n=this.normalizePath(qe(t,r)),i=this.getAppRoot(),o=this.normalizePath(i),a=n.startsWith(o)?n.slice(o.length+1):n,c={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:i,ignore:pt.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([a],{...c,...s})}clearCache(){}async _resolveFrameworkI18nPattern(t){let r=pt.I18N_PATHS;if(!r)return null;let s=t.replace(r.SOURCE_ROOT+"/",""),n=this.resolveFrameworkPackage("@donotdev/core");if(!n)return null;let i=this.normalizePath(qe(n,r.PUBLISHED_ROOT,s)),o=i.replace(/\/[^/]*\*.*$/,"");return this.pathExists(o),i}async _globWithNormalization(t,r){return(await So(t,r)).map(n=>{let i=typeof n=="string"?n:n.path;return this.normalizePath(i)})}async resolveFiles(t,r="css"){if(!t||typeof t!="object")return{frameworkFiles:[],consumerFiles:[]};if(r==="i18n")return{frameworkFiles:[],consumerFiles:[]};if(Array.isArray(t.framework)||(t.framework=[]),!Array.isArray(t.consumer))return{frameworkFiles:[],consumerFiles:[]};let s=[...t.framework,...t.consumer];for(let f of s)if(typeof f!="string"||f.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let n=this.getAppRoot(),i=pt.getGlobOptionsFor?pt.getGlobOptionsFor(r):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},o=this.normalizePath(n),a=t.framework.map(f=>{let b=this.normalizePath(f);return b.startsWith(o)?b.slice(o.length+1):b}),c=t.consumer.map(f=>{let b=this.normalizePath(f);return b.startsWith(o)?b.slice(o.length+1):b}),u={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:n};try{let f=a.length>0?await this._globWithNormalization(a,u):[],b=await this._globWithNormalization(c,u);return{frameworkFiles:f,consumerFiles:b}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(t){if(!pt.getPatternsFor)return{framework:[],consumer:[],all:[]};let r=this.getAppRoot(),s=this.getRepoRoot();if(t==="i18n"&&(!r||r===s))throw new Error(`Cannot resolve i18n patterns: appRoot not set (appRoot: ${r}, repoRoot: ${s}). Ensure configResolved hook has run before discovery.`);let n=pt.getPatternsFor(t),i=this.isMonorepo();if(t==="i18n"){let c=n,u={eager:c.eager.map(f=>f.startsWith("!")?"!"+this.resolveAppPath(f.slice(1)):this.resolveAppPath(f)),lazy:c.lazy.map(f=>f.startsWith("!")?"!"+this.resolveAppPath(f.slice(1)):this.resolveAppPath(f)),framework:{eager:i?(c.framework?.eager||[]).map(f=>this.resolveRepoPath(f)).filter(Boolean):await Promise.all((c.framework?.eager||[]).map(f=>this._resolveFrameworkI18nPattern(f))).then(f=>f.filter(Boolean)),lazy:i?(c.framework?.lazy||[]).map(f=>this.resolveRepoPath(f)).filter(Boolean):await Promise.all((c.framework?.lazy||[]).map(f=>this._resolveFrameworkI18nPattern(f))).then(f=>f.filter(Boolean))},all:[]};return u.all=[...u.eager,...u.lazy,...u.framework.eager,...u.framework.lazy],u}let o=n,a={framework:i?(o.framework||[]).map(c=>this.resolveRepoPath(c)).filter(Boolean):[],consumer:(o.consumer||[]).map(c=>this.resolveAppPath(c)),all:[]};return a.all=[...a.consumer,...a.framework],a}getEmptyModulePath(t=!1){if(t)return"@donotdev/core/empty";let r=this.resolvePackage("@donotdev/core/empty");if(r)return r;let s=Qe(Ro(import.meta.url));return this.normalizePath(qe(s,"../empty.js"))}_findRepoRoot(t){let r=this.normalizePath(t),s=0,n=this.options.maxLevels;for(;s<n;){let i=this.normalizePath(qe(r,cs.TOOLING)),o=this.normalizePath(qe(r,cs.CORE));if(this.pathExists(i)&&this.pathExists(o))return r;let a=qe(r,"apps");if(this.pathExists(a)&&this.statSync(a)?.isDirectory())return this.normalizePath(r);let c=this.normalizePath(qe(r,"package.json"));if(this.pathExists(c)&&this.normalizePath(Qe(r))===r)return r;let u=this.normalizePath(Qe(r));if(u===r)break;r=u,s++}return this.normalizePath(t)}};var De={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 $o(){return p.env.NO_COLOR?!1:p.platform==="win32"?!0:p.stdout.isTTY===!0}function Ce(e,t){return $o()?`${t}${e}${De.reset}`:e}function Q(e,t,r,s={}){let{logDir:n=".dndev-logs",fileLogging:i=!1}=s,o=ne.getInstance(),a=null;if(i){let f=o.resolveAppPath(n);o.pathExists(f)||o.mkdir(f),a=o.resolveAppPath(`${n}/${e.replace(/[^a-zA-Z0-9]/g,"-")}.log`);let b=`=== ${e} Log Started at ${new Date().toISOString()} ===
3
3
  `;o.writeSync(a,b)}let c=(f,b,m)=>{if(a){let T=new Date().toISOString(),U=m.length>0?" "+m.map(re=>typeof re=="object"?JSON.stringify(re,null,2):String(re)).join(" "):"",V=`${T} [${f}] ${b}${U}
4
- `;o.appendFile(a,V)}},u=(f,b)=>{if(b.length===0)return f;let m=b.map(T=>typeof T=="object"?JSON.stringify(T,null,2):String(T)).join(" ");return`${f} ${m}`};return{debug:(f,...b)=>{t&&(i?c("DEBUG",f,b):Re.log.message(Ce(u(f,b),De.gray)))},verbose:(f,...b)=>{r&&(i?c("VERBOSE",f,b):Re.log.message(u(f,b)))},info:(f,...b)=>{i?c("INFO",f,b):Re.log.info(Ce(u(f,b),De.brightCyan))},warn:(f,...b)=>{t&&i?c("WARN",f,b):Re.log.warn(Ce(u(f,b),De.brightYellow))},error:(f,...b)=>{t&&i?c("ERROR",f,b):Re.log.error(Ce(u(f,b),De.brightRed))},success:(f,...b)=>{t&&i?c("SUCCESS",f,b):Re.log.success(Ce(u(f,b),De.brightGreen))},when:(f,b="debug")=>(m,...T)=>{if(f){let U=u(m,T);switch(b){case"verbose":r&&(Re.log.message(U),c("VERBOSE",m,T));break;case"info":Re.log.info(Ce(U,De.brightCyan)),c("INFO",m,T);break;case"warn":Re.log.warn(Ce(U,De.brightYellow)),c("WARN",m,T);break;case"error":Re.log.error(Ce(U,De.brightRed)),c("ERROR",m,T);break;case"success":Re.log.success(Ce(U,De.brightGreen)),c("SUCCESS",m,T);break;default:t&&(Re.log.message(Ce(U,De.gray)),c("DEBUG",m,T))}}},getLogFilePath:()=>a}}function cs(e={}){let{mode:t="development",chunkingOptions:r={},debug:s,verbose:n=!0,isDev:i,isDebug:o,shouldAnalyze:a,build:c={}}=e,u=Z("build",s,n),f=ns(t,r);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"),a&&(u.info("\u{1F4CA} Bundle analysis enabled"),u.info(` Visual treemap will open after build (stats.html)
5
- `)),{outDir:"dist",sourcemap:i||o,cacheDir:"node_modules/.vite",target:"baseline-widely-available",minify:o?!1:"esbuild",reportCompressedSize:!1,chunkSizeWarningLimit:2048,assetsInlineLimit:0,esbuild:{format:"esm",drop:o?[]:["console","debugger"],legalComments:"none"},cssMinify:o?!1:"esbuild",cssCodeSplit:!0,rollupOptions:{external:Ao(),output:{format:"es",entryFileNames:"assets/[name].[hash].js",chunkFileNames:"assets/[name].[hash].js",assetFileNames:"assets/[name].[hash][extname]",...f.manualChunks&&{manualChunks:f.manualChunks},compact:!0},onwarn(m,T){m.code!=="MODULE_LEVEL_DIRECTIVE"&&T(m)},plugins:[...o?[]:[$o({include:["**/*.js","**/*.ts","**/*.tsx","**/*.jsx"],functions:["console.*","debugger"],labels:["debug"]})],...a?[(()=>{let m=ne.getInstance(),T=m.getAppRoot(),U="dist",V=m.resolveAppPath(`${U}/stats.html`),re=()=>{try{let G=m.resolveAppPath(U);m.pathExists(G)||m.mkdir(G)}catch{}},Y=ko({filename:V,open:!0,gzipSize:!0,brotliSize:!0,template:"treemap",sourcemap:i||o,projectRoot:T});if(Y.buildStart){let G=Y.buildStart.bind(Y);Y.buildStart=function(...X){re();let O=G.apply(this,X);return O&&typeof O.then=="function"?O.catch(F=>{}):O}}else Y.buildStart=function(){re()};let L=["generateBundle","writeBundle","closeBundle"];for(let G of L)if(Y[G]){let X=Y[G];Y[G]=function(...O){try{re();let F=X.apply(this,O);return F&&typeof F.then=="function"?F.catch(z=>{let se=z?.message||z?.toString()||String(z)||"Unknown error";u.warn(`Bundle visualizer warning in ${G}: ${se}`),G==="closeBundle"&&u.warn(`You can manually open ${V} to view the bundle analysis`)}):F}catch(F){let z=F?.message||F?.toString()||String(F)||"Unknown error";buildLogger.warn(`Bundle visualizer warning in ${G}: ${z}`),G==="closeBundle"&&buildLogger.warn(` You can manually open ${V} to view the bundle analysis`)}}}return Y})()]:[]]}}}function Ao(e){return e?["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 _o(){let e=!1,t=ne.getInstance();if((t.pathExists("/.dockerenv")||t.pathExists("/run/.containerenv"))&&(e=!0),!e&&(p.env.DOCKER_CONTAINER==="true"||p.env.IS_DOCKER==="true"||p.env.DOCKER_BUILDKIT==="1"||p.env.CI==="true"&&p.env.DOCKER==="true")&&(e=!0),!e&&p.env.DOCKER_HOST&&p.env.DOCKER_HOST.includes("docker")&&(e=!0),!e&&p.platform==="linux"&&t.pathExists("/proc/self/cgroup"))try{let s=t.readSync("/proc/self/cgroup");s&&(s.includes("docker")||s.includes("containerd"))&&(e=!0)}catch{}let r=!1;if((p.env.WSL_DISTRO_NAME||p.env.WSLENV)&&(r=!0),!r&&p.platform==="linux"&&t.pathExists("/proc/version"))try{let s=(t.readSync("/proc/version")||"").toLowerCase();r=s.includes("microsoft")||s.includes("wsl")}catch{}if(!r&&p.platform==="linux"&&t.pathExists("/proc/sys/kernel/osrelease"))try{let s=(t.readSync("/proc/sys/kernel/osrelease")||"").toLowerCase()||"";(s.includes("microsoft")||s.includes("wsl"))&&(r=!0)}catch{}if(!r&&p.platform==="win32"){let s=p.cwd();s&&(s.includes("\\wsl$")||s.includes("\\wsl.localhost"))&&(r=!0)}return{isDocker:e,isWSL2:r}}function No(e,t){if(e!==void 0)return e;let{isDocker:r,isWSL2:s}=_o();if(r||s){let n=r?"Docker":"WSL2";return t.info(`Detected ${n} environment - enabling polling mode for file watching`),!0}}function us(e,t={},r){let s=ne.getInstance(),n=s.getRepoRoot(),{watch:i,hmr:o,host:a,...c}=t||{},u=o||{},f=a===!0?"localhost":a||"localhost",b={...u.port&&{port:u.port},...u.clientPort&&{clientPort:u.clientPort},host:u.host??f,...u.protocol&&{protocol:u.protocol},overlay:u.overlay??!0,timeout:u.timeout??5e3},m=a!==void 0?a:!0,T=c.https===!0;return{port:e,host:m,open:t.open!==void 0?t.open:!0,https:T,fs:{allow:[n,s.resolveRepoPath("packages"),s.resolveRepoPath("node_modules")],strict:!1},watch:{usePolling:No(t?.watch?.usePolling,r),interval:t?.watch?.interval??2e3,...t?.watch||{}},hmr:{...b,...u},headers:{"Cross-Origin-Opener-Policy":"same-origin-allow-popups","Cross-Origin-Embedder-Policy":"unsafe-none"},middlewareMode:!1,...c}}function fs(e={}){let t=e.https===!0;return{...e,https:t}}g();ge();g();var Ae={CONCATENATE_DEDUPE:"CONCATENATE_DEDUPE",SHALLOW_MERGE:"SHALLOW_MERGE",DEEP_MERGE:"DEEP_MERGE",REPLACE:"REPLACE"};function Ze(e,t,r,s={}){let{protectedKeys:n=[],onConflict:i}=s;if(t==null)return e;switch(r){case Ae.CONCATENATE_DEDUPE:{if(!Array.isArray(e)||!Array.isArray(t))return t;let o=[...e,...t];return[...new Set(o)]}case Ae.SHALLOW_MERGE:return typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)||Array.isArray(t)?t:{...e,...t};case Ae.DEEP_MERGE:{if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)||Array.isArray(t))return t;let o={...e};for(let a in t){if(n.includes(a)){i&&i(a,e[a],t[a]);continue}typeof o[a]=="object"&&typeof t[a]=="object"&&o[a]!==null&&t[a]!==null&&!Array.isArray(o[a])&&!Array.isArray(t[a])?o[a]=Ze(o[a],t[a],Ae.DEEP_MERGE,{protectedKeys:n,onConflict:i}):o[a]=t[a]}return o}case Ae.REPLACE:default:return t}}function hs(e,t,r=[],s){let n=[...e,...t||[]],i=[...new Set(n)];return[...new Set([...i,...r])]}var Bt={base:"/",mode:p.env.NODE_ENV==="production"?"production":"development",debug:!1,verbose:p.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:{copyFonts:!0},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(p.env.NODE_ENV==="development"),__PROD__:JSON.stringify(p.env.NODE_ENV==="production")},optimizeDeps:{include:[...at.mandatoryIncludes],exclude:[...at.buildTools,...Object.values(ee)],esbuildOptions:{format:"esm",target:"es2020",platform:"browser",define:{"process.env.NODE_ENV":JSON.stringify(p.env.NODE_ENV||"development")},external:["next","next/*"]}},plugins:[],css:{},envDir:void 0};function ds(e={},t={}){let{onConflict:r}=t,s={...Bt},n=[],i=(o,a,c,u)=>{n.push({key:o,frameworkValue:a,userValue:c,reason:u}),r&&r(o,a,c,u)};return Object.keys(e).forEach(o=>{let a=e[o],c=s[o];if(o==="optimizeDeps"&&typeof a=="object"&&a!==null){let u=c?.include||[],f=c?.exclude||[],b=a.include||[],m=a.exclude||[],T=u.filter(L=>!L.startsWith("@donotdev/")),U=m.filter(L=>T.includes(L));if(U.length>0)for(let L of U)i("optimizeDeps.exclude",L,"excluded",`Framework requires ${L} to be included. It will be included despite your exclusion.`);let V=hs(u,b,T),re=Ze(f,m,Ae.CONCATENATE_DEDUPE),Y=Ze(c?.esbuildOptions||{},a.esbuildOptions||{},Ae.DEEP_MERGE,{protectedKeys:["external"],onConflict:L=>i(`optimizeDeps.esbuildOptions.${L}`,c?.esbuildOptions?.[L],a.esbuildOptions?.[L],`Framework requires ${L} to remain as configured.`)});s[o]={...c,include:V,exclude:re,esbuildOptions:Y,...Object.fromEntries(Object.entries(a).filter(([L])=>!["include","exclude","esbuildOptions"].includes(L)))};return}if(o==="css"&&typeof a=="object"&&a!==null){s[o]=Ze(c||{},a,Ae.DEEP_MERGE,{protectedKeys:["postcss"],onConflict:()=>i("css.postcss","framework PostCSS config",a.postcss,"Framework PostCSS config is required and cannot be overridden. Your postcss config is ignored.")});return}if(o==="define"&&typeof a=="object"&&a!==null){s[o]=Ze(c||{},a,Ae.DEEP_MERGE,{protectedKeys:["__DEV__","__PROD__"],onConflict:u=>i(`define.${u}`,c?.[u],a[u],`Framework requires ${u} to remain as configured.`)});return}if(Array.isArray(a)){Array.isArray(c)?s[o]=Ze(c,a,Ae.CONCATENATE_DEDUPE):s[o]=a;return}if(typeof a=="object"&&a!==null&&typeof c=="object"&&c!==null&&!Array.isArray(c)){s[o]=Ze(c,a,Ae.SHALLOW_MERGE);return}s[o]=a}),s}function gs(e){let{server:t={},preview:r={},mode:s,build:n={},resolve:i={},routes:o={},themes:a={},i18n:c={},assets:u={},features:f={},seo:b={},pwa:m={},serverShim:T={},chunking:U={},discovery:V={},pluginFactory:re={},debug:Y,verbose:L,base:G,define:X={},optimizeDeps:O={},plugins:F=[],css:z={},envDir:se,...M}=e,j=s!=="production",pe=Y||j,me=s==="production"&&(n.analyze??Bt.build.analyze);return{mode:s,debug:Y,verbose:L,isDev:j,isDebug:pe,shouldAnalyze:me,serverOptions:t,previewOptions:r,buildOverrides:n,resolveOptions:i,routeOptions:o,themeOptions:a,i18nOptions:c,assetOptions:u,featureOptions:f,seoOptions:b,pwaOptions:m,serverShimOptions:T,chunkingOptions:U,discoveryOptions:V,pluginFactoryOptions:re,base:G,defineOptions:X,optimizeDepsOptions:O,pluginsOptions:F,cssOptions:z,envDir:se,restOptions:M}}g();import{resolve as Io}from"node:path";import To from"autoprefixer";import Do from"postcss-import";import Co from"postcss-nesting";g();function ps({postcssImport:e,postcssNesting:t,autoprefixer:r,resolve:s}){return{plugins:[s?e({resolve:s}):e,t,r({overrideBrowserslist:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"],grid:"autoplace"})]}}function ms(e={}){return e.postcss?e.postcss:async()=>{let t=ne.getInstance();return ps({postcssImport:Do,postcssNesting:Co,autoprefixer:To,resolve:(s,n)=>{let i=t.resolvePackage(s,n);if(i)return i;if(s.startsWith("@donotdev/")){let o=s.split("/")[0]+"/"+s.split("/")[1],a=s.split("/").slice(2).join("/"),c=t.resolveFrameworkPackage(o,n);if(c&&a){let u=t.resolvePath(a,c);if(t.pathExists(u))return u}}return Io(n,s)}})}}g();import gf from"@vitejs/plugin-basic-ssl";import pf from"@vitejs/plugin-react";import mf from"vite-tsconfig-paths";g();g();g();var ye=class{static generateVirtualModule(t,r,s=!1,n=void 0,i=void 0){return r.isEmpty(t)?r.generateEmpty(t,s,n,i):r.generateModule(t,s,i)}static generateInspection(t,r,s,n){return r.generateInspection.length>=3?r.generateInspection(t,s,n):r.generateInspection(t,s)}static wrapVirtualModule(t,r){return`// Virtual module: ${t}
4
+ `;o.appendFile(a,V)}},u=(f,b)=>{if(b.length===0)return f;let m=b.map(T=>typeof T=="object"?JSON.stringify(T,null,2):String(T)).join(" ");return`${f} ${m}`};return{debug:(f,...b)=>{t&&(i?c("DEBUG",f,b):Re.log.message(Ce(u(f,b),De.gray)))},verbose:(f,...b)=>{r&&(i?c("VERBOSE",f,b):Re.log.message(u(f,b)))},info:(f,...b)=>{i?c("INFO",f,b):Re.log.info(Ce(u(f,b),De.brightCyan))},warn:(f,...b)=>{t&&i?c("WARN",f,b):Re.log.warn(Ce(u(f,b),De.brightYellow))},error:(f,...b)=>{t&&i?c("ERROR",f,b):Re.log.error(Ce(u(f,b),De.brightRed))},success:(f,...b)=>{t&&i?c("SUCCESS",f,b):Re.log.success(Ce(u(f,b),De.brightGreen))},when:(f,b="debug")=>(m,...T)=>{if(f){let U=u(m,T);switch(b){case"verbose":r&&(Re.log.message(U),c("VERBOSE",m,T));break;case"info":Re.log.info(Ce(U,De.brightCyan)),c("INFO",m,T);break;case"warn":Re.log.warn(Ce(U,De.brightYellow)),c("WARN",m,T);break;case"error":Re.log.error(Ce(U,De.brightRed)),c("ERROR",m,T);break;case"success":Re.log.success(Ce(U,De.brightGreen)),c("SUCCESS",m,T);break;default:t&&(Re.log.message(Ce(U,De.gray)),c("DEBUG",m,T))}}},getLogFilePath:()=>a}}function us(e={}){let{mode:t="development",chunkingOptions:r={},debug:s,verbose:n=!0,isDev:i,isDebug:o,shouldAnalyze:a,build:c={}}=e,u=Q("build",s,n),f=is(t,r);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"),a&&(u.info("\u{1F4CA} Bundle analysis enabled"),u.info(` Visual treemap will open after build (stats.html)
5
+ `)),{outDir:"dist",sourcemap:i||o,cacheDir:"node_modules/.vite",target:"baseline-widely-available",minify:o?!1:"esbuild",reportCompressedSize:!1,chunkSizeWarningLimit:2048,assetsInlineLimit:0,esbuild:{format:"esm",drop:o?[]:["console","debugger"],legalComments:"none"},cssMinify:o?!1:"esbuild",cssCodeSplit:!0,rollupOptions:{external:_o(),output:{format:"es",entryFileNames:"assets/[name].[hash].js",chunkFileNames:"assets/[name].[hash].js",assetFileNames:"assets/[name].[hash][extname]",...f.manualChunks&&{manualChunks:f.manualChunks},compact:!0},onwarn(m,T){m.code!=="MODULE_LEVEL_DIRECTIVE"&&T(m)},plugins:[...o?[]:[ko({include:["**/*.js","**/*.ts","**/*.tsx","**/*.jsx"],functions:["console.*","debugger"],labels:["debug"]})],...a?[(()=>{let m=ne.getInstance(),T=m.getAppRoot(),U="dist",V=m.resolveAppPath(`${U}/stats.html`),re=()=>{try{let G=m.resolveAppPath(U);m.pathExists(G)||m.mkdir(G)}catch{}},Y=Ao({filename:V,open:!0,gzipSize:!0,brotliSize:!0,template:"treemap",sourcemap:i||o,projectRoot:T});if(Y.buildStart){let G=Y.buildStart.bind(Y);Y.buildStart=function(...X){re();let O=G.apply(this,X);return O&&typeof O.then=="function"?O.catch(F=>{}):O}}else Y.buildStart=function(){re()};let L=["generateBundle","writeBundle","closeBundle"];for(let G of L)if(Y[G]){let X=Y[G];Y[G]=function(...O){try{re();let F=X.apply(this,O);return F&&typeof F.then=="function"?F.catch(z=>{let se=z?.message||z?.toString()||String(z)||"Unknown error";u.warn(`Bundle visualizer warning in ${G}: ${se}`),G==="closeBundle"&&u.warn(`You can manually open ${V} to view the bundle analysis`)}):F}catch(F){let z=F?.message||F?.toString()||String(F)||"Unknown error";buildLogger.warn(`Bundle visualizer warning in ${G}: ${z}`),G==="closeBundle"&&buildLogger.warn(` You can manually open ${V} to view the bundle analysis`)}}}return Y})()]:[]]}}}function _o(e){return e?["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 No(){let e=!1,t=ne.getInstance();if((t.pathExists("/.dockerenv")||t.pathExists("/run/.containerenv"))&&(e=!0),!e&&(p.env.DOCKER_CONTAINER==="true"||p.env.IS_DOCKER==="true"||p.env.DOCKER_BUILDKIT==="1"||p.env.CI==="true"&&p.env.DOCKER==="true")&&(e=!0),!e&&p.env.DOCKER_HOST&&p.env.DOCKER_HOST.includes("docker")&&(e=!0),!e&&p.platform==="linux"&&t.pathExists("/proc/self/cgroup"))try{let s=t.readSync("/proc/self/cgroup");s&&(s.includes("docker")||s.includes("containerd"))&&(e=!0)}catch{}let r=!1;if((p.env.WSL_DISTRO_NAME||p.env.WSLENV)&&(r=!0),!r&&p.platform==="linux"&&t.pathExists("/proc/version"))try{let s=(t.readSync("/proc/version")||"").toLowerCase();r=s.includes("microsoft")||s.includes("wsl")}catch{}if(!r&&p.platform==="linux"&&t.pathExists("/proc/sys/kernel/osrelease"))try{let s=(t.readSync("/proc/sys/kernel/osrelease")||"").toLowerCase()||"";(s.includes("microsoft")||s.includes("wsl"))&&(r=!0)}catch{}if(!r&&p.platform==="win32"){let s=p.cwd();s&&(s.includes("\\wsl$")||s.includes("\\wsl.localhost"))&&(r=!0)}return{isDocker:e,isWSL2:r}}function Io(e,t){if(e!==void 0)return e;let{isDocker:r,isWSL2:s}=No();if(r||s){let n=r?"Docker":"WSL2";return t.info(`Detected ${n} environment - enabling polling mode for file watching`),!0}}function fs(e,t={},r){let s=ne.getInstance(),n=s.getRepoRoot(),{watch:i,hmr:o,host:a,...c}=t||{},u=o||{},f=a===!0?"localhost":a||"localhost",b={...u.port&&{port:u.port},...u.clientPort&&{clientPort:u.clientPort},host:u.host??f,...u.protocol&&{protocol:u.protocol},overlay:u.overlay??!0,timeout:u.timeout??5e3},m=a!==void 0?a:!0,T=c.https===!0;return{port:e,host:m,open:t.open!==void 0?t.open:!0,https:T,fs:{allow:[n,s.resolveRepoPath("packages"),s.resolveRepoPath("node_modules")],strict:!1},watch:{usePolling:Io(t?.watch?.usePolling,r),interval:t?.watch?.interval??2e3,...t?.watch||{}},hmr:{...b,...u},headers:{"Cross-Origin-Opener-Policy":"same-origin-allow-popups","Cross-Origin-Embedder-Policy":"unsafe-none"},middlewareMode:!1,...c}}function hs(e={}){let t=e.https===!0;return{...e,https:t}}g();ge();g();var Ae={CONCATENATE_DEDUPE:"CONCATENATE_DEDUPE",SHALLOW_MERGE:"SHALLOW_MERGE",DEEP_MERGE:"DEEP_MERGE",REPLACE:"REPLACE"};function Ze(e,t,r,s={}){let{protectedKeys:n=[],onConflict:i}=s;if(t==null)return e;switch(r){case Ae.CONCATENATE_DEDUPE:{if(!Array.isArray(e)||!Array.isArray(t))return t;let o=[...e,...t];return[...new Set(o)]}case Ae.SHALLOW_MERGE:return typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)||Array.isArray(t)?t:{...e,...t};case Ae.DEEP_MERGE:{if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)||Array.isArray(t))return t;let o={...e};for(let a in t){if(n.includes(a)){i&&i(a,e[a],t[a]);continue}typeof o[a]=="object"&&typeof t[a]=="object"&&o[a]!==null&&t[a]!==null&&!Array.isArray(o[a])&&!Array.isArray(t[a])?o[a]=Ze(o[a],t[a],Ae.DEEP_MERGE,{protectedKeys:n,onConflict:i}):o[a]=t[a]}return o}case Ae.REPLACE:default:return t}}function ds(e,t,r=[],s){let n=[...e,...t||[]],i=[...new Set(n)];return[...new Set([...i,...r])]}var Bt={base:"/",mode:p.env.NODE_ENV==="production"?"production":"development",debug:!1,verbose:p.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:{copyFonts:!0},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(p.env.NODE_ENV==="development"),__PROD__:JSON.stringify(p.env.NODE_ENV==="production")},optimizeDeps:{include:[...at.mandatoryIncludes],exclude:[...at.buildTools,...Object.values(ee)],esbuildOptions:{format:"esm",target:"es2020",platform:"browser",define:{"process.env.NODE_ENV":JSON.stringify(p.env.NODE_ENV||"development")},external:["next","next/*"]}},plugins:[],css:{},envDir:void 0};function gs(e={},t={}){let{onConflict:r}=t,s={...Bt},n=[],i=(o,a,c,u)=>{n.push({key:o,frameworkValue:a,userValue:c,reason:u}),r&&r(o,a,c,u)};return Object.keys(e).forEach(o=>{let a=e[o],c=s[o];if(o==="optimizeDeps"&&typeof a=="object"&&a!==null){let u=c?.include||[],f=c?.exclude||[],b=a.include||[],m=a.exclude||[],T=u.filter(L=>!L.startsWith("@donotdev/")),U=m.filter(L=>T.includes(L));if(U.length>0)for(let L of U)i("optimizeDeps.exclude",L,"excluded",`Framework requires ${L} to be included. It will be included despite your exclusion.`);let V=ds(u,b,T),re=Ze(f,m,Ae.CONCATENATE_DEDUPE),Y=Ze(c?.esbuildOptions||{},a.esbuildOptions||{},Ae.DEEP_MERGE,{protectedKeys:["external"],onConflict:L=>i(`optimizeDeps.esbuildOptions.${L}`,c?.esbuildOptions?.[L],a.esbuildOptions?.[L],`Framework requires ${L} to remain as configured.`)});s[o]={...c,include:V,exclude:re,esbuildOptions:Y,...Object.fromEntries(Object.entries(a).filter(([L])=>!["include","exclude","esbuildOptions"].includes(L)))};return}if(o==="css"&&typeof a=="object"&&a!==null){s[o]=Ze(c||{},a,Ae.DEEP_MERGE,{protectedKeys:["postcss"],onConflict:()=>i("css.postcss","framework PostCSS config",a.postcss,"Framework PostCSS config is required and cannot be overridden. Your postcss config is ignored.")});return}if(o==="define"&&typeof a=="object"&&a!==null){s[o]=Ze(c||{},a,Ae.DEEP_MERGE,{protectedKeys:["__DEV__","__PROD__"],onConflict:u=>i(`define.${u}`,c?.[u],a[u],`Framework requires ${u} to remain as configured.`)});return}if(Array.isArray(a)){Array.isArray(c)?s[o]=Ze(c,a,Ae.CONCATENATE_DEDUPE):s[o]=a;return}if(typeof a=="object"&&a!==null&&typeof c=="object"&&c!==null&&!Array.isArray(c)){s[o]=Ze(c,a,Ae.SHALLOW_MERGE);return}s[o]=a}),s}function ps(e){let{server:t={},preview:r={},mode:s,build:n={},resolve:i={},routes:o={},themes:a={},i18n:c={},assets:u={},features:f={},seo:b={},pwa:m={},serverShim:T={},chunking:U={},discovery:V={},pluginFactory:re={},debug:Y,verbose:L,base:G,define:X={},optimizeDeps:O={},plugins:F=[],css:z={},envDir:se,...M}=e,j=s!=="production",pe=Y||j,me=s==="production"&&(n.analyze??Bt.build.analyze);return{mode:s,debug:Y,verbose:L,isDev:j,isDebug:pe,shouldAnalyze:me,serverOptions:t,previewOptions:r,buildOverrides:n,resolveOptions:i,routeOptions:o,themeOptions:a,i18nOptions:c,assetOptions:u,featureOptions:f,seoOptions:b,pwaOptions:m,serverShimOptions:T,chunkingOptions:U,discoveryOptions:V,pluginFactoryOptions:re,base:G,defineOptions:X,optimizeDepsOptions:O,pluginsOptions:F,cssOptions:z,envDir:se,restOptions:M}}g();import{resolve as To}from"node:path";import Do from"autoprefixer";import Co from"postcss-import";import Fo from"postcss-nesting";g();function ms({postcssImport:e,postcssNesting:t,autoprefixer:r,resolve:s}){return{plugins:[s?e({resolve:s}):e,t,r({overrideBrowserslist:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"],grid:"autoplace"})]}}function bs(e={}){return e.postcss?e.postcss:async()=>{let t=ne.getInstance();return ms({postcssImport:Co,postcssNesting:Fo,autoprefixer:Do,resolve:(s,n)=>{let i=t.resolvePackage(s,n);if(i)return i;if(s.startsWith("@donotdev/")){let o=s.split("/")[0]+"/"+s.split("/")[1],a=s.split("/").slice(2).join("/"),c=t.resolveFrameworkPackage(o,n);if(c&&a){let u=t.resolvePath(a,c);if(t.pathExists(u))return u}}return To(n,s)}})}}g();import pf from"@vitejs/plugin-basic-ssl";import mf from"@vitejs/plugin-react";import bf from"vite-tsconfig-paths";g();g();g();var ye=class{static generateVirtualModule(t,r,s=!1,n=void 0,i=void 0){return r.isEmpty(t)?r.generateEmpty(t,s,n,i):r.generateModule(t,s,i)}static generateInspection(t,r,s,n){return r.generateInspection.length>=3?r.generateInspection(t,s,n):r.generateInspection(t,s)}static wrapVirtualModule(t,r){return`// Virtual module: ${t}
6
6
  // Generated by @donotdev/config discovery
7
7
  // Version: 1.0.0
8
8
 
@@ -38,13 +38,13 @@ var ro=Object.create;var Kr=Object.defineProperty;var so=Object.getOwnPropertyDe
38
38
  `);return`// Helper functions for ${t}
39
39
  // Generated by @donotdev/config
40
40
 
41
- ${s}`}static validateTemplates(t){return["isEmpty","generateModule","generateEmpty","generateInspection"].every(s=>t[s]&&typeof t[s]=="function")}static createTemplateConfig(t,r){let{isEmpty:s=()=>!1,generateModule:n=()=>"",generateEmpty:i=()=>"",generateInspection:o=()=>"",generateManifest:a=()=>({}),logConfig:c=()=>{},logStats:u=()=>{},logManifest:f=()=>{}}=r;return{isEmpty:s,generateModule:n,generateEmpty:i,generateInspection:o,generateManifest:a,logConfig:c,logStats:u,logManifest:f,pluginName:t,version:"1.0.0",createdAt:new Date().toISOString()}}static getEmptyResultWithError(t,r){let s=r?.message||r||"Unknown error";if(t&&typeof t._getEmptyResult=="function")try{let n=t._getEmptyResult();return n.errors&&Array.isArray(n.errors)?n.errors.push(s):n.errors===void 0&&(n.errors=[s]),n.source==="empty"&&(n.source="error"),n}catch{return{errors:[s],source:"error"}}return{errors:[s],source:"error"}}};function Fe(e){let{pluginName:t,icon:r,virtualModuleId:s,DiscoveryClass:n,discoveryMethod:i,filePatterns:o,templates:a,defaultInspectionPath:c,manifestFileName:u,createDiscovery:f,discoveryOptions:b={},configKey:m}=e;return function(U={}){let{debug:V,verbose:re,virtualModuleId:Y=s,inspectionFilePath:L=c,hmrDebounceMs:G,hmrCacheTimeout:X,hmrSmartDetection:O,disableHmr:F,...z}=U;if(!ye.validateTemplates(a))throw new Error(`Invalid templates for plugin ${t}`);let se={...Bt.discovery,...b,debug:V,verbose:re,...z},M=m||(()=>{let A=t.match(/dndev-vite-(\w+)-discovery/);return A?A[1]:null})(),j=Z(t,V,re,{fileLogging:se.fileLogging,logDir:se.logDir}),pe=ne.getInstance(),me=()=>{let A=pe.getAppRoot(),C=pe.getRepoRoot();return A&&A!==C},dt=Date.now(),H=f?f(pe,se):new n(pe,se),J="\0"+Y,K="",le=!1,Xe=null,Ke=0,Ye=!1,de=null,At=!1,nt=null,gt=!1;typeof global<"u"&&(global.__DNDEV_CLEAR_CACHE__=()=>(H.clearCache(),de=null,j.info("Discovery cache cleared manually"),"Cache cleared"));function ur(A){let ae=ye.generateVirtualModule(A,a,V,se,M).replace(/mode:\s*['"]development['"]/g,"mode: typeof process !== 'undefined' && process.env.NODE_ENV === 'production' ? 'production' : 'development'");return!F&&le&&(ae+=`
41
+ ${s}`}static validateTemplates(t){return["isEmpty","generateModule","generateEmpty","generateInspection"].every(s=>t[s]&&typeof t[s]=="function")}static createTemplateConfig(t,r){let{isEmpty:s=()=>!1,generateModule:n=()=>"",generateEmpty:i=()=>"",generateInspection:o=()=>"",generateManifest:a=()=>({}),logConfig:c=()=>{},logStats:u=()=>{},logManifest:f=()=>{}}=r;return{isEmpty:s,generateModule:n,generateEmpty:i,generateInspection:o,generateManifest:a,logConfig:c,logStats:u,logManifest:f,pluginName:t,version:"1.0.0",createdAt:new Date().toISOString()}}static getEmptyResultWithError(t,r){let s=r?.message||r||"Unknown error";if(t&&typeof t._getEmptyResult=="function")try{let n=t._getEmptyResult();return n.errors&&Array.isArray(n.errors)?n.errors.push(s):n.errors===void 0&&(n.errors=[s]),n.source==="empty"&&(n.source="error"),n}catch{return{errors:[s],source:"error"}}return{errors:[s],source:"error"}}};function Fe(e){let{pluginName:t,icon:r,virtualModuleId:s,DiscoveryClass:n,discoveryMethod:i,filePatterns:o,templates:a,defaultInspectionPath:c,manifestFileName:u,createDiscovery:f,discoveryOptions:b={},configKey:m}=e;return function(U={}){let{debug:V,verbose:re,virtualModuleId:Y=s,inspectionFilePath:L=c,hmrDebounceMs:G,hmrCacheTimeout:X,hmrSmartDetection:O,disableHmr:F,...z}=U;if(!ye.validateTemplates(a))throw new Error(`Invalid templates for plugin ${t}`);let se={...Bt.discovery,...b,debug:V,verbose:re,...z},M=m||(()=>{let A=t.match(/dndev-vite-(\w+)-discovery/);return A?A[1]:null})(),j=Q(t,V,re,{fileLogging:se.fileLogging,logDir:se.logDir}),pe=ne.getInstance(),me=()=>{let A=pe.getAppRoot(),C=pe.getRepoRoot();return A&&A!==C},dt=Date.now(),H=f?f(pe,se):new n(pe,se),J="\0"+Y,K="",le=!1,Xe=null,Ke=0,Ye=!1,de=null,At=!1,nt=null,gt=!1;typeof global<"u"&&(global.__DNDEV_CLEAR_CACHE__=()=>(H.clearCache(),de=null,j.info("Discovery cache cleared manually"),"Cache cleared"));function ur(A){let ae=ye.generateVirtualModule(A,a,V,se,M).replace(/mode:\s*['"]development['"]/g,"mode: typeof process !== 'undefined' && process.env.NODE_ENV === 'production' ? 'production' : 'development'");return!F&&le&&(ae+=`
42
42
 
43
43
  // HMR boundary for ${t}
44
44
  if (import.meta.hot) {
45
45
  import.meta.hot.accept();
46
46
  }
47
- `),ae}function fr(A){return ye.generateInspection(A,a,K,se)}async function _t(){if(K)try{let A=await H[i](),C=fr(A),ae=pe.resolveAppPath(L);await pe.write(ae,C),j.debug(`Generated inspection file: ${pe.getRelativePath(ae)}`)}catch(A){j.error(`${t} failed to write inspection file (${L}): ${A.message}`),j.error(`Stack: ${A.stack||"No stack trace available"}`)}}function jt(A){let C=A.replace(/\\/g,"/");if(F||C.includes("/node_modules/")||C.includes("/.git/")||C.includes("/dist/")||C.includes("/build/")||C.includes("/coverage/")||C.includes("/.vite/")||C.includes("/.turbo/")||C.endsWith(".d.ts")||C.endsWith(".tsbuildinfo")||C.endsWith(".map")||C.endsWith(".css.map")||C.endsWith(".generated.log")||/\.generated\.[a-z]+$/.test(C))return!1;let ae=pe.getRelativePath(C);if(ae.startsWith("packages/"))return!1;let ot=ae.startsWith("src/")&&/\.(ts|tsx)$/.test(ae);return ot?Array.isArray(o)&&o.length>0?o.some(Ie=>typeof Ie=="function"?Ie(C):typeof Ie=="string"?Ie.startsWith("**/")?C.endsWith(Ie.slice(3)):C.endsWith(Ie):!1):ot:!1}function hr(A){if(F)return j.debug("Virtual modules are static - HMR disabled"),[];let C=Date.now();return At?(j.debug("HMR already in progress, skipping update"),[]):C-Ke<G?(Ye||(Ye=!0,Xe=setTimeout(()=>{Ye=!1,Ke=Date.now(),it(A)},G)),[]):(Ke=C,it(A))}function it(A){let C=Date.now();if(nt===A.file&&C-Ke<100)return j.debug(`Same file processed too recently: ${A.file}`),[];if(!jt(A.file))return j.debug(`Skipping irrelevant file change: ${A.file}`),[];j.debug(`Relevant file changed: ${A.file}`),At=!0,nt=A.file;try{let ae=Date.now()-(de?.timestamp||0);if(ae<X&&de){j.debug(`Using cached discovery data (age: ${ae}ms)`);let Ie=A.server.moduleGraph.getModuleById(J);return Ie&&A.server.reloadModule(Ie),[]}H.clearCache();let ot=A.server.moduleGraph.getModuleById(J);return ot&&A.server.reloadModule(ot),Xe&&clearTimeout(Xe),Xe=setTimeout(()=>{_t()},500),[]}finally{At=!1,setTimeout(()=>{nt===A.file&&(nt=null)},200)}}return{name:t,enforce:"pre",configResolved(A){K=A.root,le=A.command==="serve",V&&j.debug(`${r} ${t} initialized`),le&&j.debug("\u{1F4A1} Dev mode: Press 'r' in terminal to restart, or use global.__DNDEV_CLEAR_CACHE__() in console"),a.logConfig&&a.logConfig(se),le?j.debug("Deferring discovery until first module load (dev mode)"):H[i](!1).catch(C=>{j.error(`${t} failed initial discovery during plugin initialization: ${C.message}`),j.error(`Stack: ${C.stack||"No stack trace available"}`)})},config(A){return A.optimizeDeps||(A.optimizeDeps={}),A.optimizeDeps.exclude||(A.optimizeDeps.exclude=[]),A.optimizeDeps.exclude.includes(Y)||A.optimizeDeps.exclude.push(Y),A},resolveId(A){return A===Y?(j.debug(`Resolving virtual module: ${A}`),{id:J,moduleSideEffects:!0}):null},async load(A){if(A!==J)return null;if(j.debug(`Loading virtual module: ${A}`),!me()){j.warn("\u26A0\uFE0F load() called before appRoot is set - waiting for config resolution");let C=0;for(;!me()&&C<100;)await new Promise(ae=>setTimeout(ae,10)),C++;if(!me())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let C;return de?(j.debug("Using cached discovery data for virtual module"),C=de):(j.warn(`\u26A0\uFE0F No cached discovery data found for ${t} - running discovery in load() hook. This may indicate buildStart() hook did not run or failed. Performance may be impacted.`),C=await H[i](),de=C,j.debug("Discovery completed for virtual module")),ur(C)}catch(C){return j.error(`${t} virtual module (${J}) failed to load: ${C.message}`),j.error(`Stack: ${C.stack||"No stack trace available"}`),a.generateEmpty({},V,se,M)}},async buildStart(){if(gt=!1,!me()){j.warn("\u26A0\uFE0F buildStart() called before appRoot is set - waiting for config resolution");let A=0;for(;!me()&&A<100;)await new Promise(C=>setTimeout(C,10)),A++;if(!me())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let A=await H[i](!de);de=A,await _t(),a.logStats&&a.logStats(A,r,j)}catch(A){j.error(`${t} discovery failed during file scanning: ${A.message}`),j.error(`Stack: ${A.stack||"No stack trace available"}`),de=ye.getEmptyResultWithError(H,A)}finally{gt=!0}},configureServer(){gt=!0},handleHotUpdate(A){return F?[]:gt?hr(A):(j.debug("HMR disabled - discovery not complete yet"),[])},generateBundle(){if(!de){j.warn("No cached discovery data for manifest generation - skipping");return}try{let A=ye.generateManifest(de,a.generateManifest);this.emitFile({type:"asset",fileName:u,source:JSON.stringify(A,null,2)}),re&&a.logManifest&&a.logManifest(de,t)}catch(A){j.error(`${t} manifest generation failed: ${A.message}`),j.error(`Stack: ${A.stack||"No stack trace available"}`)}},transform(A,C){return C===J?{code:A,map:null}:null}}}}var mh={generateGlobals:ye.generateGlobals,generateExports:ye.generateExports,generateDefaultExport:ye.generateDefaultExport,wrapVirtualModule:ye.wrapVirtualModule,generateInspectionHeader:ye.generateInspectionHeader,validateTemplates:ye.validateTemplates,createTemplateConfig:ye.createTemplateConfig};ge();g();g();var _e=class e{constructor(t,r={}){if(this.constructor===e)throw new Error("BaseDiscovery is abstract and cannot be instantiated directly");this.pathResolver=t,this.options={...r},p.env.NODE_ENV==="development"&&(this.options.cacheTimeout=Math.max(this.options.cacheTimeout||6e4,3e5)),this.logger=Z(this._getDiscoveryType(),this.options.debug,this.options.verbose,{fileLogging:this.options.fileLogging,logDir:this.options.logDir}),this.cache=null,this._lastDiscoveryTime=0}async discover(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=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 n=await this._scanFiles(s),i=await this._processFiles(n);this.cache={...i,timestamp:Date.now()};let o=Date.now()-r;return this.logger.debug(`Discovery completed in ${o}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(t){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(t){let r=this._getPatternType();return await this.pathResolver.resolveFiles(t,r)}_extractFileNameInfo(t){let r=t.split("/"),s=r[r.length-1],n=s.split(".")[0],i=s.split(".").pop();return{fileName:s,baseName:n,extension:i,directory:r.slice(0,-1).join("/")}}async _processSingleFile(t,r){try{let s=this.pathResolver.getFileInfo(t);return s?await r(s):(this.logger.debug(`Could not get file info: ${t}`),null)}catch(s){return this.logger.debug(`Error processing file ${t}: ${s.message}`),null}}async _batchProcessFiles(t,r){return(await Promise.all(t.map(n=>this._processSingleFile(n,r)))).filter(n=>n!==null)}_isCacheValid(){return this.cache?Date.now()-this.cache.timestamp<this.options.cacheTimeout:!1}};ge();var ir=class extends _e{constructor(t,r={}){super(t,{assets:ke.assets.fallback,assetPatterns:ke.assets.patterns,frameworkPackage:gr.package,assetsPath:gr.assetsPath,modernFormats:ke.assets.modern,...r}),this.hasRunForSession=!1}_getDiscoveryType(){return"Asset"}async _getPatterns(){return await this.pathResolver.resolvePatterns("assets")}_getPatternType(){return"assets"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=await this._ensureDefaultAssets(r),n=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(n)||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 o=[],a=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(a)&&this.options.generateAssets!==!1&&(o=(await this._generateMissingAssets(r))?.generated||[]);let{consumerFiles:c}=t,u=await this._processAssetFiles(c),f=this._buildAssetManifest(u),b=await this._readLogoSvgContent("/logo.svg",r);return{assets:u,manifest:{...f,logoSvgContent:b},copiedAssets:s,generatedAssets:o,pwaIcons:this._extractPWAIcons(u)}}_extractPWAIcons(t){let r=[/icon-(\d+)x(\d+)\.(png|jpg|jpeg|webp|svg)/i,/apple-touch-icon/i,/android-chrome/i,/favicon\.(ico|svg)/i];return t.filter(s=>{let n=s.path.split("/").pop()||"";return r.some(i=>i.test(n))}).map(s=>{let n=s.path.split("/").pop()||"",i=n.match(/(\d+)x(\d+)/),o=i?{width:parseInt(i[1]),height:parseInt(i[2])}:this._getDefaultIconSize(n);return{type:"icon",path:s.path.replace(/^\/?public\//,""),size:o,format:s.format||this._getFormatFromPath(s.path),purpose:this._getIconPurpose(n)}})}_getDefaultIconSize(t){return t.includes("apple-touch-icon")?{width:180,height:180}:t.includes("favicon")?{width:32,height:32}:{width:192,height:192}}_getFormatFromPath(t){return t.split(".").pop()?.toLowerCase()||"png"}_getIconPurpose(t){return t.includes("maskable")||t.includes("mask")?"maskable":"any"}_getEmptyResult(){return{assets:[],manifest:this._getEmptyManifest(),copiedAssets:[],timestamp:Date.now()}}_getDiscoverySummary(){let t=this.cache?.assets?.length||0,r=this.cache?.copiedAssets?.length||0,s=this.cache?.copiedAssets?.filter(n=>n.startsWith("fonts/")).length||0;return s>0?`${t} assets, ${r} copied (${s} fonts)`:`${t} assets, ${r} copied`}async discoverAssets(t=!1){return await this.discover(t)}getAssets(){return this.cache?.assets||[]}getManifest(){return this.cache?.manifest||this._getEmptyManifest()}getOptimalAsset(t,r){let s=this.getAssets().map(i=>i.path),n=r||this.options.modernFormats;for(let i of n){let o=`/${t}.${i}`;if(s.includes(o))return o}return null}async _ensureDefaultAssets(t){this.logger.debug("Ensuring default assets with modern format support...");let r=[];try{let s=await this._resolveFrameworkAssetsDir(t);if(this.logger.debug(`Framework assets directory resolved to: ${s}`),!s)return this.logger.debug("Framework assets directory not found, skipping defaults"),r;let n=this.pathResolver.resolveAppPath(Ge.public);this.pathResolver.pathExists(n)||(this.pathResolver.mkdir(n),this.logger.debug(`Created public directory: ${n}`));for(let i of this.options.assets)await this._ensureAsset(i,n,s)&&r.push(i);if(this.options.copyFonts!==!1){let i=await this._copyFrameworkFonts(s,n);r.push(...i)}else this.logger.debug("Font copying disabled, skipping framework fonts");r.length>0&&this.logger.debug(`Added ${r.length} default assets from DNDev framework`)}catch(s){this.logger.debug(`Failed to ensure default assets: ${s.message}`)}return r}async _ensureAsset(t,r,s){let n=this.pathResolver.resolveAppPath(`${Ge.public}/${t}`);if(this.pathResolver.pathExists(n))return this.logger.debug(`Asset exists: ${t}`),!1;let i=this.pathResolver.normalizePath(`${s}/${t}`);if(this.pathResolver.pathExists(i)){if(await this.pathResolver.copy(i,n))return this.logger.debug(`Copied framework asset: ${t}`),!0;this.logger.debug(`Failed to copy framework asset: ${t}`)}return!1}async _copyFrameworkFonts(t,r){let s=[],n=this.pathResolver.normalizePath(`${t}/fonts`);if(!this.pathResolver.pathExists(n))return this.logger.debug("Framework fonts directory not found, skipping fonts"),s;let i=this.pathResolver.resolveAppPath(`${Ge.public}/${Ge.fonts}`);this.pathResolver.pathExists(i)||(this.pathResolver.mkdir(i),this.logger.debug(`Created fonts directory: ${i}`));try{let o=await this.pathResolver.findFiles(n,"*",{onlyFiles:!0,ignore:["**/dist/**","**/build/**","**/.git/**"]});for(let a of o){let c=a.split("/").pop()||a.split("\\").pop(),u=this.pathResolver.resolveAppPath(`${Ge.public}/${Ge.fonts}/${c}`);if(this.pathResolver.pathExists(u)){this.logger.debug(`Font already exists: ${c}`);continue}await this.pathResolver.copy(a,u)?(s.push(`fonts/${c}`),this.logger.debug(`Copied framework font: ${c}`)):this.logger.debug(`Failed to copy font: ${c}`)}s.length>0&&this.logger.debug(`Copied ${s.length} font files from framework`)}catch(o){this.logger.debug(`Error copying fonts: ${o.message}`)}return s}async _processAssetFiles(t){let r=[];for(let s of t)try{let n=this.pathResolver.getFileInfo(s);if(n&&n.isFile){let i=s.split("/").pop()||s.split("\\").pop(),o=this._analyzeAsset(i,n.size);o&&r.push(o)}}catch(n){this.logger.debug(`Error processing asset file ${s}: ${n.message}`)}return this.logger.debug(`Processed ${r.length} assets from ${t.length} files`),r}_analyzeAsset(t,r){let s=this._determineAssetType(t),n=this._determineAssetFormat(t);return this.options.assetPatterns.some(o=>this._matchesPattern(t,o))?{path:`/${t}`,name:t,type:s,format:n,size:r,sizeFormatted:this._formatBytes(r),isModern:this.options.modernFormats.includes(n)}:(this.logger.debug(`Asset ${t} does not match any pattern, skipping`),null)}_determineAssetType(t){let r=t.toLowerCase();if(r.includes("favicon"))return"favicon";if(r.includes("logo"))return"logo";if(r.includes("icon"))return"icon";if(r.includes("apple-touch"))return"apple-touch-icon";if(r.includes("android-chrome"))return"android-icon";if(r.includes("manifest"))return"manifest";let s=t.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(t){return t.split(".").pop()?.toLowerCase()||"unknown"}_formatBytes(t){if(t===0)return"0 Bytes";let r=1024,s=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,n)).toFixed(2))+" "+s[n]}_matchesPattern(t,r){let s=t.toLowerCase(),n=r.toLowerCase();return s.includes(n.replace("*",""))}_buildAssetManifest(t){let r=t.map(n=>n.path);return{logo:{optimal:this._getOptimalAsset("logo",r,this.options.modernFormats),fallback:this._getOptimalAsset("logo",r,["png","jpg","jpeg"])},favicon:{optimal:this._getOptimalAsset("favicon",r,["svg","ico"]),fallback:this._getOptimalAsset("favicon",r,["ico"])},appleTouchIcon:this._getOptimalAsset("apple-touch-icon",r,["png"]),androidChrome:{192:this._getOptimalAsset("android-chrome-192x192",r,["png"]),512:this._getOptimalAsset("android-chrome-512x512",r,["png"])},manifest:r.find(n=>n.includes("manifest.json"))||null,modernFormats:t.filter(n=>n.isModern).map(n=>n.path),fallbackFormats:t.filter(n=>!n.isModern).map(n=>n.path)}}_getOptimalAsset(t,r,s){for(let n of s){let i=`/${t}.${n}`;if(r.includes(i))return i}return null}async _resolveFrameworkAssetsDir(t){try{let r=this.pathResolver.getRepoRoot(),s=await this._resolvePackage("@donotdev/ui",r);if(!s)return this.logger.debug("@donotdev/ui package not found"),null;let n=this.pathResolver.normalizePath(`${s}/assets`);return this.pathResolver.pathExists(n)?(this.logger.debug(`Using framework assets from: ${n}`),n):(this.logger.debug(`Assets directory not found: ${n}`),null)}catch(r){return this.logger.debug(`Error resolving framework assets directory: ${r.message}`),null}}async _resolvePackage(t,r){try{let s=this.pathResolver.resolveFrameworkPackage(t,r);return s?(this.logger.debug(`Found package: ${s}`),s):(this.logger.debug(`Package ${t} not found`),null)}catch(s){return this.logger.debug(`Error resolving package ${t}: ${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(t,r){if(!t||!t.endsWith(".svg"))return null;try{let s=t.slice(1),n=this.pathResolver.resolveAppPath(`${Ge.public}/${s}`);return this.pathResolver.pathExists(n)&&await this.pathResolver.read(n,{format:"text"})||null}catch(s){return this.logger.debug(`Failed to read logo SVG content: ${s.message}`),null}}async _copyFrameworkLogo(t){try{let r=await this._resolveFrameworkAssetsDir(t);if(!r)return this.logger.debug("Framework assets directory not found"),!1;let s=this.pathResolver.normalizePath(`${r}/logo.svg`);if(!this.pathResolver.pathExists(s))return this.logger.debug("Framework logo.svg not found"),!1;let n=this.pathResolver.resolveAppPath(Ge.public);this.pathResolver.pathExists(n)||this.pathResolver.mkdir(n);let i=this.pathResolver.resolveAppPath("public/logo.svg");return await this.pathResolver.copy(s,i)}catch(r){return this.logger.debug(`Failed to copy framework logo: ${r.message}`),!1}}async _generateMissingAssets(t){let r=this.pathResolver.resolveAppPath("public/logo.svg"),s=this.pathResolver.resolveAppPath("public");if(!this.pathResolver.pathExists(r))return this.logger.debug("logo.svg not found in public/, skipping asset generation"),{generated:[],skipped:[],error:"logo.svg not found in public/"};let n=[{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"}],i=[{name:"favicon.svg",format:"svg"}],o=[],a=[];try{let c=await this.pathResolver.read(r,{format:"text"});if(!c)return{generated:[],skipped:[...i,...n].map(f=>f.name),error:"Failed to read logo.svg"};for(let f of i){let b=`${s}/${f.name}`;if(this.pathResolver.pathExists(b)){a.push(f.name);continue}try{await this.pathResolver.write(`public/${f.name}`,c),o.push(f.name)}catch(m){this.logger.debug(`Failed to copy ${f.name}: ${m.message}`),a.push(f.name)}}let u=await Promise.resolve().then(()=>lo(Oi(),1)).catch(()=>null);if(!u)this.logger.debug("sharp not installed, skipping PNG/ICO generation"),a.push(...n.map(f=>f.name));else for(let f of n){let b=`${s}/${f.name}`;if(this.pathResolver.pathExists(b)){a.push(f.name);continue}try{let m=u.default(r).resize(f.size,f.size,{fit:"contain",background:{r:255,g:255,b:255,alpha:0}}),T;f.format==="ico"?T=await m.toFormat("png").toBuffer():T=await m.toFormat(f.format).toBuffer(),await this.pathResolver.write(`public/${f.name}`,T),o.push(f.name)}catch(m){this.logger.debug(`Failed to generate ${f.name}: ${m.message}`),a.push(f.name)}}return{generated:o,skipped:a,error:null}}catch(c){return this.logger.debug(`Asset generation failed: ${c.message}`),{generated:[],skipped:requiredAssets.map(u=>u.name),error:c.message}}}};var Vr={data:null},tf={isEmpty:e=>!e.manifest||e.assets?.length===0,generateModule:(e,t,r="assets")=>{let{manifest:s,assets:n,copiedAssets:i}=e,o=s.logoSvgContent||null,a={totalAssets:n.length,copiedAssets:i.length,hasLogo:s.logo.optimal!==null,hasFavicon:s.favicon.optimal!==null,hasManifest:s.manifest!==null,timestamp:new Date().toISOString()};return`// ${ee.assets} - Generated asset manifest
47
+ `),ae}function fr(A){return ye.generateInspection(A,a,K,se)}async function _t(){if(K)try{let A=await H[i](),C=fr(A),ae=pe.resolveAppPath(L);await pe.write(ae,C),j.debug(`Generated inspection file: ${pe.getRelativePath(ae)}`)}catch(A){j.error(`${t} failed to write inspection file (${L}): ${A.message}`),j.error(`Stack: ${A.stack||"No stack trace available"}`)}}function jt(A){let C=A.replace(/\\/g,"/");if(F||C.includes("/node_modules/")||C.includes("/.git/")||C.includes("/dist/")||C.includes("/build/")||C.includes("/coverage/")||C.includes("/.vite/")||C.includes("/.turbo/")||C.endsWith(".d.ts")||C.endsWith(".tsbuildinfo")||C.endsWith(".map")||C.endsWith(".css.map")||C.endsWith(".generated.log")||/\.generated\.[a-z]+$/.test(C))return!1;let ae=pe.getRelativePath(C);if(ae.startsWith("packages/"))return!1;let ot=ae.startsWith("src/")&&/\.(ts|tsx)$/.test(ae);return ot?Array.isArray(o)&&o.length>0?o.some(Ie=>typeof Ie=="function"?Ie(C):typeof Ie=="string"?Ie.startsWith("**/")?C.endsWith(Ie.slice(3)):C.endsWith(Ie):!1):ot:!1}function hr(A){if(F)return j.debug("Virtual modules are static - HMR disabled"),[];let C=Date.now();return At?(j.debug("HMR already in progress, skipping update"),[]):C-Ke<G?(Ye||(Ye=!0,Xe=setTimeout(()=>{Ye=!1,Ke=Date.now(),it(A)},G)),[]):(Ke=C,it(A))}function it(A){let C=Date.now();if(nt===A.file&&C-Ke<100)return j.debug(`Same file processed too recently: ${A.file}`),[];if(!jt(A.file))return j.debug(`Skipping irrelevant file change: ${A.file}`),[];j.debug(`Relevant file changed: ${A.file}`),At=!0,nt=A.file;try{let ae=Date.now()-(de?.timestamp||0);if(ae<X&&de){j.debug(`Using cached discovery data (age: ${ae}ms)`);let Ie=A.server.moduleGraph.getModuleById(J);return Ie&&A.server.reloadModule(Ie),[]}H.clearCache();let ot=A.server.moduleGraph.getModuleById(J);return ot&&A.server.reloadModule(ot),Xe&&clearTimeout(Xe),Xe=setTimeout(()=>{_t()},500),[]}finally{At=!1,setTimeout(()=>{nt===A.file&&(nt=null)},200)}}return{name:t,enforce:"pre",configResolved(A){K=A.root,le=A.command==="serve",V&&j.debug(`${r} ${t} initialized`),le&&j.debug("\u{1F4A1} Dev mode: Press 'r' in terminal to restart, or use global.__DNDEV_CLEAR_CACHE__() in console"),a.logConfig&&a.logConfig(se),le?j.debug("Deferring discovery until first module load (dev mode)"):H[i](!1).catch(C=>{j.error(`${t} failed initial discovery during plugin initialization: ${C.message}`),j.error(`Stack: ${C.stack||"No stack trace available"}`)})},config(A){return A.optimizeDeps||(A.optimizeDeps={}),A.optimizeDeps.exclude||(A.optimizeDeps.exclude=[]),A.optimizeDeps.exclude.includes(Y)||A.optimizeDeps.exclude.push(Y),A},resolveId(A){return A===Y?(j.debug(`Resolving virtual module: ${A}`),{id:J,moduleSideEffects:!0}):null},async load(A){if(A!==J)return null;if(j.debug(`Loading virtual module: ${A}`),!me()){j.warn("\u26A0\uFE0F load() called before appRoot is set - waiting for config resolution");let C=0;for(;!me()&&C<100;)await new Promise(ae=>setTimeout(ae,10)),C++;if(!me())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let C;return de?(j.debug("Using cached discovery data for virtual module"),C=de):(j.warn(`\u26A0\uFE0F No cached discovery data found for ${t} - running discovery in load() hook. This may indicate buildStart() hook did not run or failed. Performance may be impacted.`),C=await H[i](),de=C,j.debug("Discovery completed for virtual module")),ur(C)}catch(C){return j.error(`${t} virtual module (${J}) failed to load: ${C.message}`),j.error(`Stack: ${C.stack||"No stack trace available"}`),a.generateEmpty({},V,se,M)}},async buildStart(){if(gt=!1,!me()){j.warn("\u26A0\uFE0F buildStart() called before appRoot is set - waiting for config resolution");let A=0;for(;!me()&&A<100;)await new Promise(C=>setTimeout(C,10)),A++;if(!me())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let A=await H[i](!de);de=A,await _t(),a.logStats&&a.logStats(A,r,j)}catch(A){j.error(`${t} discovery failed during file scanning: ${A.message}`),j.error(`Stack: ${A.stack||"No stack trace available"}`),de=ye.getEmptyResultWithError(H,A)}finally{gt=!0}},configureServer(){gt=!0},handleHotUpdate(A){return F?[]:gt?hr(A):(j.debug("HMR disabled - discovery not complete yet"),[])},generateBundle(){if(!de){j.warn("No cached discovery data for manifest generation - skipping");return}try{let A=ye.generateManifest(de,a.generateManifest);this.emitFile({type:"asset",fileName:u,source:JSON.stringify(A,null,2)}),re&&a.logManifest&&a.logManifest(de,t)}catch(A){j.error(`${t} manifest generation failed: ${A.message}`),j.error(`Stack: ${A.stack||"No stack trace available"}`)}},transform(A,C){return C===J?{code:A,map:null}:null}}}}var bh={generateGlobals:ye.generateGlobals,generateExports:ye.generateExports,generateDefaultExport:ye.generateDefaultExport,wrapVirtualModule:ye.wrapVirtualModule,generateInspectionHeader:ye.generateInspectionHeader,validateTemplates:ye.validateTemplates,createTemplateConfig:ye.createTemplateConfig};ge();g();g();var _e=class e{constructor(t,r={}){if(this.constructor===e)throw new Error("BaseDiscovery is abstract and cannot be instantiated directly");this.pathResolver=t,this.options={...r},p.env.NODE_ENV==="development"&&(this.options.cacheTimeout=Math.max(this.options.cacheTimeout||6e4,3e5)),this.logger=Q(this._getDiscoveryType(),this.options.debug,this.options.verbose,{fileLogging:this.options.fileLogging,logDir:this.options.logDir}),this.cache=null,this._lastDiscoveryTime=0}async discover(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=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 n=await this._scanFiles(s),i=await this._processFiles(n);this.cache={...i,timestamp:Date.now()};let o=Date.now()-r;return this.logger.debug(`Discovery completed in ${o}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(t){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(t){let r=this._getPatternType();return await this.pathResolver.resolveFiles(t,r)}_extractFileNameInfo(t){let r=t.split("/"),s=r[r.length-1],n=s.split(".")[0],i=s.split(".").pop();return{fileName:s,baseName:n,extension:i,directory:r.slice(0,-1).join("/")}}async _processSingleFile(t,r){try{let s=this.pathResolver.getFileInfo(t);return s?await r(s):(this.logger.debug(`Could not get file info: ${t}`),null)}catch(s){return this.logger.debug(`Error processing file ${t}: ${s.message}`),null}}async _batchProcessFiles(t,r){return(await Promise.all(t.map(n=>this._processSingleFile(n,r)))).filter(n=>n!==null)}_isCacheValid(){return this.cache?Date.now()-this.cache.timestamp<this.options.cacheTimeout:!1}};ge();var ir=class extends _e{constructor(t,r={}){super(t,{assets:ke.assets.fallback,assetPatterns:ke.assets.patterns,frameworkPackage:gr.package,assetsPath:gr.assetsPath,modernFormats:ke.assets.modern,...r}),this.hasRunForSession=!1}_getDiscoveryType(){return"Asset"}async _getPatterns(){return await this.pathResolver.resolvePatterns("assets")}_getPatternType(){return"assets"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=await this._ensureDefaultAssets(r),n=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(n)||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 o=[],a=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(a)&&this.options.generateAssets!==!1&&(o=(await this._generateMissingAssets(r))?.generated||[]);let{consumerFiles:c}=t,u=await this._processAssetFiles(c),f=this._buildAssetManifest(u),b=await this._readLogoSvgContent("/logo.svg",r);return{assets:u,manifest:{...f,logoSvgContent:b},copiedAssets:s,generatedAssets:o,pwaIcons:this._extractPWAIcons(u)}}_extractPWAIcons(t){let r=[/icon-(\d+)x(\d+)\.(png|jpg|jpeg|webp|svg)/i,/apple-touch-icon/i,/android-chrome/i,/favicon\.(ico|svg)/i];return t.filter(s=>{let n=s.path.split("/").pop()||"";return r.some(i=>i.test(n))}).map(s=>{let n=s.path.split("/").pop()||"",i=n.match(/(\d+)x(\d+)/),o=i?{width:parseInt(i[1]),height:parseInt(i[2])}:this._getDefaultIconSize(n);return{type:"icon",path:s.path.replace(/^\/?public\//,""),size:o,format:s.format||this._getFormatFromPath(s.path),purpose:this._getIconPurpose(n)}})}_getDefaultIconSize(t){return t.includes("apple-touch-icon")?{width:180,height:180}:t.includes("favicon")?{width:32,height:32}:{width:192,height:192}}_getFormatFromPath(t){return t.split(".").pop()?.toLowerCase()||"png"}_getIconPurpose(t){return t.includes("maskable")||t.includes("mask")?"maskable":"any"}_getEmptyResult(){return{assets:[],manifest:this._getEmptyManifest(),copiedAssets:[],timestamp:Date.now()}}_getDiscoverySummary(){let t=this.cache?.assets?.length||0,r=this.cache?.copiedAssets?.length||0,s=this.cache?.copiedAssets?.filter(n=>n.startsWith("fonts/")).length||0;return s>0?`${t} assets, ${r} copied (${s} fonts)`:`${t} assets, ${r} copied`}async discoverAssets(t=!1){return await this.discover(t)}getAssets(){return this.cache?.assets||[]}getManifest(){return this.cache?.manifest||this._getEmptyManifest()}getOptimalAsset(t,r){let s=this.getAssets().map(i=>i.path),n=r||this.options.modernFormats;for(let i of n){let o=`/${t}.${i}`;if(s.includes(o))return o}return null}async _ensureDefaultAssets(t){this.logger.debug("Ensuring default assets with modern format support...");let r=[];try{let s=await this._resolveFrameworkAssetsDir(t);if(this.logger.debug(`Framework assets directory resolved to: ${s}`),!s)return this.logger.debug("Framework assets directory not found, skipping defaults"),r;let n=this.pathResolver.resolveAppPath(Ge.public);this.pathResolver.pathExists(n)||(this.pathResolver.mkdir(n),this.logger.debug(`Created public directory: ${n}`));for(let i of this.options.assets)await this._ensureAsset(i,n,s)&&r.push(i);if(this.options.copyFonts!==!1){let i=await this._copyFrameworkFonts(s,n);r.push(...i)}else this.logger.debug("Font copying disabled, skipping framework fonts");r.length>0&&this.logger.debug(`Added ${r.length} default assets from DNDev framework`)}catch(s){this.logger.debug(`Failed to ensure default assets: ${s.message}`)}return r}async _ensureAsset(t,r,s){let n=this.pathResolver.resolveAppPath(`${Ge.public}/${t}`);if(this.pathResolver.pathExists(n))return this.logger.debug(`Asset exists: ${t}`),!1;let i=this.pathResolver.normalizePath(`${s}/${t}`);if(this.pathResolver.pathExists(i)){if(await this.pathResolver.copy(i,n))return this.logger.debug(`Copied framework asset: ${t}`),!0;this.logger.debug(`Failed to copy framework asset: ${t}`)}return!1}async _copyFrameworkFonts(t,r){let s=[],n=this.pathResolver.normalizePath(`${t}/fonts`);if(!this.pathResolver.pathExists(n))return this.logger.debug("Framework fonts directory not found, skipping fonts"),s;let i=this.pathResolver.resolveAppPath(`${Ge.public}/${Ge.fonts}`);this.pathResolver.pathExists(i)||(this.pathResolver.mkdir(i),this.logger.debug(`Created fonts directory: ${i}`));try{let o=await this.pathResolver.findFiles(n,"*",{onlyFiles:!0,ignore:["**/dist/**","**/build/**","**/.git/**"]});for(let a of o){let c=a.split("/").pop()||a.split("\\").pop(),u=this.pathResolver.resolveAppPath(`${Ge.public}/${Ge.fonts}/${c}`);if(this.pathResolver.pathExists(u)){this.logger.debug(`Font already exists: ${c}`);continue}await this.pathResolver.copy(a,u)?(s.push(`fonts/${c}`),this.logger.debug(`Copied framework font: ${c}`)):this.logger.debug(`Failed to copy font: ${c}`)}s.length>0&&this.logger.debug(`Copied ${s.length} font files from framework`)}catch(o){this.logger.debug(`Error copying fonts: ${o.message}`)}return s}async _processAssetFiles(t){let r=[];for(let s of t)try{let n=this.pathResolver.getFileInfo(s);if(n&&n.isFile){let i=s.split("/").pop()||s.split("\\").pop(),o=this._analyzeAsset(i,n.size);o&&r.push(o)}}catch(n){this.logger.debug(`Error processing asset file ${s}: ${n.message}`)}return this.logger.debug(`Processed ${r.length} assets from ${t.length} files`),r}_analyzeAsset(t,r){let s=this._determineAssetType(t),n=this._determineAssetFormat(t);return this.options.assetPatterns.some(o=>this._matchesPattern(t,o))?{path:`/${t}`,name:t,type:s,format:n,size:r,sizeFormatted:this._formatBytes(r),isModern:this.options.modernFormats.includes(n)}:(this.logger.debug(`Asset ${t} does not match any pattern, skipping`),null)}_determineAssetType(t){let r=t.toLowerCase();if(r.includes("favicon"))return"favicon";if(r.includes("logo"))return"logo";if(r.includes("icon"))return"icon";if(r.includes("apple-touch"))return"apple-touch-icon";if(r.includes("android-chrome"))return"android-icon";if(r.includes("manifest"))return"manifest";let s=t.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(t){return t.split(".").pop()?.toLowerCase()||"unknown"}_formatBytes(t){if(t===0)return"0 Bytes";let r=1024,s=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,n)).toFixed(2))+" "+s[n]}_matchesPattern(t,r){let s=t.toLowerCase(),n=r.toLowerCase();return s.includes(n.replace("*",""))}_buildAssetManifest(t){let r=t.map(n=>n.path);return{logo:{optimal:this._getOptimalAsset("logo",r,this.options.modernFormats),fallback:this._getOptimalAsset("logo",r,["png","jpg","jpeg"])},favicon:{optimal:this._getOptimalAsset("favicon",r,["svg","ico"]),fallback:this._getOptimalAsset("favicon",r,["ico"])},appleTouchIcon:this._getOptimalAsset("apple-touch-icon",r,["png"]),androidChrome:{192:this._getOptimalAsset("android-chrome-192x192",r,["png"]),512:this._getOptimalAsset("android-chrome-512x512",r,["png"])},manifest:r.find(n=>n.includes("manifest.json"))||null,modernFormats:t.filter(n=>n.isModern).map(n=>n.path),fallbackFormats:t.filter(n=>!n.isModern).map(n=>n.path)}}_getOptimalAsset(t,r,s){for(let n of s){let i=`/${t}.${n}`;if(r.includes(i))return i}return null}async _resolveFrameworkAssetsDir(t){try{let r=this.pathResolver.getRepoRoot(),s=await this._resolvePackage("@donotdev/ui",r);if(!s)return this.logger.debug("@donotdev/ui package not found"),null;let n=this.pathResolver.normalizePath(`${s}/assets`);return this.pathResolver.pathExists(n)?(this.logger.debug(`Using framework assets from: ${n}`),n):(this.logger.debug(`Assets directory not found: ${n}`),null)}catch(r){return this.logger.debug(`Error resolving framework assets directory: ${r.message}`),null}}async _resolvePackage(t,r){try{let s=this.pathResolver.resolveFrameworkPackage(t,r);return s?(this.logger.debug(`Found package: ${s}`),s):(this.logger.debug(`Package ${t} not found`),null)}catch(s){return this.logger.debug(`Error resolving package ${t}: ${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(t,r){if(!t||!t.endsWith(".svg"))return null;try{let s=t.slice(1),n=this.pathResolver.resolveAppPath(`${Ge.public}/${s}`);return this.pathResolver.pathExists(n)&&await this.pathResolver.read(n,{format:"text"})||null}catch(s){return this.logger.debug(`Failed to read logo SVG content: ${s.message}`),null}}async _copyFrameworkLogo(t){try{let r=await this._resolveFrameworkAssetsDir(t);if(!r)return this.logger.debug("Framework assets directory not found"),!1;let s=this.pathResolver.normalizePath(`${r}/logo.svg`);if(!this.pathResolver.pathExists(s))return this.logger.debug("Framework logo.svg not found"),!1;let n=this.pathResolver.resolveAppPath(Ge.public);this.pathResolver.pathExists(n)||this.pathResolver.mkdir(n);let i=this.pathResolver.resolveAppPath("public/logo.svg");return await this.pathResolver.copy(s,i)}catch(r){return this.logger.debug(`Failed to copy framework logo: ${r.message}`),!1}}async _generateMissingAssets(t){let r=this.pathResolver.resolveAppPath("public/logo.svg"),s=this.pathResolver.resolveAppPath("public");if(!this.pathResolver.pathExists(r))return this.logger.debug("logo.svg not found in public/, skipping asset generation"),{generated:[],skipped:[],error:"logo.svg not found in public/"};let n=[{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"}],i=[{name:"favicon.svg",format:"svg"}],o=[],a=[];try{let c=await this.pathResolver.read(r,{format:"text"});if(!c)return{generated:[],skipped:[...i,...n].map(f=>f.name),error:"Failed to read logo.svg"};for(let f of i){let b=`${s}/${f.name}`;if(this.pathResolver.pathExists(b)){a.push(f.name);continue}try{await this.pathResolver.write(`public/${f.name}`,c),o.push(f.name)}catch(m){this.logger.debug(`Failed to copy ${f.name}: ${m.message}`),a.push(f.name)}}let u=await Promise.resolve().then(()=>co(ji(),1)).catch(()=>null);if(!u)this.logger.debug("sharp not installed, skipping PNG/ICO generation"),a.push(...n.map(f=>f.name));else for(let f of n){let b=`${s}/${f.name}`;if(this.pathResolver.pathExists(b)){a.push(f.name);continue}try{let m=u.default(r).resize(f.size,f.size,{fit:"contain",background:{r:255,g:255,b:255,alpha:0}}),T;f.format==="ico"?T=await m.toFormat("png").toBuffer():T=await m.toFormat(f.format).toBuffer(),await this.pathResolver.write(`public/${f.name}`,T),o.push(f.name)}catch(m){this.logger.debug(`Failed to generate ${f.name}: ${m.message}`),a.push(f.name)}}return{generated:o,skipped:a,error:null}}catch(c){return this.logger.debug(`Asset generation failed: ${c.message}`),{generated:[],skipped:requiredAssets.map(u=>u.name),error:c.message}}}};var Jr={data:null},rf={isEmpty:e=>!e.manifest||e.assets?.length===0,generateModule:(e,t,r="assets")=>{let{manifest:s,assets:n,copiedAssets:i}=e,o=s.logoSvgContent||null,a={totalAssets:n.length,copiedAssets:i.length,hasLogo:s.logo.optimal!==null,hasFavicon:s.favicon.optimal!==null,hasManifest:s.manifest!==null,timestamp:new Date().toISOString()};return`// ${ee.assets} - Generated asset manifest
48
48
  const assetManifest = ${JSON.stringify(s,null,2)};
49
49
  const assetStats = ${JSON.stringify(a,null,2)};
50
50
 
@@ -230,7 +230,7 @@ export const assetStats = {
230
230
  };
231
231
 
232
232
  export default discoveredAssets;
233
- `},generateManifest:e=>({assets:e.assets?.length||0,copied:e.copiedAssets?.length||0,timestamp:Date.now(),hasLogo:e.manifest?.logo?.optimal!==null,hasFavicon:e.manifest?.favicon?.optimal!==null}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.assets?.length||0,n=e.generatedAssets?.length||0;r&&(n>0?r.info(`${t} Assets: ${s} found, ${n} generated`):r.info(`${t} Assets: ${s} found`))}},rf=[e=>e.includes("/public/"),e=>e.endsWith(".png")||e.endsWith(".svg")||e.endsWith(".ico"),e=>e.includes("favicon")||e.includes("logo")||e.includes("manifest")];function ji(e={}){let t=Fe({pluginName:"dndev-vite-asset-discovery",icon:"\u{1F3AF}",virtualModuleId:ee.assets,DiscoveryClass:ir,discoveryMethod:"discoverAssets",filePatterns:rf,templates:tf,defaultInspectionPath:ue.vite.assetInspection,manifestFileName:ue.manifests.asset,configKey:"assets"})(e),r=ne.getInstance(),s=Z("asset-plugin",e.debug,e.verbose),n=t.buildStart;return t.buildStart=async function(...i){n&&await n.apply(this,i);let o=null;try{let a=r.resolveAppPath(ue.vite.assetInspection);if(r.pathExists(a)){let c=r.readSync(a,{format:"json"});c&&(o=c,Vr.data=o)}}catch(a){s.debug(`Could not cache asset data: ${a.message}`)}},t}g();import{loadEnv as sf}from"vite";ge();var Li={isEmpty:e=>!e.env||Object.keys(e.env).length===0,generateModule:(e,t,r="env")=>{let{env:s,mode:n}=e;if(!s||Object.keys(s).length===0)return Li.generateEmpty(e,t,void 0,r);let i={totalVars:Object.keys(s).length,mode:n,source:e.source,generatedAt:new Date().toISOString()};return`// ${ee.env} - Generated environment variables
233
+ `},generateManifest:e=>({assets:e.assets?.length||0,copied:e.copiedAssets?.length||0,timestamp:Date.now(),hasLogo:e.manifest?.logo?.optimal!==null,hasFavicon:e.manifest?.favicon?.optimal!==null}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.assets?.length||0,n=e.generatedAssets?.length||0;r&&(n>0?r.info(`${t} Assets: ${s} found, ${n} generated`):r.info(`${t} Assets: ${s} found`))}},sf=[e=>e.includes("/public/"),e=>e.endsWith(".png")||e.endsWith(".svg")||e.endsWith(".ico"),e=>e.includes("favicon")||e.includes("logo")||e.includes("manifest")];function Li(e={}){let t=Fe({pluginName:"dndev-vite-asset-discovery",icon:"\u{1F3AF}",virtualModuleId:ee.assets,DiscoveryClass:ir,discoveryMethod:"discoverAssets",filePatterns:sf,templates:rf,defaultInspectionPath:ue.vite.assetInspection,manifestFileName:ue.manifests.asset,configKey:"assets"})(e),r=ne.getInstance(),s=Q("asset-plugin",e.debug,e.verbose),n=t.buildStart;return t.buildStart=async function(...i){n&&await n.apply(this,i);let o=null;try{let a=r.resolveAppPath(ue.vite.assetInspection);if(r.pathExists(a)){let c=r.readSync(a,{format:"json"});c&&(o=c,Jr.data=o)}}catch(a){s.debug(`Could not cache asset data: ${a.message}`)}},t}g();import{loadEnv as nf}from"vite";ge();var Mi={isEmpty:e=>!e.env||Object.keys(e.env).length===0,generateModule:(e,t,r="env")=>{let{env:s,mode:n}=e;if(!s||Object.keys(s).length===0)return Mi.generateEmpty(e,t,void 0,r);let i={totalVars:Object.keys(s).length,mode:n,source:e.source,generatedAt:new Date().toISOString()};return`// ${ee.env} - Generated environment variables
234
234
 
235
235
  const envData = ${JSON.stringify(s,null,2)};
236
236
  const envManifest = ${JSON.stringify(i,null,2)};
@@ -309,7 +309,7 @@ export const source = 'empty';
309
309
 
310
310
  export default envData;
311
311
  `},generateInspection:e=>{let{env:t,mode:r}=e;return["/**"," * Generated Environment Variables",` * Mode: ${r}`,` * Generated at: ${new Date().toISOString()}`,` * Total variables: ${Object.keys(t).length}`," */","","```json",JSON.stringify(t,null,2),"```"].join(`
312
- `)},generateManifest:e=>({totalVars:Object.keys(e?.env||{}).length,mode:e?.mode||"development",variables:Object.keys(e?.env||{}),timestamp:Date.now()}),logStats:(e,t,r)=>{let s=Object.keys(e.env).length;r&&r.info(`${t} Env: ${s} VITE_* variables`)}},Jr=class{constructor(t,r={}){this.pathResolver=t,this.options=r,this.mode=r.mode||"development",this.appRoot=null}async discoverEnv(){try{let t=this.pathResolver.getAppRoot();if(!t)throw new Error("App root not available in EnvDiscovery");let s={...sf(this.mode,t,"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:`${t}/.env`,errors:[]}}catch(t){return{env:{},mode:this.mode,source:"error",errors:[t.message]}}}};function Mi(e={}){return Fe({pluginName:"dndev-vite-env-discovery",icon:"\u{1F510}",virtualModuleId:ee.env,discoveryMethod:"discoverEnv",filePatterns:[],templates:Li,defaultInspectionPath:ue.vite.envInspection,manifestFileName:ue.manifests.env,configKey:"env",createDiscovery:(t,r)=>new Jr(t,{...r,mode:e.mode||r.mode||"development"})})({...e,disableHmr:!0})}g();ge();g();ge();var or=class extends _e{constructor(t,r={}){super(t,{fallbackLanguage:"en",...r})}_getDiscoveryType(){return"I18n"}async _getPatterns(){return await this.pathResolver.resolvePatterns("i18n")}_getPatternType(){return"i18n"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=this.pathResolver.getRepoRoot();if(!r||r===s)throw this.logger.error(`I18n discovery: appRoot not properly set (appRoot: ${r}, repoRoot: ${s})`),new Error("App root not set before i18n discovery. Ensure configResolved hook has run.");this.logger.debug(`I18n discovery: appRoot=${r}, repoRoot=${s}`);let n=await this._getPatterns();this.logger.debug(`I18n patterns - eager: ${n.eager.length}, lazy: ${n.lazy.length}, framework eager: ${n.framework?.eager?.length||0}, framework lazy: ${n.framework?.lazy?.length||0}`),this.logger.debug(`isMonorepo: ${this.pathResolver.isMonorepo()}, repoRoot: ${this.pathResolver.getRepoRoot()}`);let i=Mt("i18n"),o=n.eager||[],a=n.lazy||[],c=n.framework?.eager||[],u=n.framework?.lazy||[];this.logger.debug(`Resolved patterns - eager: ${o.join(", ")}, lazy: ${a.join(", ")}, framework eager: ${c.join(", ")}, framework lazy: ${u.join(", ")}`),c.length===0&&u.length===0&&this.logger.error(`\u26A0\uFE0F Framework i18n patterns are EMPTY! isMonorepo=${this.pathResolver.isMonorepo()}, repoRoot=${this.pathResolver.getRepoRoot()}`);let f=this.pathResolver.normalizePath(r),b=this.pathResolver.normalizePath(s),m=(H,J)=>{let K=this.pathResolver.normalizePath(H),le=this.pathResolver.normalizePath(J);return K.startsWith(le)?K.slice(le.length+1):K},T=o.map(H=>m(H,r)),U=a.map(H=>m(H,r)),V=c.map(H=>m(H,s)),re=u.map(H=>m(H,s)),Y={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:r},L=await this.pathResolver._globWithNormalization(T,Y),G=await this.pathResolver._globWithNormalization(U,Y),X={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:i.ignore?.filter(H=>H!=="**/node_modules/**")||[]};this.logger.debug(`\u{1F50D} Searching framework patterns with cwd: ${s}, ignore: ${JSON.stringify(X.ignore)}`);let O=await this.pathResolver._globWithNormalization(V,X),F=await this.pathResolver._globWithNormalization(re,X);this.logger.debug(`Found ${L.length} eager, ${G.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: ${c.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: ${u.join(", ")}`);let z=[...new Set([...L,...G,...O,...F])],se=new Set([...L,...O]),M={mapping:{},content:{},eagerNamespaces:new Set,allNamespaces:new Set,supportedLanguages:new Set,files:[]},j=new Map,pe=[...O,...F];for(let H of pe){let J=this._processTranslationFile(H,O.includes(H),r);if(J){let K=`${J.namespace}_${J.language}`;j.set(K,J),M.allNamespaces.add(J.namespace),M.supportedLanguages.add(J.language),O.includes(H)&&M.eagerNamespaces.add(J.namespace)}}let me=new Set;for(let H of z){if(pe.includes(H))continue;let J=this._processTranslationFile(H,se.has(H),r);if(J){let{namespace:K,language:le,importPath:Xe,content:Ke}=J,Ye=`${J.namespace}_${J.language}`;if(j.has(Ye)){let de=j.get(Ye);J.content=this._mergeTranslations(de.content,Ke)}M.allNamespaces.add(K),M.supportedLanguages.add(le),me.add(le),se.has(H)&&M.eagerNamespaces.add(K),M.mapping[K]||(M.mapping[K]={}),M.mapping[K][le]=Xe,J.content&&(M.content[K]||(M.content[K]={}),M.content[K][le]=J.content),M.files.push({path:H,relativePath:this.pathResolver.getRelativePath(H),namespace:K,language:le,eager:se.has(H),size:J.content?JSON.stringify(J.content).length:0})}}for(let[H,J]of j){let[K,le]=H.split("_");(!M.mapping[K]||!M.mapping[K][le])&&(M.mapping[K]||(M.mapping[K]={}),M.mapping[K][le]=J.importPath,M.content[K]||(M.content[K]={}),M.content[K][le]=J.content)}let dt=me.size>0?[...me].sort():[this.options.fallbackLanguage];return{mapping:M.mapping,content:M.content,eagerNamespaces:[...M.eagerNamespaces].sort(),allNamespaces:[...M.allNamespaces].sort(),supportedLanguages:dt,fallbackLanguage:this.options.fallbackLanguage,files:M.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(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=Date.now();try{let s=await this._processFiles([]);this.cache={...s,timestamp:Date.now()};let n=Date.now()-r;return this.logger.debug(`Discovery completed in ${n}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){throw this.logger.error(`I18n discovery failed: ${s.message}`),s}}async discoverTranslations(t=!1){return await this.discover(t)}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(t,r,s){let n=t.split("/").pop()||t.split("\\").pop()||"",i,o,a=n.match(/^([^_]+)_([^.]+)\.json$/);if(!a)return this.logger.debug(`Invalid translation file name format: ${n}`),null;if([,i,o]=a,!i||!o)return this.logger.debug(`Invalid namespace or language in file: ${n}`),null;let u="./"+this.pathResolver.getRelativePath(t).replace(/\\/g,"/"),f;try{if(f=this.pathResolver.readSync(t,{format:"json"}),!f)return this.logger.debug(`Could not read file: ${t}`),null}catch(b){return this.logger.debug(`Error parsing JSON from ${t}: ${b.message}`),null}return{namespace:i,language:o,importPath:u,content:f}}_mergeTranslations(t,r){let s={...t};for(let[n,i]of Object.entries(r))typeof i=="object"&&i!==null&&!Array.isArray(i)?s[n]=this._mergeTranslations(s[n]||{},i):s[n]=i;return s}};var nf={isEmpty:e=>!e.mapping||Object.keys(e.mapping).length===0,generateModule:(e,t,r="i18n")=>{let{mapping:s,eagerNamespaces:n,supportedLanguages:i,fallbackLanguage:o,stats:a,content:c={}}=e,u={mapping:s,languages:i,eager:n,fallback:o,content:c,storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:a?.totalFiles||0,totalNamespaces:a?.totalNamespaces||0,totalLanguages:a?.totalLanguages||0,eagerNamespaces:a?.eagerNamespaces||0,generatedAt:new Date().toISOString()},debug:t};return`// ${ee.i18n} - Generated by @donotdev/config
312
+ `)},generateManifest:e=>({totalVars:Object.keys(e?.env||{}).length,mode:e?.mode||"development",variables:Object.keys(e?.env||{}),timestamp:Date.now()}),logStats:(e,t,r)=>{let s=Object.keys(e.env).length;r&&r.info(`${t} Env: ${s} VITE_* variables`)}},Xr=class{constructor(t,r={}){this.pathResolver=t,this.options=r,this.mode=r.mode||"development",this.appRoot=null}async discoverEnv(){try{let t=this.pathResolver.getAppRoot();if(!t)throw new Error("App root not available in EnvDiscovery");let s={...nf(this.mode,t,"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:`${t}/.env`,errors:[]}}catch(t){return{env:{},mode:this.mode,source:"error",errors:[t.message]}}}};function zi(e={}){return Fe({pluginName:"dndev-vite-env-discovery",icon:"\u{1F510}",virtualModuleId:ee.env,discoveryMethod:"discoverEnv",filePatterns:[],templates:Mi,defaultInspectionPath:ue.vite.envInspection,manifestFileName:ue.manifests.env,configKey:"env",createDiscovery:(t,r)=>new Xr(t,{...r,mode:e.mode||r.mode||"development"})})({...e,disableHmr:!0})}g();ge();g();ge();var or=class extends _e{constructor(t,r={}){super(t,{fallbackLanguage:"en",...r})}_getDiscoveryType(){return"I18n"}async _getPatterns(){return await this.pathResolver.resolvePatterns("i18n")}_getPatternType(){return"i18n"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=this.pathResolver.getRepoRoot();if(!r||r===s)throw this.logger.error(`I18n discovery: appRoot not properly set (appRoot: ${r}, repoRoot: ${s})`),new Error("App root not set before i18n discovery. Ensure configResolved hook has run.");this.logger.debug(`I18n discovery: appRoot=${r}, repoRoot=${s}`);let n=await this._getPatterns();this.logger.debug(`I18n patterns - eager: ${n.eager.length}, lazy: ${n.lazy.length}, framework eager: ${n.framework?.eager?.length||0}, framework lazy: ${n.framework?.lazy?.length||0}`),this.logger.debug(`isMonorepo: ${this.pathResolver.isMonorepo()}, repoRoot: ${this.pathResolver.getRepoRoot()}`);let i=Mt("i18n"),o=n.eager||[],a=n.lazy||[],c=n.framework?.eager||[],u=n.framework?.lazy||[];this.logger.debug(`Resolved patterns - eager: ${o.join(", ")}, lazy: ${a.join(", ")}, framework eager: ${c.join(", ")}, framework lazy: ${u.join(", ")}`),c.length===0&&u.length===0&&this.logger.error(`\u26A0\uFE0F Framework i18n patterns are EMPTY! isMonorepo=${this.pathResolver.isMonorepo()}, repoRoot=${this.pathResolver.getRepoRoot()}`);let f=this.pathResolver.normalizePath(r),b=this.pathResolver.normalizePath(s),m=(H,J)=>{let K=this.pathResolver.normalizePath(H),le=this.pathResolver.normalizePath(J);return K.startsWith(le)?K.slice(le.length+1):K},T=o.map(H=>m(H,r)),U=a.map(H=>m(H,r)),V=c.map(H=>m(H,s)),re=u.map(H=>m(H,s)),Y={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:r},L=await this.pathResolver._globWithNormalization(T,Y),G=await this.pathResolver._globWithNormalization(U,Y),X={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:i.ignore?.filter(H=>H!=="**/node_modules/**")||[]};this.logger.debug(`\u{1F50D} Searching framework patterns with cwd: ${s}, ignore: ${JSON.stringify(X.ignore)}`);let O=await this.pathResolver._globWithNormalization(V,X),F=await this.pathResolver._globWithNormalization(re,X);this.logger.debug(`Found ${L.length} eager, ${G.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: ${c.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: ${u.join(", ")}`);let z=[...new Set([...L,...G,...O,...F])],se=new Set([...L,...O]),M={mapping:{},content:{},eagerNamespaces:new Set,allNamespaces:new Set,supportedLanguages:new Set,files:[]},j=new Map,pe=[...O,...F];for(let H of pe){let J=this._processTranslationFile(H,O.includes(H),r);if(J){let K=`${J.namespace}_${J.language}`;j.set(K,J),M.allNamespaces.add(J.namespace),M.supportedLanguages.add(J.language),O.includes(H)&&M.eagerNamespaces.add(J.namespace)}}let me=new Set;for(let H of z){if(pe.includes(H))continue;let J=this._processTranslationFile(H,se.has(H),r);if(J){let{namespace:K,language:le,importPath:Xe,content:Ke}=J,Ye=`${J.namespace}_${J.language}`;if(j.has(Ye)){let de=j.get(Ye);J.content=this._mergeTranslations(de.content,Ke)}M.allNamespaces.add(K),M.supportedLanguages.add(le),me.add(le),se.has(H)&&M.eagerNamespaces.add(K),M.mapping[K]||(M.mapping[K]={}),M.mapping[K][le]=Xe,J.content&&(M.content[K]||(M.content[K]={}),M.content[K][le]=J.content),M.files.push({path:H,relativePath:this.pathResolver.getRelativePath(H),namespace:K,language:le,eager:se.has(H),size:J.content?JSON.stringify(J.content).length:0})}}for(let[H,J]of j){let[K,le]=H.split("_");(!M.mapping[K]||!M.mapping[K][le])&&(M.mapping[K]||(M.mapping[K]={}),M.mapping[K][le]=J.importPath,M.content[K]||(M.content[K]={}),M.content[K][le]=J.content)}let dt=me.size>0?[...me].sort():[this.options.fallbackLanguage];return{mapping:M.mapping,content:M.content,eagerNamespaces:[...M.eagerNamespaces].sort(),allNamespaces:[...M.allNamespaces].sort(),supportedLanguages:dt,fallbackLanguage:this.options.fallbackLanguage,files:M.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(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=Date.now();try{let s=await this._processFiles([]);this.cache={...s,timestamp:Date.now()};let n=Date.now()-r;return this.logger.debug(`Discovery completed in ${n}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){throw this.logger.error(`I18n discovery failed: ${s.message}`),s}}async discoverTranslations(t=!1){return await this.discover(t)}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(t,r,s){let n=t.split("/").pop()||t.split("\\").pop()||"",i,o,a=n.match(/^([^_]+)_([^.]+)\.json$/);if(!a)return this.logger.debug(`Invalid translation file name format: ${n}`),null;if([,i,o]=a,!i||!o)return this.logger.debug(`Invalid namespace or language in file: ${n}`),null;let u="./"+this.pathResolver.getRelativePath(t).replace(/\\/g,"/"),f;try{if(f=this.pathResolver.readSync(t,{format:"json"}),!f)return this.logger.debug(`Could not read file: ${t}`),null}catch(b){return this.logger.debug(`Error parsing JSON from ${t}: ${b.message}`),null}return{namespace:i,language:o,importPath:u,content:f}}_mergeTranslations(t,r){let s={...t};for(let[n,i]of Object.entries(r))typeof i=="object"&&i!==null&&!Array.isArray(i)?s[n]=this._mergeTranslations(s[n]||{},i):s[n]=i;return s}};var of={isEmpty:e=>!e.mapping||Object.keys(e.mapping).length===0,generateModule:(e,t,r="i18n")=>{let{mapping:s,eagerNamespaces:n,supportedLanguages:i,fallbackLanguage:o,stats:a,content:c={}}=e,u={mapping:s,languages:i,eager:n,fallback:o,content:c,storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:a?.totalFiles||0,totalNamespaces:a?.totalNamespaces||0,totalLanguages:a?.totalLanguages||0,eagerNamespaces:a?.eagerNamespaces||0,generatedAt:new Date().toISOString()},debug:t};return`// ${ee.i18n} - Generated by @donotdev/config
313
313
  // \u{1F680} STATIC INJECTION PATTERN - Zero Runtime Loading
314
314
  // Generated at: ${new Date().toISOString()}
315
315
 
@@ -567,7 +567,7 @@ export default {
567
567
  files: translationFiles,
568
568
  manifest: i18nManifest,
569
569
  };
570
- `},generateManifest:e=>({namespaces:e.stats?.totalNamespaces||0,languages:e.stats?.totalLanguages||0,fallbackLanguage:e.fallbackLanguage,eagerNamespaces:e.stats?.eagerNamespaces||0,platform:"vite",timestamp:Date.now()}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.supportedLanguages||[],n=Object.keys(e.mapping||{}).filter(i=>i!=="default").length||0;r&&r.info(`${t} I18n: ${s.length} languages, ${n} namespaces`)}},of=[e=>e.endsWith(".json")&&e.includes("locale"),e=>/[a-z]+_[a-z]{2}\.json$/i.test(e),e=>e.includes("/locales/")&&e.endsWith(".json")];function zi(e={}){return Fe({pluginName:"dndev-vite-i18n-discovery",icon:"\u{1F310}",virtualModuleId:ee.i18n,DiscoveryClass:or,discoveryMethod:"discoverTranslations",filePatterns:of,templates:nf,defaultInspectionPath:ue.vite.i18nInspection,manifestFileName:ue.manifests.i18n,configKey:"i18n",discoveryOptions:{fallbackLanguage:e.fallbackLanguage||"en",...e}})({...e,hmrSmartDetection:!1})}g();ge();function Bi(e={}){let t=[],r="";return{name:"dndev-optional-dep-resolver",enforce:"pre",configResolved(){let s=ne.getInstance(),n=s.getAppRoot(),i=at.optionalFeatures||[];for(let o of i)s.resolvePackage(o,n)||t.push(o);r=s.getEmptyModulePath(),e.debug&&t.length>0},resolveId(s){return t.includes(s)?r:null}}}g();g();function Xr(e){return!e||typeof e!="string"?null:e.startsWith("@")?e.split("/").slice(0,2).join("/"):e.split("/")[0]}function af(e){return!e||typeof e!="string"?!1:!e.startsWith(".")&&!e.startsWith("/")&&!e.startsWith("\\")&&!e.startsWith("\0")}function lf(e,t){if(!e||!t||!t.getRepoRoot())return!1;let s=e;e.startsWith("@fs/")&&(s=e.slice(4));let n=t.resolveRepoPath("packages"),i=t.normalizePath(s);return n&&i.startsWith(n)}function cf(e,t){if(!e||!t)return null;let r=Xr(e);if(!r)return null;let s=t.resolveAppPath(`node_modules/${r}`);return t.pathExists(s)?t.resolveAppPath(`node_modules/${e}`):null}function Ui(e,t,r){return!af(e)||!lf(t,r)?null:cf(e,r)}function Gi(e={}){let{debug:t=!1,verbose:r=!0}=e,s=Z("peer-dependency-resolver",t,r);return{name:"dndev-peer-dependency-resolver",enforce:"pre",configResolved(n){let i=ne.getInstance(),o=i.getAppRoot();if(!o){s.warn("App root not set, peer dependency resolution may fail");return}this.pathResolver=i,this.appRoot=o},resolveId(n,i){if(!i||!this.appRoot||!this.pathResolver)return null;if(Ui(n,i,this.pathResolver)){let a=Xr(n),c=this.pathResolver.resolveAppPath(`node_modules/${n}`),u=this.pathResolver.resolveAppPath(`node_modules/${a}`);return this.pathResolver.pathExists(u)?n===a?((t||r)&&s.debug(`[PeerDeps] Resolving bare import "${n}" from app's node_modules: ${u}`),u):((t||r)&&s.debug(`[PeerDeps] Resolving subpath "${n}" from app's node_modules: ${c}`),c):(t&&s.debug(`[PeerDeps] Package directory not found: ${u}, skipping resolution`),null)}return null}}}g();import{VitePWA as uf}from"vite-plugin-pwa";ge();g();var ar=class extends _e{constructor(t,r={}){super(t,{...r})}_getDiscoveryType(){return"PWA"}async _getPatterns(){return await this.pathResolver.resolvePatterns("pwa")}_getPatternType(){return"pwa"}async _processFiles(t){let{frameworkFiles:r,consumerFiles:s}=t,n=[...r,...s];this.logger.debug(`Processing ${n.length} PWA files`);let i=[];this.options.assetData?.pwaIcons&&(this.logger.debug(`Using ${this.options.assetData.pwaIcons.length} icons from AssetDiscovery`),i=[...this.options.assetData.pwaIcons]);let o=await this._analyzePWAFiles(n),a=o.filter(m=>m.type==="manifest"||m.type==="service-worker");i.push(...a);let c=o.filter(m=>m.type==="icon"),u=new Set(i.filter(m=>m.type==="icon").map(m=>m.path)),f=c.filter(m=>!u.has(m.path));i.push(...f);let b=this._generatePWAManifest(i);return{assets:i,manifest:b,totalFiles:n.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(t){let r=[];for(let s of t){let n=typeof s=="string"?{absolutePath:s,relativePath:this.pathResolver.getRelativePath(s),fileName:s.split("/").pop()||"",extension:(s.split(".").pop()||"").toLowerCase()}:s,i=await this._analyzePWAAsset(n);i&&r.push(i)}return r}async _analyzePWAAsset(t){let r=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!r)return null;let s=t.relativePath,n=t.fileName;return n.includes("manifest.json")?this._parseManifestFile(r,s):n.includes("service-worker")||n.includes("sw.")?this._parseServiceWorkerFile(r,s):this._isPWAIcon(n)?this._parseIconFile(t,s):null}_parseManifestFile(t,r){try{let s=typeof t=="string"?JSON.parse(t):t;return{type:"manifest",path:r,content:s,size:typeof t=="string"?t.length:JSON.stringify(s).length}}catch(s){return this.logger.debug(`Failed to parse manifest: ${s.message}`),null}}_parseServiceWorkerFile(t,r){return{type:"service-worker",path:r,size:t.length,hasWorkbox:t.includes("workbox")}}_parseIconFile(t,r){let s=t.fileName,n=this._extractIconSize(s);return{type:"icon",path:r,size:n,format:t.extension,purpose:this._getIconPurpose(s)}}_isPWAIcon(t){return["icon","logo","apple-touch-icon","android-chrome","favicon"].some(s=>t.includes(s))}_extractIconSize(t){let r=t.match(/(\d+)x(\d+)/);return r?{width:parseInt(r[1]),height:parseInt(r[2])}:t.includes("favicon")?{width:32,height:32}:t.includes("apple-touch-icon")?{width:180,height:180}:t.includes("icon-192")?{width:192,height:192}:t.includes("icon-512")?{width:512,height:512}:{width:192,height:192}}_getIconPurpose(t){return t.includes("maskable")?"maskable":t.includes("apple-touch")?"apple-touch":t.includes("android-chrome")?"android":"any"}_generatePWAManifest(t){let r=t.filter(i=>i.type==="icon"),n=t.find(i=>i.type==="manifest")?.content||this._getDefaultManifest();return r.length>0&&(n.icons=r.map(i=>({src:`/${i.path}`,sizes:`${i.size.width}x${i.size.height}`,type:`image/${i.format}`,purpose:i.purpose}))),n}_getDefaultManifest(){let t=this.options?.app||{};return{name:t.name,short_name:t.shortName,description:t.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:[]}}generateManifestContent(t){let r=t.manifest||this._getDefaultManifest();return JSON.stringify(r,null,2)}generateServiceWorkerContent(t,r={}){let s=this._getWorkboxDefaults(r),n=r.backgroundSync!==!1&&r.backgroundSync,i=r.precacheManifest||[],o=JSON.stringify(i,null,2);return`// Generated by @donotdev/config - PWA Service Worker with Workbox
570
+ `},generateManifest:e=>({namespaces:e.stats?.totalNamespaces||0,languages:e.stats?.totalLanguages||0,fallbackLanguage:e.fallbackLanguage,eagerNamespaces:e.stats?.eagerNamespaces||0,platform:"vite",timestamp:Date.now()}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.supportedLanguages||[],n=Object.keys(e.mapping||{}).filter(i=>i!=="default").length||0;r&&r.info(`${t} I18n: ${s.length} languages, ${n} namespaces`)}},af=[e=>e.endsWith(".json")&&e.includes("locale"),e=>/[a-z]+_[a-z]{2}\.json$/i.test(e),e=>e.includes("/locales/")&&e.endsWith(".json")];function Bi(e={}){return Fe({pluginName:"dndev-vite-i18n-discovery",icon:"\u{1F310}",virtualModuleId:ee.i18n,DiscoveryClass:or,discoveryMethod:"discoverTranslations",filePatterns:af,templates:of,defaultInspectionPath:ue.vite.i18nInspection,manifestFileName:ue.manifests.i18n,configKey:"i18n",discoveryOptions:{fallbackLanguage:e.fallbackLanguage||"en",...e}})({...e,hmrSmartDetection:!1})}g();ge();function Ui(e={}){let t=[],r="";return{name:"dndev-optional-dep-resolver",enforce:"pre",configResolved(){let s=ne.getInstance(),n=s.getAppRoot(),i=at.optionalFeatures||[];for(let o of i)s.resolvePackage(o,n)||t.push(o);r=s.getEmptyModulePath(),e.debug&&t.length>0},resolveId(s){return t.includes(s)?r:null}}}g();g();function Kr(e){return!e||typeof e!="string"?null:e.startsWith("@")?e.split("/").slice(0,2).join("/"):e.split("/")[0]}function lf(e){return!e||typeof e!="string"?!1:!e.startsWith(".")&&!e.startsWith("/")&&!e.startsWith("\\")&&!e.startsWith("\0")}function cf(e,t){if(!e||!t||!t.getRepoRoot())return!1;let s=e;e.startsWith("@fs/")&&(s=e.slice(4));let n=t.resolveRepoPath("packages"),i=t.normalizePath(s);return n&&i.startsWith(n)}function uf(e,t){if(!e||!t)return null;let r=Kr(e);if(!r)return null;let s=t.resolveAppPath(`node_modules/${r}`);return t.pathExists(s)?t.resolveAppPath(`node_modules/${e}`):null}function Gi(e,t,r){return!lf(e)||!cf(t,r)?null:uf(e,r)}function qi(e={}){let{debug:t=!1,verbose:r=!0}=e,s=Q("peer-dependency-resolver",t,r);return{name:"dndev-peer-dependency-resolver",enforce:"pre",configResolved(n){let i=ne.getInstance(),o=i.getAppRoot();if(!o){s.warn("App root not set, peer dependency resolution may fail");return}this.pathResolver=i,this.appRoot=o},resolveId(n,i){if(!i||!this.appRoot||!this.pathResolver)return null;if(Gi(n,i,this.pathResolver)){let a=Kr(n),c=this.pathResolver.resolveAppPath(`node_modules/${n}`),u=this.pathResolver.resolveAppPath(`node_modules/${a}`);return this.pathResolver.pathExists(u)?n===a?((t||r)&&s.debug(`[PeerDeps] Resolving bare import "${n}" from app's node_modules: ${u}`),u):((t||r)&&s.debug(`[PeerDeps] Resolving subpath "${n}" from app's node_modules: ${c}`),c):(t&&s.debug(`[PeerDeps] Package directory not found: ${u}, skipping resolution`),null)}return null}}}g();import{VitePWA as ff}from"vite-plugin-pwa";ge();g();var ar=class extends _e{constructor(t,r={}){super(t,{...r})}_getDiscoveryType(){return"PWA"}async _getPatterns(){return await this.pathResolver.resolvePatterns("pwa")}_getPatternType(){return"pwa"}async _processFiles(t){let{frameworkFiles:r,consumerFiles:s}=t,n=[...r,...s];this.logger.debug(`Processing ${n.length} PWA files`);let i=[];this.options.assetData?.pwaIcons&&(this.logger.debug(`Using ${this.options.assetData.pwaIcons.length} icons from AssetDiscovery`),i=[...this.options.assetData.pwaIcons]);let o=await this._analyzePWAFiles(n),a=o.filter(m=>m.type==="manifest"||m.type==="service-worker");i.push(...a);let c=o.filter(m=>m.type==="icon"),u=new Set(i.filter(m=>m.type==="icon").map(m=>m.path)),f=c.filter(m=>!u.has(m.path));i.push(...f);let b=this._generatePWAManifest(i);return{assets:i,manifest:b,totalFiles:n.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(t){let r=[];for(let s of t){let n=typeof s=="string"?{absolutePath:s,relativePath:this.pathResolver.getRelativePath(s),fileName:s.split("/").pop()||"",extension:(s.split(".").pop()||"").toLowerCase()}:s,i=await this._analyzePWAAsset(n);i&&r.push(i)}return r}async _analyzePWAAsset(t){let r=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!r)return null;let s=t.relativePath,n=t.fileName;return n.includes("manifest.json")?this._parseManifestFile(r,s):n.includes("service-worker")||n.includes("sw.")?this._parseServiceWorkerFile(r,s):this._isPWAIcon(n)?this._parseIconFile(t,s):null}_parseManifestFile(t,r){try{let s=typeof t=="string"?JSON.parse(t):t;return{type:"manifest",path:r,content:s,size:typeof t=="string"?t.length:JSON.stringify(s).length}}catch(s){return this.logger.debug(`Failed to parse manifest: ${s.message}`),null}}_parseServiceWorkerFile(t,r){return{type:"service-worker",path:r,size:t.length,hasWorkbox:t.includes("workbox")}}_parseIconFile(t,r){let s=t.fileName,n=this._extractIconSize(s);return{type:"icon",path:r,size:n,format:t.extension,purpose:this._getIconPurpose(s)}}_isPWAIcon(t){return["icon","logo","apple-touch-icon","android-chrome","favicon"].some(s=>t.includes(s))}_extractIconSize(t){let r=t.match(/(\d+)x(\d+)/);return r?{width:parseInt(r[1]),height:parseInt(r[2])}:t.includes("favicon")?{width:32,height:32}:t.includes("apple-touch-icon")?{width:180,height:180}:t.includes("icon-192")?{width:192,height:192}:t.includes("icon-512")?{width:512,height:512}:{width:192,height:192}}_getIconPurpose(t){return t.includes("maskable")?"maskable":t.includes("apple-touch")?"apple-touch":t.includes("android-chrome")?"android":"any"}_generatePWAManifest(t){let r=t.filter(i=>i.type==="icon"),n=t.find(i=>i.type==="manifest")?.content||this._getDefaultManifest();return r.length>0&&(n.icons=r.map(i=>({src:`/${i.path}`,sizes:`${i.size.width}x${i.size.height}`,type:`image/${i.format}`,purpose:i.purpose}))),n}_getDefaultManifest(){let t=this.options?.app||{};return{name:t.name,short_name:t.shortName,description:t.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:[]}}generateManifestContent(t){let r=t.manifest||this._getDefaultManifest();return JSON.stringify(r,null,2)}generateServiceWorkerContent(t,r={}){let s=this._getWorkboxDefaults(r),n=r.backgroundSync!==!1&&r.backgroundSync,i=r.precacheManifest||[],o=JSON.stringify(i,null,2);return`// Generated by @donotdev/config - PWA Service Worker with Workbox
571
571
  // Generated at ${new Date().toISOString()}
572
572
 
573
573
  importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-sw.js');
@@ -635,7 +635,7 @@ registerRoute(
635
635
  }),
636
636
  'POST'
637
637
  );
638
- `}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(t=".next"){let r=this.pathResolver.resolveAppPath(`${t}/static`),s=this.pathResolver.resolveAppPath(`${t}/static/chunks`),n=this.pathResolver.resolveAppPath(`${t}/static/css`),i=[];try{let o=[`${r}/**/*.{js,css,woff2,woff,ttf,eot}`,`${s}/**/*.{js,css}`,`${n}/**/*.css`];for(let a of o){let c=await this.pathResolver.findFiles(this.pathResolver.getAppRoot(),a.replace(this.pathResolver.getAppRoot(),""),{onlyFiles:!0});for(let u of c){let f=this.pathResolver.getRelativePath(u);if(f.startsWith(`${t}/static/`)){let b=`/_next/${f.replace(`${t}/static/`,"")}`;i.push({url:b,revision:null})}}}}catch(o){this.logger?.warn(`Failed to discover Next.js build assets: ${o.message}`)}return i}generatePrecacheManifest(t=[],r=null){let s=t;return r&&typeof r=="function"&&(s=r(s)),s}async discoverPWAAssets(t=!1){return await this.discover(t)}getPWAAssets(){return this.cache?.assets||[]}getPWAManifest(){return this.cache?.manifest||this._getDefaultManifest()}};function qi(e={}){if(!e.enabled)return null;let t=e.app||{},r=[];if(t.name||r.push("name"),t.shortName||r.push("shortName"),t.description||r.push("description"),r.length>0){let f=Z("PWA",e.debug,!0);f.warn(`\u26A0\uFE0F PWA is enabled but appConfig.app is missing required fields: ${r.join(", ")}`),f.warn(" Add these to your src/config/app.ts:"),f.warn(" export const appConfig: AppConfig = {"),f.warn(" app: {"),t.name||f.warn(' name: "Your App Name",'),t.shortName||f.warn(' shortName: "App",'),t.description||f.warn(' description: "Your app description",'),f.warn(" },"),f.warn(" // ... rest of config"),f.warn(" };"),f.warn("")}let s=ne.getInstance(),n=Vr.data;if(!n)try{let f=s.resolveAppPath(ue.vite.assetInspection);s.pathExists(f)}catch{}let i=new ar(s,{...e,assetData:n}),o=e.devEnabled===!0,a={registerType:"prompt",includeAssets:["favicon.ico","favicon.svg","apple-touch-icon.png"],manifest:async()=>{let f=e.app||{},m=(await i.discoverPWAAssets()).assets.filter(T=>T.type==="icon").map(T=>({src:`/${T.path}`,sizes:`${T.size.width}x${T.size.height}`,type:`image/${T.format}`,purpose:T.purpose}));return{name:f.name,short_name:f.shortName,description:f.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:m.length>0?m:[]}},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:f})=>f.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:[f=>{let b=f.find(m=>m.url==="/index.html"||m.url==="index.html");return b&&!f.find(m=>m.url==="/")&&f.push({url:"/",revision:b.revision}),{manifest:f,warnings:[]}}]},devOptions:{enabled:o,type:"module"}},u={...a,manifest:async()=>{let f=await a.manifest();if(e.manifest){if(typeof e.manifest=="function"){let b=await e.manifest();return{...f,...b}}return{...f,...e.manifest}}return f},workbox:{...a.workbox,...e.workbox||{},runtimeCaching:[...a.workbox.runtimeCaching,...e.workbox?.runtimeCaching||[]],manifestTransforms:[...a.workbox.manifestTransforms||[],...e.workbox?.manifestTransforms||[]]}};return uf(u)}g();ge();g();ge();g();function Wi(e,t="unknown"){try{let r=/export\s+const\s+meta\s*[^=]*=\s*(\{[\s\S]*?\});/,s=e.match(r);if(!s)return null;let n=s[1];n=n.replace(/icon:\s*<(\w+)[\s\/][^>]*\/?>/g,(c,u)=>`icon: '${u}'`);let i=/(?:export\s+)?const\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g;return[...e.matchAll(i)].forEach(c=>{let u=c[1],f=c[2];n=n.replace(new RegExp(`\\b${u}\\b`,"g"),`'${f}'`)}),Function(`return ${n}`)()}catch{return null}}var Ft=null,Hi=null;function ff(e){let r=(e.split("/").pop()?.replace(/\.tsx?$/,"")||"Component").replace(/[^a-zA-Z0-9]/g,"");return r.charAt(0).toUpperCase()+r.slice(1)}var lr=class extends _e{constructor(t,r={}){super(t,{additionalPatterns:[],...r}),this.routes=[],this.errors=[],this.source="auto-discovery"}_getDiscoveryType(){return"Route"}async _getPatterns(){return await this.pathResolver.resolvePatterns("routes")}_getPatternType(){return"routes"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=p.env.DNDEV_BUILD_ID;if(Ft&&Hi===s)return this.logger.debug("Using cached route discovery results"),this.routes=Ft.routes,this.errors=Ft.errors,this.source=Ft.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: ${r}`),this.options.verbose||this.options.debug){let n=t?.consumerFiles?.length||0;if(this.logger.info(`\u{1F50D} Route discovery: Scanning ${n} files in ${r}`),this.options.debug){let i=await this._getPatterns();this.logger.debug(`Patterns: ${JSON.stringify(i)}`)}}return await this._performAutoDiscovery(t,r),(this.options.verbose||this.options.debug)&&(this.logger.info(`\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/")),Ft={routes:this.routes,errors:this.errors,source:this.source},Hi=p.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(t=!1){return await this.discover(t)}getRoutes(){return this.cache?.routes||[]}async _performAutoDiscovery(t,r){let{consumerFiles:s}=t,n=await this._batchProcessFiles(s,u=>this._analyzePageFile(u,r)),i=await this._scanAdditionalPatterns(r),o=await this._batchProcessFiles(i,u=>this._analyzePageFile(u,r)),a=[...n,...o];this.logger.debug(`Auto-discovering from ${s.length} app + ${i.length} additional files`),this.routes=a.filter(u=>u.path==="home"||u.path==="/home"?(this.logger.debug(`Filtered reserved route: ${u.path} - Use root "/" instead (${u.file})`),!1):!0);let c=new Map;for(let u of this.routes){let f=u.path;if(c.has(f)){let b=c.get(f);throw new Error(`Route conflict: Multiple routes found for path '${f}'. Routes: ${b.file} and ${u.file}. Use PageMeta route override to specify unique paths. Example: export const meta: PageMeta = { route: '/custom-path' };`)}c.set(f,u)}this.logger.debug(`Auto-discovered ${this.routes.length} routes from ${s.length+i.length} files`)}async _scanAdditionalPatterns(t){let r=this.options.additionalPatterns.map(s=>this.pathResolver.resolveAppPath(s));if(r.length===0)return[];try{let{consumerFiles:s}=await this.pathResolver.resolveFiles({consumer:r,framework:[]},"routes");return s}catch(s){return this.logger.debug(`Error scanning additional patterns: ${s.message}`),[]}}async _analyzePageFile(t,r){let s=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!s)return null;let n=t.relativePath,i="/src/"+n.replace(/\\/g,"/");i=i.replace(/src\/src\//g,"src/").replace(/src\/src\//g,"src/");let o=this._extractMetaExport(s,t.absolutePath),a=ff(i),u=a===dr.HOMEPAGE_COMPONENT?dr.HOMEPAGE_PATH:this._resolveRoutePath(o,n,t.absolutePath),f=this._extractPageMeta(n,s),{entity:b,action:m,...T}=o||{};return{path:u,component:a,importPath:i,auth:o?.auth||!1,meta:{...f,...T,entity:f.entity,action:f.action},metaExport:o,file:n}}_extractMetaExport(t,r){try{let s=Wi(t,r);return s?(this.logger.debug(`Extracted meta export from ${r}: ${JSON.stringify(s)}`),s):null}catch(s){return this.logger.debug(`Error parsing meta export from ${r}: ${s.message}`),null}}_generateRoutePath(t){let r=t.replace(/\.tsx$/,"").replace(/Page$/,"").replace(/^src\//,"").replace(/^pages\//,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return(r.endsWith("/index")||r==="index")&&(r=r.replace(/\/index$/,"")||"/"),r==="/"?"/":"/"+r.replace(/\/+/g,"/")}_resolveRoutePath(t,r,s){if(!t?.route)return this._generateRoutePath(r);if(typeof t.route=="string"){let n=t.route.trim();return n==="/"?"/":(n=n.replace(/\/+/g,"/"),n.startsWith("/")||(n="/"+n),n)}if(typeof t.route=="object"&&t.route!==null){let n=this._generateRoutePath(r),i=t.route.params;if(Array.isArray(i)&&i.length>0){let o=i.map(a=>`:${a}`).join("/");return`${n}/${o}`}return n}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(r)}_extractPageMeta(t,r){let s=t.split("/").pop()?.replace(".tsx","")||"",n=s.replace(/Page$/,"");n=n.replace(/([A-Z])/g," $1").trim(),n=n.charAt(0).toUpperCase()+n.slice(1);let i=t.split("/"),o=null,a=null;return i.length>1&&(o=i[i.length-2],s.includes("List")?a="list":s.includes("Form")||s.includes("Create")||s.includes("Edit")?a="form":(s.includes("Detail")||s.includes("View"))&&(a="detail")),{title:n,entity:o,action:a,file:t}}};var hf={isEmpty:e=>!e.routes||e.routes.length===0,generateModule:(e,t,r="routes")=>{let s={totalRoutes:e.routes.length,authRequired:e.routes.filter(i=>i.auth&&i.auth.required).length,publicRoutes:e.routes.filter(i=>!i.auth||i.auth===!1).length,source:e.source,generatedAt:new Date().toISOString(),errors:e.errors.length},n=e.routes.map(i=>` {
638
+ `}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(t=".next"){let r=this.pathResolver.resolveAppPath(`${t}/static`),s=this.pathResolver.resolveAppPath(`${t}/static/chunks`),n=this.pathResolver.resolveAppPath(`${t}/static/css`),i=[];try{let o=[`${r}/**/*.{js,css,woff2,woff,ttf,eot}`,`${s}/**/*.{js,css}`,`${n}/**/*.css`];for(let a of o){let c=await this.pathResolver.findFiles(this.pathResolver.getAppRoot(),a.replace(this.pathResolver.getAppRoot(),""),{onlyFiles:!0});for(let u of c){let f=this.pathResolver.getRelativePath(u);if(f.startsWith(`${t}/static/`)){let b=`/_next/${f.replace(`${t}/static/`,"")}`;i.push({url:b,revision:null})}}}}catch(o){this.logger?.warn(`Failed to discover Next.js build assets: ${o.message}`)}return i}generatePrecacheManifest(t=[],r=null){let s=t;return r&&typeof r=="function"&&(s=r(s)),s}async discoverPWAAssets(t=!1){return await this.discover(t)}getPWAAssets(){return this.cache?.assets||[]}getPWAManifest(){return this.cache?.manifest||this._getDefaultManifest()}};function Wi(e={}){if(!e.enabled)return null;let t=e.app||{},r=[];if(t.name||r.push("name"),t.shortName||r.push("shortName"),t.description||r.push("description"),r.length>0){let f=Q("PWA",e.debug,!0);f.warn(`\u26A0\uFE0F PWA is enabled but appConfig.app is missing required fields: ${r.join(", ")}`),f.warn(" Add these to your src/config/app.ts:"),f.warn(" export const appConfig: AppConfig = {"),f.warn(" app: {"),t.name||f.warn(' name: "Your App Name",'),t.shortName||f.warn(' shortName: "App",'),t.description||f.warn(' description: "Your app description",'),f.warn(" },"),f.warn(" // ... rest of config"),f.warn(" };"),f.warn("")}let s=ne.getInstance(),n=Jr.data;if(!n)try{let f=s.resolveAppPath(ue.vite.assetInspection);s.pathExists(f)}catch{}let i=new ar(s,{...e,assetData:n}),o=e.devEnabled===!0,a={registerType:"prompt",includeAssets:["favicon.ico","favicon.svg","apple-touch-icon.png"],manifest:async()=>{let f=e.app||{},m=(await i.discoverPWAAssets()).assets.filter(T=>T.type==="icon").map(T=>({src:`/${T.path}`,sizes:`${T.size.width}x${T.size.height}`,type:`image/${T.format}`,purpose:T.purpose}));return{name:f.name,short_name:f.shortName,description:f.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:m.length>0?m:[]}},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:f})=>f.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:[f=>{let b=f.find(m=>m.url==="/index.html"||m.url==="index.html");return b&&!f.find(m=>m.url==="/")&&f.push({url:"/",revision:b.revision}),{manifest:f,warnings:[]}}]},devOptions:{enabled:o,type:"module"}},u={...a,manifest:async()=>{let f=await a.manifest();if(e.manifest){if(typeof e.manifest=="function"){let b=await e.manifest();return{...f,...b}}return{...f,...e.manifest}}return f},workbox:{...a.workbox,...e.workbox||{},runtimeCaching:[...a.workbox.runtimeCaching,...e.workbox?.runtimeCaching||[]],manifestTransforms:[...a.workbox.manifestTransforms||[],...e.workbox?.manifestTransforms||[]]}};return ff(u)}g();ge();g();ge();g();function Hi(e,t="unknown"){try{let r=/export\s+const\s+meta\s*[^=]*=\s*(\{[\s\S]*?\});/,s=e.match(r);if(!s)return null;let n=s[1];n=n.replace(/icon:\s*<(\w+)[\s\/][^>]*\/?>/g,(c,u)=>`icon: '${u}'`);let i=/(?:export\s+)?const\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g;return[...e.matchAll(i)].forEach(c=>{let u=c[1],f=c[2];n=n.replace(new RegExp(`\\b${u}\\b`,"g"),`'${f}'`)}),Function(`return ${n}`)()}catch{return null}}var Ft=null,Vi=null;function hf(e){let r=(e.split("/").pop()?.replace(/\.tsx?$/,"")||"Component").replace(/[^a-zA-Z0-9]/g,"");return r.charAt(0).toUpperCase()+r.slice(1)}var lr=class extends _e{constructor(t,r={}){super(t,{additionalPatterns:[],...r}),this.routes=[],this.errors=[],this.source="auto-discovery"}_getDiscoveryType(){return"Route"}async _getPatterns(){return await this.pathResolver.resolvePatterns("routes")}_getPatternType(){return"routes"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=p.env.DNDEV_BUILD_ID;if(Ft&&Vi===s)return this.logger.debug("Using cached route discovery results"),this.routes=Ft.routes,this.errors=Ft.errors,this.source=Ft.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: ${r}`),this.options.verbose||this.options.debug){let n=t?.consumerFiles?.length||0;if(this.logger.info(`\u{1F50D} Route discovery: Scanning ${n} files in ${r}`),this.options.debug){let i=await this._getPatterns();this.logger.debug(`Patterns: ${JSON.stringify(i)}`)}}return await this._performAutoDiscovery(t,r),(this.options.verbose||this.options.debug)&&(this.logger.info(`\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/")),Ft={routes:this.routes,errors:this.errors,source:this.source},Vi=p.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(t=!1){return await this.discover(t)}getRoutes(){return this.cache?.routes||[]}async _performAutoDiscovery(t,r){let{consumerFiles:s}=t,n=await this._batchProcessFiles(s,u=>this._analyzePageFile(u,r)),i=await this._scanAdditionalPatterns(r),o=await this._batchProcessFiles(i,u=>this._analyzePageFile(u,r)),a=[...n,...o];this.logger.debug(`Auto-discovering from ${s.length} app + ${i.length} additional files`),this.routes=a.filter(u=>u.path==="home"||u.path==="/home"?(this.logger.debug(`Filtered reserved route: ${u.path} - Use root "/" instead (${u.file})`),!1):!0);let c=new Map;for(let u of this.routes){let f=u.path;if(c.has(f)){let b=c.get(f);throw new Error(`Route conflict: Multiple routes found for path '${f}'. Routes: ${b.file} and ${u.file}. Use PageMeta route override to specify unique paths. Example: export const meta: PageMeta = { route: '/custom-path' };`)}c.set(f,u)}this.logger.debug(`Auto-discovered ${this.routes.length} routes from ${s.length+i.length} files`)}async _scanAdditionalPatterns(t){let r=this.options.additionalPatterns.map(s=>this.pathResolver.resolveAppPath(s));if(r.length===0)return[];try{let{consumerFiles:s}=await this.pathResolver.resolveFiles({consumer:r,framework:[]},"routes");return s}catch(s){return this.logger.debug(`Error scanning additional patterns: ${s.message}`),[]}}async _analyzePageFile(t,r){let s=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!s)return null;let n=t.relativePath,i="/src/"+n.replace(/\\/g,"/");i=i.replace(/src\/src\//g,"src/").replace(/src\/src\//g,"src/");let o=this._extractMetaExport(s,t.absolutePath),a=hf(i),u=a===dr.HOMEPAGE_COMPONENT?dr.HOMEPAGE_PATH:this._resolveRoutePath(o,n,t.absolutePath),f=this._extractPageMeta(n,s),{entity:b,action:m,...T}=o||{};return{path:u,component:a,importPath:i,auth:o?.auth||!1,meta:{...f,...T,entity:f.entity,action:f.action},metaExport:o,file:n}}_extractMetaExport(t,r){try{let s=Hi(t,r);return s?(this.logger.debug(`Extracted meta export from ${r}: ${JSON.stringify(s)}`),s):null}catch(s){return this.logger.debug(`Error parsing meta export from ${r}: ${s.message}`),null}}_generateRoutePath(t){let r=t.replace(/\.tsx$/,"").replace(/Page$/,"").replace(/^src\//,"").replace(/^pages\//,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return(r.endsWith("/index")||r==="index")&&(r=r.replace(/\/index$/,"")||"/"),r==="/"?"/":"/"+r.replace(/\/+/g,"/")}_resolveRoutePath(t,r,s){if(!t?.route)return this._generateRoutePath(r);if(typeof t.route=="string"){let n=t.route.trim();return n==="/"?"/":(n=n.replace(/\/+/g,"/"),n.startsWith("/")||(n="/"+n),n)}if(typeof t.route=="object"&&t.route!==null){let n=this._generateRoutePath(r),i=t.route.params;if(Array.isArray(i)&&i.length>0){let o=i.map(a=>`:${a}`).join("/");return`${n}/${o}`}return n}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(r)}_extractPageMeta(t,r){let s=t.split("/").pop()?.replace(".tsx","")||"",n=s.replace(/Page$/,"");n=n.replace(/([A-Z])/g," $1").trim(),n=n.charAt(0).toUpperCase()+n.slice(1);let i=t.split("/"),o=null,a=null;return i.length>1&&(o=i[i.length-2],s.includes("List")?a="list":s.includes("Form")||s.includes("Create")||s.includes("Edit")?a="form":(s.includes("Detail")||s.includes("View"))&&(a="detail")),{title:n,entity:o,action:a,file:t}}};var df={isEmpty:e=>!e.routes||e.routes.length===0,generateModule:(e,t,r="routes")=>{let s={totalRoutes:e.routes.length,authRequired:e.routes.filter(i=>i.auth&&i.auth.required).length,publicRoutes:e.routes.filter(i=>!i.auth||i.auth===!1).length,source:e.source,generatedAt:new Date().toISOString(),errors:e.errors.length},n=e.routes.map(i=>` {
639
639
  path: '${i.path}',
640
640
  component: () => import('${i.importPath}'),
641
641
  auth: ${JSON.stringify(i.auth,null,2).replace(/\n/g,`
@@ -762,7 +762,7 @@ export const routeManifest = {
762
762
  };
763
763
 
764
764
  export default discoveredRoutes;
765
- `},generateManifest:e=>({routes:e?.routes?.length||0,source:e?.source||"unknown",timestamp:Date.now(),errors:e?.errors?.length||0}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.routes||[],n=s.filter(o=>o.auth&&o.auth.required).length,i=s.length;r&&r.info(`${t} Routes: ${i} found${n>0?`, ${n} are authguarded`:""}`)}},df=[e=>e.endsWith("Page.tsx")];function Vi(e={}){return Fe({pluginName:"dndev-vite-route-discovery",icon:"\u{1F6E3}\uFE0F",virtualModuleId:ee.routes,DiscoveryClass:lr,discoveryMethod:"discoverRoutes",filePatterns:df,templates:hf,defaultInspectionPath:ue.vite.routeInspection,manifestFileName:ue.manifests.route,configKey:"routes"})({...e,disableHmr:e?.hmr===!1,hmrSmartDetection:!1})}g();import"vite";g();var cr=class{constructor(t={}){let{debug:r=!1,generateRobotsTxt:s=!0,generateSitemap:n=!0,baseUrl:i,siteName:o,crawlDelay:a=1,routes:c={},...u}=t;if(!i||!o)throw new Error("SEOGenerator requires baseUrl and siteName options");this.options={debug:r,generateRobotsTxt:s,generateSitemap:n,baseUrl:i,siteName:o,crawlDelay:a,routes:c,defaultImage:"/og-image.jpg",twitterHandle:"@donotdev",defaultAuthor:"DNDev Team",defaultLanguage:"en",staticTags:{},...u},this.logger=Z("SEO Generator",t.debug,t.verbose)}async generateSEOFiles(t,r,s=null){try{let n=this.generateRouteMetaTags(t.routes||[]),i={routes:t.routes||[],routeMetaTags:n,baseUrl:this.options.baseUrl,siteName:this.options.siteName},o={robotsTxt:null,sitemap:null,manifest:null,totalRoutes:i.routes.length,publicRoutes:i.routes.filter(a=>!a.auth||a.auth===!1).length,protectedRoutes:i.routes.filter(a=>a.auth&&a.auth.required).length};return this.options.generateRobotsTxt&&(o.robotsTxt=await this.generateRobotsTxt(i,r,s)),this.options.generateSitemap&&(o.sitemap=await this.generateSitemap(i,r,s)),o.manifest=await this.generateManifest(i,r,s),o}catch(n){throw this.logger.error(`SEO generator failed to create files (robots.txt/sitemap.xml/manifest): ${n.message}`),this.logger.error(`Stack: ${n.stack||"No stack trace available"}`),n}}async generateRobotsTxt(t,r,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 n=[];(t.routes||[]).forEach(o=>{if(o.auth&&o.auth.required){let a=o.path.startsWith("/")?o.path:`/${o.path}`;n.push(a)}}),n.push("/admin","/api","/_next","/static");let i=this.generateRobotsTxtContent({disallowedPaths:[...new Set(n)],sitemap:`${this.options.baseUrl}/sitemap.xml`,crawlDelay:this.options.crawlDelay});return await r("robots.txt",i),{fileName:"robots.txt",content:i,disallowedPaths:n.length}}async generateSitemap(t,r,s=null){if(s&&await s("sitemap.xml"))return this.logger.info("\u2705 sitemap.xml already exists, skipping generation"),{fileName:"sitemap.xml",skipped:!0};let i=(t.routes||[]).filter(a=>!a.auth||a.auth===!1).map(a=>({url:a.path,lastmod:new Date().toISOString().split("T")[0],changefreq:"weekly",priority:a.path==="/"?"1.0":"0.8"})),o=this.generateSitemapContent(i);return await r("sitemap.xml",o),{fileName:"sitemap.xml",content:o,publicRoutes:i.length}}async generateManifest(t,r,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 n={totalRoutes:t.routes?.length||0,publicRoutes:t.routes?.filter(o=>!o.auth||o.auth===!1).length||0,protectedRoutes:t.routes?.filter(o=>o.auth&&o.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString(),routeMetaTags:t.routeMetaTags||[]},i=JSON.stringify(n,null,2);return await r("seo-manifest.json",i),{fileName:"seo-manifest.json",content:i,manifest:n}}generateRobotsTxtContent(t={}){let{allowedPaths:r=["/"],disallowedPaths:s=["/admin","/api"],sitemap:n,crawlDelay:i}=t,o=c=>c?c==="*"?"*":c.startsWith("/")?c:`/${c}`:"/",a=["User-agent: *",...s.map(c=>`Disallow: ${o(c)}`),...r.map(c=>`Allow: ${o(c)}`)];return i&&a.push(`Crawl-delay: ${i}`),n&&a.push(`Sitemap: ${n}`),a.join(`
765
+ `},generateManifest:e=>({routes:e?.routes?.length||0,source:e?.source||"unknown",timestamp:Date.now(),errors:e?.errors?.length||0}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.routes||[],n=s.filter(o=>o.auth&&o.auth.required).length,i=s.length;r&&r.info(`${t} Routes: ${i} found${n>0?`, ${n} are authguarded`:""}`)}},gf=[e=>e.endsWith("Page.tsx")];function Ji(e={}){return Fe({pluginName:"dndev-vite-route-discovery",icon:"\u{1F6E3}\uFE0F",virtualModuleId:ee.routes,DiscoveryClass:lr,discoveryMethod:"discoverRoutes",filePatterns:gf,templates:df,defaultInspectionPath:ue.vite.routeInspection,manifestFileName:ue.manifests.route,configKey:"routes"})({...e,disableHmr:e?.hmr===!1,hmrSmartDetection:!1})}g();import"vite";g();var cr=class{constructor(t={}){let{debug:r=!1,generateRobotsTxt:s=!0,generateSitemap:n=!0,baseUrl:i,siteName:o,crawlDelay:a=1,routes:c={},...u}=t;if(!i||!o)throw new Error("SEOGenerator requires baseUrl and siteName options");this.options={debug:r,generateRobotsTxt:s,generateSitemap:n,baseUrl:i,siteName:o,crawlDelay:a,routes:c,defaultImage:"/og-image.jpg",twitterHandle:"@donotdev",defaultAuthor:"DNDev Team",defaultLanguage:"en",staticTags:{},...u},this.logger=Q("SEO Generator",t.debug,t.verbose)}async generateSEOFiles(t,r,s=null){try{let n=this.generateRouteMetaTags(t.routes||[]),i={routes:t.routes||[],routeMetaTags:n,baseUrl:this.options.baseUrl,siteName:this.options.siteName},o={robotsTxt:null,sitemap:null,manifest:null,totalRoutes:i.routes.length,publicRoutes:i.routes.filter(a=>!a.auth||a.auth===!1).length,protectedRoutes:i.routes.filter(a=>a.auth&&a.auth.required).length};return this.options.generateRobotsTxt&&(o.robotsTxt=await this.generateRobotsTxt(i,r,s)),this.options.generateSitemap&&(o.sitemap=await this.generateSitemap(i,r,s)),o.manifest=await this.generateManifest(i,r,s),o}catch(n){throw this.logger.error(`SEO generator failed to create files (robots.txt/sitemap.xml/manifest): ${n.message}`),this.logger.error(`Stack: ${n.stack||"No stack trace available"}`),n}}async generateRobotsTxt(t,r,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 n=[];(t.routes||[]).forEach(o=>{if(o.auth&&o.auth.required){let a=o.path.startsWith("/")?o.path:`/${o.path}`;n.push(a)}}),n.push("/admin","/api","/_next","/static");let i=this.generateRobotsTxtContent({disallowedPaths:[...new Set(n)],sitemap:`${this.options.baseUrl}/sitemap.xml`,crawlDelay:this.options.crawlDelay});return await r("robots.txt",i),{fileName:"robots.txt",content:i,disallowedPaths:n.length}}async generateSitemap(t,r,s=null){if(s&&await s("sitemap.xml"))return this.logger.info("\u2705 sitemap.xml already exists, skipping generation"),{fileName:"sitemap.xml",skipped:!0};let i=(t.routes||[]).filter(a=>!a.auth||a.auth===!1).map(a=>({url:a.path,lastmod:new Date().toISOString().split("T")[0],changefreq:"weekly",priority:a.path==="/"?"1.0":"0.8"})),o=this.generateSitemapContent(i);return await r("sitemap.xml",o),{fileName:"sitemap.xml",content:o,publicRoutes:i.length}}async generateManifest(t,r,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 n={totalRoutes:t.routes?.length||0,publicRoutes:t.routes?.filter(o=>!o.auth||o.auth===!1).length||0,protectedRoutes:t.routes?.filter(o=>o.auth&&o.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString(),routeMetaTags:t.routeMetaTags||[]},i=JSON.stringify(n,null,2);return await r("seo-manifest.json",i),{fileName:"seo-manifest.json",content:i,manifest:n}}generateRobotsTxtContent(t={}){let{allowedPaths:r=["/"],disallowedPaths:s=["/admin","/api"],sitemap:n,crawlDelay:i}=t,o=c=>c?c==="*"?"*":c.startsWith("/")?c:`/${c}`:"/",a=["User-agent: *",...s.map(c=>`Disallow: ${o(c)}`),...r.map(c=>`Allow: ${o(c)}`)];return i&&a.push(`Crawl-delay: ${i}`),n&&a.push(`Sitemap: ${n}`),a.join(`
766
766
  `)}generateSitemapContent(t){return`<?xml version="1.0" encoding="UTF-8"?>
767
767
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
768
768
  ${t.map(({url:s,lastmod:n,changefreq:i,priority:o})=>{let a=[` <loc>${this.options.baseUrl}${s}</loc>`];return n&&a.push(` <lastmod>${n}</lastmod>`),i&&a.push(` <changefreq>${i}</changefreq>`),o&&a.push(` <priority>${o}</priority>`),` <url>
@@ -770,7 +770,7 @@ ${a.join(`
770
770
  `)}
771
771
  </url>`}).join(`
772
772
  `)}
773
- </urlset>`}generateRouteMetaTags(t){return t.map(r=>{let s=this.options.siteName;if(r.meta?.title)s=`${r.meta.title} - ${this.options.siteName}`;else if(r.path!=="/"){let i=r.path.split("/").filter(Boolean);i.length>0&&(s=`${i[i.length-1].split("-").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ")} - ${this.options.siteName}`)}let n=`Welcome to ${this.options.siteName}`;if(r.meta?.description)n=r.meta.description;else if(r.meta?.entity&&r.meta?.action)n=`${r.meta.action} ${r.meta.entity} on ${this.options.siteName}`;else if(r.path!=="/"){let i=r.path.split("/").filter(Boolean);i.length>0&&(n=`Explore ${i[i.length-1].split("-").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ").toLowerCase()} on ${this.options.siteName}`)}return{path:r.path,meta:{title:s,description:n,canonical:`${this.options.baseUrl}${r.path}`,robots:r.auth&&r.auth.required?"noindex, nofollow":"index, follow"}}})}getGenerationSummary(t){let r=t.routes?.length||0,s=t.routes?.filter(i=>!i.auth||i.auth===!1).length||0,n=t.routes?.filter(i=>i.auth&&i.auth.required).length||0;return`${r} routes (${s} public, ${n} protected)`}formatAPIResponse(t){return{totalRoutes:t.routes?.length||0,publicRoutes:t.routes?.filter(r=>!r.auth||r.auth===!1).length||0,protectedRoutes:t.routes?.filter(r=>r.auth&&r.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString()}}};function Ji(e={}){let{disabled:t=!1,debug:r,generateRobotsTxt:s,generateSitemap:n,routes:i={},baseUrl:o,siteName:a,crawlDelay:c,appUrl:u,isDev:f,...b}=e;if(t)return{name:"seo-disabled"};let m=Z("SEO Plugin",r,!0),T=ne.getInstance(),U=null,V=null,re=!1;async function Y(){try{let L=T.resolveAppPath("src/routes.generated.log"),G=T.readSync(L,{format:"text"});if(!G)return m.error(`SEO plugin: routes discovery file not found at ${L}`),m.error("This indicates route discovery failed or did not run. SEO files will be generated with empty routes."),{routes:[],errors:[`Routes file missing: ${L}`],source:"fallback"};let X=G.match(/export const discoveredRoutes = (\[[\s\S]*?\]);/);if(!X)return m.error(`SEO plugin: failed to parse routes from ${L}`),m.error("Expected format: export const discoveredRoutes = [...];"),m.error("This indicates route discovery generated invalid output. SEO files will be generated with empty routes."),{routes:[],errors:[`Invalid routes file format: ${L}`],source:"fallback"};let O=X[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,"]"),F=Function(`"use strict"; return ${O}`)();return{routes:F,errors:[],source:"generated",totalFiles:F.length}}catch(L){return m.warn(`Error parsing generated routes: ${L.message}, falling back to empty routes`),{routes:[],errors:[],source:"fallback"}}}return{name:"vite-seo-plugin",enforce:"pre",configResolved(L){let G=T.getAppRoot(),X=null;u?(X=u,r&&m.debug(`Using app URL from appConfig.app.url: ${X}`)):(X=p.env.VITE_APP_URL||null,X&&r&&m.debug(`Using app URL from VITE_APP_URL: ${X}`)),U=a||null,V=o||X||null,m.verbose(`Name: ${U||"Not found"}`),m.verbose(`URL: ${V||"Not found"}`),U&&m.debug(` - Site name from appConfig: "${U}"`);let O=[];if(V||O.push("baseUrl (VITE_APP_URL in .env)"),U||O.push("siteName (APP_NAME in src/config/app.ts)"),O.length>0){re=!0,m.warn("\u26A0\uFE0F SEO Plugin disabled - missing required configuration:"),O.forEach(F=>m.warn(` - ${F}`)),m.warn(""),m.warn(" To fix:"),V||m.warn(" 1. Add VITE_APP_URL=https://yourdomain.com to your .env file"),U||(m.warn(" 2. Add APP_NAME export to src/config/app.ts:"),m.warn(' export const APP_NAME = "Your App Name";')),m.warn(""),m.warn(" robots.txt and sitemap.xml will NOT be generated."),m.warn("");return}m.debug(`Generate robots.txt: ${s}`),m.debug(`Generate sitemap: ${n}`)},async generateBundle(){if(!re)try{let L=new cr({debug:r,generateRobotsTxt:s,generateSitemap:n,baseUrl:V,siteName:U,crawlDelay:c,routes:i,...b}),G=await Y(),X=async(z,se)=>{this.emitFile({type:"asset",fileName:z,source:se})},O=async z=>!1,F=await L.generateSEOFiles(G,X,O);F.robotsTxt&&!F.robotsTxt.skipped&&m.info(`\u{1F916} robots.txt: ${F.robotsTxt.disallowedPaths||0} disallowed paths`),F.sitemap&&!F.sitemap.skipped&&m.info(`\u{1F5FA}\uFE0F sitemap.xml: ${F.sitemap.publicRoutes||0} routes`),F.manifest&&!F.manifest.skipped&&m.info("\u{1F4C4} seo-manifest.json")}catch(L){m.error(`SEO plugin failed to generate files (robots.txt/sitemap.xml): ${L.message}`),m.error(`Stack: ${L.stack||"No stack trace available"}`)}}}}g();ge();function Xi(e={}){let{debug:t}=e;return{name:"dndev-server-shim",enforce:"pre",resolveId(r){return r.startsWith("node:")?(Z("server-shim",t,!0).warn(`Blocking Node.js built-in module import: ${r}`),"\0virtual:empty-server-module"):Zr.includes(r)?(Z("server-shim",t,!0).warn(`Blocking server-only import: ${r}`),"\0virtual:empty-server-module"):null},load(r){return r==="\0virtual:empty-server-module"?`
773
+ </urlset>`}generateRouteMetaTags(t){return t.map(r=>{let s=this.options.siteName;if(r.meta?.title)s=`${r.meta.title} - ${this.options.siteName}`;else if(r.path!=="/"){let i=r.path.split("/").filter(Boolean);i.length>0&&(s=`${i[i.length-1].split("-").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ")} - ${this.options.siteName}`)}let n=`Welcome to ${this.options.siteName}`;if(r.meta?.description)n=r.meta.description;else if(r.meta?.entity&&r.meta?.action)n=`${r.meta.action} ${r.meta.entity} on ${this.options.siteName}`;else if(r.path!=="/"){let i=r.path.split("/").filter(Boolean);i.length>0&&(n=`Explore ${i[i.length-1].split("-").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ").toLowerCase()} on ${this.options.siteName}`)}return{path:r.path,meta:{title:s,description:n,canonical:`${this.options.baseUrl}${r.path}`,robots:r.auth&&r.auth.required?"noindex, nofollow":"index, follow"}}})}getGenerationSummary(t){let r=t.routes?.length||0,s=t.routes?.filter(i=>!i.auth||i.auth===!1).length||0,n=t.routes?.filter(i=>i.auth&&i.auth.required).length||0;return`${r} routes (${s} public, ${n} protected)`}formatAPIResponse(t){return{totalRoutes:t.routes?.length||0,publicRoutes:t.routes?.filter(r=>!r.auth||r.auth===!1).length||0,protectedRoutes:t.routes?.filter(r=>r.auth&&r.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString()}}};function Xi(e={}){let{disabled:t=!1,debug:r,generateRobotsTxt:s,generateSitemap:n,routes:i={},baseUrl:o,siteName:a,crawlDelay:c,appUrl:u,isDev:f,...b}=e;if(t)return{name:"seo-disabled"};let m=Q("SEO Plugin",r,!0),T=ne.getInstance(),U=null,V=null,re=!1;async function Y(){try{let L=T.resolveAppPath("src/routes.generated.log"),G=T.readSync(L,{format:"text"});if(!G)return m.error(`SEO plugin: routes discovery file not found at ${L}`),m.error("This indicates route discovery failed or did not run. SEO files will be generated with empty routes."),{routes:[],errors:[`Routes file missing: ${L}`],source:"fallback"};let X=G.match(/export const discoveredRoutes = (\[[\s\S]*?\]);/);if(!X)return m.error(`SEO plugin: failed to parse routes from ${L}`),m.error("Expected format: export const discoveredRoutes = [...];"),m.error("This indicates route discovery generated invalid output. SEO files will be generated with empty routes."),{routes:[],errors:[`Invalid routes file format: ${L}`],source:"fallback"};let O=X[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,"]"),F=Function(`"use strict"; return ${O}`)();return{routes:F,errors:[],source:"generated",totalFiles:F.length}}catch(L){return m.warn(`Error parsing generated routes: ${L.message}, falling back to empty routes`),{routes:[],errors:[],source:"fallback"}}}return{name:"vite-seo-plugin",enforce:"pre",configResolved(L){let G=T.getAppRoot(),X=null;u?(X=u,r&&m.debug(`Using app URL from appConfig.app.url: ${X}`)):(X=p.env.VITE_APP_URL||null,X&&r&&m.debug(`Using app URL from VITE_APP_URL: ${X}`)),U=a||null,V=o||X||null,m.verbose(`Name: ${U||"Not found"}`),m.verbose(`URL: ${V||"Not found"}`),U&&m.debug(` - Site name from appConfig: "${U}"`);let O=[];if(V||O.push("baseUrl (VITE_APP_URL in .env)"),U||O.push("siteName (APP_NAME in src/config/app.ts)"),O.length>0){re=!0,m.warn("\u26A0\uFE0F SEO Plugin disabled - missing required configuration:"),O.forEach(F=>m.warn(` - ${F}`)),m.warn(""),m.warn(" To fix:"),V||m.warn(" 1. Add VITE_APP_URL=https://yourdomain.com to your .env file"),U||(m.warn(" 2. Add APP_NAME export to src/config/app.ts:"),m.warn(' export const APP_NAME = "Your App Name";')),m.warn(""),m.warn(" robots.txt and sitemap.xml will NOT be generated."),m.warn("");return}m.debug(`Generate robots.txt: ${s}`),m.debug(`Generate sitemap: ${n}`)},async generateBundle(){if(!re)try{let L=new cr({debug:r,generateRobotsTxt:s,generateSitemap:n,baseUrl:V,siteName:U,crawlDelay:c,routes:i,...b}),G=await Y(),X=async(z,se)=>{this.emitFile({type:"asset",fileName:z,source:se})},O=async z=>!1,F=await L.generateSEOFiles(G,X,O);F.robotsTxt&&!F.robotsTxt.skipped&&m.info(`\u{1F916} robots.txt: ${F.robotsTxt.disallowedPaths||0} disallowed paths`),F.sitemap&&!F.sitemap.skipped&&m.info(`\u{1F5FA}\uFE0F sitemap.xml: ${F.sitemap.publicRoutes||0} routes`),F.manifest&&!F.manifest.skipped&&m.info("\u{1F4C4} seo-manifest.json")}catch(L){m.error(`SEO plugin failed to generate files (robots.txt/sitemap.xml): ${L.message}`),m.error(`Stack: ${L.stack||"No stack trace available"}`)}}}}g();ge();function Ki(e={}){let{debug:t}=e;return{name:"dndev-server-shim",enforce:"pre",resolveId(r,s){return r.startsWith("node:")?(Q("server-shim",t,!0).warn(`Blocking Node.js built-in module import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):pr.includes(r)||pr.some(n=>r.startsWith(`${n}/`))?(Q("server-shim",t,!0).warn(`Blocking server-only subpath import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):es.includes(r)?(Q("server-shim",t,!0).warn(`Blocking server-only import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):null},load(r){return r==="\0virtual:empty-server-module"?`
774
774
  // Node.js built-in modules shims for browser compatibility
775
775
  export const URL = globalThis.URL;
776
776
  export const URLSearchParams = globalThis.URLSearchParams;
@@ -1049,7 +1049,7 @@ ${a.join(`
1049
1049
  // Google Logging Utils shims
1050
1050
  export const LoggingWinston = class LoggingWinston {};
1051
1051
  export const LoggingBunyan = class LoggingBunyan {};
1052
- `:null}}}g();ge();g();ge();g();ge();var kt=class{constructor(t,r={}){if(!t)throw new Error("CSSExtractor requires PathResolver instance");this.pathResolver=t,this.options={debug:!1,customPatterns:{},...r},this.logger=r.logger||{debug:(s,...n)=>{this.options.debug}},this.patterns={selectors:{...pr.selectors,...this.options.customPatterns?.selectors},themes:{...pr.themes,...this.options.customPatterns?.themes}}}cssVarToJsIdentifier(t){if(!t||typeof t!="string")return this._debug(`Invalid CSS variable: ${t}`),null;let r=t.replace(/^--/,"");if(!r)return this._debug(`Empty CSS variable after removing --: ${t}`),null;let s=r.split("-").filter(o=>o.length>0);if(s.length===0)return this._debug(`No valid parts in CSS variable: ${t}`),null;let n=s.map((o,a)=>{let c=o.replace(/[^a-zA-Z0-9]/g,"");return c?a===0?c.toLowerCase():c.charAt(0).toUpperCase()+c.slice(1).toLowerCase():null}).filter(Boolean).join("");return!n||!/^[a-zA-Z][a-zA-Z0-9]*$/.test(n)?(this._debug(`Invalid JavaScript identifier generated from ${t}: ${n}`),null):["const","let","var","function","class","export","import","default","if","else","for","while"].includes(n)?`${n}Var`:n}_stripComments(t){return t.replace(/\/\*[\s\S]*?\*\//g,"")}extractThemes(t,r,s){let n=[],i,o=this.pathResolver.normalizePath(r),a=this._stripComments(t),c=/(?::root\.|\.)([a-z][a-z0-9-]*)\s*\{([^}]*--theme-label\s*:\s*['"]([^'"]+)['"][^}]*)\}/gim;for(;(i=c.exec(a))!==null;){let[,u,f,b]=i;if(!u||!b)continue;let m=f.match(this.patterns.themes.themeIcon),T=f.match(this.patterns.themes.themeIsDark),U={name:u,displayName:b,isDark:T?T[1]==="1":!1,meta:{icon:m?.[1]},source:this.pathResolver.getBasename(r)};this._debug(`Discovered theme: ${u} (${b})`),n.push(U),s.themes.set(u,{name:u,displayName:b,isDark:U.isDark,file:o,variables:new Set,meta:U.meta})}return n.length>0&&this._debug(`Extracted ${n.length} themes from ${o}`),n}extractClasses(t,r){(t.match(this.patterns.selectors.class)||[]).forEach(n=>{let i=n.slice(1);i.startsWith("_")||r.classes.add(i)})}extractVariables(t,r,s){(t.match(this.patterns.selectors.variable)||[]).forEach(i=>{i.startsWith("--")&&i.length>2?s==="framework"?r.variables.framework.add(i):r.variables.consumer.add(i):this._debug(`Skipping invalid CSS variable: ${i}`)})}extractKeyframes(t,r){(t.match(this.patterns.selectors.keyframe)||[]).forEach(n=>{let i=n.replace("@keyframes","").trim();i&&r.keyframes.add(i)})}validateCSS(t){let r=[],s=t.match(/--[a-zA-Z0-9-_]*[^a-zA-Z0-9-_:;\s]/g);return s&&s.forEach(i=>{r.push(`Possible malformed CSS variable: ${i}`)}),(t.match(/\.[a-z][a-z0-9-]+\s*\{[^}]*\}/gi)||[]).forEach(i=>{if(!i.includes("--theme-label")&&i.includes("--")){let o=i.match(/\.([a-z][a-z0-9-]+)/)?.[1];o&&r.push(`Theme class "${o}" missing --theme-label`)}}),r}extractAll(t,r,s="consumer"){let n={themes:new Map,classes:new Set,variables:{framework:new Set,consumer:new Set},keyframes:new Set},i=this.extractThemes(t,r,n);this.extractClasses(t,n),this.extractVariables(t,n,s),this.extractKeyframes(t,n);let o=this.validateCSS(t);return{themes:i,classes:Array.from(n.classes),variables:{framework:Array.from(n.variables.framework),consumer:Array.from(n.variables.consumer),all:[...Array.from(n.variables.framework),...Array.from(n.variables.consumer)].sort()},keyframes:Array.from(n.keyframes),warnings:o}}getPatterns(){return{...this.patterns}}setPatterns(t){this.patterns={...this.patterns,...t,selectors:{...this.patterns.selectors,...t.selectors},themes:{...this.patterns.themes,...t.themes}}}_debug(t,r){this.logger.debug(t,r||"")}};var Ot=class extends _e{constructor(t,r,s={}){super(r,s),this.cssExtractor=t||new kt(r,{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(t){this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes();let{frameworkFiles:r,consumerFiles:s}=t;this.logger.debug(`Scanning ${r.length} framework + ${s.length} consumer CSS files`),this.logger.debug("\u{1F50D} FILES DISCOVERED:"),this.logger.debug("Framework files:",r),this.logger.debug("Consumer files:",s),r.length>0?(this.logger.debug(`Framework files found: ${r.length}`),this.logger.debug("Framework files:",r)):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(r),await this._processConsumerFiles(s);let n=this._serializeThemes();return this.logger.debug(`Discovered ${n.length} themes:`,n.map(i=>i.name)),{themes:n,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 t=this._serializeThemes();return{themes:t.length>0?t:this._getEssentialThemesFallback(),variables:{framework:[],consumer:[],all:[]},classes:[],keyframes:[],timestamp:Date.now()}}_getEssentialThemesFallback(){return mr.map(t=>({name:t.name,displayName:t.displayName,meta:{icon:t.icon,category:t.isDark?"dark":"light"},essential:!0,isDark:t.isDark,source:"built-in",variableCount:0}))}_getDiscoverySummary(){return""}async discoverThemes(t=!1){return await this.discover(t)}getThemes(){return this.cache?.themes||[]}getVariables(){return this.cache?.variables||{framework:[],consumer:[],all:[]}}getClasses(){return this.cache?.classes||[]}async _processFrameworkFiles(t){for(let r of t)try{let s=await this.pathResolver.read(r,{format:"text"}),n=this.pathResolver.normalizePath(r);this.cssExtractor.extractThemes(s,n,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(n)}`)}catch(s){this.logger.debug(`Error scanning framework file ${r}: ${s.message}`)}}async _processConsumerFiles(t){for(let r of t)try{let s=await this.pathResolver.read(r,{format:"text"}),n=this.pathResolver.normalizePath(r);this.cssExtractor.extractThemes(s,n,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"consumer"),this.logger.debug(`\u2705 Processed consumer: ${this.pathResolver.getRelativePath(n)}`)}catch(s){this.logger.debug(`Error scanning consumer file ${r}: ${s.message}`)}}_addEssentialThemes(){mr.forEach(t=>{this.discovered.themes.set(t.name,{name:t.name,displayName:t.displayName,meta:{icon:t.icon,category:t.isDark?"dark":"light"},essential:!0,isDark:t.isDark,source:"built-in",variables:new Set})})}_serializeThemes(){return Array.from(this.discovered.themes.values()).map(t=>({name:t.name,displayName:t.displayName,meta:t.meta,source:t.source,essential:t.essential||!1,isDark:t.isDark||!1,variableCount:t.variables?.size||0}))}};var Ki={isEmpty:e=>!e.themes||e.themes.length===0,generateModule:(e,t,r="themes")=>{let{themes:s}=e;if(!s||s.length===0)return Ki.generateEmpty(e,t,void 0,r);let n=s.find(o=>o.essential&&o.name==="light")||s[0],i={totalThemes:s.length,defaultTheme:n?.name||"light",hasCustomThemes:s.some(o=>!o.essential),timestamp:new Date().toISOString()};return`// Virtual module: ${ee.themes}
1052
+ `:null}}}g();ge();g();ge();g();ge();var kt=class{constructor(t,r={}){if(!t)throw new Error("CSSExtractor requires PathResolver instance");this.pathResolver=t,this.options={debug:!1,customPatterns:{},...r},this.logger=r.logger||{debug:(s,...n)=>{this.options.debug}},this.patterns={selectors:{...mr.selectors,...this.options.customPatterns?.selectors},themes:{...mr.themes,...this.options.customPatterns?.themes}}}cssVarToJsIdentifier(t){if(!t||typeof t!="string")return this._debug(`Invalid CSS variable: ${t}`),null;let r=t.replace(/^--/,"");if(!r)return this._debug(`Empty CSS variable after removing --: ${t}`),null;let s=r.split("-").filter(o=>o.length>0);if(s.length===0)return this._debug(`No valid parts in CSS variable: ${t}`),null;let n=s.map((o,a)=>{let c=o.replace(/[^a-zA-Z0-9]/g,"");return c?a===0?c.toLowerCase():c.charAt(0).toUpperCase()+c.slice(1).toLowerCase():null}).filter(Boolean).join("");return!n||!/^[a-zA-Z][a-zA-Z0-9]*$/.test(n)?(this._debug(`Invalid JavaScript identifier generated from ${t}: ${n}`),null):["const","let","var","function","class","export","import","default","if","else","for","while"].includes(n)?`${n}Var`:n}_stripComments(t){return t.replace(/\/\*[\s\S]*?\*\//g,"")}extractThemes(t,r,s){let n=[],i,o=this.pathResolver.normalizePath(r),a=this._stripComments(t),c=/(?::root\.|\.)([a-z][a-z0-9-]*)\s*\{([^}]*--theme-label\s*:\s*['"]([^'"]+)['"][^}]*)\}/gim;for(;(i=c.exec(a))!==null;){let[,u,f,b]=i;if(!u||!b)continue;let m=f.match(this.patterns.themes.themeIcon),T=f.match(this.patterns.themes.themeIsDark),U={name:u,displayName:b,isDark:T?T[1]==="1":!1,meta:{icon:m?.[1]},source:this.pathResolver.getBasename(r)};this._debug(`Discovered theme: ${u} (${b})`),n.push(U),s.themes.set(u,{name:u,displayName:b,isDark:U.isDark,file:o,variables:new Set,meta:U.meta})}return n.length>0&&this._debug(`Extracted ${n.length} themes from ${o}`),n}extractClasses(t,r){(t.match(this.patterns.selectors.class)||[]).forEach(n=>{let i=n.slice(1);i.startsWith("_")||r.classes.add(i)})}extractVariables(t,r,s){(t.match(this.patterns.selectors.variable)||[]).forEach(i=>{i.startsWith("--")&&i.length>2?s==="framework"?r.variables.framework.add(i):r.variables.consumer.add(i):this._debug(`Skipping invalid CSS variable: ${i}`)})}extractKeyframes(t,r){(t.match(this.patterns.selectors.keyframe)||[]).forEach(n=>{let i=n.replace("@keyframes","").trim();i&&r.keyframes.add(i)})}validateCSS(t){let r=[],s=t.match(/--[a-zA-Z0-9-_]*[^a-zA-Z0-9-_:;\s]/g);return s&&s.forEach(i=>{r.push(`Possible malformed CSS variable: ${i}`)}),(t.match(/\.[a-z][a-z0-9-]+\s*\{[^}]*\}/gi)||[]).forEach(i=>{if(!i.includes("--theme-label")&&i.includes("--")){let o=i.match(/\.([a-z][a-z0-9-]+)/)?.[1];o&&r.push(`Theme class "${o}" missing --theme-label`)}}),r}extractAll(t,r,s="consumer"){let n={themes:new Map,classes:new Set,variables:{framework:new Set,consumer:new Set},keyframes:new Set},i=this.extractThemes(t,r,n);this.extractClasses(t,n),this.extractVariables(t,n,s),this.extractKeyframes(t,n);let o=this.validateCSS(t);return{themes:i,classes:Array.from(n.classes),variables:{framework:Array.from(n.variables.framework),consumer:Array.from(n.variables.consumer),all:[...Array.from(n.variables.framework),...Array.from(n.variables.consumer)].sort()},keyframes:Array.from(n.keyframes),warnings:o}}getPatterns(){return{...this.patterns}}setPatterns(t){this.patterns={...this.patterns,...t,selectors:{...this.patterns.selectors,...t.selectors},themes:{...this.patterns.themes,...t.themes}}}_debug(t,r){this.logger.debug(t,r||"")}};var Ot=class extends _e{constructor(t,r,s={}){super(r,s),this.cssExtractor=t||new kt(r,{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(t){this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes();let{frameworkFiles:r,consumerFiles:s}=t;this.logger.debug(`Scanning ${r.length} framework + ${s.length} consumer CSS files`),this.logger.debug("\u{1F50D} FILES DISCOVERED:"),this.logger.debug("Framework files:",r),this.logger.debug("Consumer files:",s),r.length>0?(this.logger.debug(`Framework files found: ${r.length}`),this.logger.debug("Framework files:",r)):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(r),await this._processConsumerFiles(s);let n=this._serializeThemes();return this.logger.debug(`Discovered ${n.length} themes:`,n.map(i=>i.name)),{themes:n,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 t=this._serializeThemes();return{themes:t.length>0?t:this._getEssentialThemesFallback(),variables:{framework:[],consumer:[],all:[]},classes:[],keyframes:[],timestamp:Date.now()}}_getEssentialThemesFallback(){return br.map(t=>({name:t.name,displayName:t.displayName,meta:{icon:t.icon,category:t.isDark?"dark":"light"},essential:!0,isDark:t.isDark,source:"built-in",variableCount:0}))}_getDiscoverySummary(){return""}async discoverThemes(t=!1){return await this.discover(t)}getThemes(){return this.cache?.themes||[]}getVariables(){return this.cache?.variables||{framework:[],consumer:[],all:[]}}getClasses(){return this.cache?.classes||[]}async _processFrameworkFiles(t){for(let r of t)try{let s=await this.pathResolver.read(r,{format:"text"}),n=this.pathResolver.normalizePath(r);this.cssExtractor.extractThemes(s,n,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(n)}`)}catch(s){this.logger.debug(`Error scanning framework file ${r}: ${s.message}`)}}async _processConsumerFiles(t){for(let r of t)try{let s=await this.pathResolver.read(r,{format:"text"}),n=this.pathResolver.normalizePath(r);this.cssExtractor.extractThemes(s,n,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"consumer"),this.logger.debug(`\u2705 Processed consumer: ${this.pathResolver.getRelativePath(n)}`)}catch(s){this.logger.debug(`Error scanning consumer file ${r}: ${s.message}`)}}_addEssentialThemes(){br.forEach(t=>{this.discovered.themes.set(t.name,{name:t.name,displayName:t.displayName,meta:{icon:t.icon,category:t.isDark?"dark":"light"},essential:!0,isDark:t.isDark,source:"built-in",variables:new Set})})}_serializeThemes(){return Array.from(this.discovered.themes.values()).map(t=>({name:t.name,displayName:t.displayName,meta:t.meta,source:t.source,essential:t.essential||!1,isDark:t.isDark||!1,variableCount:t.variables?.size||0}))}};var Yi={isEmpty:e=>!e.themes||e.themes.length===0,generateModule:(e,t,r="themes")=>{let{themes:s}=e;if(!s||s.length===0)return Yi.generateEmpty(e,t,void 0,r);let n=s.find(o=>o.essential&&o.name==="light")||s[0],i={totalThemes:s.length,defaultTheme:n?.name||"light",hasCustomThemes:s.some(o=>!o.essential),timestamp:new Date().toISOString()};return`// Virtual module: ${ee.themes}
1053
1053
  // \u{1F680} STATIC INJECTION PATTERN - Zero Runtime Loading
1054
1054
  // Generated by @donotdev/config at ${new Date().toISOString()}
1055
1055
 
@@ -1225,11 +1225,11 @@ export const themeManifest = {
1225
1225
  };
1226
1226
 
1227
1227
  export default discoveredThemes;
1228
- `},generateManifest:e=>({themes:e.themes?.length||0,timestamp:Date.now(),hasCustomThemes:e.themes?.some(t=>!t.essential)||!1}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.themes||[],n=s.filter(o=>!o.essential).length,i=s.length;r&&(i===0?r.warn(`${t} No themes discovered - using framework essential themes fallback`):r.info(`${t} Themes: ${i} discovered${n>0?` (${n} custom)`:""}`))}};function Yi(e={}){let t=Date.now();return Z("theme-plugin",e.debug,e.verbose).debug("\u{1F3A8} Creating theme discovery plugin..."),Fe({pluginName:"dndev-theme",icon:"\u{1F3A8}",virtualModuleId:ee.themes,DiscoveryClass:Ot,discoveryMethod:"discoverThemes",filePatterns:["**/*.css"],templates:Ki,defaultInspectionPath:ue.vite.themeInspection,manifestFileName:ue.manifests.theme,configKey:"themes",createDiscovery:(n,i)=>{let o=new kt(n,{debug:i.debug,logger:Z("css-extractor",i.debug,i.verbose)});return new Ot(o,n,i)}})(e)}function Qi(e={}){let t=Z("vite-plugins",e.debug,e.verbose);try{let{mode:r,debug:s,verbose:n,isDev:i,server:o={},routes:a={},themes:c={},i18n:u={},assets:f={},seo:b={},pwa:m={},serverShim:T={},pluginFactory:U={},appUrl:V}=e,re=a.debug??s,Y=c.debug??s,L=u.debug??s,G=f.debug??s,X=T.debug??s,O=[],F;try{F=ne.getInstance()}catch(z){throw new Error(`Failed to initialize PathResolver: ${z.message||z}`)}return O.push({name:"dndev-file-watcher-fix",enforce:"pre",configResolved(z){if(s){t.debug("\u{1F4CB} Vite resolved config (configResolved):");let M={root:z.root,mode:z.mode,envDir:z.envDir,base:z.base,build:z.build?{outDir:z.build.outDir,minify:z.build.minify}:void 0,server:z.server?{port:z.server.port,host:z.server.host}:void 0,plugins:z.plugins?{count:z.plugins.length,names:z.plugins.map(j=>j?.name||"unnamed").filter(Boolean)}:void 0};t.debug(JSON.stringify(M,null,2))}F.setAppRoot(z.root);let se=F.getAppRoot();if(i&&z.server?.port){let M=z.server.https?"https":"http";p.env.VITE_APP_URL=`${M}://localhost:${z.server.port}`,(s||n)&&t.debug(`VITE_APP_URL set: ${p.env.VITE_APP_URL}`)}else V?(p.env.VITE_APP_URL=V,t.debug(`VITE_APP_URL set from appConfig.app.url: ${V}`)):i&&t.warn("VITE_APP_URL not set. Server port not available. Set appConfig.app.url in src/config/app.ts");try{let M=F.getRepoRoot();t.verbose(`Repo: ${M}`),t.verbose(`App: ${se}`)}catch(M){t.debug(`Could not log PathResolver values: ${M.message}`)}if(z.server){let M=pe=>{let me=pe.replace(/\\/g,"/"),dt=se.replace(/\\/g,"/");return!me.startsWith(dt)};z.server.watch||(z.server.watch={});let j=["**/node_modules/**","**/.git/**","**/dist/**","**/build/**","**/.next/**","**/.turbo/**","**/.vite/**"];z.server.watch={...z.server.watch,ignored:[...z.server.watch.ignored||[],...j,M]},t.verbose(`Fixed file watcher to use app root: ${se}`)}}}),O.push(Gi({debug:s,verbose:n})),O.push(Bi({debug:s})),O.push(pf({fastRefresh:!0,jsxRuntime:"automatic"})),O.push(mf({ignoreConfigErrors:!0})),o.https!==!1&&O.push(gf()),O.push(Vi({...U,...a,debug:re})),O.push(Yi({...U,...c,debug:Y})),O.push(zi({...U,...u,debug:L})),O.push(ji({...U,...f,debug:G})),O.push(Mi({...U,mode:r,debug:s,verbose:n})),O.push(Ji({...b,debug:s,appUrl:V,isDev:i})),m.enabled&&O.push(qi({...m,debug:s})),O.push(Xi({...T,debug:X})),O}catch(r){throw Z("vite-plugins",!1,!0).error(`Failed to create Vite plugins: ${r.message}`),r}}g();ge();function bf(e){if(!e)return{};let t={};return Array.isArray(e)?e.forEach(({find:r,replacement:s})=>{typeof r=="string"&&(t[r]=s)}):typeof e=="object"&&Object.assign(t,e),t}function Zi(e={}){let{alias:t,...r}=e,{conditions:s,...n}=r;return{alias:{"@":"/src",...bf(t)},dedupe:["react","react-dom","react-router-dom"],preserveSymlinks:!1,conditions:["browser","module","import","vite-app",...s||[]],...n}}function eo(e={}){let{include:t=[],exclude:r=[],esbuildOptions:s={},...n}=e,i=[...t,...at.optionalFeatures],o=[...new Set(i)],a=[...new Set(r)];return{include:o,exclude:a,esbuildOptions:s,...n}}function vf(e={}){return e==null&&(e={}),async(t={})=>{t==null&&(t={});try{let r=p.env.CI==="true";p.env.DNDEV_BUILD_ID||(p.env.DNDEV_BUILD_ID=r?`ci-${Math.random().toString(36).slice(2,9)}`:Math.random().toString(36).slice(2,9));let s=t.command,n=t.mode,{appConfig:i,...o}=e;if(!i)throw new Error(`appConfig is required. Import appConfig from src/config/app.ts and pass it to defineViteConfig({ appConfig, ... })
1229
- Make sure the import statement in vite.config.ts is: import { appConfig } from "./src/config/app";`);if(typeof i!="object"||i===null)throw new Error(`appConfig must be an object, but got ${typeof i}. Make sure you are exporting appConfig from src/config/app.ts correctly.`);let a=i?.features?{debug:i.features.debug}:void 0,c=i?.seo&&typeof i.seo!="boolean"?{...i.seo,siteName:i.seo.siteName||i.app?.name}:i?.app?.name?{siteName:i.app.name}:void 0,{features:u,seo:f,...b}=o,m=i?.app?{name:i.app.name,shortName:i.app.shortName,description:i.app.description,url:i.app.url}:void 0,{pwa:T={},...U}=b,V={...T,app:T.app||m},re={...a?{features:a}:{},...c?{seo:c}:{},...Object.keys(V).length>0?{pwa:V}:{},...U,mode:n},Y;try{Y=ds(re)}catch(Te){throw new Error(`mergeOptions failed: ${Te?.message||Te||"Unknown error"}`)}let L;try{L=gs(Y)}catch(Te){throw new Error(`normalizeOptions failed: ${Te?.message||Te||"Unknown error"}`)}if(!L)throw new Error("normalizeOptions returned undefined");let{mode:G,debug:X,verbose:O,isDev:F,isDebug:z,shouldAnalyze:se,serverOptions:M,previewOptions:j,buildOverrides:pe,resolveOptions:me,routeOptions:dt,themeOptions:H,i18nOptions:J,assetOptions:K,featureOptions:le,seoOptions:Xe,pwaOptions:Ke,serverShimOptions:Ye,chunkingOptions:de,pluginFactoryOptions:At,base:nt,defineOptions:gt,optimizeDepsOptions:ur,pluginsOptions:fr,cssOptions:_t,envDir:jt,restOptions:hr}=L,it=Z("vite-config",X,O);it.debug(`Mode: ${G}, Dev: ${F}`);let A=p.env.DNDEV_BUILD_ID,C;s==="build"?C=`Building for ${G}`:s==="serve"?C=`Development server (${G})`:s==="preview"?C=`Preview server (serving ${G} build)`:C=`Running ${s} (${G})`,it.info(`
1228
+ `},generateManifest:e=>({themes:e.themes?.length||0,timestamp:Date.now(),hasCustomThemes:e.themes?.some(t=>!t.essential)||!1}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.themes||[],n=s.filter(o=>!o.essential).length,i=s.length;r&&(i===0?r.warn(`${t} No themes discovered - using framework essential themes fallback`):r.info(`${t} Themes: ${i} discovered${n>0?` (${n} custom)`:""}`))}};function Qi(e={}){let t=Date.now();return Q("theme-plugin",e.debug,e.verbose).debug("\u{1F3A8} Creating theme discovery plugin..."),Fe({pluginName:"dndev-theme",icon:"\u{1F3A8}",virtualModuleId:ee.themes,DiscoveryClass:Ot,discoveryMethod:"discoverThemes",filePatterns:["**/*.css"],templates:Yi,defaultInspectionPath:ue.vite.themeInspection,manifestFileName:ue.manifests.theme,configKey:"themes",createDiscovery:(n,i)=>{let o=new kt(n,{debug:i.debug,logger:Q("css-extractor",i.debug,i.verbose)});return new Ot(o,n,i)}})(e)}function Zi(e={}){let t=Q("vite-plugins",e.debug,e.verbose);try{let{mode:r,debug:s,verbose:n,isDev:i,server:o={},routes:a={},themes:c={},i18n:u={},assets:f={},seo:b={},pwa:m={},serverShim:T={},pluginFactory:U={},appUrl:V}=e,re=a.debug??s,Y=c.debug??s,L=u.debug??s,G=f.debug??s,X=T.debug??s,O=[];O.push(Ki({...T,debug:X}));let F;try{F=ne.getInstance()}catch(z){throw new Error(`Failed to initialize PathResolver: ${z.message||z}`)}return O.push({name:"dndev-file-watcher-fix",enforce:"pre",configResolved(z){if(s){t.debug("\u{1F4CB} Vite resolved config (configResolved):");let M={root:z.root,mode:z.mode,envDir:z.envDir,base:z.base,build:z.build?{outDir:z.build.outDir,minify:z.build.minify}:void 0,server:z.server?{port:z.server.port,host:z.server.host}:void 0,plugins:z.plugins?{count:z.plugins.length,names:z.plugins.map(j=>j?.name||"unnamed").filter(Boolean)}:void 0};t.debug(JSON.stringify(M,null,2))}F.setAppRoot(z.root);let se=F.getAppRoot();if(i&&z.server?.port){let M=z.server.https?"https":"http";p.env.VITE_APP_URL=`${M}://localhost:${z.server.port}`,(s||n)&&t.debug(`VITE_APP_URL set: ${p.env.VITE_APP_URL}`)}else V?(p.env.VITE_APP_URL=V,t.debug(`VITE_APP_URL set from appConfig.app.url: ${V}`)):i&&t.warn("VITE_APP_URL not set. Server port not available. Set appConfig.app.url in src/config/app.ts");try{let M=F.getRepoRoot();t.verbose(`Repo: ${M}`),t.verbose(`App: ${se}`)}catch(M){t.debug(`Could not log PathResolver values: ${M.message}`)}if(z.server){let M=pe=>{let me=pe.replace(/\\/g,"/"),dt=se.replace(/\\/g,"/");return!me.startsWith(dt)};z.server.watch||(z.server.watch={});let j=["**/node_modules/**","**/.git/**","**/dist/**","**/build/**","**/.next/**","**/.turbo/**","**/.vite/**"];z.server.watch={...z.server.watch,ignored:[...z.server.watch.ignored||[],...j,M]},t.verbose(`Fixed file watcher to use app root: ${se}`)}}}),O.push(qi({debug:s,verbose:n})),O.push(Ui({debug:s})),O.push(mf({fastRefresh:!0,jsxRuntime:"automatic"})),O.push(bf({ignoreConfigErrors:!0})),o.https!==!1&&O.push(pf()),O.push(Ji({...U,...a,debug:re})),O.push(Qi({...U,...c,debug:Y})),O.push(Bi({...U,...u,debug:L})),O.push(Li({...U,...f,debug:G})),O.push(zi({...U,mode:r,debug:s,verbose:n})),O.push(Xi({...b,debug:s,appUrl:V,isDev:i})),m.enabled&&O.push(Wi({...m,debug:s})),O}catch(r){throw Q("vite-plugins",!1,!0).error(`Failed to create Vite plugins: ${r.message}`),r}}g();ge();function vf(e){if(!e)return{};let t={};return Array.isArray(e)?e.forEach(({find:r,replacement:s})=>{typeof r=="string"&&(t[r]=s)}):typeof e=="object"&&Object.assign(t,e),t}function eo(e={}){let{alias:t,...r}=e,{conditions:s,...n}=r;return{alias:{"@":"/src",...vf(t)},dedupe:["react","react-dom","react-router-dom"],preserveSymlinks:!1,conditions:["browser","module","import","vite-app",...s||[]],...n}}function to(e={}){let{include:t=[],exclude:r=[],esbuildOptions:s={},...n}=e,i=[...t,...at.optionalFeatures],o=[...new Set(i)],a=[...new Set(r)];return{include:o,exclude:a,esbuildOptions:s,...n}}function yf(e={}){return e==null&&(e={}),async(t={})=>{t==null&&(t={});try{let r=p.env.CI==="true";p.env.DNDEV_BUILD_ID||(p.env.DNDEV_BUILD_ID=r?`ci-${Math.random().toString(36).slice(2,9)}`:Math.random().toString(36).slice(2,9));let s=t.command,n=t.mode,{appConfig:i,...o}=e;if(!i)throw new Error(`appConfig is required. Import appConfig from src/config/app.ts and pass it to defineViteConfig({ appConfig, ... })
1229
+ Make sure the import statement in vite.config.ts is: import { appConfig } from "./src/config/app";`);if(typeof i!="object"||i===null)throw new Error(`appConfig must be an object, but got ${typeof i}. Make sure you are exporting appConfig from src/config/app.ts correctly.`);let a=i?.features?{debug:i.features.debug}:void 0,c=i?.seo&&typeof i.seo!="boolean"?{...i.seo,siteName:i.seo.siteName||i.app?.name}:i?.app?.name?{siteName:i.app.name}:void 0,{features:u,seo:f,...b}=o,m=i?.app?{name:i.app.name,shortName:i.app.shortName,description:i.app.description,url:i.app.url}:void 0,{pwa:T={},...U}=b,V={...T,app:T.app||m},re={...a?{features:a}:{},...c?{seo:c}:{},...Object.keys(V).length>0?{pwa:V}:{},...U,mode:n},Y;try{Y=gs(re)}catch(Te){throw new Error(`mergeOptions failed: ${Te?.message||Te||"Unknown error"}`)}let L;try{L=ps(Y)}catch(Te){throw new Error(`normalizeOptions failed: ${Te?.message||Te||"Unknown error"}`)}if(!L)throw new Error("normalizeOptions returned undefined");let{mode:G,debug:X,verbose:O,isDev:F,isDebug:z,shouldAnalyze:se,serverOptions:M,previewOptions:j,buildOverrides:pe,resolveOptions:me,routeOptions:dt,themeOptions:H,i18nOptions:J,assetOptions:K,featureOptions:le,seoOptions:Xe,pwaOptions:Ke,serverShimOptions:Ye,chunkingOptions:de,pluginFactoryOptions:At,base:nt,defineOptions:gt,optimizeDepsOptions:ur,pluginsOptions:fr,cssOptions:_t,envDir:jt,restOptions:hr}=L,it=Q("vite-config",X,O);it.debug(`Mode: ${G}, Dev: ${F}`);let A=p.env.DNDEV_BUILD_ID,C;s==="build"?C=`Building for ${G}`:s==="serve"?C=`Development server (${G})`:s==="preview"?C=`Preview server (serving ${G} build)`:C=`Running ${s} (${G})`,it.info(`
1230
1230
  \u{1F3D7}\uFE0F DnDev Framework - ${C}${A?` [build:${A}]`:""}`),it.info(` Platform: Vite | Command: ${s} | Mode: ${G}
1231
- `);let ae=Qi({mode:G,debug:X,verbose:O,isDev:F,routes:dt,themes:H,i18n:J,assets:K,features:le,seo:Xe,pwa:Ke,serverShim:Ye,chunkingOptions:de,pluginFactory:At,appUrl:m?.url});if(!Array.isArray(ae))throw new Error(`createVitePlugins returned ${typeof ae}, expected array. Value: ${ae}`);let ot=cs({mode:G,chunkingOptions:de,debug:X,isDev:F,isDebug:z,shouldAnalyze:se}),Ie=us(M.port||3e3,M,it),to=fs(j);return{...nt&&{base:nt},plugins:[...ae,...fr],appType:"spa",assetsInclude:["**/*.woff","**/*.woff2","**/*.ttf","**/*.otf","**/*.eot"],...G==="production"&&{build:ot},...s==="serve"&&{server:Ie},...s==="preview"&&{preview:to},...jt&&{envDir:jt},customLogger:G==="production"&&!X?(()=>{let Te={hasWarned:!1,_shouldSuppress($e){return $e.includes("dist/")||$e.includes("kB")||$e.includes("\u2502")||$e.includes("gzip:")||$e.includes("\u2713 built in")||$e.match(/built in \d+\.\d+s/)},info($e){Te._shouldSuppress($e)},warn($e){Te._shouldSuppress($e)},error($e){},warnOnce($e){Te.hasWarned||(Te.hasWarned=!0)},clearScreen(){},hasErrorLogged(){return!1}};return Te})():void 0,css:{postcss:ms(_t),..._t},optimizeDeps:eo(ur),resolve:Zi(me),define:{...gt,"process.env.NODE_ENV":JSON.stringify(n),__DEV__:JSON.stringify(F),__PROD__:JSON.stringify(!F)},...hr}}catch(r){let s=r||new Error("Unknown error occurred"),n=s?.message||s?.toString()||String(s)||"Unknown error",i=s?.stack||"",o=new Error(`Failed to create Vite config: ${n}${i?`
1232
- ${i}`:""}`);throw o.stack=i||o.stack,o}}}export{vf as defineViteConfig};
1231
+ `);let ae=Zi({mode:G,debug:X,verbose:O,isDev:F,routes:dt,themes:H,i18n:J,assets:K,features:le,seo:Xe,pwa:Ke,serverShim:Ye,chunkingOptions:de,pluginFactory:At,appUrl:m?.url});if(!Array.isArray(ae))throw new Error(`createVitePlugins returned ${typeof ae}, expected array. Value: ${ae}`);let ot=us({mode:G,chunkingOptions:de,debug:X,isDev:F,isDebug:z,shouldAnalyze:se}),Ie=fs(M.port||3e3,M,it),ro=hs(j);return{...nt&&{base:nt},plugins:[...ae,...fr],appType:"spa",assetsInclude:["**/*.woff","**/*.woff2","**/*.ttf","**/*.otf","**/*.eot"],...G==="production"&&{build:ot},...s==="serve"&&{server:Ie},...s==="preview"&&{preview:ro},...jt&&{envDir:jt},customLogger:G==="production"&&!X?(()=>{let Te={hasWarned:!1,_shouldSuppress($e){return $e.includes("dist/")||$e.includes("kB")||$e.includes("\u2502")||$e.includes("gzip:")||$e.includes("\u2713 built in")||$e.match(/built in \d+\.\d+s/)},info($e){Te._shouldSuppress($e)},warn($e){Te._shouldSuppress($e)},error($e){},warnOnce($e){Te.hasWarned||(Te.hasWarned=!0)},clearScreen(){},hasErrorLogged(){return!1}};return Te})():void 0,css:{postcss:bs(_t),..._t},optimizeDeps:to(ur),resolve:eo(me),define:{...gt,"process.env.NODE_ENV":JSON.stringify(n),__DEV__:JSON.stringify(F),__PROD__:JSON.stringify(!F)},...hr}}catch(r){let s=r||new Error("Unknown error occurred"),n=s?.message||s?.toString()||String(s)||"Unknown error",i=s?.stack||"",o=new Error(`Failed to create Vite config: ${n}${i?`
1232
+ ${i}`:""}`);throw o.stack=i||o.stack,o}}}export{yf as defineViteConfig};
1233
1233
  /*! Bundled license information:
1234
1234
 
1235
1235
  sharp/lib/is.js: