create-pixi-vn 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,59 +1,59 @@
1
- import{styleText as l}from"node:util";import G,{stdin as Ce,stdout as ve}from"node:process";import*as oe from"node:readline";import ut from"node:readline";import{ReadStream as Oe}from"node:tty";import E from"node:fs";import A from"node:path";import{execa as K}from"execa";import ct from"open";import Le from"which";import{fileURLToPath as lt}from"node:url";const pt=(()=>{const e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),ft=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ht=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,dt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,mt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Ne=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,gt=/\t{1,1000}/y,je=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),vt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,wt=new RegExp("\\p{M}+","gu"),$t={limit:1/0,ellipsis:""},De=(e,t={},r={})=>{const i=t.limit??1/0,n=t.ellipsis??"",a=t?.ellipsisWidth??(n?De(n,$t,r).width:0),s=0,o=r.controlWidth??0,u=r.tabWidth??8,c=r.emojiWidth??2,w=2,m=r.regularWidth??1,p=r.wideWidth??w,g=[[vt,m],[dt,s],[mt,o],[gt,u],[je,c],[Ne,p]];let h=0,f=0,v=e.length,I=0,j=!1,k=v,S=Math.max(0,i-a),_=0,b=0,d=0,y=0;e:for(;;){if(b>_||f>=v&&f>h){const x=e.slice(_,b)||e.slice(h,f);I=0;for(const $ of x.replaceAll(wt,"")){const C=$.codePointAt(0)||0;if(ft(C)?y=w:ht(C)?y=p:y=m,d+y>S&&(k=Math.min(k,Math.max(_,h)+I)),d+y>i){j=!0;break e}I+=$.length,d+=y}_=b=0}if(f>=v)break e;for(let x=0,$=g.length;x<$;x++){const[C,V]=g[x];if(C.lastIndex=f,C.test(e)){if(I=C===Ne?pt(e.slice(f,C.lastIndex)):C===je?1:C.lastIndex-f,y=I*V,d+y>S&&(k=Math.min(k,f+Math.floor((S-d)/V))),d+y>i){j=!0;break e}d+=y,_=h,b=f,f=h=C.lastIndex;continue e}}f+=1}return{width:j?S:d,index:j?k:v,truncated:j,ellipsed:j&&i>=a}},yt={limit:1/0,ellipsis:"",ellipsisWidth:0},J=(e,t={})=>De(e,yt,t).width,ue="\x1B",Me="\x9B",bt=39,we="\x07",Ve="[",Et="]",Ue="m",$e=`${Et}8;;`,Pe=new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${$e}(?<uri>.*)${we})`,"y"),Be=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},We=e=>`${ue}${Ve}${e}${Ue}`,Ge=e=>`${ue}${$e}${e}${we}`,ye=(e,t,r)=>{const i=t[Symbol.iterator]();let n=!1,a=!1,s=e.at(-1),o=s===void 0?0:J(s),u=i.next(),c=i.next(),w=0;for(;!u.done;){const m=u.value,p=J(m);o+p<=r?e[e.length-1]+=m:(e.push(m),o=0),(m===ue||m===Me)&&(n=!0,a=t.startsWith($e,w+1)),n?a?m===we&&(n=!1,a=!1):m===Ue&&(n=!1):(o+=p,o===r&&!c.done&&(e.push(""),o=0)),u=c,c=i.next(),w+=m.length}s=e.at(-1),!o&&s!==void 0&&s.length&&e.length>1&&(e[e.length-2]+=e.pop())},It=e=>{const t=e.split(" ");let r=t.length;for(;r&&!J(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},St=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,a;const s=e.split(" ");let o=[""],u=0;for(let m=0;m<s.length;m++){const p=s[m];if(r.trim!==!1){const h=o.at(-1)??"",f=h.trimStart();h.length!==f.length&&(o[o.length-1]=f,u=J(f))}m!==0&&(u>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),u=0),(u||r.trim===!1)&&(o[o.length-1]+=" ",u++));const g=J(p);if(r.hard&&g>t){const h=t-u,f=1+Math.floor((g-h-1)/t);Math.floor((g-1)/t)<f&&o.push(""),ye(o,p,t),u=J(o.at(-1)??"");continue}if(u+g>t&&u&&g){if(r.wordWrap===!1&&u<t){ye(o,p,t),u=J(o.at(-1)??"");continue}o.push(""),u=0}if(u+g>t&&r.wordWrap===!1){ye(o,p,t),u=J(o.at(-1)??"");continue}o[o.length-1]+=p,u+=g}r.trim!==!1&&(o=o.map(m=>It(m)));const c=o.join(`
2
- `);let w=!1;for(let m=0;m<c.length;m++){const p=c[m];if(i+=p,w)w=!1;else if(w=p>="\uD800"&&p<="\uDBFF",w)continue;if(p===ue||p===Me){Pe.lastIndex=m+1;const h=Pe.exec(c)?.groups;if(h?.code!==void 0){const f=Number.parseFloat(h.code);n=f===bt?void 0:f}else h?.uri!==void 0&&(a=h.uri.length===0?void 0:h.uri)}if(c[m+1]===`
3
- `){a&&(i+=Ge(""));const g=n?Be(n):void 0;n&&g&&(i+=We(g))}else p===`
4
- `&&(n&&Be(n)&&(i+=We(n)),a&&(i+=Ge(a)))}return i},_t=/\r?\n/;function ee(e,t,r){return String(e).normalize().split(_t).map(i=>St(i,t,r)).join(`
5
- `)}function Tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var be,Ke;function Ft(){if(Ke)return be;Ke=1;const e="\x1B",t=`${e}[`,r="\x07",i={to(s,o){return o?`${t}${o+1};${s+1}H`:`${t}${s+1}G`},move(s,o){let u="";return s<0?u+=`${t}${-s}D`:s>0&&(u+=`${t}${s}C`),o<0?u+=`${t}${-o}A`:o>0&&(u+=`${t}${o}B`),u},up:(s=1)=>`${t}${s}A`,down:(s=1)=>`${t}${s}B`,forward:(s=1)=>`${t}${s}C`,backward:(s=1)=>`${t}${s}D`,nextLine:(s=1)=>`${t}E`.repeat(s),prevLine:(s=1)=>`${t}F`.repeat(s),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},n={up:(s=1)=>`${t}S`.repeat(s),down:(s=1)=>`${t}T`.repeat(s)},a={screen:`${t}2J`,up:(s=1)=>`${t}1J`.repeat(s),down:(s=1)=>`${t}J`.repeat(s),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(s){let o="";for(let u=0;u<s;u++)o+=this.line+(u<s-1?i.up():"");return s&&(o+=i.left),o}};return be={cursor:i,scroll:n,erase:a,beep:r},be}var L=Ft();function ce(e,t,r){if(!r.some(s=>!s.disabled))return e;const i=e+t,n=Math.max(r.length-1,0),a=i<0?n:i>n?0:i;return r[a].disabled?ce(a,t<0?-1:1,r):a}const xt=["up","down","left","right","space","enter","cancel"],H={actions:new Set(xt),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0};function Ee(e,t){if(typeof e=="string")return H.aliases.get(e)===t;for(const r of e)if(r!==void 0&&Ee(r,t))return!0;return!1}function Rt(e,t){if(e===t)return;const r=e.split(`
1
+ import{styleText as l}from"node:util";import G,{stdin as Ce,stdout as ve}from"node:process";import*as oe from"node:readline";import ut from"node:readline";import{ReadStream as Oe}from"node:tty";import E from"node:fs";import A from"node:path";import{execa as K}from"execa";import ct from"open";import Le from"which";import{fileURLToPath as lt}from"node:url";const pt=(()=>{const e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),ft=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ht=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,dt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,mt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Ne=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,gt=/\t{1,1000}/y,je=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),vt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,wt=new RegExp("\\p{M}+","gu"),$t={limit:1/0,ellipsis:""},De=(e,t={},r={})=>{const i=t.limit??1/0,a=t.ellipsis??"",n=t?.ellipsisWidth??(a?De(a,$t,r).width:0),s=0,o=r.controlWidth??0,c=r.tabWidth??8,u=r.emojiWidth??2,v=2,m=r.regularWidth??1,p=r.wideWidth??v,g=[[vt,m],[dt,s],[mt,o],[gt,c],[je,u],[Ne,p]];let f=0,h=0,w=e.length,I=0,j=!1,k=w,S=Math.max(0,i-n),_=0,b=0,d=0,$=0;e:for(;;){if(b>_||h>=w&&h>f){const x=e.slice(_,b)||e.slice(f,h);I=0;for(const y of x.replaceAll(wt,"")){const C=y.codePointAt(0)||0;if(ft(C)?$=v:ht(C)?$=p:$=m,d+$>S&&(k=Math.min(k,Math.max(_,f)+I)),d+$>i){j=!0;break e}I+=y.length,d+=$}_=b=0}if(h>=w)break e;for(let x=0,y=g.length;x<y;x++){const[C,V]=g[x];if(C.lastIndex=h,C.test(e)){if(I=C===Ne?pt(e.slice(h,C.lastIndex)):C===je?1:C.lastIndex-h,$=I*V,d+$>S&&(k=Math.min(k,h+Math.floor((S-d)/V))),d+$>i){j=!0;break e}d+=$,_=f,b=h,h=f=C.lastIndex;continue e}}h+=1}return{width:j?S:d,index:j?k:w,truncated:j,ellipsed:j&&i>=n}},yt={limit:1/0,ellipsis:"",ellipsisWidth:0},J=(e,t={})=>De(e,yt,t).width,ue="\x1B",Me="\x9B",bt=39,we="\x07",Ve="[",Et="]",Ue="m",$e=`${Et}8;;`,Pe=new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${$e}(?<uri>.*)${we})`,"y"),Be=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},We=e=>`${ue}${Ve}${e}${Ue}`,Ge=e=>`${ue}${$e}${e}${we}`,ye=(e,t,r)=>{const i=t[Symbol.iterator]();let a=!1,n=!1,s=e.at(-1),o=s===void 0?0:J(s),c=i.next(),u=i.next(),v=0;for(;!c.done;){const m=c.value,p=J(m);o+p<=r?e[e.length-1]+=m:(e.push(m),o=0),(m===ue||m===Me)&&(a=!0,n=t.startsWith($e,v+1)),a?n?m===we&&(a=!1,n=!1):m===Ue&&(a=!1):(o+=p,o===r&&!u.done&&(e.push(""),o=0)),c=u,u=i.next(),v+=m.length}s=e.at(-1),!o&&s!==void 0&&s.length&&e.length>1&&(e[e.length-2]+=e.pop())},It=e=>{const t=e.split(" ");let r=t.length;for(;r&&!J(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},St=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",a,n;const s=e.split(" ");let o=[""],c=0;for(let m=0;m<s.length;m++){const p=s[m];if(r.trim!==!1){const f=o.at(-1)??"",h=f.trimStart();f.length!==h.length&&(o[o.length-1]=h,c=J(h))}m!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),c=0),(c||r.trim===!1)&&(o[o.length-1]+=" ",c++));const g=J(p);if(r.hard&&g>t){const f=t-c,h=1+Math.floor((g-f-1)/t);Math.floor((g-1)/t)<h&&o.push(""),ye(o,p,t),c=J(o.at(-1)??"");continue}if(c+g>t&&c&&g){if(r.wordWrap===!1&&c<t){ye(o,p,t),c=J(o.at(-1)??"");continue}o.push(""),c=0}if(c+g>t&&r.wordWrap===!1){ye(o,p,t),c=J(o.at(-1)??"");continue}o[o.length-1]+=p,c+=g}r.trim!==!1&&(o=o.map(m=>It(m)));const u=o.join(`
2
+ `);let v=!1;for(let m=0;m<u.length;m++){const p=u[m];if(i+=p,v)v=!1;else if(v=p>="\uD800"&&p<="\uDBFF",v)continue;if(p===ue||p===Me){Pe.lastIndex=m+1;const f=Pe.exec(u)?.groups;if(f?.code!==void 0){const h=Number.parseFloat(f.code);a=h===bt?void 0:h}else f?.uri!==void 0&&(n=f.uri.length===0?void 0:f.uri)}if(u[m+1]===`
3
+ `){n&&(i+=Ge(""));const g=a?Be(a):void 0;a&&g&&(i+=We(g))}else p===`
4
+ `&&(a&&Be(a)&&(i+=We(a)),n&&(i+=Ge(n)))}return i},_t=/\r?\n/;function te(e,t,r){return String(e).normalize().split(_t).map(i=>St(i,t,r)).join(`
5
+ `)}function Tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var be,Ke;function Ft(){if(Ke)return be;Ke=1;const e="\x1B",t=`${e}[`,r="\x07",i={to(s,o){return o?`${t}${o+1};${s+1}H`:`${t}${s+1}G`},move(s,o){let c="";return s<0?c+=`${t}${-s}D`:s>0&&(c+=`${t}${s}C`),o<0?c+=`${t}${-o}A`:o>0&&(c+=`${t}${o}B`),c},up:(s=1)=>`${t}${s}A`,down:(s=1)=>`${t}${s}B`,forward:(s=1)=>`${t}${s}C`,backward:(s=1)=>`${t}${s}D`,nextLine:(s=1)=>`${t}E`.repeat(s),prevLine:(s=1)=>`${t}F`.repeat(s),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},a={up:(s=1)=>`${t}S`.repeat(s),down:(s=1)=>`${t}T`.repeat(s)},n={screen:`${t}2J`,up:(s=1)=>`${t}1J`.repeat(s),down:(s=1)=>`${t}J`.repeat(s),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(s){let o="";for(let c=0;c<s;c++)o+=this.line+(c<s-1?i.up():"");return s&&(o+=i.left),o}};return be={cursor:i,scroll:a,erase:n,beep:r},be}var L=Ft();function ce(e,t,r){if(!r.some(s=>!s.disabled))return e;const i=e+t,a=Math.max(r.length-1,0),n=i<0?a:i>a?0:i;return r[n]?.disabled?ce(n,t<0?-1:1,r):n}const xt=["up","down","left","right","space","enter","cancel"],H={actions:new Set(xt),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0};function Ee(e,t){if(typeof e=="string")return H.aliases.get(e)===t;for(const r of e)if(r!==void 0&&Ee(r,t))return!0;return!1}function Rt(e,t){if(e===t)return;const r=e.split(`
6
6
  `),i=t.split(`
7
- `),n=Math.max(r.length,i.length),a=[];for(let s=0;s<n;s++)r[s]!==i[s]&&a.push(s);return{lines:a,numLinesBefore:r.length,numLinesAfter:i.length,numLines:n}}const At=globalThis.process.platform.startsWith("win"),Ie=Symbol("clack:cancel");function D(e){return e===Ie}function le(e,t){const r=e;r.isTTY&&r.setRawMode(t)}function kt({input:e=Ce,output:t=ve,overwrite:r=!0,hideCursor:i=!0}={}){const n=oe.createInterface({input:e,output:t,prompt:"",tabSize:1});oe.emitKeypressEvents(e,n),e instanceof Oe&&e.isTTY&&e.setRawMode(!0);const a=(s,{name:o,sequence:u})=>{const c=String(s);if(Ee([c,o,u],"cancel")){i&&t.write(L.cursor.show),process.exit(0);return}if(!r)return;const w=o==="return"?0:-1,m=o==="return"?-1:0;oe.moveCursor(t,w,m,()=>{oe.clearLine(t,1,()=>{e.once("keypress",a)})})};return i&&t.write(L.cursor.hide),e.once("keypress",a),()=>{e.off("keypress",a),i&&t.write(L.cursor.show),e instanceof Oe&&e.isTTY&&!At&&e.setRawMode(!1),n.terminal=!1,n.close()}}const Se=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,He=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function pe(e,t,r,i=r,n=r,a){const s=Se(e??ve);return ee(t,s-r.length,{hard:!0,trim:!1}).split(`
8
- `).map((o,u,c)=>{const w=o;return u===0?`${i}${w}`:u===c.length-1?`${n}${w}`:`${r}${w}`}).join(`
9
- `)}function Ct(e,t){if("~standard"in e){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return r.issues?.at(0)?.message}return e(t)}class _e{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,r=!0){const{input:i=Ce,output:n=ve,render:a,signal:s,...o}=t;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=a.bind(this),this._track=r,this._abortSignal=s,this.input=i,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(t,r){const i=this._subscribers.get(t)??[];i.push(r),this._subscribers.set(t,i)}on(t,r){this.setSubscriber(t,{cb:r})}once(t,r){this.setSubscriber(t,{cb:r,once:!0})}emit(t,...r){const i=this._subscribers.get(t)??[],n=[];for(const a of i)a.cb(...r),a.once&&n.push(()=>i.splice(i.indexOf(a),1));for(const a of n)a()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(Ie);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=ut.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),le(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(L.cursor.show),this.output.off("resize",this.render),le(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(L.cursor.show),this.output.off("resize",this.render),le(this.input,!1),t(Ie)})})}_isActionKey(t,r){return t===" "}_shouldSubmit(t,r){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,r){this.userInput=t??"",this.emit("userInput",this.userInput),r&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,r){if(this._track&&r.name!=="return"&&(r.name&&this._isActionKey(t,r)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&H.aliases.has(r.name)&&this.emit("cursor",H.aliases.get(r.name)),H.actions.has(r.name)&&this.emit("cursor",r.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t,r),r?.name==="return"&&this._shouldSubmit(t,r)){if(this.opts.validate){const i=Ct(this.opts.validate,this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}Ee([t,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
10
- `),le(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=ee(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
11
- `).length-1;this.output.write(L.cursor.move(-999,t*-1))}render(){const t=ee(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(L.cursor.hide);else{const r=Rt(this._prevFrame,t),i=He(this.output);if(this.restoreCursor(),r){const n=Math.max(0,r.numLinesAfter-i),a=Math.max(0,r.numLinesBefore-i);let s=r.lines.find(o=>o>=n);if(s===void 0){this._prevFrame=t;return}if(r.lines.length===1){this.output.write(L.cursor.move(0,s-a)),this.output.write(L.erase.lines(1));const o=t.split(`
12
- `);this.output.write(o[s]),this._prevFrame=t,this.output.write(L.cursor.move(0,o.length-s-1));return}else if(r.lines.length>1){if(n<a)s=n;else{const u=s-a;u>0&&this.output.write(L.cursor.move(0,u))}this.output.write(L.erase.down());const o=t.split(`
7
+ `),a=Math.max(r.length,i.length),n=[];for(let s=0;s<a;s++)r[s]!==i[s]&&n.push(s);return{lines:n,numLinesBefore:r.length,numLinesAfter:i.length,numLines:a}}const At=globalThis.process.platform.startsWith("win"),Ie=Symbol("clack:cancel");function D(e){return e===Ie}function le(e,t){const r=e;r.isTTY&&r.setRawMode(t)}function kt({input:e=Ce,output:t=ve,overwrite:r=!0,hideCursor:i=!0}={}){const a=oe.createInterface({input:e,output:t,prompt:"",tabSize:1});oe.emitKeypressEvents(e,a),e instanceof Oe&&e.isTTY&&e.setRawMode(!0);const n=(s,{name:o,sequence:c})=>{const u=String(s);if(Ee([u,o,c],"cancel")){i&&t.write(L.cursor.show),process.exit(0);return}if(!r)return;const v=o==="return"?0:-1,m=o==="return"?-1:0;oe.moveCursor(t,v,m,()=>{oe.clearLine(t,1,()=>{e.once("keypress",n)})})};return i&&t.write(L.cursor.hide),e.once("keypress",n),()=>{e.off("keypress",n),i&&t.write(L.cursor.show),e instanceof Oe&&e.isTTY&&!At&&e.setRawMode(!1),a.terminal=!1,a.close()}}const Se=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,He=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function pe(e,t,r,i=r,a=r,n){const s=Se(e??ve);return te(t,s-r.length,{hard:!0,trim:!1}).split(`
8
+ `).map((o,c,u)=>{const v=o;return c===0?`${i}${v}`:c===u.length-1?`${a}${v}`:`${r}${v}`}).join(`
9
+ `)}function Ct(e,t){if("~standard"in e){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return r.issues?.at(0)?.message}return e(t)}class _e{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,r=!0){const{input:i=Ce,output:a=ve,render:n,signal:s,...o}=t;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=r,this._abortSignal=s,this.input=i,this.output=a}unsubscribe(){this._subscribers.clear()}setSubscriber(t,r){const i=this._subscribers.get(t)??[];i.push(r),this._subscribers.set(t,i)}on(t,r){this.setSubscriber(t,{cb:r})}once(t,r){this.setSubscriber(t,{cb:r,once:!0})}emit(t,...r){const i=this._subscribers.get(t)??[],a=[];for(const n of i)n.cb(...r),n.once&&a.push(()=>i.splice(i.indexOf(n),1));for(const n of a)n()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(Ie);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=ut.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),le(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(L.cursor.show),this.output.off("resize",this.render),le(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(L.cursor.show),this.output.off("resize",this.render),le(this.input,!1),t(Ie)})})}_isActionKey(t,r){return t===" "}_shouldSubmit(t,r){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,r){this.userInput=t??"",this.emit("userInput",this.userInput),r&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,r){if(this._track&&r.name!=="return"&&(r.name&&this._isActionKey(t,r)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&H.aliases.has(r.name)&&this.emit("cursor",H.aliases.get(r.name)),H.actions.has(r.name)&&this.emit("cursor",r.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t,r),r?.name==="return"&&this._shouldSubmit(t,r)){if(this.opts.validate){const i=Ct(this.opts.validate,this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}Ee([t,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
10
+ `),le(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=te(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
11
+ `).length-1;this.output.write(L.cursor.move(-999,t*-1))}render(){const t=te(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(L.cursor.hide);else{const r=Rt(this._prevFrame,t),i=He(this.output);if(this.restoreCursor(),r){const a=Math.max(0,r.numLinesAfter-i),n=Math.max(0,r.numLinesBefore-i);let s=r.lines.find(o=>o>=a);if(s===void 0){this._prevFrame=t;return}if(r.lines.length===1){this.output.write(L.cursor.move(0,s-n)),this.output.write(L.erase.lines(1));const o=t.split(`
12
+ `);this.output.write(o[s]),this._prevFrame=t,this.output.write(L.cursor.move(0,o.length-s-1));return}else if(r.lines.length>1){if(a<n)s=a;else{const c=s-n;c>0&&this.output.write(L.cursor.move(0,c))}this.output.write(L.erase.down());const o=t.split(`
13
13
  `).slice(s);this.output.write(o.join(`
14
- `)),this._prevFrame=t;return}}this.output.write(L.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class Ot extends _e{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(L.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class Lt extends _e{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;const r=this.options.findIndex(({value:n})=>n===t.initialValue),i=r===-1?0:r;this.cursor=this.options[i].disabled?ce(i,1,this.options):i,this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=ce(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=ce(this.cursor,1,this.options);break}this.changeValue()})}}class Nt extends _e{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;const r=t.slice(0,this.cursor),[i,...n]=t.slice(this.cursor);return`${r}${l("inverse",i)}${n.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}function jt(){return G.platform!=="win32"?G.env.TERM!=="linux":!!G.env.CI||!!G.env.WT_SESSION||!!G.env.TERMINUS_SUBLIME||G.env.ConEmuTask==="{cmd::Cmder}"||G.env.TERM_PROGRAM==="Terminus-Sublime"||G.env.TERM_PROGRAM==="vscode"||G.env.TERM==="xterm-256color"||G.env.TERM==="alacritty"||G.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Te=jt(),Dt=()=>process.env.CI==="true",B=(e,t)=>Te?e:t,Mt=B("\u25C6","*"),ze=B("\u25A0","x"),Ye=B("\u25B2","x"),Fe=B("\u25C7","o"),Vt=B("\u250C","T"),F=B("\u2502","|"),te=B("\u2514","\u2014"),xe=B("\u25CF",">"),fe=B("\u25CB"," "),Ut=B("\u25CF","\u2022"),Pt=B("\u25C6","*"),Bt=B("\u25B2","!"),Wt=B("\u25A0","x"),Re=e=>{switch(e){case"initial":case"active":return l("cyan",Mt);case"cancel":return l("red",ze);case"error":return l("yellow",Ye);case"submit":return l("green",Fe)}},Gt=e=>{switch(e){case"initial":case"active":return l("cyan",F);case"cancel":return l("red",F);case"error":return l("yellow",F);case"submit":return l("green",F)}};function Kt(e,t){const r=[`${t?`${l("cyan",F)} `:""}${e.join(" \u2022 ")}`];return t&&r.push(l("cyan",te)),r}const qe=(e,t,r,i,n,a=!1)=>{let s=t,o=0;if(a)for(let u=i-1;u>=r&&(s-=e[u].length,o++,!(s<=n));u--);else for(let u=r;u<i&&(s-=e[u].length,o++,!(s<=n));u++);return{lineCount:s,removals:o}},Ht=({cursor:e,options:t,style:r,output:i=process.stdout,maxItems:n=Number.POSITIVE_INFINITY,columnPadding:a=0,rowPadding:s=4})=>{const o=Se(i)-a,u=He(i),c=l("dim","..."),w=Math.max(u-s,0),m=Math.max(Math.min(n,w),5);let p=0;e>=m-3&&(p=Math.max(Math.min(e-m+3,t.length-m),0));let g=m<t.length&&p>0,h=m<t.length&&p+m<t.length;const f=Math.min(p+m,t.length),v=[];let I=0;g&&I++,h&&I++;const j=p+(g?1:0),k=f-(h?1:0);for(let _=j;_<k;_++){const b=ee(r(t[_],_===e),o,{hard:!0,trim:!1}).split(`
15
- `);v.push(b),I+=b.length}if(I>w){let _=0,b=0,d=I;const y=e-j;let x=w;const $=()=>qe(v,d,0,y,x),C=()=>qe(v,d,y+1,v.length,x,!0);g?({lineCount:d,removals:_}=$(),d>x&&(h||(x-=1),{lineCount:d,removals:b}=C())):(h||(x-=1),{lineCount:d,removals:b}=C(),d>x&&(x-=1,{lineCount:d,removals:_}=$())),_>0&&(g=!0,v.splice(0,_)),b>0&&(h=!0,v.splice(v.length-b,b))}const S=[];g&&S.push(c);for(const _ of v)for(const b of _)S.push(b);return h&&S.push(c),S},Je=e=>{const t=e.active??"Yes",r=e.inactive??"No";return new Ot({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){const i=e.withGuide??H.withGuide,n=`${Re(this.state)} `,a=i?`${l("gray",F)} `:"",s=pe(e.output,e.message,a,n),o=`${i?`${l("gray",F)}
14
+ `)),this._prevFrame=t;return}}this.output.write(L.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class Ot extends _e{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(L.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}let Lt=class extends _e{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){const t=this._selectedValue;this.value=t===void 0?void 0:t.value}constructor(t){super(t,!1),this.options=t.options;const r=this.options.findIndex(({value:a})=>a===t.initialValue),i=r===-1?0:r;this.cursor=this.options[i]?.disabled?ce(i,1,this.options):i,this.changeValue(),this.on("cursor",a=>{switch(a){case"left":case"up":this.cursor=ce(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=ce(this.cursor,1,this.options);break}this.changeValue()})}};class Nt extends _e{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;const r=t.slice(0,this.cursor),i=t.slice(this.cursor,this.cursor+1),a=t.slice(this.cursor+1);return`${r}${l("inverse",i)}${a}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}function jt(){return G.platform!=="win32"?G.env.TERM!=="linux":!!G.env.CI||!!G.env.WT_SESSION||!!G.env.TERMINUS_SUBLIME||G.env.ConEmuTask==="{cmd::Cmder}"||G.env.TERM_PROGRAM==="Terminus-Sublime"||G.env.TERM_PROGRAM==="vscode"||G.env.TERM==="xterm-256color"||G.env.TERM==="alacritty"||G.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Te=jt(),Dt=()=>process.env.CI==="true",B=(e,t)=>Te?e:t,Mt=B("\u25C6","*"),ze=B("\u25A0","x"),Ye=B("\u25B2","x"),Fe=B("\u25C7","o"),Vt=B("\u250C","T"),F=B("\u2502","|"),X=B("\u2514","\u2014"),xe=B("\u25CF",">"),fe=B("\u25CB"," "),Ut=B("\u25CF","\u2022"),Pt=B("\u25C6","*"),Bt=B("\u25B2","!"),Wt=B("\u25A0","x"),Re=e=>{switch(e){case"initial":case"active":return l("cyan",Mt);case"cancel":return l("red",ze);case"error":return l("yellow",Ye);case"submit":return l("green",Fe)}},Gt=e=>{switch(e){case"initial":case"active":return l("cyan",F);case"cancel":return l("red",F);case"error":return l("yellow",F);case"submit":return l("green",F)}};function Kt(e,t){const r=[`${t?`${l("cyan",F)} `:""}${e.join(" \u2022 ")}`];return t&&r.push(l("cyan",X)),r}const qe=(e,t,r,i,a,n=!1)=>{let s=t,o=0;if(n)for(let c=i-1;c>=r;c--){const u=e[c];if(u&&(s-=u.length),o++,s<=a)break}else for(let c=r;c<i;c++){const u=e[c];if(u&&(s-=u.length),o++,s<=a)break}return{lineCount:s,removals:o}},Ht=({cursor:e,options:t,style:r,output:i=process.stdout,maxItems:a=Number.POSITIVE_INFINITY,columnPadding:n=0,rowPadding:s=4})=>{const o=Se(i)-n,c=He(i),u=l("dim","..."),v=Math.max(c-s,0),m=Math.max(Math.min(a,v),5);let p=0;e>=m-3&&(p=Math.max(Math.min(e-m+3,t.length-m),0));let g=m<t.length&&p>0,f=m<t.length&&p+m<t.length;const h=Math.min(p+m,t.length),w=[];let I=0;g&&I++,f&&I++;const j=p+(g?1:0),k=h-(f?1:0);for(let _=j;_<k;_++){const b=t[_],d=b?r(b,_===e):"",$=te(d,o,{hard:!0,trim:!1}).split(`
15
+ `);w.push($),I+=$.length}if(I>v){let _=0,b=0,d=I;const $=e-j;let x=v;const y=()=>qe(w,d,0,$,x),C=()=>qe(w,d,$+1,w.length,x,!0);g?({lineCount:d,removals:_}=y(),d>x&&(f||(x-=1),{lineCount:d,removals:b}=C())):(f||(x-=1),{lineCount:d,removals:b}=C(),d>x&&(x-=1,{lineCount:d,removals:_}=y())),_>0&&(g=!0,w.splice(0,_)),b>0&&(f=!0,w.splice(w.length-b,b))}const S=[];g&&S.push(u);for(const _ of w)for(const b of _)S.push(b);return f&&S.push(u),S},Je=e=>{const t=e.active??"Yes",r=e.inactive??"No";return new Ot({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){const i=e.withGuide??H.withGuide,a=`${Re(this.state)} `,n=i?`${l("gray",F)} `:"",s=pe(e.output,e.message,n,a),o=`${i?`${l("gray",F)}
16
16
  `:""}${s}
17
- `,u=this.value?t:r;switch(this.state){case"submit":{const c=i?`${l("gray",F)} `:"";return`${o}${c}${l("dim",u)}`}case"cancel":{const c=i?`${l("gray",F)} `:"";return`${o}${c}${l(["strikethrough","dim"],u)}${i?`
18
- ${l("gray",F)}`:""}`}default:{const c=i?`${l("cyan",F)} `:"",w=i?l("cyan",te):"";return`${o}${c}${this.value?`${l("green",xe)} ${t}`:`${l("dim",fe)} ${l("dim",t)}`}${e.vertical?i?`
17
+ `,c=this.value?t:r;switch(this.state){case"submit":{const u=i?`${l("gray",F)} `:"";return`${o}${u}${l("dim",c)}`}case"cancel":{const u=i?`${l("gray",F)} `:"";return`${o}${u}${l(["strikethrough","dim"],c)}${i?`
18
+ ${l("gray",F)}`:""}`}default:{const u=i?`${l("cyan",F)} `:"",v=i?l("cyan",X):"";return`${o}${u}${this.value?`${l("green",xe)} ${t}`:`${l("dim",fe)} ${l("dim",t)}`}${e.vertical?i?`
19
19
  ${l("cyan",F)} `:`
20
20
  `:` ${l("dim","/")} `}${this.value?`${l("dim",fe)} ${l("dim",r)}`:`${l("green",xe)} ${r}`}
21
- ${w}
22
- `}}}}).prompt()};`${l("dim","\u2191/\u2193")}`,`${l("dim","Space:")}`,`${l("dim","Enter:")}`;const P={message:(e=[],{symbol:t=l("gray",F),secondarySymbol:r=l("gray",F),output:i=process.stdout,spacing:n=1,withGuide:a}={})=>{const s=[],o=a??H.withGuide,u=o?r:"",c=o?`${t} `:"",w=o?`${r} `:"";for(let p=0;p<n;p++)s.push(u);const m=Array.isArray(e)?e:e.split(`
23
- `);if(m.length>0){const[p,...g]=m;p.length>0?s.push(`${c}${p}`):s.push(o?t:"");for(const h of g)h.length>0?s.push(`${w}${h}`):s.push(o?r:"")}i.write(`${s.join(`
21
+ ${v}
22
+ `}}}}).prompt()};`${l("dim","\u2191/\u2193")}`,`${l("dim","Space:")}`,`${l("dim","Enter:")}`;const P={message:(e=[],{symbol:t=l("gray",F),secondarySymbol:r=l("gray",F),output:i=process.stdout,spacing:a=1,withGuide:n}={})=>{const s=[],o=n??H.withGuide,c=o?r:"",u=o?`${t} `:"",v=o?`${r} `:"";for(let p=0;p<a;p++)s.push(c);const m=Array.isArray(e)?e:e.split(`
23
+ `);if(m.length>0){const[p,...g]=m;p.length>0?s.push(`${u}${p}`):s.push(o?t:"");for(const f of g)f.length>0?s.push(`${v}${f}`):s.push(o?r:"")}i.write(`${s.join(`
24
24
  `)}
25
- `)},info:(e,t)=>{P.message(e,{...t,symbol:l("blue",Ut)})},success:(e,t)=>{P.message(e,{...t,symbol:l("green",Pt)})},step:(e,t)=>{P.message(e,{...t,symbol:l("green",Fe)})},warn:(e,t)=>{P.message(e,{...t,symbol:l("yellow",Bt)})},warning:(e,t)=>{P.warn(e,t)},error:(e,t)=>{P.message(e,{...t,symbol:l("red",Wt)})}},T=(e="",t)=>{const r=process.stdout,i=`${l("gray",te)} `;r.write(`${i}${l("red",e)}
25
+ `)},info:(e,t)=>{P.message(e,{...t,symbol:l("blue",Ut)})},success:(e,t)=>{P.message(e,{...t,symbol:l("green",Pt)})},step:(e,t)=>{P.message(e,{...t,symbol:l("green",Fe)})},warn:(e,t)=>{P.message(e,{...t,symbol:l("yellow",Bt)})},warning:(e,t)=>{P.warn(e,t)},error:(e,t)=>{P.message(e,{...t,symbol:l("red",Wt)})}},T=(e="",t)=>{const r=process.stdout,i=`${l("gray",X)} `;r.write(`${i}${l("red",e)}
26
26
 
27
27
  `)},zt=(e="",t)=>{const r=process.stdout,i=`${l("gray",Vt)} `;r.write(`${i}${e}
28
28
  `)},Yt=(e="",t)=>{const r=process.stdout,i=`${l("gray",F)}
29
- ${l("gray",te)} `;r.write(`${i}${e}
29
+ ${l("gray",X)} `;r.write(`${i}${e}
30
30
 
31
- `)},qt=e=>l("magenta",e),Jt=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:i,errorMessage:n,frames:a=Te?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:s=Te?80:120,signal:o,...u}={})=>{const c=Dt();let w,m,p=!1,g=!1,h="",f,v=performance.now();const I=Se(r),j=u?.styleFrame??qt,k=R=>{const W=R>1?n??H.messages.error:i??H.messages.cancel;g=R===1,p&&(U(W,R),g&&typeof t=="function"&&t())},S=()=>k(2),_=()=>k(1),b=()=>{process.on("uncaughtExceptionMonitor",S),process.on("unhandledRejection",S),process.on("SIGINT",_),process.on("SIGTERM",_),process.on("exit",k),o&&o.addEventListener("abort",_)},d=()=>{process.removeListener("uncaughtExceptionMonitor",S),process.removeListener("unhandledRejection",S),process.removeListener("SIGINT",_),process.removeListener("SIGTERM",_),process.removeListener("exit",k),o&&o.removeEventListener("abort",_)},y=()=>{if(f===void 0)return;c&&r.write(`
32
- `);const R=ee(f,I,{hard:!0,trim:!1}).split(`
33
- `);R.length>1&&r.write(L.cursor.up(R.length-1)),r.write(L.cursor.to(0)),r.write(L.erase.down())},x=R=>R.replace(/\.+$/,""),$=R=>{const W=(performance.now()-R)/1e3,Y=Math.floor(W/60),q=Math.floor(W%60);return Y>0?`[${Y}m ${q}s]`:`[${q}s]`},C=u.withGuide??H.withGuide,V=(R="")=>{p=!0,w=kt({output:r}),h=x(R),v=performance.now(),C&&r.write(`${l("gray",F)}
34
- `);let W=0,Y=0;b(),m=setInterval(()=>{if(c&&h===f)return;y(),f=h;const q=j(a[W]);let ae;if(c)ae=`${q} ${h}...`;else if(e==="timer")ae=`${q} ${h} ${$(v)}`;else{const ot=".".repeat(Math.floor(Y)).slice(0,3);ae=`${q} ${h}${ot}`}const at=ee(ae,I,{hard:!0,trim:!1});r.write(at),W=W+1<a.length?W+1:0,Y=Y<4?Y+.125:0},s)},U=(R="",W=0,Y=!1)=>{if(!p)return;p=!1,clearInterval(m),y();const q=W===0?l("green",Fe):W===1?l("red",ze):l("red",Ye);h=R??h,Y||(e==="timer"?r.write(`${q} ${h} ${$(v)}
35
- `):r.write(`${q} ${h}
36
- `)),d(),w()};return{start:V,stop:(R="")=>U(R,0),message:(R="")=>{h=x(R??h)},cancel:(R="")=>U(R,1),error:(R="")=>U(R,2),clear:()=>U("",0,!0),get isCancelled(){return g}}},Zt=[`${l("dim","\u2191/\u2193")} to navigate`,`${l("dim","Enter:")} confirm`],he=(e,t)=>e.includes(`
31
+ `)},qt=e=>l("magenta",e),Jt=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:i,errorMessage:a,frames:n=Te?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:s=Te?80:120,signal:o,...c}={})=>{const u=Dt();let v,m,p=!1,g=!1,f="",h,w=performance.now();const I=Se(r),j=c?.styleFrame??qt,k=R=>{const W=R>1?a??H.messages.error:i??H.messages.cancel;g=R===1,p&&(U(W,R),g&&typeof t=="function"&&t())},S=()=>k(2),_=()=>k(1),b=()=>{process.on("uncaughtExceptionMonitor",S),process.on("unhandledRejection",S),process.on("SIGINT",_),process.on("SIGTERM",_),process.on("exit",k),o&&o.addEventListener("abort",_)},d=()=>{process.removeListener("uncaughtExceptionMonitor",S),process.removeListener("unhandledRejection",S),process.removeListener("SIGINT",_),process.removeListener("SIGTERM",_),process.removeListener("exit",k),o&&o.removeEventListener("abort",_)},$=()=>{if(h===void 0)return;u&&r.write(`
32
+ `);const R=te(h,I,{hard:!0,trim:!1}).split(`
33
+ `);R.length>1&&r.write(L.cursor.up(R.length-1)),r.write(L.cursor.to(0)),r.write(L.erase.down())},x=R=>R.replace(/\.+$/,""),y=R=>{const W=(performance.now()-R)/1e3,Y=Math.floor(W/60),q=Math.floor(W%60);return Y>0?`[${Y}m ${q}s]`:`[${q}s]`},C=c.withGuide??H.withGuide,V=(R="")=>{p=!0,v=kt({output:r}),f=x(R),w=performance.now(),C&&r.write(`${l("gray",F)}
34
+ `);let W=0,Y=0;b(),m=setInterval(()=>{if(u&&f===h)return;$(),h=f;const q=j(n[W]);let ae;if(u)ae=`${q} ${f}...`;else if(e==="timer")ae=`${q} ${f} ${y(w)}`;else{const ot=".".repeat(Math.floor(Y)).slice(0,3);ae=`${q} ${f}${ot}`}const at=te(ae,I,{hard:!0,trim:!1});r.write(at),W=W+1<n.length?W+1:0,Y=Y<4?Y+.125:0},s)},U=(R="",W=0,Y=!1)=>{if(!p)return;p=!1,clearInterval(m),$();const q=W===0?l("green",Fe):W===1?l("red",ze):l("red",Ye);f=R??f,Y||(e==="timer"?r.write(`${q} ${f} ${y(w)}
35
+ `):r.write(`${q} ${f}
36
+ `)),d(),v()};return{start:V,stop:(R="")=>U(R,0),message:(R="")=>{f=x(R??f)},cancel:(R="")=>U(R,1),error:(R="")=>U(R,2),clear:()=>U("",0,!0),get isCancelled(){return g}}},Zt=[`${l("dim","\u2191/\u2193")} to navigate`,`${l("dim","Enter:")} confirm`],he=(e,t)=>e.includes(`
37
37
  `)?e.split(`
38
38
  `).map(r=>t(r)).join(`
39
- `):t(e),X=e=>{const t=(r,i)=>{const n=r.label??String(r.value);switch(i){case"disabled":return`${l("gray",fe)} ${he(n,a=>l("gray",a))}${r.hint?` ${l("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${he(n,a=>l("dim",a))}`;case"active":return`${l("green",xe)} ${n}${r.hint?` ${l("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${he(n,a=>l(["strikethrough","dim"],a))}`;default:return`${l("dim",fe)} ${he(n,a=>l("dim",a))}`}};return new Lt({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const r=e.withGuide??H.withGuide,i=`${Re(this.state)} `,n=`${Gt(this.state)} `,a=pe(e.output,e.message,n,i),s=`${r?`${l("gray",F)}
40
- `:""}${a}
41
- `;switch(this.state){case"submit":{const o=r?`${l("gray",F)} `:"",u=pe(e.output,t(this.options[this.cursor],"selected"),o);return`${s}${u}`}case"cancel":{const o=r?`${l("gray",F)} `:"",u=pe(e.output,t(this.options[this.cursor],"cancelled"),o);return`${s}${u}${r?`
42
- ${l("gray",F)}`:""}`}default:{const o=r?`${l("cyan",F)} `:"",u=s.split(`
43
- `).length,c=Kt(Zt,r),w=c.join(`
44
- `),m=c.length+1;return`${s}${o}${Ht({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:o.length,rowPadding:u+m,style:(p,g)=>t(p,p.disabled?"disabled":g?"active":"inactive")}).join(`
45
- ${o}`)}
46
- ${w}
47
- `}}}}).prompt()};`${l("gray",F)}`;const de=async(e,t)=>{for(const r of e){if(r.enabled===!1)continue;const i=Jt(t);i.start(r.title);const n=await r.task(i.message);i.stop(n||r.title)}},se=e=>new Nt({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){const t=e?.withGuide??H.withGuide,r=`${`${t?`${l("gray",F)}
39
+ `):t(e),Q=e=>{const t=(i,a)=>{if(i===void 0)return"";const n=i.label??String(i.value);switch(a){case"disabled":return`${l("gray",fe)} ${he(n,s=>l("gray",s))}${i.hint?` ${l("dim",`(${i.hint??"disabled"})`)}`:""}`;case"selected":return`${he(n,s=>l("dim",s))}`;case"active":return`${l("green",xe)} ${n}${i.hint?` ${l("dim",`(${i.hint})`)}`:""}`;case"cancelled":return`${he(n,s=>l(["strikethrough","dim"],s))}`;default:return`${l("dim",fe)} ${he(n,s=>l("dim",s))}`}},r=e.showInstructions??!0;return new Lt({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const i=e.withGuide??H.withGuide,a=`${Re(this.state)} `,n=`${Gt(this.state)} `,s=pe(e.output,e.message,n,a),o=`${i?`${l("gray",F)}
40
+ `:""}${s}
41
+ `;switch(this.state){case"submit":{const c=i?`${l("gray",F)} `:"",u=pe(e.output,t(this.options[this.cursor],"selected"),c);return`${o}${u}`}case"cancel":{const c=i?`${l("gray",F)} `:"",u=pe(e.output,t(this.options[this.cursor],"cancelled"),c);return`${o}${u}${i?`
42
+ ${l("gray",F)}`:""}`}default:{const c=i?`${l("cyan",F)} `:"",u=o.split(`
43
+ `).length,v=r?Kt(Zt,i):i?[l("cyan",X)]:[],m=v.join(`
44
+ `),p=v.length+1;return`${o}${c}${Ht({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:c.length,rowPadding:u+p,style:(g,f)=>t(g,g.disabled?"disabled":f?"active":"inactive")}).join(`
45
+ ${c}`)}
46
+ ${m}
47
+ `}}}}).prompt()};`${l("gray",F)}`;const de=async(e,t)=>{for(const r of e){if(r.enabled===!1)continue;const i=Jt(t);i.start(r.title);const a=await r.task(i.message);i.stop(a||r.title)}},se=e=>new Nt({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){const t=e?.withGuide??H.withGuide,r=`${`${t?`${l("gray",F)}
48
48
  `:""}${Re(this.state)} `}${e.message}
49
- `,i=e.placeholder?l("inverse",e.placeholder[0])+l("dim",e.placeholder.slice(1)):l(["inverse","hidden"],"_"),n=this.userInput?this.userInputWithCursor:i,a=this.value??"";switch(this.state){case"error":{const s=this.error?` ${l("yellow",this.error)}`:"",o=t?`${l("yellow",F)} `:"",u=t?l("yellow",te):"";return`${r.trim()}
50
- ${o}${n}
51
- ${u}${s}
52
- `}case"submit":{const s=a?` ${l("dim",a)}`:"",o=t?l("gray",F):"";return`${r}${o}${s}`}case"cancel":{const s=a?` ${l(["strikethrough","dim"],a)}`:"",o=t?l("gray",F):"";return`${r}${o}${s}${a.trim()?`
53
- ${o}`:""}`}default:{const s=t?`${l("cyan",F)} `:"",o=t?l("cyan",te):"";return`${r}${s}${n}
49
+ `,i=e.placeholder&&e.placeholder.length>0?l("inverse",e.placeholder[0])+l("dim",e.placeholder.slice(1)):l(["inverse","hidden"],"_"),a=this.userInput?this.userInputWithCursor:i,n=this.value??"";switch(this.state){case"error":{const s=this.error?` ${l("yellow",this.error)}`:"",o=t?`${l("yellow",F)} `:"",c=t?l("yellow",X):"";return`${r.trim()}
50
+ ${o}${a}
51
+ ${c}${s}
52
+ `}case"submit":{const s=n?` ${l("dim",n)}`:"",o=t?l("gray",F):"";return`${r}${o}${s}`}case"cancel":{const s=n?` ${l(["strikethrough","dim"],n)}`:"",o=t?l("gray",F):"";return`${r}${o}${s}${n.trim()?`
53
+ ${o}`:""}`}default:{const s=t?`${l("cyan",F)} `:"",o=t?l("cyan",X):"";return`${r}${s}${a}
54
54
  ${o}
55
- `}}}}).prompt();let Q=!0;const re=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ne=0;if(re.process&&re.process.env&&re.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:r,TERM:i,COLORTERM:n}=re.process.env;t||r||e==="0"?Q=!1:e==="1"||e==="2"||e==="3"?Q=!0:i==="dumb"?Q=!1:"CI"in re.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(a=>a in re.process.env)?Q=!0:Q=process.stdout.isTTY,Q&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?ne=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?ne=2:ne=1)}let Ze={enabled:Q,supportLevel:ne};function me(e,t,r=1){const i=`\x1B[${e}m`,n=`\x1B[${t}m`,a=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Ze.enabled&&Ze.supportLevel>=r?i+(""+s).replace(a,i)+n:""+s}const Xt=me(31,39),ge=me(36,39),Qt=me(90,39),er=me(91,39);var Ae,Xe;function tr(){if(Xe)return Ae;Xe=1;function e(i,n){var a=i;n.slice(0,-1).forEach(function(o){a=a[o]||{}});var s=n[n.length-1];return s in a}function t(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function r(i,n){return n==="constructor"&&typeof i[n]=="function"||n==="__proto__"}return Ae=function(i,n){n||(n={});var a={bools:{},strings:{},unknownFn:null};typeof n.unknown=="function"&&(a.unknownFn=n.unknown),typeof n.boolean=="boolean"&&n.boolean?a.allBools=!0:[].concat(n.boolean).filter(Boolean).forEach(function(d){a.bools[d]=!0});var s={};function o(d){return s[d].some(function(y){return a.bools[y]})}Object.keys(n.alias||{}).forEach(function(d){s[d]=[].concat(n.alias[d]),s[d].forEach(function(y){s[y]=[d].concat(s[d].filter(function(x){return y!==x}))})}),[].concat(n.string).filter(Boolean).forEach(function(d){a.strings[d]=!0,s[d]&&[].concat(s[d]).forEach(function(y){a.strings[y]=!0})});var u=n.default||{},c={_:[]};function w(d,y){return a.allBools&&/^--[^=]+$/.test(y)||a.strings[d]||a.bools[d]||s[d]}function m(d,y,x){for(var $=d,C=0;C<y.length-1;C++){var V=y[C];if(r($,V))return;$[V]===void 0&&($[V]={}),($[V]===Object.prototype||$[V]===Number.prototype||$[V]===String.prototype)&&($[V]={}),$[V]===Array.prototype&&($[V]=[]),$=$[V]}var U=y[y.length-1];r($,U)||(($===Object.prototype||$===Number.prototype||$===String.prototype)&&($={}),$===Array.prototype&&($=[]),$[U]===void 0||a.bools[U]||typeof $[U]=="boolean"?$[U]=x:Array.isArray($[U])?$[U].push(x):$[U]=[$[U],x])}function p(d,y,x){if(!(x&&a.unknownFn&&!w(d,x)&&a.unknownFn(x)===!1)){var $=!a.strings[d]&&t(y)?Number(y):y;m(c,d.split("."),$),(s[d]||[]).forEach(function(C){m(c,C.split("."),$)})}}Object.keys(a.bools).forEach(function(d){p(d,u[d]===void 0?!1:u[d])});var g=[];i.indexOf("--")!==-1&&(g=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var h=0;h<i.length;h++){var f=i[h],v,I;if(/^--.+=/.test(f)){var j=f.match(/^--([^=]+)=([\s\S]*)$/);v=j[1];var k=j[2];a.bools[v]&&(k=k!=="false"),p(v,k,f)}else if(/^--no-.+/.test(f))v=f.match(/^--no-(.+)/)[1],p(v,!1,f);else if(/^--.+/.test(f))v=f.match(/^--(.+)/)[1],I=i[h+1],I!==void 0&&!/^(-|--)[^-]/.test(I)&&!a.bools[v]&&!a.allBools&&(!s[v]||!o(v))?(p(v,I,f),h+=1):/^(true|false)$/.test(I)?(p(v,I==="true",f),h+=1):p(v,a.strings[v]?"":!0,f);else if(/^-[^-]+/.test(f)){for(var S=f.slice(1,-1).split(""),_=!1,b=0;b<S.length;b++){if(I=f.slice(b+2),I==="-"){p(S[b],I,f);continue}if(/[A-Za-z]/.test(S[b])&&I[0]==="="){p(S[b],I.slice(1),f),_=!0;break}if(/[A-Za-z]/.test(S[b])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(I)){p(S[b],I,f),_=!0;break}if(S[b+1]&&S[b+1].match(/\W/)){p(S[b],f.slice(b+2),f),_=!0;break}else p(S[b],a.strings[S[b]]?"":!0,f)}v=f.slice(-1)[0],!_&&v!=="-"&&(i[h+1]&&!/^(-|--)[^-]/.test(i[h+1])&&!a.bools[v]&&(!s[v]||!o(v))?(p(v,i[h+1],f),h+=1):i[h+1]&&/^(true|false)$/.test(i[h+1])?(p(v,i[h+1]==="true",f),h+=1):p(v,a.strings[v]?"":!0,f))}else if((!a.unknownFn||a.unknownFn(f)!==!1)&&c._.push(a.strings._||!t(f)?f:Number(f)),n.stopEarly){c._.push.apply(c._,i.slice(h+1));break}}return Object.keys(u).forEach(function(d){e(c,d.split("."))||(m(c,d.split("."),u[d]),(s[d]||[]).forEach(function(y){m(c,y.split("."),u[d])}))}),n["--"]?c["--"]=g.slice():g.forEach(function(d){c._.push(d)}),c},Ae}var rr=tr();const ir=Tt(rr);async function sr({rootFolder:e}){const t=A.join(e,".git");try{if(E.existsSync(t)){P.warn("Git repository already exists.");return}}catch(i){P.error(`Error checking git folder: ${i}`);return}const r=await X({message:"Do you want to initialize a git repository? (recommended)",options:[{value:!0,label:"Yes",hint:"You can use GitHub to track changes and collaborate with others."},{value:!1,label:"No",hint:"It is not recommended to skip this step."}],initialValue:!0});if(D(r)&&(T("Operation cancelled."),process.exit(0)),r){const i=await de([{title:"Initializing git repository...",task:async n=>{const a=await K("git",["init","-b","main"],{cwd:e});n(a.stdout);const s=await K("git",["add","."],{cwd:e});n(s.stdout);const o=await K("git",["config","user.name"]).then(c=>c.stdout.trim()).catch(()=>""),u=await K("git",["config","user.email"]).then(c=>c.stdout.trim()).catch(()=>"");return o&&u&&(await K("git",["commit","-m","Initial commit"],{cwd:e}),n("Initial commit created.")),"Git repository initialized."}}]);D(i)&&(T("Operation cancelled."),process.exit(0)),P.message(`Now, you can use GitHub Desktop upload your project to GitHub.
56
- GitHub Desktop: https://github.com/apps/desktop`)}}var ie=(e=>(e.VisualStudioCode="vscode",e.Cursor="cursor",e.VSCodium="codium",e.Other="other",e))(ie||{});async function nr({rootFolder:e,fileToOpen:t}){const r=await X({message:"Which IDE do you want to use?",options:[{value:ie.VisualStudioCode,label:"Visual Studio Code"},{value:ie.Cursor,label:"Cursor"},{value:ie.VSCodium,label:"VSCodium"},{value:ie.Other,label:"Other"}],initialValue:ie.VisualStudioCode});if(D(r)&&(T("Operation cancelled."),process.exit(0)),r===void 0)return;let i,n;switch(r){case"vscode":n="Opening in Visual Studio Code...",i="code";break;case"cursor":n="Opening in Cursor...",i="cursor";break;case"codium":n="Opening in VSCodium...",i="codium";break;default:return}await de([{title:n,task:async a=>{try{await Le(i);const s=await K(i,[e]);if(a(s.stdout),t){const o=await K(i,[`${e}/${t}`]);a(o.stdout)}return`Opened project using ${r}`}catch{return`Could not open project using ${r}, since ${r} was not in your PATH`}}}])}var z=(e=>(e[e.VisualNovel=0]="VisualNovel",e[e.TextStory=1]="TextStory",e[e.PointAndClick=2]="PointAndClick",e[e.GameEngine=3]="GameEngine",e[e.Library=4]="Library",e))(z||{}),O=(e=>(e[e.Ink=0]="Ink",e[e.Renpy=1]="Renpy",e[e.Typescript=2]="Typescript",e))(O||{}),M=(e=>(e[e.React=0]="React",e[e.Vue=1]="Vue",e[e.Angular=2]="Angular",e))(M||{});const Qe="My Game",Z=[{type:z.VisualNovel,name:"Visual Novel",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!0},{type:z.TextStory,name:"Text-based Story",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!1},{type:z.PointAndClick,name:"Point & Click Adventure",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!1},{type:z.GameEngine,name:"Game Engine",availableUI:[],availableNarrativeLanguages:[],isMultidevice:!1,canReplaceUI:!1},{type:z.Library,name:"Library",availableUI:[],availableNarrativeLanguages:[],isMultidevice:!1,canReplaceUI:!1}];async function ar({packageName:e}){const t=await X({message:"Select the type of game you want to create:",options:Z.map(c=>({label:c.name,value:c.type})),initialValue:Z[0].type});D(t)&&(T("Operation cancelled."),process.exit(0));const r=Z.find(c=>c.type===t)?.availableUI.map(c=>{let w="";switch(c){case M.React:w=ge("React");break;case M.Vue:w=Qt("Vue");break;case M.Angular:w=Xt("Angular");break}return{label:w,value:c}})||[];let i;r.length===1?(P.warning(`Only one UI framework available: ${r[0].label}. Using it by default.`),i=r[0].value):r.length>0?(i=await X({message:"Select the UI framework you want to use:",options:r,initialValue:Z.find(c=>c.type===t)?.availableUI[0]}),D(i)&&(T("Operation cancelled."),process.exit(0))):i=void 0;const n=Z.find(c=>c.type===t)?.availableNarrativeLanguages.map(c=>{let w="";switch(c){case O.Ink:w="Ink + Typescript";break;case O.Renpy:w=er("Renpy");break;case O.Typescript:w=ge("Typescript");break}return{label:w,value:c}})||[];let a;n.length===1?(P.warning(`Only one narrative language available: ${n[0].label}. Using it by default.`),a=n[0].value):n.length>0?(a=await X({message:"Select the narrative language you want to use:",options:n,initialValue:Z.find(c=>c.type===t)?.availableNarrativeLanguages[0]}),D(a)&&(T("Operation cancelled."),process.exit(0))):a=void 0;const s=Z.find(c=>c.type===t)?.isMultidevice;let o=!1,u="";return s&&(o=await X({message:"Which devices is the project intended for?",options:[{label:"Web page",value:!1},{label:"Web page + Desktop + Mobile (Tauri)",value:!0}],initialValue:!1}),D(o)&&(T("Operation cancelled."),process.exit(0)),o?(u=await se({message:"Project identifier:",initialValue:`com.${e}.app`,validate:c=>{if(!c)return"Identifier is required.";if(!/^[a-zA-Z0-9_.\-]+$/.test(c))return"Identifier can only contain letters, numbers, underscores, dots and dashes."}}),D(u)&&(T("Operation cancelled."),process.exit(0))):u=""),{gameType:t,UIFramework:i,narrativeLanguage:a,multidevice:o,identifier:u}}var N=(e=>(e.Delete="delete",e.Overwrite="overwrite",e.Skip="skip",e.Ask="ask",e.Cancel="cancel",e))(N||{});function or(e){const t=E.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function et(e,t,r){if(!E.existsSync(t))return;const i=E.statSync(t);if(i.isFile())(r===N.Overwrite||r===N.Delete)&&E.rmSync(t,{force:!0});else if(i.isDirectory()){const n=E.readdirSync(e);for(const a of n){const s=A.join(e,a),o=A.join(t,a);et(s,o,r)}}}function ke(e,t,r){if(E.statSync(e).isDirectory()){E.mkdirSync(t,{recursive:!0});for(const i of E.readdirSync(e)){const n=A.join(e,i),a=A.join(t,i);ke(n,a,r)}}else{if(r!==void 0&&E.existsSync(t)){if(r===N.Skip)return;(r===N.Overwrite||r===N.Delete)&&E.rmSync(t,{force:!0})}E.copyFileSync(e,t)}}function ur(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function tt(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}async function cr(){const e=await se({message:"Project name:",defaultValue:Qe,placeholder:Qe,validate:s=>{if(!s)return"Project name cannot be empty"}});D(e)&&(T("Operation cancelled."),process.exit(0));const t=await se({message:"Project description:",defaultValue:"A new game project",placeholder:"A new game project"});D(t)&&(T("Operation cancelled."),process.exit(0));const r=await se({message:"Package name:",defaultValue:tt(e),placeholder:tt(e),validate:s=>{if(s&&!ur(s))return"Invalid package name. The name can only include URL-friendly characters."}});D(r)&&(T("Operation cancelled."),process.exit(0));const i=A.basename(A.resolve()),n=await se({message:"Target directory:",defaultValue:r,placeholder:`${r} (If is equal to ".", the current directory (${i}) will be used)`});D(n)&&(T("Operation cancelled."),process.exit(0));let a;return E.existsSync(n)&&!or(n)?(a=await X({message:"Overwrite existing files?",options:[{hint:"Delete all existing files and create a new project",label:"Delete all",value:N.Delete},{hint:"Overwrite existing conflicting files",label:"Overwrite",value:N.Overwrite},{hint:"Skip existing conflicting files",label:"Skip",value:N.Skip},{hint:"Ask for each file",label:"Ask",value:N.Ask},{hint:"Cancel operation",label:"Cancel",value:N.Cancel}],initialValue:N.Overwrite}),(D(a)||a===N.Cancel)&&(T("Operation cancelled."),process.exit(0))):a=void 0,{projectName:e,foltderName:n,description:t,packageName:r,overwrite:a}}const rt={_gitignore:".gitignore"};function it(e,t,r,i,n){return e=e.replace(/my-app-package-name/g,t),e=e.replace(/my-app-description/g,r),e=e.replace(/my-app-project-name/g,i),n&&(e=e.replace(/com\.my-app-project-name\.app/g,n)),e}function st(e,t,r,i,n){E.existsSync(e)&&E.writeFileSync(e,it(E.readFileSync(e,"utf-8"),t,r,i,n))}async function lr({rootFolder:e,overwrite:t,template:r,packageName:i,description:n,projectName:a,identifier:s}){const o=await de([{title:`Creating project in ${e}...`,task:async()=>{E.existsSync(e)||E.mkdirSync(e,{recursive:!0});const u=A.resolve(lt(import.meta.url),"../..",`${r}`),c=(g,h)=>{const f=A.join(e,rt[g]??g);h?E.writeFileSync(f,h):ke(A.join(u,g),f,t)},w=E.readdirSync(u).map(async g=>{const h=A.join(u,g),f=A.join(e,rt[g]??g);if(E.existsSync(f))switch(t){case N.Ask:if(E.statSync(f).isFile()){const v=await Je({message:`File ${f} already exists. Do you want to overwrite it?`,initialValue:!1});if(D(v)&&(T("Operation cancelled."),process.exit(0)),!v)return;E.rmSync(f,{force:!0})}else{const v=E.readdirSync(h);for(const I of v){const j=A.join(h,I),k=A.join(f,I);if(E.existsSync(k)){const S=await Je({message:`File ${k} already exists. Do you want to overwrite it?`,initialValue:!1});if(D(S)&&(T("Operation cancelled."),process.exit(0)),!S)continue;E.rmSync(k,{force:!0})}ke(j,k,t)}return}break;case N.Skip:return;case N.Overwrite:case N.Delete:et(h,f,t);break}switch(g){case"package.json":case"vite.config.ts":case"index.html":case"README.md":{c(g,it(E.readFileSync(h,"utf-8"),i,n,a));break}case".git":case"package-lock.json":break;default:c(g)}});await Promise.all(w),st(A.join(e,".vscode","launch.json"),i,n,a);const m=A.join(e,"src-tauri");if(E.existsSync(m))for(const g of["Cargo.toml","tauri.conf.json"])st(A.join(m,g),i,n,a,s);const p=A.join(e,"_github");return E.existsSync(p)&&E.renameSync(p,A.join(e,".github")),"Project created"}}]);D(o)&&(T("Operation cancelled."),process.exit(0))}const pr=process.cwd();async function fr(){let e,{description:t,overwrite:r,packageName:i,projectName:n,foltderName:a}=await cr(),{UIFramework:s,gameType:o,narrativeLanguage:u,multidevice:c,identifier:w}=await ar({packageName:i});const m=A.join(pr,a);let p;switch(o){case z.VisualNovel:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-react-vite-muijoy-tauri":p="template-react-vite-muijoy",e="src/content/labels/start.label.ts";break;case O.Ink:c?p="template-react-vite-muijoy-ink-tauri":p="template-react-vite-muijoy-ink",e="ink/start.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.TextStory:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-story-react-vite-muijoy-tauri":p="template-story-react-vite-muijoy",e="src/labels/startLabel.ts";break;case O.Ink:c?p="template-story-react-vite-muijoy-ink-tauri":p="template-story-react-vite-muijoy-ink",e="src/ink/start.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.PointAndClick:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-nqtr-react-vite-muijoy-tauri":p="template-nqtr-react-vite-muijoy",e="src/content/labels/start.label.ts";break;case O.Ink:c?p="template-nqtr-react-vite-muijoy-ink-tauri":p="template-nqtr-react-vite-muijoy-ink",e="ink/start.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.GameEngine:p="template-game-engine",e="src/index.ts";break;case z.Library:p="template-lib",e="src/index.ts";break;default:T("Error: Unknown game type"),process.exit(0)}await lr({rootFolder:m,template:p,packageName:i,description:t,projectName:n,overwrite:r,identifier:w});const g=Z.find(h=>h.type===o)?.canReplaceUI??!1;return{rootFolder:m,fileToOpen:e,canReplaceUI:g}}function hr(){console.info(`
55
+ `}}}}).prompt();let ee=!0;const re=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ne=0;if(re.process&&re.process.env&&re.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:r,TERM:i,COLORTERM:a}=re.process.env;t||r||e==="0"?ee=!1:e==="1"||e==="2"||e==="3"?ee=!0:i==="dumb"?ee=!1:"CI"in re.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(n=>n in re.process.env)?ee=!0:ee=process.stdout.isTTY,ee&&(process.platform==="win32"||a&&(a==="truecolor"||a==="24bit")?ne=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?ne=2:ne=1)}let Ze={enabled:ee,supportLevel:ne};function me(e,t,r=1){const i=`\x1B[${e}m`,a=`\x1B[${t}m`,n=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Ze.enabled&&Ze.supportLevel>=r?i+(""+s).replace(n,i)+a:""+s}const Xt=me(31,39),ge=me(36,39),Qt=me(90,39),er=me(91,39);var Ae,Xe;function tr(){if(Xe)return Ae;Xe=1;function e(i,a){var n=i;a.slice(0,-1).forEach(function(o){n=n[o]||{}});var s=a[a.length-1];return s in n}function t(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function r(i,a){return a==="constructor"&&typeof i[a]=="function"||a==="__proto__"}return Ae=function(i,a){a||(a={});var n={bools:{},strings:{},unknownFn:null};typeof a.unknown=="function"&&(n.unknownFn=a.unknown),typeof a.boolean=="boolean"&&a.boolean?n.allBools=!0:[].concat(a.boolean).filter(Boolean).forEach(function(d){n.bools[d]=!0});var s={};function o(d){return s[d].some(function($){return n.bools[$]})}Object.keys(a.alias||{}).forEach(function(d){s[d]=[].concat(a.alias[d]),s[d].forEach(function($){s[$]=[d].concat(s[d].filter(function(x){return $!==x}))})}),[].concat(a.string).filter(Boolean).forEach(function(d){n.strings[d]=!0,s[d]&&[].concat(s[d]).forEach(function($){n.strings[$]=!0})});var c=a.default||{},u={_:[]};function v(d,$){return n.allBools&&/^--[^=]+$/.test($)||n.strings[d]||n.bools[d]||s[d]}function m(d,$,x){for(var y=d,C=0;C<$.length-1;C++){var V=$[C];if(r(y,V))return;y[V]===void 0&&(y[V]={}),(y[V]===Object.prototype||y[V]===Number.prototype||y[V]===String.prototype)&&(y[V]={}),y[V]===Array.prototype&&(y[V]=[]),y=y[V]}var U=$[$.length-1];r(y,U)||((y===Object.prototype||y===Number.prototype||y===String.prototype)&&(y={}),y===Array.prototype&&(y=[]),y[U]===void 0||n.bools[U]||typeof y[U]=="boolean"?y[U]=x:Array.isArray(y[U])?y[U].push(x):y[U]=[y[U],x])}function p(d,$,x){if(!(x&&n.unknownFn&&!v(d,x)&&n.unknownFn(x)===!1)){var y=!n.strings[d]&&t($)?Number($):$;m(u,d.split("."),y),(s[d]||[]).forEach(function(C){m(u,C.split("."),y)})}}Object.keys(n.bools).forEach(function(d){p(d,c[d]===void 0?!1:c[d])});var g=[];i.indexOf("--")!==-1&&(g=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var f=0;f<i.length;f++){var h=i[f],w,I;if(/^--.+=/.test(h)){var j=h.match(/^--([^=]+)=([\s\S]*)$/);w=j[1];var k=j[2];n.bools[w]&&(k=k!=="false"),p(w,k,h)}else if(/^--no-.+/.test(h))w=h.match(/^--no-(.+)/)[1],p(w,!1,h);else if(/^--.+/.test(h))w=h.match(/^--(.+)/)[1],I=i[f+1],I!==void 0&&!/^(-|--)[^-]/.test(I)&&!n.bools[w]&&!n.allBools&&(!s[w]||!o(w))?(p(w,I,h),f+=1):/^(true|false)$/.test(I)?(p(w,I==="true",h),f+=1):p(w,n.strings[w]?"":!0,h);else if(/^-[^-]+/.test(h)){for(var S=h.slice(1,-1).split(""),_=!1,b=0;b<S.length;b++){if(I=h.slice(b+2),I==="-"){p(S[b],I,h);continue}if(/[A-Za-z]/.test(S[b])&&I[0]==="="){p(S[b],I.slice(1),h),_=!0;break}if(/[A-Za-z]/.test(S[b])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(I)){p(S[b],I,h),_=!0;break}if(S[b+1]&&S[b+1].match(/\W/)){p(S[b],h.slice(b+2),h),_=!0;break}else p(S[b],n.strings[S[b]]?"":!0,h)}w=h.slice(-1)[0],!_&&w!=="-"&&(i[f+1]&&!/^(-|--)[^-]/.test(i[f+1])&&!n.bools[w]&&(!s[w]||!o(w))?(p(w,i[f+1],h),f+=1):i[f+1]&&/^(true|false)$/.test(i[f+1])?(p(w,i[f+1]==="true",h),f+=1):p(w,n.strings[w]?"":!0,h))}else if((!n.unknownFn||n.unknownFn(h)!==!1)&&u._.push(n.strings._||!t(h)?h:Number(h)),a.stopEarly){u._.push.apply(u._,i.slice(f+1));break}}return Object.keys(c).forEach(function(d){e(u,d.split("."))||(m(u,d.split("."),c[d]),(s[d]||[]).forEach(function($){m(u,$.split("."),c[d])}))}),a["--"]?u["--"]=g.slice():g.forEach(function(d){u._.push(d)}),u},Ae}var rr=tr();const ir=Tt(rr);async function sr({rootFolder:e}){const t=A.join(e,".git");try{if(E.existsSync(t)){P.warn("Git repository already exists.");return}}catch(i){P.error(`Error checking git folder: ${i}`);return}const r=await Q({message:"Do you want to initialize a git repository? (recommended)",options:[{value:!0,label:"Yes",hint:"You can use GitHub to track changes and collaborate with others."},{value:!1,label:"No",hint:"It is not recommended to skip this step."}],initialValue:!0});if(D(r)&&(T("Operation cancelled."),process.exit(0)),r){const i=await de([{title:"Initializing git repository...",task:async a=>{const n=await K("git",["init","-b","main"],{cwd:e});a(n.stdout);const s=await K("git",["add","."],{cwd:e});a(s.stdout);const o=await K("git",["config","user.name"]).then(u=>u.stdout.trim()).catch(()=>""),c=await K("git",["config","user.email"]).then(u=>u.stdout.trim()).catch(()=>"");return o&&c&&(await K("git",["commit","-m","Initial commit"],{cwd:e}),a("Initial commit created.")),"Git repository initialized."}}]);D(i)&&(T("Operation cancelled."),process.exit(0)),P.message(`Now, you can use GitHub Desktop upload your project to GitHub.
56
+ GitHub Desktop: https://github.com/apps/desktop`)}}var ie=(e=>(e.VisualStudioCode="vscode",e.Cursor="cursor",e.VSCodium="codium",e.Other="other",e))(ie||{});async function nr({rootFolder:e,fileToOpen:t}){const r=await Q({message:"Which IDE do you want to use?",options:[{value:ie.VisualStudioCode,label:"Visual Studio Code"},{value:ie.Cursor,label:"Cursor"},{value:ie.VSCodium,label:"VSCodium"},{value:ie.Other,label:"Other"}],initialValue:ie.VisualStudioCode});if(D(r)&&(T("Operation cancelled."),process.exit(0)),r===void 0)return;let i,a;switch(r){case"vscode":a="Opening in Visual Studio Code...",i="code";break;case"cursor":a="Opening in Cursor...",i="cursor";break;case"codium":a="Opening in VSCodium...",i="codium";break;default:return}await de([{title:a,task:async n=>{try{await Le(i);const s=await K(i,[e]);if(n(s.stdout),t){const o=await K(i,[`${e}/${t}`]);n(o.stdout)}return`Opened project using ${r}`}catch{return`Could not open project using ${r}, since ${r} was not in your PATH`}}}])}var z=(e=>(e[e.VisualNovel=0]="VisualNovel",e[e.TextStory=1]="TextStory",e[e.PointAndClick=2]="PointAndClick",e[e.GameEngine=3]="GameEngine",e[e.Library=4]="Library",e))(z||{}),O=(e=>(e[e.Ink=0]="Ink",e[e.Renpy=1]="Renpy",e[e.Typescript=2]="Typescript",e))(O||{}),M=(e=>(e[e.React=0]="React",e[e.Vue=1]="Vue",e[e.Angular=2]="Angular",e))(M||{});const Qe="My Game",Z=[{type:z.VisualNovel,name:"Visual Novel",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!0},{type:z.TextStory,name:"Text-based Story",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!1},{type:z.PointAndClick,name:"Point & Click Adventure",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!1},{type:z.GameEngine,name:"Game Engine",availableUI:[],availableNarrativeLanguages:[],isMultidevice:!1,canReplaceUI:!1},{type:z.Library,name:"Library",availableUI:[],availableNarrativeLanguages:[],isMultidevice:!1,canReplaceUI:!1}];async function ar({packageName:e}){const t=await Q({message:"Select the type of game you want to create:",options:Z.map(u=>({label:u.name,value:u.type})),initialValue:Z[0].type});D(t)&&(T("Operation cancelled."),process.exit(0));const r=Z.find(u=>u.type===t)?.availableUI.map(u=>{let v="";switch(u){case M.React:v=ge("React");break;case M.Vue:v=Qt("Vue");break;case M.Angular:v=Xt("Angular");break}return{label:v,value:u}})||[];let i;r.length===1?(P.warning(`Only one UI framework available: ${r[0].label}. Using it by default.`),i=r[0].value):r.length>0?(i=await Q({message:"Select the UI framework you want to use:",options:r,initialValue:Z.find(u=>u.type===t)?.availableUI[0]}),D(i)&&(T("Operation cancelled."),process.exit(0))):i=void 0;const a=Z.find(u=>u.type===t)?.availableNarrativeLanguages.map(u=>{let v="";switch(u){case O.Ink:v="Ink + Typescript";break;case O.Renpy:v=er("Renpy");break;case O.Typescript:v=ge("Typescript");break}return{label:v,value:u}})||[];let n;a.length===1?(P.warning(`Only one narrative language available: ${a[0].label}. Using it by default.`),n=a[0].value):a.length>0?(n=await Q({message:"Select the narrative language you want to use:",options:a,initialValue:Z.find(u=>u.type===t)?.availableNarrativeLanguages[0]}),D(n)&&(T("Operation cancelled."),process.exit(0))):n=void 0;const s=Z.find(u=>u.type===t)?.isMultidevice;let o=!1,c="";return s&&(o=await Q({message:"Which devices is the project intended for?",options:[{label:"Web page",value:!1},{label:"Web page + Desktop + Mobile (Tauri)",value:!0}],initialValue:!1}),D(o)&&(T("Operation cancelled."),process.exit(0)),o?(c=await se({message:"Project identifier:",initialValue:`com.${e}.app`,validate:u=>{if(!u)return"Identifier is required.";if(!/^[a-zA-Z0-9_.\-]+$/.test(u))return"Identifier can only contain letters, numbers, underscores, dots and dashes."}}),D(c)&&(T("Operation cancelled."),process.exit(0))):c=""),{gameType:t,UIFramework:i,narrativeLanguage:n,multidevice:o,identifier:c}}var N=(e=>(e.Delete="delete",e.Overwrite="overwrite",e.Skip="skip",e.Ask="ask",e.Cancel="cancel",e))(N||{});function or(e){const t=E.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function et(e,t,r){if(!E.existsSync(t))return;const i=E.statSync(t);if(i.isFile())(r===N.Overwrite||r===N.Delete)&&E.rmSync(t,{force:!0});else if(i.isDirectory()){const a=E.readdirSync(e);for(const n of a){const s=A.join(e,n),o=A.join(t,n);et(s,o,r)}}}function ke(e,t,r){if(E.statSync(e).isDirectory()){E.mkdirSync(t,{recursive:!0});for(const i of E.readdirSync(e)){const a=A.join(e,i),n=A.join(t,i);ke(a,n,r)}}else{if(r!==void 0&&E.existsSync(t)){if(r===N.Skip)return;(r===N.Overwrite||r===N.Delete)&&E.rmSync(t,{force:!0})}E.copyFileSync(e,t)}}function ur(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function tt(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}async function cr(){const e=await se({message:"Project name:",defaultValue:Qe,placeholder:Qe,validate:s=>{if(!s)return"Project name cannot be empty"}});D(e)&&(T("Operation cancelled."),process.exit(0));const t=await se({message:"Project description:",defaultValue:"A new game project",placeholder:"A new game project"});D(t)&&(T("Operation cancelled."),process.exit(0));const r=await se({message:"Package name:",defaultValue:tt(e),placeholder:tt(e),validate:s=>{if(s&&!ur(s))return"Invalid package name. The name can only include URL-friendly characters."}});D(r)&&(T("Operation cancelled."),process.exit(0));const i=A.basename(A.resolve()),a=await se({message:"Target directory:",defaultValue:r,placeholder:`${r} (If is equal to ".", the current directory (${i}) will be used)`});D(a)&&(T("Operation cancelled."),process.exit(0));let n;return E.existsSync(a)&&!or(a)?(n=await Q({message:"Overwrite existing files?",options:[{hint:"Delete all existing files and create a new project",label:"Delete all",value:N.Delete},{hint:"Overwrite existing conflicting files",label:"Overwrite",value:N.Overwrite},{hint:"Skip existing conflicting files",label:"Skip",value:N.Skip},{hint:"Ask for each file",label:"Ask",value:N.Ask},{hint:"Cancel operation",label:"Cancel",value:N.Cancel}],initialValue:N.Overwrite}),(D(n)||n===N.Cancel)&&(T("Operation cancelled."),process.exit(0))):n=void 0,{projectName:e,foltderName:a,description:t,packageName:r,overwrite:n}}const rt={_gitignore:".gitignore"};function it(e,t,r,i,a){return e=e.replace(/my-app-package-name/g,t),e=e.replace(/my-app-description/g,r),e=e.replace(/my-app-project-name/g,i),a&&(e=e.replace(/com\.my-app-project-name\.app/g,a)),e}function st(e,t,r,i,a){E.existsSync(e)&&E.writeFileSync(e,it(E.readFileSync(e,"utf-8"),t,r,i,a))}async function lr({rootFolder:e,overwrite:t,template:r,packageName:i,description:a,projectName:n,identifier:s}){const o=await de([{title:`Creating project in ${e}...`,task:async()=>{E.existsSync(e)||E.mkdirSync(e,{recursive:!0});const c=A.resolve(lt(import.meta.url),"../..",`${r}`),u=(g,f)=>{const h=A.join(e,rt[g]??g);f?E.writeFileSync(h,f):ke(A.join(c,g),h,t)},v=E.readdirSync(c).map(async g=>{const f=A.join(c,g),h=A.join(e,rt[g]??g);if(E.existsSync(h))switch(t){case N.Ask:if(E.statSync(h).isFile()){const w=await Je({message:`File ${h} already exists. Do you want to overwrite it?`,initialValue:!1});if(D(w)&&(T("Operation cancelled."),process.exit(0)),!w)return;E.rmSync(h,{force:!0})}else{const w=E.readdirSync(f);for(const I of w){const j=A.join(f,I),k=A.join(h,I);if(E.existsSync(k)){const S=await Je({message:`File ${k} already exists. Do you want to overwrite it?`,initialValue:!1});if(D(S)&&(T("Operation cancelled."),process.exit(0)),!S)continue;E.rmSync(k,{force:!0})}ke(j,k,t)}return}break;case N.Skip:return;case N.Overwrite:case N.Delete:et(f,h,t);break}switch(g){case"package.json":case"vite.config.ts":case"index.html":case"README.md":{u(g,it(E.readFileSync(f,"utf-8"),i,a,n));break}case".git":case"package-lock.json":break;default:u(g)}});await Promise.all(v),st(A.join(e,".vscode","launch.json"),i,a,n);const m=A.join(e,"src-tauri");if(E.existsSync(m))for(const g of["Cargo.toml","tauri.conf.json"])st(A.join(m,g),i,a,n,s);const p=A.join(e,"_github");return E.existsSync(p)&&E.renameSync(p,A.join(e,".github")),"Project created"}}]);D(o)&&(T("Operation cancelled."),process.exit(0))}const pr=process.cwd();async function fr(){let e,{description:t,overwrite:r,packageName:i,projectName:a,foltderName:n}=await cr(),{UIFramework:s,gameType:o,narrativeLanguage:c,multidevice:u,identifier:v}=await ar({packageName:i});const m=A.join(pr,n);let p;switch(o){case z.VisualNovel:switch(s){case M.React:switch(c){case O.Typescript:u?p="template-react-vite-muijoy-tauri":p="template-react-vite-muijoy",e="src/content/labels/start.label.ts";break;case O.Ink:u?p="template-react-vite-muijoy-ink-tauri":p="template-react-vite-muijoy-ink",e="ink/start.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.TextStory:switch(s){case M.React:switch(c){case O.Typescript:u?p="template-story-react-vite-muijoy-tauri":p="template-story-react-vite-muijoy",e="src/labels/startLabel.ts";break;case O.Ink:u?p="template-story-react-vite-muijoy-ink-tauri":p="template-story-react-vite-muijoy-ink",e="src/ink/start.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.PointAndClick:switch(s){case M.React:switch(c){case O.Typescript:u?p="template-nqtr-react-vite-muijoy-tauri":p="template-nqtr-react-vite-muijoy",e="src/content/labels/start.label.ts";break;case O.Ink:u?p="template-nqtr-react-vite-muijoy-ink-tauri":p="template-nqtr-react-vite-muijoy-ink",e="ink/start.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.GameEngine:p="template-game-engine",e="src/index.ts";break;case z.Library:p="template-lib",e="src/index.ts";break;default:T("Error: Unknown game type"),process.exit(0)}await lr({rootFolder:m,template:p,packageName:i,description:t,projectName:a,overwrite:r,identifier:v});const g=Z.find(f=>f.type===o)?.canReplaceUI??!1;return{rootFolder:m,fileToOpen:e,canReplaceUI:g}}function hr(){console.info(`
57
57
  \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557
58
58
  \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551
59
59
  \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551
@@ -69,9 +69,9 @@ Options:
69
69
  -t, --template NAME use a specific template
70
70
 
71
71
  Available templates:
72
- ${ge("basic-visual-novel react")}`;async function vr(){try{if(hr(),zt(`Welcome to ${ge("Pixi\u2019VN")}! \u{1F3A8}\u2728`),mr.help){console.log(gr);return}const{rootFolder:e,fileToOpen:t,canReplaceUI:r}=await fr(),i=A.join(e,"package-lock.json");E.existsSync(i)&&E.rmSync(i);const n=dr(process.env.npm_config_user_agent),a=n?n.name:"npm",s=A.relative(nt,e);r&&(P.info("You will need to select a UI theme for your project."),await de([{title:"Installing shadcn globally...",task:async()=>{try{await Le(a),a==="yarn"?await K("yarn",["global","add","shadcn@latest"]):await K(a,["install","-g","shadcn@latest"])}catch{return"Could not install shadcn globally"}return"shadcn installed globally."}}]),P.step("Running ui:reinit..."),a==="yarn"?await K("yarn",["ui:reinit"],{cwd:e,stdio:"inherit"}):await K(a,["run","ui:reinit"],{cwd:e,stdio:"inherit"})),await sr({rootFolder:e}),await nr({rootFolder:e,fileToOpen:t});let o="To run the game:";switch(e!==nt&&(o+=`
73
- cd ${s.includes(" ")?`"${s}"`:s}`),a){case"yarn":o+=`
72
+ ${ge("basic-visual-novel react")}`;async function vr(){try{if(hr(),zt(`Welcome to ${ge("Pixi\u2019VN")}! \u{1F3A8}\u2728`),mr.help){console.log(gr);return}const{rootFolder:e,fileToOpen:t,canReplaceUI:r}=await fr(),i=A.join(e,"package-lock.json");E.existsSync(i)&&E.rmSync(i);const a=dr(process.env.npm_config_user_agent),n=a?a.name:"npm",s=A.relative(nt,e);r&&(P.info("You will need to select a UI theme for your project."),await de([{title:"Installing shadcn globally...",task:async()=>{try{await Le(n),n==="yarn"?await K("yarn",["global","add","shadcn@latest"]):await K(n,["install","-g","shadcn@latest"])}catch{return"Could not install shadcn globally"}return"shadcn installed globally."}}]),P.step("Running ui:reinit..."),n==="yarn"?await K("yarn",["ui:reinit"],{cwd:e,stdio:"inherit"}):await K(n,["run","ui:reinit"],{cwd:e,stdio:"inherit"})),await sr({rootFolder:e}),await nr({rootFolder:e,fileToOpen:t});let o="To run the game:";switch(e!==nt&&(o+=`
73
+ cd ${s.includes(" ")?`"${s}"`:s}`),n){case"yarn":o+=`
74
74
  yarn`,o+=`
75
75
  yarn dev`;break;default:o+=`
76
- ${a} install`,o+=`
77
- ${a} run start`;break}P.message(o),Yt("You're all set! \u{1F389} Now go build your game! \u{1F680}"),await ct("https://pixi-vn.com/start/templates"),console.log()}catch(e){console.error(e)}}vr().catch(e=>{console.error(e)});
76
+ ${n} install`,o+=`
77
+ ${n} run start`;break}P.message(o),Yt("You're all set! \u{1F389} Now go build your game! \u{1F680}"),await ct("https://pixi-vn.com/start/templates"),console.log()}catch(e){console.error(e)}}vr().catch(e=>{console.error(e)});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-pixi-vn",
3
3
  "description": "Create a new Pixi’VN project",
4
- "version": "2.1.0",
4
+ "version": "2.1.1",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0",
7
7
  "author": "DRincs-Productions",
@@ -1,8 +1,7 @@
1
1
  {
2
- "recommendations": [
3
- "ms-vscode.vscode-typescript-next",
4
- "dbaeumer.vscode-eslint",
5
- "esbenp.prettier-vscode",
6
- "vitest.explorer"
7
- ]
8
- }
2
+ "recommendations": [
3
+ "ms-vscode.vscode-typescript-next",
4
+ "vitest.explorer",
5
+ "biomejs.biome"
6
+ ]
7
+ }
@@ -1,30 +1,32 @@
1
1
  {
2
- // Formatter
3
- "[typescript]": {
4
- "editor.defaultFormatter": "esbenp.prettier-vscode",
5
- "editor.formatOnSave": true
6
- },
7
- "[javascript]": {
8
- "editor.defaultFormatter": "esbenp.prettier-vscode",
9
- "editor.formatOnSave": true
10
- },
11
- "prettier.jsxSingleQuote": true,
12
- "prettier.printWidth": 120,
13
- "prettier.useTabs": false,
14
- "prettier.singleAttributePerLine": false,
15
- "prettier.tabWidth": 4,
16
- // reorganise imports
17
- "editor.codeActionsOnSave": {
18
- "source.organizeImports": "explicit"
19
- },
20
- // references
21
- "javascript.referencesCodeLens.enabled": true,
22
- "javascript.referencesCodeLens.showOnAllFunctions": true,
23
- "typescript.referencesCodeLens.enabled": true,
24
- "typescript.referencesCodeLens.showOnAllFunctions": true,
25
- // move file
26
- "javascript.updateImportsOnFileMove.enabled": "always",
27
- "typescript.updateImportsOnFileMove.enabled": "always",
28
- // olther
29
- "extensions.ignoreRecommendations": false,
30
- }
2
+ "extensions.ignoreRecommendations": false,
3
+ // formatter
4
+ "[javascript]": {
5
+ "editor.defaultFormatter": "biomejs.biome",
6
+ "editor.formatOnSave": true
7
+ },
8
+ "[typescript]": {
9
+ "editor.defaultFormatter": "biomejs.biome",
10
+ "editor.formatOnSave": true
11
+ },
12
+ "[json]": {
13
+ "editor.defaultFormatter": "biomejs.biome",
14
+ "editor.formatOnSave": true
15
+ },
16
+ "[jsonc]": {
17
+ "editor.defaultFormatter": "biomejs.biome",
18
+ "editor.formatOnSave": true
19
+ },
20
+ // reorganise imports
21
+ "editor.codeActionsOnSave": {
22
+ "source.organizeImports": "explicit",
23
+ "source.fixAll": "explicit"
24
+ },
25
+ "js/ts.preferences.importModuleSpecifier": "non-relative",
26
+ "js/ts.preferences.importModuleSpecifierEnding": "minimal",
27
+ // references
28
+ "js/ts.referencesCodeLens.enabled": true,
29
+ "js/ts.referencesCodeLens.showOnAllFunctions": true,
30
+ // move file
31
+ "js/ts.updateImportsOnFileMove.enabled": "always"
32
+ }
@@ -8,17 +8,25 @@ on:
8
8
  tags:
9
9
  - 'v*'
10
10
 
11
+ workflow_dispatch:
12
+ inputs:
13
+ run_deploy_docs:
14
+ description: "Run only deploy-docs"
15
+ required: false
16
+ default: "false"
17
+
11
18
  run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }}
12
19
 
13
20
  jobs:
14
21
  build:
15
22
  name: Build
16
23
  runs-on: ubuntu-latest
24
+ if: github.event_name == 'push'
17
25
  steps:
18
26
  - uses: actions/checkout@v3
19
27
  - uses: actions/setup-node@v3
20
28
  with:
21
- node-version: 20
29
+ node-version: 24.12.0
22
30
  - run: npm i
23
31
  - run: npm ci
24
32
  - run: npm run build
@@ -28,11 +36,12 @@ jobs:
28
36
  name: Publish to NPM
29
37
  needs: build
30
38
  runs-on: ubuntu-latest
39
+ if: github.event_name == 'push'
31
40
  steps:
32
41
  - uses: actions/checkout@v3
33
42
  - uses: actions/setup-node@v3
34
43
  with:
35
- node-version: 20
44
+ node-version: 24.12.0
36
45
  registry-url: https://registry.npmjs.org/
37
46
  - run: |
38
47
  npm i
@@ -46,10 +55,55 @@ jobs:
46
55
  name: Create Release
47
56
  needs: publish-npm
48
57
  runs-on: ubuntu-latest
58
+ if: github.event_name == 'push'
59
+ permissions:
60
+ contents: write
61
+ steps:
62
+ - uses: actions/checkout@v3
63
+ - uses: ncipollo/release-action@v1
64
+ with:
65
+ body: |
66
+ Release ${{ github.ref }}
67
+ deploy-docs:
68
+ name: Deploy Docs to Wiki
69
+ runs-on: ubuntu-latest
70
+ if: |
71
+ github.event_name == 'push' ||
72
+ github.event.inputs.run_deploy_docs == 'true'
49
73
  permissions:
50
74
  contents: write
51
75
  steps:
52
- - uses: actions/checkout@v3
53
- - uses: ncipollo/release-action@v1
54
- with:
55
- body: "Release ${{ github.ref }}"
76
+ - name: Checkout repo
77
+ uses: actions/checkout@v3
78
+
79
+ - name: Setup Node
80
+ uses: actions/setup-node@v3
81
+ with:
82
+ node-version: 24.12.0
83
+
84
+ - name: Install deps
85
+ run: npm i
86
+
87
+ - name: Generate docs
88
+ run: npm run docs
89
+
90
+ - name: Clone Wiki
91
+ run: |
92
+ git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git wiki
93
+
94
+ - name: Clean Wiki (safe)
95
+ run: |
96
+ find wiki -mindepth 1 -not -path "wiki/.git*" -delete
97
+
98
+ - name: Copy docs
99
+ run: |
100
+ cp -r doc/* wiki/
101
+
102
+ - name: Commit & Push
103
+ run: |
104
+ cd wiki
105
+ git config user.name "github-actions"
106
+ git config user.email "github-actions@github.com"
107
+ git add .
108
+ git diff --cached --quiet || git commit -m "Update TypeDoc API docs"
109
+ git push
@@ -0,0 +1,71 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/latest/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "files": {
9
+ "ignoreUnknown": true,
10
+ "includes": ["**", "!!**/dist", "!!**/*.test.*", "!!playground"]
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space",
15
+ "indentWidth": 4,
16
+ "lineWidth": 100
17
+ },
18
+ "linter": {
19
+ "enabled": true,
20
+ "rules": {
21
+ "recommended": true,
22
+ "suspicious": {
23
+ "noExplicitAny": "info",
24
+ "noArrayIndexKey": "warn",
25
+ "noDoubleEquals": "info",
26
+ "noThenProperty": "off"
27
+ },
28
+ "a11y": "info",
29
+ "style": {
30
+ "noDefaultExport": "off",
31
+ "useImportType": "info",
32
+ "useConst": "warn"
33
+ }
34
+ },
35
+ "domains": {
36
+ "react": "recommended"
37
+ }
38
+ },
39
+ "javascript": {
40
+ "formatter": {
41
+ "enabled": true,
42
+ "quoteStyle": "double"
43
+ }
44
+ },
45
+ "css": {
46
+ "formatter": {
47
+ "enabled": true,
48
+ "indentStyle": "space",
49
+ "indentWidth": 2
50
+ },
51
+ "parser": {
52
+ "tailwindDirectives": true
53
+ }
54
+ },
55
+ "json": {
56
+ "formatter": {
57
+ "enabled": true,
58
+ "indentStyle": "space",
59
+ "indentWidth": 2,
60
+ "lineWidth": 80
61
+ }
62
+ },
63
+ "assist": {
64
+ "enabled": true,
65
+ "actions": {
66
+ "source": {
67
+ "organizeImports": "off"
68
+ }
69
+ }
70
+ }
71
+ }
@@ -9,10 +9,17 @@
9
9
  "files": [
10
10
  "dist"
11
11
  ],
12
+ "workspaces": [
13
+ "playground"
14
+ ],
12
15
  "scripts": {
13
- "build:post": "node scripts/replace-pixi.js",
14
- "build": "tsup --config tsup.config.ts && npm run build:post",
15
- "test": "vitest"
16
+ "dev": "tsup --watch",
17
+ "build": "tsup --config tsup.config.ts",
18
+ "lint": "biome lint",
19
+ "check": "biome check",
20
+ "format": "biome format --write",
21
+ "test": "vitest",
22
+ "playground": "npm run build && npm run dev --workspace=playground"
16
23
  },
17
24
  "exports": {
18
25
  ".": {
@@ -23,15 +30,17 @@
23
30
  }
24
31
  },
25
32
  "devDependencies": {
26
- "jsdom": "^27.0.0",
33
+ "@biomejs/biome": "^2.4.12",
34
+ "jsdom": "^29.0.2",
27
35
  "ts-node": "^10.9.2",
28
- "tsup": "^8.5.0",
36
+ "tsup": "^8.5.1",
37
+ "typedoc": "^0.28.19",
38
+ "typedoc-plugin-markdown": "^4.12.0",
29
39
  "typescript": "^5.9.3",
30
- "vite-tsconfig-paths": "^6.0.3"
40
+ "vite-tsconfig-paths": "^6.1.1"
31
41
  },
32
42
  "peerDependencies": {
33
- "@drincs/pixi-vn": ">=1.3.31",
34
- "pixi.js": ">=8.0.0"
43
+ "@drincs/pixi-vn": ">=1.5.0"
35
44
  },
36
45
  "keywords": [
37
46
  "game",
@@ -43,6 +52,6 @@
43
52
  "visual-novel"
44
53
  ],
45
54
  "dependencies": {
46
- "vitest": "^3.2.4"
55
+ "vitest": "^4.1.4"
47
56
  }
48
57
  }
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>playground</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/main.tsx"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "playground",
3
+ "private": true,
4
+ "scripts": {
5
+ "dev": "vite",
6
+ "build": "vite build"
7
+ },
8
+ "dependencies": {
9
+ "@drincs/pixi-vn": "^1.8.21"
10
+ },
11
+ "devDependencies": {
12
+ "@types/node": "^22.0.0",
13
+ "@types/react": "^19.0.0",
14
+ "@types/react-dom": "^19.0.0",
15
+ "@vitejs/plugin-react": "^4.3.0",
16
+ "vite": "^5.4.0"
17
+ }
18
+ }
@@ -0,0 +1,3 @@
1
+ export default function App() {
2
+ return <div></div>;
3
+ }
@@ -0,0 +1,33 @@
1
+ import { Container, Game, canvas, sound } from "@drincs/pixi-vn";
2
+ import { createRoot } from "react-dom/client";
3
+ import App from "./App";
4
+
5
+ // Canvas setup with PIXI
6
+ const body = document.body;
7
+ if (!body) {
8
+ throw new Error("body element not found");
9
+ }
10
+
11
+ Game.init(body, {}).then(() => {
12
+ // Pixi.JS UI Layer
13
+ canvas.addLayer("ui", new Container());
14
+
15
+ // Sound setup
16
+ sound.addChannel("bgm", { background: true });
17
+ sound.addChannel("sfx");
18
+ sound.defaultChannelAlias = "sfx";
19
+
20
+ // React setup with ReactDOM
21
+ const root = document.getElementById("root");
22
+ if (!root) {
23
+ throw new Error("root element not found");
24
+ }
25
+
26
+ const htmlLayout = canvas.addHtmlLayer("ui", root);
27
+ if (!htmlLayout) {
28
+ throw new Error("htmlLayout not found");
29
+ }
30
+ const reactRoot = createRoot(htmlLayout);
31
+
32
+ reactRoot.render(<App />);
33
+ });
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "jsx": "react-jsx",
14
+ "strict": true,
15
+ "types": ["node"],
16
+ "paths": {
17
+ "my-app-package-name": ["../src/index.ts"],
18
+ "@/*": ["../src/*"]
19
+ }
20
+ },
21
+ "include": ["src"]
22
+ }
@@ -0,0 +1,14 @@
1
+ import react from "@vitejs/plugin-react";
2
+ import { resolve } from "node:path";
3
+ import { defineConfig } from "vite";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ resolve: {
8
+ alias: {
9
+ "my-app-package-name": resolve(__dirname, "../src/index.ts"),
10
+ // needed for the library's internal "@/" imports (e.g. "@/functions/...")
11
+ "@": resolve(__dirname, "../src"),
12
+ },
13
+ },
14
+ });
@@ -0,0 +1,3 @@
1
+ import { Game } from "@drincs/pixi-vn";
2
+
3
+ Game.init();
@@ -0,0 +1,5 @@
1
+ import { expect, test } from "vitest";
2
+
3
+ test("start", () => {
4
+ expect(true).toBe(true);
5
+ });
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": ".."
5
+ },
6
+ "include": ["../src", "."]
7
+ }
@@ -1,108 +1,21 @@
1
1
  {
2
2
  "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- // "jsx": "preserve", /* Specify what JSX code is generated. */
17
- "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
-
27
- /* Modules */
28
- "module": "commonjs", /* Specify what module code is generated. */
29
- // "rootDir": "./", /* Specify the root folder within your source files. */
30
- // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31
- "baseUrl": ".", /* Specify the base directory to resolve non-relative module names. */
32
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
34
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
35
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
37
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
38
- // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
39
- // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
40
- // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
41
- // "resolveJsonModule": true, /* Enable importing .json files. */
42
- // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
43
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
44
-
45
- /* JavaScript Support */
46
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
47
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
48
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
49
-
50
- /* Emit */
51
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
52
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
53
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
54
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
55
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
56
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
57
- "outDir": "dist", /* Specify an output folder for all emitted files. */
58
- // "removeComments": true, /* Disable emitting comments. */
59
- // "noEmit": true, /* Disable emitting files from a compilation. */
60
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
61
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
62
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
63
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
64
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
65
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
66
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
67
- // "newLine": "crlf", /* Set the newline character for emitting files. */
68
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
69
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
70
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
71
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
72
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
73
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
74
-
75
- /* Interop Constraints */
76
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
77
- // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
78
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
79
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
80
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
81
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
82
-
83
- /* Type Checking */
84
- "strict": true, /* Enable all strict type-checking options. */
85
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
86
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
87
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
88
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
89
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
90
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
91
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
92
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
93
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
94
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
95
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
96
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
97
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
98
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
99
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
100
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
101
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
102
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
103
-
104
- /* Completeness */
105
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
106
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
107
- }
3
+ "target": "ESNext",
4
+ "experimentalDecorators": true,
5
+ "module": "esnext",
6
+ "paths": {
7
+ "pixi.js": ["./node_modules/@drincs/pixi-vn/pixi.js"],
8
+ "@/*": ["./src/*"]
9
+ },
10
+ "resolveJsonModule": true,
11
+ "declaration": true,
12
+ "emitDeclarationOnly": true,
13
+ "sourceMap": true,
14
+ "esModuleInterop": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "strict": true,
17
+ "skipLibCheck": true,
18
+ "ignoreDeprecations": "6.0"
19
+ },
20
+ "include": ["src"]
108
21
  }
@@ -1,24 +1,29 @@
1
- // tsup.config.ts per l'index
2
1
  import { defineConfig } from "tsup";
3
2
 
4
- // https://dev.to/orabazu/how-to-bundle-a-tree-shakable-typescript-library-with-tsup-and-publish-with-npm-3c46
5
- export default defineConfig({
6
- target: "es2020",
7
- entry: {
8
- index: "src/index.ts",
3
+ export default defineConfig([
4
+ {
5
+ target: "es2020",
6
+ entry: {
7
+ index: "src/index.ts",
8
+ },
9
+ format: ["cjs", "esm"],
10
+ dts: true,
11
+ treeshake: true,
12
+ clean: false,
13
+ minify: true,
14
+ bundle: true,
15
+ skipNodeModulesBundle: false,
16
+ external: ["@drincs/pixi-vn", "pixi.js"],
17
+ esbuildOptions(options) {
18
+ options.alias = {
19
+ ...options.alias,
20
+ "pixi.js": "@drincs/pixi-vn/pixi.js",
21
+ };
22
+ },
23
+ outExtension({ format }) {
24
+ return {
25
+ js: format === "esm" ? ".mjs" : ".cjs",
26
+ };
27
+ },
9
28
  },
10
- format: ["cjs", "esm"], // Build for commonJS and ESmodules
11
- dts: true, // Generate declaration file (.d.ts)
12
- treeshake: true,
13
- // sourcemap: true, // Generate sourcemap, it was removed because otherwise it would explode
14
- clean: true,
15
- minify: true,
16
- bundle: true,
17
- skipNodeModulesBundle: false, // Skip bundling of node_modules
18
- external: ["@drincs/pixi-vn", "pixi.js"],
19
- outExtension({ format }) {
20
- return {
21
- js: format === "esm" ? ".mjs" : ".cjs",
22
- };
23
- },
24
- });
29
+ ]);
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "plugin": ["typedoc-plugin-markdown"],
4
+ "entryPoints": ["./src/index.ts"],
5
+ "out": "doc",
6
+ "exclude": ["*.md"],
7
+ "entryFileName": "index.md"
8
+ }
@@ -2,9 +2,9 @@ import tsconfigPaths from "vite-tsconfig-paths";
2
2
  import { defineConfig } from "vitest/config";
3
3
 
4
4
  export default defineConfig({
5
- plugins: [tsconfigPaths()],
5
+ plugins: [tsconfigPaths({ projects: ["./tsconfig.json", "./tests/tsconfig.json"] })],
6
6
  test: {
7
7
  environment: "jsdom",
8
- setupFiles: ["./tests/setup.test.ts"],
8
+ setupFiles: ["tests/setup.ts"],
9
9
  },
10
10
  });
@@ -1,4 +1,5 @@
1
1
  === order_product ===
2
+ # remove image background
2
3
  mc: OK! Let's see, let's look for a book....
3
4
  mc: Here's R****, for $1. Just the thing for me.
4
5
  # remove activity order_product from mc_room
@@ -1,4 +1,5 @@
1
1
  === order_product ===
2
+ # remove image background
2
3
  mc: OK! Let's see, let's look for a book....
3
4
  mc: Here's R****, for $1. Just the thing for me.
4
5
  # remove activity order_product from mc_room
@@ -1,22 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: { browser: true, es2020: true },
4
- extends: [
5
- 'eslint:recommended',
6
- 'plugin:@typescript-eslint/recommended',
7
- 'plugin:react-hooks/recommended',
8
- ],
9
- ignorePatterns: ['dist', '.eslintrc.cjs'],
10
- parser: '@typescript-eslint/parser',
11
- plugins: ['react-refresh'],
12
- rules: {
13
- 'react-refresh/only-export-components': [
14
- 'warn',
15
- { allowConstantExport: true },
16
- ],
17
- },
18
- "prefer-const": ["error", {
19
- "destructuring": "all",
20
- "ignoreReadBeforeAssign": true
21
- }],
22
- }
@@ -1,30 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
-
4
- const DIST_DIR = path.resolve("dist");
5
-
6
- function walk(dir) {
7
- const files = fs.readdirSync(dir);
8
- for (const file of files) {
9
- const fullPath = path.join(dir, file);
10
- const stat = fs.statSync(fullPath);
11
-
12
- if (stat.isDirectory()) {
13
- walk(fullPath);
14
- } else if (/\.(js|mjs|cjs|d\.ts)$/.test(file)) {
15
- let content = fs.readFileSync(fullPath, "utf8");
16
-
17
- const replaced = content.replace(
18
- /(['"])pixi\.js(\/[^'"]*)?\1/g,
19
- (_, quote, subpath = "") => `${quote}@drincs/pixi-vn/pixi.js${subpath}${quote}`
20
- );
21
-
22
- if (replaced !== content) {
23
- fs.writeFileSync(fullPath, replaced, "utf8");
24
- console.log(`✔ patched: ${fullPath}`);
25
- }
26
- }
27
- }
28
- }
29
-
30
- walk(DIST_DIR);
@@ -1,6 +0,0 @@
1
- import { Game } from "@drincs/pixi-vn";
2
- import { test } from "vitest";
3
-
4
- test("setup", async () => {
5
- Game.init();
6
- });