@appinit/cli 1.1.0 → 1.2.0

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.
Files changed (39) hide show
  1. package/LICENSE +33 -0
  2. package/dist/index.js +82 -10
  3. package/dist/templates/frontend-react/.appinit-generate/project/README.md +14 -0
  4. package/dist/templates/frontend-react/.appinit-generate/project/index.html +12 -0
  5. package/dist/templates/frontend-react/.appinit-generate/project/package.json +26 -0
  6. package/dist/templates/frontend-react/.appinit-generate/project/public/vite.svg +30 -0
  7. package/dist/templates/frontend-react/.appinit-generate/project/src/App.tsx +16 -0
  8. package/dist/templates/frontend-react/.appinit-generate/project/src/assets/react.svg +1 -0
  9. package/dist/templates/frontend-react/.appinit-generate/project/src/index.css +9 -0
  10. package/dist/templates/frontend-react/.appinit-generate/project/src/main.tsx +10 -0
  11. package/dist/templates/frontend-react/.appinit-generate/project/tsconfig.app.json +31 -0
  12. package/dist/templates/frontend-react/.appinit-generate/project/tsconfig.json +7 -0
  13. package/dist/templates/frontend-react/.appinit-generate/project/tsconfig.node.json +26 -0
  14. package/dist/templates/frontend-react/.appinit-generate/project/vite.config.ts +16 -0
  15. package/dist/templates/frontend-react/docs/README.md +12 -0
  16. package/dist/templates/frontend-react/hooks/afterRender.ts +3 -0
  17. package/dist/templates/frontend-react/hooks/afterWrite.ts +3 -0
  18. package/dist/templates/frontend-react/hooks/beforeRender.ts +3 -0
  19. package/dist/templates/frontend-react/hooks/beforeWrite.ts +3 -0
  20. package/dist/templates/frontend-react/package.json +16 -0
  21. package/dist/templates/frontend-react/template/.env__tmpl +1 -0
  22. package/dist/templates/frontend-react/template/README.md__tmpl +14 -0
  23. package/dist/templates/frontend-react/template/_gitignore +41 -0
  24. package/dist/templates/frontend-react/template/index.html__tmpl +12 -0
  25. package/dist/templates/frontend-react/template/package.json__tmpl +26 -0
  26. package/dist/templates/frontend-react/template/public/vite.svg +30 -0
  27. package/dist/templates/frontend-react/template/src/App.tsx__tmpl +16 -0
  28. package/dist/templates/frontend-react/template/src/assets/react.svg +1 -0
  29. package/dist/templates/frontend-react/template/src/index.css__tmpl +9 -0
  30. package/dist/templates/frontend-react/template/src/main.tsx__tmpl +10 -0
  31. package/dist/templates/frontend-react/template/tsconfig.app.json__tmpl +31 -0
  32. package/dist/templates/frontend-react/template/tsconfig.json__tmpl +7 -0
  33. package/dist/templates/frontend-react/template/tsconfig.node.json__tmpl +26 -0
  34. package/dist/templates/frontend-react/template/vite.config.ts__tmpl +16 -0
  35. package/dist/templates/frontend-react/template.config.ts +30 -0
  36. package/dist/templates/frontend-react/variables/defaults.ts +6 -0
  37. package/dist/templates/frontend-react/variables/schema.ts +17 -0
  38. package/dist/templates/frontend-react/variables/transform.ts +10 -0
  39. package/package.json +24 -3
package/dist/index.js CHANGED
@@ -1,17 +1,30 @@
1
1
  #!/usr/bin/env node
2
- import {existsSync}from'fs';import He,{readFile}from'fs/promises';import*as z from'path';import z__default from'path';import {isatty}from'tty';import p from'kleur';import {exec}from'child_process';import Ve,{promisify}from'util';import S from'process';import {spinner,multiselect,confirm,select,isCancel,cancel,text}from'@clack/prompts';import rt from'os';import nt from'mri';var M=process.stdout?.columns||80;process.stdout?.rows||24;var A=async e=>existsSync(e),F=e=>readFile(e,"utf8");function Oe(e){return e.replace(/\\/g,"/")}function x(e,t){return Oe(z.join(e,t))}var O=e=>e.replace(/-([a-zA-Z0-9])/g,(t,n)=>n.toUpperCase());var D=()=>!!process.env.npm_lifecycle_event;async function L(){try{if(process.env.DOCKER||process.env.CONTAINER||await A("/.dockerenv"))return !0;if(await A("/proc/1/cgroup")){let e=await F("/proc/1/cgroup");if(e.includes("docker")||e.includes("container"))return !0}return !1}catch{return false}}var U=e=>["turborepo","nx","monorepo"].includes(e);var d=()=>["CI","GITHUB_ACTIONS","BITBUCKET_PIPELINES","BUILDKITE","GITLAB_CI","CIRCLECI","JENKINS_HOME"].some(e=>process.env[e]==="true");async function De(e){return !((e??{}).nonInteractive||!process.stdin.isTTY||!process.stdout.isTTY||d()||D()||await L())}var _=De;var y=!!(process.stdout&&process.stdout.isTTY&&isatty(1));process.platform==="win32";var T={brand:p.cyan,primary:p.cyan,success:p.green,danger:p.red,warning:p.yellow,info:p.blue,dim:p.gray,red:p.red,green:p.green,yellow:p.yellow,blue:p.blue,cyan:p.cyan,magenta:p.magenta,gray:p.gray};({bgRed:p.bgRed,bgGreen:p.bgGreen,bgYellow:p.bgYellow,bgBlue:p.bgBlue,bgMagenta:p.bgMagenta,bgCyan:p.bgCyan,bgWhite:p.bgWhite,bgBlack:p.bgBlack});var b={bold:e=>p.bold(e),italic:e=>p.italic(e),underline:e=>p.underline(e),apply:(...e)=>t=>e.reduce((n,a)=>a(n),t)};var $={default:{brand:e=>p.cyan().bold(e),primary:e=>p.cyan(e),success:e=>p.green().bold(e),danger:e=>p.red().bold(e),warning:e=>p.yellow().bold(e),info:e=>p.blue(e),dim:e=>p.gray(e)},dark:{brand:e=>p.magenta().bold(e),primary:e=>p.white(e),success:e=>p.green(e),danger:e=>p.red(e),warning:e=>p.yellow(e),info:e=>p.cyan(e),dim:e=>p.gray(e)},neon:{brand:e=>p.magenta().bold().underline(e),primary:e=>p.green().bold(e),success:e=>p.cyan().bold(e),danger:e=>p.red().bold(e),warning:e=>p.yellow().bold().underline(e),info:e=>p.blue().bold(e),dim:e=>p.gray(e)},mono:{brand:e=>e,primary:e=>e,success:e=>e,danger:e=>e,warning:e=>e,info:e=>e,dim:e=>e}};var Ue="default";var l=new Proxy({},{get(e,t){return $[Ue][t]}});promisify(exec);var V={silent:0,error:1,warn:2,info:3,debug:4,success:5},B=S.env.APPINIT_LOG_LEVEL||"info",Be=S.env.APPINIT_LOG==="json",ze=S.env.APPINIT_DEBUG==="1",R=S.env.NO_COLOR!=="1";function g(e){let t=V[B];return V[e]<=t}function Ge(e){return e?Ve.inspect(e,{colors:R,depth:5}):""}function k(e,t,n){let a=new Date().toISOString();if(Be)return JSON.stringify({ts:a,level:e,message:t,meta:n});let o=e.toUpperCase();if(R)switch(e){case "debug":o=l.info(o);break;case "info":o=l.primary(o);break;case "warn":o=l.warning(o);break;case "error":o=l.danger(o);break;}let r=R?l.dim(a):a,i=n?" "+Ge(n):"";return `${r} ${o} ${b.bold(t)}${i}`}var v={debug(e,t){ze&&g("debug")&&console.debug(k("debug",e,t));},info(e,t){g("info")&&console.info(k("info",e,t));},warn(e,t){g("warn")&&console.warn(k("warn",e,t));},error(e,t){g("error")&&console.error(k("error",e,t));},raw(e){B!=="silent"&&console.log(e);},step(e){g("info")&&console.log(k("info",`\u25B6 ${e}`));},title(e){g("info")&&console.log(`
3
- `+l.brand(b.bold(`\u{1F680} ${e}`))+`
4
- `);},success(e){g("info")&&console.log(`
5
- `+l.success(b.bold(`\u2714 ${e}`))+`
6
- `);}};var We=[["pnpm","pnpm-lock.yaml"],["yarn","yarn.lock"],["bun","bun.lockb"],["npm","package-lock.json"]];async function G(e){let t=z__default.resolve(e);for(let[n,a]of We)try{return await He.access(z__default.join(t,a)),n}catch{}return "npm"}var Je=/[&|<>*?!%^"'$;{}()=@]/,Ye=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;function H(e){let t=z__default.basename(e);return Ye.test(t)?`The folder name "${t}" is reserved on Windows.`:Je.test(e)?`The path contains forbidden characters: & | < > * ? ! % ^ " ' $ ; { } ( ) = @`:/[. ]$/.test(t)?"Folder name cannot end with a dot or space.":/\/\s|\s\//.test(e.replace(/\\/g,"/"))?"Folder path contains invalid spacing around slashes.":null}async function W(e){let t=process.stdout.columns||80,n="\u2500".repeat(Math.min(t,60));console.log(""),console.log(l.success(n)),console.log(l.success("\u2728 Project created successfully!")),console.log("");let a=await G(e),o="",r="";switch(a){case "pnpm":o="pnpm install",r="pnpm dev";break;case "yarn":o="yarn",r="yarn dev";break;case "bun":o="bun install",r="bun dev";break;default:case "npm":o="npm install",r="npm run dev";break}console.log(b.bold("\u{1F449} Next steps:")),console.log(` ${l.primary(`cd ${e}`)}`),console.log(` ${l.primary(o)}`),console.log(` ${l.primary(r)}`),console.log(""),console.log(l.dim("\u{1F4A1} You\u2019re ready to start building your app.")),console.log(l.dim("\u{1F4A1} Use `appinit add` to include packs, modules, and capabilities.")),console.log(l.dim("\u{1F4A1} Need help? Run `appinit help`")),console.log(""),console.log(l.success(n)),console.log("");}var qe=`
2
+ import*as Ye from'fs';import Ye__default,{readFileSync,statSync,stat,readFile,existsSync,symlinkSync}from'fs';import*as Ee from'path';import Ee__default,{sep,resolve,dirname,extname}from'path';import*as ho from'fs/promises';import ho__default,{mkdir,rm,readFile as readFile$1,cp as cp$1,readdir,lstat}from'fs/promises';import {build}from'esbuild';import Qf,{tmpdir}from'os';import {fileURLToPath,pathToFileURL}from'url';import rf from'crypto';import {PassThrough}from'stream';import {createRequire}from'module';import {exec,spawn}from'child_process';import {note,select,isCancel,cancel,multiselect,confirm,text,spinner}from'@clack/prompts';import Rf,{promisify}from'util';import N from'kleur';import {isatty}from'tty';import mr from'process';import Bf from'http';import Gf from'sirv';import Kf from'chokidar';import Xf from'mri';var Oa=Object.create;var Qn=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var ja=Object.getPrototypeOf,Fa=Object.prototype.hasOwnProperty;var $a=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var We=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Na=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ia(e))!Fa.call(t,i)&&i!==r&&Qn(t,i,{get:()=>e[i],enumerable:!(n=Pa(e,i))||n.enumerable});return t};var Yn=(t,e,r)=>(r=t!=null?Oa(ja(t)):{},Na(Qn(r,"default",{value:t,enumerable:true}),t));var ot=We((nm,ri)=>{var Zn="[^\\\\/]",Ma="(?=.)",Xn="[^/]",yr="(?:\\/|$)",ei="(?:^|\\/)",wr=`\\.{1,2}${yr}`,Ha="(?!\\.)",Va=`(?!${ei}${wr})`,za=`(?!\\.{0,1}${yr})`,qa=`(?!${wr})`,Ua="[^.\\/]",Ba=`${Xn}*?`,Ga="/",ti={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:Ma,QMARK:Xn,END_ANCHOR:yr,DOTS_SLASH:wr,NO_DOT:Ha,NO_DOTS:Va,NO_DOT_SLASH:za,NO_DOTS_SLASH:qa,QMARK_NO_DOT:Ua,STAR:Ba,START_ANCHOR:ei,SEP:Ga},Wa={...ti,SLASH_LITERAL:"[\\\\/]",QMARK:Zn,STAR:`${Zn}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Ka={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};ri.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Ka,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===true?Wa:ti}};});var at=We(oe=>{var{REGEX_BACKSLASH:Ja,REGEX_REMOVE_BACKSLASH:Qa,REGEX_SPECIAL_CHARS:Ya,REGEX_SPECIAL_CHARS_GLOBAL:Za}=ot();oe.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);oe.hasRegexChars=t=>Ya.test(t);oe.isRegexChar=t=>t.length===1&&oe.hasRegexChars(t);oe.escapeRegex=t=>t.replace(Za,"\\$1");oe.toPosixSlashes=t=>t.replace(Ja,"/");oe.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":false};oe.removeBackslashes=t=>t.replace(Qa,e=>e==="\\"?"":e);oe.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?oe.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};oe.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};oe.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===true&&(s=`(?:^(?!${s}).*$)`),s};oe.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n};});var ui=We((sm,ci)=>{var ni=at(),{CHAR_ASTERISK:br,CHAR_AT:Xa,CHAR_BACKWARD_SLASH:lt,CHAR_COMMA:el,CHAR_DOT:vr,CHAR_EXCLAMATION_MARK:xr,CHAR_FORWARD_SLASH:li,CHAR_LEFT_CURLY_BRACE:kr,CHAR_LEFT_PARENTHESES:Sr,CHAR_LEFT_SQUARE_BRACKET:tl,CHAR_PLUS:rl,CHAR_QUESTION_MARK:ii,CHAR_RIGHT_CURLY_BRACE:nl,CHAR_RIGHT_PARENTHESES:si,CHAR_RIGHT_SQUARE_BRACKET:il}=ot(),oi=t=>t===li||t===lt,ai=t=>{t.isPrefix!==true&&(t.depth=t.isGlobstar?1/0:1);},sl=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===true||r.scanToEnd===true,s=[],o=[],a=[],l=t,c=-1,u=0,y=0,d=false,b=false,v=false,E=false,ne=false,G=false,D=false,ie=false,ge=false,ee=false,Z=0,le,x,A={value:"",depth:0,isGlob:false},m=()=>c>=n,se=()=>l.charCodeAt(c+1),z=()=>(le=x,l.charCodeAt(++c));for(;c<n;){x=z();let L;if(x===lt){D=A.backslashes=true,x=z(),x===kr&&(G=true);continue}if(G===true||x===kr){for(Z++;m()!==true&&(x=z());){if(x===lt){D=A.backslashes=true,z();continue}if(x===kr){Z++;continue}if(G!==true&&x===vr&&(x=z())===vr){if(d=A.isBrace=true,v=A.isGlob=true,ee=true,i===true)continue;break}if(G!==true&&x===el){if(d=A.isBrace=true,v=A.isGlob=true,ee=true,i===true)continue;break}if(x===nl&&(Z--,Z===0)){G=false,d=A.isBrace=true,ee=true;break}}if(i===true)continue;break}if(x===li){if(s.push(c),o.push(A),A={value:"",depth:0,isGlob:false},ee===true)continue;if(le===vr&&c===u+1){u+=2;continue}y=c+1;continue}if(r.noext!==true&&(x===rl||x===Xa||x===br||x===ii||x===xr)===true&&se()===Sr){if(v=A.isGlob=true,E=A.isExtglob=true,ee=true,x===xr&&c===u&&(ge=true),i===true){for(;m()!==true&&(x=z());){if(x===lt){D=A.backslashes=true,x=z();continue}if(x===si){v=A.isGlob=true,ee=true;break}}continue}break}if(x===br){if(le===br&&(ne=A.isGlobstar=true),v=A.isGlob=true,ee=true,i===true)continue;break}if(x===ii){if(v=A.isGlob=true,ee=true,i===true)continue;break}if(x===tl){for(;m()!==true&&(L=z());){if(L===lt){D=A.backslashes=true,z();continue}if(L===il){b=A.isBracket=true,v=A.isGlob=true,ee=true;break}}if(i===true)continue;break}if(r.nonegate!==true&&x===xr&&c===u){ie=A.negated=true,u++;continue}if(r.noparen!==true&&x===Sr){if(v=A.isGlob=true,i===true){for(;m()!==true&&(x=z());){if(x===Sr){D=A.backslashes=true,x=z();continue}if(x===si){ee=true;break}}continue}break}if(v===true){if(ee=true,i===true)continue;break}}r.noext===true&&(E=false,v=false);let M=l,p="",f="";u>0&&(p=l.slice(0,u),l=l.slice(u),y-=u),M&&v===true&&y>0?(M=l.slice(0,y),f=l.slice(y)):v===true?(M="",f=l):M=l,M&&M!==""&&M!=="/"&&M!==l&&oi(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===true&&(f&&(f=ni.removeBackslashes(f)),M&&D===true&&(M=ni.removeBackslashes(M)));let ue={prefix:p,input:t,start:u,base:M,glob:f,isBrace:d,isBracket:b,isGlob:v,isExtglob:E,isGlobstar:ne,negated:ie,negatedExtglob:ge};if(r.tokens===true&&(ue.maxDepth=0,oi(x)||o.push(A),ue.tokens=o),r.parts===true||r.tokens===true){let L;for(let F=0;F<s.length;F++){let ke=L?L+1:u,pe=s[F],De=t.slice(ke,pe);r.tokens&&(F===0&&u!==0?(o[F].isPrefix=true,o[F].value=p):o[F].value=De,ai(o[F]),ue.maxDepth+=o[F].depth),(F!==0||De!=="")&&a.push(De),L=pe;}if(L&&L+1<t.length){let F=t.slice(L+1);a.push(F),r.tokens&&(o[o.length-1].value=F,ai(o[o.length-1]),ue.maxDepth+=o[o.length-1].depth);}ue.slashes=s,ue.parts=a;}return ue};ci.exports=sl;});var mi=We((om,fi)=>{var At=ot(),ye=at(),{MAX_LENGTH:Ct,POSIX_REGEX_SOURCE:ol,REGEX_NON_SPECIAL_CHARS:al,REGEX_SPECIAL_CHARS_BACKREF:ll,REPLACEMENTS:pi}=At,cl=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r);}catch{return t.map(i=>ye.escapeRegex(i)).join("..")}return r},Ke=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Tr=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=pi[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Ct,r.maxLength):Ct,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",l=At.globChars(r.windows),c=At.extglobChars(l),{DOT_LITERAL:u,PLUS_LITERAL:y,SLASH_LITERAL:d,ONE_CHAR:b,DOTS_SLASH:v,NO_DOT:E,NO_DOT_SLASH:ne,NO_DOTS_SLASH:G,QMARK:D,QMARK_NO_DOT:ie,STAR:ge,START_ANCHOR:ee}=l,Z=g=>`(${a}(?:(?!${ee}${g.dot?v:u}).)*?)`,le=r.dot?"":E,x=r.dot?D:ie,A=r.bash===true?Z(r):ge;r.capture&&(A=`(${A})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let m={input:t,index:-1,start:0,dot:r.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:o};t=ye.removePrefix(t,m),i=t.length;let se=[],z=[],M=[],p=s,f,ue=()=>m.index===i-1,L=m.peek=(g=1)=>t[m.index+g],F=m.advance=()=>t[++m.index]||"",ke=()=>t.slice(m.index+1),pe=(g="",I=0)=>{m.consumed+=g,m.index+=I;},De=g=>{m.output+=g.output!=null?g.output:g.value,pe(g.value);},Da=()=>{let g=1;for(;L()==="!"&&(L(2)!=="("||L(3)==="?");)F(),m.start++,g++;return g%2===0?false:(m.negated=true,m.start++,true)},St=g=>{m[g]++,M.push(g);},$e=g=>{m[g]--,M.pop();},C=g=>{if(p.type==="globstar"){let I=m.braces>0&&(g.type==="comma"||g.type==="brace"),h=g.extglob===true||se.length&&(g.type==="pipe"||g.type==="paren");g.type!=="slash"&&g.type!=="paren"&&!I&&!h&&(m.output=m.output.slice(0,-p.output.length),p.type="star",p.value="*",p.output=A,m.output+=p.output);}if(se.length&&g.type!=="paren"&&(se[se.length-1].inner+=g.value),(g.value||g.output)&&De(g),p&&p.type==="text"&&g.type==="text"){p.output=(p.output||p.value)+g.value,p.value+=g.value;return}g.prev=p,o.push(g),p=g;},Tt=(g,I)=>{let h={...c[I],conditions:1,inner:""};h.prev=p,h.parens=m.parens,h.output=m.output;let R=(r.capture?"(":"")+h.open;St("parens"),C({type:g,value:I,output:m.output?"":b}),C({type:"paren",extglob:true,value:F(),output:R}),se.push(h);},La=g=>{let I=g.close+(r.capture?")":""),h;if(g.type==="negate"){let R=A;if(g.inner&&g.inner.length>1&&g.inner.includes("/")&&(R=Z(r)),(R!==A||ue()||/^\)+$/.test(ke()))&&(I=g.close=`)$))${R}`),g.inner.includes("*")&&(h=ke())&&/^\.[^\\/.]+$/.test(h)){let $=Tr(h,{...e,fastpaths:false}).output;I=g.close=`)${$})${R})`;}g.prev.type==="bos"&&(m.negatedExtglob=true);}C({type:"paren",extglob:true,value:f,output:I}),$e("parens");};if(r.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(t)){let g=false,I=t.replace(ll,(h,R,$,te,W,gr)=>te==="\\"?(g=true,h):te==="?"?R?R+te+(W?D.repeat(W.length):""):gr===0?x+(W?D.repeat(W.length):""):D.repeat($.length):te==="."?u.repeat($.length):te==="*"?R?R+te+(W?A:""):A:R?h:`\\${h}`);return g===true&&(r.unescape===true?I=I.replace(/\\/g,""):I=I.replace(/\\+/g,h=>h.length%2===0?"\\\\":h?"\\":"")),I===t&&r.contains===true?(m.output=t,m):(m.output=ye.wrapOutput(I,m,e),m)}for(;!ue();){if(f=F(),f==="\0")continue;if(f==="\\"){let h=L();if(h==="/"&&r.bash!==true||h==="."||h===";")continue;if(!h){f+="\\",C({type:"text",value:f});continue}let R=/^\\+/.exec(ke()),$=0;if(R&&R[0].length>2&&($=R[0].length,m.index+=$,$%2!==0&&(f+="\\")),r.unescape===true?f=F():f+=F(),m.brackets===0){C({type:"text",value:f});continue}}if(m.brackets>0&&(f!=="]"||p.value==="["||p.value==="[^")){if(r.posix!==false&&f===":"){let h=p.value.slice(1);if(h.includes("[")&&(p.posix=true,h.includes(":"))){let R=p.value.lastIndexOf("["),$=p.value.slice(0,R),te=p.value.slice(R+2),W=ol[te];if(W){p.value=$+W,m.backtrack=true,F(),!s.output&&o.indexOf(p)===1&&(s.output=b);continue}}}(f==="["&&L()!==":"||f==="-"&&L()==="]")&&(f=`\\${f}`),f==="]"&&(p.value==="["||p.value==="[^")&&(f=`\\${f}`),r.posix===true&&f==="!"&&p.value==="["&&(f="^"),p.value+=f,De({value:f});continue}if(m.quotes===1&&f!=='"'){f=ye.escapeRegex(f),p.value+=f,De({value:f});continue}if(f==='"'){m.quotes=m.quotes===1?0:1,r.keepQuotes===true&&C({type:"text",value:f});continue}if(f==="("){St("parens"),C({type:"paren",value:f});continue}if(f===")"){if(m.parens===0&&r.strictBrackets===true)throw new SyntaxError(Ke("opening","("));let h=se[se.length-1];if(h&&m.parens===h.parens+1){La(se.pop());continue}C({type:"paren",value:f,output:m.parens?")":"\\)"}),$e("parens");continue}if(f==="["){if(r.nobracket===true||!ke().includes("]")){if(r.nobracket!==true&&r.strictBrackets===true)throw new SyntaxError(Ke("closing","]"));f=`\\${f}`;}else St("brackets");C({type:"bracket",value:f});continue}if(f==="]"){if(r.nobracket===true||p&&p.type==="bracket"&&p.value.length===1){C({type:"text",value:f,output:`\\${f}`});continue}if(m.brackets===0){if(r.strictBrackets===true)throw new SyntaxError(Ke("opening","["));C({type:"text",value:f,output:`\\${f}`});continue}$e("brackets");let h=p.value.slice(1);if(p.posix!==true&&h[0]==="^"&&!h.includes("/")&&(f=`/${f}`),p.value+=f,De({value:f}),r.literalBrackets===false||ye.hasRegexChars(h))continue;let R=ye.escapeRegex(p.value);if(m.output=m.output.slice(0,-p.value.length),r.literalBrackets===true){m.output+=R,p.value=R;continue}p.value=`(${a}${R}|${p.value})`,m.output+=p.value;continue}if(f==="{"&&r.nobrace!==true){St("braces");let h={type:"brace",value:f,output:"(",outputIndex:m.output.length,tokensIndex:m.tokens.length};z.push(h),C(h);continue}if(f==="}"){let h=z[z.length-1];if(r.nobrace===true||!h){C({type:"text",value:f,output:f});continue}let R=")";if(h.dots===true){let $=o.slice(),te=[];for(let W=$.length-1;W>=0&&(o.pop(),$[W].type!=="brace");W--)$[W].type!=="dots"&&te.unshift($[W].value);R=cl(te,r),m.backtrack=true;}if(h.comma!==true&&h.dots!==true){let $=m.output.slice(0,h.outputIndex),te=m.tokens.slice(h.tokensIndex);h.value=h.output="\\{",f=R="\\}",m.output=$;for(let W of te)m.output+=W.output||W.value;}C({type:"brace",value:f,output:R}),$e("braces"),z.pop();continue}if(f==="|"){se.length>0&&se[se.length-1].conditions++,C({type:"text",value:f});continue}if(f===","){let h=f,R=z[z.length-1];R&&M[M.length-1]==="braces"&&(R.comma=true,h="|"),C({type:"comma",value:f,output:h});continue}if(f==="/"){if(p.type==="dot"&&m.index===m.start+1){m.start=m.index+1,m.consumed="",m.output="",o.pop(),p=s;continue}C({type:"slash",value:f,output:d});continue}if(f==="."){if(m.braces>0&&p.type==="dot"){p.value==="."&&(p.output=u);let h=z[z.length-1];p.type="dots",p.output+=f,p.value+=f,h.dots=true;continue}if(m.braces+m.parens===0&&p.type!=="bos"&&p.type!=="slash"){C({type:"text",value:f,output:u});continue}C({type:"dot",value:f,output:u});continue}if(f==="?"){if(!(p&&p.value==="(")&&r.noextglob!==true&&L()==="("&&L(2)!=="?"){Tt("qmark",f);continue}if(p&&p.type==="paren"){let R=L(),$=f;(p.value==="("&&!/[!=<:]/.test(R)||R==="<"&&!/<([!=]|\w+>)/.test(ke()))&&($=`\\${f}`),C({type:"text",value:f,output:$});continue}if(r.dot!==true&&(p.type==="slash"||p.type==="bos")){C({type:"qmark",value:f,output:ie});continue}C({type:"qmark",value:f,output:D});continue}if(f==="!"){if(r.noextglob!==true&&L()==="("&&(L(2)!=="?"||!/[!=<:]/.test(L(3)))){Tt("negate",f);continue}if(r.nonegate!==true&&m.index===0){Da();continue}}if(f==="+"){if(r.noextglob!==true&&L()==="("&&L(2)!=="?"){Tt("plus",f);continue}if(p&&p.value==="("||r.regex===false){C({type:"plus",value:f,output:y});continue}if(p&&(p.type==="bracket"||p.type==="paren"||p.type==="brace")||m.parens>0){C({type:"plus",value:f});continue}C({type:"plus",value:y});continue}if(f==="@"){if(r.noextglob!==true&&L()==="("&&L(2)!=="?"){C({type:"at",extglob:true,value:f,output:""});continue}C({type:"text",value:f});continue}if(f!=="*"){(f==="$"||f==="^")&&(f=`\\${f}`);let h=al.exec(ke());h&&(f+=h[0],m.index+=h[0].length),C({type:"text",value:f});continue}if(p&&(p.type==="globstar"||p.star===true)){p.type="star",p.star=true,p.value+=f,p.output=A,m.backtrack=true,m.globstar=true,pe(f);continue}let g=ke();if(r.noextglob!==true&&/^\([^?]/.test(g)){Tt("star",f);continue}if(p.type==="star"){if(r.noglobstar===true){pe(f);continue}let h=p.prev,R=h.prev,$=h.type==="slash"||h.type==="bos",te=R&&(R.type==="star"||R.type==="globstar");if(r.bash===true&&(!$||g[0]&&g[0]!=="/")){C({type:"star",value:f,output:""});continue}let W=m.braces>0&&(h.type==="comma"||h.type==="brace"),gr=se.length&&(h.type==="pipe"||h.type==="paren");if(!$&&h.type!=="paren"&&!W&&!gr){C({type:"star",value:f,output:""});continue}for(;g.slice(0,3)==="/**";){let Rt=t[m.index+4];if(Rt&&Rt!=="/")break;g=g.slice(3),pe("/**",3);}if(h.type==="bos"&&ue()){p.type="globstar",p.value+=f,p.output=Z(r),m.output=p.output,m.globstar=true,pe(f);continue}if(h.type==="slash"&&h.prev.type!=="bos"&&!te&&ue()){m.output=m.output.slice(0,-(h.output+p.output).length),h.output=`(?:${h.output}`,p.type="globstar",p.output=Z(r)+(r.strictSlashes?")":"|$)"),p.value+=f,m.globstar=true,m.output+=h.output+p.output,pe(f);continue}if(h.type==="slash"&&h.prev.type!=="bos"&&g[0]==="/"){let Rt=g[1]!==void 0?"|$":"";m.output=m.output.slice(0,-(h.output+p.output).length),h.output=`(?:${h.output}`,p.type="globstar",p.output=`${Z(r)}${d}|${d}${Rt})`,p.value+=f,m.output+=h.output+p.output,m.globstar=true,pe(f+F()),C({type:"slash",value:"/",output:""});continue}if(h.type==="bos"&&g[0]==="/"){p.type="globstar",p.value+=f,p.output=`(?:^|${d}|${Z(r)}${d})`,m.output=p.output,m.globstar=true,pe(f+F()),C({type:"slash",value:"/",output:""});continue}m.output=m.output.slice(0,-p.output.length),p.type="globstar",p.output=Z(r),p.value+=f,m.output+=p.output,m.globstar=true,pe(f);continue}let I={type:"star",value:f,output:A};if(r.bash===true){I.output=".*?",(p.type==="bos"||p.type==="slash")&&(I.output=le+I.output),C(I);continue}if(p&&(p.type==="bracket"||p.type==="paren")&&r.regex===true){I.output=f,C(I);continue}(m.index===m.start||p.type==="slash"||p.type==="dot")&&(p.type==="dot"?(m.output+=ne,p.output+=ne):r.dot===true?(m.output+=G,p.output+=G):(m.output+=le,p.output+=le),L()!=="*"&&(m.output+=b,p.output+=b)),C(I);}for(;m.brackets>0;){if(r.strictBrackets===true)throw new SyntaxError(Ke("closing","]"));m.output=ye.escapeLast(m.output,"["),$e("brackets");}for(;m.parens>0;){if(r.strictBrackets===true)throw new SyntaxError(Ke("closing",")"));m.output=ye.escapeLast(m.output,"("),$e("parens");}for(;m.braces>0;){if(r.strictBrackets===true)throw new SyntaxError(Ke("closing","}"));m.output=ye.escapeLast(m.output,"{"),$e("braces");}if(r.strictSlashes!==true&&(p.type==="star"||p.type==="bracket")&&C({type:"maybe_slash",value:"",output:`${d}?`}),m.backtrack===true){m.output="";for(let g of m.tokens)m.output+=g.output!=null?g.output:g.value,g.suffix&&(m.output+=g.suffix);}return m};Tr.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Ct,r.maxLength):Ct,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=pi[t]||t;let{DOT_LITERAL:s,SLASH_LITERAL:o,ONE_CHAR:a,DOTS_SLASH:l,NO_DOT:c,NO_DOTS:u,NO_DOTS_SLASH:y,STAR:d,START_ANCHOR:b}=At.globChars(r.windows),v=r.dot?u:c,E=r.dot?y:c,ne=r.capture?"":"?:",G={negated:false,prefix:""},D=r.bash===true?".*?":d;r.capture&&(D=`(${D})`);let ie=le=>le.noglobstar===true?D:`(${ne}(?:(?!${b}${le.dot?l:s}).)*?)`,ge=le=>{switch(le){case "*":return `${v}${a}${D}`;case ".*":return `${s}${a}${D}`;case "*.*":return `${v}${D}${s}${a}${D}`;case "*/*":return `${v}${D}${o}${a}${E}${D}`;case "**":return v+ie(r);case "**/*":return `(?:${v}${ie(r)}${o})?${E}${a}${D}`;case "**/*.*":return `(?:${v}${ie(r)}${o})?${E}${D}${s}${a}${D}`;case "**/.*":return `(?:${v}${ie(r)}${o})?${s}${a}${D}`;default:{let x=/^(.*?)\.(\w+)$/.exec(le);if(!x)return;let A=ge(x[1]);return A?A+s+x[2]:void 0}}},ee=ye.removePrefix(t,G),Z=ge(ee);return Z&&r.strictSlashes!==true&&(Z+=`${o}?`),Z};fi.exports=Tr;});var gi=We((am,di)=>{var ul=ui(),Rr=mi(),hi=at(),pl=ot(),fl=t=>t&&typeof t=="object"&&!Array.isArray(t),H=(t,e,r=false)=>{if(Array.isArray(t)){let u=t.map(d=>H(d,e,r));return d=>{for(let b of u){let v=b(d);if(v)return v}return false}}let n=fl(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=i.windows,o=n?H.compileRe(t,e):H.makeRe(t,e,false,true),a=o.state;delete o.state;let l=()=>false;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};l=H(i.ignore,u,r);}let c=(u,y=false)=>{let{isMatch:d,match:b,output:v}=H.test(u,o,e,{glob:t,posix:s}),E={glob:t,state:a,regex:o,posix:s,input:u,output:v,match:b,isMatch:d};return typeof i.onResult=="function"&&i.onResult(E),d===false?(E.isMatch=false,y?E:false):l(u)?(typeof i.onIgnore=="function"&&i.onIgnore(E),E.isMatch=false,y?E:false):(typeof i.onMatch=="function"&&i.onMatch(E),y?E:true)};return r&&(c.state=a),c};H.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return {isMatch:false,output:""};let s=r||{},o=s.format||(i?hi.toPosixSlashes:null),a=t===n,l=a&&o?o(t):t;return a===false&&(l=o?o(t):t,a=l===n),(a===false||s.capture===true)&&(s.matchBase===true||s.basename===true?a=H.matchBase(t,e,r,i):a=e.exec(l)),{isMatch:!!a,match:a,output:l}};H.matchBase=(t,e,r)=>(e instanceof RegExp?e:H.makeRe(e,r)).test(hi.basename(t));H.isMatch=(t,e,r)=>H(e,r)(t);H.parse=(t,e)=>Array.isArray(t)?t.map(r=>H.parse(r,e)):Rr(t,{...e,fastpaths:false});H.scan=(t,e)=>ul(t,e);H.compileRe=(t,e,r=false,n=false)=>{if(r===true)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===true&&(a=`^(?!${a}).*$`);let l=H.toRegex(a,e);return n===true&&(l.state=t),l};H.makeRe=(t,e={},r=false,n=false)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:false,fastpaths:true};return e.fastpaths!==false&&(t[0]==="."||t[0]==="*")&&(i.output=Rr.fastpaths(t,e)),i.output||(i=Rr(t,e)),H.compileRe(i,e,r,n)};H.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===true)throw r;return /$^/}};H.constants=pl;di.exports=H;});var Ar=We((lm,bi)=>{var yi=gi(),ml=at();function wi(t,e,r=false){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:ml.isWindows()}),yi(t,e,r)}Object.assign(wi,yi);bi.exports=wi;});var xi=Yn(Ar());var q=async t=>mkdir(t,{recursive:true}),Je=async t=>rm(t,{recursive:true,force:true}),U=t=>existsSync(t),Qe=t=>readFile$1(t,"utf8");function xl(t){return t.replace(/\\/g,"/")}function k(t,e){return xl(Ee.join(t,e))}var ct=async(t,e,r)=>{await mkdir(Ee.dirname(e),{recursive:true}),await cp$1(t,e,{recursive:true,force:!(r?.errorOnExist??false)});};async function _t(t,e="",r=[]){let n=[],i=await readdir(t),s=r.length>0?(0, xi.default)(r,{dot:true}):()=>false;for(let o of i){let a=Ee.join(t,o),l=Ee.posix.join(e,o);if(s(l))continue;let c;try{c=await lstat(a);}catch{continue}if(!c.isSymbolicLink())if(c.isDirectory()){let u=await _t(a,l,r);n.push(...u);}else n.push(l);}return n}async function ki(t,e,r){if(r==="dev")try{symlinkSync(t,e,"junction");return}catch{await ct(t,e,{});return}await ct(t,e,{});}var Si=t=>t.replace(/-([a-zA-Z0-9])/g,(e,r)=>r.toUpperCase());var Sl=new Set([".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".svgz",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".wav",".ogg",".webm",".zip",".tar",".gz",".tgz",".rar",".7z",".pdf",".exe",".dll",".bin"]);function Ti(t){return Sl.has(Ee__default.extname(t).toLowerCase())}async function he(t){if(!U(t))return console.warn(`\u26A0 File not found: ${t}`),null;let e=Ee__default.extname(t).toLowerCase();if(e===".json")return JSON.parse(await Qe(t));if(e===".md"||e===".txt"||e===".yaml"||e===".yml")return await Qe(t);if(e===".js"||e===".mjs"||e===".cjs")return await import(pathToFileURL(t).href);if(e===".ts"){let r=Ee__default.join(tmpdir(),`appinit.template.${Date.now()}.mjs`);try{return await build({entryPoints:[t],outfile:r,bundle:!0,platform:"neutral",format:"esm",sourcemap:"inline",target:["es2019"]}),await import(pathToFileURL(r).href)}catch(n){throw console.warn(`\u26A0 esbuild transpile failed for ${t}: ${String(n)}`),n}finally{try{await ho__default.unlink(r);}catch{}}}return await Qe(t)}async function _i(t){let{template:e,templatesDir:r,logger:n,mode:i,builtinTemplatesDir:s}=t;if(!e)throw new Error("ensureTemplateInstalled: template is required");if(e.includes("/")||e.includes(".."))throw new Error(`Invalid template ID: ${e}`);if(i==="dev")throw new Error("ensureTemplateInstalled should not be called in dev mode");let o=k(r,e),a=k(o,"current");if(U(a))return a;if(!s)throw new Error("No built-in templates directory available");let l=k(s,e);if(!U(l))throw new Error(`Template "${e}" is not installed and not available as built-in.`);n?.info?.(`\u{1F4E6} Installing template "${e}"`),console.log("templateRoot",o),await q(o);let c=k(k(o,"versions"),"1.0.0");await q(c),await ct(l,c),await ct(c,a);let u=k(o,"template.json");return U(u)||await ho.writeFile(u,JSON.stringify({id:e,installedAt:new Date().toISOString(),activeVersion:"1.0.0",ats:"1.0",source:"builtin"},null,2)),a}async function Et(t){let e=Ee__default.join(t,"variables","defaults.ts");try{return (await import(e)).defaults??{}}catch{return {}}}function Ei(t){if(typeof t!="object"||!t)throw new Error("Template config must be an object");if(!t.id||typeof t.id!="string")throw new Error("Template config requires a valid 'id'");if(!t.version||typeof t.version!="string")throw new Error("Template config requires a valid 'version'");if(t.appinitSpec!=="1.0")throw new Error(`Unsupported ATS version: ${t.appinitSpec}`);return {...t,projectKind:t.category}}async function Di(t){let e=Ee__default.join(t,"template.config.ts");if(!Ye__default.existsSync(e))throw new Error("Missing required file: template.config.ts");let r=pathToFileURL(e).href,n;try{n=await import(r);}catch(o){throw new Error(`Failed to load template.config.ts: ${o.message}`)}if(!n||typeof n.config!="object")throw new Error("template.config.ts must export a named 'config' object");if("default"in n)throw new Error("Default export is not allowed in template.config.ts");let i=n.config;return Ei(i)}async function Pi(t){let{intent:e}=t,{target:r}=e,n=r.rootDir,i=r.kind,s={rootDir:n,scope:i,intent:e,projectKind:r.projectKind,cliVersion:t.cliVersion,supportedAtsVersions:t.supportedAtsVersions},o=Ee__default.join(n,".appinit");if(Ye__default.existsSync(o)&&(s.appinitDir=o),i==="template"){let a=Ee__default.join(n,"template.config.ts");if(Ye__default.existsSync(a)){s.templateConfigPath=a;let l=await Di(n);s.atsVersion=l.appinitSpec,s.templateId=l.id,s.templateVersion=l.version,s.projectKind=l.projectKind;}}return s}var Ii={id:"appinit-dir",appliesTo:["template"],actors:["template-author"],async run(t){return t.appinitDir?{id:"appinit-dir",title:".appinit directory",status:"ok"}:{id:"appinit-dir",title:".appinit directory",status:"error",message:".appinit directory not found",suggestion:"Initialize the template using AppInit"}}};var ji={id:"appinit-present",appliesTo:["project"],actors:["project-user"],async run(t){return t.rootDir?t.appinitDir?{id:"appinit-present",title:"AppInit management",status:"ok"}:{id:"appinit-present",title:"AppInit management",status:"error",message:"This project is not managed by AppInit",suggestion:"Run `appinit create` to scaffold a new AppInit project"}:{id:"appinit-present",title:"AppInit management",status:"error",message:"Project root could not be determined"}}};var Fi={id:"appinit-root",appliesTo:["template"],actors:["template-author"],async run(t){return t.appinitDir?{id:"appinit-root",title:"AppInit project root",status:"ok"}:{id:"appinit-root",title:"AppInit project root",status:"error",message:"Missing .appinit directory at template root",suggestion:"Ensure you are running the command from a valid AppInit template root"}}};var $i={id:"ats-version",appliesTo:["template"],actors:["template-author"],async run(t){let{atsVersion:e,supportedAtsVersions:r}=t;return e?r.includes(e)?{id:"ats-version",title:"ATS version",status:"ok"}:{id:"ats-version",title:"ATS version",status:"warn",message:`ATS version "${e}" is not supported by this CLI`,suggestion:"Upgrade the AppInit CLI or use a compatible template"}:{id:"ats-version",title:"ATS version",status:"error",message:"ATS version is not declared in template.config.ts",suggestion:"Declare `appinitSpec` (ATS version) in template.config.ts"}}};var Ni={id:"cli-compat",appliesTo:["template"],actors:["template-author"],async run(t){let{cliVersion:e,atsVersion:r,supportedAtsVersions:n}=t;return r?n.includes(r)?{id:"cli-compat",title:"CLI compatibility",status:"ok"}:{id:"cli-compat",title:"CLI compatibility",status:"error",message:`CLI v${e} does not support ATS ${r}`,suggestion:"Upgrade the AppInit CLI or use a compatible template"}:{id:"cli-compat",title:"CLI compatibility",status:"error",message:"Cannot determine CLI compatibility without an ATS version",suggestion:"Declare `appinitSpec` in template.config.ts"}}};var Mi={id:"dependencies-installed",appliesTo:["project"],actors:["project-user"],async run(t){if(!t.rootDir)return {id:"dependencies-installed",title:"Dependencies installed",status:"warn",message:"Project root could not be determined"};let r=Ee__default.join(t.rootDir,"node_modules");return Ye__default.existsSync(r)?{id:"dependencies-installed",title:"Dependencies installed",status:"ok"}:{id:"dependencies-installed",title:"Dependencies installed",status:"warn",message:"Dependencies are not installed",suggestion:"Run your package manager install command (e.g. pnpm install)"}}};var Hi={id:"package-json",appliesTo:["project"],actors:["project-user"],async run(t){if(!t.rootDir)return {id:"package-json",title:"package.json",status:"error",message:"Project root could not be determined"};let e=Ee__default.join(t.rootDir,"package.json");return Ye__default.existsSync(e)?{id:"package-json",title:"package.json",status:"ok"}:{id:"package-json",title:"package.json",status:"error",message:"package.json not found",suggestion:"Ensure this is a valid Node.js project"}}};var zi={id:"project-root",appliesTo:["project"],actors:["project-user"],async run(t){let e=t.rootDir;try{if(!Ye.statSync(e).isDirectory())return {id:"project-root",title:"Project root",status:"error",message:"Resolved project root is not a directory"}}catch{return {id:"project-root",title:"Project root",status:"error",message:"Unable to access the resolved project directory",suggestion:"Run this command inside an AppInit project"}}return {id:"project-root",title:"Project root",status:"ok"}}};var qi={id:"template-config",appliesTo:["template"],actors:["template-author"],async run(t){return t.templateConfigPath?{id:"template-config",title:"template.config.ts",status:"ok"}:{id:"template-config",title:"template.config.ts",status:"error",message:"template.config.ts not found at template root",suggestion:"Ensure your template follows ATS 1.0 and includes template.config.ts at the root"}}};async function Ui(t,e){let r=[];for(let n of e)if(!(n.appliesTo&&!n.appliesTo.includes(t.scope))&&!(n.actors&&!n.actors.includes(t.intent.actor))&&!(n.modes&&!n.modes.includes(t.intent.mode)))try{let i=await n.run(t);Array.isArray(i)?r.push(...i):r.push(i);}catch(i){r.push({id:n.id,title:n.id,status:"error",message:i instanceof Error?i.message:"Unknown error occurred",suggestion:"Please report this issue to AppInit"});}return r}async function Dt(t){let{cwd:e,cliVersion:r,supportedAtsVersions:n,intent:i}=t,s=await Pi({cliVersion:r,supportedAtsVersions:n,intent:i}),a=await Ui(s,[zi,ji,Hi,Mi,Fi,Ii,qi,$i,Ni]);return {ok:a.every(c=>c.status!=="error"),results:a,cwd:e,intent:i}}var Bi=()=>!!process.env.npm_lifecycle_event;async function Gi(){try{if(process.env.DOCKER||process.env.CONTAINER||U("/.dockerenv"))return !0;if(U("/proc/1/cgroup")){let t=await Qe("/proc/1/cgroup");if(t.includes("docker")||t.includes("container"))return !0}return !1}catch{return false}}var Wi=t=>["turborepo","nx","monorepo"].includes(t);function Ki(t,e){let r={writtenFiles:[],overwrittenFiles:[]};function n(i){let s=Ye__default.readdirSync(i,{withFileTypes:true});for(let o of s){let a=Ee__default.join(i,o.name),l=Ee__default.relative(t,a),c=Ee__default.join(e,l);if(o.isDirectory()){Ye__default.mkdirSync(c,{recursive:true}),n(a);continue}Ye__default.existsSync(c)?r.overwrittenFiles.push(l):r.writtenFiles.push(l),Ye__default.mkdirSync(Ee__default.dirname(c),{recursive:true}),Ye__default.renameSync(a,c);}}return n(t),Ye__default.rmSync(t,{recursive:true,force:true}),r}async function Yi(t,e){for(let r of t){let n=Ee__default.join(e,r.dest);Ye__default.mkdirSync(Ee__default.dirname(n),{recursive:true}),Ye__default.writeFileSync(n,r.content);}}async function ut(t,e){t&&await t(e);}function Zi(t,e){let r=[/\{%\s*include\s+/,/\{%\s*render\s+/];for(let n of r)if(n.test(t))throw new Error(`Forbidden Liquid feature in ${e}. ATS 1.0 allows only {{ }}, {% if %}, {% for %}.`)}var ae=class{constructor(e,r,n,i,s){this.kind=e,this.input=r,this.begin=n,this.end=i,this.file=s;}getText(){return this.input.slice(this.begin,this.end)}getPosition(){let[e,r]=[1,1];for(let n=0;n<this.begin;n++)this.input[n]===`
3
+ `?(e++,r=1):r++;return [e,r]}size(){return this.end-this.begin}},Ce=class{liquidMethodMissing(e,r){}},ql=Object.prototype.toString,Xi=String.prototype.toLowerCase,_n=Object.hasOwnProperty;function S(t){return typeof t=="string"}function K(t){return typeof t=="function"}function Ul(t){return t&&K(t.then)}function Ft(t){return t&&K(t.next)&&K(t.throw)&&K(t.return)}function Bl(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function ks(t){return function(...e){return new Promise((r,n)=>{t(...e,(i,s)=>{i?n(i):r(s);});})}}function w(t){return t=_(t),S(t)?t:fe(t)?"":Y(t)?t.map(e=>w(e)).join(""):String(t)}function vt(t){return t=_(t),Y(t)?t:S(t)&&t.length>0?[t]:Wl(t)?Array.from(t):Xt(t)?Object.keys(t).map(e=>[e,t[e]]):[]}function Q(t){return t=_(t),fe(t)?[]:Y(t)?t:[t]}function _(t){return t instanceof Ce&&K(t.valueOf)?t.valueOf():t}function Er(t){return +_(t)||0}function Zt(t){return typeof t=="number"}function Ss(t){return t&&K(t.toLiquid)?Ss(t.toLiquid()):t}function fe(t){return t==null}function Gl(t){return t===void 0}function Y(t){return ql.call(t)==="[object Array]"}function Ts(t){return t&&Zt(t.length)}function Wl(t){return Xt(t)&&Symbol.iterator in t}function es(t,e){t=t||{};for(let r in t)if(_n.call(t,r)&&e(t[r],r,t)===false)break;return t}function Kl(t){return t[t.length-1]}function Xt(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function Rs(t,e,r=1){let n=[];for(let i=t;i<e;i+=r)n.push(i);return n}function ht(t,e,r=" "){return As(t,e,r,(n,i)=>i+n)}function Jl(t,e,r=" "){return As(t,e,r,(n,i)=>n+i)}function As(t,e,r,n){t=String(t);let i=e-t.length;for(;i-- >0;)t=n(t,r);return t}function Cs(t){return t}function Ql(t){return [...t].some(r=>r>="a"&&r<="z")?t.toUpperCase():t.toLowerCase()}function Yl(t,e){return t.length>e?t.slice(0,e-3)+"...":t}function ts(t,e){return t==null&&e==null?0:t==null?1:e==null||(t=Xi.call(t),e=Xi.call(e),t<e)?-1:t>e?1:0}function er(t){return function(...e){return t.call(this,...e.map(_))}}function be(t){return function(...e){return t.call(this,...e.map(Er))}}function En(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function*Ot(t){let e=new Set;for(let r of t){let n=JSON.stringify(r);e.has(n)||(e.add(n),yield r);}}var rs="__liquidClass__",_e=class extends Error{constructor(e,r){super(typeof e=="string"?e:e.message),this.context="",typeof e!="string"&&Object.defineProperty(this,"originalError",{value:e,enumerable:false}),Object.defineProperty(this,"token",{value:r,enumerable:false}),Object.defineProperty(this,rs,{value:"LiquidError",enumerable:false});}update(){Object.defineProperty(this,"context",{value:Zl(this.token),enumerable:false}),this.message=Xl(this.message,this.token),this.stack=this.message+`
4
+ `+this.context+`
5
+ `+this.stack,this.originalError&&(this.stack+=`
6
+ From `+this.originalError.stack);}static is(e){return e?.[rs]==="LiquidError"}},Dr=class extends _e{constructor(e,r){super(e,r),this.name="TokenizationError",super.update();}},Lr=class extends _e{constructor(e,r){super(e,r),this.name="ParseError",this.message=e.message,super.update();}},Or=class extends _e{constructor(e,r){super(e,r.token),this.name="RenderError",this.message=e.message,super.update();}static is(e){return e.name==="RenderError"}},$t=class extends _e{constructor(e){super(e[0],e[0].token),this.errors=e,this.name="LiquidErrors";let r=e.length>1?"s":"";this.message=`${e.length} error${r} found`,super.update();}static is(e){return e.name==="LiquidErrors"}},Pr=class extends _e{constructor(e,r){super(e,r),this.name="UndefinedVariableError",this.message=e.message,super.update();}},Ir=class extends Error{constructor(e){super(`undefined variable: ${e}`),this.name="InternalUndefinedVariableError",this.variableName=e;}},jr=class extends Error{constructor(e){super(e),this.name="AssertionError",this.message=e+"";}};function Zl(t){let[e,r]=t.getPosition(),n=t.input.split(`
7
+ `),i=Math.max(e-2,1),s=Math.min(e+3,n.length);return Rs(i,s+1).map(a=>{let l=a===e?">> ":" ",c=ht(String(a),String(s).length),u=`${l}${c}| `,y=a===e?`
8
+ `+ht("^",r+u.length):"";return u+=n[a-1],u+=y,u}).join(`
9
+ `)}function Xl(t,e){e.file&&(t+=`, file:${e.file}`);let[r,n]=e.getPosition();return t+=`, line:${r}, col:${n}`,t}var O=[0,0,0,0,0,0,0,0,0,20,4,4,4,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,2,8,0,0,0,0,8,0,0,0,64,0,65,0,0,33,33,33,33,33,33,33,33,33,33,0,0,2,2,2,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0],ec=1,et=4,ns=8,_s=16,tc=32,rc=64,nc=128;function Pt(t){let e=t.charCodeAt(0);return e>=128?!O[e]:!!(O[e]&ec)}O[160]=O[5760]=O[6158]=O[8192]=O[8193]=O[8194]=O[8195]=O[8196]=O[8197]=O[8198]=O[8199]=O[8200]=O[8201]=O[8202]=O[8232]=O[8233]=O[8239]=O[8287]=O[12288]=et;O[8220]=O[8221]=nc;function X(t,e){if(!t){let r=typeof e=="function"?e():e||`expect ${t} to be true`;throw new jr(r)}}function Nt(t,e=`unexpected ${JSON.stringify(t)}`){X(!t,e);}var Fr=class extends Ce{equals(e){return fe(_(e))}gt(){return false}geq(){return false}lt(){return false}leq(){return false}valueOf(){return null}},dt=class t extends Ce{equals(e){return e instanceof t?false:(e=_(e),S(e)||Y(e)?e.length===0:Xt(e)?Object.keys(e).length===0:false)}gt(){return false}geq(){return false}lt(){return false}leq(){return false}valueOf(){return ""}static is(e){return e instanceof t}},$r=class t extends dt{equals(e){return e===false||fe(_(e))?true:S(e)?/^\s*$/.test(e):super.equals(e)}static is(e){return e instanceof t}},gt=class extends Ce{constructor(e,r,n){super(),this.i=0,this.length=e,this.name=`${n}-${r}`;}next(){this.i++;}index0(){return this.i}index(){return this.i+1}first(){return this.i===0}last(){return this.i===this.length-1}rindex(){return this.length-this.i}rindex0(){return this.length-this.i-1}valueOf(){return JSON.stringify(this)}},Mt=class{constructor(){this.buffer="";}write(e){this.buffer+=w(e);}},Nr=class{constructor(){this.buffer="",this.stream=new PassThrough;}write(e){this.stream.write(w(e));}error(e){this.stream.emit("error",e);}end(){this.stream.end();}},Mr=class{constructor(){this.buffer="";}write(e){e=_(e),typeof e!="string"&&this.buffer===""?this.buffer=e:this.buffer=w(this.buffer)+w(e);}},Ht=class extends Ce{constructor(e=()=>""){super(),this.superBlockRender=e;}*super(){let e=new Mt;return yield this.superBlockRender(e),e.buffer}};function we(t){return t&&K(t.equals)&&K(t.gt)&&K(t.geq)&&K(t.lt)&&K(t.leq)}var is=new Fr,Es={true:true,false:false,nil:is,null:is,empty:new dt,blank:new $r};function ss(t){let e={};for(let[r,n]of Object.entries(t)){let i=e;for(let s=0;s<r.length;s++){let o=r[s];i[o]=i[o]||{},s===r.length-1&&Pt(r[s])&&(i[o].needBoundary=true),i=i[o];}i.data=n,i.end=true;}return e}var Vt=function(){return Vt=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s]);}return e},Vt.apply(this,arguments)};function J(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s);})}return new(r||(r=Promise))(function(s,o){function a(u){try{c(n.next(u));}catch(y){o(y);}}function l(u){try{c(n.throw(u));}catch(y){o(y);}}function c(u){u.done?s(u.value):i(u.value).then(a,l);}c((n=n.apply(t,[])).next());})}function Te(t){return J(this,void 0,void 0,function*(){if(!Ft(t))return t;let e,r=false,n="next";do{let i=t[n](e);r=i.done,e=i.value,n="next";try{Ft(e)&&(e=Te(e)),Ul(e)&&(e=yield e);}catch(s){n="throw",e=s;}}while(!r);return e})}function Re(t){if(!Ft(t))return t;let e,r=false,n="next";do{let i=t[n](e);if(r=i.done,e=i.value,n="next",Ft(e))try{e=Re(e);}catch(s){n="throw",e=s;}}while(!r);return e}var ic=/%([-_0^#:]+)?(\d+)?([EO])?(.)/;function sc(t){return [31,oc(t)?29:28,31,30,31,30,31,31,30,31,30,31]}function Ds(t){let e=0;for(let r=0;r<t.getMonth();++r)e+=sc(t)[r];return e+t.getDate()}function os(t,e){let r=Ds(t)+(e-t.getDay()),i=7-new Date(t.getFullYear(),0,1).getDay()+e;return String(Math.floor((r-i)/7)+1)}function oc(t){let e=t.getFullYear();return !!((e&3)===0&&(e%100||e%400===0&&e))}function ac(t){let e=t.getDate();if([11,12,13].includes(e))return "th";switch(e%10){case 1:return "st";case 2:return "nd";case 3:return "rd";default:return "th"}}function lc(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}var cc={d:2,e:2,H:2,I:2,j:3,k:2,l:2,L:3,m:2,M:2,S:2,U:2,W:2},uc=new Set("aAbBceklpP");function as(t,e){let r=Math.abs(t.getTimezoneOffset()),n=Math.floor(r/60),i=r%60;return (t.getTimezoneOffset()>0?"-":"+")+ht(n,2,"0")+(e.flags[":"]?":":"")+ht(i,2,"0")}var Hr={a:t=>t.getShortWeekdayName(),A:t=>t.getLongWeekdayName(),b:t=>t.getShortMonthName(),B:t=>t.getLongMonthName(),c:t=>t.toLocaleString(),C:t=>lc(t),d:t=>t.getDate(),e:t=>t.getDate(),H:t=>t.getHours(),I:t=>String(t.getHours()%12||12),j:t=>Ds(t),k:t=>t.getHours(),l:t=>String(t.getHours()%12||12),L:t=>t.getMilliseconds(),m:t=>t.getMonth()+1,M:t=>t.getMinutes(),N:(t,e)=>{let r=Number(e.width)||9,n=String(t.getMilliseconds()).slice(0,r);return Jl(n,r,"0")},p:t=>t.getHours()<12?"AM":"PM",P:t=>t.getHours()<12?"am":"pm",q:t=>ac(t),s:t=>Math.round(t.getTime()/1e3),S:t=>t.getSeconds(),u:t=>t.getDay()||7,U:t=>os(t,0),w:t=>t.getDay(),W:t=>os(t,1),x:t=>t.toLocaleDateString(),X:t=>t.toLocaleTimeString(),y:t=>t.getFullYear().toString().slice(2,4),Y:t=>t.getFullYear(),z:as,Z:(t,e)=>t.getTimeZoneName()||as(t,e),t:()=>" ",n:()=>`
10
+ `,"%":()=>"%"};Hr.h=Hr.b;function It(t,e){let r="",n=e,i;for(;i=ic.exec(n);)r+=n.slice(0,i.index),n=n.slice(i.index+i[0].length),r+=pc(t,i);return r+n}function pc(t,e){let[r,n="",i,s,o]=e,a=Hr[o];if(!a)return r;let l={};for(let d of n)l[d]=true;let c=String(a(t,{flags:l,width:i,modifier:s})),u=uc.has(o)?" ":"0",y=i||cc[o]||0;return l["^"]?c=c.toUpperCase():l["#"]&&(c=Ql(c)),l._?u=" ":l[0]&&(u="0"),l["-"]&&(y=0),ht(c,y,u)}function Ls(){return typeof Intl<"u"?Intl.DateTimeFormat:void 0}var fc=6e4,mc=/([zZ]|([+-])(\d{2}):?(\d{2}))$/,Os=["January","February","March","April","May","June","July","August","September","October","November","December"],hc=Os.map(t=>t.slice(0,3)),Ps=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dc=Ps.map(t=>t.slice(0,3)),Ie=class t{constructor(e,r,n){this.locale=r,this.DateTimeFormat=Ls(),this.date=new Date(e),this.timezoneFixed=n!==void 0,n===void 0&&(n=this.date.getTimezoneOffset()),this.timezoneOffset=S(n)?t.getTimezoneOffset(n,this.date):n,this.timezoneName=S(n)?n:"";let i=(this.date.getTimezoneOffset()-this.timezoneOffset)*fc,s=this.date.getTime()+i;this.displayDate=new Date(s);}getTime(){return this.displayDate.getTime()}getMilliseconds(){return this.displayDate.getMilliseconds()}getSeconds(){return this.displayDate.getSeconds()}getMinutes(){return this.displayDate.getMinutes()}getHours(){return this.displayDate.getHours()}getDay(){return this.displayDate.getDay()}getDate(){return this.displayDate.getDate()}getMonth(){return this.displayDate.getMonth()}getFullYear(){return this.displayDate.getFullYear()}toLocaleString(e,r){return r?.timeZone?this.date.toLocaleString(e,r):this.displayDate.toLocaleString(e,r)}toLocaleTimeString(e){return this.displayDate.toLocaleTimeString(e)}toLocaleDateString(e){return this.displayDate.toLocaleDateString(e)}getTimezoneOffset(){return this.timezoneOffset}getTimeZoneName(){if(this.timezoneFixed)return this.timezoneName;if(this.DateTimeFormat)return this.DateTimeFormat().resolvedOptions().timeZone}getLongMonthName(){var e;return (e=this.format({month:"long"}))!==null&&e!==void 0?e:Os[this.getMonth()]}getShortMonthName(){var e;return (e=this.format({month:"short"}))!==null&&e!==void 0?e:hc[this.getMonth()]}getLongWeekdayName(){var e;return (e=this.format({weekday:"long"}))!==null&&e!==void 0?e:Ps[this.displayDate.getDay()]}getShortWeekdayName(){var e;return (e=this.format({weekday:"short"}))!==null&&e!==void 0?e:dc[this.displayDate.getDay()]}valid(){return !isNaN(this.getTime())}format(e){return this.DateTimeFormat&&this.DateTimeFormat(this.locale,e).format(this.displayDate)}static createDateFixedToTimezone(e,r){let n=e.match(mc);if(n&&n[1]==="Z")return new t(+new Date(e),r,0);if(n&&n[2]&&n[3]&&n[4]){let[,,i,s,o]=n,a=(i==="+"?-1:1)*(parseInt(s,10)*60+parseInt(o,10));return new t(+new Date(e),r,a)}return new t(e,r)}static getTimezoneOffset(e,r){let n=r.toLocaleString("en-US",{timeZone:e}),i=r.toLocaleString("en-US",{timeZone:"UTC"}),s=new Date(n);return (+new Date(i)-+s)/(60*1e3)}},yt=class{constructor(e,r){this.base=0,this.message=`${e} limit exceeded`,this.limit=r;}use(e){e=+e||0,X(this.base+e<=this.limit,this.message),this.base+=e;}check(e){e=+e||0,X(e<=this.limit,this.message);}},wt=class extends ae{constructor(e,[r,n],i,s,o,a,l,c){super(e,i,s,o,c),this.trimLeft=false,this.trimRight=false;let u=i[r]==="-",y=i[n-1]==="-",d=u?r+1:r,b=y?n-1:n;for(;d<b&&O[i.charCodeAt(d)]&et;)d++;for(;b>d&&O[i.charCodeAt(b-1)]&et;)b--;this.contentRange=[d,b],this.trimLeft=u||a,this.trimRight=y||l;}get content(){return this.input.slice(this.contentRange[0],this.contentRange[1])}},zt=class extends wt{constructor(e,r,n,i,s){let{trimTagLeft:o,trimTagRight:a,tagDelimiterLeft:l,tagDelimiterRight:c}=i,[u,y]=[r+l.length,n-c.length];super(P.Tag,[u,y],e,r,n,o,a,s),this.tokenizer=new me(e,i.operators,s,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal tag syntax, tag name expected"),this.tokenizer.skipBlank(),this.args=this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1]);}},Vr=class extends wt{constructor(e,r,n,i,s){let{trimOutputLeft:o,trimOutputRight:a,outputDelimiterLeft:l,outputDelimiterRight:c}=i,u=[r+l.length,n-c.length];super(P.Output,u,e,r,n,o,a,s);}},qt=class extends ae{constructor(e,r,n,i){super(P.HTML,e,r,n,i),this.input=e,this.begin=r,this.end=n,this.file=i,this.trimLeft=0,this.trimRight=0;}getContent(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)}},zr=class extends ae{constructor(e,r,n,i){super(P.Number,e,r,n,i),this.input=e,this.begin=r,this.end=n,this.file=i,this.content=Number(this.getText());}},pt=class extends ae{constructor(e,r,n,i){super(P.Word,e,r,n,i),this.input=e,this.begin=r,this.end=n,this.file=i,this.content=this.getText();}},qr=class extends ae{constructor(e,r,n,i){super(P.Literal,e,r,n,i),this.input=e,this.begin=r,this.end=n,this.file=i,this.literal=this.getText(),this.content=Es[this.literal];}},ls={"==":2,"!=":2,">":2,"<":2,">=":2,"<=":2,contains:2,not:1,and:0,or:0},gc={"==":0,"!=":0,">":0,"<":0,">=":0,"<=":0,contains:0,not:1,and:0,or:0},Ur=class extends ae{constructor(e,r,n,i){super(P.Operator,e,r,n,i),this.input=e,this.begin=r,this.end=n,this.file=i,this.operator=this.getText();}getPrecedence(){let e=this.getText();return e in ls?ls[e]:1}},Ut=class extends ae{constructor(e,r,n,i,s,o){super(P.PropertyAccess,n,i,s,o),this.variable=e,this.props=r;}},Bt=class extends ae{constructor(e,r,n,i,s,o){super(P.Filter,n,i,s,o),this.name=e,this.args=r;}},Br=class extends ae{constructor(e,r,n,i,s,o){super(P.Hash,e,r,n,o),this.input=e,this.begin=r,this.end=n,this.name=i,this.value=s,this.file=o;}},yc=/[\da-fA-F]/,cs=/[0-7]/,us={b:"\b",f:"\f",n:`
11
+ `,r:"\r",t:" ",v:"\v"};function ps(t){let e=t.charCodeAt(0);return e>=97?e-87:e>=65?e-55:e-48}function wc(t){let e="";for(let r=1;r<t.length-1;r++){if(t[r]!=="\\"){e+=t[r];continue}if(us[t[r+1]]!==void 0)e+=us[t[++r]];else if(t[r+1]==="u"){let n=0,i=r+2;for(;i<=r+5&&yc.test(t[i]);)n=n*16+ps(t[i++]);r=i-1,e+=String.fromCharCode(n);}else if(!cs.test(t[r+1]))e+=t[++r];else {let n=r+1,i=0;for(;n<=r+3&&cs.test(t[n]);)i=i*8+ps(t[n++]);r=n-1,e+=String.fromCharCode(i);}}return e}var Gr=class extends ae{constructor(e,r,n,i){super(P.Quoted,e,r,n,i),this.input=e,this.begin=r,this.end=n,this.file=i,this.content=wc(this.getText());}},Wr=class extends ae{constructor(e,r,n,i,s,o){super(P.Range,e,r,n,o),this.input=e,this.begin=r,this.end=n,this.lhs=i,this.rhs=s,this.file=o;}},Kr=class extends wt{constructor(e,r,n,i,s){super(P.Tag,[r,n],e,r,n,false,false,s),this.tokenizer=new me(e,i.operators,s,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal liquid tag syntax"),this.tokenizer.skipBlank();}get args(){return this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}},Jr=class extends ae{constructor(e,r,n,i,s,o){super(P.FilteredValue,n,i,s,o),this.initial=e,this.filters=r,this.input=n,this.begin=i,this.end=s,this.file=o;}},bc={now:()=>Date.now()};function Is(){return typeof global=="object"&&global.performance||typeof window=="object"&&window.performance||bc}var Qr=class{renderTemplatesToNodeStream(e,r){let n=new Nr;return Promise.resolve().then(()=>Te(this.renderTemplates(e,r,n))).then(()=>n.end(),i=>n.error(i)),n.stream}*renderTemplates(e,r,n){n||(n=r.opts.keepOutputType?new Mr:new Mt);let i=[];for(let s of e){r.renderLimit.check(Is().now());try{let o=yield s.render(r,n);if(o&&n.write(o),r.breakCalled||r.continueCalled)break}catch(o){let a=_e.is(o)?o:new Or(o,s);if(r.opts.catchAllErrors)i.push(a);else throw a}}if(i.length)throw new $t(i);return n.buffer}},Yr=class{constructor(e){this.postfix=[...Sc(e)];}*evaluate(e,r){X(e,"unable to evaluate: context not defined");let n=[];for(let i of this.postfix)if(Ms(i)){let s=n.pop(),o;if(gc[i.operator]===1)o=yield e.opts.operators[i.operator](s,e);else {let a=n.pop();o=yield e.opts.operators[i.operator](a,s,e);}n.push(o);}else n.push(yield B(i,e,r));return n[0]}valid(){return !!this.postfix.length}};function*B(t,e,r=false){if(t){if("content"in t)return t.content;if(Qt(t))return yield vc(t,e,r);if(Hs(t))return yield kc(t,e)}}function*vc(t,e,r){let n=[];for(let i of t.props)n.push(yield B(i,e,false));try{if(t.variable){let i=yield B(t.variable,e,r);return yield e._getFromScope(i,n)}else return yield e._get(n)}catch(i){if(r&&i.name==="InternalUndefinedVariableError")return null;throw new Pr(i,t)}}function xc(t){return t.content}function*kc(t,e){let r=yield B(t.lhs,e),n=yield B(t.rhs,e);return e.memoryLimit.use(n-r+1),Rs(+r,+n+1)}function*Sc(t){let e=[];for(let r of t)if(Ms(r)){for(;e.length&&e[e.length-1].getPrecedence()>r.getPrecedence();)yield e.pop();e.push(r);}else yield r;for(;e.length;)yield e.pop();}function Me(t,e){return !tr(t,e)}function tr(t,e){return t=_(t),e.opts.jsTruthy?!t:t===false||t===void 0||t===null}var Tc={"==":Ae,"!=":(t,e)=>!Ae(t,e),">":(t,e)=>we(t)?t.gt(e):we(e)?e.lt(t):_(t)>_(e),"<":(t,e)=>we(t)?t.lt(e):we(e)?e.gt(t):_(t)<_(e),">=":(t,e)=>we(t)?t.geq(e):we(e)?e.leq(t):_(t)>=_(e),"<=":(t,e)=>we(t)?t.leq(e):we(e)?e.geq(t):_(t)<=_(e),contains:(t,e)=>(t=_(t),Y(t)?t.some(r=>Ae(r,e)):K(t?.indexOf)?t.indexOf(_(e))>-1:false),not:(t,e)=>tr(_(t),e),and:(t,e,r)=>Me(_(t),r)&&Me(_(e),r),or:(t,e,r)=>Me(_(t),r)||Me(_(e),r)};function Ae(t,e){return we(t)?t.equals(e):we(e)?e.equals(t):(t=_(t),e=_(e),Y(t)?Y(e)&&Rc(t,e):t===e)}function Rc(t,e){return t.length!==e.length?false:!t.some((r,n)=>!Ae(r,e[n]))}function Ac(t,e){return t.some(r=>Ae(r,e))}var ft=class{constructor(e,r,n,i){this.key=e,this.value=r,this.next=n,this.prev=i;}},Gt=class{constructor(e,r=0){this.limit=e,this.size=r,this.cache={},this.head=new ft("HEAD",null,null,null),this.tail=new ft("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head;}write(e,r){if(this.cache[e])this.cache[e].value=r;else {let n=new ft(e,r,this.head.next,this.head);this.head.next.prev=n,this.head.next=n,this.cache[e]=n,this.size++,this.ensureLimit();}}read(e){if(!this.cache[e])return;let{value:r}=this.cache[e];return this.remove(e),this.write(e,r),r}remove(e){let r=this.cache[e];r.prev.next=r.next,r.next.prev=r.prev,delete this.cache[e],this.size--;}clear(){this.head.next=this.tail,this.tail.prev=this.head,this.size=0,this.cache={};}ensureLimit(){this.size>this.limit&&this.remove(this.tail.prev.key);}};function Cc(t){return createRequire(process.cwd()+"/").resolve(t)}var _c=ks(stat),Ec=ks(readFile);function Dc(t){return J(this,void 0,void 0,function*(){try{return yield _c(t),!0}catch{return false}})}function Lc(t){return Ec(t,"utf8")}function Oc(t){try{return statSync(t),!0}catch{return false}}function Pc(t){return readFileSync(t,"utf8")}function Ic(t,e,r){return extname(e)||(e+=r),resolve(t,e)}function jc(t){try{return Cc(t)}catch{}}function Fc(t){return dirname(t)}function $c(t,e){return t=resolve(t),t=t.endsWith(sep)?t:t+sep,e.startsWith(t)}var Nc=Object.freeze({__proto__:null,exists:Dc,readFile:Lc,existsSync:Oc,readFileSync:Pc,resolve:Ic,fallback:jc,dirname:Fc,contains:$c,sep:sep});function Mc(t,e,...r){return t=_(t),Y(t)||S(t)?t.length?t:e:t===false&&new Map(r).get("allow_false")?false:tr(t,this.context)?e:t}function fs(t,e=0){return JSON.stringify(t,null,e)}function Hc(t,e=0){let r=[];return JSON.stringify(t,function(n,i){if(typeof i!="object"||i===null)return i;for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(i)?"[Circular]":(r.push(i),i)},e)}function Vc(t){return Number(t)}var zc={raw:true,handler:Cs},js={default:Mc,raw:zc,jsonify:fs,to_integer:Vc,json:fs,inspect:Hc},qc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},Uc={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function rr(t){return t=w(t),this.context.memoryLimit.use(t.length),t.replace(/&|<|>|"|'/g,e=>qc[e])}function Bc(t){return rr.call(this,t)}function Gc(t){return t=w(t),this.context.memoryLimit.use(t.length),t.replace(/&(amp|lt|gt|#34|#39);/g,e=>Uc[e])}function Wc(t){return rr.call(this,Gc.call(this,t))}function Kc(t){let e=w(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,`<br />
12
+ `)}function Jc(t){let e=w(t);return this.context.memoryLimit.use(e.length),e.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g,"")}var Qc=Object.freeze({__proto__:null,escape:rr,xml_escape:Bc,escape_once:Wc,newline_to_br:Kc,strip_html:Jc}),Zr=class{constructor(e){this.mapping=e,this.sep="/";}exists(e){return J(this,void 0,void 0,function*(){return this.existsSync(e)})}existsSync(e){return !fe(this.mapping[e])}readFile(e){return J(this,void 0,void 0,function*(){return this.readFileSync(e)})}readFileSync(e){let r=this.mapping[e];if(fe(r))throw new Error(`ENOENT: ${e}`);return r}dirname(e){let r=e.split(this.sep);return r.pop(),r.join(this.sep)}resolve(e,r,n){if(r+=n,e===".")return r;let i=e.split(/\/+/);for(let s of r.split(this.sep))s==="."||s===""||(s===".."?(i.length>1||i[0]!=="")&&i.pop():i.push(s));return i.join(this.sep)}},Ze={root:["."],layouts:["."],partials:["."],relativeReference:true,jekyllInclude:false,keyValueSeparator:":",cache:void 0,extname:"",fs:Nc,dynamicPartials:true,jsTruthy:false,dateFormat:"%A, %B %-e, %Y at %-l:%M %P %z",locale:"",trimTagRight:false,trimTagLeft:false,trimOutputRight:false,trimOutputLeft:false,greedy:true,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",preserveTimezones:false,strictFilters:false,strictVariables:false,ownPropertyOnly:true,lenientIf:false,globals:{},keepOutputType:false,operators:Tc,memoryLimit:1/0,parseLimit:1/0,renderLimit:1/0};function Yc(t){var e,r;if(t.hasOwnProperty("root")&&(t.hasOwnProperty("partials")||(t.partials=t.root),t.hasOwnProperty("layouts")||(t.layouts=t.root)),t.hasOwnProperty("cache")){let n;typeof t.cache=="number"?n=t.cache>0?new Gt(t.cache):void 0:typeof t.cache=="object"?n=t.cache:n=t.cache?new Gt(1024):void 0,t.cache=n;}return t=Object.assign(Object.assign(Object.assign({},Ze),t.jekyllInclude?{dynamicPartials:false}:{}),t),(!t.fs.dirname||!t.fs.sep)&&t.relativeReference&&(console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning"),t.relativeReference=false),t.root=jt(t.root),t.partials=jt(t.partials),t.layouts=jt(t.layouts),t.outputEscape=t.outputEscape&&Zc(t.outputEscape),t.locale||(t.locale=(r=(e=Ls())===null||e===void 0?void 0:e().resolvedOptions().locale)!==null&&r!==void 0?r:"en-US"),t.templates&&(t.fs=new Zr(t.templates),t.relativeReference=true,t.root=t.partials=t.layouts="."),t}function Zc(t){return t==="escape"?rr:t==="json"?js.json:(X(K(t),"`outputEscape` need to be of type string or function"),t)}function jt(t){let e=[];return Y(t)&&(e=t),S(t)&&(e=[t]),e}function Xc(t,e){let r=false;for(let n=0;n<t.length;n++){let i=t[n];iu(i)&&(!r&&i.trimLeft&&eu(t[n-1],e.greedy),qe(i)&&(i.name==="raw"?r=true:i.name==="endraw"&&(r=false)),!r&&i.trimRight&&tu(t[n+1],e.greedy));}}function eu(t,e){if(!t||!Dn(t))return;let r=e?et:_s;for(;O[t.input.charCodeAt(t.end-1-t.trimRight)]&r;)t.trimRight++;}function tu(t,e){if(!t||!Dn(t))return;let r=e?et:_s;for(;O[t.input.charCodeAt(t.begin+t.trimLeft)]&r;)t.trimLeft++;t.input.charAt(t.begin+t.trimLeft)===`
13
+ `&&t.trimLeft++;}var me=class{constructor(e,r=Ze.operators,n,i){this.input=e,this.file=n,this.rawBeginAt=-1,this.p=i?i[0]:0,this.N=i?i[1]:e.length,this.opTrie=ss(r),this.literalTrie=ss(Es);}readExpression(){return new Yr(this.readExpressionTokens())}*readExpressionTokens(){for(;this.p<this.N;){let e=this.readOperator();if(e){yield e;continue}let r=this.readValue();if(r){yield r;continue}return}}readOperator(){this.skipBlank();let e=this.matchTrie(this.opTrie);if(e!==-1)return new Ur(this.input,this.p,this.p=e,this.file)}matchTrie(e){let r=e,n=this.p,i;for(;r[this.input[n]]&&n<this.N;)r=r[this.input[n++]],r.end&&(i=r);return !i||i.needBoundary&&Pt(this.peek(n-this.p))?-1:n}readFilteredValue(){let e=this.p,r=this.readExpression();this.assert(r.valid(),`invalid value expression: ${this.snapshot()}`);let n=this.readFilters();return new Jr(r,n,this.input,e,this.p,this.file)}readFilters(){let e=[];for(;;){let r=this.readFilter();if(!r)return e;e.push(r);}}readFilter(){if(this.skipBlank(),this.end())return null;this.assert(this.read()==="|",'expected "|" before filter');let e=this.readIdentifier();if(!e.size())return this.assert(this.end(),"expected filter name"),null;let r=[];if(this.skipBlank(),this.peek()===":")do{++this.p;let n=this.readFilterArg();n&&r.push(n),this.skipBlank(),this.assert(this.end()||this.peek()===","||this.peek()==="|",()=>`unexpected character ${this.snapshot()}`);}while(this.peek()===",");else if(!(this.peek()==="|"||this.end()))throw this.error('expected ":" after filter name');return new Bt(e.getText(),r,this.input,e.begin,this.p,this.file)}readFilterArg(){let e=this.readValue();if(!e)return;if(this.skipBlank(),this.peek()!==":")return e;++this.p;let r=this.readValue();return [e.getText(),r]}readTopLevelTokens(e=Ze){let r=[];for(;this.p<this.N;){let n=this.readTopLevelToken(e);r.push(n);}return Xc(r,e),r}readTopLevelToken(e){let{tagDelimiterLeft:r,outputDelimiterLeft:n}=e;return this.rawBeginAt>-1?this.readEndrawOrRawContent(e):this.match(r)?this.readTagToken(e):this.match(n)?this.readOutputToken(e):this.readHTMLToken([r,n])}readHTMLToken(e){let r=this.p;for(;this.p<this.N&&!e.some(n=>this.match(n));)++this.p;return new qt(this.input,r,this.p,this.file)}readTagToken(e){let{file:r,input:n}=this,i=this.p;if(this.readToDelimiter(e.tagDelimiterRight)===-1)throw this.error(`tag ${this.snapshot(i)} not closed`,i);let s=new zt(n,i,this.p,e,r);return s.name==="raw"&&(this.rawBeginAt=i),s}readToDelimiter(e,r=false){for(this.skipBlank();this.p<this.N;){if(r&&this.peekType()&ns){this.readQuoted();continue}if(++this.p,this.rmatch(e))return this.p}return -1}readOutputToken(e=Ze){let{file:r,input:n}=this,{outputDelimiterRight:i}=e,s=this.p;if(this.readToDelimiter(i,true)===-1)throw this.error(`output ${this.snapshot(s)} not closed`,s);return new Vr(n,s,this.p,e,r)}readEndrawOrRawContent(e){let{tagDelimiterLeft:r,tagDelimiterRight:n}=e,i=this.p,s=this.readTo(r)-r.length;for(;this.p<this.N;){if(this.readIdentifier().getText()!=="endraw"){s=this.readTo(r)-r.length;continue}for(;this.p<=this.N;){if(this.rmatch(n)){let o=this.p;return i===s?(this.rawBeginAt=-1,new zt(this.input,i,o,e,this.file)):(this.p=s,new qt(this.input,i,s,this.file))}if(this.rmatch(r))break;this.p++;}}throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`,i)}readLiquidTagTokens(e=Ze){let r=[];for(;this.p<this.N;){let n=this.readLiquidTagToken(e);n&&r.push(n);}return r}readLiquidTagToken(e){if(this.skipBlank(),this.end())return;let r=this.p;this.readToDelimiter(`
14
+ `);let n=this.p;return new Kr(this.input,r,n,e,this.file)}error(e,r=this.p){return new Dr(e,new pt(this.input,r,this.N,this.file))}assert(e,r,n){if(!e)throw this.error(typeof r=="function"?r():r,n)}snapshot(e=this.p){return JSON.stringify(Yl(this.input.slice(e,this.N),32))}readWord(){return this.readIdentifier()}readIdentifier(){this.skipBlank();let e=this.p;for(;!this.end()&&Pt(this.peek());)++this.p;return new pt(this.input,e,this.p,this.file)}readNonEmptyIdentifier(){let e=this.readIdentifier();return e.size()?e:void 0}readTagName(){return this.skipBlank(),this.input[this.p]==="#"?this.input.slice(this.p,++this.p):this.readIdentifier().getText()}readHashes(e){let r=[];for(;;){let n=this.readHash(e);if(!n)return r;r.push(n);}}readHash(e){this.skipBlank(),this.peek()===","&&++this.p;let r=this.p,n=this.readNonEmptyIdentifier();if(!n)return;let i;this.skipBlank();let s=S(e)?e:e?"=":":";return this.peek()===s&&(++this.p,i=this.readValue()),new Br(this.input,r,this.p,n,i,this.file)}remaining(){return this.input.slice(this.p,this.N)}advance(e=1){this.p+=e;}end(){return this.p>=this.N}read(){return this.input[this.p++]}readTo(e){for(;this.p<this.N;)if(++this.p,this.rmatch(e))return this.p;return -1}readValue(){this.skipBlank();let e=this.p,r=this.readLiteral()||this.readQuoted()||this.readRange()||this.readNumber(),n=this.readProperties(!r);return n.length?new Ut(r,n,this.input,e,this.p):r}readScopeValue(){this.skipBlank();let e=this.p,r=this.readProperties();if(r.length)return new Ut(void 0,r,this.input,e,this.p)}readProperties(e=true){let r=[];for(;;){if(this.peek()==="["){this.p++;let n=this.readValue()||new pt(this.input,this.p,this.p,this.file);this.assert(this.readTo("]")!==-1,"[ not closed"),r.push(n);continue}if(e&&!r.length){let n=this.readNonEmptyIdentifier();if(n){r.push(n);continue}}if(this.peek()==="."&&this.peek(1)!=="."){this.p++;let n=this.readNonEmptyIdentifier();if(!n)break;r.push(n);continue}break}return r}readNumber(){this.skipBlank();let e=false,r=false,n=0;for(this.peekType()&rc&&n++;this.p+n<=this.N;)if(this.peekType(n)&tc)r=true,n++;else if(this.peek(n)==="."&&this.peek(n+1)!=="."){if(e||!r)return;e=true,n++;}else break;if(r&&!Pt(this.peek(n))){let i=new zr(this.input,this.p,this.p+n,this.file);return this.advance(n),i}}readLiteral(){this.skipBlank();let e=this.matchTrie(this.literalTrie);if(e===-1)return;let r=new qr(this.input,this.p,e,this.file);return this.p=e,r}readRange(){this.skipBlank();let e=this.p;if(this.peek()!=="(")return;++this.p;let r=this.readValueOrThrow();this.skipBlank(),this.assert(this.read()==="."&&this.read()===".","invalid range syntax");let n=this.readValueOrThrow();return this.skipBlank(),this.assert(this.read()===")","invalid range syntax"),new Wr(this.input,e,this.p,r,n,this.file)}readValueOrThrow(){let e=this.readValue();return this.assert(e,()=>`unexpected token ${this.snapshot()}, value expected`),e}readQuoted(){this.skipBlank();let e=this.p;if(!(this.peekType()&ns))return;++this.p;let r=false;for(;this.p<this.N&&(++this.p,!(this.input[this.p-1]===this.input[e]&&!r));)r?r=false:this.input[this.p-1]==="\\"&&(r=true);return new Gr(this.input,e,this.p,this.file)}*readFileNameTemplate(e){let{outputDelimiterLeft:r}=e,n=[","," ",r],i=new Set(n);for(;this.p<this.N&&!i.has(this.peek());)yield this.match(r)?this.readOutputToken(e):this.readHTMLToken(n);}match(e){for(let r=0;r<e.length;r++)if(e[r]!==this.input[this.p+r])return false;return true}rmatch(e){for(let r=0;r<e.length;r++)if(e[e.length-1-r]!==this.input[this.p-1-r])return false;return true}peekType(e=0){return this.p+e>=this.N?0:O[this.input.charCodeAt(this.p+e)]}peek(e=0){return this.p+e>=this.N?"":this.input[this.p+e]}skipBlank(){for(;this.peekType()&et;)++this.p;}},Xr=class{constructor(e,r){this.handlers={},this.stopRequested=false,this.tokens=e,this.parseToken=r;}on(e,r){return this.handlers[e]=r,this}trigger(e,r){let n=this.handlers[e];return n?(n.call(this,r),true):false}start(){this.trigger("start");let e;for(;!this.stopRequested&&(e=this.tokens.shift());){if(this.trigger("token",e)||qe(e)&&this.trigger(`tag:${e.name}`,e))continue;let r=this.parseToken(e,this.tokens);this.trigger("template",r);}return this.stopRequested||this.trigger("end"),this}stop(){return this.stopRequested=true,this}},bt=class{constructor(e){this.token=e;}},j=class extends bt{constructor(e,r,n){super(e),this.name=e.name,this.liquid=n,this.tokenizer=e.tokenizer;}},je=class{constructor(e,r){this.hash={};let n=e instanceof me?e:new me(e,{});for(let i of n.readHashes(r))this.hash[i.name.content]=i.value;}*render(e){let r={};for(let n of Object.keys(this.hash))r[n]=this.hash[n]===void 0?true:yield B(this.hash[n],e);return r}};function ru(t){return class extends j{constructor(e,r,n){super(e,r,n),K(t.parse)&&t.parse.call(this,e,r);}*render(e,r){let n=yield new je(this.token.args,e.opts.keyValueSeparator).render(e);return yield t.render.call(this,e,r,n)}}}function Fs(t){return Y(t)}var Wt=class{constructor(e,r,n){this.token=e,this.name=e.name,this.handler=K(r)?r:K(r?.handler)?r.handler:Cs,this.raw=!K(r)&&!!r?.raw,this.args=e.args,this.liquid=n;}*render(e,r){let n=[];for(let i of this.args)Fs(i)?n.push([i[0],yield B(i[1],r)]):n.push(yield B(i,r));return yield this.handler.apply({context:r,token:this.token,liquid:this.liquid},[e,...n])}},re=class{constructor(e,r){this.filters=[];let n=typeof e=="string"?new me(e,r.options.operators).readFilteredValue():e;this.initial=n.initial,this.filters=n.filters.map(i=>new Wt(i,this.getFilter(r,i.name),r));}*value(e,r){r=r||e.opts.lenientIf&&this.filters.length>0&&this.filters[0].name==="default";let n=yield this.initial.evaluate(e,r);for(let i of this.filters)n=yield i.render(n,e);return n}getFilter(e,r){let n=e.filters[r];return X(n||!e.options.strictFilters,()=>`undefined filter: ${r}`),n}},en=class extends bt{constructor(e,r){var n;super(e);let i=new me(e.input,r.options.operators,e.file,e.contentRange);this.value=new re(i.readFilteredValue(),r);let s=this.value.filters,o=r.options.outputEscape;if(!(!((n=s[s.length-1])===null||n===void 0)&&n.raw)&&o){let a=new Bt(toString.call(o),[],"",0,0);s.push(new Wt(a,o,r));}}*render(e,r){let n=yield this.value.value(e,false);r.write(n);}*arguments(){yield this.value;}},tn=class extends bt{constructor(e){super(e),this.str=e.getContent();}*render(e,r){r.write(this.str);}},Ve=class t{constructor(e,r){this.segments=e,this.location=r;}toString(){return Jt(this.segments,true)}toArray(){function*e(...r){for(let n of r)n instanceof t?yield Array.from(e(...n.segments)):yield n;}return Array.from(e(...this.segments))}},mt=class{constructor(){this.map=new Map;}get(e){let r=Jt([e.segments[0]]);return this.map.has(r)||this.map.set(r,[]),this.map.get(r)}has(e){return this.map.has(Jt([e.segments[0]]))}push(e){this.get(e).push(e);}asObject(){return Object.fromEntries(this.map)}},$s={partials:true};function*Ns(t,e,r){let n=new mt,i=new mt,s=new mt,o=new Kt(new Set),a=new Set;function l(u,y){n.push(u);let d=y.alias(u);if(d!==void 0){let b=d.segments[0];S(b)&&!o.has(b)&&i.push(d);}else {let b=u.segments[0];S(b)&&!y.has(b)&&i.push(u);}for(let b of u.segments)b instanceof Ve&&l(b,y);}function*c(u,y){if(u.arguments)for(let d of u.arguments())for(let b of ms(d))l(b,y);if(u.localScope)for(let d of u.localScope()){y.add(d.content),y.deleteAlias(d.content);let[b,v]=d.getPosition();s.push(new Ve([d.content],{row:b,col:v,file:d.file}));}if(u.children)if(u.partialScope){let d=u.partialScope();if(d===void 0){for(let E of yield u.children(e,r))yield c(E,y);return}if(a.has(d.name))return;let b=new Set,v=d.isolated?new Kt(b):y.push(b);for(let E of d.scope)if(S(E))b.add(E);else {let[ne,G]=E;b.add(ne);let D=Array.from(ms(G));D.length&&v.setAlias(ne,D[0].segments);}for(let E of yield u.children(e,r))yield c(E,v),a.add(d.name);v.pop();}else {u.blockScope&&y.push(new Set(u.blockScope()));for(let d of yield u.children(e,r))yield c(d,y);u.blockScope&&y.pop();}}for(let u of t)yield c(u,o);return {variables:n.asObject(),globals:i.asObject(),locals:s.asObject()}}function Oe(t,e={}){let r=Object.assign(Object.assign({},$s),e);return Te(Ns(t,r.partials,false))}function Pe(t,e={}){let r=Object.assign(Object.assign({},$s),e);return Re(Ns(t,r.partials,true))}var Kt=class{constructor(e){this.stack=[{names:e,aliases:new Map}];}has(e){for(let r of this.stack)if(r.names.has(e))return true;return false}push(e){return this.stack.push({names:e,aliases:new Map}),this}pop(){var e;return (e=this.stack.pop())===null||e===void 0?void 0:e.names}add(e){this.stack[0].names.add(e);}alias(e){let r=e.segments[0];if(!S(r))return;let n=this.getAlias(r);if(n!==void 0)return new Ve([...n,...e.segments.slice(1)],e.location)}setAlias(e,r){this.stack[this.stack.length-1].aliases.set(e,r);}deleteAlias(e){this.stack[this.stack.length-1].aliases.delete(e);}getAlias(e){for(let r of this.stack){if(r.aliases.has(e))return r.aliases.get(e);if(r.names.has(e))return}}};function*ms(t){ce(t)?yield*Xe(t):t instanceof re&&(yield*nu(t));}function*nu(t){for(let e of t.initial.postfix)ce(e)&&(yield*Xe(e));for(let e of t.filters)for(let r of e.args)Fs(r)&&r[1]?yield*Xe(r[1]):ce(r)&&(yield*Xe(r));}function*Xe(t){Hs(t)?(yield*Xe(t.lhs),yield*Xe(t.rhs)):Qt(t)&&(yield rn(t));}function rn(t){let e=[],r=t.file,n=t.props[0];r=r||n.file,sn(n)||ds(n)||gs(n)?e.push(n.content):Qt(n)&&e.push(...rn(n).segments);for(let o of t.props.slice(1))r=r||o.file,sn(o)||ds(o)||gs(o)?e.push(o.content):Qt(o)&&e.push(rn(o));let[i,s]=t.getPosition();return new Ve(e,{row:i,col:s,file:r})}var hs=/^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;function Jt(t,e=false){let r=[],n=t[0];S(n)&&(!e||n.match(hs)?r.push(`${n}`):r.push(`['${n}']`));for(let i of t.slice(1))i instanceof Ve?r.push(`[${Jt(i.segments)}]`):S(i)?i.match(hs)?r.push(`.${i}`):r.push(`['${i}']`):r.push(`[${i}]`);return r.join("")}var ze;(function(t){t.Partials="partials",t.Layouts="layouts",t.Root="root";})(ze||(ze={}));var nn=class{constructor(e){if(this.options=e,e.relativeReference){let r=e.fs.sep;X(r,"`fs.sep` is required for relative reference");let n=new RegExp(["."+r,".."+r,"./","../"].map(i=>Bl(i)).join("|"));this.shouldLoadRelative=i=>n.test(i);}else this.shouldLoadRelative=r=>false;this.contains=this.options.fs.contains||(()=>true);}*lookup(e,r,n,i){let{fs:s}=this.options,o=this.options[r];for(let a of this.candidates(e,o,i,r!==ze.Root))if(n?s.existsSync(a):yield s.exists(a))return a;throw this.lookupError(e,o)}*candidates(e,r,n,i){let{fs:s,extname:o}=this.options;if(this.shouldLoadRelative(e)&&n){let a=s.resolve(this.dirname(n),e,o);for(let l of r)if(!i||this.contains(l,a)){yield a;break}}for(let a of r){let l=s.resolve(a,e,o);(!i||this.contains(a,l))&&(yield l);}if(s.fallback!==void 0){let a=s.fallback(e);a!==void 0&&(yield a);}}dirname(e){let r=this.options.fs;return X(r.dirname,"`fs.dirname` is required for relative reference"),r.dirname(e)}lookupError(e,r){let n=new Error("ENOENT");return n.message=`ENOENT: Failed to lookup "${e}" in "${r}"`,n.code="ENOENT",n}},Se=class{constructor(e){this.liquid=e,this.cache=this.liquid.options.cache,this.fs=this.liquid.options.fs,this.parseFile=this.cache?this._parseFileCached:this._parseFile,this.loader=new nn(this.liquid.options),this.parseLimit=new yt("parse length",e.options.parseLimit);}parse(e,r){e=String(e),this.parseLimit.use(e.length);let i=new me(e,this.liquid.options.operators,r).readTopLevelTokens(this.liquid.options);return this.parseTokens(i)}parseTokens(e){let r,n=[],i=[];for(;r=e.shift();)try{n.push(this.parseToken(r,e));}catch(s){if(this.liquid.options.catchAllErrors)i.push(s);else throw s}if(i.length)throw new $t(i);return n}parseToken(e,r){try{if(qe(e)){let n=this.liquid.tags[e.name];return X(n,`tag "${e.name}" not found`),new n(e,r,this.liquid,this)}return su(e)?new en(e,this.liquid):new tn(e)}catch(n){throw _e.is(n)?n:new Lr(n,e)}}parseStream(e){return new Xr(e,(r,n)=>this.parseToken(r,n))}*_parseFileCached(e,r,n=ze.Root,i){let s=this.cache,o=this.loader.shouldLoadRelative(e)?i+","+e:n+":"+e,a=yield s.read(o);if(a)return a;let l=this._parseFile(e,r,n,i),c=r?yield l:Te(l);s.write(o,c);try{return yield c}catch(u){throw s.remove(o),u}}*_parseFile(e,r,n=ze.Root,i){let s=yield this.loader.lookup(e,n,r,i);return this.parse(r?this.fs.readFileSync(s):yield this.fs.readFile(s),s)}},P;(function(t){t[t.Number=1]="Number",t[t.Literal=2]="Literal",t[t.Tag=4]="Tag",t[t.Output=8]="Output",t[t.HTML=16]="HTML",t[t.Filter=32]="Filter",t[t.Hash=64]="Hash",t[t.PropertyAccess=128]="PropertyAccess",t[t.Word=256]="Word",t[t.Range=512]="Range",t[t.Quoted=1024]="Quoted",t[t.Operator=2048]="Operator",t[t.FilteredValue=4096]="FilteredValue",t[t.Delimited=12]="Delimited";})(P||(P={}));function iu(t){return !!(de(t)&P.Delimited)}function Ms(t){return de(t)===P.Operator}function Dn(t){return de(t)===P.HTML}function su(t){return de(t)===P.Output}function qe(t){return de(t)===P.Tag}function sn(t){return de(t)===P.Quoted}function ds(t){return de(t)===P.Number}function Qt(t){return de(t)===P.PropertyAccess}function gs(t){return de(t)===P.Word}function Hs(t){return de(t)===P.Range}function ce(t){return (de(t)&1667)>0}function de(t){return t?t.kind:-1}var Ne=class t{constructor(e={},r=Ze,n={},{memoryLimit:i,renderLimit:s}={}){var o,a,l,c,u;this.scopes=[{}],this.registers={},this.breakCalled=false,this.continueCalled=false,this.sync=!!n.sync,this.opts=r,this.globals=(o=n.globals)!==null&&o!==void 0?o:r.globals,this.environments=Xt(e)?e:Object(e),this.strictVariables=(a=n.strictVariables)!==null&&a!==void 0?a:this.opts.strictVariables,this.ownPropertyOnly=(l=n.ownPropertyOnly)!==null&&l!==void 0?l:r.ownPropertyOnly,this.memoryLimit=i??new yt("memory alloc",(c=n.memoryLimit)!==null&&c!==void 0?c:r.memoryLimit),this.renderLimit=s??new yt("template render",Is().now()+((u=n.renderLimit)!==null&&u!==void 0?u:r.renderLimit));}getRegister(e){return this.registers[e]=this.registers[e]||{}}setRegister(e,r){return this.registers[e]=r}saveRegister(...e){return e.map(r=>[r,this.getRegister(r)])}restoreRegister(e){return e.forEach(([r,n])=>this.setRegister(r,n))}getAll(){return [this.globals,this.environments,...this.scopes].reduce((e,r)=>Vt(e,r),{})}get(e){return this.getSync(e)}getSync(e){return Re(this._get(e))}*_get(e){let r=this.findScope(e[0]);return yield this._getFromScope(r,e)}getFromScope(e,r){return Re(this._getFromScope(e,r))}*_getFromScope(e,r,n=this.strictVariables){S(r)&&(r=r.split("."));for(let i=0;i<r.length;i++)if(e=yield this.readProperty(e,r[i]),n&&Gl(e))throw new Ir(r.slice(0,i+1).join("."));return e}push(e){return this.scopes.push(e)}pop(){return this.scopes.pop()}bottom(){return this.scopes[0]}spawn(e={}){return new t(e,this.opts,{sync:this.sync,globals:this.globals,strictVariables:this.strictVariables},{renderLimit:this.renderLimit,memoryLimit:this.memoryLimit})}findScope(e){for(let r=this.scopes.length-1;r>=0;r--){let n=this.scopes[r];if(e in n)return n}return e in this.environments?this.environments:this.globals}readProperty(e,r){if(e=Ss(e),r=_(r),fe(e))return e;if(Y(e)&&r<0)return e[e.length+ +r];let n=ou(e,r,this.ownPropertyOnly);return n===void 0&&e instanceof Ce?e.liquidMethodMissing(r,this):K(n)?n.call(e):r==="size"?cu(e):r==="first"?au(e):r==="last"?lu(e):n}};function ou(t,e,r){if(!(r&&!_n.call(t,e)&&!(t instanceof Ce)))return t[e]}function au(t){return Y(t)?t[0]:t.first}function lu(t){return Y(t)?t[t.length-1]:t.last}function cu(t){if(_n.call(t,"size")||t.size!==void 0)return t.size;if(Y(t)||S(t))return t.length;if(typeof t=="object")return Object.keys(t).length}var He;(function(t){t[t.OUTPUT=0]="OUTPUT",t[t.STORE=1]="STORE";})(He||(He={}));var uu=be(Math.abs),pu=be(Math.max),fu=be(Math.min),mu=be(Math.ceil),hu=be((t,e,r=false)=>r?Math.floor(t/e):t/e),du=be(Math.floor),gu=be((t,e)=>t-e),yu=be((t,e)=>t+e),wu=be((t,e)=>t%e),bu=be((t,e)=>t*e);function vu(t,e=0){t=Er(t),e=Er(e);let r=Math.pow(10,e);return Math.round(t*r)/r}var xu=Object.freeze({__proto__:null,abs:uu,at_least:pu,at_most:fu,ceil:mu,divided_by:hu,floor:du,minus:gu,plus:yu,modulo:wu,times:bu,round:vu}),ku=t=>decodeURIComponent(w(t)).replace(/\+/g," "),Su=t=>encodeURIComponent(w(t)).replace(/%20/g,"+"),Tu=t=>encodeURIComponent(w(t)).replace(/%20/g,"+").replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()),Ru=t=>encodeURI(w(t)).replace(/%5B/g,"[").replace(/%5D/g,"]"),ys=/[^\p{M}\p{L}\p{Nd}]+/ug,Au={raw:/\s+/g,default:ys,pretty:/[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug,ascii:/[^A-Za-z0-9]+/g,latin:ys,none:null};function Cu(t,e="default",r=false){t=w(t);let n=Au[e];return n&&(e==="latin"&&(t=_u(t)),t=t.replace(n,"-").replace(/^-|-$/g,"")),r?t:t.toLowerCase()}function _u(t){return t.replace(/[àáâãäå]/g,"a").replace(/[æ]/g,"ae").replace(/[ç]/g,"c").replace(/[èéêë]/g,"e").replace(/[ìíîï]/g,"i").replace(/[ð]/g,"d").replace(/[ñ]/g,"n").replace(/[òóôõöø]/g,"o").replace(/[ùúûü]/g,"u").replace(/[ýÿ]/g,"y").replace(/[ß]/g,"ss").replace(/[œ]/g,"oe").replace(/[þ]/g,"th").replace(/[ẞ]/g,"SS").replace(/[Œ]/g,"OE").replace(/[Þ]/g,"TH")}var Eu=Object.freeze({__proto__:null,url_decode:ku,url_encode:Su,cgi_escape:Tu,uri_escape:Ru,slugify:Cu}),Du=er(function(t,e){let r=Q(t),n=fe(e)?" ":w(e),i=r.length*(1+n.length);return this.context.memoryLimit.use(i),r.join(n)}),Lu=er(t=>Ts(t)?Kl(t):""),Ou=er(t=>Ts(t)?t[0]:""),Pu=er(function(t){let e=Q(t);return this.context.memoryLimit.use(e.length),[...e].reverse()});function*Iu(t,e){let r=[],n=Q(t);this.context.memoryLimit.use(n.length);for(let i of n)r.push([i,e?yield this.context._getFromScope(i,w(e).split("."),false):i]);return r.sort((i,s)=>{let o=i[1],a=s[1];return o<a?-1:o>a?1:0}).map(i=>i[0])}function ju(t,e){let r=w(e),n=e===void 0?ts:(s,o)=>ts(s[r],o[r]),i=Q(t);return this.context.memoryLimit.use(i.length),[...i].sort(n)}var Fu=t=>t&&t.length||0;function*$u(t,e){let r=[],n=Q(t);this.context.memoryLimit.use(n.length);for(let i of n)r.push(yield this.context._getFromScope(i,w(e),false));return r}function*Nu(t,e){let r=0,n=Q(t);for(let i of n){let s=Number(e?yield this.context._getFromScope(i,w(e),false):i);r+=Number.isNaN(s)?0:s;}return r}function Mu(t){let e=Q(t);return this.context.memoryLimit.use(e.length),e.filter(r=>!fe(_(r)))}function Vs(t,e=[]){let r=Q(t),n=Q(e);return this.context.memoryLimit.use(r.length+n.length),r.concat(n)}function Hu(t,e){return Vs.call(this,t,[e])}function Vu(t,e){let r=Q(t);this.context.memoryLimit.use(r.length);let n=[...r];return n.unshift(e),n}function zu(t){let e=[...Q(t)];return e.pop(),e}function qu(t){let e=Q(t);this.context.memoryLimit.use(e.length);let r=[...e];return r.shift(),r}function Uu(t,e,r=1){return t=_(t),fe(t)?[]:(Y(t)||(t=w(t)),e=e<0?t.length+e:e,this.context.memoryLimit.use(r),t.slice(e,e+r))}function zs(t){return this.context.opts.jekyllWhere?e=>dt.is(t)?Ae(e,t):Y(e)?Ac(e,t):Ae(e,t):t===void 0?e=>Me(e,this.context):e=>Ae(e,t)}function*qs(t,e,r,n){let i=[];e=Q(e),this.context.memoryLimit.use(e.length);let s=new me(w(r)).readScopeValue();for(let a of e)i.push(yield B(s,this.context.spawn(a)));let o=zs.call(this,n);return e.filter((a,l)=>o(i[l])===t)}function*Us(t,e,r,n){let i=[],s=new re(w(n),this.liquid),o=Q(e);this.context.memoryLimit.use(o.length);for(let a of o){this.context.push({[r]:a});let l=yield s.value(this.context);this.context.pop(),l===t&&i.push(a);}return i}function*Bu(t,e,r){return yield*qs.call(this,true,t,e,r)}function*Gu(t,e,r){return yield*qs.call(this,false,t,e,r)}function*Wu(t,e,r){return yield*Us.call(this,true,t,e,r)}function*Ku(t,e,r){return yield*Us.call(this,false,t,e,r)}function*Ju(t,e){let r=new Map;t=vt(t);let n=new me(w(e)).readScopeValue();this.context.memoryLimit.use(t.length);for(let i of t){let s=yield B(n,this.context.spawn(i));r.has(s)||r.set(s,[]),r.get(s).push(i);}return [...r.entries()].map(([i,s])=>({name:i,items:s}))}function*Qu(t,e,r){let n=new Map,i=new re(w(r),this.liquid);t=vt(t),this.context.memoryLimit.use(t.length);for(let s of t){this.context.push({[e]:s});let o=yield i.value(this.context);this.context.pop(),n.has(o)||n.set(o,[]),n.get(o).push(s);}return [...n.entries()].map(([s,o])=>({name:s,items:o}))}function*Ln(t,e,r){let n=new me(w(e)).readScopeValue(),i=Q(t),s=zs.call(this,r);for(let o=0;o<i.length;o++){let a=yield B(n,this.context.spawn(i[o]));if(s(a))return [o,i[o]]}}function*On(t,e,r){let n=new re(w(r),this.liquid),i=Q(t);for(let s=0;s<i.length;s++){this.context.push({[e]:i[s]});let o=yield n.value(this.context);if(this.context.pop(),o)return [s,i[s]]}}function*Yu(t,e,r){return !!(yield*Ln.call(this,t,e,r))}function*Zu(t,e,r){return !!(yield*On.call(this,t,e,r))}function*Xu(t,e,r){let n=yield*Ln.call(this,t,e,r);return n?n[0]:void 0}function*ep(t,e,r){let n=yield*On.call(this,t,e,r);return n?n[0]:void 0}function*tp(t,e,r){let n=yield*Ln.call(this,t,e,r);return n?n[1]:void 0}function*rp(t,e,r){let n=yield*On.call(this,t,e,r);return n?n[1]:void 0}function np(t){return t=Q(t),this.context.memoryLimit.use(t.length),[...new Set(t)]}function ip(t,e=1){if(t=_(t),fe(t))return [];Y(t)||(t=w(t)),this.context.memoryLimit.use(e);let r=[...t].sort(()=>Math.random()-.5);return e===1?r[0]:r.slice(0,e)}var sp=Object.freeze({__proto__:null,join:Du,last:Lu,first:Ou,reverse:Pu,sort:Iu,sort_natural:ju,size:Fu,map:$u,sum:Nu,compact:Mu,concat:Vs,push:Hu,unshift:Vu,pop:zu,shift:qu,slice:Uu,where:Bu,reject:Gu,where_exp:Wu,reject_exp:Ku,group_by:Ju,group_by_exp:Qu,has:Yu,has_exp:Zu,find_index:Xu,find_index_exp:ep,find:tp,find_exp:rp,uniq:np,sample:ip});function Pn(t,e,r){var n,i,s;let o=((n=t?.length)!==null&&n!==void 0?n:0)+((i=e?.length)!==null&&i!==void 0?i:0)+((s=r?.length)!==null&&s!==void 0?s:0);this.context.memoryLimit.use(o);let a=Gs(t,this.context.opts,r);return a?(e=_(e),e=fe(e)?this.context.opts.dateFormat:w(e),It(a,e)):t}function op(t){return Pn.call(this,t,"%Y-%m-%dT%H:%M:%S%:z")}function ap(t){return Pn.call(this,t,"%a, %d %b %Y %H:%M:%S %z")}function lp(t,e,r){return Bs.call(this,t,"%b",e,r)}function cp(t,e,r){return Bs.call(this,t,"%B",e,r)}function Bs(t,e,r,n){let i=Gs(t,this.context.opts);if(!i)return t;if(r==="ordinal"){let s=i.getDate();return n==="US"?It(i,`${e} ${s}%q, %Y`):It(i,`${s}%q ${e} %Y`)}return It(i,`%d ${e} %Y`)}function Gs(t,e,r){let n,i=r??e.timezoneOffset,s=e.locale;return t=_(t),t==="now"||t==="today"?n=new Ie(Date.now(),s,i):Zt(t)?n=new Ie(t*1e3,s,i):S(t)?/^\d+$/.test(t)?n=new Ie(+t*1e3,s,i):e.preserveTimezones&&r===void 0?n=Ie.createDateFixedToTimezone(t,s):n=new Ie(t,s,i):n=new Ie(t,s,i),n.valid()?n:void 0}var up=Object.freeze({__proto__:null,date:Pn,date_to_xmlschema:op,date_to_rfc822:ap,date_to_string:lp,date_to_long_string:cp}),Cr=/[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu,ws=/[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu;function pp(t,e){X(arguments.length===2,"append expect 2 arguments");let r=w(t),n=w(e);return this.context.memoryLimit.use(r.length+n.length),r+n}function fp(t,e){X(arguments.length===2,"prepend expect 2 arguments");let r=w(t),n=w(e);return this.context.memoryLimit.use(r.length+n.length),n+r}function mp(t,e){let r=w(t);return this.context.memoryLimit.use(r.length),e?(e=En(w(e)),r.replace(new RegExp(`^[${e}]+`,"g"),"")):r.replace(/^\s+/,"")}function hp(t){let e=w(t);return this.context.memoryLimit.use(e.length),e.toLowerCase()}function dp(t){let e=w(t);return this.context.memoryLimit.use(e.length),w(e).toUpperCase()}function gp(t,e){let r=w(t);return this.context.memoryLimit.use(r.length),r.split(w(e)).join("")}function yp(t,e){let r=w(t);return this.context.memoryLimit.use(r.length),r.replace(w(e),"")}function wp(t,e){let r=w(t);this.context.memoryLimit.use(r.length);let n=w(e),i=r.lastIndexOf(n);return i===-1?r:r.substring(0,i)+r.substring(i+n.length)}function bp(t,e){return t=w(t),this.context.memoryLimit.use(t.length),e?(e=En(w(e)),t.replace(new RegExp(`[${e}]+$`,"g"),"")):t.replace(/\s+$/,"")}function vp(t,e){let r=w(t);this.context.memoryLimit.use(r.length);let n=r.split(w(e));for(;n.length&&n[n.length-1]==="";)n.pop();return n}function xp(t,e){let r=w(t);return this.context.memoryLimit.use(r.length),e?(e=En(w(e)),r.replace(new RegExp(`^[${e}]+`,"g"),"").replace(new RegExp(`[${e}]+$`,"g"),"")):r.trim()}function kp(t){let e=w(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,"")}function Sp(t){return t=w(t),this.context.memoryLimit.use(t.length),t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Tp(t,e,r){let n=w(t);return this.context.memoryLimit.use(n.length),n.split(w(e)).join(r)}function Rp(t,e,r){let n=w(t);return this.context.memoryLimit.use(n.length),n.replace(w(e),r)}function Ap(t,e,r){let n=w(t);this.context.memoryLimit.use(n.length);let i=w(e),s=n.lastIndexOf(i);if(s===-1)return n;let o=w(r);return n.substring(0,s)+o+n.substring(s+i.length)}function Cp(t,e=50,r="..."){let n=w(t);return this.context.memoryLimit.use(n.length),n.length<=e?t:n.substring(0,e-r.length)+r}function _p(t,e=15,r="..."){let n=w(t);this.context.memoryLimit.use(n.length);let i=n.split(/\s+/);e<=0&&(e=1);let s=i.slice(0,e).join(" ");return i.length>=e&&(s+=r),s}function Ep(t){let e=w(t);return this.context.memoryLimit.use(e.length),e.replace(/\s+/g," ")}function Dp(t,e){let r=w(t);if(this.context.memoryLimit.use(r.length),t=r.trim(),!t)return 0;switch(e){case "cjk":return (t.match(Cr)||[]).length+(t.match(ws)||[]).length;case "auto":return Cr.test(t)?t.match(Cr).length+(t.match(ws)||[]).length:t.split(/\s+/).length;default:return t.split(/\s+/).length}}function Lp(t,e="and"){switch(this.context.memoryLimit.use(t.length),t.length){case 0:return "";case 1:return t[0];case 2:return `${t[0]} ${e} ${t[1]}`;default:return `${t.slice(0,-1).join(", ")}, ${e} ${t[t.length-1]}`}}var Op=Object.freeze({__proto__:null,append:pp,prepend:fp,lstrip:mp,downcase:hp,upcase:dp,remove:gp,remove_first:yp,remove_last:wp,rstrip:bp,split:vp,strip:xp,strip_newlines:kp,capitalize:Sp,replace:Tp,replace_first:Rp,replace_last:Ap,truncate:Cp,truncatewords:_p,normalize_whitespace:Ep,number_of_words:Dp,array_to_sentence_string:Lp});function Pp(t){return Buffer.from(t,"utf8").toString("base64")}function Ip(t){return Buffer.from(t,"base64").toString("utf8")}function jp(t){let e=w(t);return this.context.memoryLimit.use(e.length),Pp(e)}function Fp(t){let e=w(t);return this.context.memoryLimit.use(e.length),Ip(e)}var $p=Object.freeze({__proto__:null,base64_encode:jp,base64_decode:Fp}),Np=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Qc),xu),Eu),sp),up),Op),$p),js),on=class extends j{constructor(e,r,n){super(e,r,n),this.identifier=this.tokenizer.readIdentifier(),this.key=this.identifier.content,this.tokenizer.assert(this.key,"expected variable name"),this.tokenizer.skipBlank(),this.tokenizer.assert(this.tokenizer.peek()==="=",'expected "="'),this.tokenizer.advance(),this.value=new re(this.tokenizer.readFilteredValue(),this.liquid);}*render(e){e.bottom()[this.key]=yield this.value.value(e,this.liquid.options.lenientIf);}*arguments(){yield this.value;}*localScope(){yield this.identifier;}},bs=["offset","limit","reversed"],an=class extends j{constructor(e,r,n,i){super(e,r,n);let s=this.tokenizer.readIdentifier(),o=this.tokenizer.readIdentifier(),a=this.tokenizer.readValue();if(!s.size()||o.content!=="in"||!a)throw new Error(`illegal tag: ${e.getText()}`);this.variable=s.content,this.collection=a,this.hash=new je(this.tokenizer,n.options.keyValueSeparator),this.templates=[],this.elseTemplates=[];let l,c=i.parseStream(r).on("start",()=>l=this.templates).on("tag:else",u=>{Nt(u.args),l=this.elseTemplates;}).on("tag:endfor",u=>{Nt(u.args),c.stop();}).on("template",u=>l.push(u)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});c.start();}*render(e,r){let n=this.liquid.renderer,i=vt(yield B(this.collection,e));if(!i.length){yield n.renderTemplates(this.elseTemplates,e,r);return}let s="continue-"+this.variable+"-"+this.collection.getText();e.push({continue:e.getRegister(s)});let o=yield this.hash.render(e);e.pop(),i=(this.liquid.options.orderedFilterParameters?Object.keys(o).filter(c=>bs.includes(c)):bs.filter(c=>o[c]!==void 0)).reduce((c,u)=>u==="offset"?Hp(c,o.offset):u==="limit"?Vp(c,o.limit):Mp(c),i),e.setRegister(s,(o.offset||0)+i.length);let l={forloop:new gt(i.length,this.collection.getText(),this.variable)};e.push(l);for(let c of i){if(l[this.variable]=c,e.continueCalled=e.breakCalled=false,yield n.renderTemplates(this.templates,e,r),e.breakCalled)break;l.forloop.next();}e.continueCalled=e.breakCalled=false,e.pop();}*children(){let e=this.templates.slice();return this.elseTemplates&&e.push(...this.elseTemplates),e}*arguments(){yield this.collection;for(let e of Object.values(this.hash.hash))ce(e)&&(yield e);}blockScope(){return [this.variable,"forloop"]}};function Mp(t){return [...t].reverse()}function Hp(t,e){return t.slice(e)}function Vp(t,e){return t.slice(0,e)}var ln=class extends j{constructor(e,r,n,i){for(super(e,r,n),this.templates=[],this.identifier=this.readVariable(),this.variable=this.identifier.content;r.length;){let s=r.shift();if(qe(s)&&s.name==="endcapture")return;this.templates.push(i.parseToken(s,r));}throw new Error(`tag ${e.getText()} not closed`)}readVariable(){let e=this.tokenizer.readIdentifier();if(e.content||(e=this.tokenizer.readQuoted(),e))return e;throw this.tokenizer.error("invalid capture name")}*render(e){let n=yield this.liquid.renderer.renderTemplates(this.templates,e);e.bottom()[this.variable]=n;}*children(){return this.templates}*localScope(){yield this.identifier;}},cn=class extends j{constructor(e,r,n,i){super(e,r,n),this.branches=[],this.elseTemplates=[],this.value=new re(this.tokenizer.readFilteredValue(),this.liquid),this.elseTemplates=[];let s=[],o=0,a=i.parseStream(r).on("tag:when",l=>{if(o>0)return;s=[];let c=[];for(;!l.tokenizer.end();)c.push(l.tokenizer.readValueOrThrow()),l.tokenizer.skipBlank(),l.tokenizer.peek()===","?l.tokenizer.readTo(","):l.tokenizer.readTo("or");this.branches.push({values:c,templates:s});}).on("tag:else",()=>{o++,s=this.elseTemplates;}).on("tag:endcase",()=>a.stop()).on("template",l=>{(s!==this.elseTemplates||o===1)&&s.push(l);}).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});a.start();}*render(e,r){let n=this.liquid.renderer,i=_(yield this.value.value(e,e.opts.lenientIf)),s=false;for(let o of this.branches)for(let a of o.values){let l=yield B(a,e,e.opts.lenientIf);if(Ae(i,l)){yield n.renderTemplates(o.templates,e,r),s=true;break}}s||(yield n.renderTemplates(this.elseTemplates,e,r));}*arguments(){yield this.value,yield*this.branches.flatMap(e=>e.values);}*children(){let e=this.branches.flatMap(r=>r.templates);return this.elseTemplates&&e.push(...this.elseTemplates),e}},un=class extends j{constructor(e,r,n){for(super(e,r,n);r.length;){let i=r.shift();if(qe(i)&&i.name==="endcomment")return}throw new Error(`tag ${e.getText()} not closed`)}render(){}},pn=class extends j{constructor(e,r,n,i){super(e,r,n);let s=this.tokenizer;for(this.file=In(s,this.liquid,i),this.currentFile=e.file;!s.end();){s.skipBlank();let o=s.p,a=s.readIdentifier();if((a.content==="with"||a.content==="for")&&(s.skipBlank(),s.peek()!==":")){let l=s.readValue();if(l){let c=s.p,u=s.readIdentifier(),y;u.content==="as"?y=s.readIdentifier():s.p=c,this[a.content]={value:l,alias:y&&y.content},s.skipBlank(),s.peek()===","&&s.advance();continue}}s.p=o;break}this.hash=new je(s,n.options.keyValueSeparator);}*render(e,r){let{liquid:n,hash:i}=this,s=yield jn(this.file,e,n);X(s,()=>`illegal file path "${s}"`);let o=e.spawn(),a=o.bottom();if(Vt(a,yield i.render(e)),this.with){let{value:l,alias:c}=this.with;a[c||s]=yield B(l,e);}if(this.for){let{value:l,alias:c}=this.for,u=vt(yield B(l,e));a.forloop=new gt(u.length,l.getText(),c);for(let y of u){a[c]=y;let d=yield n._parsePartialFile(s,o.sync,this.currentFile);yield n.renderer.renderTemplates(d,o,r),a.forloop.next();}}else {let l=yield n._parsePartialFile(s,o.sync,this.currentFile);yield n.renderer.renderTemplates(l,o,r);}}*children(e,r){return e&&S(this.file)?yield this.liquid._parsePartialFile(this.file,r,this.currentFile):[]}partialScope(){if(S(this.file)){let e=Object.keys(this.hash.hash);if(this.with){let{value:r,alias:n}=this.with;S(n)?e.push([n,r]):S(this.file)&&e.push([this.file,r]);}if(this.for){let{value:r,alias:n}=this.for;S(n)?e.push([n,r]):S(this.file)&&e.push([this.file,r]);}return {name:this.file,isolated:true,scope:e}}}*arguments(){for(let e of Object.values(this.hash.hash))ce(e)&&(yield e);if(this.with){let{value:e}=this.with;ce(e)&&(yield e);}if(this.for){let{value:e}=this.for;ce(e)&&(yield e);}}};function In(t,e,r){if(e.options.dynamicPartials){let s=t.readValue();if(t.assert(s,"illegal file path"),s.getText()==="none")return;if(sn(s)){let o=r.parse(xc(s));return vs(o)}return s}let n=[...t.readFileNameTemplate(e.options)],i=vs(r.parseTokens(n));return i==="none"?void 0:i}function vs(t){return t.length===1&&Dn(t[0].token)?t[0].token.getContent():t}function*jn(t,e,r){return typeof t=="string"?t:Array.isArray(t)?r.renderer.renderTemplates(t,e):yield B(t,e)}var fn=class extends j{constructor(e,r,n,i){super(e,r,n);let{tokenizer:s}=e;this.file=In(s,this.liquid,i),this.currentFile=e.file;let o=s.p;s.readIdentifier().content==="with"?(s.skipBlank(),s.peek()!==":"?this.withVar=s.readValue():s.p=o):s.p=o,this.hash=new je(s,n.options.jekyllInclude||n.options.keyValueSeparator);}*render(e,r){let{liquid:n,hash:i,withVar:s}=this,{renderer:o}=n,a=yield jn(this.file,e,n);X(a,()=>`illegal file path "${a}"`);let l=e.saveRegister("blocks","blockMode");e.setRegister("blocks",{}),e.setRegister("blockMode",He.OUTPUT);let c=yield i.render(e);s&&(c[a]=yield B(s,e));let u=yield n._parsePartialFile(a,e.sync,this.currentFile);e.push(e.opts.jekyllInclude?{include:c}:c),yield o.renderTemplates(u,e,r),e.pop(),e.restoreRegister(l);}*children(e,r){return e&&S(this.file)?yield this.liquid._parsePartialFile(this.file,r,this.currentFile):[]}partialScope(){if(S(this.file)){let e;return this.liquid.options.jekyllInclude?e=["include"]:(e=Object.keys(this.hash.hash),this.withVar&&e.push([this.file,this.withVar])),{name:this.file,isolated:false,scope:e}}}*arguments(){yield*Object.values(this.hash.hash).filter(ce),ce(this.file)&&(yield this.file),ce(this.withVar)&&(yield this.withVar);}},mn=class extends j{constructor(e,r,n){super(e,r,n),this.identifier=this.tokenizer.readIdentifier(),this.variable=this.identifier.content;}render(e,r){let n=e.environments;Zt(n[this.variable])||(n[this.variable]=0),r.write(w(--n[this.variable]));}*localScope(){yield this.identifier;}},hn=class extends j{constructor(e,r,n){super(e,r,n),this.candidates=[];let i=this.tokenizer.readValue();for(this.tokenizer.skipBlank(),i&&(this.tokenizer.peek()===":"?(this.group=i,this.tokenizer.advance()):this.candidates.push(i));!this.tokenizer.end();){let s=this.tokenizer.readValue();s&&this.candidates.push(s),this.tokenizer.readTo(",");}this.tokenizer.assert(this.candidates.length,()=>`empty candidates: "${e.getText()}"`);}*render(e,r){let i=`cycle:${yield B(this.group,e)}:`+this.candidates.join(","),s=e.getRegister("cycle"),o=s[i];o===void 0&&(o=s[i]=0);let a=this.candidates[o];return o=(o+1)%this.candidates.length,s[i]=o,yield B(a,e)}*arguments(){yield*this.candidates,this.group&&(yield this.group);}},dn=class extends j{constructor(e,r,n,i){super(e,r,n),this.branches=[];let s=[];i.parseStream(r).on("start",()=>this.branches.push({value:new re(e.tokenizer.readFilteredValue(),this.liquid),templates:s=[]})).on("tag:elsif",o=>{X(!this.elseTemplates,"unexpected elsif after else"),this.branches.push({value:new re(o.tokenizer.readFilteredValue(),this.liquid),templates:s=[]});}).on("tag:else",o=>{Nt(o.args),X(!this.elseTemplates,"duplicated else"),s=this.elseTemplates=[];}).on("tag:endif",function(o){Nt(o.args),this.stop();}).on("template",o=>s.push(o)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start();}*render(e,r){let n=this.liquid.renderer;for(let{value:i,templates:s}of this.branches){let o=yield i.value(e,e.opts.lenientIf);if(Me(o,e)){yield n.renderTemplates(s,e,r);return}}yield n.renderTemplates(this.elseTemplates||[],e,r);}*children(){let e=this.branches.flatMap(r=>r.templates);return this.elseTemplates&&e.push(...this.elseTemplates),e}arguments(){return this.branches.map(e=>e.value)}},gn=class extends j{constructor(e,r,n){super(e,r,n),this.identifier=this.tokenizer.readIdentifier(),this.variable=this.identifier.content;}render(e,r){let n=e.environments;Zt(n[this.variable])||(n[this.variable]=0);let i=n[this.variable];n[this.variable]++,r.write(w(i));}*localScope(){yield this.identifier;}},yn=class extends j{constructor(e,r,n,i){super(e,r,n),this.file=In(this.tokenizer,this.liquid,i),this.currentFile=e.file,this.args=new je(this.tokenizer,n.options.keyValueSeparator),this.templates=i.parseTokens(r);}*render(e,r){let{liquid:n,args:i,file:s}=this,{renderer:o}=n;if(s===void 0){e.setRegister("blockMode",He.OUTPUT),yield o.renderTemplates(this.templates,e,r);return}let a=yield jn(this.file,e,n);X(a,()=>`illegal file path "${a}"`);let l=yield n._parseLayoutFile(a,e.sync,this.currentFile);e.setRegister("blockMode",He.STORE);let c=yield o.renderTemplates(this.templates,e),u=e.getRegister("blocks");u[""]===void 0&&(u[""]=(y,d)=>d.write(c)),e.setRegister("blockMode",He.OUTPUT),e.push(yield i.render(e)),yield o.renderTemplates(l,e,r),e.pop();}*children(e){let r=this.templates.slice();return e&&S(this.file)&&r.push(...yield this.liquid._parsePartialFile(this.file,true,this.currentFile)),r}*arguments(){for(let e of Object.values(this.args.hash))ce(e)&&(yield e);ce(this.file)&&(yield this.file);}partialScope(){if(S(this.file))return {name:this.file,isolated:false,scope:Object.keys(this.args.hash)}}},wn=class extends j{constructor(e,r,n,i){super(e,r,n),this.templates=[];let s=/\w+/.exec(e.args);for(this.block=s?s[0]:"";r.length;){let o=r.shift();if(qe(o)&&o.name==="endblock")return;let a=i.parseToken(o,r);this.templates.push(a);}throw new Error(`tag ${e.getText()} not closed`)}*render(e,r){let n=this.getBlockRender(e);e.getRegister("blockMode")===He.STORE?e.getRegister("blocks")[this.block]=n:yield n(new Ht,r);}getBlockRender(e){let{liquid:r,templates:n}=this,i=e.getRegister("blocks")[this.block],s=function*(o,a){e.push({block:o}),yield r.renderer.renderTemplates(n,e,a),e.pop();};return i?(o,a)=>i(new Ht(l=>s(o,l)),a):s}*children(){return this.templates}blockScope(){return ["block"]}},bn=class extends j{constructor(e,r,n){for(super(e,r,n),this.tokens=[];r.length;){let i=r.shift();if(qe(i)&&i.name==="endraw")return;this.tokens.push(i);}throw new Error(`tag ${e.getText()} not closed`)}render(){return this.tokens.map(e=>e.getText()).join("")}},vn=class extends gt{constructor(e,r,n,i){super(e,n,i),this.length=e,this.cols=r;}row(){return Math.floor(this.i/this.cols)+1}col0(){return this.i%this.cols}col(){return this.col0()+1}col_first(){return this.col0()===0}col_last(){return this.col()===this.cols}},xn=class extends j{constructor(e,r,n,i){super(e,r,n);let s=this.tokenizer.readIdentifier();this.tokenizer.skipBlank();let o=this.tokenizer.readIdentifier(),a=this.tokenizer.readValue();if(o.content!=="in"||!a)throw new Error(`illegal tag: ${e.getText()}`);this.variable=s.content,this.collection=a,this.args=new je(this.tokenizer,n.options.keyValueSeparator),this.templates=[];let l,c=i.parseStream(r).on("start",()=>l=this.templates).on("tag:endtablerow",()=>c.stop()).on("template",u=>l.push(u)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});c.start();}*render(e,r){let n=vt(yield B(this.collection,e)),i=yield this.args.render(e),s=i.offset||0,o=i.limit===void 0?n.length:i.limit;n=n.slice(s,s+o);let a=i.cols||n.length,l=this.liquid.renderer,c=new vn(n.length,a,this.collection.getText(),this.variable),u={tablerowloop:c};e.push(u);for(let y=0;y<n.length;y++,c.next())u[this.variable]=n[y],c.col0()===0&&(c.row()!==1&&r.write("</tr>"),r.write(`<tr class="row${c.row()}">`)),r.write(`<td class="col${c.col()}">`),yield l.renderTemplates(this.templates,e,r),r.write("</td>");n.length&&r.write("</tr>"),e.pop();}*children(){return this.templates}*arguments(){yield this.collection;for(let e of Object.values(this.args.hash))ce(e)&&(yield e);}blockScope(){return [this.variable,"tablerowloop"]}},kn=class extends j{constructor(e,r,n,i){super(e,r,n),this.branches=[],this.elseTemplates=[];let s=[],o=0;i.parseStream(r).on("start",()=>this.branches.push({value:new re(e.tokenizer.readFilteredValue(),this.liquid),test:tr,templates:s=[]})).on("tag:elsif",a=>{if(o>0){s=[];return}this.branches.push({value:new re(a.tokenizer.readFilteredValue(),this.liquid),test:Me,templates:s=[]});}).on("tag:else",()=>{o++,s=this.elseTemplates;}).on("tag:endunless",function(){this.stop();}).on("template",a=>{(s!==this.elseTemplates||o===1)&&s.push(a);}).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start();}*render(e,r){let n=this.liquid.renderer;for(let{value:i,test:s,templates:o}of this.branches){let a=yield i.value(e,e.opts.lenientIf);if(s(a,e)){yield n.renderTemplates(o,e,r);return}}yield n.renderTemplates(this.elseTemplates,e,r);}*children(){let e=this.branches.flatMap(r=>r.templates);return this.elseTemplates&&e.push(...this.elseTemplates),e}arguments(){return this.branches.map(e=>e.value)}},Sn=class extends j{render(e,r){e.breakCalled=true;}},Tn=class extends j{render(e,r){e.continueCalled=true;}},Rn=class extends j{constructor(e,r,n){super(e,r,n),this.tokenizer.skipBlank(),this.tokenizer.end()||(this.value=new re(this.tokenizer.readFilteredValue(),this.liquid));}*render(e,r){if(!this.value)return;let n=yield this.value.value(e,false);r.write(n);}*arguments(){this.value&&(yield this.value);}},An=class extends j{constructor(e,r,n,i){super(e,r,n);let s=this.tokenizer.readLiquidTagTokens(this.liquid.options);this.templates=i.parseTokens(s);}*render(e,r){yield this.liquid.renderer.renderTemplates(this.templates,e,r);}*children(){return this.templates}},Cn=class extends j{constructor(e,r,n){if(super(e,r,n),e.args.search(/\n\s*[^#\s]/g)!==-1)throw new Error("every line of an inline comment must start with a '#' character")}render(){}},zp={assign:on,for:an,capture:ln,case:cn,comment:un,include:fn,render:pn,decrement:mn,increment:gn,cycle:hn,if:dn,layout:yn,block:wn,raw:bn,tablerow:xn,unless:kn,break:Sn,continue:Tn,echo:Rn,liquid:An,"#":Cn},Yt=class t{constructor(e={}){this.renderer=new Qr,this.filters={},this.tags={},this.options=Yc(e),this.parser=new Se(this),es(zp,(r,n)=>this.registerTag(n,r)),es(Np,(r,n)=>this.registerFilter(n,r));}parse(e,r){return new Se(this).parse(e,r)}_render(e,r,n){let i=r instanceof Ne?r:new Ne(r,this.options,n);return this.renderer.renderTemplates(e,i)}render(e,r,n){return J(this,void 0,void 0,function*(){return Te(this._render(e,r,Object.assign(Object.assign({},n),{sync:false})))})}renderSync(e,r,n){return Re(this._render(e,r,Object.assign(Object.assign({},n),{sync:true})))}renderToNodeStream(e,r,n={}){let i=new Ne(r,this.options,n);return this.renderer.renderTemplatesToNodeStream(e,i)}_parseAndRender(e,r,n){let i=this.parse(e);return this._render(i,r,n)}parseAndRender(e,r,n){return J(this,void 0,void 0,function*(){return Te(this._parseAndRender(e,r,Object.assign(Object.assign({},n),{sync:false})))})}parseAndRenderSync(e,r,n){return Re(this._parseAndRender(e,r,Object.assign(Object.assign({},n),{sync:true})))}_parsePartialFile(e,r,n){return new Se(this).parseFile(e,r,ze.Partials,n)}_parseLayoutFile(e,r,n){return new Se(this).parseFile(e,r,ze.Layouts,n)}_parseFile(e,r,n,i){return new Se(this).parseFile(e,r,n,i)}parseFile(e,r){return J(this,void 0,void 0,function*(){return Te(new Se(this).parseFile(e,false,r))})}parseFileSync(e,r){return Re(new Se(this).parseFile(e,true,r))}*_renderFile(e,r,n){let i=yield this._parseFile(e,n.sync,n.lookupType);return yield this._render(i,r,n)}renderFile(e,r,n){return J(this,void 0,void 0,function*(){return Te(this._renderFile(e,r,Object.assign(Object.assign({},n),{sync:false})))})}renderFileSync(e,r,n){return Re(this._renderFile(e,r,Object.assign(Object.assign({},n),{sync:true})))}renderFileToNodeStream(e,r,n){return J(this,void 0,void 0,function*(){let i=yield this.parseFile(e);return this.renderToNodeStream(i,r,n)})}_evalValue(e,r){let n=new re(e,this),i=r instanceof Ne?r:new Ne(r,this.options);return n.value(i)}evalValue(e,r){return J(this,void 0,void 0,function*(){return Te(this._evalValue(e,r))})}evalValueSync(e,r){return Re(this._evalValue(e,r))}registerFilter(e,r){this.filters[e]=r;}registerTag(e,r){this.tags[e]=K(r)?r:ru(r);}plugin(e){return e.call(this,t)}express(){let e=this,r=true;return function(n,i,s){if(r){r=false;let o=jt(this.root);e.options.root.unshift(...o),e.options.layouts.unshift(...o),e.options.partials.unshift(...o);}e.renderFile(n,i).then(o=>s(null,o),s);}}analyze(e,r={}){return J(this,void 0,void 0,function*(){return Oe(e,r)})}analyzeSync(e,r={}){return Pe(e,r)}parseAndAnalyze(e,r,n={}){return J(this,void 0,void 0,function*(){return Oe(this.parse(e,r),n)})}parseAndAnalyzeSync(e,r,n={}){return Pe(this.parse(e,r),n)}variables(e,r={}){return J(this,void 0,void 0,function*(){let n=yield Oe(S(e)?this.parse(e):e,r);return Object.keys(n.variables)})}variablesSync(e,r={}){let n=Pe(S(e)?this.parse(e):e,r);return Object.keys(n.variables)}fullVariables(e,r={}){return J(this,void 0,void 0,function*(){let n=yield Oe(S(e)?this.parse(e):e,r);return Array.from(new Set(Object.values(n.variables).flatMap(i=>i.map(s=>String(s)))))})}fullVariablesSync(e,r={}){let n=Pe(S(e)?this.parse(e):e,r);return Array.from(new Set(Object.values(n.variables).flatMap(i=>i.map(s=>String(s)))))}variableSegments(e,r={}){return J(this,void 0,void 0,function*(){let n=yield Oe(S(e)?this.parse(e):e,r);return Array.from(Ot(Object.values(n.variables).flatMap(i=>i.map(s=>s.toArray()))))})}variableSegmentsSync(e,r={}){let n=Pe(S(e)?this.parse(e):e,r);return Array.from(Ot(Object.values(n.variables).flatMap(i=>i.map(s=>s.toArray()))))}globalVariables(e,r={}){return J(this,void 0,void 0,function*(){let n=yield Oe(S(e)?this.parse(e):e,r);return Object.keys(n.globals)})}globalVariablesSync(e,r={}){let n=Pe(S(e)?this.parse(e):e,r);return Object.keys(n.globals)}globalFullVariables(e,r={}){return J(this,void 0,void 0,function*(){let n=yield Oe(S(e)?this.parse(e):e,r);return Array.from(new Set(Object.values(n.globals).flatMap(i=>i.map(s=>String(s)))))})}globalFullVariablesSync(e,r={}){let n=Pe(S(e)?this.parse(e):e,r);return Array.from(new Set(Object.values(n.globals).flatMap(i=>i.map(s=>String(s)))))}globalVariableSegments(e,r={}){return J(this,void 0,void 0,function*(){let n=yield Oe(S(e)?this.parse(e):e,r);return Array.from(Ot(Object.values(n.globals).flatMap(i=>i.map(s=>s.toArray()))))})}globalVariableSegmentsSync(e,r={}){let n=Pe(S(e)?this.parse(e):e,r);return Array.from(Ot(Object.values(n.globals).flatMap(i=>i.map(s=>s.toArray()))))}};function Ws(t){t.registerFilter("kebab",e=>String(e).replace(/\s+/g,"-").toLowerCase()),t.registerFilter("camel",e=>String(e).replace(/-./g,r=>r[1].toUpperCase())),t.registerFilter("json",e=>JSON.stringify(e,null,2));}var Ks=new Yt({extname:".liquid",strictVariables:true,strictFilters:true,trimTagRight:true,trimTagLeft:true});Ws(Ks);async function Js(t,e){return Ks.parseAndRender(t,e)}function Qs(t,e){return t.replace(/%%\s*([\w.-]+)\s*%%/g,(r,n)=>{let i=e[n];return i==null?"":String(i)})}async function Zs(t){let{file:e,engine:r,variables:n}=t;if(e.isBinary)return {dest:e.dest,content:Ye__default.readFileSync(e.src)};let i=Ye__default.readFileSync(e.src,"utf8");if(i=Qs(i,n),!e.isTemplate)return {dest:e.dest,content:i};if(r==="none")throw new Error(`Template file encountered but engine is "none": ${e.dest}`);return Zi(i,e.dest),{dest:e.dest,content:await Js(i,n)}}async function Xs(t){let{template:e,variables:r,outputDir:n,logger:i}=t,s=[];await ut(e.hooks.beforeRender,{template:e,variables:r,logger:i});for(let o of e.vfs.list())s.push(await Zs({file:o,engine:e.config.engine,variables:r}));await ut(e.hooks.afterRender,{template:e,variables:r,logger:i}),await ut(e.hooks.beforeWrite,{template:e,variables:r,logger:i}),await Yi(s,n),await ut(e.hooks.afterWrite,{template:e,variables:r,logger:i});}var qp=["beforeRender","afterRender","beforeWrite","afterWrite"];async function ro(t,e){let r=Ee__default.resolve(t,e.paths?.hooks??"hooks");if(!Ye__default.existsSync(r))return {};let n={};for(let i of qp){let s=Ee__default.join(r,`${i}.ts`);if(!Ye__default.existsSync(s))continue;let o=await he(s),a=o?.default??o;if(typeof a!="function")throw new Error(`Hook "${i}" must export a function (${s})`);n[i]=a;}return n}async function no(t,e){let r=Ee__default.resolve(t,e.paths?.variables??"variables");if(!Ye__default.existsSync(r))return {defaults:{},schema:{}};let n=Ee__default.join(r,"defaults.ts"),i=Ee__default.join(r,"schema.ts"),s=Ee__default.join(r,"transform.ts"),o={},a={},l;if(Ye__default.existsSync(n)){let c=await he(n);if(o=c?.defaults??c?.default??c,!o||typeof o!="object")throw new Error("variables/defaults.ts must export an object")}if(Ye__default.existsSync(i)){let c=await he(i);if(a=c?.schema??c?.default??c,!a||typeof a!="object")throw new Error("variables/schema.ts must export an object")}if(Ye__default.existsSync(s)){let c=await he(s);if(l=c?.transform??c?.default??c,typeof l!="function")throw new Error("variables/transform.ts must export a function")}return {defaults:o,schema:a,transform:l}}var oo=Yn(Ar());function io(t){let e=t.endsWith("__tmpl"),r=e?t.slice(0,-6):t;return console.log("DEST---",r),{dest:r.split(Ee__default.sep).join("/"),isTemplate:e}}var sr=class{files=new Map;add(e){this.files.set(e.dest,e);}list(){return this.files.values()}get(e){return this.files.get(e)}freeze(){return Object.freeze(this.files),this}};var Bp=["**/.git/**","**/node_modules/**",".DS_Store","variables/**","hooks/**","docs/**"],so={_gitignore:".gitignore",_npmrc:".npmrc"};async function ao(t){let e=new sr,r=await _t(t),n=(0, oo.default)(Bp,{dot:true});for(let i of r){if(n(i))continue;let s=Ee__default.join(t,i),{dest:o,isTemplate:a}=io(i),l=Ee__default.posix.dirname(o),c=Ee__default.posix.basename(o);so[c]&&(c=so[c]);let u=l==="."?c:Ee__default.posix.join(l,c);e.add({src:s,rel:i,dest:u,isTemplate:a,isBinary:Ti(s)});}return e}var Gp=["appinit.template.json","appinit.template.ts","template.meta.json"];async function lo(t){let e=Ee__default.join(t,"template.config.ts");if(!Ye__default.existsSync(t))throw new Error(`Template root not found: ${t}`);for(let l of Gp)if(Ye__default.existsSync(Ee__default.join(t,l)))throw new Error(`Deprecated template format detected: ${l} is not supported in ATS 1.0`);if(!Ye__default.existsSync(e))throw new Error("Missing required file: template.config.ts");let r=await he(e),n=r?.config??r?.default??r;if(!n||typeof n!="object")throw new Error("Invalid export in template.config.ts");if(n.appinitSpec!=="1.0")throw new Error(`Template targets ATS ${n.appinitSpec}, but resolver only supports ATS 1.0`);let i=Ee__default.resolve(t,n.paths?.template??"template");if(!Ye__default.existsSync(i))throw new Error(`Missing template directory: ${i}`);let s=await ao(i),o=await no(t,n),a=await ro(t,n);return {config:n,variables:o,hooks:a,vfs:s,meta:{source:t,engine:n.engine,ats:"1.0"}}}var Jp=[["pnpm","pnpm-lock.yaml"],["yarn","yarn.lock"],["bun","bun.lockb"],["npm","package-lock.json"]];function tt(t,e=[],r={}){let n=process.platform==="win32";return new Promise((i,s)=>{let o=spawn(t,e,{cwd:r.cwd,env:{...process.env,...r.env},stdio:"inherit",shell:n});o.on("error",s),o.on("exit",a=>{if(a===0)return i(a);s(new Error(`${t} ${e.join(" ")} failed with exit ${a}`));});})}async function lr(t){let e=Ee__default.resolve(t);for(let[r,n]of Jp)try{return await ho__default.access(Ee__default.join(e,n)),r}catch{}return "npm"}var Qp={npm:"npm",yarn:"yarn",pnpm:"pnpm",bun:"bun"};async function co(t="npm",e){let r=t.trim().toLowerCase(),n=Qp[r];if(!n)throw new Error(`\u274C Unknown package manager: "${t}"`);let i=Ee__default.resolve(e),s={npm:{installDeps:["install"],installDevDeps:["install","-D"],remove:["uninstall"]},yarn:{installDeps:["add"],installDevDeps:["add","-D"],remove:["remove"]},pnpm:{installDeps:["add"],installDevDeps:["add","-D"],remove:["remove"]},bun:{installDeps:["add"],installDevDeps:["add","-d"],remove:["remove"]}};return {name:t,async install(o={}){await tt(n,["install"],{cwd:o.cwd??i});},async installDeps(o,a={}){if(!o.length)return;let l=s[r].installDeps;await tt(n,[...l,...o],{cwd:a.cwd??i});},async installDevDeps(o,a={}){if(!o.length)return;let l=s[r].installDevDeps;await tt(n,[...l,...o],{cwd:a.cwd??i});},async remove(o,a={}){if(!o.length)return;let l=s[r].remove;await tt(n,[...l,...o],{cwd:a.cwd??i});},async run(o,a={}){if(!o)return;await tt(n,r==="yarn"?[o]:["run",o],{cwd:a.cwd??i});},async runRaw(o,a={}){o.length&&await tt(n,o,{cwd:a.cwd??i});}}}async function uo(t){let{targetDir:e,packageManager:r,postInstallCommands:n=[]}=t;if(!e)throw new Error("runPostInstall: targetDir is required");let i=r??await lr(e),s=await co(i,e);await s.install({cwd:e});for(let o of n)await s.runRaw(o.split(" "),{cwd:e});}function Yp(t,e){let r={...t};for(let n of Object.keys(e)){let i=e[n];(r[n]===void 0||r[n]===null||r[n]==="")&&i.default!==void 0&&(r[n]=i.default);let s=r[n];if(i.required&&(s==null||s===""))throw new Error(`Template variable "${n}" is required.`);if(s!=null){if(i.type==="string"&&typeof s!="string")throw new Error(`Variable "${n}" must be a string.`);if(i.enum&&!i.enum.includes(s))throw new Error(`Variable "${n}" must be one of: ${i.enum.join(", ")}`)}}return r}function Zp(t){try{let e=$a("zod"),r={};for(let n of Object.keys(t)){let i=t[n],s=e.any();i.type==="string"&&(s=e.string()),i.type==="number"&&(s=e.number()),i.type==="boolean"&&(s=e.boolean()),i.enum&&(s=e.enum(i.enum)),i.required||(s=s.optional()),r[n]=s;}return e.object(r)}catch{return null}}async function po(t){let{template:e,answers:r}=t,{defaults:n,schema:i,transform:s}=e.variables,o={...n??{},...r??{}},a=Zp(i??{});if(a){let l=a.safeParse(o);if(!l.success){let c=typeof Nn=="function"?Nn(l.error):JSON.stringify(l.error,null,2);throw new Error(`Template variable validation failed:
15
+ ${c}`)}o=l.data;}else o=Yp(o,i??{});if(typeof s=="function"){let l=await s(o);l&&typeof l=="object"&&(o=l);}return o}promisify(exec);var Nn=t=>t.issues.map(({message:e})=>e)[0];function mo(t){let e=Ee__default.resolve(t);for(;;){if(Ye.existsSync(Ee__default.join(e,"template.config.ts")))return e;let r=Ee__default.dirname(e);if(r===e)break;e=r;}}async function go({targetDir:t,templateId:e,cliVersion:r}){let n=k(t,".appinit");await q(n),await ho__default.writeFile(k(n,"project.json"),JSON.stringify({name:Ee__default.basename(t),createdAt:new Date().toISOString(),cliVersion:r,ats:"1.0"},null,2)),await ho__default.writeFile(k(n,"template.json"),JSON.stringify({id:e,version:"1.0.0",source:"builtin",installedAt:new Date().toISOString()},null,2));}async function cr(t){let{template:e,targetDir:r,answers:n,runtimeDir:i,mode:s,dryRun:o,skipInstall:a,debug:l,logger:c,templatesDir:u,builtinTemplatesDir:y,cliVersion:d}=t;if(!n)throw new Error("runScaffold: missing prompt answers");if(!r)throw new Error("runScaffold: missing targetDir");let b=rf.randomUUID(),v=k(k(i,"sessions"),b);await q(v);try{let E=k(v,"template"),ne;s==="dev"?ne=e:ne=await _i({template:e,templatesDir:u,mode:s,logger:c,builtinTemplatesDir:y}),console.log("CTX---",t),await ki(ne,E,s==="dev"?"dev":"prod"),s==="dev"&&c?.warn(`\u26A0 AppInit DEV MODE
16
+ \u2192 Using live template source
17
+ \u2192 Runtime template is symlinked
18
+ \u2192 Cache is bypassed`);let G=await lo(E),D=await po({template:G,answers:n,logger:c});if(G.config.engine==="none"){for(let ge of G.vfs.list())if(ge.isTemplate)throw new Error(`Template contains renderable files, but engine is "none": ${ge.dest}`)}let ie=k(r,`.appinit-tmp-${b}`);return Ye.mkdirSync(ie,{recursive:!0}),await Xs({template:G,variables:D,outputDir:ie,logger:c}),Ki(ie,r),await go({targetDir:r,templateId:G.config.id,cliVersion:d??"unknown"}),!o&&!a&&await uo({targetDir:r,packageManager:n.packageManager,postInstallCommands:G.config.postInstall??[],logger:c}),{templateDir:E,sessionId:b}}finally{isCancel("Rollback")&&cancel("Operation canceled"),s==="prod"&&!l&&await Je(v);}}async function ur(t){return cr({template:t.templateDir,targetDir:t.targetDir,answers:t.answers,mode:"dev",homeDir:t.homeDir,cacheDir:t.cacheDir,templatesDir:t.templatesDir,runtimeDir:t.runtimeDir,dryRun:t.dryRun,skipInstall:true,logger:t.logger})}async function bo(t){note(`The directory ${t} already contains files.
19
+ Continuing will overwrite or modify existing data.`,"Conflict Detected");let e=await select({message:"How would you like to proceed?",options:[{value:"cancel",label:"Abort installation",hint:"(Safe) Exit without changes"},{value:"overwrite",label:"Overwrite existing project",hint:N.red("(Warning) This may delete existing files")}]});(isCancel(e)||e==="cancel")&&(cancel(N.yellow("Operation cancelled. No changes were made.")),process.exit(0)),e==="overwrite"&&await Je(t);}var vo=[{label:"React",value:"react",hint:"**The most popular library.** Component-based UI with a huge ecosystem (often paired with Vite or Next.js)."},{label:"Next.js",value:"next",hint:"**Production-ready full-stack React framework.** Excellent for SSR, routing, and APIs."},{label:"Vue",value:"vue",hint:"**Progressive and approachable framework.** Fully-featured with great official libraries (Vue Router, Pinia)."},{label:"Svelte",value:"svelte",hint:"**The compiler.** No virtual DOM. Generates highly optimized vanilla JS for faster runtime performance."},{label:"Angular",value:"angular",hint:"**Opinionated, full-featured framework.** Best for large-scale enterprise applications with built-in tooling."},{label:"SolidJS",value:"solid",hint:"**Fine-grained reactivity.** High performance using compiled JSX and actual DOM nodes, no Virtual DOM."},{label:"Qwik",value:"qwik",hint:"Focuses on **Resumability** to achieve near-instant loading times by lazy loading and resuming application state."},{label:"Astro",value:"astro",hint:"An **all-in-one framework** for building fast, content-focused websites using 'Islands of Interactivity'."},{label:"Framer Motion",value:"framer",hint:"Used primarily for **animation and interactive design.** Not a general-purpose framework, but a powerful animation library."},{label:"React Router",value:"react-router",hint:"A declarative routing library for React (often associated with **Remix** full-stack framework)."},{label:"None",value:"none",hint:"**Vanilla JavaScript/TypeScript.** No framework or library required."}];var xo=[{label:"Next.js",value:"next",hint:"**The leading React full-stack framework.** Excellent for server-side rendering (SSR), static site generation (SSG), and API routes."},{label:"Remix",value:"react-router",hint:"**Full-stack React framework built on web standards.** Focuses on route-level data fetching and seamless integration with React Router."},{label:"SvelteKit",value:"svelte",hint:"**The full-stack Svelte framework.** Extremely fast, uses a compiler approach, and offers flexible adapters for deployment."},{label:"Nuxt (Vue)",value:"vue",hint:"**The full-stack Vue framework.** Rich feature set including file-system routing, auto-imports, and powerful module ecosystem."}];var ko=[{label:"Express",value:"express",hint:"**Most popular Node backend.** Simple routing, middleware based, huge ecosystem."},{label:"Koa",value:"koa",hint:"A **minimalist framework** designed by the Express team. Smaller footprint, uses `async/await` for cleaner middleware flow and better error handling."},{label:"Fastify",value:"fastify",hint:"**High-performance & plugin-based.** Best for APIs requiring throughput."},{label:"NestJS",value:"nest",hint:"**Enterprise-grade architecture.** Built-in DI, modules, and scalable structure."},{label:"AdonisJS",value:"adonis",hint:"A **full-featured, opinionated MVC framework** inspired by Laravel/Rails. Comes with its own ORM, CLI, and authentication built-in."},{label:"Hono (Edge-optimized)",value:"hono",hint:"**Tiny + ultra fast for edge runtimes.** Perfect for Cloudflare, Deno, Bun."},{label:"Elysia (Bun)",value:"elysia",hint:"**Deep Bun integration.** Modern type-safe router + middleware."},{label:"None",value:"none",hint:"Choose this if you intend to use a different framework or build your server from scratch."}],So=[{label:"REST",value:"rest",hint:"**Standard + universal.** Works everywhere and easy to scale gradually."},{label:"tRPC",value:"trpc",hint:"**Full end-to-end types.** Great with React/Next fullstack workflows."},{label:"GraphQL",value:"graphql",hint:"**Flexible querying.** Best for complex relational or mobile apps."}],To=[{label:"Monolith",value:"monolith",hint:"**Single, unified unit.** All components (UI, logic, data) are in one codebase and deployed together. **Simple to develop initially**."},{label:"Modular",value:"modular",hint:"A Monolith where code is **logically separated** into independent modules (features/domains) within the *same* codebase. Easier to maintain than a traditional Monolith."},{label:"Microservices",value:"microservices",hint:"**Independent, specialized services.** Each feature runs as its own separate application with its own database, communicating via APIs. **Highly scalable and fault-tolerant**."},{label:"None",value:"none",hint:"No default architecture"}];var Ro={name:"backend",priority:40,condition:(t,e)=>["next","framer","nuxt"].includes(e.frontendFramework??"")?false:e.projectKind==="backend"||e.projectKind==="fullstack",handler:async(t,e)=>{let r=t.interactive!==false,n={backendFramework:e.backendFramework??"express",apiStyle:e.apiStyle??"rest",backendMode:e.backendMode??"none"};if(!r)return {values:n};let i=[{type:"select",name:"backendFramework",message:"\u{1F9F1} Backend Framework:",choices:ko,initial:n.backendFramework},{type:"select",name:"apiStyle",message:"\u{1F50C} API Style:",choices:So,initial:n.apiStyle},{type:"select",name:"backendMode",message:"\u2699\uFE0F Backend Architecture Mode:",choices:To,initial:n.backendMode}];return {values:n,questions:i}}};var Ao={name:"environment",priority:55,handler:async(t,e)=>{let r=t.interactive!==false,n={packageManager:e.packageManager??"pnpm",workspaceTool:e.workspaceTool??"single"};if(!r)return {values:n};let i=[{type:"select",name:"packageManager",message:"\u{1F4E6} Package manager:",choices:uf,initial:n.packageManager}];return {values:n,questions:i}}},uf=[{label:"npm",value:"npm",hint:"The default and most widely adopted package manager for Node.js."},{label:"pnpm",value:"pnpm",hint:"Disk-space efficient and fast. Excellent for monorepos."},{label:"yarn",value:"yarn",hint:"Reliable and feature-rich with strong workspace support."},{label:"bun",value:"bun",hint:"A fast all-in-one runtime, bundler, and package manager."}];var Co={name:"framework",priority:2,condition:(t,e)=>e.projectKind==="frontend"||e.projectKind==="fullstack",handler:async(t,e)=>{let r=t.interactive!==false,i=e.projectKind==="fullstack",s=e.frontendFramework??t.frontendFramework??(i?"next":"react");return r?{values:{frontendFramework:s},questions:[{type:"select",name:"frontendFramework",message:`\u2699\uFE0F ${i?"Fullstack":"Frontend"} Framework:`,choices:i?xo:vo,initial:s}]}:{values:{frontendFramework:s}}}};var _o=[{label:"MIT",value:"MIT",hint:"A short, permissive license with conditions only requiring preservation of copyright and license notices. Great for maximum compatibility."},{label:"Apache-2.0",value:"Apache-2.0",hint:"A permissive license similar to MIT, but providing an express grant of patent rights from contributors to users."},{label:"GPL-3.0",value:"GPL-3.0",hint:"A strong copyleft license. If you modify or redistribute code under this license, you must also release your source code under GPL-3.0."},{label:"Unlicense",value:"Unlicense",hint:"Dedicates the work to the public domain, offering the fewest restrictions possible."},{label:"Other",value:"Other",hint:"Choose this if your license is not listed above and you will provide details later."}];var Eo=[{label:"Frontend Application",value:"frontend",hint:"Create a UI-focused app that interacts with APIs (SPA)."},{label:"Backend API",value:"backend",hint:"Build a server-side API to manage data and handle requests."},{label:"Fullstack (UI + API)",value:"fullstack",hint:"Develop both the frontend and backend in one unified project."},{label:"Library / SDK",value:"library",hint:"Package reusable components or utilities for others to use via NPM."},{label:"CLI Tool",value:"cli",hint:"Automate tasks with a command-line tool (e.g., scaffolding, deployment)."}];var Hn=t=>String(t).trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"").replace(/^-+|-+$/g,"");var Ue=(...t)=>t.find(e=>e!=null&&e!=="");function Do(t,e){let r=e.projectKind??t.projectKind;return r==="library"||r==="cli"||Wi(t?.workspaceTool)}var Vn=t=>{if(typeof t!="string")return null;let e=t.trim().replace(/^@/,"");return e?`@${e}`:null};function Lo(t){if(!t||typeof t!="string")return "Name cannot be empty";let e=t.trim();if(!e.length)return "Name cannot be empty";if(/\s/.test(e))return "Spaces are not allowed \u2014 use dash or underscore";if(/[A-Z]/.test(e))return "Use lowercase letters only (npm package rule)";if(/[~'!()*]/.test(e))return "Name contains forbidden characters ~ ' ! ( ) *";if(/[<>:\"\\|?*]/.test(e))return 'Name contains Windows-forbidden characters < > : " \\ | ? *';if(/[/.]$/.test(e))return "Name cannot end with a dot or slash";if(e.startsWith("@")){if(!/^@[a-z0-9\-_]+\/[a-z0-9\-_]+$/.test(e))return "Invalid scoped package. Use @scope/name"}else if(!/^[a-z0-9\-_]+$/.test(e))return "Use only letters, numbers, dash (-), and underscore (_)";return ["node_modules","favicon","core","con","aux","nul","prn"].includes(e.toLowerCase())?`"${e}" is a reserved name`:true}var Oo={name:"meta",priority:1,handler:async(t,e)=>{let r=t.interactive!==false,n={projectName:Ue(t.projectName,e.projectName,"appinit-app"),description:Ue(e.description,""),author:Ue(e.author,"appinit"),licenseType:Ue(e.licenseType,"MIT"),projectKind:Ue(t.projectKind,e.projectKind,r?void 0:"frontend"),packageScope:Vn(Ue(e.packageScope,"@"))};if(!r)return {values:n};let i=[];return t.projectName||i.push({type:"text",name:"projectName",message:"\u{1F9F1} Project name:",initial:n.projectName,format:s=>s?Hn(s):null,validate:s=>Lo(Hn(s||""))}),i.push({type:"text",name:"description",message:"\u{1F4DD} Short description:",initial:n.description},{type:"text",name:"author",message:"\u{1F464} Author (name/email):",initial:n.author},{type:"select",name:"licenseType",message:"\u{1F4DC} License:",choices:_o,initial:n.licenseType}),t.projectKind||i.push({type:"select",name:"projectKind",message:"\u{1F4E6} Project type:",choices:Eo,initial:n.projectKind}),Do(t,e)&&i.push({type:"text",name:"packageScope",message:"\u{1F4E6} Package scope (optional, without @):",initial:n.packageScope.replace(/^@/,""),format:s=>s?Vn(s):null}),{values:n,questions:i}}};var pf=[Oo,Co,Ao,Ro];async function Po(t,e,r=[]){let{projectName:n,template:i,projectKind:s,skipPrompts:o,overrides:a={},logger:l}=t,c={projectName:n,template:i,projectKind:s,interactive:o===false},u={template:i,...a},y=[...pf,...r].sort((d,b)=>(d.priority??100)-(b.priority??100));Object.freeze(y),c.hooks?.beforeAll&&await c.hooks.beforeAll(c,u);for(let d of y)try{if(d.condition&&!await d.condition(c,u)){l?.info?.(`\u23ED\uFE0F Skipping pack: ${d.name}`);continue}c.hooks?.beforeEach&&await c.hooks.beforeEach(d,c,u),d.before&&await d.before(c,u);let b=await d.handler(c,u);if(b?.values&&Object.assign(u,b.values),c.interactive&&b?.questions&&b.questions.length>0){let v=await e.ask(b.questions,u);Object.assign(u,v);}d.after&&await d.after(c,u),c.hooks?.afterEach&&await c.hooks.afterEach(d,c,u);}catch(b){throw l?.error?.(`\u274C Prompt pack failed: ${d.name}`),b}return c.hooks?.afterAll&&await c.hooks.afterAll(c,u),u}function pr(t){isCancel(t)&&(cancel("Operation cancelled."),process.exit(1));}var Io={async ask(t,e){let r={};for(let n of t){if(n.when&&!await n.when(e))continue;let i;switch(n.type){case "text":{let s=await text({message:n.message,placeholder:n.placeholder,initialValue:n.initial});pr(s),i=s;break}case "confirm":case "toggle":{let s=await confirm({message:n.message,initialValue:n.initial});pr(s),i=s;break}case "select":{let o=(typeof n.choices=="function"?await n.choices(e):n.choices??[]).map(l=>({label:l.label??String(l.value),value:l.value,hint:l.hint})),a=await select({message:n.message,initialValue:n.initial,options:o});pr(a),i=a;break}case "multiselect":{let o=(typeof n.choices=="function"?await n.choices(e):n.choices??[]).map(l=>({label:l.label??String(l.value),value:l.value,hint:l.hint})),a=await multiselect({message:n.message,initialValues:n.initial,required:n.required,options:o});pr(a),i=a;break}default:throw new Error(`Unsupported prompt type: ${n.type}`)}n.format&&(i=n.format(i)),i!=null&&(r[n.name]=i,e[n.name]=i);}return r}};var jo={async ask(t,e){let r={};for(let n of t){if(n.when&&!await n.when(e))continue;let i=n.name,s;if(e[i]!==void 0)s=e[i];else if(n.initial!==void 0)s=n.initial;else throw new Error(`[headless-runtime] Missing required value for "${n.name}"`);if(n.format&&(s=n.format(s)),n.validate){let o=await n.validate(s);if(o!==true)throw new Error(`[headless-runtime] Validation failed for "${n.name}": ${typeof o=="string"?o:"invalid value"}`)}r[i]=s,e[i]=s;}return r}};async function Fo(t){let e=Ee__default.join(t,"hooks"),r=Ee__default.join(e,"before.ts"),n=Ee__default.join(e,"after.ts"),i={};if(U(r)){let s=await he(r);i.before=s.default??s;}if(U(n)){let s=await he(n);i.after=s.default??s;}return i}var $o=process.stdout?.columns||80;process.stdout?.rows||24;var ve=()=>["CI","GITHUB_ACTIONS","BITBUCKET_PIPELINES","BUILDKITE","GITLAB_CI","CIRCLECI","JENKINS_HOME"].some(t=>process.env[t]==="true");async function wf(t){return !((t??{}).nonInteractive||!process.stdin.isTTY||!process.stdout.isTTY||ve()||Bi()||await Gi())}var No=wf;var Fe=!!(process.stdout&&process.stdout.isTTY&&isatty(1));process.platform==="win32";var qn={brand:N.cyan,primary:N.cyan,success:N.green,danger:N.red,warning:N.yellow,info:N.blue,dim:N.gray,red:N.red,green:N.green,yellow:N.yellow,blue:N.blue,cyan:N.cyan,magenta:N.magenta,gray:N.gray};({bgRed:N.bgRed,bgGreen:N.bgGreen,bgYellow:N.bgYellow,bgBlue:N.bgBlue,bgMagenta:N.bgMagenta,bgCyan:N.bgCyan,bgWhite:N.bgWhite,bgBlack:N.bgBlack});var Mo={default:{brand:t=>N.cyan().bold(t),primary:t=>N.cyan(t),success:t=>N.green().bold(t),danger:t=>N.red().bold(t),warning:t=>N.yellow().bold(t),info:t=>N.blue(t),dim:t=>N.gray(t)},dark:{brand:t=>N.magenta().bold(t),primary:t=>N.white(t),success:t=>N.green(t),danger:t=>N.red(t),warning:t=>N.yellow(t),info:t=>N.cyan(t),dim:t=>N.gray(t)},neon:{brand:t=>N.magenta().bold().underline(t),primary:t=>N.green().bold(t),success:t=>N.cyan().bold(t),danger:t=>N.red().bold(t),warning:t=>N.yellow().bold().underline(t),info:t=>N.blue().bold(t),dim:t=>N.gray(t)},mono:{brand:t=>t,primary:t=>t,success:t=>t,danger:t=>t,warning:t=>t,info:t=>t,dim:t=>t}};var vf="default";var T=new Proxy({},{get(t,e){return Mo[vf][e]}});var fr={bold:t=>N.bold(t),italic:t=>N.italic(t),underline:t=>N.underline(t),apply:(...t)=>e=>t.reduce((r,n)=>n(r),e)};async function Ho(t){let e=Fe&&!ve(),r=e&&process.stdout.columns||80,n="\u2500".repeat(Math.min(r,60)),i=console.log;i(""),e?(i(T.success(n)),i(T.success("\u2728 Project created successfully")),i("")):i("Project created successfully");let s=resolve(process.cwd(),t),o;try{o=await lr(s);}catch{o="npm";}let a="",l="";switch(o){case "pnpm":a="pnpm install",l="pnpm dev";break;case "yarn":a="yarn",l="yarn dev";break;case "bun":a="bun install",l="bun dev";break;default:a="npm install",l="npm run dev";break}i(fr.bold("\u{1F449} Next steps:")),i(` ${T.primary(`cd ${t}`)}`),i(` ${T.primary(a)}`),i(` ${T.primary(l)}`),i(""),e&&(i(T.dim("\u{1F4A1} Start building your app right away.")),i(T.dim("\u{1F4A1} Add features later with `appinit add` (packs, modules, capabilities).")),i(T.dim("\u{1F4A1} Need help? Run `appinit help`.")),i(""),i(T.success(n)),i(""));}var kf=`
7
20
  \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
8
21
  \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D
9
22
  \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551
10
23
  \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551
11
24
  \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551
12
25
  \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
13
- `;async function K(){for(let e of qe.trimEnd().split(`
14
- `))console.log(e);}var Qe="AppInit OS",Ze="Developer Operating System",J=false;async function Y(e){if(J||d()||!y)return;J=true,console.log(""),await _(e.flags??{})&&M>=72&&(await K(),console.log("")),console.log(l.brand(`${Qe} \u2014 ${Ze}`)),console.log(l.primary(l.dim(`v${e.version}`))),console.log("");}function q(e){console.log("AppInit OS \u2014 Developer Operating System"),console.log(`v${e}`),console.log(""),console.log(`Usage:
26
+ `;async function Vo(){for(let t of kf.trimEnd().split(`
27
+ `))console.log(t);}var Sf="AppInit OS",Tf="Developer Operating System",zo=false;async function qo(t){if(zo||ve()||!Fe)return;zo=true,console.log(""),await No(t.flags??{})&&$o>=72&&(await Vo(),console.log("")),console.log(T.brand(`${Sf} \u2014 ${Tf}`)),console.log(T.primary(T.dim(`v${t.version}`))),console.log("");}function xt(t){console.log("AppInit OS \u2014 Developer Operating System"),console.log(`v${t}`),console.log(""),console.log(`Usage:
15
28
  appinit create <project-name> Create project (guided or fast)
16
29
  appinit add <capability> Add AI, DB, auth, UI, etc.
17
30
  appinit doctor Analyze & validate project
@@ -20,6 +33,65 @@ import {existsSync}from'fs';import He,{readFile}from'fs/promises';import*as z fr
20
33
 
21
34
  Example:
22
35
  appinit create my-app
23
- `);}var et=process.platform==="win32";function Q(e){let{text:t,color:n="brand",indicator:a="dots",quiet:o}=e,r=!!(o||d()||!y);et&&!process.env.TERM_PROGRAM&&(r=true);let i=s=>typeof n=="function"?n(s):l[n]?l[n](s):T[n]?T[n](s):s;if(r)return console.log(l.dim(`\u203A ${t}`)),{start(){},stop(){},success(s){console.log(l.success(`\u2714 ${s??t}`));},error(s){console.log(l.danger(`\u2716 ${s??t}`));},message(s){console.log(l.dim(`\u203A ${s}`));},persist(s){console.log(s);},async run(s){try{let m=await s();return console.log(l.success(`\u2714 ${t}`)),m}catch(m){throw console.log(l.danger(`\u2716 ${t}`)),m}}};let c=spinner({indicator:a});return {start(s){c.start(i(s??t));},stop(s){c.stop(i(s??t));},success(s){c.stop(l.success(s??t));},error(s){c.stop(l.danger(s??t));},message(s){c.message(i(s));},persist(s){c.stop(s);},async run(s){try{let m=await s();return c.stop(l.success(t)),m}catch(m){throw c.stop(l.danger(t)),m}}}}function Z(e){let t=e.flags?.quiet||d()||!y;function n(o){let r=Q({text:o,color:"primary",quiet:t});return {start(i){r.start(i??o);},success(i){r.success(i??o);},error(i){r.error(i??o);},message(i){r.message(i);},async run(i){try{r.start(o);let c=await i();return r.success(o),c}catch(c){throw r.error(o),c}}}}function a(o){return console.log(l.brand(`
24
- ${o}
25
- `)),{title:o,step(r){return n(r)},complete(r){console.log(l.success(`\u2714 ${r??o}`));},error(r){console.log(l.danger(`\u2716 ${r??o}`));}}}return {group:a,step:n}}var X={version:"1.1.0"};function ee(){return ((process.argv[1]??"").split(/[/\\]/).pop()??"").replace(/\.(js|ts|mjs|cjs)$/i,"")||"appinit"}function w(){return X?.version}async function te(e){let t=process.cwd(),n=x(rt.homedir(),".appinit/cache");return {cwd:t,cacheDir:n,command:e.name,flags:e.flags,args:e.args,cliName:ee(),cliVersion:process.env.APPINIT_CLI_VERSION??w(),runtime:"cli",outputMode:e.flags.json?"json":"text",interactive:!e.flags.nonInteractive,logger:v,spinner:void 0,task:{createManager:()=>Z(e)}}}var oe=["help","version","nonInteractive","skipInstall","skipGit","skipDefaultPacks","dryRun","force","quiet"],ae=["template","projectType"],re={"non-interactive":"nonInteractive","skip-install":"skipInstall","skip-git":"skipGit","project-type":"projectType","skip-default-packs":"skipDefaultPacks","dry-run":"dryRun"},ne={help:"help",h:"help",version:"version",v:"version",json:"json",f:"force",q:"quiet","non-interactive":"nonInteractive","skip-install":"skipInstall","skip-git":"skipGit","project-type":"projectType","dry-run":"dryRun"},I={quiet:false,verbose:false,debug:false,nonInteractive:false,skipInstall:false,skipGit:false,json:"",projectType:"frontend",skipDefaultPacks:false,dryRun:false,force:false};function ie(e){let t=e.splice(2),n=nt(t,{boolean:oe.map(r=>r.toLowerCase()),string:ae.map(r=>r.toLowerCase()),default:I}),a=String(n._?.[0]??"help"),o=ot(n);return {name:a,args:t,flags:o}}function ot(e){let t={...I};for(let[n,a]of Object.entries(e)){if(n==="_"||typeof n!="string")continue;let o=at(n);if(o){if(n.startsWith("no-")){t[o]=false;continue}t[o]=a;}}return t}function at(e){if(!e)return "";if(e=e.replace(/^--?/,"").toLowerCase(),ne[e])return ne[e];if(e in re)return re[e];let t=O(e);return t in I||oe.includes(t)||ae.includes(t)?t:""}function se(e){isCancel(e)&&(cancel("Operation cancelled."),process.exit(1));}async function le(e){let t=await text({message:e.message,initialValue:e.initial});return isCancel(t)&&(cancel("Operation cancelled."),process.exit(1)),t}async function ce(e,t={}){let a=(typeof e.choices=="function"?await e.choices(t):e.choices??[]).map(r=>({label:r.label??r.title??String(r.value),value:r.value,hint:r.hint})),o=await select({...e,initialValue:e.initialValue,options:a});return isCancel(o)&&(cancel("Operation cancelled."),process.exit(1)),o}async function pe(e){let t=await confirm({...e,message:e.message});return se(t),t}async function ue(e,t={}){let a=(typeof e.choices=="function"?await e.choices(t):e.choices??[]).map(r=>({label:r.label??r.title??String(r.value),value:r.value,hint:r.hint})),o=await multiselect({...e,options:a});return se(o),o}async function f(e,t={},n){let a={...t};for(let o of e){if(typeof o.when=="function"&&!await o.when(a))continue;let r;switch(o.type){case "text":r=await le(o);break;case "select":r=await ce(o,a);break;case "confirm":case "toggle":r=await pe(o);break;case "multiselect":r=await ue(o,a);break;default:throw new Error(`Unsupported prompt type "${o.type}`)}if(typeof o.format=="function"&&(r=o.format(r)),typeof o.validate=="function"){let i=await o.validate(r);if(i!==true)throw new Error(`Validation failed for "${o.name}": ${i}`)}a[o.name]=r;}return a}var me=[{label:"React",value:"react",hint:"**The most popular library.** Component-based UI with a huge ecosystem (often paired with Vite or Next.js)."},{label:"Next.js",value:"next",hint:"**Production-ready full-stack React framework.** Excellent for SSR, routing, and APIs."},{label:"Vue",value:"vue",hint:"**Progressive and approachable framework.** Fully-featured with great official libraries (Vue Router, Pinia)."},{label:"Svelte",value:"svelte",hint:"**The compiler.** No virtual DOM. Generates highly optimized vanilla JS for faster runtime performance."},{label:"Angular",value:"angular",hint:"**Opinionated, full-featured framework.** Best for large-scale enterprise applications with built-in tooling."},{label:"SolidJS",value:"solid",hint:"**Fine-grained reactivity.** High performance using compiled JSX and actual DOM nodes, no Virtual DOM."},{label:"Qwik",value:"qwik",hint:"Focuses on **Resumability** to achieve near-instant loading times by lazy loading and resuming application state."},{label:"Astro",value:"astro",hint:"An **all-in-one framework** for building fast, content-focused websites using 'Islands of Interactivity'."},{label:"Framer Motion",value:"framer",hint:"Used primarily for **animation and interactive design.** Not a general-purpose framework, but a powerful animation library."},{label:"React Router",value:"react-router",hint:"A declarative routing library for React (often associated with **Remix** full-stack framework)."},{label:"None",value:"none",hint:"**Vanilla JavaScript/TypeScript.** No framework or library required."}];var de=[{label:"Next.js",value:"next",hint:"**The leading React full-stack framework.** Excellent for server-side rendering (SSR), static site generation (SSG), and API routes."},{label:"Remix",value:"react-router",hint:"**Full-stack React framework built on web standards.** Focuses on route-level data fetching and seamless integration with React Router."},{label:"SvelteKit",value:"svelte",hint:"**The full-stack Svelte framework.** Extremely fast, uses a compiler approach, and offers flexible adapters for deployment."},{label:"Nuxt (Vue)",value:"vue",hint:"**The full-stack Vue framework.** Rich feature set including file-system routing, auto-imports, and powerful module ecosystem."}];var fe=[{label:"Express",value:"express",hint:"**Most popular Node backend.** Simple routing, middleware based, huge ecosystem."},{label:"Koa",value:"koa",hint:"A **minimalist framework** designed by the Express team. Smaller footprint, uses `async/await` for cleaner middleware flow and better error handling."},{label:"Fastify",value:"fastify",hint:"**High-performance & plugin-based.** Best for APIs requiring throughput."},{label:"NestJS",value:"nest",hint:"**Enterprise-grade architecture.** Built-in DI, modules, and scalable structure."},{label:"AdonisJS",value:"adonis",hint:"A **full-featured, opinionated MVC framework** inspired by Laravel/Rails. Comes with its own ORM, CLI, and authentication built-in."},{label:"Hono (Edge-optimized)",value:"hono",hint:"**Tiny + ultra fast for edge runtimes.** Perfect for Cloudflare, Deno, Bun."},{label:"Elysia (Bun)",value:"elysia",hint:"**Deep Bun integration.** Modern type-safe router + middleware."},{label:"None",value:"none",hint:"Choose this if you intend to use a different framework or build your server from scratch."}],ge=[{label:"REST",value:"rest",hint:"**Standard + universal.** Works everywhere and easy to scale gradually."},{label:"tRPC",value:"trpc",hint:"**Full end-to-end types.** Great with React/Next fullstack workflows."},{label:"GraphQL",value:"graphql",hint:"**Flexible querying.** Best for complex relational or mobile apps."}],he=[{label:"Monolith",value:"monolith",hint:"**Single, unified unit.** All components (UI, logic, data) are in one codebase and deployed together. **Simple to develop initially**."},{label:"Modular",value:"modular",hint:"A Monolith where code is **logically separated** into independent modules (features/domains) within the *same* codebase. Easier to maintain than a traditional Monolith."},{label:"Microservices",value:"microservices",hint:"**Independent, specialized services.** Each feature runs as its own separate application with its own database, communicating via APIs. **Highly scalable and fault-tolerant**."},{label:"None",value:"none",hint:"No default architecture"}];var ye={name:"backend",priority:40,condition:(e,t)=>["next","framer","nuxt"].includes(t.frontendFramework)?false:["backend","fullstack"].includes(t.projectType??""),handler:async(e,t,n)=>{if(!e.interactive){let r=e.savedConfig??{};return {backendFramework:n.backendFramework??r.backendFramework??"express",apiStyle:n.apiStyle??r.apiStyle??"rest",backendMode:n.backendMode??r.backendMode??"none"}}return await f([{type:"select",name:"backendFramework",message:"\u{1F9F1} Backend Framework:",choices:fe,initialValue:n.backendFramework??"express"},{type:"select",name:"apiStyle",message:"\u{1F50C} API Style:",choices:ge,initialValue:n.apiStyle??"rest"},{type:"select",name:"backendMode",message:"\u2699\uFE0F Backend Architecture Mode:",choices:he,initialValue:n.backendMode??"none"}],n)}};var be={name:"environment",priority:55,handler:async(e,t,n)=>{let a=e.interactive,o={packageManager:n.packageManager??"pnpm",workspace:n.workspace??"single"};return a?await f([{type:"select",name:"packageManager",message:"\u{1F4E6} Package manager:",choices:pt,initial:n.packageManager??"pnpm"},{type:"select",name:"workspace",message:"\u{1F9E9} Workspace type:",choices:ut,initial:n.workspace??"single"}],n):o}},pt=[{label:"npm",value:"npm",hint:"The **default and most widely-adopted** package manager for Node.js. Great for simplicity and maximum package compatibility."},{label:"pnpm",value:"pnpm",hint:"Focuses on **disk-space efficiency and speed** using content-addressable storage (hard links). Excellent for monorepos."},{label:"yarn",value:"yarn",hint:"Known for **speed, reliability, and monorepo support** (workspaces). Yarn 2+ introduced the Plug'n'Play (PnP) architecture."},{label:"bun",value:"bun",hint:"A **blazingly fast** all-in-one JavaScript runtime, bundler, and package manager. Best for performance-critical or new projects."}],ut=[{label:"Single project",value:"single",hint:"A **traditional project structure** where all code lives in one package. Simple and easy to manage for small-to-medium applications."},{label:"Turborepo (monorepo)",value:"turborepo",hint:"A fast, lightweight build system by Vercel for monorepos. Focuses on **caching and remote computation**."},{label:"Nx (monorepo)",value:"nx",hint:"A **powerful, full-featured monorepo toolkit** that uses a deep graph to understand project dependencies for faster builds and better tooling."},{label:"Lerna (monorepo)",value:"lerna",hint:"A classic tool to manage JavaScript monorepos. Best for **publishing multiple packages** from a single repository."}];var ve={name:"framework",priority:2,condition:(e,t)=>t.projectType==="frontend"||t.projectType==="fullstack",handler:async(e,t,n)=>{let a=e.interactive,o=n.projectType,r=n.frontendFramework??t.frontendFramework??"react",i=o==="fullstack";return a?{frontendFramework:(await f([{type:"select",name:"frontendFramework",message:`\u2699\uFE0F ${i?"Fullstack":"Frontend"} Framework:`,choices:i?de:me,initial:r??(i?"next":"react")}],n)).frontendFramework}:{frontendFramework:r}}};var we=[{label:"MIT",value:"MIT",hint:"A short, permissive license with conditions only requiring preservation of copyright and license notices. Great for maximum compatibility."},{label:"Apache-2.0",value:"Apache-2.0",hint:"A permissive license similar to MIT, but providing an express grant of patent rights from contributors to users."},{label:"GPL-3.0",value:"GPL-3.0",hint:"A strong copyleft license. If you modify or redistribute code under this license, you must also release your source code under GPL-3.0."},{label:"Unlicense",value:"Unlicense",hint:"Dedicates the work to the public domain, offering the fewest restrictions possible."},{label:"Other",value:"Other",hint:"Choose this if your license is not listed above and you will provide details later."}];var ke=[{label:"Frontend Application",value:"frontend",hint:"**A pure client-side application (SPA).** Good for UIs, dashboards, and static sites that consume an existing external API."},{label:"Backend API",value:"backend",hint:"A **server-only project** dedicated to data, business logic, and API endpoints (e.g., using Node.js, Python, or Go)."},{label:"Fullstack (UI + API)",value:"fullstack",hint:"**The modern monolith.** A single project containing both the user interface and the API/server logic (e.g., Next.js, SvelteKit)."},{label:"Library / SDK",value:"library",hint:"A **reusable package** of code meant to be published to NPM and used by other applications (e.g., component library, utility functions)."},{label:"CLI Tool",value:"cli",hint:"A **command-line application** that runs in the terminal. Excellent for automation, deployment, or scaffold generation."}];var j=e=>String(e).trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"").replace(/^-+|-+$/g,"");var h=(...e)=>e.find(t=>t!=null&&t!=="");function xe(e,t,n){let a=n.projectType??t.projectType;return a==="library"||a==="cli"||U(t?.workspaceTool)}var P=e=>{if(typeof e!="string")return null;let t=e.trim().replace(/^@/,"");return t?`@${t}`:null};function Se(e){if(!e||typeof e!="string")return "Name cannot be empty";let t=e.trim();if(!t.length)return "Name cannot be empty";if(/\s/.test(t))return "Spaces are not allowed \u2014 use dash or underscore";if(/[A-Z]/.test(t))return "Use lowercase letters only (npm package rule)";if(/[~'!()*]/.test(t))return "Name contains forbidden characters ~ ' ! ( ) *";if(/[<>:\"\\|?*]/.test(t))return 'Name contains Windows-forbidden characters < > : " \\ | ? *';if(/[/.]$/.test(t))return "Name cannot end with a dot or slash";if(t.startsWith("@")){if(!/^@[a-z0-9\-_]+\/[a-z0-9\-_]+$/.test(t))return "Invalid scoped package. Use @scope/name"}else if(!/^[a-z0-9\-_]+$/.test(t))return "Use only letters, numbers, dash (-), and underscore (_)";return ["node_modules","favicon","core","con","aux","nul","prn"].includes(t.toLowerCase())?`"${t}" is a reserved name`:true}var Pe={name:"meta",priority:1,before(e){console.log("I am meta pack");},handler:async(e,t,n)=>{let a=e.savedConfig??{},o=e.interactive,r={projectName:h(t.projectName,n.projectName,a.projectName,"appinit-app"),projectType:h(t.projectType,n.projectType,a.projectType,"frontend"),description:h(t.description,n.description,a.description,""),licenseType:h(t.licenseType,n.licenseType,a.licenseType,"MIT"),author:h(t.author,n.author,a.author,"appinit"),packageScope:P(h(t.packageScope,n.packageScope,a.packageScope,"@"))};if(!o)return r;let i=[];(!t.projectName||t.projectName.trim()==="")&&i.push({type:"text",name:"projectName",message:"\u{1F9F1} Project name:",initial:a.projectName??"my-appinit-app",format:s=>s?j(s):null,validate:s=>Se(j(s||""))}),i.push({type:"text",name:"description",message:"\u{1F4DD} Short description:",initial:r.description,defaultValue:""},{type:"text",name:"author",message:"\u{1F464} Author (name/email):",initial:r.author,defaultValue:"appinit"},{type:"select",name:"licenseType",message:"\u{1F4DC} License:",choices:we,initial:r.licenseType},{type:"select",name:"projectType",message:"\u{1F4E6} Project type:",choices:ke,initial:r.projectType}),xe(e,t,n)&&i.push({type:"text",name:"packageScope",message:"\u{1F4E6} Package scope (optional, without @):",initial:a.packageScope?.replace?.(/^@/,"")??"",format:s=>s?P(s):null});let c=await f(i,n);return c.packageScope&&(c.packageScope=P(c.packageScope)),{...r,...c}}};var mt=[Pe,ve,be,ye];async function Ce(e,t){let n=e.args[1],a=e.logger,o=[],r={},i={projectName:n,projectType:e.flags.projectType};e.flags.skipDefaultPacks||(o=[...mt]),Array.isArray(t)&&(o=[...o,...t]),o.sort((c,s)=>(c.priority??100)-(s.priority??100)),Object.freeze(o),i.hooks?.beforeAll&&await i.hooks.beforeAll(i,r);for(let c of o)try{if(c.condition&&!await c.condition(i,r)){a.info(`\u23ED\uFE0F Skipping pack: ${c.name}`);continue}i.hooks?.beforeEach&&await i.hooks.beforeEach(c,i,r),c.before&&await c.before(e,i,r);let s=await c.handler(e,i,r);console.log("PACK-",r,c.name,s),s&&typeof s=="object"&&Object.assign(r,s),c.after&&await c.after(e,i,r),i.hooks?.afterEach&&await i.hooks.afterEach(c,i,r);}catch(s){throw a.error(`\u274C Pack failed: "${c.name}"`),a.error(`Reason: ${s.message}`),s}return i.hooks?.afterAll&&await i.hooks.afterAll(i,r),r}var Ae={name:"create",description:"Create new AppInit project",async run(e){let {args:t,task:n,logger:a}=e,o=t[1]??"";n.createManager();await Y({version:w()});let i;try{i=await Ce(e);}catch(je){a?.error("\u274C Prompt engine failed"),a?.error(String(je)),process.exit(1);}console.log("An",i),e.answers=i;let c=i.projectName,s=x(e.cwd,c),m=H(s);m&&(a?.error(`\u274C Invalid target directory: ${s}`),a?.error(`Reason: ${m}`),process.exit(1)),console.log("COnfig",e),W(o);}};var Te={name:"help",description:"",async run(e){return q(w())}};var Re={create:Ae,help:Te};async function Ie(e,t){let n=Re[e];return n||(v.error(`Unknown command: ${e}`),process.exit(1)),n.run(t)}function Ne(e){return e?["init","new"].includes(e)?"create":e.toLowerCase():"help"}async function Ee(e){let t=ie(e),n=Ne(t.name),a=await te(t);try{await Ie(n,a);}catch(o){v.error(`CLI command failed, ${o}`),process.exitCode=1;}}function To(e){Ee(e);}export{To as start};
36
+ `);}var Uo={silent:0,error:1,warn:2,info:3,debug:4,success:5};function rt(t,e){return Uo[t]<=Uo[e.level]}function nt(t,e,r,n){let i=new Date().toISOString();if(n.json)return JSON.stringify({ts:i,level:t,message:e,meta:r});let s=t.toUpperCase();n.color&&(t==="error"&&(s=T.danger(s)),t==="warn"&&(s=T.warning(s)),t==="info"&&(s=T.primary(s)),t==="debug"&&(s=T.dim(s)));let o=n.color?T.dim(i):i,a=r!=null?" "+Rf.inspect(r,{colors:n.color,depth:5}):"";return `${o} ${s} ${fr.bold(e)}${a}`}function Af(){return {level:mr.env.APPINIT_LOG_LEVEL||"info",json:mr.env.APPINIT_LOG==="json",debug:mr.env.APPINIT_DEBUG==="1",color:mr.env.NO_COLOR!=="1"}}function it(){let t=Af();return {debug(e,r){t.debug&&rt("debug",t)&&console.debug(nt("debug",e,r,t));},info(e,r){rt("info",t)&&console.info(nt("info",e,r,t));},warn(e,r){rt("warn",t)&&console.warn(nt("warn",e,r,t));},error(e,r){rt("error",t)&&console.error(nt("error",e,r,t));},success(e){rt("info",t)&&console.log(nt("success",e,null,t));},raw(e){t.level!=="silent"&&console.log(e);}}}var _f=process.platform==="win32";function Be(t){process.stdout.write(t+`
37
+ `);}function Bo(t){let{text:e,color:r="brand",indicator:n="dots",quiet:i}=t,s=!!(i||ve()||!Fe);_f&&!process.env.TERM_PROGRAM&&(s=true);let o=l=>typeof r=="function"?r(l):T[r]?T[r](l):qn[r]?qn[r](l):l;if(s)return Be(T.dim(`\u203A ${e}`)),{start(){},stop(){},success(l){Be(T.success(`\u2714 ${l??e}`));},error(l){Be(T.danger(`\u2716 ${l??e}`));},message(l){Be(T.dim(`\u203A ${l}`));},persist(l){Be(l);},async run(l){try{let c=await l();return Be(T.success(`\u2714 ${e}`)),c}catch(c){throw Be(T.danger(`\u2716 ${e}`)),c}}};let a=spinner({indicator:n});return {start(l){a.start(o(l??e));},stop(l){a.stop(o(l??e));},success(l){a.stop(T.success(l??e));},error(l){a.stop(T.danger(l??e));},message(l){a.message(o(l));},persist(l){a.stop(l);},async run(l){try{let c=await l();return a.stop(T.success(e)),c}catch(c){throw a.stop(T.danger(e)),c}}}}function Bn(t){process.stdout.write(t+`
38
+ `);}function Go(t){let e=t.flags?.quiet===true||ve()||!Fe;function r(i){let s=Bo({text:i,color:"primary",quiet:e});return {async run(o){try{return s.run(o)}catch(a){throw a}}}}function n(i){return e||Bn(T.brand(`
39
+ ${i}
40
+ `)),{step(s){return r(s)},complete(s){e||Bn(T.success(`\u2714 ${s??i}`));},error(s){e||Bn(T.danger(`\u2716 ${s??i}`));}}}return {group:n}}var Wo={version:"1.2.0"};function Ko(){return ((process.argv[1]??"").split(/[/\\]/).pop()??"").replace(/\.(js|ts|mjs|cjs)$/i,"")||"appinit"}function xe(){return Wo?.version}function hr(t){let e=t;for(;;){if(Ye__default.existsSync(Ee__default.join(e,"pnpm-workspace.yaml")))return e;let r=Ee__default.dirname(e);if(r===e)break;e=r;}throw new Error("AppInit repo root not found")}var Of=fileURLToPath(import.meta.url),Pf=Ee__default.dirname(Of);function Yo(t){let{answers:e,flags:r,mode:n}=t;if(r.template){if(n==="prod")throw new Error("Template paths are not allowed in prod mode. Use a template ID.");return r.template}if(!e?.projectKind)throw new Error("Missing projectKind");let i=`${e?.projectKind}-${e?.frontendFramework}`;if(n==="dev"){let s=hr(Pf);return Ee__default.join(s,"templates",i)}if(!e?.projectKind)throw new Error("Missing projectKind");return i}var Ff=fileURLToPath(import.meta.url),$f=Ee__default.dirname(Ff),Zo=k($f,"templates");async function Xo(t){let{logger:e,flags:r,task:n,mode:i}=t,o=n.createManager().group("\u{1F680} Creating your project");t.repoTemplatesDir=Zo,await qo({version:xe()});let a=r.yes===true||r.nonInteractive===true,l=a?jo:Io,c=await o.step("Collecting project configuration").run(async()=>Po({projectName:t.args[1],projectKind:r.projectKind,template:r.template,skipPrompts:a,overrides:{template:r.template,packageManager:r.packageManager},logger:e},l));t.answers=c;let u=c.projectName,y=k(t.cwd,u);t.targetDir=y,U(y)&&await bo(y);let d=Yo(t),{templateDir:b}=await o.step("Generating project files").run(async()=>await cr({template:d,targetDir:y,answers:c,runtimeDir:t.runtimeDir,templatesDir:t.templatesDir,cacheDir:t.cacheDir,homeDir:t.homeDir,mode:i,dryRun:r.dryRun,skipInstall:r.skipInstall,debug:r.debug,builtinTemplatesDir:Zo,logger:e,cliVersion:t.cliVersion})),v=await Fo(b),E={answers:c,targetDir:y,flags:r,logger:e};v.before&&await v.before(E),v.after&&await v.after(E),o.complete("Project created successfully"),Ho(u);}var ea={template:{type:"string",description:"Template ID to use (skip template prompt)"},force:{type:"boolean",default:false,description:"Overwrite target directory if it exists"},yes:{type:"boolean",description:"Skip prompts and use default values"},skipInstall:{type:"boolean",description:"Skip dependency installation"},skipGit:{type:"boolean",description:"Do not initialize a git repository"}};var ta={name:"create",description:"Create new AppInit project",options:ea,async run(t){await Xo(t);}};var ra=["1.0"];function na(t){let{intent:e}=t;console.log(JSON.stringify({intent:e,ok:t.ok,results:t.results.map(r=>({id:r.id,title:r.title,status:r.status,message:r.message,suggestion:r.suggestion}))},null,2));}function ia(t){let{intent:e}=t;e.actor==="template-author"?(console.log("========================================="),console.log("\u{1F9E9} AppInit Doctor: Template Author (Strict)"),console.log("=========================================")):(console.log("========================="),console.log("\u{1FA7A} AppInit Doctor Report"),console.log("=========================")),console.log("");for(let r of t.results)Nf(r);if(console.log(""),console.log("-----------------------------------------"),t.ok)console.log("\u2714 Doctor finished with no errors");else {let r=t.results.filter(s=>s.status==="error").length,n=t.results.filter(s=>s.status==="warn").length,i="\u2716 Doctor finished with issues";r?(i+=` (${r} error${r!==1?"s":""}`,n&&(i+=`, ${n} warning${n!==1?"s":""}`),i+=")"):n&&(i+=` (${n} warning${n!==1?"s":""})`),console.log(i);}console.log("-----------------------------------------"),e.actor==="template-author"&&(console.log(""),console.log("\u2139 Author mode runs strict template validation checks."));}function Nf(t){let e=Mf(t.status);console.log(T.success(`${e} **${t.title}**`)),t.message&&console.log(` ${t.message}`),t.suggestion&&console.log(` \u2192 ${t.suggestion}`);}function Mf(t){let e=process.platform!=="win32"||process.env.TERM_PROGRAM==="vscode"||!!process.env.WT_SESSION;switch(t){case "ok":return e?"\u2714":"[PASS]";case "warn":return e?"\u26A0":"[WARN]";case "error":return e?"\u2716":"[ERR]";default:return "?"}}var sa={format:{type:"string",description:"Output format",values:["text","json"],default:"text"},author:{type:"boolean",description:"Run doctor in template author mode",default:false}};var oa={name:"doctor",description:"Check AppInit project health and compatibility",options:sa,async run(t){let{cwd:e,cliVersion:r,flags:n}=t,i=mo(e),s=!!i,o=n.author||s?{actor:"template-author",mode:"strict",target:{kind:"template",rootDir:i??e}}:{actor:"project-user",mode:"normal",target:{kind:"project",rootDir:e}},a=await Dt({cwd:e,cliVersion:r,supportedAtsVersions:ra,intent:o});n?.format==="json"?na(a):ia(a),process.exit(a.ok?0:1);}};var aa={name:"help",description:"",async run(t){return xt(xe())}};async function la(t){let{targetDir:e,flags:r,logger:n,cwd:i}=t;if(console.log("targetDir",e,i),!e)throw new Error("Target directory is required for template scaffold");let s=r?.projectKind??"frontend";q(e),q(Ee__default.join(e,".appinit")),q(Ee__default.join(e,"template")),q(Ee__default.join(e,"variables")),q(Ee__default.join(e,"hooks")),q(Ee__default.join(e,"docs")),Ge(e,"template/README.md",qf),Ge(e,"variables/defaults.ts",`export const defaults = {};
41
+ `),Ge(e,"variables/schema.ts",`export const schema = {};
42
+ `),Ge(e,"variables/transform.ts",`export function transform(vars: any) {
43
+ return vars;
44
+ }
45
+ `),Ge(e,"docs/README.md",`# Template Documentation
46
+
47
+ Describe your template here.
48
+ `),Ge(e,"template.config.ts",zf(Ee__default.basename(e),s)),Vf(e,"package.json",{name:`@appinit/template-${Ee__default.basename(e)}`,private:true,version:"0.1.0"}),n?.success("\u2714 Template scaffold created"),n?.info(""),n?.info("Next steps:"),n?.info(" - Edit files inside template/"),n?.info(" - Add _tmpl suffix to renderable files"),n?.info(" - Run: appinit template generate");}function Ge(t,e,r){let n=Ee__default.join(t,e),i=Ee__default.dirname(n);q(i),Ye__default.writeFileSync(n,r,"utf8");}function Vf(t,e,r){Ge(t,e,JSON.stringify(r,null,2));}function zf(t,e){return `export const config = {
49
+ id: "@appinit/template-${t}",
50
+ version: "0.1.0",
51
+ appinitSpec: "1.0",
52
+
53
+ projectKind: "${e}",
54
+ engine: "none",
55
+
56
+ title: "${t}",
57
+ description: "AppInit template",
58
+ };
59
+ `}var qf=`# Template Files
60
+
61
+ Place all renderable template files in this directory.
62
+
63
+ Rules:
64
+ - Use \`_tmpl\` suffix for files processed by AppInit
65
+ - Static assets may omit suffix
66
+ - Variable logic lives in /variables
67
+ - Hooks are optional and live in /hooks
68
+
69
+ AppInit does NOT generate framework code for you.
70
+ You own the template content.
71
+ `;var ca={name:"create",description:"Create a new AppInit template (minimal scaffold)",options:{kind:{type:"string",description:"Template category (frontend|backend|fullstack|cli|library)",default:"frontend"}},async run(t){let e=t.args?.[2];console.log("config",t),console.log("NAME",e),e||(t.logger?.error("\u2716 Template name is required"),t.logger?.info("Example:"),t.logger?.info(" appinit template create frontend-react"),process.exit(1)),t.targetDir=k(t.cwd,e),await la(t);}};var Uf=["1.0"];async function dr(t){let e=await Dt({cwd:t,cliVersion:xe(),supportedAtsVersions:Uf,intent:{actor:"template-author",mode:"strict",target:{kind:"template",rootDir:t}}});if(!e.ok)throw new Error("Template validation failed");return e}async function pa(t){let{cwd:e,homeDir:r,cacheDir:n,templatesDir:i,runtimeDir:s,logger:o}=t,a=o??it();await dr(e),a.success("\u2714 Template validated");let l=Ee__default.join(e,".appinit-generate"),c=Ee__default.join(l,"project");Je(l),q(c);let u=await Et(e);await ur({templateDir:e,targetDir:c,answers:u,homeDir:r,cacheDir:n,templatesDir:i,runtimeDir:s,logger:a}),a.success("\u2714 Template generated successfully"),a.info(""),a.info("Generated output:"),a.info(` ${c}`),a.info(""),a.info("Next steps:"),a.info(" - Inspect generated files"),a.info(" - Run: appinit template preview"),a.info(" - Fix any Doctor warnings");}var fa={name:"generate",description:"Generate files without scaffolding",options:{kind:{type:"string",description:"Template category (frontend|backend|fullstack|cli|library)",default:"frontend"}},async run(t){await pa(t);}};function ma(t,e){let r=Gf(t,{dev:true,single:true}),n=Bf.createServer((i,s)=>{r(i,s);});return n.listen(e,()=>{console.log(`\u{1F440} Static preview running at http://localhost:${e}`);}),n}function Wf(t){let e=[t,k(t,"dist"),k(t,"build")];for(let r of e)if(U(k(r,"index.html")))return r;return null}var ha={name:"preview",description:"Preview rendered template output",options:{port:{type:"number",default:3e3,description:"Preview server port"}},async run(t){let{cwd:e,flags:r,logger:n}=t,i=k(k(e,".appinit-preview"),"project");U(i)||(n?.error("\u2716 No preview found"),n?.error("Run `appinit template dev` first to generate preview"),process.exit(1)),Wf(i)||(n?.warn("\u26A0 Preview cannot be served in browser"),n?.warn("No index.html found in preview output."),n?.warn(""),n?.warn("This is expected for framework templates (React/Vue/etc)."),n?.warn("Preview server is static only (ATS 1.0)."),n?.warn(""),n?.warn("Next steps:"),n?.warn("\u2022 Run `appinit template generate`"),n?.warn("\u2022 Then run framework dev/build manually"),process.exit(0));let o=Number(r.port??3e3);n?.info("\u2714 Starting preview server..."),ma(i,o),await new Promise(()=>{});}};function da(t,e){let r=Kf.watch(t,{ignored:["**/.appinit-preview/**","**/node_modules/**","**/.git/**"],ignoreInitial:true}),n=false;async function i(){if(!n){n=true;try{await e();}finally{n=false;}}}let s=null;return r.on("all",(o,a)=>{s&&clearTimeout(s),s=setTimeout(()=>{console.log(`\u{1F504} ${o}: ${a}`),i();},100);}),r}function ya(t){let e=Ee__default.join(t,".appinit-preview"),r=Ee__default.join(e,"project");return Ye__default.existsSync(e)&&Ye__default.rmSync(r,{recursive:true,force:true}),Ye__default.mkdirSync(r,{recursive:true}),r}var wa={name:"dev",description:"Run template in development mode",options:{port:{type:"number",default:3e3,description:"Dev server port"},watch:{type:"boolean",description:"Enable watch mode"}},async run(t){let{cwd:e,logger:r}=t,n=k(e,"template.config.ts"),i=k(e,".appinit");(!U(n)||!U(i))&&(r?.warn("\u26A0 Not inside an AppInit template"),r?.info("This command must be run from a template root directory."),r?.info(""),r?.info("Example:"),r?.info(" cd templates/frontend-react"),r?.info(" appinit template dev"),process.exit(1)),r?.info("\u2714 Template root detected"),await dr(e),r?.info("\u2714 Template validated");async function s(){let o=ya(e),a=await Et(e);await ur({templateDir:e,targetDir:o,answers:a,homeDir:t.homeDir,cacheDir:t.cacheDir,templatesDir:t.templatesDir,runtimeDir:t.runtimeDir,logger:r}),r?.success("\u2714 Template re-rendered");}await s(),t.flags.watch!==false&&(r?.info("\u{1F440} Watching template for changes..."),da(e,s)),r?.success("\u2714 Template rendered into preview directory");}};var ba={name:"template",description:"",subcommands:{dev:wa,preview:ha,generate:fa,create:ca},async run(t){console.log(`
72
+ AppInit Template Commands (Author Mode)
73
+
74
+ Usage:
75
+ appinit template <command>
76
+
77
+ Commands:
78
+ dev Run template in development mode (watch & render)
79
+ preview Serve static preview of rendered output
80
+ generate Generate final output for validation
81
+ create Scaffold a new template (author bootstrap)
82
+
83
+ Examples:
84
+ appinit template dev
85
+ appinit template generate
86
+ `),process.exit(0);}};var kt={create:ta,help:aa,doctor:oa,template:ba};async function xa(t){console.log("ENV",process.env.NODE_ENV);let e=t.flags.env??(process.env.NODE_ENV==="development"?"dev":"prod"),r=e;console.log("ENV",e),console.log("MODE------------------------",r);let n=process.cwd(),i=k(Qf.homedir(),".appinit"),s=it(),o;if(r==="dev"){let a=fileURLToPath(import.meta.url),l=Ee__default.dirname(a),c=hr(l);o=Ee__default.join(c,"templates");}return await Zf(i),{cwd:n,command:t.name,flags:t.flags,args:t.args,interactive:!t.flags.nonInteractive,homeDir:i,cacheDir:k(i,"cache"),templatesDir:k(i,"templates"),runtimeDir:k(i,"runtime"),mode:r,env:process.env.NODE_ENV==="development"?"dev":"prod",cliName:Ko(),cliVersion:process.env.APPINIT_CLI_VERSION??xe(),runtime:"cli",outputMode:t.flags.json?"json":"text",logger:s,task:{createManager:()=>Go(t)},answers:void 0,targetDir:void 0,runtimeSession:void 0,savedConfig:null,repoTemplatesDir:o}}async function Zf(t){if(existsSync(t))return;let e=[t,k(t,"templates"),k(t,"runtime"),k(t,"registry"),k(t,"cache"),k(t,"logs")];await Promise.all(e.map(q));}var Sa=["help","version","nonInteractive","skipInstall","skipGit","skipDefaultPacks","dryRun","force","quiet","yes","author","watch"],Ta=["template","projectKind","format","env","mode","port"],ka={"non-interactive":"nonInteractive","skip-install":"skipInstall","skip-git":"skipGit","project-kind":"projectKind","skip-default-packs":"skipDefaultPacks","dry-run":"dryRun"},Wn={help:"help",h:"help",version:"version",v:"version",author:"author",a:"author",json:"json",f:"force",q:"quiet",y:"yes",e:"env",m:"mode",w:"watch","non-interactive":"nonInteractive","skip-install":"skipInstall","skip-git":"skipGit","project-kind":"projectKind","dry-run":"dryRun"},Kn={quiet:false,verbose:false,debug:false,nonInteractive:false,skipInstall:false,skipGit:false,skipDefaultPacks:false,json:"",project:"",dryRun:false,force:false,author:false,env:"prod",mode:void 0,format:"text"};function Ra(t){let e=t.splice(2),r=Object.entries(Wn).reduce((o,[a,l])=>(a.length===1&&(o[a]=l),o),{}),n=Xf(e,{boolean:Sa.map(o=>o.toLowerCase()),string:Ta.map(o=>o.toLowerCase()),alias:r,default:Kn}),i=String(n._?.[0]??"help"),s=em(n);return {name:i,args:e,flags:s}}function em(t){let e={...Kn};for(let[r,n]of Object.entries(t)){if(r==="_"||typeof r!="string")continue;let i=tm(r);if(i){if(r.startsWith("no-")){e[i]=false;continue}e[i]=n;}}return e}function tm(t){if(!t)return "";if(t=t.replace(/^--?/,"").toLowerCase(),Wn[t])return Wn[t];if(t in ka)return ka[t];let e=Si(t);return e in Kn||Sa.includes(e)||Ta.includes(e)?e:""}function st(t,e={}){let r=t.subcommands&&Object.keys(t.subcommands).length>0,n=e.usage??(r?`Usage: appinit ${t.name} <command>`:`Usage: appinit ${t.name} [options]`),i=t.description??"",s=[];if(s.push(`
87
+ ${n}
88
+ `),i&&s.push(i),t.subcommands&&Object.keys(t.subcommands).length>0){s.push(`
89
+ ### Commands:
90
+ `);for(let o of Object.values(t.subcommands))s.push(` ${o.name.padEnd(12)} ${o.description??""}`);s.push(`
91
+ Run: appinit ${t.name} <command> --help`);}else t.options&&Object.keys(t.options).length>0&&s.push(`
92
+ `+Aa(t.options));if(e.examples?.length){s.push(`
93
+ ### Examples:
94
+ `);for(let o of e.examples)s.push(` ${o}`);}return s.join(`
95
+ `).trimEnd()}function Jn(t){return st(t,{usage:"Usage: appinit create <project-name> [options]",examples:["appinit create my-app","appinit create my-app --template frontend.react.basic --yes","appinit create my-app --skip-install"]})}function Aa(t){let e=[];e.push(`### Options:
96
+ `);let r=Object.entries(t),i=r.reduce((s,[o])=>Math.max(s,o.length),0)+2;for(let[s,o]of r){let a=s.replace(/([A-Z])/g,"-$1").toLowerCase(),l=o.type?`(${o.type})`:"",c=o.default!==void 0?`[default: ${o.default}]`:"",u=`--${a}`,y=" ".repeat(i-a.length),d=`${o.description} ${l} ${c}`.trim();e.push(` ${u}${y}${d}`);}return e.join(`
97
+ `)}function Ca(t){return t?["init","new"].includes(t)?"create":t.toLowerCase():"help"}async function _a(t,e){let r=kt[t],n=it();r||(n.error(`Unknown command: ${t}`),process.exit(1));let i=e.args?.[1],s=r.subcommands&&i?r.subcommands[i]:null;return s?s.run(e):r.run(e)}async function Ea(t){let e=Ra(t),r=Ca(e.name),n=await xa(e),i=xe(),s=kt[r];if(e.flags.version){console.log(i);return}if(!r||r==="help"){let o=e.args[1],a=kt[o];if(a){if(a.name==="create"){console.log(Jn(a));return}console.log(st(a));return}xt(i);return}if(e.flags.help){if(!s){xt(i);return}let o=e.args[1],a=s.subcommands&&o?s.subcommands[o]:null;if(a){console.log(st(a));return}if(s.name==="create"){console.log(Jn(s));return}console.log(st(s));return}try{await _a(r,n);}catch(o){n.logger?.error("CLI command failed",o),process.exitCode=1;}}function jx(t){Ea(t);}export{jx as start};
@@ -0,0 +1,14 @@
1
+ # my-react-app
2
+
3
+ This project was generated using **AppInit**.
4
+
5
+ - Template: `frontend.react.basic`
6
+ - Spec: ATS 1.0
7
+ - Framework: React + Vite + TypeScript
8
+
9
+ ## Getting Started
10
+
11
+ ```bash
12
+ npm install
13
+ npm run dev
14
+ ```