@webflow/webflow-cli 2.3.0 → 2.4.0-next.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.js CHANGED
@@ -1,69 +1,69 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var _C=Object.create;var zu=Object.defineProperty;var FC=Object.getOwnPropertyDescriptor;var AC=Object.getOwnPropertyNames;var TC=Object.getPrototypeOf,RC=Object.prototype.hasOwnProperty;var O=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ju=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),uh=(e,t)=>{for(var r in t)zu(e,r,{get:t[r],enumerable:!0})},IC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of AC(t))!RC.call(e,o)&&o!==r&&zu(e,o,{get:()=>t[o],enumerable:!(n=FC(t,o))||n.enumerable});return e};var D=(e,t,r)=>(r=e!=null?_C(TC(e)):{},IC(t||!e||!e.__esModule?zu(r,"default",{value:e,enumerable:!0}):r,e));var ph,_e,qu,Lt,ne,vt,V,te,R,de=O(()=>{"use strict";ph=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,_e=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,qu=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Lt=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,ne=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,vt=e=>`\x1B[97m${e}\x1B[0m`,V=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,te=e=>`\x1B[1m${e}\x1B[0m`,R=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function NC(){let e=new Map;for(let[t,r]of Object.entries(ve)){for(let[n,o]of Object.entries(r))ve[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=ve[n],e.set(o[0],o[1]);Object.defineProperty(ve,t,{value:r,enumerable:!1})}return Object.defineProperty(ve,"codes",{value:e,enumerable:!1}),ve.color.close="\x1B[39m",ve.bgColor.close="\x1B[49m",ve.color.ansi=fh(),ve.color.ansi256=mh(),ve.color.ansi16m=gh(),ve.bgColor.ansi=fh(10),ve.bgColor.ansi256=mh(10),ve.bgColor.ansi16m=gh(10),Object.defineProperties(ve,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>ve.rgbToAnsi256(...ve.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,o;if(t>=232)r=((t-232)*10+8)/255,n=r,o=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>ve.ansi256ToAnsi(ve.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>ve.ansi256ToAnsi(ve.hexToAnsi256(t)),enumerable:!1}}),ve}var fh,mh,gh,ve,WP,$C,LC,HP,jC,Xt,hh=O(()=>{"use strict";fh=(e=0)=>t=>`\x1B[${t+e}m`,mh=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,gh=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,ve={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},WP=Object.keys(ve.modifier),$C=Object.keys(ve.color),LC=Object.keys(ve.bgColor),HP=[...$C,...LC];jC=NC(),Xt=jC});function Nt(e,t=globalThis.Deno?globalThis.Deno.args:Ka.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return n!==-1&&(o===-1||n<o)}function MC(){if("FORCE_COLOR"in Oe)return Oe.FORCE_COLOR==="true"?1:Oe.FORCE_COLOR==="false"?0:Oe.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Oe.FORCE_COLOR,10),3)}function BC(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function UC(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=MC();n!==void 0&&(Ga=n);let o=r?Ga:n;if(o===0)return 0;if(r){if(Nt("color=16m")||Nt("color=full")||Nt("color=truecolor"))return 3;if(Nt("color=256"))return 2}if("TF_BUILD"in Oe&&"AGENT_NAME"in Oe)return 1;if(e&&!t&&o===void 0)return 0;let i=o||0;if(Oe.TERM==="dumb")return i;if(Ka.default.platform==="win32"){let s=wh.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in Oe)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in Oe)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in Oe)||Oe.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in Oe)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Oe.TEAMCITY_VERSION)?1:0;if(Oe.COLORTERM==="truecolor"||Oe.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Oe){let s=Number.parseInt((Oe.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Oe.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Oe.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Oe.TERM)||"COLORTERM"in Oe?1:i}function yh(e,t={}){let r=UC(e,{streamIsTTY:e&&e.isTTY,...t});return BC(r)}var Ka,wh,Yu,Oe,Ga,WC,Dh,kh=O(()=>{"use strict";Ka=D(require("process"),1),wh=D(require("os"),1),Yu=D(require("tty"),1);({env:Oe}=Ka.default);Nt("no-color")||Nt("no-colors")||Nt("color=false")||Nt("color=never")?Ga=0:(Nt("color")||Nt("colors")||Nt("color=true")||Nt("color=always"))&&(Ga=1);WC={stdout:yh({isTTY:Yu.default.isatty(1)}),stderr:yh({isTTY:Yu.default.isatty(2)})},Dh=WC});function bh(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i);while(n!==-1);return s+=e.slice(i),s}function Eh(e,t,r,n){let o=0,i="";do{let s=e[n-1]==="\r";i+=e.slice(o,s?n-1:n)+t+(s?`\r
2
+ "use strict";var C_=Object.create;var Wd=Object.defineProperty;var F_=Object.getOwnPropertyDescriptor;var __=Object.getOwnPropertyNames;var A_=Object.getPrototypeOf,I_=Object.prototype.hasOwnProperty;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var Hd=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),by=(e,t)=>{for(var n in t)Wd(e,n,{get:t[n],enumerable:!0})},R_=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of __(t))!I_.call(e,o)&&o!==n&&Wd(e,o,{get:()=>t[o],enumerable:!(r=F_(t,o))||r.enumerable});return e};var w=(e,t,n)=>(n=e!=null?C_(A_(e)):{},R_(t||!e||!e.__esModule?Wd(n,"default",{value:e,enumerable:!0}):n,e));var Ey,Ne,Vd,Mt,le,Ft,K,se,R,pe=L(()=>{"use strict";Ey=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,Ne=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,Vd=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Mt=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,le=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,Ft=e=>`\x1B[97m${e}\x1B[0m`,K=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,R=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function L_(){let e=new Map;for(let[t,n]of Object.entries(Ae)){for(let[r,o]of Object.entries(n))Ae[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=Ae[r],e.set(o[0],o[1]);Object.defineProperty(Ae,t,{value:n,enumerable:!1})}return Object.defineProperty(Ae,"codes",{value:e,enumerable:!1}),Ae.color.close="\x1B[39m",Ae.bgColor.close="\x1B[49m",Ae.color.ansi=vy(),Ae.color.ansi256=Sy(),Ae.color.ansi16m=xy(),Ae.bgColor.ansi=vy(10),Ae.bgColor.ansi256=Sy(10),Ae.bgColor.ansi16m=xy(10),Object.defineProperties(Ae,{rgbToAnsi256:{value(t,n,r){return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(i=>i+i).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>Ae.rgbToAnsi256(...Ae.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,r,o;if(t>=232)n=((t-232)*10+8)/255,r=n,o=n;else{t-=16;let a=t%36;n=Math.floor(t/36)/5,r=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(n,r,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(n));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,n,r)=>Ae.ansi256ToAnsi(Ae.rgbToAnsi256(t,n,r)),enumerable:!1},hexToAnsi:{value:t=>Ae.ansi256ToAnsi(Ae.hexToAnsi256(t)),enumerable:!1}}),Ae}var vy,Sy,xy,Ae,NN,$_,O_,jN,N_,tn,Cy=L(()=>{"use strict";vy=(e=0)=>t=>`\x1B[${t+e}m`,Sy=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,xy=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,Ae={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},NN=Object.keys(Ae.modifier),$_=Object.keys(Ae.color),O_=Object.keys(Ae.bgColor),jN=[...$_,...O_];N_=L_(),tn=N_});function Bt(e,t=globalThis.Deno?globalThis.Deno.args:_l.default.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}function j_(){if("FORCE_COLOR"in Ue)return Ue.FORCE_COLOR==="true"?1:Ue.FORCE_COLOR==="false"?0:Ue.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ue.FORCE_COLOR,10),3)}function M_(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function B_(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=j_();r!==void 0&&(Fl=r);let o=n?Fl:r;if(o===0)return 0;if(n){if(Bt("color=16m")||Bt("color=full")||Bt("color=truecolor"))return 3;if(Bt("color=256"))return 2}if("TF_BUILD"in Ue&&"AGENT_NAME"in Ue)return 1;if(e&&!t&&o===void 0)return 0;let i=o||0;if(Ue.TERM==="dumb")return i;if(_l.default.platform==="win32"){let s=_y.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in Ue)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in Ue)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in Ue)||Ue.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in Ue)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ue.TEAMCITY_VERSION)?1:0;if(Ue.COLORTERM==="truecolor"||Ue.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Ue){let s=Number.parseInt((Ue.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ue.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ue.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ue.TERM)||"COLORTERM"in Ue?1:i}function Fy(e,t={}){let n=B_(e,{streamIsTTY:e&&e.isTTY,...t});return M_(n)}var _l,_y,Gd,Ue,Fl,U_,Ay,Iy=L(()=>{"use strict";_l=w(require("process"),1),_y=w(require("os"),1),Gd=w(require("tty"),1);({env:Ue}=_l.default);Bt("no-color")||Bt("no-colors")||Bt("color=false")||Bt("color=never")?Fl=0:(Bt("color")||Bt("colors")||Bt("color=true")||Bt("color=always"))&&(Fl=1);U_={stdout:Fy({isTTY:Gd.default.isatty(1)}),stderr:Fy({isTTY:Gd.default.isatty(2)})},Ay=U_});function Ry(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,r)+t+n,i=r+o,r=e.indexOf(t,i);while(r!==-1);return s+=e.slice(i),s}function Ty(e,t,n,r){let o=0,i="";do{let s=e[r-1]==="\r";i+=e.slice(o,s?r-1:r)+t+(s?`\r
3
3
  `:`
4
- `)+r,o=n+1,n=e.indexOf(`
5
- `,o)}while(n!==-1);return i+=e.slice(o),i}var vh=O(()=>{"use strict"});function Qi(e){return VC(e)}var Sh,xh,Xu,Lo,Zi,Ch,No,HC,VC,Zu,GC,KC,Qu,za,zC,JC,YP,Zt,ed=O(()=>{"use strict";hh();kh();vh();({stdout:Sh,stderr:xh}=Dh),Xu=Symbol("GENERATOR"),Lo=Symbol("STYLER"),Zi=Symbol("IS_EMPTY"),Ch=["ansi","ansi","ansi256","ansi16m"],No=Object.create(null),HC=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Sh?Sh.level:0;e.level=t.level===void 0?r:t.level},VC=e=>{let t=(...r)=>r.join(" ");return HC(t,e),Object.setPrototypeOf(t,Qi.prototype),t};Object.setPrototypeOf(Qi.prototype,Function.prototype);for(let[e,t]of Object.entries(Xt))No[e]={get(){let r=za(this,Qu(t.open,t.close,this[Lo]),this[Zi]);return Object.defineProperty(this,e,{value:r}),r}};No.visible={get(){let e=za(this,this[Lo],!0);return Object.defineProperty(this,"visible",{value:e}),e}};Zu=(e,t,r,...n)=>e==="rgb"?t==="ansi16m"?Xt[r].ansi16m(...n):t==="ansi256"?Xt[r].ansi256(Xt.rgbToAnsi256(...n)):Xt[r].ansi(Xt.rgbToAnsi(...n)):e==="hex"?Zu("rgb",t,r,...Xt.hexToRgb(...n)):Xt[r][e](...n),GC=["rgb","hex","ansi256"];for(let e of GC){No[e]={get(){let{level:r}=this;return function(...n){let o=Qu(Zu(e,Ch[r],"color",...n),Xt.color.close,this[Lo]);return za(this,o,this[Zi])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);No[t]={get(){let{level:r}=this;return function(...n){let o=Qu(Zu(e,Ch[r],"bgColor",...n),Xt.bgColor.close,this[Lo]);return za(this,o,this[Zi])}}}}KC=Object.defineProperties(()=>{},{...No,level:{enumerable:!0,get(){return this[Xu].level},set(e){this[Xu].level=e}}}),Qu=(e,t,r)=>{let n,o;return r===void 0?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},za=(e,t,r)=>{let n=(...o)=>zC(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,KC),n[Xu]=e,n[Lo]=t,n[Zi]=r,n},zC=(e,t)=>{if(e.level<=0||!t)return e[Zi]?"":t;let r=e[Lo];if(r===void 0)return t;let{openAll:n,closeAll:o}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=bh(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
6
- `);return i!==-1&&(t=Eh(t,o,n,i)),n+t+o};Object.defineProperties(Qi.prototype,No);JC=Qi(),YP=Qi({level:xh?xh.level:0}),Zt=JC});function td(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))qC(e,t,o,r);return XC(e,t),t_(e,t,n),e}var qC,YC,XC,ZC,QC,e_,t_,_h=O(()=>{"use strict";qC=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let o=Object.getOwnPropertyDescriptor(e,r),i=Object.getOwnPropertyDescriptor(t,r);!YC(o,i)&&n||Object.defineProperty(e,r,i)},YC=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},XC=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},ZC=(e,t)=>`/* Wrapped ${e}*/
7
- ${t}`,QC=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),e_=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),t_=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=ZC.bind(null,n,t.toString());Object.defineProperty(o,"name",e_);let{writable:i,enumerable:s,configurable:a}=QC;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var Ja,Fh,Ah,Th=O(()=>{"use strict";_h();Ja=new WeakMap,Fh=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0,o=e.displayName||e.name||"<anonymous>",i=function(...s){if(Ja.set(i,++n),n===1)r=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return r};return td(i,e),Ja.set(i,n),i};Fh.callCount=e=>{if(!Ja.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Ja.get(e)};Ah=Fh});var Tn,Rh=O(()=>{"use strict";Tn=[];Tn.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Tn.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Tn.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var qa,rd,nd,r_,od,Ya,n_,id,sd,ad,Ih,n$,o$,Oh=O(()=>{"use strict";Rh();qa=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",rd=Symbol.for("signal-exit emitter"),nd=globalThis,r_=Object.defineProperty.bind(Object),od=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(nd[rd])return nd[rd];r_(nd,rd,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},Ya=class{},n_=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),id=class extends Ya{onExit(){return()=>{}}load(){}unload(){}},sd=class extends Ya{#s=ad.platform==="win32"?"SIGINT":"SIGHUP";#r=new od;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let r of Tn)this.#t[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#s:r;s||t.kill(t.pid,a)}};this.#p=t.reallyExit,this.#o=t.emit}onExit(t,r){if(!qa(this.#e))return()=>{};this.#i===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{this.#r.removeListener(n,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#r.count+=1;for(let t of Tn)try{let r=this.#t[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#f(t,...r),this.#e.reallyExit=t=>this.#n(t)}}unload(){this.#i&&(this.#i=!1,Tn.forEach(t=>{let r=this.#t[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#p,this.#r.count-=1)}#n(t){return qa(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#f(t,...r){let n=this.#o;if(t==="exit"&&qa(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let o=n.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},ad=globalThis.process,{onExit:Ih,load:n$,unload:o$}=n_(qa(ad)?new sd(ad):new id)});var es,Ph,o_,$h,Lh=O(()=>{"use strict";es=D(require("process"),1);Th();Oh();Ph=es.default.stderr.isTTY?es.default.stderr:es.default.stdout.isTTY?es.default.stdout:void 0,o_=Ph?Ah(()=>{Ih(()=>{Ph.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},$h=o_});var ld,Xa,jo,cd,Nh=O(()=>{"use strict";ld=D(require("process"),1);Lh();Xa=!1,jo={};jo.show=(e=ld.default.stderr)=>{e.isTTY&&(Xa=!1,e.write("\x1B[?25h"))};jo.hide=(e=ld.default.stderr)=>{e.isTTY&&($h(),Xa=!0,e.write("\x1B[?25l"))};jo.toggle=(e,t)=>{e!==void 0&&(Xa=e),Xa?jo.show(t):jo.hide(t)};cd=jo});var jh=Ju((d$,i_)=>{i_.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var ud=Ju((p$,Bh)=>{"use strict";var Za=Object.assign({},jh()),Mh=Object.keys(Za);Object.defineProperty(Za,"random",{get(){let e=Math.floor(Math.random()*Mh.length),t=Mh[e];return Za[t]}});Bh.exports=Za});function dd(){return jt.default.platform!=="win32"?jt.default.env.TERM!=="linux":!!jt.default.env.CI||!!jt.default.env.WT_SESSION||!!jt.default.env.TERMINUS_SUBLIME||jt.default.env.ConEmuTask==="{cmd::Cmder}"||jt.default.env.TERM_PROGRAM==="Terminus-Sublime"||jt.default.env.TERM_PROGRAM==="vscode"||jt.default.env.TERM==="xterm-256color"||jt.default.env.TERM==="alacritty"||jt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var jt,Uh=O(()=>{"use strict";jt=D(require("process"),1)});var s_,a_,l_,ts,Wh=O(()=>{"use strict";ed();Uh();s_={info:Zt.blue("\u2139"),success:Zt.green("\u2714"),warning:Zt.yellow("\u26A0"),error:Zt.red("\u2716")},a_={info:Zt.blue("i"),success:Zt.green("\u221A"),warning:Zt.yellow("\u203C"),error:Zt.red("\xD7")},l_=dd()?s_:a_,ts=l_});function pd({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var Hh=O(()=>{"use strict"});function fd(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(c_,"")}var c_,Vh=O(()=>{"use strict";Hh();c_=pd()});function md({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var Gh=O(()=>{"use strict"});function gd(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(u_,"")}var u_,Kh=O(()=>{"use strict";Gh();u_=md()});var Qa,el,hd,yd,rs,zh=O(()=>{"use strict";Qa=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],el=[12288,12288,65281,65376,65504,65510],hd=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],yd=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],rs=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141]});var tl,Jh=O(()=>{"use strict";tl=(e,t)=>{let r=0,n=Math.floor(e.length/2)-1;for(;r<=n;){let o=Math.floor((r+n)/2),i=o*2;if(t<e[i])n=o-1;else if(t>e[i+1])r=o+1;else return!0}return!1}});function D_(e){let t=e[0],r=e[1];for(let n=0;n<e.length;n+=2){let o=e[n],i=e[n+1];if(qh>=o&&qh<=i)return[o,i];i-o>r-t&&(t=o,r=i)}return[t,r]}var d_,p_,f_,m_,_$,F$,A$,T$,g_,h_,qh,y_,w_,Yh,Xh,Zh,Qh=O(()=>{"use strict";zh();Jh();d_=Qa[0],p_=Qa.at(-1),f_=el[0],m_=el.at(-1),_$=hd[0],F$=hd.at(-1),A$=yd[0],T$=yd.at(-1),g_=rs[0],h_=rs.at(-1),qh=19968,[y_,w_]=D_(rs);Yh=e=>e<d_||e>p_?!1:tl(Qa,e),Xh=e=>e<f_||e>m_?!1:tl(el,e),Zh=e=>e>=y_&&e<=w_?!0:e<g_||e>h_?!1:tl(rs,e)});function k_(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function ey(e,{ambiguousAsWide:t=!1}={}){return k_(e),Xh(e)||Zh(e)||t&&Yh(e)?2:1}var ty=O(()=>{"use strict";Qh()});var ry,ny=O(()=>{"use strict";ry=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});function wd(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=gd(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!r};for(let{segment:s}of b_.segment(e)){let a=s.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!E_.test(s)){if(ry().test(s)){o+=2;continue}o+=ey(a,i)}}return o}var b_,E_,oy=O(()=>{"use strict";Kh();ty();ny();b_=new Intl.Segmenter,E_=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function Dd({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var iy=O(()=>{"use strict"});function bd(){let{env:e}=kd.default,{TERM:t,TERM_PROGRAM:r}=e;return kd.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var kd,sy=O(()=>{"use strict";kd=D(require("process"),1)});var Qt,v_,Ed,S_,vd,ay=O(()=>{"use strict";Qt=D(require("process"),1),v_=3,Ed=class{#s=0;start(){this.#s++,this.#s===1&&this.#r()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#r(){Qt.default.platform==="win32"||!Qt.default.stdin.isTTY||(Qt.default.stdin.setRawMode(!0),Qt.default.stdin.on("data",this.#o),Qt.default.stdin.resume())}#e(){Qt.default.stdin.isTTY&&(Qt.default.stdin.off("data",this.#o),Qt.default.stdin.pause(),Qt.default.stdin.setRawMode(!1))}#o(t){t[0]===v_&&Qt.default.emit("SIGINT")}},S_=new Ed,vd=S_});function xd(e){return new Sd(e)}var ns,os,x_,Sd,ly=O(()=>{"use strict";ns=D(require("process"),1);ed();Nh();os=D(ud(),1);Wh();Vh();oy();iy();sy();ay();x_=D(ud(),1),Sd=class{#s=0;#r=!1;#e=0;#o=-1;#p=0;#t;#i;#n;#f;#g;#c;#u;#d;#h;#a;#l;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:ns.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#n=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Dd({stream:this.#n}),this.#u=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,ns.default.env.NODE_ENV==="test"&&(this._stream=this.#n,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(r){this.#s=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#o}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=t,this.#m()}get interval(){return this.#g??this.#i.interval??100}get spinner(){return this.#i}set spinner(t){if(this.#o=-1,this.#g=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#i=t}else if(!bd())this.#i=os.default.line;else if(t===void 0)this.#i=os.default.dots;else if(t!=="default"&&os.default[t])this.#i=os.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#a}set prefixText(t=""){this.#a=t,this.#m()}get suffixText(){return this.#l}set suffixText(t=""){this.#l=t,this.#m()}get isSpinning(){return this.#f!==void 0}#y(t=this.#a,r=" "){return typeof t=="string"&&t!==""?t+r:typeof t=="function"?t()+r:""}#w(t=this.#l,r=" "){return typeof t=="string"&&t!==""?r+t:typeof t=="function"?r+t():""}#m(){let t=this.#n.columns??80,r=this.#y(this.#a,"-"),n=this.#w(this.#l,"-"),o=" ".repeat(this.#d)+r+"--"+this.#h+"--"+n;this.#e=0;for(let i of fd(o).split(`
8
- `))this.#e+=Math.max(1,Math.ceil(wd(i,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#c&&!this.#u}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#c=t}get isSilent(){return this.#u}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#u=t}frame(){let t=Date.now();(this.#o===-1||t-this.#p>=this.interval)&&(this.#o=++this.#o%this.#i.frames.length,this.#p=t);let{frames:r}=this.#i,n=r[this.#o];this.color&&(n=Zt[this.color](n));let o=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",i=typeof this.text=="string"?" "+this.text:"",s=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return o+n+i+s}clear(){if(!this.#c||!this.#n.isTTY)return this;this.#n.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#n.moveCursor(0,-1),this.#n.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#n.cursorTo(this.#d),this.lastIndent=this.#d,this.#s=0,this}render(){return this.#u?this:(this.clear(),this.#n.write(this.frame()),this.#s=this.#e,this)}start(t){return t&&(this.text=t),this.#u?this:this.#c?this.isSpinning?this:(this.#t.hideCursor&&cd.hide(this.#n),this.#t.discardStdin&&ns.default.stdin.isTTY&&(this.#r=!0,vd.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#n.write(`- ${this.text}
9
- `),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&cd.show(this.#n),this.#t.discardStdin&&ns.default.stdin.isTTY&&this.#r&&(vd.stop(),this.#r=!1),this):this}succeed(t){return this.stopAndPersist({symbol:ts.success,text:t})}fail(t){return this.stopAndPersist({symbol:ts.error,text:t})}warn(t){return this.stopAndPersist({symbol:ts.warning,text:t})}info(t){return this.stopAndPersist({symbol:ts.info,text:t})}stopAndPersist(t={}){if(this.#u)return this;let r=t.prefixText??this.#a,n=this.#y(r," "),o=t.symbol??" ",i=t.text??this.text,a=typeof i=="string"?(o?" ":"")+i:"",l=t.suffixText??this.#l,c=this.#w(l," "),d=n+o+a+c+`
10
- `;return this.stop(),this.#n.write(d),this}}});function is(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),rl.default.platform==="darwin"?C_(e):rl.default.platform==="win32"?__(e):F_(e)}var Se,Cd,rl,qr,_d,Mo,C_,__,F_,Fd=O(()=>{"use strict";Se=D(require("path"),1),Cd=D(require("os"),1),rl=D(require("process"),1),qr=Cd.default.homedir(),_d=Cd.default.tmpdir(),{env:Mo}=rl.default,C_=e=>{let t=Se.default.join(qr,"Library");return{data:Se.default.join(t,"Application Support",e),config:Se.default.join(t,"Preferences",e),cache:Se.default.join(t,"Caches",e),log:Se.default.join(t,"Logs",e),temp:Se.default.join(_d,e)}},__=e=>{let t=Mo.APPDATA||Se.default.join(qr,"AppData","Roaming"),r=Mo.LOCALAPPDATA||Se.default.join(qr,"AppData","Local");return{data:Se.default.join(r,e,"Data"),config:Se.default.join(t,e,"Config"),cache:Se.default.join(r,e,"Cache"),log:Se.default.join(r,e,"Log"),temp:Se.default.join(_d,e)}},F_=e=>{let t=Se.default.basename(qr);return{data:Se.default.join(Mo.XDG_DATA_HOME||Se.default.join(qr,".local","share"),e),config:Se.default.join(Mo.XDG_CONFIG_HOME||Se.default.join(qr,".config"),e),cache:Se.default.join(Mo.XDG_CACHE_HOME||Se.default.join(qr,".cache"),e),log:Se.default.join(Mo.XDG_STATE_HOME||Se.default.join(qr,".local","state"),e),temp:Se.default.join(_d,t,e)}}});function nl(){return/[<>:"/\\|?*\u0000-\u001F]/g}function cy(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var uy=O(()=>{"use strict"});function ss(e,t={}){let r=/[\u0000-\u001F\u0080-\u009F]/g,n=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof e!="string")throw new TypeError("Expected a string");let o=t.replacement===void 0?"!":t.replacement;if(nl().test(o)&&r.test(o))throw new Error("Replacement string cannot contain reserved filename characters");o.length>0&&(e=e.replace(n,"$1")),e=e.normalize("NFD"),e=e.replace(T_,o),e=e.replace(nl(),o),e=e.replace(r,o),e=e.replace(R_,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=cy().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:A_;if(e.length>i){let s=e.lastIndexOf(".");if(s===-1)e=e.slice(0,i);else{let a=e.slice(0,s),l=e.slice(s);e=a.slice(0,Math.max(1,i-l.length))+l}}return e}var A_,T_,R_,Ad=O(()=>{"use strict";uy();A_=100,T_=/^\.+(\\|\/)|^\.+$/,R_=/\.+$/});var I_,dy=O(()=>{"use strict";I_=D(require("path"),1);Ad()});var py=O(()=>{"use strict";Ad();dy()});var ol,Td=O(()=>{"use strict";ol="webflow.json"});var Rn,Rd=O(()=>{"use strict";Rn=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function yy(e){fy=e}function wy(e){my=e}function O_(){for(let e of Dy){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function P_(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||O_()!==null}function W(){return fy?!0:my?!1:P_()}function er(){return!W()}function ky(e){gy=e}function ze(){return gy}function by(e){hy=e}function Ey(){return hy}var fy,my,gy,hy,Dy,uL,pe=O(()=>{"use strict";fy=!1,my=!1,gy=!1;Dy=[{variable:"CLAUDECODE",agent:"claude-code"},{variable:"CODEX_THREAD_ID",agent:"codex"},{variable:"CODEX_SANDBOX",agent:"codex"},{variable:"GEMINI_CLI",agent:"gemini-cli"},{variable:"OPENCODE_CLIENT",agent:"opencode"},{variable:"AI_AGENT",agent:"generic-agent"},{variable:"COPILOT_MODEL",agent:"copilot"},{variable:"AUGMENT_AGENT",agent:"augment"},{variable:"ANTIGRAVITY_AGENT",agent:"antigravity"},{variable:"CURSOR_AGENT",agent:"cursor"},{variable:"CURSOR_EXTENSION_HOST_ROLE",agent:"cursor",value:"agent-exec"}],uL=Dy.map(e=>e.variable)});function In(){let e=Ey();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,vy.statSync)(e)?.isDirectory())return{path:(0,Sy.join)(e,ol),isUserDefined:!0}}catch{if(e.endsWith(".json"))return{path:e,isUserDefined:!0}}throw new Error(`Manifest path must be either a directory or a .json file. Got: ${e}`)}return{path:`./${ol}`,isUserDefined:!1}}var vy,Sy,Id=O(()=>{"use strict";vy=require("fs"),Sy=require("path");Td();pe()});var xy,$_,L_,Od,Cy=O(()=>{"use strict";xy=D(require("ajv")),$_=new xy.default,L_={type:"object",properties:{library:{type:"object",properties:{name:{type:"string",minLength:1},id:{type:"string",minLength:1},components:{type:"array",items:{type:"string"},minItems:1},renderer:{anyOf:[{type:"object",properties:{client:{type:"string",minLength:1},server:{type:"string",minLength:1}}},{type:"string",minLength:1}]},globals:{type:"string",minLength:1}},required:[]},devlink:{type:"object",properties:{rootDir:{type:"string",minLength:1},cssModules:{type:"boolean"},allowTelemetry:{type:"boolean"},overwriteModule:{type:"boolean"},skipTagSelectors:{type:"boolean"},envVariables:{type:"object",additionalProperties:{type:"string"}},components:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},fileExtensions:{type:"object",properties:{js:{type:"string"},css:{type:"string"}}},relativeHrefRoot:{oneOf:[{type:"boolean"},{type:"string"}]}},required:["rootDir"]},"devlink-export":{type:"object",properties:{rootDir:{type:"string",minLength:1},components:{type:"string"},componentGroups:{type:"string"},ts:{type:"boolean"},cssScopes:{type:"boolean"},relativeHrefRoot:{oneOf:[{type:"boolean",const:!1},{type:"string"}]},treeShake:{type:"boolean"},camelCaseVariantNames:{type:"boolean"}},required:[]}}},Od=$_.compile(L_)});function _y(e){return e instanceof Error?e:new Error("Unknown error")}function Z(){let{path:e}=In();if(!(0,il.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,il.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${_y(o).message}`)}if(t.trim()==="")return{manifest:{},manifestPath:e};let n;try{n=JSON.parse(t)}catch(o){throw new Error(`Invalid JSON in manifest file: ${_y(o).message}`)}if(!Od(n)){let o=Od.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:n,manifestPath:e}}var il,as=O(()=>{"use strict";il=require("fs");Id();Cy()});function ls(e,t){let r=e[t];if(!r)throw new Rn(t);return r}var Fy=O(()=>{"use strict";Rd()});function xe(e){let t=Z(),r=t.manifest,n=t.manifestPath,o={...r};for(let i in e){let s=i,a=e[s];if(a!==void 0)if(typeof a=="string"||typeof a=="number"||typeof a=="boolean"||a===null)o[s]=a;else{let l=o[s];o[s]={...typeof l=="object"&&l!==null?l:{},...a}}}return(0,Ay.writeFileSync)(n,JSON.stringify(o,null,2),"utf-8"),o}var Ay,Pd=O(()=>{"use strict";Ay=require("fs");as()});var Me=O(()=>{"use strict";Td();Rd();as();Id();Fy();Pd()});var sl=Ju((TL,N_)=>{N_.exports={name:"@webflow/webflow-cli",version:"2.3.0",license:"MIT",bin:{webflow:"./dist/index.js"},scripts:{build:"tsup",dev:"tsup",lint:"eslint .",test:"jest --ci","test:unit":"jest --ci --ignoreProjects e2e","test:local":"jest","test:e2e:deploy":"bash regression/run-local.sh","test:regression":"jest --config regression/jest.config.js --testTimeout=420000","test:e2e-cache-clear":"bash scripts/clear-e2e-cache.sh"},files:["CHANGELOG.md","dist/**/*"],publishConfig:{access:"public"},dependencies:{"@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@babel/preset-typescript":"^7.27.0","@dotenvx/dotenvx":"^1.44.1","@inquirer/prompts":"^7.9.0","@module-federation/enhanced":"2.5.1","@rspack/core":"^1.7.8","@webflow/cosmic-deploy-contract":"^1.0.2","@webflow/data-types":"*",ajv:"^8.17.1",archiver:"^5.3.1","babel-loader":"^10.0.0",commander:"^10.0.0",cosmiconfig:"^8.2.0","css-loader":"^7.1.2",dotenv:"^16.0.3","env-paths":"^3.0.0","fast-glob":"^3.3.3",filenamify:"^6.0.0","fork-ts-checker-webpack-plugin":"9.1.0","form-data":"4.0.4","fs-extra":"^11.3.0",jsdom:"^26.0.0","jsonc-parser":"^3.2.0",md5:"^2.2.1",memfs:"4.17.0","mime-types":"^2.1.35","mini-css-extract-plugin":"^2.9.2","node-fetch":"^2.6.7",open:"^8.4.2",ora:"^8.2.0",postcss:"^8.5.6","postcss-loader":"^8.1.1","postcss-selector-parser":"^7.1.0",semver:"^7.7.2","serve-handler":"^6.1.5","source-map-support":"^0.5.21",tar:"^7.5.19","ts-checker-rspack-plugin":"^1.0.0","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.2.0",unionfs:"^4.5.4","webflow-api":"3.3.4",webpack:">=5.99.7 <5.106.0","webpack-merge":"^6.0.1","webpack-node-externals":"^3.0.0",yaml:"^2.8.4",zod:"^3.22.4"},devDependencies:{"@module-federation/sdk":"2.5.1","@types/archiver":"^5.3.2","@types/express":"^4.17.13","@types/fs-extra":"^11.0.4","@types/jest":"^29.2.3","@types/md5":"^2.3.2","@types/mime-types":"^2.1.4","@types/nock":"^8.0.33","@types/node":"^22.13.0","@types/node-fetch":"2.6.13","@types/serve-handler":"^6.1.1","@types/source-map":"^0.5.2","@types/webpack-node-externals":"^3.0.4",astro:"^7.0.6","eslint-config-custom":"*",express:"^4.18.1",jest:"^29.3.1",nock:"13.3.1",tar:"^7.5.19","ts-jest":"^29.4.9","ts-node":"^10.9.1",tsconfig:"*",tsup:"^8.4.0",typescript:"^5.9.3"},engines:{node:">=22.13.0"}}});function Ar(){try{return sl().version}catch{return"unknown"}}function pr(e=""){if(!e)return"";let t=e;t=t.replace(/\/.*?\/webflow-cli/gi,"/REDACTED_PII/webflow-cli"),t=t.replace(/\/.*?\/node_modules/gi,"/REDACTED_PII/node_modules");let r=cs.default.homedir();if(r){let o=new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let n=cs.default.userInfo().username;if(n){let o=new RegExp(`/Users/${n}`,"gi");t=t.replace(o,"/Users/REDACTED_PII")}return t=t.replace(/\/Users\/[^\/\s]+/gi,"/Users/REDACTED_PII"),t=t.replace(/C:\\Users\\[^\\]+/gi,"C:\\Users\\REDACTED_PII"),t=t.replace(/[a-zA-Z0-9]{32,}/g,"[REDACTED_TOKEN]"),t=t.replace(/Bearer\s+[^\s]+/gi,"Bearer [REDACTED_TOKEN]"),t=t.replace(/token[=:]\s*[^\s]+/gi,"token=[REDACTED_TOKEN]"),t=t.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,"[REDACTED_EMAIL]"),t=t.replace(/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g,"[REDACTED_IP]"),t}function $d(e){if(e.stack)return pr(e.stack)}function Yr(e){let t=["password","token","secret","key","auth","bearer","authorization","apikey","api_key","access_token","refresh_token","client_secret","private_key"],r={};for(let[n,o]of Object.entries(e)){let i=n.toLowerCase();t.some(s=>i.includes(s))?r[n]="[REDACTED]":typeof o=="string"?r[n]=pr(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?r[n]=Yr(o):Array.isArray(o)?r[n]=o.map(s=>typeof s=="object"&&s!==null?Yr(s):typeof s=="string"?pr(s):s):r[n]=o}return r}function Ty(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${cs.default.type()} ${cs.default.release()}`}}function Ld(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var cs,us=O(()=>{"use strict";cs=D(require("os"))});var L,b,Fe,Bo,Nd,ot,he,al,jd,Tr,N=O(()=>{"use strict";de();L=V("\u2713"),b=Lt("\u2716"),Fe=_e("\u2139"),Bo=V("\u279C"),Nd=Lt("\u279C"),ot="\u279C",he=ne("\u26A0"),al=R("\u2732"),jd=V("\u2732"),Tr=ne("[Deprecated]")});var Xr,Md=O(()=>{"use strict";Me();us();x();de();N();pe();Xr=class e{static instance;cache=void 0;static isDoNotTrackEnabled(){let t=process.env.DO_NOT_TRACK;return t==="1"||t?.toLowerCase()==="true"}static getInstance(){return e.instance||(e.instance=new e),e.instance}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;try{let{manifest:t}=await Z(),r=t?.telemetry?.global?.allowTelemetry;return this.cache=r,r}catch{return}}async setPreference(t){this.cache=t,await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(ze()||u.info(`${Fe} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(ze()||(u.info(`${jd} ${R("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${jd} ${R("To opt out, run")} ${V("webflow auth telemetry --disable")}`)),await this.setPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return this.getPreference()}async setGlobalPreference(t){let r={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:Ar()}}};await xe(r),ze()||u.info(`${L} Telemetry configuration updated in webflow.json`),this.cache=t}async hasGlobalPreference(){return await this.getPreference()!==void 0}async getTelemetryStatus(){let t=await this.getPreference();return t!==void 0?{enabled:t,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,r){this.cache=r}}});async function G(e,t){let n={"User-Agent":`webflow-cli@${Ar()}`};return(0,Ry.default)(e,{...t,headers:{...t?.headers,...n}})}var Ry,dt=O(()=>{"use strict";Ry=D(require("node-fetch"));z()});var Iy,Oy=O(()=>{"use strict";Iy=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});var Bd,I,ll,Uo,ds,Ud,ps,fs,Wo,ye=O(()=>{"use strict";Oy();Bd=(e,t)=>(Iy(t)||(console.error(`Error: Invalid ${e} environment variable. Only valid plain HTTP/HTTPS URLs without query parameters and anchors is allowed.`),process.exit(1)),t),I=process.env.WEBFLOW_API_HOST?Bd("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):"https://api.webflow.com",ll=process.env.WEBFLOW_CDN_API_HOST?Bd("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):"https://api-cdn.webflow.com",Uo=process.env.WEBFLOW_HOST?Bd("WEBFLOW_HOST",process.env.WEBFLOW_HOST):"https://webflow.com",ds="wf-manifest.json",Ud="mf-manifest.json",ps="@webflow_renderer",fs="ssr-bundle.tar",Wo="index.js"});function j_(){let e=process.argv.slice(2),t=[];for(let r=0;r<e.length;r+=1){let n=e[r],o=n.indexOf("=");if(o>0&&Py.has(n.slice(0,o))){t.push(`${n.slice(0,o)}=<redacted>`);continue}t.push(n),Py.has(n)&&r+1<e.length&&(t.push("<redacted>"),r+=1)}return t.join(" ")||void 0}var Py,_,Wd=O(()=>{"use strict";Md();us();x();dt();ye();Py=new Set(["--ref"]);_=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=Xr.getInstance(),this.sessionId=Ld(),this.platformInfo=Ty()}async sendEvent(t){try{if(!await this.isEnabled())return;let r=this.enrichEvent(t),n=this.sanitizeEvent(r);await this.transmitEvent(n)}catch(r){u.debug(`Failed to send telemetry event: ${r}`)}}async sendError(t,r,n){await this.sendEvent({eventType:"error",success:!1,name:t.name,message:t.message,cause:t.cause,stack:$d(t),context:r,metadata:n?Yr(n):void 0})}async sendUsage(t,r){let{duration:n,...o}=r??{};await this.sendEvent({eventType:"usage",success:!0,feature:t,duration:typeof n=="number"?n:void 0,data:Object.keys(o).length>0?Yr(o):void 0})}async sendPerformance(t,r,n){await this.sendEvent({eventType:"performance",operation:t,duration:r,metrics:n})}async isEnabled(){return await this.consentManager.getPreference()!==!1}async isGloballyEnabled(){return await this.consentManager.getGlobalPreference()!==!1}async updatePreferences(t){await this.consentManager.setPreference(t)}static async promptForConsentIfNeeded(t){let r=Xr.getInstance(),n=await r.getPreference();return n!==void 0?n:await r.promptForConsent(t)}enrichEvent(t){return{...{eventType:t.eventType||"usage",timestamp:Date.now(),sessionId:this.sessionId,platform:this.platformInfo.platform,nodeVersion:this.platformInfo.nodeVersion,cliVersion:Ar(),command:this.config.suppressCommand?void 0:j_(),metadata:{...t.metadata,commandType:this.config.commandType,siteId:this.config.siteId,projectId:this.config.projectId,os:this.platformInfo.os,arch:this.platformInfo.arch}},...t}}sanitizeEvent(t){let r=JSON.parse(JSON.stringify(t));return r.message&&(r.message=pr(r.message)),r.stack&&(r.stack=pr(r.stack)),r.context&&(r.context=pr(r.context)),r.metadata&&(r.metadata=Yr(r.metadata)),r.data&&(r.data=Yr(r.data)),r}async transmitEvent(t){let r=this.getEndpoint(),n=process.env.WEBFLOW_TELEMETRY_DEBUG==="true";if(n){console.log(`\u{1F4CA} [Telemetry] Sending to: ${r}`);let i={...t};i.metadata&&(delete i.metadata.authToken,delete i.metadata.apiToken),console.log("\u{1F4CA} [Telemetry] Payload:",JSON.stringify(i,null,2))}let o=await G(r,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`,"Content-Type":"application/json"},body:JSON.stringify(t),timeout:5e3});if(o.ok)n&&console.log(`\u{1F4CA} [Telemetry] Request successful: ${o.status}`);else throw n&&console.error(`\u{1F4CA} [Telemetry] Request failed: ${o.status} ${o.statusText}`),new Error(`Telemetry request failed: ${o.status} ${o.statusText}`)}getEndpoint(){let{host:t,commandType:r}=this.config;return`${t}/webflow-cli/${r}/telemetry`}static forDevlinkSync(t){return new e({host:t.host||I,authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||I,authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||I,authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||I,authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||I,authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||I,authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||I,authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||I,authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||I,authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||I,authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||I,authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||I,authToken:t.authToken,commandType:"skills"})}}});var $y=O(()=>{"use strict"});function Ly(e){return async(t,r,n)=>{let o=Date.now(),i=process.memoryUsage().heapUsed;try{let s=await r(),a=Date.now()-o,l=process.memoryUsage().heapUsed;return await e.sendPerformance(t,a,{memoryDelta:l-i,...n}),s}catch(s){let a=Date.now()-o;throw await e.sendPerformance(t,a,{failed:1,...n}),s}}}var z=O(()=>{"use strict";Wd();Md();$y();us();us()});var Vd,Hd,M_,Rr,Gd=O(()=>{"use strict";Vd=Symbol("webflow-cli-warn"),Hd=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let r=t.split(`
11
- `);for(let n=2;n<r.length;n++){let o=r[n],i=o.match(/at .+? \((.+?):\d+:\d+\)/)||o.match(/at (.+?):\d+:\d+/);if(i){let s=i[1];if(s.includes("node_modules")){let a=s.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)/);return a?`External: ${a[1]}`:"External Dependencies"}else if(s.includes("webflow-cli"))return s.includes("/metadata/")?"Metadata Collection":s.includes("/bundler/")?"Bundling":s.includes("/commands/")?"CLI Commands":"Webflow CLI"}}return"General"}start(){this.isActive||(this.warnings=[],this.originalConsoleWarn=console.warn,this.isActive=!0,console.warn=(...t)=>{if(t.length>1&&t[t.length-1]===Vd){let i=t.slice(0,-1);this.originalConsoleWarn&&this.originalConsoleWarn(...i);return}let r=t.map(i=>{if(typeof i=="string")return i;if(i instanceof Error)return i.message;try{return String(i)}catch{return"[Object]"}}).join(" "),n=new Error().stack||"",o=this.parseSource(n);this.warnings.push({message:r,timestamp:Date.now(),source:o,stackTrace:n})})}stop(){this.isActive&&(this.originalConsoleWarn&&(console.warn=this.originalConsoleWarn,this.originalConsoleWarn=null),this.isActive=!1)}displayGrouped(){if(this.warnings.length===0)return;console.log(`
4
+ `)+n,o=r+1,r=e.indexOf(`
5
+ `,o)}while(r!==-1);return i+=e.slice(o),i}var Py=L(()=>{"use strict"});function Is(e){return H_(e)}var $y,Oy,Jd,si,As,Ly,ai,W_,H_,Kd,V_,G_,zd,Al,J_,K_,GN,nn,qd=L(()=>{"use strict";Cy();Iy();Py();({stdout:$y,stderr:Oy}=Ay),Jd=Symbol("GENERATOR"),si=Symbol("STYLER"),As=Symbol("IS_EMPTY"),Ly=["ansi","ansi","ansi256","ansi16m"],ai=Object.create(null),W_=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let n=$y?$y.level:0;e.level=t.level===void 0?n:t.level},H_=e=>{let t=(...n)=>n.join(" ");return W_(t,e),Object.setPrototypeOf(t,Is.prototype),t};Object.setPrototypeOf(Is.prototype,Function.prototype);for(let[e,t]of Object.entries(tn))ai[e]={get(){let n=Al(this,zd(t.open,t.close,this[si]),this[As]);return Object.defineProperty(this,e,{value:n}),n}};ai.visible={get(){let e=Al(this,this[si],!0);return Object.defineProperty(this,"visible",{value:e}),e}};Kd=(e,t,n,...r)=>e==="rgb"?t==="ansi16m"?tn[n].ansi16m(...r):t==="ansi256"?tn[n].ansi256(tn.rgbToAnsi256(...r)):tn[n].ansi(tn.rgbToAnsi(...r)):e==="hex"?Kd("rgb",t,n,...tn.hexToRgb(...r)):tn[n][e](...r),V_=["rgb","hex","ansi256"];for(let e of V_){ai[e]={get(){let{level:n}=this;return function(...r){let o=zd(Kd(e,Ly[n],"color",...r),tn.color.close,this[si]);return Al(this,o,this[As])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);ai[t]={get(){let{level:n}=this;return function(...r){let o=zd(Kd(e,Ly[n],"bgColor",...r),tn.bgColor.close,this[si]);return Al(this,o,this[As])}}}}G_=Object.defineProperties(()=>{},{...ai,level:{enumerable:!0,get(){return this[Jd].level},set(e){this[Jd].level=e}}}),zd=(e,t,n)=>{let r,o;return n===void 0?(r=e,o=t):(r=n.openAll+e,o=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:o,parent:n}},Al=(e,t,n)=>{let r=(...o)=>J_(r,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(r,G_),r[Jd]=e,r[si]=t,r[As]=n,r},J_=(e,t)=>{if(e.level<=0||!t)return e[As]?"":t;let n=e[si];if(n===void 0)return t;let{openAll:r,closeAll:o}=n;if(t.includes("\x1B"))for(;n!==void 0;)t=Ry(t,n.close,n.open),n=n.parent;let i=t.indexOf(`
6
+ `);return i!==-1&&(t=Ty(t,o,r,i)),r+t+o};Object.defineProperties(Is.prototype,ai);K_=Is(),GN=Is({level:Oy?Oy.level:0}),nn=K_});function Xd(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let o of Reflect.ownKeys(t))z_(e,t,o,n);return X_(e,t),eA(e,t,r),e}var z_,q_,X_,Y_,Z_,Q_,eA,Ny=L(()=>{"use strict";z_=(e,t,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let o=Object.getOwnPropertyDescriptor(e,n),i=Object.getOwnPropertyDescriptor(t,n);!q_(o,i)&&r||Object.defineProperty(e,n,i)},q_=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},X_=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},Y_=(e,t)=>`/* Wrapped ${e}*/
7
+ ${t}`,Z_=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Q_=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),eA=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=Y_.bind(null,r,t.toString());Object.defineProperty(o,"name",Q_);let{writable:i,enumerable:s,configurable:a}=Z_;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var Il,jy,My,By=L(()=>{"use strict";Ny();Il=new WeakMap,jy=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,r=0,o=e.displayName||e.name||"<anonymous>",i=function(...s){if(Il.set(i,++r),r===1)n=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return n};return Xd(i,e),Il.set(i,r),i};jy.callCount=e=>{if(!Il.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Il.get(e)};My=jy});var qr,Uy=L(()=>{"use strict";qr=[];qr.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&qr.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&qr.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Rl,Yd,Zd,tA,Qd,Tl,nA,ep,tp,np,Wy,ZN,QN,Hy=L(()=>{"use strict";Uy();Rl=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Yd=Symbol.for("signal-exit emitter"),Zd=globalThis,tA=Object.defineProperty.bind(Object),Qd=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Zd[Yd])return Zd[Yd];tA(Zd,Yd,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,n){this.listeners[t].push(n)}removeListener(t,n){let r=this.listeners[t],o=r.indexOf(n);o!==-1&&(o===0&&r.length===1?r.length=0:r.splice(o,1))}emit(t,n,r){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(n,r)===!0||o;return t==="exit"&&(o=this.emit("afterExit",n,r)||o),o}},Tl=class{},nA=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),ep=class extends Tl{onExit(){return()=>{}}load(){}unload(){}},tp=class extends Tl{#s=np.platform==="win32"?"SIGINT":"SIGHUP";#n=new Qd;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let n of qr)this.#t[n]=()=>{let r=this.#e.listeners(n),{count:o}=this.#n,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),r.length===o){this.unload();let s=this.#n.emit("exit",null,n),a=n==="SIGHUP"?this.#s:n;s||t.kill(t.pid,a)}};this.#p=t.reallyExit,this.#o=t.emit}onExit(t,n){if(!Rl(this.#e))return()=>{};this.#i===!1&&this.load();let r=n?.alwaysLast?"afterExit":"exit";return this.#n.on(r,t),()=>{this.#n.removeListener(r,t),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#n.count+=1;for(let t of qr)try{let n=this.#t[t];n&&this.#e.on(t,n)}catch{}this.#e.emit=(t,...n)=>this.#f(t,...n),this.#e.reallyExit=t=>this.#r(t)}}unload(){this.#i&&(this.#i=!1,qr.forEach(t=>{let n=this.#t[t];if(!n)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,n)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#p,this.#n.count-=1)}#r(t){return Rl(this.#e)?(this.#e.exitCode=t||0,this.#n.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#f(t,...n){let r=this.#o;if(t==="exit"&&Rl(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let o=r.call(this.#e,t,...n);return this.#n.emit("exit",this.#e.exitCode,null),o}else return r.call(this.#e,t,...n)}},np=globalThis.process,{onExit:Wy,load:ZN,unload:QN}=nA(Rl(np)?new tp(np):new ep)});var Rs,Vy,rA,Gy,Jy=L(()=>{"use strict";Rs=w(require("process"),1);By();Hy();Vy=Rs.default.stderr.isTTY?Rs.default.stderr:Rs.default.stdout.isTTY?Rs.default.stdout:void 0,rA=Vy?My(()=>{Wy(()=>{Vy.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Gy=rA});var rp,Pl,li,op,Ky=L(()=>{"use strict";rp=w(require("process"),1);Jy();Pl=!1,li={};li.show=(e=rp.default.stderr)=>{e.isTTY&&(Pl=!1,e.write("\x1B[?25h"))};li.hide=(e=rp.default.stderr)=>{e.isTTY&&(Gy(),Pl=!0,e.write("\x1B[?25l"))};li.toggle=(e,t)=>{e!==void 0&&(Pl=e),Pl?li.show(t):li.hide(t)};op=li});var zy=Hd((sj,oA)=>{oA.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var ip=Hd((aj,Xy)=>{"use strict";var $l=Object.assign({},zy()),qy=Object.keys($l);Object.defineProperty($l,"random",{get(){let e=Math.floor(Math.random()*qy.length),t=qy[e];return $l[t]}});Xy.exports=$l});function sp(){return Ut.default.platform!=="win32"?Ut.default.env.TERM!=="linux":!!Ut.default.env.CI||!!Ut.default.env.WT_SESSION||!!Ut.default.env.TERMINUS_SUBLIME||Ut.default.env.ConEmuTask==="{cmd::Cmder}"||Ut.default.env.TERM_PROGRAM==="Terminus-Sublime"||Ut.default.env.TERM_PROGRAM==="vscode"||Ut.default.env.TERM==="xterm-256color"||Ut.default.env.TERM==="alacritty"||Ut.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ut,Yy=L(()=>{"use strict";Ut=w(require("process"),1)});var iA,sA,aA,Ts,Zy=L(()=>{"use strict";qd();Yy();iA={info:nn.blue("\u2139"),success:nn.green("\u2714"),warning:nn.yellow("\u26A0"),error:nn.red("\u2716")},sA={info:nn.blue("i"),success:nn.green("\u221A"),warning:nn.yellow("\u203C"),error:nn.red("\xD7")},aA=sp()?iA:sA,Ts=aA});function ap({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var Qy=L(()=>{"use strict"});function lp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(lA,"")}var lA,ew=L(()=>{"use strict";Qy();lA=ap()});function cp({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var tw=L(()=>{"use strict"});function up(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(cA,"")}var cA,nw=L(()=>{"use strict";tw();cA=cp()});var Ol,Ll,dp,pp,Ps,rw=L(()=>{"use strict";Ol=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Ll=[12288,12288,65281,65376,65504,65510],dp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],pp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ps=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141]});var Nl,ow=L(()=>{"use strict";Nl=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=o*2;if(t<e[i])r=o-1;else if(t>e[i+1])n=o+1;else return!0}return!1}});function wA(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let o=e[r],i=e[r+1];if(iw>=o&&iw<=i)return[o,i];i-o>n-t&&(t=o,n=i)}return[t,n]}var uA,dA,pA,fA,Ej,vj,Sj,xj,mA,gA,iw,hA,yA,sw,aw,lw,cw=L(()=>{"use strict";rw();ow();uA=Ol[0],dA=Ol.at(-1),pA=Ll[0],fA=Ll.at(-1),Ej=dp[0],vj=dp.at(-1),Sj=pp[0],xj=pp.at(-1),mA=Ps[0],gA=Ps.at(-1),iw=19968,[hA,yA]=wA(Ps);sw=e=>e<uA||e>dA?!1:Nl(Ol,e),aw=e=>e<pA||e>fA?!1:Nl(Ll,e),lw=e=>e>=hA&&e<=yA?!0:e<mA||e>gA?!1:Nl(Ps,e)});function DA(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function uw(e,{ambiguousAsWide:t=!1}={}){return DA(e),aw(e)||lw(e)||t&&sw(e)?2:1}var dw=L(()=>{"use strict";cw()});var pw,fw=L(()=>{"use strict";pw=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});function fp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=up(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!n};for(let{segment:s}of bA.segment(e)){let a=s.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!kA.test(s)){if(pw().test(s)){o+=2;continue}o+=uw(a,i)}}return o}var bA,kA,mw=L(()=>{"use strict";nw();dw();fw();bA=new Intl.Segmenter,kA=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function mp({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var gw=L(()=>{"use strict"});function hp(){let{env:e}=gp.default,{TERM:t,TERM_PROGRAM:n}=e;return gp.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var gp,hw=L(()=>{"use strict";gp=w(require("process"),1)});var rn,EA,yp,vA,wp,yw=L(()=>{"use strict";rn=w(require("process"),1),EA=3,yp=class{#s=0;start(){this.#s++,this.#s===1&&this.#n()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#n(){rn.default.platform==="win32"||!rn.default.stdin.isTTY||(rn.default.stdin.setRawMode(!0),rn.default.stdin.on("data",this.#o),rn.default.stdin.resume())}#e(){rn.default.stdin.isTTY&&(rn.default.stdin.off("data",this.#o),rn.default.stdin.pause(),rn.default.stdin.setRawMode(!1))}#o(t){t[0]===EA&&rn.default.emit("SIGINT")}},vA=new yp,wp=vA});function bp(e){return new Dp(e)}var $s,Os,SA,Dp,ww=L(()=>{"use strict";$s=w(require("process"),1);qd();Ky();Os=w(ip(),1);Zy();ew();mw();gw();hw();yw();SA=w(ip(),1),Dp=class{#s=0;#n=!1;#e=0;#o=-1;#p=0;#t;#i;#r;#f;#g;#c;#u;#d;#h;#a;#l;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:$s.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#r=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:mp({stream:this.#r}),this.#u=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,$s.default.env.NODE_ENV==="test"&&(this._stream=this.#r,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(n){this.#s=n}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#o}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=t,this.#m()}get interval(){return this.#g??this.#i.interval??100}get spinner(){return this.#i}set spinner(t){if(this.#o=-1,this.#g=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#i=t}else if(!hp())this.#i=Os.default.line;else if(t===void 0)this.#i=Os.default.dots;else if(t!=="default"&&Os.default[t])this.#i=Os.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#a}set prefixText(t=""){this.#a=t,this.#m()}get suffixText(){return this.#l}set suffixText(t=""){this.#l=t,this.#m()}get isSpinning(){return this.#f!==void 0}#y(t=this.#a,n=" "){return typeof t=="string"&&t!==""?t+n:typeof t=="function"?t()+n:""}#w(t=this.#l,n=" "){return typeof t=="string"&&t!==""?n+t:typeof t=="function"?n+t():""}#m(){let t=this.#r.columns??80,n=this.#y(this.#a,"-"),r=this.#w(this.#l,"-"),o=" ".repeat(this.#d)+n+"--"+this.#h+"--"+r;this.#e=0;for(let i of lp(o).split(`
8
+ `))this.#e+=Math.max(1,Math.ceil(fp(i,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#c&&!this.#u}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#c=t}get isSilent(){return this.#u}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#u=t}frame(){let t=Date.now();(this.#o===-1||t-this.#p>=this.interval)&&(this.#o=++this.#o%this.#i.frames.length,this.#p=t);let{frames:n}=this.#i,r=n[this.#o];this.color&&(r=nn[this.color](r));let o=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",i=typeof this.text=="string"?" "+this.text:"",s=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return o+r+i+s}clear(){if(!this.#c||!this.#r.isTTY)return this;this.#r.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#r.moveCursor(0,-1),this.#r.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#r.cursorTo(this.#d),this.lastIndent=this.#d,this.#s=0,this}render(){return this.#u?this:(this.clear(),this.#r.write(this.frame()),this.#s=this.#e,this)}start(t){return t&&(this.text=t),this.#u?this:this.#c?this.isSpinning?this:(this.#t.hideCursor&&op.hide(this.#r),this.#t.discardStdin&&$s.default.stdin.isTTY&&(this.#n=!0,wp.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#r.write(`- ${this.text}
9
+ `),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&op.show(this.#r),this.#t.discardStdin&&$s.default.stdin.isTTY&&this.#n&&(wp.stop(),this.#n=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Ts.success,text:t})}fail(t){return this.stopAndPersist({symbol:Ts.error,text:t})}warn(t){return this.stopAndPersist({symbol:Ts.warning,text:t})}info(t){return this.stopAndPersist({symbol:Ts.info,text:t})}stopAndPersist(t={}){if(this.#u)return this;let n=t.prefixText??this.#a,r=this.#y(n," "),o=t.symbol??" ",i=t.text??this.text,a=typeof i=="string"?(o?" ":"")+i:"",l=t.suffixText??this.#l,c=this.#w(l," "),d=r+o+a+c+`
10
+ `;return this.stop(),this.#r.write(d),this}}});function Ls(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),jl.default.platform==="darwin"?xA(e):jl.default.platform==="win32"?CA(e):FA(e)}var Ie,kp,jl,ur,Ep,ci,xA,CA,FA,vp=L(()=>{"use strict";Ie=w(require("path"),1),kp=w(require("os"),1),jl=w(require("process"),1),ur=kp.default.homedir(),Ep=kp.default.tmpdir(),{env:ci}=jl.default,xA=e=>{let t=Ie.default.join(ur,"Library");return{data:Ie.default.join(t,"Application Support",e),config:Ie.default.join(t,"Preferences",e),cache:Ie.default.join(t,"Caches",e),log:Ie.default.join(t,"Logs",e),temp:Ie.default.join(Ep,e)}},CA=e=>{let t=ci.APPDATA||Ie.default.join(ur,"AppData","Roaming"),n=ci.LOCALAPPDATA||Ie.default.join(ur,"AppData","Local");return{data:Ie.default.join(n,e,"Data"),config:Ie.default.join(t,e,"Config"),cache:Ie.default.join(n,e,"Cache"),log:Ie.default.join(n,e,"Log"),temp:Ie.default.join(Ep,e)}},FA=e=>{let t=Ie.default.basename(ur);return{data:Ie.default.join(ci.XDG_DATA_HOME||Ie.default.join(ur,".local","share"),e),config:Ie.default.join(ci.XDG_CONFIG_HOME||Ie.default.join(ur,".config"),e),cache:Ie.default.join(ci.XDG_CACHE_HOME||Ie.default.join(ur,".cache"),e),log:Ie.default.join(ci.XDG_STATE_HOME||Ie.default.join(ur,".local","state"),e),temp:Ie.default.join(Ep,t,e)}}});function Ml(){return/[<>:"/\\|?*\u0000-\u001F]/g}function Dw(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var bw=L(()=>{"use strict"});function Ns(e,t={}){let n=/[\u0000-\u001F\u0080-\u009F]/g,r=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof e!="string")throw new TypeError("Expected a string");let o=t.replacement===void 0?"!":t.replacement;if(Ml().test(o)&&n.test(o))throw new Error("Replacement string cannot contain reserved filename characters");o.length>0&&(e=e.replace(r,"$1")),e=e.normalize("NFD"),e=e.replace(AA,o),e=e.replace(Ml(),o),e=e.replace(n,o),e=e.replace(IA,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=Dw().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:_A;if(e.length>i){let s=e.lastIndexOf(".");if(s===-1)e=e.slice(0,i);else{let a=e.slice(0,s),l=e.slice(s);e=a.slice(0,Math.max(1,i-l.length))+l}}return e}var _A,AA,IA,Sp=L(()=>{"use strict";bw();_A=100,AA=/^\.+(\\|\/)|^\.+$/,IA=/\.+$/});var RA,kw=L(()=>{"use strict";RA=w(require("path"),1);Sp()});var Ew=L(()=>{"use strict";Sp();kw()});var Bl,xp=L(()=>{"use strict";Bl="webflow.json"});var Xr,Cp=L(()=>{"use strict";Xr=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function Fw(e){vw=e}function _w(e){Sw=e}function TA(){for(let e of Aw){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function PA(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||TA()!==null}function V(){return vw?!0:Sw?!1:PA()}function on(){return!V()}function Iw(e){xw=e}function Ye(){return xw}function Rw(e){Cw=e}function Tw(){return Cw}var vw,Sw,xw,Cw,Aw,i1,we=L(()=>{"use strict";vw=!1,Sw=!1,xw=!1;Aw=[{variable:"CLAUDECODE",agent:"claude-code"},{variable:"CODEX_THREAD_ID",agent:"codex"},{variable:"CODEX_SANDBOX",agent:"codex"},{variable:"GEMINI_CLI",agent:"gemini-cli"},{variable:"OPENCODE_CLIENT",agent:"opencode"},{variable:"AI_AGENT",agent:"generic-agent"},{variable:"COPILOT_MODEL",agent:"copilot"},{variable:"AUGMENT_AGENT",agent:"augment"},{variable:"ANTIGRAVITY_AGENT",agent:"antigravity"},{variable:"CURSOR_AGENT",agent:"cursor"},{variable:"CURSOR_EXTENSION_HOST_ROLE",agent:"cursor",value:"agent-exec"}],i1=Aw.map(e=>e.variable)});function Yr(){let e=Tw();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Pw.statSync)(e)?.isDirectory())return{path:(0,$w.join)(e,Bl),isUserDefined:!0}}catch{if(e.endsWith(".json"))return{path:e,isUserDefined:!0}}throw new Error(`Manifest path must be either a directory or a .json file. Got: ${e}`)}return{path:`./${Bl}`,isUserDefined:!1}}var Pw,$w,Fp=L(()=>{"use strict";Pw=require("fs"),$w=require("path");xp();we()});var Ow,$A,OA,_p,Lw=L(()=>{"use strict";Ow=w(require("ajv")),$A=new Ow.default,OA={type:"object",properties:{library:{type:"object",properties:{name:{type:"string",minLength:1},id:{type:"string",minLength:1},components:{type:"array",items:{type:"string"},minItems:1},renderer:{anyOf:[{type:"object",properties:{client:{type:"string",minLength:1},server:{type:"string",minLength:1}}},{type:"string",minLength:1}]},globals:{type:"string",minLength:1}},required:[]},devlink:{type:"object",properties:{rootDir:{type:"string",minLength:1},cssModules:{type:"boolean"},allowTelemetry:{type:"boolean"},overwriteModule:{type:"boolean"},skipTagSelectors:{type:"boolean"},envVariables:{type:"object",additionalProperties:{type:"string"}},components:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},fileExtensions:{type:"object",properties:{js:{type:"string"},css:{type:"string"}}},relativeHrefRoot:{oneOf:[{type:"boolean"},{type:"string"}]}},required:["rootDir"]},"devlink-export":{type:"object",properties:{rootDir:{type:"string",minLength:1},components:{type:"string"},componentGroups:{type:"string"},ts:{type:"boolean"},cssScopes:{type:"boolean"},relativeHrefRoot:{oneOf:[{type:"boolean",const:!1},{type:"string"}]},treeShake:{type:"boolean"},camelCaseVariantNames:{type:"boolean"}},required:[]},site:{type:"object",properties:{layout:{type:"object",properties:{preset:{type:"string",enum:["library","astro","nextjs","nextjs-pages"]},pagesRoot:{type:"string",minLength:1},componentsRoot:{type:"string",minLength:1},pagesShape:{type:"string",enum:["flat","nested"]}},required:[]}},required:[]}}},_p=$A.compile(OA)});function Nw(e){return e instanceof Error?e:new Error("Unknown error")}function ne(){let{path:e}=Yr();if(!(0,Ul.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,Ul.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${Nw(o).message}`)}if(t.trim()==="")return{manifest:{},manifestPath:e};let r;try{r=JSON.parse(t)}catch(o){throw new Error(`Invalid JSON in manifest file: ${Nw(o).message}`)}if(!_p(r)){let o=_p.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:r,manifestPath:e}}var Ul,js=L(()=>{"use strict";Ul=require("fs");Fp();Lw()});function Ms(e,t){let n=e[t];if(!n)throw new Xr(t);return n}var jw=L(()=>{"use strict";Cp()});function Se(e){let t=ne(),n=t.manifest,r=t.manifestPath,o={...n};for(let i in e){let s=i,a=e[s];if(a!==void 0)if(typeof a=="string"||typeof a=="number"||typeof a=="boolean"||a===null)o[s]=a;else{let l=o[s];o[s]={...typeof l=="object"&&l!==null?l:{},...a}}}return(0,Mw.writeFileSync)(r,JSON.stringify(o,null,2),"utf-8"),o}var Mw,Ap=L(()=>{"use strict";Mw=require("fs");js()});var We=L(()=>{"use strict";xp();Cp();js();Fp();jw();Ap()});var Wl=Hd((x1,LA)=>{LA.exports={name:"@webflow/webflow-cli",version:"2.4.0-next.1",license:"MIT",bin:{webflow:"./dist/index.js"},scripts:{build:"tsup",dev:"tsup",lint:"eslint .","type-check":"tsc -p tsconfig.typecheck.json",test:"jest --ci","test:unit":"jest --ci --ignoreProjects e2e","test:local":"jest","test:e2e:deploy":"bash regression/run-local.sh","test:regression":"jest --config regression/jest.config.js --testTimeout=420000","test:e2e-cache-clear":"bash scripts/clear-e2e-cache.sh"},files:["CHANGELOG.md","dist/**/*"],publishConfig:{access:"public"},dependencies:{"@babel/parser":"^7.26.9","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@babel/preset-typescript":"^7.27.0","@babel/types":"^7.26.9","@dotenvx/dotenvx":"^1.44.1","@inquirer/prompts":"^7.9.0","@module-federation/enhanced":"2.5.1","@rspack/core":"^1.7.8","@webflow/cosmic-deploy-contract":"^1.1.0","@webflow/data-types":"*",ajv:"^8.17.1",archiver:"^5.3.1","babel-loader":"^10.0.0",commander:"^10.0.0",cosmiconfig:"^8.2.0","css-loader":"^7.1.2",dotenv:"^16.0.3","env-paths":"^3.0.0","fast-glob":"^3.3.3",filenamify:"^6.0.0","fork-ts-checker-webpack-plugin":"9.1.0","form-data":"4.0.4","fs-extra":"^11.3.0",jsdom:"^26.0.0","jsonc-parser":"^3.2.0",md5:"^2.2.1",memfs:"4.17.0","mime-types":"^2.1.35","mini-css-extract-plugin":"^2.9.2","node-fetch":"^2.6.7",open:"^8.4.2",ora:"^8.2.0",postcss:"^8.5.6","postcss-loader":"^8.1.1","postcss-selector-parser":"^7.1.0",prettier:"^3.9.6",semver:"^7.7.2","serve-handler":"^6.1.5","source-map-support":"^0.5.21",tar:"^7.5.19","ts-checker-rspack-plugin":"^1.0.0","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.2.0",unionfs:"^4.5.4","webflow-api":"3.3.4",webpack:">=5.99.7 <5.106.0","webpack-merge":"^6.0.1","webpack-node-externals":"^3.0.0",yaml:"^2.8.4",zod:"^3.22.4"},devDependencies:{"@module-federation/sdk":"2.5.1","@types/archiver":"^5.3.2","@types/express":"^4.17.13","@types/fs-extra":"^11.0.4","@types/jest":"^30.0.0","@types/md5":"^2.3.2","@types/mime-types":"^2.1.4","@types/nock":"^8.0.33","@types/node":"^22.13.0","@types/node-fetch":"2.6.13","@types/serve-handler":"^6.1.1","@types/source-map":"^0.5.2","@types/webpack-node-externals":"^3.0.4",astro:"^7.0.6","eslint-config-custom":"*",express:"^4.18.1",jest:"^30.4.2","jest-config-custom":"*",nock:"13.3.1",tar:"^7.5.19",tsconfig:"*",tsup:"^8.4.0",typescript:"^5.9.3"},engines:{node:">=22.13.0"}}});function jn(){try{return Wl().version}catch{return"unknown"}}function bn(e=""){if(!e)return"";let t=e;t=t.replace(/\/.*?\/webflow-cli/gi,"/REDACTED_PII/webflow-cli"),t=t.replace(/\/.*?\/node_modules/gi,"/REDACTED_PII/node_modules");let n=Bs.default.homedir();if(n){let o=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let r=Bs.default.userInfo().username;if(r){let o=new RegExp(`/Users/${r}`,"gi");t=t.replace(o,"/Users/REDACTED_PII")}return t=t.replace(/\/Users\/[^\/\s]+/gi,"/Users/REDACTED_PII"),t=t.replace(/C:\\Users\\[^\\]+/gi,"C:\\Users\\REDACTED_PII"),t=t.replace(/[a-zA-Z0-9]{32,}/g,"[REDACTED_TOKEN]"),t=t.replace(/Bearer\s+[^\s]+/gi,"Bearer [REDACTED_TOKEN]"),t=t.replace(/token[=:]\s*[^\s]+/gi,"token=[REDACTED_TOKEN]"),t=t.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,"[REDACTED_EMAIL]"),t=t.replace(/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g,"[REDACTED_IP]"),t}function Ip(e){if(e.stack)return bn(e.stack)}function dr(e){let t=["password","token","secret","key","auth","bearer","authorization","apikey","api_key","access_token","refresh_token","client_secret","private_key"],n={};for(let[r,o]of Object.entries(e)){let i=r.toLowerCase();t.some(s=>i.includes(s))?n[r]="[REDACTED]":typeof o=="string"?n[r]=bn(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?n[r]=dr(o):Array.isArray(o)?n[r]=o.map(s=>typeof s=="object"&&s!==null?dr(s):typeof s=="string"?bn(s):s):n[r]=o}return n}function Bw(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${Bs.default.type()} ${Bs.default.release()}`}}function Rp(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var Bs,Us=L(()=>{"use strict";Bs=w(require("os"))});var $,k,je,ui,Tp,at,re,Hl,Pp,Mn,M=L(()=>{"use strict";pe();$=K("\u2713"),k=Mt("\u2716"),je=Ne("\u2139"),ui=K("\u279C"),Tp=Mt("\u279C"),at="\u279C",re=le("\u26A0"),Hl=R("\u2732"),Pp=K("\u2732"),Mn=le("[Deprecated]")});var pr,$p=L(()=>{"use strict";We();Us();_();pe();M();we();pr=class e{static instance;cache=void 0;static isDoNotTrackEnabled(){let t=process.env.DO_NOT_TRACK;return t==="1"||t?.toLowerCase()==="true"}static getInstance(){return e.instance||(e.instance=new e),e.instance}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;try{let{manifest:t}=await ne(),n=t?.telemetry?.global?.allowTelemetry;return this.cache=n,n}catch{return}}async setPreference(t){this.cache=t,await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(Ye()||u.info(`${je} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(Ye()||(u.info(`${Pp} ${R("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${Pp} ${R("To opt out, run")} ${K("webflow auth telemetry --disable")}`)),await this.setPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return this.getPreference()}async setGlobalPreference(t){let n={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:jn()}}};await Se(n),Ye()||u.info(`${$} Telemetry configuration updated in webflow.json`),this.cache=t}async hasGlobalPreference(){return await this.getPreference()!==void 0}async getTelemetryStatus(){let t=await this.getPreference();return t!==void 0?{enabled:t,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,n){this.cache=n}}});async function J(e,t){let r={"User-Agent":`webflow-cli@${jn()}`};return(0,Uw.default)(e,{...t,headers:{...t?.headers,...r}})}var Uw,lt=L(()=>{"use strict";Uw=w(require("node-fetch"));X()});var Ww,Hw=L(()=>{"use strict";Ww=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});var Op,P,di,kn,Ws,Lp,Hs,Vs,pi,be=L(()=>{"use strict";Hw();Op=(e,t)=>(Ww(t)||(console.error(`Error: Invalid ${e} environment variable. Only valid plain HTTP/HTTPS URLs without query parameters and anchors is allowed.`),process.exit(1)),t),P=process.env.WEBFLOW_API_HOST?Op("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):"https://api.webflow.com",di=process.env.WEBFLOW_CDN_API_HOST?Op("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):"https://api-cdn.webflow.com",kn=process.env.WEBFLOW_HOST?Op("WEBFLOW_HOST",process.env.WEBFLOW_HOST):"https://webflow.com",Ws="wf-manifest.json",Lp="mf-manifest.json",Hs="@webflow_renderer",Vs="ssr-bundle.tar",pi="index.js"});function NA(){let e=process.argv.slice(2),t=[];for(let n=0;n<e.length;n+=1){let r=e[n],o=r.indexOf("=");if(o>0&&Vw.has(r.slice(0,o))){t.push(`${r.slice(0,o)}=<redacted>`);continue}t.push(r),Vw.has(r)&&n+1<e.length&&(t.push("<redacted>"),n+=1)}return t.join(" ")||void 0}var Vw,F,Np=L(()=>{"use strict";$p();Us();_();lt();be();Vw=new Set(["--ref","--name","--q","--branch","--key"]);F=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=pr.getInstance(),this.sessionId=Rp(),this.platformInfo=Bw()}async sendEvent(t){try{if(!await this.isEnabled())return;let n=this.enrichEvent(t),r=this.sanitizeEvent(n);await this.transmitEvent(r)}catch(n){u.debug(`Failed to send telemetry event: ${n}`)}}async sendError(t,n,r){await this.sendEvent({eventType:"error",success:!1,name:t.name,message:t.message,cause:t.cause,stack:Ip(t),context:n,metadata:r?dr(r):void 0})}async sendUsage(t,n){let{duration:r,...o}=n??{};await this.sendEvent({eventType:"usage",success:!0,feature:t,duration:typeof r=="number"?r:void 0,data:Object.keys(o).length>0?dr(o):void 0})}async sendPerformance(t,n,r){await this.sendEvent({eventType:"performance",operation:t,duration:n,metrics:r})}async isEnabled(){return await this.consentManager.getPreference()!==!1}async isGloballyEnabled(){return await this.consentManager.getGlobalPreference()!==!1}async updatePreferences(t){await this.consentManager.setPreference(t)}static async promptForConsentIfNeeded(t){let n=pr.getInstance(),r=await n.getPreference();return r!==void 0?r:await n.promptForConsent(t)}enrichEvent(t){return{...{eventType:t.eventType||"usage",timestamp:Date.now(),sessionId:this.sessionId,platform:this.platformInfo.platform,nodeVersion:this.platformInfo.nodeVersion,cliVersion:jn(),command:this.config.suppressCommand?void 0:NA(),metadata:{...t.metadata,commandType:this.config.commandType,siteId:this.config.siteId,projectId:this.config.projectId,os:this.platformInfo.os,arch:this.platformInfo.arch}},...t}}sanitizeEvent(t){let n=JSON.parse(JSON.stringify(t));return n.message&&(n.message=bn(n.message)),n.stack&&(n.stack=bn(n.stack)),n.context&&(n.context=bn(n.context)),n.metadata&&(n.metadata=dr(n.metadata)),n.data&&(n.data=dr(n.data)),n}async transmitEvent(t){let n=this.getEndpoint(),r=process.env.WEBFLOW_TELEMETRY_DEBUG==="true";if(r){console.log(`\u{1F4CA} [Telemetry] Sending to: ${n}`);let i={...t};i.metadata&&(delete i.metadata.authToken,delete i.metadata.apiToken),console.log("\u{1F4CA} [Telemetry] Payload:",JSON.stringify(i,null,2))}let o=await J(n,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`,"Content-Type":"application/json"},body:JSON.stringify(t),timeout:5e3});if(o.ok)r&&console.log(`\u{1F4CA} [Telemetry] Request successful: ${o.status}`);else throw r&&console.error(`\u{1F4CA} [Telemetry] Request failed: ${o.status} ${o.statusText}`),new Error(`Telemetry request failed: ${o.status} ${o.statusText}`)}getEndpoint(){let{host:t,commandType:n}=this.config;return`${t}/webflow-cli/${n}/telemetry`}static forDevlinkSync(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||P,authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||P,authToken:t.authToken,commandType:"skills"})}}});var Gw=L(()=>{"use strict"});function Jw(e){return async(t,n,r)=>{let o=Date.now(),i=process.memoryUsage().heapUsed;try{let s=await n(),a=Date.now()-o,l=process.memoryUsage().heapUsed;return await e.sendPerformance(t,a,{memoryDelta:l-i,...r}),s}catch(s){let a=Date.now()-o;throw await e.sendPerformance(t,a,{failed:1,...r}),s}}}var X=L(()=>{"use strict";Np();$p();Gw();Us();Us()});var Mp,jp,jA,Bn,Bp=L(()=>{"use strict";Mp=Symbol("webflow-cli-warn"),jp=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let n=t.split(`
11
+ `);for(let r=2;r<n.length;r++){let o=n[r],i=o.match(/at .+? \((.+?):\d+:\d+\)/)||o.match(/at (.+?):\d+:\d+/);if(i){let s=i[1];if(s.includes("node_modules")){let a=s.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)/);return a?`External: ${a[1]}`:"External Dependencies"}else if(s.includes("webflow-cli"))return s.includes("/metadata/")?"Metadata Collection":s.includes("/bundler/")?"Bundling":s.includes("/commands/")?"CLI Commands":"Webflow CLI"}}return"General"}start(){this.isActive||(this.warnings=[],this.originalConsoleWarn=console.warn,this.isActive=!0,console.warn=(...t)=>{if(t.length>1&&t[t.length-1]===Mp){let i=t.slice(0,-1);this.originalConsoleWarn&&this.originalConsoleWarn(...i);return}let n=t.map(i=>{if(typeof i=="string")return i;if(i instanceof Error)return i.message;try{return String(i)}catch{return"[Object]"}}).join(" "),r=new Error().stack||"",o=this.parseSource(r);this.warnings.push({message:n,timestamp:Date.now(),source:o,stackTrace:r})})}stop(){this.isActive&&(this.originalConsoleWarn&&(console.warn=this.originalConsoleWarn,this.originalConsoleWarn=null),this.isActive=!1)}displayGrouped(){if(this.warnings.length===0)return;console.log(`
12
12
  \u26A0\uFE0F Warnings:
13
- `);let t=this.warnings.reduce((r,n)=>{let o=n.source||"General";return r[o]||(r[o]=[]),r[o].push(n),r},{});Object.entries(t).forEach(([r,n])=>{r!=="General"&&console.log(` ${r}:`),n.forEach((o,i)=>{let s=r!=="General"?" ":" ",a=o.message||"[Empty warning message]";console.log(`${s}${i+1}. ${a}`)}),r!=="General"&&console.log("")}),t.General&&console.log("")}debug(){console.log(`
13
+ `);let t=this.warnings.reduce((n,r)=>{let o=r.source||"General";return n[o]||(n[o]=[]),n[o].push(r),n},{});Object.entries(t).forEach(([n,r])=>{n!=="General"&&console.log(` ${n}:`),r.forEach((o,i)=>{let s=n!=="General"?" ":" ",a=o.message||"[Empty warning message]";console.log(`${s}${i+1}. ${a}`)}),n!=="General"&&console.log("")}),t.General&&console.log("")}debug(){console.log(`
14
14
  \u{1F41B} Debug: Captured Warnings
15
- `),this.warnings.forEach((t,r)=>{console.log(`Warning ${r+1}:`),console.log(` Source: ${t.source}`),console.log(` Message: ${t.message}`),console.log(` Message length: ${t.message.length}`),console.log(` Timestamp: ${new Date(t.timestamp).toISOString()}`),t.stackTrace&&(console.log(" Stack (first 3 lines):"),t.stackTrace.split(`
16
- `).slice(0,3).forEach(n=>{console.log(` ${n}`)})),console.log("")})}},M_=new Hd,Rr=M_});function pt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function My(e,t){if(!e)return t;let r=parseInt(e,10);return isNaN(r)||r<=0?t:r}function Ir(e){gs.push(pr(e)),gs.length>W_&&gs.shift()}function By(e){zd=e}function Ny(e){return Ir(`DEBUG: ${e}`),e}function V_(e){return Ir(`INFO: ${e}`),e}function G_(e){return Ir(`WARN: ${e}`),e}function K_(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";Ir(`ERROR: ${n}${r}`),Jd=!0;let o=e instanceof Error?e.message:String(e);return Lt(`${n}${o}`)}function z_(e){return Ir(`SUCCESS: ${e}`),V(e)}function Y_(e){let t=xd({text:`${e}...`,indent:1}).start(),r=!1,n=o=>i=>{if(Ir(`${J_[o]||"INFO"}: ${i||e}`),o==="fail"&&(Jd=!0),o==="update"){t.text=i||e;return}r||(r=!0,t.stopAndPersist({symbol:q_[o],text:R(i||e)}))};return{succeed:n("succeed"),fail:n("fail"),warn:n("warn"),info:n("info"),neutral:n("neutral"),update:n("update"),stop:()=>{r||(r=!0,t.stop())}}}function X_(){let e=Ho.default.readdirSync(St).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:Ho.default.statSync(cl.default.join(St,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);for(;e.length>=U_;)try{let t=e.pop();if(!t)break;Ho.default.removeSync(cl.default.join(St,t.name))}catch{}}function qd(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;Ho.default.ensureDirSync(St),X_(),gs.unshift(`CLI Version: ${Ar()}`,`Node Version: ${process.version}`,`Platform: ${process.platform}`,`Architecture: ${process.arch}`,`Command: ${t||"N/A"}`,`Exit Code: ${e??0}`,`Memory Usage: ${Math.round(process.memoryUsage().heapUsed/1024/1024)}MB`,`Timestamp: ${new Date().toISOString()}`,...zd?[`Sync ID: ${zd}`]:[],"");let r=gs.map(pt);Ho.default.writeFileSync(Kd,r.join(`
17
- `)),Jd&&(console.info(`
18
- ${b} ${R("An error occurred. See logs for more information:")}`),console.info(` ${Nd} Latest log: ${Kd}`),console.info(` ${Nd} All logs: ${St}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
19
- ${L} Command completed successfully. Logs written to:`),console.info(` ${Bo} Latest log: ${Kd}`),console.info(` ${Bo} All logs: ${St}`))}catch(t){console.error("Failed to write logs:",t)}}function Uy(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";Ir(`ERROR: ${n}${r}`)}var Ho,cl,aN,B_,St,U_,W_,H_,Kd,gs,Jd,zd,J_,q_,Vo,jy,ms,Z_,u,x=O(()=>{"use strict";Ho=D(require("fs-extra")),cl=D(require("path")),aN=require("source-map-support/register");ly();Fd();py();z();de();Gd();N();B_=is("webflow-cli"),St=B_.log;U_=My(process.env.MAX_PERSISTED_LOGS,50),W_=My(process.env.MAX_IN_MEMORY_LOGS,1e3),H_=`${ss(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Kd=cl.default.join(St,H_);gs=[],Jd=!1;J_={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},q_={succeed:L,fail:b,warn:he,info:Fe,neutral:" ",update:void 0};Vo=!1;process.on("uncaughtException",e=>{Vo||(Vo=!0,Ir(`UNCAUGHT EXCEPTION: ${e?.stack}`),qd(1)),Rr.displayGrouped(),Rr.stop(),process.exit(1)});process.on("unhandledRejection",e=>{Vo||(Vo=!0,Ir(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),qd(1)),Rr.displayGrouped(),Rr.stop(),process.exit(1)});process.on("exit",e=>{Vo||(Vo=!0,qd(e))});jy=!0,ms=e=>{let t=e.split(`
20
- `).map(r=>r.length?` ${r}`:r).join(`
21
- `);return jy?(jy=!1,`
22
- `+t):t};Z_={debug:e=>{let t=Ny(e);process.env.DEBUG&&console.debug(ms(t))},trace:e=>{let t=Ny(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(ms(V_(e))),warn:e=>console.warn(ms(G_(e)),Vd),error:(e,t)=>{console.error(ms(K_(e,t)))},success:e=>console.log(ms(z_(e))),spinner:Y_},u=Z_});async function Go(e){process.stdout.write(`
23
- `);try{return await e()}catch(t){throw t instanceof Error&&iF.test(t.message)&&(u.debug(t.message),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&process.stdin.setRawMode(!1),process.exit(130)),t}}async function Pe(e){return W()?e.default??!1:Go(()=>it.confirm({...e,theme:eF}))}async function Be(e){if(W())return"default"in e?e.default:null;let t=e.choices.map(r=>{if(!r||typeof r!="object"||it.Separator.isSeparator(r)||r.type==="separator")return r;let n=r.name??String(r.value??"");return{...r,name:` ${R(n)}`}});return Go(()=>it.select({...e,choices:t,theme:rF}))}async function Je(e){return W()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:Go(()=>it.input({...e,theme:Vy}))}async function zy(e){return W()?null:Go(()=>it.password({...e,theme:Vy}))}async function fr(e){if(W()){let r=[];return await e.validate?.(r)!==!0?null:r}let t=e.choices.map(r=>{if(!r||typeof r!="object"||r.type==="separator"||it.Separator.isSeparator(r))return r;let n=r.name??String(r.value??"");return{...r,name:` ${R(n)}`}});return Go(()=>it.checkbox({...e,choices:t,theme:nF}))}async function dl(e){if(W())return"default"in e?e.default:null;let t=(async(r,n)=>(await e.source(r,n)).map(i=>!i||typeof i!="object"||it.Separator.isSeparator(i)?i:{...i,name:` ${R(i.name??"")}`}));return Go(()=>it.search({...e,source:t,theme:oF}))}var it,eF,Vy,hs,Gy,Zd,Qd,Ky,tF,rF,nF,oF,iF,Ae=O(()=>{"use strict";it=D(require("@inquirer/prompts"));pe();x();de();eF={prefix:` ${_e("?")}`,style:{message:(e,t)=>t==="done"?`${te(e)}
24
- `:`${te(e)}
25
- `,answer:e=>` ${R(e)}`}},Vy={prefix:` ${_e("?")}`,style:{message:e=>`${te(e)}
26
- `,answer:e=>R(e)}},hs=2,Gy=1,Zd=(e,t)=>t==="done"?`${te(e)}
27
- `:te(e),Qd=e=>` ${R(pt(e).trim())}`,Ky=e=>{let t=pt(e),r=t.slice(0,hs),n=t.slice(hs+1+Gy);return _e(`${r} ${n}`)},tF=e=>{let t=pt(e),r=t.slice(0,hs),n=t[hs+2],o=t.slice(hs+3+Gy);return _e(`${r} ${n} ${o}`)},rF={prefix:` ${_e("?")}`,style:{message:Zd,answer:Qd,highlight:Ky,keysHelpTip:e=>` ${e.map(([t,r])=>`${R(t)} ${R(r)}`).join(" ")}`},icon:{cursor:` ${_e("\u23F5")}`}},nF={prefix:` ${_e("?")}`,style:{message:Zd,answer:Qd,highlight:tF,keysHelpTip:e=>` ${e.map(([t,r])=>`${R(t)} ${R(r)}`).join(" ")}`},icon:{cursor:` ${_e("\u23F5")}`,checked:` ${V("\u25C9")}`,unchecked:` ${R("\u25EF")}`}},oF={prefix:` ${_e("?")}`,style:{message:Zd,answer:Qd,highlight:Ky,searchTerm:e=>_e(e)},icon:{cursor:` ${_e("\u23F5")}`}},iF=/SIGINT/i});function ct(){return!1}var Qr=O(()=>{"use strict"});function Or({apiToken:e,siteId:t,directory:r}){let n=ws.resolve(r?ws.join(r,".env"):ws.join(process.cwd(),".env"));r&&!Ln.existsSync(r)&&Ln.mkdirSync(r,{recursive:!0}),Ln.existsSync(n)||Ln.writeFileSync(n,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),pl.default.config({path:n,quiet:!0}),e&&pl.default.set("WEBFLOW_API_TOKEN",e,{path:n,encrypt:!1}),t&&pl.default.set("WEBFLOW_SITE_ID",t,{path:n,encrypt:!1})}var Ln,ws,pl,Qy=O(()=>{"use strict";Ln=D(require("fs")),ws=D(require("path")),pl=D(require("@dotenvx/dotenvx"))});var f,S=O(()=>{"use strict";f=class e extends Error{prefix;skipLogging;isUserError;missingFlag;constructor(t,r){let n=t instanceof Error?t.message:String(t);super(n),this.name="CLIError",this.prefix=r?.prefix,this.skipLogging=r?.skipLogging??!1,this.isUserError=r?.isUserError??(t instanceof e?t.isUserError:!1),this.missingFlag=r?.missingFlag,t instanceof Error?(this.cause=t,this.stack=t.stack):Error.captureStackTrace&&Error.captureStackTrace(this,e)}}});function fl(){if(process.platform==="win32"){let r=process.env.APPDATA??Ds.default.join(tp.default.homedir(),"AppData","Roaming");return Ds.default.join(r,ew)}let t=process.env.XDG_CONFIG_HOME??Ds.default.join(tp.default.homedir(),".config");return Ds.default.join(t,ew)}function tw(){return is("webflow-cli").cache}var tp,Ds,ew,ml=O(()=>{"use strict";tp=D(require("os")),Ds=D(require("path"));Fd();ew="webflow"});function tn(){let e=fl();return rp.default.join(e,lF)}function ks(){let e=tn();try{if(!en.default.existsSync(e))return null;let t=en.default.readFileSync(e,"utf8");return JSON.parse(t)}catch{return null}}function np(e){let t=tn(),r=rp.default.dirname(t);en.default.existsSync(r)||en.default.mkdirSync(r,{recursive:!0,mode:448}),en.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}function op(){let e=tn();try{en.default.existsSync(e)&&en.default.unlinkSync(e)}catch{}}var en,rp,lF,ip=O(()=>{"use strict";en=D(require("fs")),rp=D(require("path"));ml();lF="auth.json"});var bs,sp=O(()=>{"use strict";ye();bs={serverUrl:Uo,timeoutMs:300*1e3}});var rw,nw,ow,iw,cF,sw,uF,aw,lw=O(()=>{"use strict";rw=require("crypto"),nw=D(require("open"));sp();x();dt();ow=e=>{let t=new Uint8Array(e);return rw.webcrypto.getRandomValues(t),Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")},iw=({pollId:e,clientId:t,scope:r})=>`${bs.serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(r.join(" "))}`,cF=e=>`${bs.serverUrl}/oauth/webflow/poll?pollId=${e}`,sw=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(r=>setTimeout(r,3e3)),await(0,nw.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},uF=async e=>{let t=cF(e),r=await G(t);if(!r.ok){let n=`Failed to poll for authentication status (${r.status})`;try{let o=await r.json();o&&o.error&&(n+=`: ${o.error}`)}catch{}throw new Error(n)}return r.json()},aw=(e,t)=>{let r=u.spinner("Waiting");return new Promise((n,o)=>{let i=setTimeout(()=>{clearTimeout(i),clearInterval(s),o(new Error("Authentication timed out. Please try again."))},t),s=setInterval(async()=>{try{let a=await uF(e);a.status==="success"&&a.accessToken?(clearTimeout(i),clearInterval(s),r.succeed("Authentication successful! You can close the browser window."),n(a.accessToken)):a.status==="error"&&(clearTimeout(i),clearInterval(s),r.fail("Authentication failed"),o(new Error(a.error||"Authentication failed")))}catch(a){clearTimeout(i),clearInterval(s),r.fail("Authentication failed"),o(a instanceof Error?a:new Error(String(a)))}},2e3)})}});function uw(){return[...dF,...ct()?["cloud_apps:read"]:[]].sort()}function xt(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=ks();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!cw&&(cw=!0,u.warn(`${he} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${V("webflow auth login --force")} to update your .env file.`)),t}async function T(e){if(e?.apiToken&&!e.force)return e.apiToken;if(!e?.force){let o=xt();if(o)return o}if(W())throw new f(`No API token found. To authenticate in CI/CD environments:
15
+ `),this.warnings.forEach((t,n)=>{console.log(`Warning ${n+1}:`),console.log(` Source: ${t.source}`),console.log(` Message: ${t.message}`),console.log(` Message length: ${t.message.length}`),console.log(` Timestamp: ${new Date(t.timestamp).toISOString()}`),t.stackTrace&&(console.log(" Stack (first 3 lines):"),t.stackTrace.split(`
16
+ `).slice(0,3).forEach(r=>{console.log(` ${r}`)})),console.log("")})}},jA=new jp,Bn=jA});function wt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function qw(e,t){if(!e)return t;let n=parseInt(e,10);return isNaN(n)||n<=0?t:n}function Un(e){Js.push(bn(e)),Js.length>UA&&Js.shift()}function Xw(e){Wp=e}function Kw(e){return Un(`DEBUG: ${e}`),e}function HA(e){return Un(`INFO: ${e}`),e}function VA(e){return Un(`WARN: ${e}`),e}function GA(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Un(`ERROR: ${r}${n}`),Hp=!0;let o=e instanceof Error?e.message:String(e);return Mt(`${r}${o}`)}function JA(e){return Un(`SUCCESS: ${e}`),K(e)}function qA(e){let t=bp({text:`${e}...`,indent:1}).start(),n=!1,r=o=>i=>{if(Un(`${KA[o]||"INFO"}: ${i||e}`),o==="fail"&&(Hp=!0),o==="update"){t.text=i||e;return}n||(n=!0,t.stopAndPersist({symbol:zA[o],text:R(i||e)}))};return{succeed:r("succeed"),fail:r("fail"),warn:r("warn"),info:r("info"),neutral:r("neutral"),update:r("update"),stop:()=>{n||(n=!0,t.stop())}}}function XA(){let e=fi.default.readdirSync(_t).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:fi.default.statSync(Vl.default.join(_t,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);for(;e.length>=BA;)try{let t=e.pop();if(!t)break;fi.default.removeSync(Vl.default.join(_t,t.name))}catch{}}function Vp(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;fi.default.ensureDirSync(_t),XA(),Js.unshift(`CLI Version: ${jn()}`,`Node Version: ${process.version}`,`Platform: ${process.platform}`,`Architecture: ${process.arch}`,`Command: ${t||"N/A"}`,`Exit Code: ${e??0}`,`Memory Usage: ${Math.round(process.memoryUsage().heapUsed/1024/1024)}MB`,`Timestamp: ${new Date().toISOString()}`,...Wp?[`Sync ID: ${Wp}`]:[],"");let n=Js.map(wt);fi.default.writeFileSync(Up,n.join(`
17
+ `)),Hp&&(console.info(`
18
+ ${k} ${R("An error occurred. See logs for more information:")}`),console.info(` ${Tp} Latest log: ${Up}`),console.info(` ${Tp} All logs: ${_t}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
19
+ ${$} Command completed successfully. Logs written to:`),console.info(` ${ui} Latest log: ${Up}`),console.info(` ${ui} All logs: ${_t}`))}catch(t){console.error("Failed to write logs:",t)}}function Yw(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Un(`ERROR: ${r}${n}`)}var fi,Vl,n2,MA,_t,BA,UA,WA,Up,Js,Hp,Wp,KA,zA,mi,zw,Gs,YA,u,_=L(()=>{"use strict";fi=w(require("fs-extra")),Vl=w(require("path")),n2=require("source-map-support/register");ww();vp();Ew();X();pe();Bp();M();MA=Ls("webflow-cli"),_t=MA.log;BA=qw(process.env.MAX_PERSISTED_LOGS,50),UA=qw(process.env.MAX_IN_MEMORY_LOGS,1e3),WA=`${Ns(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Up=Vl.default.join(_t,WA);Js=[],Hp=!1;KA={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},zA={succeed:$,fail:k,warn:re,info:je,neutral:" ",update:void 0};mi=!1;process.on("uncaughtException",e=>{mi||(mi=!0,Un(`UNCAUGHT EXCEPTION: ${e?.stack}`),Vp(1)),Bn.displayGrouped(),Bn.stop(),process.exit(1)});process.on("unhandledRejection",e=>{mi||(mi=!0,Un(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),Vp(1)),Bn.displayGrouped(),Bn.stop(),process.exit(1)});process.on("exit",e=>{mi||(mi=!0,Vp(e))});zw=!0,Gs=e=>{let t=e.split(`
20
+ `).map(n=>n.length?` ${n}`:n).join(`
21
+ `);return zw?(zw=!1,`
22
+ `+t):t};YA={debug:e=>{let t=Kw(e);process.env.DEBUG&&console.debug(Gs(t))},trace:e=>{let t=Kw(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(Gs(HA(e))),warn:e=>console.warn(Gs(VA(e)),Mp),error:(e,t)=>{console.error(Gs(GA(e,t)))},success:e=>console.log(Gs(JA(e))),spinner:qA},u=YA});async function gi(e){process.stdout.write(`
23
+ `);try{return await e()}catch(t){throw t instanceof Error&&o0.test(t.message)&&(u.debug(t.message),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&process.stdin.setRawMode(!1),process.exit(130)),t}}async function Re(e){return V()?e.default??!1:gi(()=>ct.confirm({...e,theme:QA}))}async function Me(e){if(V())return"default"in e?e.default:null;let t=e.choices.map(n=>{if(!n||typeof n!="object"||ct.Separator.isSeparator(n)||n.type==="separator")return n;let r=n.name??String(n.value??"");return{...n,name:` ${R(r)}`}});return gi(()=>ct.select({...e,choices:t,theme:t0}))}async function Je(e){return V()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:gi(()=>ct.input({...e,theme:eD}))}async function rD(e){return V()?null:gi(()=>ct.password({...e,theme:eD}))}async function En(e){if(V()){let n=[];return await e.validate?.(n)!==!0?null:n}let t=e.choices.map(n=>{if(!n||typeof n!="object"||n.type==="separator"||ct.Separator.isSeparator(n))return n;let r=n.name??String(n.value??"");return{...n,name:` ${R(r)}`}});return gi(()=>ct.checkbox({...e,choices:t,theme:n0}))}async function Jl(e){if(V())return"default"in e?e.default:null;let t=(async(n,r)=>(await e.source(n,r)).map(i=>!i||typeof i!="object"||ct.Separator.isSeparator(i)?i:{...i,name:` ${R(i.name??"")}`}));return gi(()=>ct.search({...e,source:t,theme:r0}))}var ct,QA,eD,Ks,tD,Kp,zp,nD,e0,t0,n0,r0,o0,Te=L(()=>{"use strict";ct=w(require("@inquirer/prompts"));we();_();pe();QA={prefix:` ${Ne("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
24
+ `:`${se(e)}
25
+ `,answer:e=>` ${R(e)}`}},eD={prefix:` ${Ne("?")}`,style:{message:e=>`${se(e)}
26
+ `,answer:e=>R(e)}},Ks=2,tD=1,Kp=(e,t)=>t==="done"?`${se(e)}
27
+ `:se(e),zp=e=>` ${R(wt(e).trim())}`,nD=e=>{let t=wt(e),n=t.slice(0,Ks),r=t.slice(Ks+1+tD);return Ne(`${n} ${r}`)},e0=e=>{let t=wt(e),n=t.slice(0,Ks),r=t[Ks+2],o=t.slice(Ks+3+tD);return Ne(`${n} ${r} ${o}`)},t0={prefix:` ${Ne("?")}`,style:{message:Kp,answer:zp,highlight:nD,keysHelpTip:e=>` ${e.map(([t,n])=>`${R(t)} ${R(n)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`}},n0={prefix:` ${Ne("?")}`,style:{message:Kp,answer:zp,highlight:e0,keysHelpTip:e=>` ${e.map(([t,n])=>`${R(t)} ${R(n)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`,checked:` ${K("\u25C9")}`,unchecked:` ${R("\u25EF")}`}},r0={prefix:` ${Ne("?")}`,style:{message:Kp,answer:zp,highlight:nD,searchTerm:e=>Ne(e)},icon:{cursor:` ${Ne("\u23F5")}`}},o0=/SIGINT/i});function tt(){return!0}var Wn=L(()=>{"use strict"});function Hn({apiToken:e,siteId:t,directory:n}){let r=qs.resolve(n?qs.join(n,".env"):qs.join(process.cwd(),".env"));n&&!to.existsSync(n)&&to.mkdirSync(n,{recursive:!0}),to.existsSync(r)||to.writeFileSync(r,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),Kl.default.config({path:r,quiet:!0}),e&&Kl.default.set("WEBFLOW_API_TOKEN",e,{path:r,encrypt:!1}),t&&Kl.default.set("WEBFLOW_SITE_ID",t,{path:r,encrypt:!1})}var to,qs,Kl,cD=L(()=>{"use strict";to=w(require("fs")),qs=w(require("path")),Kl=w(require("@dotenvx/dotenvx"))});var f,C=L(()=>{"use strict";f=class e extends Error{prefix;skipLogging;isUserError;missingFlag;code;constructor(t,n){let r=t instanceof Error?t.message:String(t);super(r),this.name="CLIError",this.prefix=n?.prefix,this.skipLogging=n?.skipLogging??!1,this.isUserError=n?.isUserError??(t instanceof e?t.isUserError:!1),this.missingFlag=n?.missingFlag,this.code=n?.code??(t instanceof e?t.code:void 0),t instanceof Error?(this.cause=t,this.stack=t.stack):Error.captureStackTrace&&Error.captureStackTrace(this,e)}}});function zl(){if(process.platform==="win32"){let n=process.env.APPDATA??Xs.default.join(Xp.default.homedir(),"AppData","Roaming");return Xs.default.join(n,uD)}let t=process.env.XDG_CONFIG_HOME??Xs.default.join(Xp.default.homedir(),".config");return Xs.default.join(t,uD)}function dD(){return Ls("webflow-cli").cache}var Xp,Xs,uD,ql=L(()=>{"use strict";Xp=w(require("os")),Xs=w(require("path"));vp();uD="webflow"});function gr(){let e=zl();return Yp.default.join(e,a0)}function Ys(){let e=gr();try{if(!mr.default.existsSync(e))return null;let t=mr.default.readFileSync(e,"utf8");return JSON.parse(t)}catch{return null}}function Zp(e){let t=gr(),n=Yp.default.dirname(t);mr.default.existsSync(n)||mr.default.mkdirSync(n,{recursive:!0,mode:448}),mr.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}function Qp(){let e=gr();try{mr.default.existsSync(e)&&mr.default.unlinkSync(e)}catch{}}var mr,Yp,a0,ef=L(()=>{"use strict";mr=w(require("fs")),Yp=w(require("path"));ql();a0="auth.json"});var Zs,tf=L(()=>{"use strict";be();Zs={serverUrl:kn,timeoutMs:300*1e3}});var pD,fD,mD,gD,l0,hD,c0,yD,wD=L(()=>{"use strict";pD=require("crypto"),fD=w(require("open"));tf();_();lt();mD=e=>{let t=new Uint8Array(e);return pD.webcrypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")},gD=({pollId:e,clientId:t,scope:n})=>`${Zs.serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(n.join(" "))}`,l0=e=>`${Zs.serverUrl}/oauth/webflow/poll?pollId=${e}`,hD=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(n=>setTimeout(n,3e3)),await(0,fD.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},c0=async e=>{let t=l0(e),n=await J(t);if(!n.ok){let r=`Failed to poll for authentication status (${n.status})`;try{let o=await n.json();o&&o.error&&(r+=`: ${o.error}`)}catch{}throw new Error(r)}return n.json()},yD=(e,t)=>{let n=u.spinner("Waiting");return new Promise((r,o)=>{let i=setTimeout(()=>{clearTimeout(i),clearInterval(s),o(new Error("Authentication timed out. Please try again."))},t),s=setInterval(async()=>{try{let a=await c0(e);a.status==="success"&&a.accessToken?(clearTimeout(i),clearInterval(s),n.succeed("Authentication successful! You can close the browser window."),r(a.accessToken)):a.status==="error"&&(clearTimeout(i),clearInterval(s),n.fail("Authentication failed"),o(new Error(a.error||"Authentication failed")))}catch(a){clearTimeout(i),clearInterval(s),n.fail("Authentication failed"),o(a instanceof Error?a:new Error(String(a)))}},2e3)})}});function bD(){return[...u0,...tt()?d0:[]].sort()}function At(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=Ys();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!DD&&(DD=!0,u.warn(`${re} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${K("webflow auth login --force")} to update your .env file.`)),t}async function T(e){if(e?.apiToken&&!e.force)return e.apiToken;if(!e?.force){let o=At();if(o)return o}if(V())throw new f(`No API token found. To authenticate in CI/CD environments:
28
28
  1. Generate a Workspace API token in your Webflow Dashboard > Apps & Integrations > Manage > Workspace API Token
29
- 2. Set it as the WEBFLOW_API_TOKEN environment variable in your CI/CD pipeline`);let t=ow(16),r=pF(),n=uw();try{let o=iw({pollId:t,clientId:r,scope:n});await sw(o);let i=await aw(t,bs.timeoutMs);return np({accessToken:i,scopes:n,createdAt:new Date().toISOString()}),u.info(`${L} Credentials saved: ${tn()}`),i}catch(o){throw new f(o)}}function pF(){return"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}var dF,cw,ap=O(()=>{"use strict";pe();x();N();S();ip();sp();lw();de();Qr();dF=["assets:read","assets:write","authorized_user:read","cloud_apps:write","cms:read","cms:write","code_components:read","code_components:write","devlink_export:read","forms:read","sites:read","sites:write","workspace:read"];cw=!1});function Es(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function vs(e){try{let r=await new dw.WebflowClient({accessToken:e,environment:{base:`${I}/v2`,dataApi:`${I}/v2`,contentDeliveryApi:`${ll}/v2`}}).sites.list();if(!r||typeof r!="object"||!r.sites||!Array.isArray(r.sites))throw new f("Invalid response from Webflow API");let n=r.sites.map(o=>({id:o.id,displayName:o.displayName??"",shortName:o.shortName||(o.displayName??"").toLowerCase().replace(/\s+/g,"-"),lastUpdated:o.lastUpdated??null}));return n.sort((o,i)=>o.displayName.localeCompare(i.displayName)),n}catch(t){throw new f(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
30
- `})}}async function lp(e){let t=e.map(n=>({name:`${n.displayName} (${n.shortName})`,value:n})),r=await dl({message:"Search for a Webflow site:",source:n=>{if(!n)return t;let o=n.toLowerCase();return t.filter(i=>i.value.displayName.toLowerCase().includes(o)||i.value.shortName.toLowerCase().includes(o))},pageSize:15});if(!r){if(e.length===0)throw new f("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return r}var dw,gl=O(()=>{"use strict";dw=require("webflow-api");Ae();x();ye();ye();S()});var Nn,rn,cp=O(()=>{"use strict";S();Nn=class extends f{constructor(t){super(t),this.name="NoWebflowSitesError"}},rn=class extends f{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function Ue(e,t){let r=t?.site??Es(e);if(W()&&!r)throw new f(`No site ID configured for this project.
31
- Run ${V("webflow auth login")} locally to authenticate and associate this project with a Webflow site,
32
- or provide --site and --api-token when running a CLI command`);let n=await T({apiToken:t?.apiToken,force:t?.force});if(!r||t?.force){let o=await vs(n);if(o.length===0)throw new Nn("No Webflow sites found in your account. Please make sure you have at least one authorized site in your Webflow account");let i=o.length>1?await lp(o):o[0];r=i.id;let s=xe({siteId:r});return e.siteId=s.siteId,u.info(`${L} Site ID updated in webflow.json`),{siteId:r,siteName:i.displayName,accessToken:n}}return{siteId:r,accessToken:n}}var pw=O(()=>{"use strict";Me();pe();ap();gl();S();cp();N();de();x()});async function up(e){let t=new fw.WebflowClient({accessToken:e,environment:{base:`${I}/v2`,dataApi:`${I}/v2`}});try{return await t.token.authorizedBy()}catch{return null}}var fw,mw=O(()=>{"use strict";fw=require("webflow-api");ye()});var J=O(()=>{"use strict";Qy();ap();pw();gl();gl();ip();mw();cp()});function xF(e,t){if(e.includes("..")||tr.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let r=tr.resolve(t,e),n=tr.resolve(t);if(!r.startsWith(n+tr.sep)&&r!==n)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function _l(e,t,r){let n=tr.join(process.cwd(),t);r&&(0,on.existsSync)(n)&&await(0,Cl.rm)(n,{recursive:!0,force:!0}),(0,on.existsSync)(n)||await(0,Cl.mkdir)(n);for(let o of e){xF(o.path,n);let i=CF(n,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));_F(n,s)}(0,on.writeFileSync)(i,o.content,{flag:"w+"})}}function CF(e,t){return tr.join(e,...t.split("/"))}function _F(e,t){let r=t.split("/"),n=e;for(let o of r)n=tr.join(n,o),(0,on.existsSync)(n)||(0,on.mkdirSync)(n)}var on,Cl,tr,bp=O(()=>{"use strict";on=require("fs"),Cl=require("fs/promises"),tr=D(require("path"))});function Al(e){for(let t of e??[]){let r=u[t.status]??u.info,n=RF[t.status]??Fe;r(`
33
- ${n} ${t.content}`)}}var RF,Sp=O(()=>{"use strict";x();N();RF={info:Fe,warn:he,success:L}});function Cp(e){let{manifestPath:t}=Z();return(0,Xw.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var Xw,Zw=O(()=>{"use strict";Xw=require("fs");as()});function Tl(e,t){try{let r=_p(),n=Fp(Object.values(e)),o=t?.force;return n&&r&&!o}catch{return!1}}var Qw,eD,_p,Fp,Rl=O(()=>{"use strict";Qw=require("path"),eD=require("fs-extra");_p=()=>{try{return(0,eD.existsSync)((0,Qw.join)(process.cwd(),"tsconfig.json"))}catch{return!1}},Fp=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function IF(e){let{export:t,...r}=e;return t?r["devlink-export"]!=null?(Cp(r),r):(u.warn(`${he} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),r["devlink-export"]={...t},Cp(r),r):r}function nD(e,t){try{new RegExp(e)}catch{throw new f(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function iD(e){e=IF(e);let t=e["devlink-export"]||{},r=!1,n=t.rootDir;n||(W()?n=tD:(r=!0,n=await Je({message:"Enter the root directory for exported components:",default:tD,validate:d=>!d||d.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&($F()?o=!0:W()?o=!1:(r=!0,o=await Pe({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(W()?i=rD:(r=!0,i=await Pe({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:rD}))),t.components&&nD(t.components,"components"),t.componentGroups&&nD(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(W()?(s=Il,a=Ol):(r=!0,await Pe({message:"Do you want to export all components?",default:!0})?(s=Il,a=Ol):(s=await Je({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:Il,validate:p=>{try{return new RegExp(p),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Je({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:Ol,validate:p=>{try{return new RegExp(p),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||Il,a=a||Ol;let l=t.relativeHrefRoot;l===void 0&&(l=OF);let c={...t,rootDir:n,components:s,componentGroups:a,ts:o,cssScopes:i,relativeHrefRoot:l};return(!t.rootDir||t.ts===void 0||t.cssScopes===void 0||!t.components||!t.componentGroups||t.relativeHrefRoot===void 0)&&PF(c),{config:c,wasPrompted:r}}function PF(e){xe({"devlink-export":{...e}}),u.info(`${L} Devlink Export configuration updated in webflow.json`)}function $F(){try{let e=process.cwd();if(_p())return!0;let t=["src","app","pages","components"];for(let r of t){let n=oD.join(e,r);if(Pl.existsSync(n)&&Fp(Pl.readdirSync(n)))return!0}}catch{}return!1}var Pl,oD,tD,Il,Ol,rD,OF,sD=O(()=>{"use strict";Pl=D(require("fs")),oD=D(require("path"));Ae();pe();x();N();S();Pd();Zw();Rl();tD="./webflow",Il=".*",Ol=".*",rD=!0,OF="/"});function Mn(e){let t=e;for(let r=0;r<8&&t instanceof Error;r+=1){if(t.code===Tp)return!0;t=t.cause}return!1}async function cD(e){if(e.ok)return;let t=await e.text().catch(()=>"");u.debug(`Server error response (HTTP ${e.status}): ${t||"<empty>"}`);let r,n;try{let o=JSON.parse(t);r=o.message,n=o.code}catch{}throw new Cs(r||`Request failed (HTTP ${e.status}).`,{code:n})}async function Rp(e,t,r,n){let o=await LF(r,n,t,e);if(!o.files||!Array.isArray(o.files))throw new f("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function LF(e,t,r,n){let{taskId:o,polling:i}=await NF(e,t,r,n);return jF(e,t,r,o,i)}async function NF(e,t,r,n){let o=await(0,Ap.default)(`${I}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",[lD]:t},body:JSON.stringify(n),timeout:6e4});return o.ok||await cD(o),await o.json()}async function jF(e,t,r,n,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,d=i;do{let p=await(0,Ap.default)(`${I}/v2/devlink/${e}/export/${n}`,{headers:{Authorization:`Bearer ${r}`,[lD]:t},timeout:6e4});p.ok||await cD(p);let h=await p.json();if(h.status==="finished")return h.result;if(h.status==="failed")throw new Cs("The export task failed. Please try again or report a bug.");await(0,aD.setTimeout)(d),d=Math.min(d*a,s)}while(Date.now()<c);throw new Cs(`Export task timed out after ${l}ms. Please try again.`)}var Ap,aD,lD,Tp,Cs,Ip=O(()=>{"use strict";Ap=D(require("node-fetch")),aD=require("timers/promises");x();ye();S();lD="X-WF-Sync-Id",Tp="devlink_export_not_entitled",Cs=class extends Error{code;constructor(t,r){super(t),this.code=r?.code}}});var uD,dD=O(()=>{"use strict";Ae();x();uD=async(e,t)=>{if(!t)return;await Pe({message:`Ready to export components to ${e.rootDir}?`,default:!0})||(u.info("Export cancelled."),process.exit(0))}});function pD(e,t,r){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:r||`${t}s`;return`${e} ${i}`}var fD=O(()=>{"use strict"});async function $l(e){let t=Date.now(),r;try{let{manifest:n}=Z(),{siteId:o,accessToken:i}=await Ue(n,e),s=(0,mD.randomUUID)();By(s);let{config:a,wasPrompted:l}=await iD(n);u.info(`${L} Export configuration loaded!`),await uD(a,l);let c=_.forExport({authToken:i,siteId:o});r=u.spinner("Exporting components"),await c.sendUsage("devlink_export_start",{cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot});try{let{files:d,messages:p,metadata:h}=await Rp(a,i,o,s),g=h.exportCoverage==="full";await _l(d,a.rootDir,g),r.succeed(`${pD(h.componentCount,"component")} exported to ${a.rootDir}`),Al(p);let m=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:m,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(d){let p=d instanceof Error?d.message:String(d);throw e?.silentNotEntitled&&Mn(d)?r.stop():r.fail(`Components export failed: ${p}`),await c.sendError(d instanceof Error?d:new Error(String(d)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),d}}catch(n){if(!(e?.silentNotEntitled&&Mn(n))){let i="Export failed: "+(n instanceof Error?n.message:n);r?r.fail(i):u.error(i,{prefix:`
34
- `+b})}throw new f(n,{skipLogging:!0})}}var mD,gD=O(()=>{"use strict";mD=require("crypto");sD();Ip();dD();z();J();Me();fD();x();S();bp();N();Sp()});var hD={};uh(hD,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>Tp,exportComponents:()=>$l,isDevlinkNotEntitledError:()=>Mn});var Ll=O(()=>{"use strict";gD();Ip()});var dh=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function OC(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.code==="DEP0040"&&typeof t.message=="string"&&t.message.includes("punycode")}function PC(e=process){if(e[dh])return;e[dh]=!0;let t=e.emit;e.emit=function(n,...o){return n==="warning"&&OC(o[0])?!1:t.call(this,n,...o)}}PC();var SC=D(require("fs")),xC=require("commander");var bC=require("commander");de();x();var Wy=require("child_process"),Hy=require("fs"),Yd=D(require("semver"));x();var Xd="@webflow/webflow-cli",On="@webflow/data-types",ul="@webflow/react",Q_=[Xd,On,ul],Pn=class{getInstalledDependencies(){try{let t=(0,Wy.execSync)(`npm ls ${Q_.join(" ")} --depth=0 --json --silent`,{encoding:"utf-8"}),r=JSON.parse(t);return r.dependencies?Object.entries(r.dependencies).reduce((n,[o,{version:i}])=>(n[o]=i,n),{}):{}}catch(t){return u.debug(`Failed to get installed dependencies: ${t}`),{}}}getRequiredDependencies(t){let r=JSON.parse((0,Hy.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...r.dependencies,...r.devDependencies}}checkCLIAndDataTypes(t){let r=t[On];if(!r)return;let o=this.getRequiredDependencies(Xd)[On];if(!Yd.default.satisfies(r,o))throw new Error(`Version mismatch: ${Xd} requires ${On} v${o} but found v${r}`)}checkReactAndDataTypes(t){let r=t[On],n=t[ul];if(!(!r||!n)&&!Yd.default.eq(r,n))throw new Error(`Version mismatch: ${ul} and ${On} must be on the same version. Found ${ul}@${n} and ${On}@${r}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var Xy=require("fs-extra");Ae();var Zy=require("@dotenvx/dotenvx"),$n=D(require("semver"));x();var Jy=require("child_process"),qy=require("util"),sF=(0,qy.promisify)(Jy.exec);async function Zr(e,t){try{let{stdout:r,stderr:n}=await sF(e,t);return{stdout:r.toString().trim(),stderr:n.toString().trim(),code:0}}catch(r){let n=r;return{stdout:n.stdout??"",stderr:n.stderr??String(n.message??""),code:n.code??1}}}pe();var ep=D(sl());N();de();(0,Zy.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var Yy={npm:{updateCommand:"npm install",update:async e=>await Zr(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await Zr(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await Zr(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await Zr(`pnpm outdated --json ${e}`);return JSON.parse(t)},lockFile:"pnpm-lock.yaml",globalFlag:"--global",supported:!0},yarn:{lockFile:"yarn.lock",globalFlag:"",updateCommand:"",getOutdated:async()=>({}),update:async()=>({stdout:"",stderr:"",code:0}),supported:!1}},aF=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],ys=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(Yy))if((0,Xy.existsSync)(t.lockFile))return t;return Yy.npm}async listOutdatedPackages(t="local",r=aF){let{getOutdated:n,globalFlag:o}=this.packageManager,i=await n(`${t==="global"?o:""} ${r?.join(" ")}`);return Object.fromEntries(Object.entries(i).map(([s,a])=>Array.isArray(a)?[s,{current:a[0].current,latest:a[0].latest,installationType:t}]:[s,{current:a.current,latest:a.latest,installationType:t}]))}async getOutdatedPackages(){let t=await this.listOutdatedPackages();if(t["@webflow/webflow-cli"])return t;let r=await this.listOutdatedPackages("global",["@webflow/webflow-cli"]);return{...t,...r}}async showUpdatePrompt(t){let r={name:"Update all packages",value:"update-all"},n=Object.entries(t).map(([i,{current:s,latest:a}])=>({name:`${i} (${s} ${ot} ${a})`,value:i})),o=await fr({message:`New versions of the following ${_e("@webflow")} packages are available. Would you like to update them?`,choices:[r,...n]});return o==null?[]:o.includes("update-all")?Object.keys(t):o}showUpdateSuggestions(t){let{updateCommand:r,globalFlag:n}=this.packageManager;u.info(`${Fe} New versions of the following ${_e("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(R(` ${al} ${s} (${a} ${ot} ${l})`))});let o=Object.entries(t).filter(([,{installationType:s}])=>s==="local").map(([s])=>`${s}@latest`),i=Object.entries(t).filter(([,{installationType:s}])=>s==="global").map(([s])=>`${s}@latest`);u.info(`
35
- ${ot} To update, run:`),o.length>0&&u.info(V(` ${r} ${o.join(" ")}`)),i.length>0&&u.info(V(` ${r} ${n} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=$n.prerelease(ep.default.version);return t&&t.length>0&&typeof t[0]=="string"?t[0]:"latest"}async promptPrerelease(t){let r;try{r=u.spinner("Checking for updates (to disable, use --skip-update-check)");let{stdout:n,code:o}=await Zr(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!n.trim()){r.succeed("Up to date");return}let i=n.trim(),s=ep.default.version;if(!$n.valid(i)||!$n.valid(s)){r.succeed("Up to date");return}if(!$n.gt(i,s)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||W()){u.info(`${Fe} A new version of @webflow/webflow-cli@${t} is available.`);let{code:p}=await Zr("npm ls @webflow/webflow-cli --json"),g=(p===0?"local":"global")==="global"?" --global":"";u.info(`${ot} To update, run: `+V(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`)+`
36
- `);return}let{code:l}=await Zr("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await Pe({message:`A new version of @webflow/webflow-cli@${t} is available.
37
- Would you like to update it?`,default:!1})){r=u.spinner("Updating");let p=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${p} @webflow/webflow-cli@${t}`),r.succeed("Updated successfully")}catch{let g=c==="global"?` ${this.packageManager.globalFlag}`:"";r.fail("Update failed. Manually run: "+V(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}async prompt(){if(this.shouldSkipUpdateChecks())return;let t=this.getDistTag();if(t!=="latest")return this.promptPrerelease(t);let r;try{r=u.spinner("Checking for updates (to disable, use --skip-update-check)");let n=await this.getOutdatedPackages();if(!(Object.keys(n).length>0)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||W()){this.showUpdateSuggestions(n);return}let s=await this.showUpdatePrompt(n);if(s.length>0){r=u.spinner("Updating");let{local:a,global:l}=s.reduce((h,g)=>(h[n[g].installationType==="global"?"global":"local"].push(g),h),{local:[],global:[]}),{update:c,globalFlag:d,updateCommand:p}=this.packageManager;try{a.length>0&&await c(`${a.map(h=>`${h}@latest`).join(" ")}`),l.length>0&&await c(`${d} ${l.map(h=>`${h}@latest`).join(" ")}`),r.succeed("Updated successfully")}catch{r.fail("Update failed. Manually run: "+V(`${p} ${s.map(g=>`${g}@latest`).join(" ")}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}};pe();Qr();Gd();Wd();Ae();z();J();pe();Me();x();S();N();de();var hw=e=>{let t=e.command("auth").description("Authentication and configuration commands");t.command("login").description("Authenticate with Webflow and save credentials to .env file").option("-f, --force","Force reauthentication even if credentials exist").action(async r=>{if(W()){u.info(`${b} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:n}=Z();if(!r.force&&xt()){let i=Es(n);u.info(`${L} Webflow credentials already exist:`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
38
- Use --force flag to reauthenticate anyway`);return}try{let o=await T({force:r.force});Or({apiToken:o}),u.info(`
39
- You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new f(o,{prefix:`${b} Authentication failed:`})}}),t.command("status").description("Show current authentication status").action(async()=>{let r=ks(),n=r?.accessToken??xt();if(!n){u.info(`${b} Not logged in. Run ${V("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let o=await up(n);if(!o){u.info(`${b} Token is invalid or expired. Run ${V("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}u.info(`${L} Logged in as ${o.firstName} ${o.lastName} (${o.email})`),r?.scopes?.length&&u.info(` Scopes: ${r.scopes.join(", ")}`),u.info(` Session: ${tn()}`)}catch(o){throw new f(o,{prefix:`${b} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove stored credentials").action(async()=>{op(),u.info(`${L} Logged out. Session file removed.`),u.info(`${ot} Run ${V("webflow auth login")} to authenticate again.`)}),t.command("telemetry").description("Manage telemetry settings for all Webflow CLI commands").option("--enable","Enable telemetry for all commands").option("--disable","Disable telemetry for all commands").option("--status","Show current telemetry status").action(async r=>{let n=Xr.getInstance();if(r.status){let s=await n.getTelemetryStatus();u.info(gw(s.enabled));return}if(r.enable){await n.setGlobalPreference(!0),u.info(dp(!0));return}if(r.disable){await n.setGlobalPreference(!1),u.info(dp(!1));return}let o=await n.getTelemetryStatus();if(u.info(gw(o.enabled)),W()){u.info("\u{1F4A1} When --no-input mode is enabled please provide --enable or --disable option");return}let i=await Be({message:"What would you like to do?",choices:[{name:"Enable telemetry for all commands",value:"enable"},{name:"Disable telemetry for all commands",value:"disable"},{name:"Cancel",value:"cancel"}]});if(i==="enable"||i==="disable"){let s=i==="enable";await n.setGlobalPreference(s),u.info(dp(s))}})},dp=e=>`${L} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,gw=e=>`${Fe} Telemetry status: ${e?`enabled ${L}`:`disabled ${b}`}`;var Lw=D(require("http")),Nw=D(require("node-fetch")),jw=D(require("serve-handler")),Mw=require("fs"),Bw=D(require("path")),Uw=require("commander");var ww=D(require("archiver")),fp=require("commander"),wl=require("fs");var yw=require("cosmiconfig"),pp=require("commander"),hl=async(e,t)=>{let r=await fF(t),n=r.config.apiVersion;return n&&typeof n!="string"&&pp.program.error('Error: The apiVersion field in webflow.json must be a string (i.e. "apiVersion": "2").'),{filepath:r.filepath,config:{publicDir:e,...r.config}}},fF=async e=>{let r=await(0,yw.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return r||pp.program.error(`No ${e} file was found. Run this command within your extension folder.`),r};var Dw=D(require("mime-types")),yl=D(require("path")),mF=5*1024*1024,gF=new Set(["application/javascript","application/json","application/xml","image/png","image/jpeg","image/gif","image/svg+xml","image/webp","image/vnd.microsoft.icon","image/x-icon","video/webm","font/ttf","font/otf","font/woff","font/woff2","text/plain","text/markdown","text/html","text/css"]),kw=async(e,t,r)=>{let{config:n,filepath:o}=await hl(e,t),i=yl.join(o,".."),s=!0,a=!1,l=d=>{let p=d.name,h=Dw.default.lookup(p);return p==="index.html"&&(a=!0),p&&p.endsWith(".DS_Store")||!h?!1:gF.has(h)?d:(console.log(`Invalid file type: ${h} for file: ${p}`),s=!1,!1)},c=d=>{(0,wl.unlink)(r,p=>{p&&console.error(`Failed to delete file: ${p}`),fp.program.error(d)})};return console.log(`Packaging the contents of the ${n.publicDir} folder into ${r}...`),new Promise(d=>{let p=(0,ww.default)("zip",{zlib:{level:9}}),h=(0,wl.createWriteStream)(yl.join(i,r));h.on("close",()=>{d(void 0)}),p.directory(yl.join(i,n.publicDir),!1,l),p.file(o,{name:t}),p.pipe(h),p.finalize(),p.on("warning",g=>{console.log(g)}),p.on("error",g=>{fp.program.error(g.message)}),p.on("finish",()=>{if(!a){c("Could not find index.html in your `publicDir`, all Designer Extension code needs to be inside of `publicDir`");return}if(!s){c("Bundling failed due to invalid file types");return}if(!p.pointer()||p.pointer()===0){c("Bundling failed with no output");return}if(p.pointer()>=mF){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${p.pointer()} total bytes written`),console.log(`Done! ${r} is ready for you to upload to your Webflow app.`)})})};var Ss=D(require("path")),mr=D(require("fs/promises")),bl=D(require("fs")),Ew=require("url"),G1=require("dotenv/config"),vw=["js","cjs","json"],hp=process.cwd(),Sw=".webflowrc",$r=Ss.extname(bl.readdirSync(hp).find(e=>e.includes(Sw))??"").replace(/\./g,""),Pr=Ss.join(hp,`${Sw}${$r&&`.${$r}`}`),xw=bl.existsSync(Pr),mp=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${vw.join(", ")}`)}},Dl=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${$r}. The supported extensions are: ${vw.join(", ")}`)}},kl=class extends Error{constructor(t){let r=t.includes(".webflowrc"),n=t.includes("webflow.json"),o;r?o=`It seems like you don't have a .webflowrc file in your project (${t}). Make sure there is a .webflowrc file in your project root.`:n?o=`It seems like you don't have a webflow.json file in your project (${t}). Make sure there is a webflow.json file in your project root.`:o=`It seems like you don't have a config file in your project (${t}). Make sure there is a config file in your project root.`,super(o)}},gp=class extends Error{constructor(t){super(`The following required fields are missing or undefined in your .webflowrc file: ${t}. If you're using process.env variables, make sure they're set up correctly.`)}};async function hF(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,Ew.pathToFileURL)(e).href:e)).default}function bw(e,t){let r=t.filter(n=>!e[n]);if(r.length)throw new gp(r.join(", "))}async function Ko(e=[],t=!1){if(!xw){if(t)return{};throw new kl(Pr)}if(!$r)throw new mp;switch($r){case"js":case"cjs":{await mr.access(Pr);let r=await hF(Pr);return bw(r,e),r}case"json":{let r=JSON.parse(await mr.readFile(Pr,"utf8"));return bw(r,e),r}default:throw new Dl}}function yF(e,t){if($r==="js"||$r==="cjs"){let n=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(n)return n[1]}}function wF(e,t,r){let n=yF(t,r);if(n){let o=new RegExp(`${r}: ".*?",`,"g");return e.replace(o,`${r}: process.env.${n},`)}return e}async function DF(e){let t=["authToken","host","siteId"],r=await mr.readFile(Pr,"utf-8");for(let n of t)e=wF(e,r,n);return e}async function kF(){try{let e=Ss.join(hp,"package.json");return await mr.access(e),JSON.parse(await mr.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function Cw(e){if(!xw)throw new kl(Pr);let t=JSON.stringify(e,null,2);switch($r){case"js":case"cjs":{let r=await DF(t.replace(/"([^"]+)":/g,"$1:")),n=await kF()&&$r==="js"?"export default ":"module.exports = ";return mr.writeFile(Pr,n+r)}case"json":return mr.writeFile(Pr,t);default:throw new Dl}}var nn=D(require("fs")),Mt=D(require("path"));var xs="webflow.json",_w="index.html",Fw="bundle.zip",yp="public",wp="extension-scaffolds",El="default";var Aw="package.json",Tw="wf-placeholder-name",Dp=e=>JSON.stringify(e,null,2),Rw=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
29
+ 2. Set it as the WEBFLOW_API_TOKEN environment variable in your CI/CD pipeline`);let t=mD(16),n=p0(),r=bD();try{let o=gD({pollId:t,clientId:n,scope:r});await hD(o);let i=await yD(t,Zs.timeoutMs);return Zp({accessToken:i,scopes:r,createdAt:new Date().toISOString()}),u.info(`${$} Credentials saved: ${gr()}`),i}catch(o){throw new f(o)}}function p0(){return"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}var u0,d0,DD,nf=L(()=>{"use strict";we();_();M();C();ef();tf();wD();pe();Wn();u0=["assets:read","assets:write","authorized_user:read","cloud_apps:write","cms:read","cms:write","code_components:read","code_components:write","devlink_export:read","forms:read","sites:read","sites:write","workspace:read"],d0=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];DD=!1});function no(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function hr(e){try{let n=await new kD.WebflowClient({accessToken:e,environment:{base:`${P}/v2`,dataApi:`${P}/v2`,contentDeliveryApi:`${di}/v2`}}).sites.list();if(!n||typeof n!="object"||!n.sites||!Array.isArray(n.sites))throw new f("Invalid response from Webflow API");let r=n.sites.map(o=>({id:o.id,displayName:o.displayName??"",shortName:o.shortName||(o.displayName??"").toLowerCase().replace(/\s+/g,"-"),lastUpdated:o.lastUpdated??null,workspaceId:o.workspaceId??null}));return r.sort((o,i)=>o.displayName.localeCompare(i.displayName)),r}catch(t){throw new f(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
30
+ `})}}async function hi(e){let t=e.map(r=>({name:`${r.displayName} (${r.shortName})`,value:r})),n=await Jl({message:"Search for a Webflow site:",source:r=>{if(!r)return t;let o=r.toLowerCase();return t.filter(i=>i.value.displayName.toLowerCase().includes(o)||i.value.shortName.toLowerCase().includes(o))},pageSize:15});if(!n){if(e.length===0)throw new f("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return n}var kD,Xl=L(()=>{"use strict";kD=require("webflow-api");Te();_();be();be();C()});var ro,yr,rf=L(()=>{"use strict";C();ro=class extends f{constructor(t){super(t),this.name="NoWebflowSitesError"}},yr=class extends f{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function Ke(e,t){let n=t?.site??no(e);if(V()&&!n)throw new f(`No site ID configured for this project.
31
+ Run ${K("webflow auth login")} locally to authenticate and associate this project with a Webflow site,
32
+ or provide --site and --api-token when running a CLI command`);let r=await T({apiToken:t?.apiToken,force:t?.force});if(!n||t?.force){let o=await hr(r);if(o.length===0)throw new ro("No Webflow sites found in your account. Please make sure you have at least one authorized site in your Webflow account");let i=o.length>1?await hi(o):o[0];n=i.id;let s=Se({siteId:n});return e.siteId=s.siteId,u.info(`${$} Site ID updated in webflow.json`),{siteId:n,siteName:i.displayName,accessToken:r}}return{siteId:n,accessToken:r}}var ED=L(()=>{"use strict";We();we();nf();Xl();C();rf();M();pe();_()});async function of(e){let t=new vD.WebflowClient({accessToken:e,environment:{base:`${P}/v2`,dataApi:`${P}/v2`,contentDeliveryApi:`${di}/v2`}});try{return await t.token.authorizedBy()}catch{return null}}var vD,SD=L(()=>{"use strict";vD=require("webflow-api");be()});var q=L(()=>{"use strict";cD();nf();ED();Xl();Xl();ef();SD();rf()});function x0(e,t){if(e.includes("..")||sn.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let n=sn.resolve(t,e),r=sn.resolve(t);if(!n.startsWith(r+sn.sep)&&n!==r)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function lc(e,t,n){let r=sn.join(process.cwd(),t);n&&(0,Dr.existsSync)(r)&&await(0,ac.rm)(r,{recursive:!0,force:!0}),(0,Dr.existsSync)(r)||await(0,ac.mkdir)(r);for(let o of e){x0(o.path,r);let i=C0(r,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));F0(r,s)}(0,Dr.writeFileSync)(i,o.content,{flag:"w+"})}}function C0(e,t){return sn.join(e,...t.split("/"))}function F0(e,t){let n=t.split("/"),r=e;for(let o of n)r=sn.join(r,o),(0,Dr.existsSync)(r)||(0,Dr.mkdirSync)(r)}var Dr,ac,sn,hf=L(()=>{"use strict";Dr=require("fs"),ac=require("fs/promises"),sn=w(require("path"))});function uc(e){for(let t of e??[]){let n=u[t.status]??u.info,r=R0[t.status]??je;n(`
33
+ ${r} ${t.content}`)}}var R0,Df=L(()=>{"use strict";_();M();R0={info:je,warn:re,success:$}});function kf(e){let{manifestPath:t}=ne();return(0,ab.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var ab,lb=L(()=>{"use strict";ab=require("fs");js()});function dc(e,t){try{let n=Ef(),r=vf(Object.values(e)),o=t?.force;return r&&n&&!o}catch{return!1}}var cb,ub,Ef,vf,pc=L(()=>{"use strict";cb=require("path"),ub=require("fs-extra");Ef=()=>{try{return(0,ub.existsSync)((0,cb.join)(process.cwd(),"tsconfig.json"))}catch{return!1}},vf=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function T0(e){let{export:t,...n}=e;return t?n["devlink-export"]!=null?(kf(n),n):(u.warn(`${re} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),n["devlink-export"]={...t},kf(n),n):n}function fb(e,t){try{new RegExp(e)}catch{throw new f(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function gb(e){e=T0(e);let t=e["devlink-export"]||{},n=!1,r=t.rootDir;r||(V()?r=db:(n=!0,r=await Je({message:"Enter the root directory for exported components:",default:db,validate:d=>!d||d.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(O0()?o=!0:V()?o=!1:(n=!0,o=await Re({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(V()?i=pb:(n=!0,i=await Re({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:pb}))),t.components&&fb(t.components,"components"),t.componentGroups&&fb(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(V()?(s=fc,a=mc):(n=!0,await Re({message:"Do you want to export all components?",default:!0})?(s=fc,a=mc):(s=await Je({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:fc,validate:p=>{try{return new RegExp(p),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Je({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:mc,validate:p=>{try{return new RegExp(p),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||fc,a=a||mc;let l=t.relativeHrefRoot;l===void 0&&(l=P0);let c={...t,rootDir:r,components:s,componentGroups:a,ts:o,cssScopes:i,relativeHrefRoot:l};return(!t.rootDir||t.ts===void 0||t.cssScopes===void 0||!t.components||!t.componentGroups||t.relativeHrefRoot===void 0)&&$0(c),{config:c,wasPrompted:n}}function $0(e){Se({"devlink-export":{...e}}),u.info(`${$} Devlink Export configuration updated in webflow.json`)}function O0(){try{let e=process.cwd();if(Ef())return!0;let t=["src","app","pages","components"];for(let n of t){let r=mb.join(e,n);if(gc.existsSync(r)&&vf(gc.readdirSync(r)))return!0}}catch{}return!1}var gc,mb,db,fc,mc,pb,P0,hb=L(()=>{"use strict";gc=w(require("fs")),mb=w(require("path"));Te();we();_();M();C();Ap();lb();pc();db="./webflow",fc=".*",mc=".*",pb=!0,P0="/"});function io(e){let t=e;for(let n=0;n<8&&t instanceof Error;n+=1){if(t.code===xf)return!0;t=t.cause}return!1}async function Db(e){if(e.ok)return;let t=await e.text().catch(()=>"");u.debug(`Server error response (HTTP ${e.status}): ${t||"<empty>"}`);let n,r;try{let o=JSON.parse(t);n=o.message,r=o.code}catch{}throw new ta(n||`Request failed (HTTP ${e.status}).`,{code:r})}async function Cf(e,t,n,r){let o=await L0(n,r,t,e);if(!o.files||!Array.isArray(o.files))throw new f("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function L0(e,t,n,r){let{taskId:o,polling:i}=await N0(e,t,n,r);return j0(e,t,n,o,i)}async function N0(e,t,n,r){let o=await(0,Sf.default)(`${P}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",[wb]:t},body:JSON.stringify(r),timeout:6e4});return o.ok||await Db(o),await o.json()}async function j0(e,t,n,r,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,d=i;do{let p=await(0,Sf.default)(`${P}/v2/devlink/${e}/export/${r}`,{headers:{Authorization:`Bearer ${n}`,[wb]:t},timeout:6e4});p.ok||await Db(p);let m=await p.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new ta("The export task failed. Please try again or report a bug.");await(0,yb.setTimeout)(d),d=Math.min(d*a,s)}while(Date.now()<c);throw new ta(`Export task timed out after ${l}ms. Please try again.`)}var Sf,yb,wb,xf,ta,Ff=L(()=>{"use strict";Sf=w(require("node-fetch")),yb=require("timers/promises");_();be();C();wb="X-WF-Sync-Id",xf="devlink_export_not_entitled",ta=class extends Error{code;constructor(t,n){super(t),this.code=n?.code}}});var bb,kb=L(()=>{"use strict";Te();_();bb=async(e,t)=>{if(!t)return;await Re({message:`Ready to export components to ${e.rootDir}?`,default:!0})||(u.info("Export cancelled."),process.exit(0))}});function Eb(e,t,n){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:n||`${t}s`;return`${e} ${i}`}var vb=L(()=>{"use strict"});async function hc(e){let t=Date.now(),n;try{let{manifest:r}=ne(),{siteId:o,accessToken:i}=await Ke(r,e),s=(0,Sb.randomUUID)();Xw(s);let{config:a,wasPrompted:l}=await gb(r);u.info(`${$} Export configuration loaded!`),await bb(a,l);let c=F.forExport({authToken:i,siteId:o});n=u.spinner("Exporting components"),await c.sendUsage("devlink_export_start",{cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot});try{let{files:d,messages:p,metadata:m}=await Cf(a,i,o,s),h=m.exportCoverage==="full";await lc(d,a.rootDir,h),n.succeed(`${Eb(m.componentCount,"component")} exported to ${a.rootDir}`),uc(p);let g=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:g,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(d){let p=d instanceof Error?d.message:String(d);throw e?.silentNotEntitled&&io(d)?n.stop():n.fail(`Components export failed: ${p}`),await c.sendError(d instanceof Error?d:new Error(String(d)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),d}}catch(r){if(!(e?.silentNotEntitled&&io(r))){let i="Export failed: "+(r instanceof Error?r.message:r);n?n.fail(i):u.error(i,{prefix:`
34
+ `+k})}throw new f(r,{skipLogging:!0})}}var Sb,xb=L(()=>{"use strict";Sb=require("crypto");hb();Ff();kb();X();q();We();vb();_();C();hf();M();Df()});var Cb={};by(Cb,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>xf,exportComponents:()=>hc,isDevlinkNotEntitledError:()=>io});var yc=L(()=>{"use strict";xb();Ff()});var ky=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function T_(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.code==="DEP0040"&&typeof t.message=="string"&&t.message.includes("punycode")}function P_(e=process){if(e[ky])return;e[ky]=!0;let t=e.emit;e.emit=function(r,...o){return r==="warning"&&T_(o[0])?!1:t.call(this,r,...o)}}P_();var E_=w(require("fs")),v_=require("commander");var D_=require("commander");pe();_();var Zw=require("child_process"),Qw=require("fs"),Gp=w(require("semver"));_();var Jp="@webflow/webflow-cli",Zr="@webflow/data-types",Gl="@webflow/react",ZA=[Jp,Zr,Gl],Qr=class{getInstalledDependencies(){try{let t=(0,Zw.execSync)(`npm ls ${ZA.join(" ")} --depth=0 --json --silent`,{encoding:"utf-8"}),n=JSON.parse(t);return n.dependencies?Object.entries(n.dependencies).reduce((r,[o,{version:i}])=>(r[o]=i,r),{}):{}}catch(t){return u.debug(`Failed to get installed dependencies: ${t}`),{}}}getRequiredDependencies(t){let n=JSON.parse((0,Qw.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...n.dependencies,...n.devDependencies}}checkCLIAndDataTypes(t){let n=t[Zr];if(!n)return;let o=this.getRequiredDependencies(Jp)[Zr];if(!Gp.default.satisfies(n,o))throw new Error(`Version mismatch: ${Jp} requires ${Zr} v${o} but found v${n}`)}checkReactAndDataTypes(t){let n=t[Zr],r=t[Gl];if(!(!n||!r)&&!Gp.default.eq(n,r))throw new Error(`Version mismatch: ${Gl} and ${Zr} must be on the same version. Found ${Gl}@${r} and ${Zr}@${n}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var aD=require("fs-extra");Te();var lD=require("@dotenvx/dotenvx"),eo=w(require("semver"));_();var oD=require("child_process"),iD=require("util"),i0=(0,iD.promisify)(oD.exec);async function fr(e,t){try{let{stdout:n,stderr:r}=await i0(e,t);return{stdout:n.toString().trim(),stderr:r.toString().trim(),code:0}}catch(n){let r=n;return{stdout:r.stdout??"",stderr:r.stderr??String(r.message??""),code:r.code??1}}}we();var qp=w(Wl());M();pe();(0,lD.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var sD={npm:{updateCommand:"npm install",update:async e=>await fr(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await fr(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await fr(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await fr(`pnpm outdated --json ${e}`);return JSON.parse(t)},lockFile:"pnpm-lock.yaml",globalFlag:"--global",supported:!0},yarn:{lockFile:"yarn.lock",globalFlag:"",updateCommand:"",getOutdated:async()=>({}),update:async()=>({stdout:"",stderr:"",code:0}),supported:!1}},s0=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],zs=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(sD))if((0,aD.existsSync)(t.lockFile))return t;return sD.npm}async listOutdatedPackages(t="local",n=s0){let{getOutdated:r,globalFlag:o}=this.packageManager,i=await r(`${t==="global"?o:""} ${n?.join(" ")}`);return Object.fromEntries(Object.entries(i).map(([s,a])=>Array.isArray(a)?[s,{current:a[0].current,latest:a[0].latest,installationType:t}]:[s,{current:a.current,latest:a.latest,installationType:t}]))}async getOutdatedPackages(){let t=await this.listOutdatedPackages();if(t["@webflow/webflow-cli"])return t;let n=await this.listOutdatedPackages("global",["@webflow/webflow-cli"]);return{...t,...n}}async showUpdatePrompt(t){let n={name:"Update all packages",value:"update-all"},r=Object.entries(t).map(([i,{current:s,latest:a}])=>({name:`${i} (${s} ${at} ${a})`,value:i})),o=await En({message:`New versions of the following ${Ne("@webflow")} packages are available. Would you like to update them?`,choices:[n,...r]});return o==null?[]:o.includes("update-all")?Object.keys(t):o}showUpdateSuggestions(t){let{updateCommand:n,globalFlag:r}=this.packageManager;u.info(`${je} New versions of the following ${Ne("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(R(` ${Hl} ${s} (${a} ${at} ${l})`))});let o=Object.entries(t).filter(([,{installationType:s}])=>s==="local").map(([s])=>`${s}@latest`),i=Object.entries(t).filter(([,{installationType:s}])=>s==="global").map(([s])=>`${s}@latest`);u.info(`
35
+ ${at} To update, run:`),o.length>0&&u.info(K(` ${n} ${o.join(" ")}`)),i.length>0&&u.info(K(` ${n} ${r} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=eo.prerelease(qp.default.version);return t&&t.length>0&&typeof t[0]=="string"?t[0]:"latest"}async promptPrerelease(t){let n;try{n=u.spinner("Checking for updates (to disable, use --skip-update-check)");let{stdout:r,code:o}=await fr(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!r.trim()){n.succeed("Up to date");return}let i=r.trim(),s=qp.default.version;if(!eo.valid(i)||!eo.valid(s)){n.succeed("Up to date");return}if(!eo.gt(i,s)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){u.info(`${je} A new version of @webflow/webflow-cli@${t} is available.`);let{code:p}=await fr("npm ls @webflow/webflow-cli --json"),h=(p===0?"local":"global")==="global"?" --global":"";u.info(`${at} To update, run: `+K(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`)+`
36
+ `);return}let{code:l}=await fr("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await Re({message:`A new version of @webflow/webflow-cli@${t} is available.
37
+ Would you like to update it?`,default:!1})){n=u.spinner("Updating");let p=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${p} @webflow/webflow-cli@${t}`),n.succeed("Updated successfully")}catch{let h=c==="global"?` ${this.packageManager.globalFlag}`:"";n.fail("Update failed. Manually run: "+K(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}async prompt(){if(this.shouldSkipUpdateChecks())return;let t=this.getDistTag();if(t!=="latest")return this.promptPrerelease(t);let n;try{n=u.spinner("Checking for updates (to disable, use --skip-update-check)");let r=await this.getOutdatedPackages();if(!(Object.keys(r).length>0)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){this.showUpdateSuggestions(r);return}let s=await this.showUpdatePrompt(r);if(s.length>0){n=u.spinner("Updating");let{local:a,global:l}=s.reduce((m,h)=>(m[r[h].installationType==="global"?"global":"local"].push(h),m),{local:[],global:[]}),{update:c,globalFlag:d,updateCommand:p}=this.packageManager;try{a.length>0&&await c(`${a.map(m=>`${m}@latest`).join(" ")}`),l.length>0&&await c(`${d} ${l.map(m=>`${m}@latest`).join(" ")}`),n.succeed("Updated successfully")}catch{n.fail("Update failed. Manually run: "+K(`${p} ${s.map(h=>`${h}@latest`).join(" ")}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}};we();Wn();Bp();Np();Te();X();q();we();We();_();C();M();pe();var CD=e=>{let t=e.command("auth").description("Authentication and configuration commands");t.command("login").description("Authenticate with Webflow and save credentials to .env file").option("-f, --force","Force reauthentication even if credentials exist").action(async n=>{if(V()){u.info(`${k} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:r}=ne();if(!n.force&&At()){let i=no(r);u.info(`${$} Webflow credentials already exist:`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
38
+ Use --force flag to reauthenticate anyway`);return}try{let o=await T({force:n.force});Hn({apiToken:o}),u.info(`
39
+ You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new f(o,{prefix:`${k} Authentication failed:`})}}),t.command("status").description("Show current authentication status").action(async()=>{let n=Ys(),r=n?.accessToken??At();if(!r){u.info(`${k} Not logged in. Run ${K("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let o=await of(r);if(!o){u.info(`${k} Token is invalid or expired. Run ${K("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}u.info(`${$} Logged in as ${o.firstName} ${o.lastName} (${o.email})`),n?.scopes?.length&&u.info(` Scopes: ${n.scopes.join(", ")}`),u.info(` Session: ${gr()}`)}catch(o){throw new f(o,{prefix:`${k} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove stored credentials").action(async()=>{Qp(),u.info(`${$} Logged out. Session file removed.`),u.info(`${at} Run ${K("webflow auth login")} to authenticate again.`)}),t.command("telemetry").description("Manage telemetry settings for all Webflow CLI commands").option("--enable","Enable telemetry for all commands").option("--disable","Disable telemetry for all commands").option("--status","Show current telemetry status").action(async n=>{let r=pr.getInstance();if(n.status){let s=await r.getTelemetryStatus();u.info(xD(s.enabled));return}if(n.enable){await r.setGlobalPreference(!0),u.info(sf(!0));return}if(n.disable){await r.setGlobalPreference(!1),u.info(sf(!1));return}let o=await r.getTelemetryStatus();if(u.info(xD(o.enabled)),V()){u.info("\u{1F4A1} When --no-input mode is enabled please provide --enable or --disable option");return}let i=await Me({message:"What would you like to do?",choices:[{name:"Enable telemetry for all commands",value:"enable"},{name:"Disable telemetry for all commands",value:"disable"},{name:"Cancel",value:"cancel"}]});if(i==="enable"||i==="disable"){let s=i==="enable";await r.setGlobalPreference(s),u.info(sf(s))}})},sf=e=>`${$} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,xD=e=>`${je} Telemetry status: ${e?`enabled ${$}`:`disabled ${k}`}`;var JD=w(require("http")),KD=w(require("node-fetch")),zD=w(require("serve-handler")),qD=require("fs"),XD=w(require("path")),YD=require("commander");var _D=w(require("archiver")),lf=require("commander"),Ql=require("fs");var FD=require("cosmiconfig"),af=require("commander"),Yl=async(e,t)=>{let n=await f0(t),r=n.config.apiVersion;return r&&typeof r!="string"&&af.program.error('Error: The apiVersion field in webflow.json must be a string (i.e. "apiVersion": "2").'),{filepath:n.filepath,config:{publicDir:e,...n.config}}},f0=async e=>{let n=await(0,FD.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return n||af.program.error(`No ${e} file was found. Run this command within your extension folder.`),n};var AD=w(require("mime-types")),Zl=w(require("path")),m0=5*1024*1024,g0=new Set(["application/javascript","application/json","application/xml","image/png","image/jpeg","image/gif","image/svg+xml","image/webp","image/vnd.microsoft.icon","image/x-icon","video/webm","font/ttf","font/otf","font/woff","font/woff2","text/plain","text/markdown","text/html","text/css"]),ID=async(e,t,n)=>{let{config:r,filepath:o}=await Yl(e,t),i=Zl.join(o,".."),s=!0,a=!1,l=d=>{let p=d.name,m=AD.default.lookup(p);return p==="index.html"&&(a=!0),p&&p.endsWith(".DS_Store")||!m?!1:g0.has(m)?d:(console.log(`Invalid file type: ${m} for file: ${p}`),s=!1,!1)},c=d=>{(0,Ql.unlink)(n,p=>{p&&console.error(`Failed to delete file: ${p}`),lf.program.error(d)})};return console.log(`Packaging the contents of the ${r.publicDir} folder into ${n}...`),new Promise(d=>{let p=(0,_D.default)("zip",{zlib:{level:9}}),m=(0,Ql.createWriteStream)(Zl.join(i,n));m.on("close",()=>{d(void 0)}),p.directory(Zl.join(i,r.publicDir),!1,l),p.file(o,{name:t}),p.pipe(m),p.finalize(),p.on("warning",h=>{console.log(h)}),p.on("error",h=>{lf.program.error(h.message)}),p.on("finish",()=>{if(!a){c("Could not find index.html in your `publicDir`, all Designer Extension code needs to be inside of `publicDir`");return}if(!s){c("Bundling failed due to invalid file types");return}if(!p.pointer()||p.pointer()===0){c("Bundling failed with no output");return}if(p.pointer()>=m0){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${p.pointer()} total bytes written`),console.log(`Done! ${n} is ready for you to upload to your Webflow app.`)})})};var Qs=w(require("path")),vn=w(require("fs/promises")),nc=w(require("fs")),TD=require("url"),UM=require("dotenv/config"),PD=["js","cjs","json"],df=process.cwd(),$D=".webflowrc",Gn=Qs.extname(nc.readdirSync(df).find(e=>e.includes($D))??"").replace(/\./g,""),Vn=Qs.join(df,`${$D}${Gn&&`.${Gn}`}`),OD=nc.existsSync(Vn),cf=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${PD.join(", ")}`)}},ec=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${Gn}. The supported extensions are: ${PD.join(", ")}`)}},tc=class extends Error{constructor(t){let n=t.includes(".webflowrc"),r=t.includes("webflow.json"),o;n?o=`It seems like you don't have a .webflowrc file in your project (${t}). Make sure there is a .webflowrc file in your project root.`:r?o=`It seems like you don't have a webflow.json file in your project (${t}). Make sure there is a webflow.json file in your project root.`:o=`It seems like you don't have a config file in your project (${t}). Make sure there is a config file in your project root.`,super(o)}},uf=class extends Error{constructor(t){super(`The following required fields are missing or undefined in your .webflowrc file: ${t}. If you're using process.env variables, make sure they're set up correctly.`)}};async function h0(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,TD.pathToFileURL)(e).href:e)).default}function RD(e,t){let n=t.filter(r=>!e[r]);if(n.length)throw new uf(n.join(", "))}async function yi(e=[],t=!1){if(!OD){if(t)return{};throw new tc(Vn)}if(!Gn)throw new cf;switch(Gn){case"js":case"cjs":{await vn.access(Vn);let n=await h0(Vn);return RD(n,e),n}case"json":{let n=JSON.parse(await vn.readFile(Vn,"utf8"));return RD(n,e),n}default:throw new ec}}function y0(e,t){if(Gn==="js"||Gn==="cjs"){let r=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(r)return r[1]}}function w0(e,t,n){let r=y0(t,n);if(r){let o=new RegExp(`${n}: ".*?",`,"g");return e.replace(o,`${n}: process.env.${r},`)}return e}async function D0(e){let t=["authToken","host","siteId"],n=await vn.readFile(Vn,"utf-8");for(let r of t)e=w0(e,n,r);return e}async function b0(){try{let e=Qs.join(df,"package.json");return await vn.access(e),JSON.parse(await vn.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function LD(e){if(!OD)throw new tc(Vn);let t=JSON.stringify(e,null,2);switch(Gn){case"js":case"cjs":{let n=await D0(t.replace(/"([^"]+)":/g,"$1:")),r=await b0()&&Gn==="js"?"export default ":"module.exports = ";return vn.writeFile(Vn,r+n)}case"json":return vn.writeFile(Vn,t);default:throw new ec}}var wr=w(require("fs")),Wt=w(require("path"));var ea="webflow.json",ND="index.html",jD="bundle.zip",pf="public",ff="extension-scaffolds",rc="default";var MD="package.json",BD="wf-placeholder-name",mf=e=>JSON.stringify(e,null,2),UD=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
40
40
  \u2502 `+e+` \u2502
41
- \u2570`+t+"\u256F"};var Iw=async(e,t="./",r=El,n)=>{let o=n[r];try{for(let i of o){let s=Mt.join(t,i),a=vF(s,r,e);if(i.includes(Aw)||i.includes(xs))await EF(i,a,e);else{let l=await nn.promises.readFile(i);await $w(a,l)}}}catch(i){console.error("Error writing file, ",i)}},Ow=async()=>{let e={},t=Mt.resolve(__dirname),r=Mt.join(t,wp),n=await nn.promises.readdir(r);for(let o of n){let i=Mt.join(r,o),s=await Pw(i);e[o]=s}return e},Pw=async e=>{let t=[];try{let r=await nn.promises.readdir(e);for(let n of r){let o=Mt.join(e,n);if((await nn.promises.stat(o)).isDirectory()){let s=await Pw(o);t.push(...s)}else t.push(o)}}catch(r){console.error(`Error reading ${Mt}, `,r)}return t},$w=async(e,t)=>{try{await nn.promises.mkdir(Mt.dirname(e),{recursive:!0}),await nn.promises.writeFile(e,t)}catch(r){console.error("Error writing file ",r)}},EF=async(e,t,r)=>nn.promises.readFile(e,"utf8").then(async n=>{let o=n.replace(Tw,r);await $w(t,o)}),vF=(e,t,r)=>{let n=Mt.join(wp,t),o=e.indexOf(n);if(o!==-1){let i=e.substring(o+n.length+1);return Mt.join(r,i)}return""};var vl=async()=>await Ow(),Ww=async()=>{let e=await vl(),t=Object.keys(e).join(", ");console.log(`Your available templates are: ${t}`),console.log('\u{1F4A1} Syntax: "webflow extension init projectName templateName"'),console.log('\u{1F31F} Example: "webflow extension init my-first-extension react"')},Hw=async(e,t=El)=>{let r=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let n=await vl();await Iw(e,r,t,n),console.log(`Done! Check out ${r}/README.md for steps on how to develop your extension.`)},Vw=()=>kw(yp,xs,Fw),Gw=async e=>{let{config:t,filepath:r}=await hl(yp,xs),n=Bw.join(r,"..",t.publicDir,_w),i=(await Ko([],!0)).extensionTemplateDomain||"webflow-ext.com",s=t.apiVersion==="2"?"template/v2":"template",a=Object.keys(t.featureFlags||{}).map(g=>t.featureFlags?.[g]===!0?`ff_on=${g}`:`ff_off=${g}`).join("&"),l=a?`&${a}`:"",d=await(await(0,Nw.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),p=new Lw.Server((g,m)=>{if(g.url==="/"){Mw.promises.readFile(n,{encoding:"utf-8"}).catch(w=>{Uw.program.error(w.message)}).then(w=>{let k=d.replace("{{ui}}",w);return m.writeHead(200,{"Content-Length":Buffer.byteLength(k),"Content-Type":"text/html"}),m.end(k)});return}if(g.url==="/__webflow")return m.writeHead(200,{"Content-Length":Buffer.byteLength(Dp(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),m.end(Dp(t));(0,jw.default)(g,m,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),h=SF(e);p.listen(h),console.log(Rw(`Serving your extension at http://localhost:${h}`)+`
42
- `)},SF=e=>{if(e){let t=parseInt(e,10);return isNaN(t)?(console.log("Invalid port number provided. Using the default port "+1337),1337):t}return 1337};Ae();S();var Kw=e=>{let t=e.command("extension").description("CLI for developing Designer Extensions.");t.command("list").description("Get list of project templates that can be used for `init`").action(Ww),t.command("init").description("Bootstrap a Designer Extension.").argument("[projectName]","What is your Designer Extension's name?").argument("[scaffoldName]","Which project template do you want to use?").action(async(r,n)=>{let o=await vl(),i=Object.keys(o),s=await Je({message:"What would you like to name your Designer Extension?",default:r,validate:l=>l.trim()===""?"The Designer Extension name cannot be empty.":!0});if(s===null)throw new f("When --no-input mode is enabled please provide the [projectName] argument.");let a=await Be({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:n||"default"});await Hw(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(Vw),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(Gw)};var xp=D(require("process"));x();ye();Me();var Jw=D(require("fs"));S();async function xl(e){let{authToken:t,siteId:r}=e||{},{path:n,isUserDefined:o}=In(),i=Jw.existsSync(n),s=!1;try{let{manifest:a}=Z();s=!0,o&&u.info(`Using manifest file: ${n}`);try{let l=ls(a,"devlink");if(!t||!r)throw new Error(`Missing Site ID or API token. Make sure you have WEBFLOW_API_TOKEN and WEBFLOW_SITE_ID set in your environment variables, or pass them as arguments --site and --api-token.
41
+ \u2570`+t+"\u256F"};var WD=async(e,t="./",n=rc,r)=>{let o=r[n];try{for(let i of o){let s=Wt.join(t,i),a=v0(s,n,e);if(i.includes(MD)||i.includes(ea))await E0(i,a,e);else{let l=await wr.promises.readFile(i);await GD(a,l)}}}catch(i){console.error("Error writing file, ",i)}},HD=async()=>{let e={},t=Wt.resolve(__dirname),n=Wt.join(t,ff),r=await wr.promises.readdir(n);for(let o of r){let i=Wt.join(n,o),s=await VD(i);e[o]=s}return e},VD=async e=>{let t=[];try{let n=await wr.promises.readdir(e);for(let r of n){let o=Wt.join(e,r);if((await wr.promises.stat(o)).isDirectory()){let s=await VD(o);t.push(...s)}else t.push(o)}}catch(n){console.error(`Error reading ${Wt}, `,n)}return t},GD=async(e,t)=>{try{await wr.promises.mkdir(Wt.dirname(e),{recursive:!0}),await wr.promises.writeFile(e,t)}catch(n){console.error("Error writing file ",n)}},E0=async(e,t,n)=>wr.promises.readFile(e,"utf8").then(async r=>{let o=r.replace(BD,n);await GD(t,o)}),v0=(e,t,n)=>{let r=Wt.join(ff,t),o=e.indexOf(r);if(o!==-1){let i=e.substring(o+r.length+1);return Wt.join(n,i)}return""};var oc=async()=>await HD(),ZD=async()=>{let e=await oc(),t=Object.keys(e).join(", ");console.log(`Your available templates are: ${t}`),console.log('\u{1F4A1} Syntax: "webflow extension init projectName templateName"'),console.log('\u{1F31F} Example: "webflow extension init my-first-extension react"')},QD=async(e,t=rc)=>{let n=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let r=await oc();await WD(e,n,t,r),console.log(`Done! Check out ${n}/README.md for steps on how to develop your extension.`)},eb=()=>ID(pf,ea,jD),tb=async e=>{let{config:t,filepath:n}=await Yl(pf,ea),r=XD.join(n,"..",t.publicDir,ND),i=(await yi([],!0)).extensionTemplateDomain||"webflow-ext.com",s=t.apiVersion==="2"?"template/v2":"template",a=Object.keys(t.featureFlags||{}).map(h=>t.featureFlags?.[h]===!0?`ff_on=${h}`:`ff_off=${h}`).join("&"),l=a?`&${a}`:"",d=await(await(0,KD.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),p=new JD.Server((h,g)=>{if(h.url==="/"){qD.promises.readFile(r,{encoding:"utf-8"}).catch(y=>{YD.program.error(y.message)}).then(y=>{let b=d.replace("{{ui}}",y);return g.writeHead(200,{"Content-Length":Buffer.byteLength(b),"Content-Type":"text/html"}),g.end(b)});return}if(h.url==="/__webflow")return g.writeHead(200,{"Content-Length":Buffer.byteLength(mf(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),g.end(mf(t));(0,zD.default)(h,g,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=S0(e);p.listen(m),console.log(UD(`Serving your extension at http://localhost:${m}`)+`
42
+ `)},S0=e=>{if(e){let t=parseInt(e,10);return isNaN(t)?(console.log("Invalid port number provided. Using the default port "+1337),1337):t}return 1337};Te();C();var nb=e=>{let t=e.command("extension").description("CLI for developing Designer Extensions.");t.command("list").description("Get list of project templates that can be used for `init`").action(ZD),t.command("init").description("Bootstrap a Designer Extension.").argument("[projectName]","What is your Designer Extension's name?").argument("[scaffoldName]","Which project template do you want to use?").action(async(n,r)=>{let o=await oc(),i=Object.keys(o),s=await Je({message:"What would you like to name your Designer Extension?",default:n,validate:l=>l.trim()===""?"The Designer Extension name cannot be empty.":!0});if(s===null)throw new f("When --no-input mode is enabled please provide the [projectName] argument.");let a=await Me({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:r||"default"});await QD(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(eb),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(tb)};var bf=w(require("process"));_();be();We();var ob=w(require("fs"));C();async function sc(e){let{authToken:t,siteId:n}=e||{},{path:r,isUserDefined:o}=Yr(),i=ob.existsSync(r),s=!1;try{let{manifest:a}=ne();s=!0,o&&u.info(`Using manifest file: ${r}`);try{let l=Ms(a,"devlink");if(!t||!n)throw new Error(`Missing Site ID or API token. Make sure you have WEBFLOW_API_TOKEN and WEBFLOW_SITE_ID set in your environment variables, or pass them as arguments --site and --api-token.
43
43
 
44
44
  To set up your credentials, run:
45
- webflow auth login`);return zw(l?.relativeHrefRoot),{...l,host:I,authToken:t,siteId:r,cssModules:!!l?.cssModules,components:Sl(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new f(l,{prefix:`Failed to read devlink config from manifest file: ${n}
46
- `})}}catch(a){if(o||i||s){let l=o?`The manifest file specified via --manifest flag was not found or is invalid: ${n}
47
- `:`Your manifest file exists but is invalid or missing required properties: ${n}
48
- `;throw new f(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),r||a.push("siteId");let l=await Ko(a);return zw(l?.relativeHrefRoot),{...l,host:l.host||I,cssModules:!!l?.cssModules,components:Sl(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(a){throw a instanceof Error&&a.message.includes(".webflowrc")&&(a.message=`No configuration file found. Please create either:
45
+ webflow auth login`);return rb(l?.relativeHrefRoot),{...l,host:P,authToken:t,siteId:n,cssModules:!!l?.cssModules,components:ic(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new f(l,{prefix:`Failed to read devlink config from manifest file: ${r}
46
+ `})}}catch(a){if(o||i||s){let l=o?`The manifest file specified via --manifest flag was not found or is invalid: ${r}
47
+ `:`Your manifest file exists but is invalid or missing required properties: ${r}
48
+ `;throw new f(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),n||a.push("siteId");let l=await yi(a);return rb(l?.relativeHrefRoot),{...l,host:l.host||P,cssModules:!!l?.cssModules,components:ic(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(a){throw a instanceof Error&&a.message.includes(".webflowrc")&&(a.message=`No configuration file found. Please create either:
49
49
  - webflow.json with a "devlink" section, or
50
50
  - .webflowrc file
51
- in your project root.`),new f(a)}}function zw(e){if(!(e===void 0||e===!1)){if(typeof e=="string"){if(e==="/"||e.startsWith("http://")||e.startsWith("https://"))return;throw new Error(`Invalid relativeHrefRoot value "${e}". Must be false, "/" or an absolute URL starting with http:// or https://`)}throw new Error(`Invalid relativeHrefRoot type. Must be false, "/" or an absolute URL string, got: ${typeof e}`)}}function Sl(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}bp();dt();S();var zo=class extends Error{};function FF(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function AF(e){switch(e.status){case 400:{let t=await e.text(),r=FF(t);throw new zo(r||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new zo("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new zo("`webflow devlink sync` is no longer available. Run `webflow devlink export` instead \u2014 see the migration guide: https://developers.webflow.com/devlink/docs/reference/migrate-from-sync");default:throw new zo(`Something went wrong (HTTP ${e.status}).`)}}async function TF(e){try{let{siteId:t,host:r,authToken:n,...o}=e,i=await G(`${r}/devlink/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify(o),timeout:6e4});return i.ok?await i.json():AF(i)}catch(t){throw new f(t,{skipLogging:!0})}}async function Ep(e){try{let t=await TF(e);if(!t.files||!Array.isArray(t.files))throw new f("Invalid response format from V1 API: expected 'files' array");let r=t.metadata?.exportCoverage==="full";return await _l(t.files,e.rootDir,r),{messages:t.messages}}catch(t){throw t instanceof f?t:new f(t,{skipLogging:!0})}}var jn=D(require("process"));x();Me();dt();var vp=class{config;error;constructor(t,r){this.config=t,this.error=r}stripPII(t=""){return t.replace(/\/(.*)webflow-cli/gi,"/REDACTED_PII/webflow-cli/").replace(/\/(.*)node_modules/gi,"/REDACTED_PII/node_modules")}sendTelemetry(){let t=this.config,r=this.error;G(`${t.host}/devlink/${t.siteId}/telemetry`,{headers:{Authorization:`Bearer ${t.authToken}`,"Content-Type":"application/json"},method:"post",body:JSON.stringify({cause:r.cause,message:r.message,name:r.name,stack:this.stripPII(r.stack),platform:jn.default.platform,node:jn.default.version})})}async storeChoice(t){try{return xe({devlink:{allowTelemetry:t}})}catch{let n=await Ko();await Cw({...n,allowTelemetry:t})}}async prompt(){let t=this.config;u.error(this.error),t.allowTelemetry===!0?this.sendTelemetry():t.allowTelemetry===void 0&&(await this.storeChoice(!0),this.sendTelemetry())}};function Fl(e){return async function(r){jn.default.removeListener("uncaughtException",Fl),jn.default.removeListener("unhandledRejection",Fl);let n=await xl(e);if(!n)return;await new vp(n,r).prompt()}}function qw(e){jn.default.on("uncaughtException",Fl(e)),jn.default.on("unhandledRejection",Fl(e))}z();x();J();Me();Sp();async function Yw(e,t){let r=Date.now(),{manifest:n}=Z(),{accessToken:o,siteId:i}=await Ue(n,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:Sl(e),overwriteModule:!1}:{overwriteModule:!0}};qw(s);let a=await xl(s);if(!a)return xp.default.exit();let l;try{l=_.forDevlinkSync(a)}catch(d){u.debug(`Failed to initialize telemetry: ${d}`)}await l?.sendUsage("devlink_sync_start",{specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot});let c=u.spinner(`Exporting components into ${a.rootDir}`);try{let{messages:d}=await Ep(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),Al(d);let p=Date.now()-r;await l?.sendUsage("devlink_sync_success",{duration:p,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(d){let p=d instanceof Error?d.message:String(d);c.fail(`Failed to export components: ${p}`);let h=Date.now()-r;throw await l?.sendError(d instanceof Error?d:new Error(String(d)),"devlink_sync_failure",{duration:h,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot,configOverrides:Object.keys(s),argv:xp.default.argv.slice(2)}),d}}Ll();var dn=require("commander");var ec=require("path"),ti=require("@webflow/data-types");ye();var Nl=require("fs"),Op=D(require("md5"));function _s(e,t){try{let r=(0,Nl.statSync)(e),n=(0,Nl.readFileSync)(e);return{value:n,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,Op.default)(n),size:r.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function Fs(e,t,r){try{let n=new Blob([e]).size,o=Buffer.from(e,"utf-8");return{value:o,meta:{title:t.replace(/^.*[\\\/]/,""),fileHash:(0,Op.default)(o),size:n,...r}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var yD=D(require("node-fetch")),wD=D(require("form-data"));async function As(e,t){let r={...t.fields,file:e.value},n=new wD.default;Object.entries(r).forEach(([i,s])=>{n.append(i,s)});let o=await(0,yD.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:n});MF(o)}function MF(e){switch(e.status){case 200:case 201:return;case 403:throw new Error("Unauthorized. Please check your AWS access key");default:throw new Error(`Something went wrong when uploading the file: ${e.statusText}`)}}x();Me();z();ye();dt();de();function BF({apiToken:e=process.env.WEBFLOW_API_TOKEN??process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN,siteId:t=process.env.WEBFLOW_SITE_ID,libraryTarget:r=process.env.WEBFLOW_LIBRARY_TARGET}){if(!e)throw new Error("No API token provided");if(r==="site"){if(!t)throw new Error("No site provided");return{baseUrl:`${I}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${I}/v2/workspaces`,authToken:e}}function UF(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function WF(e){if(e.ok)return;if(e.status===401||e.status===403)throw new Error(`Your API token is invalid or not authorized to perform this action. Run ${V("webflow auth login --force")} to generate a new token.`);if(e.status===404)throw new Error("Code components are rolling out in phases. Check back soon for access.");let t=await e.json();throw new Error(t.message||e.statusText)}async function sn({endpoint:e,method:t="GET",body:r,options:n}){let{baseUrl:o,authToken:i}=BF(n),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await G(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:UF(r)});return await WF(a),a.json()}async function Pp({options:e}){return(await sn({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function $p({name:e,description:t,slug:r,options:n}){return(await sn({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:r},options:n})).payload}async function Lp({resourceId:e,files:t,options:r}){return(await sn({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:r})).payload}async function Np({resourceId:e,codeModule:t,components:r,options:n}){return(await sn({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:r},options:n})).payload}var ck=require("path"),uk=D(require("webpack-merge")),Bn=require("@webflow/data-types");ye();x();var bD=require("memfs/lib/volume"),Ts=require("@webflow/data-types");var gr="./tmp_entry",DD="components";function jl(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+|[^\p{L}\p{N}]/gu," ").toLowerCase().replace(new RegExp("(?:^|\\s)(\\p{L})","gu"),(t,r)=>r.toUpperCase()).replace(/\s+/g,"")}function HF(e){let t=jl(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function kD(e,t){let r=e.map(({name:l,path:c,isDefaultExport:d})=>d?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
52
- `),n=e.filter(l=>l.type==="internal").map(({name:l,exportKey:c})=>`${c}: ${l}`).join(", "),o=e.filter(l=>l.type==="component").map(({name:l,exportKey:c})=>`"${c}": ${l}`).join(", "),i=`env: "${t}"`,s=n,a=o?`components: { ${o} }`:void 0;return`${r}
51
+ in your project root.`),new f(a)}}function rb(e){if(!(e===void 0||e===!1)){if(typeof e=="string"){if(e==="/"||e.startsWith("http://")||e.startsWith("https://"))return;throw new Error(`Invalid relativeHrefRoot value "${e}". Must be false, "/" or an absolute URL starting with http:// or https://`)}throw new Error(`Invalid relativeHrefRoot type. Must be false, "/" or an absolute URL string, got: ${typeof e}`)}}function ic(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}hf();lt();C();var wi=class extends Error{};function _0(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function A0(e){switch(e.status){case 400:{let t=await e.text(),n=_0(t);throw new wi(n||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new wi("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new wi("`webflow devlink sync` is no longer available. Run `webflow devlink export` instead \u2014 see the migration guide: https://developers.webflow.com/devlink/docs/reference/migrate-from-sync");default:throw new wi(`Something went wrong (HTTP ${e.status}).`)}}async function I0(e){try{let{siteId:t,host:n,authToken:r,...o}=e,i=await J(`${n}/devlink/${t}`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(o),timeout:6e4});return i.ok?await i.json():A0(i)}catch(t){throw new f(t,{skipLogging:!0})}}async function yf(e){try{let t=await I0(e);if(!t.files||!Array.isArray(t.files))throw new f("Invalid response format from V1 API: expected 'files' array");let n=t.metadata?.exportCoverage==="full";return await lc(t.files,e.rootDir,n),{messages:t.messages}}catch(t){throw t instanceof f?t:new f(t,{skipLogging:!0})}}var oo=w(require("process"));_();We();lt();var wf=class{config;error;constructor(t,n){this.config=t,this.error=n}stripPII(t=""){return t.replace(/\/(.*)webflow-cli/gi,"/REDACTED_PII/webflow-cli/").replace(/\/(.*)node_modules/gi,"/REDACTED_PII/node_modules")}sendTelemetry(){let t=this.config,n=this.error;J(`${t.host}/devlink/${t.siteId}/telemetry`,{headers:{Authorization:`Bearer ${t.authToken}`,"Content-Type":"application/json"},method:"post",body:JSON.stringify({cause:n.cause,message:n.message,name:n.name,stack:this.stripPII(n.stack),platform:oo.default.platform,node:oo.default.version})})}async storeChoice(t){try{return Se({devlink:{allowTelemetry:t}})}catch{let r=await yi();await LD({...r,allowTelemetry:t})}}async prompt(){let t=this.config;u.error(this.error),t.allowTelemetry===!0?this.sendTelemetry():t.allowTelemetry===void 0&&(await this.storeChoice(!0),this.sendTelemetry())}};function cc(e){return async function(n){oo.default.removeListener("uncaughtException",cc),oo.default.removeListener("unhandledRejection",cc);let r=await sc(e);if(!r)return;await new wf(r,n).prompt()}}function ib(e){oo.default.on("uncaughtException",cc(e)),oo.default.on("unhandledRejection",cc(e))}X();_();q();We();Df();async function sb(e,t){let n=Date.now(),{manifest:r}=ne(),{accessToken:o,siteId:i}=await Ke(r,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:ic(e),overwriteModule:!1}:{overwriteModule:!0}};ib(s);let a=await sc(s);if(!a)return bf.default.exit();let l;try{l=F.forDevlinkSync(a)}catch(d){u.debug(`Failed to initialize telemetry: ${d}`)}await l?.sendUsage("devlink_sync_start",{specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot});let c=u.spinner(`Exporting components into ${a.rootDir}`);try{let{messages:d}=await yf(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),uc(d);let p=Date.now()-n;await l?.sendUsage("devlink_sync_success",{duration:p,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(d){let p=d instanceof Error?d.message:String(d);c.fail(`Failed to export components: ${p}`);let m=Date.now()-n;throw await l?.sendError(d instanceof Error?d:new Error(String(d)),"devlink_sync_failure",{duration:m,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot,configOverrides:Object.keys(s),argv:bf.default.argv.slice(2)}),d}}yc();var xr=require("commander");var Oc=require("path"),Ci=require("@webflow/data-types");be();var wc=require("fs"),_f=w(require("md5"));function na(e,t){try{let n=(0,wc.statSync)(e),r=(0,wc.readFileSync)(e);return{value:r,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,_f.default)(r),size:n.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function ra(e,t,n){try{let r=new Blob([e]).size,o=Buffer.from(e,"utf-8");return{value:o,meta:{title:t.replace(/^.*[\\\/]/,""),fileHash:(0,_f.default)(o),size:r,...n}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var Fb=w(require("node-fetch")),_b=w(require("form-data"));async function oa(e,t){let n={...t.fields,file:e.value},r=new _b.default;Object.entries(n).forEach(([i,s])=>{r.append(i,s)});let o=await(0,Fb.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:r});M0(o)}function M0(e){switch(e.status){case 200:case 201:return;case 403:throw new Error("Unauthorized. Please check your AWS access key");default:throw new Error(`Something went wrong when uploading the file: ${e.statusText}`)}}_();We();X();be();lt();pe();function B0({apiToken:e=process.env.WEBFLOW_API_TOKEN??process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN,siteId:t=process.env.WEBFLOW_SITE_ID,libraryTarget:n=process.env.WEBFLOW_LIBRARY_TARGET}){if(!e)throw new Error("No API token provided");if(n==="site"){if(!t)throw new Error("No site provided");return{baseUrl:`${P}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${P}/v2/workspaces`,authToken:e}}function U0(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function W0(e){if(e.ok)return;if(e.status===401||e.status===403)throw new Error(`Your API token is invalid or not authorized to perform this action. Run ${K("webflow auth login --force")} to generate a new token.`);if(e.status===404)throw new Error("Code components are rolling out in phases. Check back soon for access.");let t=await e.json();throw new Error(t.message||e.statusText)}async function br({endpoint:e,method:t="GET",body:n,options:r}){let{baseUrl:o,authToken:i}=B0(r),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await J(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:U0(n)});return await W0(a),a.json()}async function Af({options:e}){return(await br({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function If({name:e,description:t,slug:n,options:r}){return(await br({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:n},options:r})).payload}async function Rf({resourceId:e,files:t,options:n}){return(await br({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:n})).payload}async function Tf({resourceId:e,codeModule:t,components:n,options:r}){return(await br({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:n},options:r})).payload}var Dk=require("path"),bk=w(require("webpack-merge")),so=require("@webflow/data-types");be();_();var Rb=require("memfs/lib/volume"),ia=require("@webflow/data-types");var Sn="./tmp_entry",Ab="components";function Dc(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+|[^\p{L}\p{N}]/gu," ").toLowerCase().replace(new RegExp("(?:^|\\s)(\\p{L})","gu"),(t,n)=>n.toUpperCase()).replace(/\s+/g,"")}function H0(e){let t=Dc(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function Ib(e,t){let n=e.map(({name:l,path:c,isDefaultExport:d})=>d?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
52
+ `),r=e.filter(l=>l.type==="internal").map(({name:l,exportKey:c})=>`${c}: ${l}`).join(", "),o=e.filter(l=>l.type==="component").map(({name:l,exportKey:c})=>`"${c}": ${l}`).join(", "),i=`env: "${t}"`,s=r,a=o?`components: { ${o} }`:void 0;return`${n}
53
53
 
54
- export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function ED(e,t,r){let n={},o=`${gr}/Client.js`,i=`${gr}/Server.js`;n[o]=kD([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],Ts.Environment.Client);let s={},a=c=>{let d=HF(c);return s[d]?(s[d]+=1,`${d}${s[d]}`):(s[d]=1,d)};n[i]=kD([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([c])=>r[c]?.ssr??!0).map(([c,d])=>{let p=a(c),h=d.startsWith(gr)?d.replace(`${gr}/`,"./"):d;return{name:p,path:h,exportKey:c,isDefaultExport:!0,type:"component"}})],Ts.Environment.Server);let l={[Ts.Environment.Client]:o,[Ts.Environment.Server]:i};return{entryPointsVolume:bD.Volume.fromJSON(n),paths:l}}var dk=require("memfs/lib/volume");var _D=D(require("archiver")),Jo=require("path");ye();var Rs=require("@webflow/data-types");ye();x();var an=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var vD=2;function SD(e){let t={type:Rs.ModuleLoader.FEDERATION,version:vD,entry:Ud,renderer:ps,components:e};return{title:ds,content:JSON.stringify(t)}}function xD(e){let t={type:Rs.ModuleLoader.SSR,version:vD,entry:Wo,components:e};return{title:ds,content:JSON.stringify(t)}}function CD(e){let t=`/${Rs.Environment.Client}/${Ud}`;try{if(e.existsSync(t)){let r=e.readFileSync(t,"utf8"),n=JSON.parse(r.toString()),o="publicPath"in n.metaData?n.metaData.publicPath:null;if(!o)throw new Error("Public path not found in module federation manifest");return n.exposes.reduce((i,s)=>{let a=s.name;return a===ps||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${an(o)}${l}`)})),i},{})}}catch(r){u.error(r,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var Ml=require("@webflow/data-types"),VF=/\.css$/i;async function FD(e,t,r){let n=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${Ml.Environment.Server}/${fs}`,a=(0,_D.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",p=>(n=!0,i(p))),l.on("close",()=>{if(!n)try{let p={type:"asset",name:fs,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(h=>{let g=(0,Jo.resolve)((0,Jo.join)(`/${Ml.Environment.Server}`,h.name));t.existsSync(g)&&t.rmSync(g)}),o([p])}catch(p){return i(p)}finally{n=!0}}),a.pipe(l);let{title:c,content:d}=xD(r);a.append(d,{name:c}),e.forEach(p=>{if(!VF.test(p.name))try{let h=(0,Jo.resolve)((0,Jo.join)(`/${Ml.Environment.Server}`,p.name)),g=t.readFileSync(h,"utf8");a.append(g,{name:p.name})}catch(h){return n=!0,i(h)}}),await a.finalize()})}var AD=require("@webflow/data-types");async function TD(e,t,r){let{title:n,content:o}=SD(r);await t.promises.writeFile(`/${AD.Environment.Client}/${n}`,o);let i={type:"asset",name:n,info:{},size:o.length,emitted:!0,comparedForEmit:!1,cached:!1};return e.filter(s=>s.name!=="mf-stats.json").concat([i])}var rk=require("@rspack/core"),nk=D(require("fork-ts-checker-webpack-plugin")),ok=require("ts-checker-rspack-plugin"),ik=D(require("mini-css-extract-plugin")),sk=require("@webflow/data-types");var ID=require("webpack"),Mp=D(require("mini-css-extract-plugin")),OD=D(require("tsconfig-paths-webpack-plugin")),PD=require("tsconfig-paths"),Bp=require("@webflow/data-types"),$D=require("path");ye();var RD=D(require("postcss-selector-parser")),jp=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,RD.default)(r=>{r.walkPseudos(n=>{n.value===":root"&&(n.value=":host")})}).processSync(t.selector)})}});jp.postcss=!0;jp.postcssPlugin="CSSinShadowDOM";var Bl=jp;function GF(){return(0,PD.loadConfig)(process.cwd()).resultType==="success"}function LD({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i}){let s={mode:r,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Mp.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[Bl]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Mp.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[GF()?new OD.default:null].filter(Boolean)},performance:{hints:!1}};if(t===Bp.Environment.Client)return{...s,entry:()=>({}),output:{path:i?(0,$D.join)(process.cwd(),i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===Bp.Environment.Server)return{...s,plugins:[...s.plugins||[],new ID.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Wo,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var ND=require("@module-federation/enhanced"),Up=require("@webflow/data-types");function jD({libraryName:e,env:t,exposes:r}){if(t===Up.Environment.Client)return{plugins:[new ND.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Up.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function MD(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,use:[{ident:"babel-loader",loader:require.resolve("babel-loader"),options:{presets:[require.resolve("@babel/preset-env"),[require.resolve("@babel/preset-react"),{runtime:"automatic"}],require.resolve("@babel/preset-typescript")]}}]}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}function Ul(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,loader:"builtin:swc-loader",options:{jsc:{parser:{syntax:"typescript",tsx:!0},transform:{react:{runtime:"automatic",development:!1,refresh:!1}}}}}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}var Wl=require("@rspack/core"),BD=require("tsconfig-paths"),Wp=require("@webflow/data-types"),UD=require("path");ye();function KF(){let e=(0,BD.loadConfig)(process.cwd());if(e.resultType==="success")return e.configFileAbsolutePath}function WD({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i}){let s={mode:r,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Wl.rspack.CssExtractRspackPlugin.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[Bl]}}}],type:"javascript/auto"},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Wl.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let a=KF();return a?{tsConfig:{configFile:a}}:{}})(),performance:{hints:!1}};if(t===Wp.Environment.Client)return{...s,entry:()=>({}),output:{path:i?(0,UD.join)(process.cwd(),i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===Wp.Environment.Server)return{...s,plugins:[...Array.isArray(s.plugins)?s.plugins:[],new Wl.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Wo,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var HD=require("@module-federation/enhanced/rspack"),Hp=require("@webflow/data-types");function VD({libraryName:e,env:t,exposes:r}){if(t===Hp.Environment.Client)return{plugins:[new HD.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Hp.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var JF=D(require("fs")),GD=require("unionfs"),KD=require("webpack");function zF(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function Hl(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:r=>e.toString(r),toJson:()=>({...t,assets:(t.assets??[]).map(zF)})}}async function zD({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new GD.Union().use(JF));return new Promise((s,a)=>{let l=(0,KD.webpack)(e);l.inputFileSystem=i,r&&(l.outputFileSystem=r),n&&(l.outputPath=n),l.run((c,d)=>{l.close(p=>{c||p?a(c||p):d?d.hasErrors()||o&&d.hasWarnings()?a(new Error(d.toString("errors-warnings"))):s(Hl(d)):a(new Error("Webpack stats are undefined"))})})})}var qF=D(require("fs")),Vp=D(require("webpack-merge")),JD=require("memfs"),qD=require("unionfs"),YD=require("@rspack/core");async function Vl({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new qD.Union().use(qF)),s=e;return t.length>0&&(s=(0,Vp.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),r&&(s=(0,Vp.default)(s,{output:{clean:!1,...n&&{path:n}}})),new Promise((a,l)=>{let c=(0,YD.rspack)(s);c.inputFileSystem=i,r&&(c.outputFileSystem=(0,JD.createFsFromVolume)(r)),n&&(c.outputPath=n),c.run((d,p)=>{c.close(h=>{d||h?l(d||h):p?p.hasErrors()||o&&p.hasWarnings()?l(new Error(p.toString("errors-warnings"))):a(Hl(p)):l(new Error("Rspack stats are undefined"))})})})}var ZD=require("@module-federation/enhanced");var qo=D(require("webpack-merge"));x();function ln(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function XD(e,t){let r=Object.entries(e).filter(([n])=>!t.includes(n));return Object.fromEntries(r)}function YF(e,t){return e instanceof t||ln(e)==="ModuleFederationPlugin"}function Kl(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:r,getPluginOptions:n,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],d=XF(s),p=Array.isArray(l)?Gl(...l.map(d)):Gl(d(l));Object.keys(p).some(B=>c.includes(B))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let g={...XD(p,[...c,"ModuleFederationPlugin","module","plugins"]),module:XD(p.module??{},["rules"])},m=(0,qo.default)(a,g),w=p.plugins??[];o&&(w=w.filter(o));let k=a.plugins??[],A=(0,qo.mergeWithCustomize)({customizeArray:(0,qo.unique)("plugins",t,B=>ln(B))})({plugins:w},{plugins:k}).plugins,E=p?.ModuleFederationPlugin?.shared,v=A?.map(B=>{if(YF(B,r)){let U=n(B);return new r({...U,...E?{shared:E}:{}})}return B});m.plugins=v;let M=p.module?.rules;if(M&&typeof M=="function"){let B=a.module?.rules??[];m.module={...m.module??{},rules:M(B)}}return m}}function Gl(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={};for(let r of e){let{module:n,ModuleFederationPlugin:o,plugins:i,...s}=r;if(t={...t,...s},n){let{rules:a,...l}=n;if(t.module={...t.module,...l},a){let c=t.module?.rules;c?t.module.rules=d=>{let p=c(d);return a(p)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function XF(e){return t=>typeof t=="function"?t(e):t}var ZF=Kl({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:ZD.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function QD(e,t,r){return ZF(e,t,r)}var ek=require("@module-federation/enhanced/rspack");var QF=Kl({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:ek.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>ln(e)!=="MiniCssExtractPlugin"});function tk(e,t,r){return QF(e,t,r)}var Gp={[sk.Framework.React]:{generateWebpackBundlerConfig:MD,generateRspackBundlerConfig:Ul}},eA={webpack:{generateBaseConfig:LD,getFrameworkConfig:(e,t)=>Gp[e].generateWebpackBundlerConfig(t),generateFederationConfig:jD,mergeConfigs:(e,t,r)=>QD(e,t,r),bundle:e=>zD({...e,config:e.config}),typeCheckerPlugin:nk.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>ln(t)==="MiniCssExtractPlugin"?new ik.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:WD,getFrameworkConfig:(e,t)=>Gp[e].generateRspackBundlerConfig(t),generateFederationConfig:VD,mergeConfigs:(e,t,r)=>tk(e,t,r),bundle:e=>Vl({...e,config:e.config}),typeCheckerPlugin:ok.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>ln(t)==="CssExtractRspackPlugin"?new rk.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},Yo=e=>eA[e],ak=e=>!!Gp[e];var lk={colors:!0,chunks:!1,modules:!1,chunkModules:!1,reasons:!1,errorDetails:!1,assetsSpace:1/0,warnings:!1,assets:!0,entrypoints:!0,performance:!0};async function zl(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:r,paths:n}=ED(e.renderer,e.componentsFiles,e.componentsOptions),o=dk.Volume.fromJSON({"/Server":null,"/Client":null});u.debug("Generating bundling config...");let i=e.overrideConfig??{};Object.keys(i).length&&u.debug("Found bundle config overrides. Merging...");let s=Yo(t),a=k=>{let F=tA({env:k,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:n,libraryName:e.libraryIdentifier,bundler:t}),A=s.mergeConfigs(k,F,i);return e?.debugBundler&&(u.info(`${t} config for env ${k}:`),u.dir(A)),A},l={sourceVolumes:[...e.sourceVolumes,r],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,d]=await Promise.all([s.bundle({...l,config:a(Bn.Environment.Server),outputPath:`/${Bn.Environment.Server}`}),s.bundle({...l,config:a(Bn.Environment.Client),outputPath:`/${Bn.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(lk)}`),u.debug(`Client Bundler Stats: ${d.toString(lk)}`));let p=CD(o);u.debug("Packaging server bundle...");let h=await FD(c.toJson().assets||[],o,p);u.debug("Packaging client bundle...");let g=await TD(d.toJson().assets||[],o,p),m=k=>F=>[F,k];return{outputFiles:[...h.map(m(Bn.Environment.Server)),...g.map(m(Bn.Environment.Client))],outputVolume:o}}function tA({env:e,mode:t="production",framework:r,publicPath:n,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack"}){if(!ak(r))throw new Error(`Unknown framework: ${r}`);let c=Object.entries({[ps]:i[e],...o}).reduce((m,[w,k])=>({...m,[`./${w}`]:`./${(0,ck.relative)(process.cwd(),k)}`}),{}),d=Yo(l),p=d.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:n,outputPath:a}),h=d.getFrameworkConfig(r,e),g=d.generateFederationConfig({exposes:c,env:e,libraryName:s});return(0,uk.default)(p,h,g)}var mk=D(require("path")),zp=require("memfs/lib/volume"),Jp=D(require("webpack-merge")),gk=D(require("webpack-node-externals")),Bt=require("@webflow/data-types");var rA=D(require("fs")),Xo=require("path"),Zo=require("webpack");function nA(e,t=rA){let r=(0,Xo.join)(process.cwd(),"node_modules",e);for(;r!==(0,Xo.dirname)(r)&&r!=="node_modules";){let n=(0,Xo.join)(r,"package.json");if(t.existsSync(n))try{let{name:o,version:i}=JSON.parse(t.readFileSync(n,"utf8"));return`${o}@${i}`}catch{return null}r=(0,Xo.dirname)(r)}return null}var Jl=class{apply(t){t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(r){r.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Zo.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let n=r.getAssets(),o={};Object.values(n).forEach(({name:i,source:s})=>{if(!i.endsWith(".map"))return;let[a,l,c]=i.split("."),d=o[a]?.sources??{},p=o[a]?.dependencies??new Set;JSON.parse(s.source().toString()).sources.forEach(g=>{if(g.startsWith("external")){let m=g.match(/^external \S+ "(.+)"$/)?.[1];if(!m)throw new Error(`Could not extract package name from ${g}`);let w=nA(m,r.inputFileSystem);if(!w)throw new Error(`Could not find package information for ${m}`);w&&p.add(w)}}),o[a]={sources:{...d,[`./${a}.${c}`]:l},dependencies:p},r.deleteAsset(i)}),Object.entries(o).forEach(([i,{sources:s,dependencies:a}])=>{r.emitAsset(`${i}.js.map`,new Zo.sources.RawSource(JSON.stringify({sources:s,dependencies:[...a]})))})}catch(n){r.errors.push(new Zo.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${n instanceof Error?n.stack:String(n)}`))}})})}};var pk=D(require("module")),fk=require("jsdom"),Kp="__webflowCliImportModuleWindow__";function oA(e){let r=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),n=!!r,o=`module[${JSON.stringify(Kp)}]`,i=[];n||i.push('"use strict";'),i.push(`var __wfW = ${o};`,'if (__wfW == null) { throw new ReferenceError("Webflow CLI internal: missing JSDOM window on module"); }',"var window = __wfW;","var document = __wfW.document;","var navigator = __wfW.navigator;","var HTMLElement = __wfW.HTMLElement;","var localStorage = __wfW.localStorage;","var sessionStorage = __wfW.sessionStorage;","var requestAnimationFrame = __wfW.requestAnimationFrame.bind(__wfW);","var cancelAnimationFrame = __wfW.cancelAnimationFrame.bind(__wfW);","var getComputedStyle = __wfW.getComputedStyle.bind(__wfW);","var performance = __wfW.performance;","");let s=i.join(`
54
+ export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function Tb(e,t,n){let r={},o=`${Sn}/Client.js`,i=`${Sn}/Server.js`;r[o]=Ib([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],ia.Environment.Client);let s={},a=c=>{let d=H0(c);return s[d]?(s[d]+=1,`${d}${s[d]}`):(s[d]=1,d)};r[i]=Ib([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([c])=>n[c]?.ssr??!0).map(([c,d])=>{let p=a(c),m=d.startsWith(Sn)?d.replace(`${Sn}/`,"./"):d;return{name:p,path:m,exportKey:c,isDefaultExport:!0,type:"component"}})],ia.Environment.Server);let l={[ia.Environment.Client]:o,[ia.Environment.Server]:i};return{entryPointsVolume:Rb.Volume.fromJSON(r),paths:l}}var kk=require("memfs/lib/volume");var Nb=w(require("archiver")),Di=require("path");be();var sa=require("@webflow/data-types");be();_();var kr=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var Pb=2;function $b(e){let t={type:sa.ModuleLoader.FEDERATION,version:Pb,entry:Lp,renderer:Hs,components:e};return{title:Ws,content:JSON.stringify(t)}}function Ob(e){let t={type:sa.ModuleLoader.SSR,version:Pb,entry:pi,components:e};return{title:Ws,content:JSON.stringify(t)}}function Lb(e){let t=`/${sa.Environment.Client}/${Lp}`;try{if(e.existsSync(t)){let n=e.readFileSync(t,"utf8"),r=JSON.parse(n.toString()),o="publicPath"in r.metaData?r.metaData.publicPath:null;if(!o)throw new Error("Public path not found in module federation manifest");return r.exposes.reduce((i,s)=>{let a=s.name;return a===Hs||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${kr(o)}${l}`)})),i},{})}}catch(n){u.error(n,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var bc=require("@webflow/data-types"),V0=/\.css$/i;async function jb(e,t,n){let r=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${bc.Environment.Server}/${Vs}`,a=(0,Nb.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",p=>(r=!0,i(p))),l.on("close",()=>{if(!r)try{let p={type:"asset",name:Vs,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let h=(0,Di.resolve)((0,Di.join)(`/${bc.Environment.Server}`,m.name));t.existsSync(h)&&t.rmSync(h)}),o([p])}catch(p){return i(p)}finally{r=!0}}),a.pipe(l);let{title:c,content:d}=Ob(n);a.append(d,{name:c}),e.forEach(p=>{if(!V0.test(p.name))try{let m=(0,Di.resolve)((0,Di.join)(`/${bc.Environment.Server}`,p.name)),h=t.readFileSync(m,"utf8");a.append(h,{name:p.name})}catch(m){return r=!0,i(m)}}),await a.finalize()})}var Mb=require("@webflow/data-types");async function Bb(e,t,n){let{title:r,content:o}=$b(n);await t.promises.writeFile(`/${Mb.Environment.Client}/${r}`,o);let i={type:"asset",name:r,info:{},size:o.length,emitted:!0,comparedForEmit:!1,cached:!1};return e.filter(s=>s.name!=="mf-stats.json").concat([i])}var pk=require("@rspack/core"),fk=w(require("fork-ts-checker-webpack-plugin")),mk=require("ts-checker-rspack-plugin"),gk=w(require("mini-css-extract-plugin")),hk=require("@webflow/data-types");var Wb=require("webpack"),$f=w(require("mini-css-extract-plugin")),Hb=w(require("tsconfig-paths-webpack-plugin")),Vb=require("tsconfig-paths"),Of=require("@webflow/data-types"),Gb=require("path");be();var Ub=w(require("postcss-selector-parser")),Pf=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,Ub.default)(n=>{n.walkPseudos(r=>{r.value===":root"&&(r.value=":host")})}).processSync(t.selector)})}});Pf.postcss=!0;Pf.postcssPlugin="CSSinShadowDOM";var kc=Pf;function G0(){return(0,Vb.loadConfig)(process.cwd()).resultType==="success"}function Jb({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i}){let s={mode:n,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:$f.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[kc]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new $f.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[G0()?new Hb.default:null].filter(Boolean)},performance:{hints:!1}};if(t===Of.Environment.Client)return{...s,entry:()=>({}),output:{path:i?(0,Gb.join)(process.cwd(),i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Of.Environment.Server)return{...s,plugins:[...s.plugins||[],new Wb.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:pi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var Kb=require("@module-federation/enhanced"),Lf=require("@webflow/data-types");function zb({libraryName:e,env:t,exposes:n}){if(t===Lf.Environment.Client)return{plugins:[new Kb.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Lf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function qb(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,use:[{ident:"babel-loader",loader:require.resolve("babel-loader"),options:{presets:[require.resolve("@babel/preset-env"),[require.resolve("@babel/preset-react"),{runtime:"automatic"}],require.resolve("@babel/preset-typescript")]}}]}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}function Ec(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,loader:"builtin:swc-loader",options:{jsc:{parser:{syntax:"typescript",tsx:!0},transform:{react:{runtime:"automatic",development:!1,refresh:!1}}}}}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}var vc=require("@rspack/core"),Xb=require("tsconfig-paths"),Nf=require("@webflow/data-types"),Yb=require("path");be();function J0(){let e=(0,Xb.loadConfig)(process.cwd());if(e.resultType==="success")return e.configFileAbsolutePath}function Zb({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i}){let s={mode:n,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:vc.rspack.CssExtractRspackPlugin.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[kc]}}}],type:"javascript/auto"},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new vc.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let a=J0();return a?{tsConfig:{configFile:a}}:{}})(),performance:{hints:!1}};if(t===Nf.Environment.Client)return{...s,entry:()=>({}),output:{path:i?(0,Yb.join)(process.cwd(),i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Nf.Environment.Server)return{...s,plugins:[...Array.isArray(s.plugins)?s.plugins:[],new vc.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:pi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var Qb=require("@module-federation/enhanced/rspack"),jf=require("@webflow/data-types");function ek({libraryName:e,env:t,exposes:n}){if(t===jf.Environment.Client)return{plugins:[new Qb.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===jf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var z0=w(require("fs")),tk=require("unionfs"),nk=require("webpack");function K0(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function Sc(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:n=>e.toString(n),toJson:()=>({...t,assets:(t.assets??[]).map(K0)})}}async function rk({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new tk.Union().use(z0));return new Promise((s,a)=>{let l=(0,nk.webpack)(e);l.inputFileSystem=i,n&&(l.outputFileSystem=n),r&&(l.outputPath=r),l.run((c,d)=>{l.close(p=>{c||p?a(c||p):d?d.hasErrors()||o&&d.hasWarnings()?a(new Error(d.toString("errors-warnings"))):s(Sc(d)):a(new Error("Webpack stats are undefined"))})})})}var q0=w(require("fs")),Mf=w(require("webpack-merge")),ok=require("memfs"),ik=require("unionfs"),sk=require("@rspack/core");async function xc({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new ik.Union().use(q0)),s=e;return t.length>0&&(s=(0,Mf.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),n&&(s=(0,Mf.default)(s,{output:{clean:!1,...r&&{path:r}}})),new Promise((a,l)=>{let c=(0,sk.rspack)(s);c.inputFileSystem=i,n&&(c.outputFileSystem=(0,ok.createFsFromVolume)(n)),r&&(c.outputPath=r),c.run((d,p)=>{c.close(m=>{d||m?l(d||m):p?p.hasErrors()||o&&p.hasWarnings()?l(new Error(p.toString("errors-warnings"))):a(Sc(p)):l(new Error("Rspack stats are undefined"))})})})}var lk=require("@module-federation/enhanced");var bi=w(require("webpack-merge"));_();function Er(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function ak(e,t){let n=Object.entries(e).filter(([r])=>!t.includes(r));return Object.fromEntries(n)}function X0(e,t){return e instanceof t||Er(e)==="ModuleFederationPlugin"}function Fc(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:n,getPluginOptions:r,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],d=Y0(s),p=Array.isArray(l)?Cc(...l.map(d)):Cc(d(l));Object.keys(p).some(H=>c.includes(H))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let h={...ak(p,[...c,"ModuleFederationPlugin","module","plugins"]),module:ak(p.module??{},["rules"])},g=(0,bi.default)(a,h),y=p.plugins??[];o&&(y=y.filter(o));let b=a.plugins??[],A=(0,bi.mergeWithCustomize)({customizeArray:(0,bi.unique)("plugins",t,H=>Er(H))})({plugins:y},{plugins:b}).plugins,v=p?.ModuleFederationPlugin?.shared,x=A?.map(H=>{if(X0(H,n)){let B=r(H);return new n({...B,...v?{shared:v}:{}})}return H});g.plugins=x;let O=p.module?.rules;if(O&&typeof O=="function"){let H=a.module?.rules??[];g.module={...g.module??{},rules:O(H)}}return g}}function Cc(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={};for(let n of e){let{module:r,ModuleFederationPlugin:o,plugins:i,...s}=n;if(t={...t,...s},r){let{rules:a,...l}=r;if(t.module={...t.module,...l},a){let c=t.module?.rules;c?t.module.rules=d=>{let p=c(d);return a(p)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function Y0(e){return t=>typeof t=="function"?t(e):t}var Z0=Fc({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:lk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function ck(e,t,n){return Z0(e,t,n)}var uk=require("@module-federation/enhanced/rspack");var Q0=Fc({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:uk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Er(e)!=="MiniCssExtractPlugin"});function dk(e,t,n){return Q0(e,t,n)}var Bf={[hk.Framework.React]:{generateWebpackBundlerConfig:qb,generateRspackBundlerConfig:Ec}},eI={webpack:{generateBaseConfig:Jb,getFrameworkConfig:(e,t)=>Bf[e].generateWebpackBundlerConfig(t),generateFederationConfig:zb,mergeConfigs:(e,t,n)=>ck(e,t,n),bundle:e=>rk({...e,config:e.config}),typeCheckerPlugin:fk.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Er(t)==="MiniCssExtractPlugin"?new gk.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:Zb,getFrameworkConfig:(e,t)=>Bf[e].generateRspackBundlerConfig(t),generateFederationConfig:ek,mergeConfigs:(e,t,n)=>dk(e,t,n),bundle:e=>xc({...e,config:e.config}),typeCheckerPlugin:mk.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Er(t)==="CssExtractRspackPlugin"?new pk.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},ki=e=>eI[e],yk=e=>!!Bf[e];var wk={colors:!0,chunks:!1,modules:!1,chunkModules:!1,reasons:!1,errorDetails:!1,assetsSpace:1/0,warnings:!1,assets:!0,entrypoints:!0,performance:!0};async function _c(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:n,paths:r}=Tb(e.renderer,e.componentsFiles,e.componentsOptions),o=kk.Volume.fromJSON({"/Server":null,"/Client":null});u.debug("Generating bundling config...");let i=e.overrideConfig??{};Object.keys(i).length&&u.debug("Found bundle config overrides. Merging...");let s=ki(t),a=b=>{let S=tI({env:b,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:r,libraryName:e.libraryIdentifier,bundler:t}),A=s.mergeConfigs(b,S,i);return e?.debugBundler&&(u.info(`${t} config for env ${b}:`),u.dir(A)),A},l={sourceVolumes:[...e.sourceVolumes,n],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,d]=await Promise.all([s.bundle({...l,config:a(so.Environment.Server),outputPath:`/${so.Environment.Server}`}),s.bundle({...l,config:a(so.Environment.Client),outputPath:`/${so.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(wk)}`),u.debug(`Client Bundler Stats: ${d.toString(wk)}`));let p=Lb(o);u.debug("Packaging server bundle...");let m=await jb(c.toJson().assets||[],o,p);u.debug("Packaging client bundle...");let h=await Bb(d.toJson().assets||[],o,p),g=b=>S=>[S,b];return{outputFiles:[...m.map(g(so.Environment.Server)),...h.map(g(so.Environment.Client))],outputVolume:o}}function tI({env:e,mode:t="production",framework:n,publicPath:r,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack"}){if(!yk(n))throw new Error(`Unknown framework: ${n}`);let c=Object.entries({[Hs]:i[e],...o}).reduce((g,[y,b])=>({...g,[`./${y}`]:`./${(0,Dk.relative)(process.cwd(),b)}`}),{}),d=ki(l),p=d.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:r,outputPath:a}),m=d.getFrameworkConfig(n,e),h=d.generateFederationConfig({exposes:c,env:e,libraryName:s});return(0,bk.default)(p,m,h)}var Sk=w(require("path")),Wf=require("memfs/lib/volume"),Hf=w(require("webpack-merge")),xk=w(require("webpack-node-externals")),Ht=require("@webflow/data-types");var nI=w(require("fs")),Ei=require("path"),vi=require("webpack");function rI(e,t=nI){let n=(0,Ei.join)(process.cwd(),"node_modules",e);for(;n!==(0,Ei.dirname)(n)&&n!=="node_modules";){let r=(0,Ei.join)(n,"package.json");if(t.existsSync(r))try{let{name:o,version:i}=JSON.parse(t.readFileSync(r,"utf8"));return`${o}@${i}`}catch{return null}n=(0,Ei.dirname)(n)}return null}var Ac=class{apply(t){t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(n){n.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:vi.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let r=n.getAssets(),o={};Object.values(r).forEach(({name:i,source:s})=>{if(!i.endsWith(".map"))return;let[a,l,c]=i.split("."),d=o[a]?.sources??{},p=o[a]?.dependencies??new Set;JSON.parse(s.source().toString()).sources.forEach(h=>{if(h.startsWith("external")){let g=h.match(/^external \S+ "(.+)"$/)?.[1];if(!g)throw new Error(`Could not extract package name from ${h}`);let y=rI(g,n.inputFileSystem);if(!y)throw new Error(`Could not find package information for ${g}`);y&&p.add(y)}}),o[a]={sources:{...d,[`./${a}.${c}`]:l},dependencies:p},n.deleteAsset(i)}),Object.entries(o).forEach(([i,{sources:s,dependencies:a}])=>{n.emitAsset(`${i}.js.map`,new vi.sources.RawSource(JSON.stringify({sources:s,dependencies:[...a]})))})}catch(r){n.errors.push(new vi.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${r instanceof Error?r.stack:String(r)}`))}})})}};var Ek=w(require("module")),vk=require("jsdom"),Uf="__webflowCliImportModuleWindow__";function oI(e){let n=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),r=!!n,o=`module[${JSON.stringify(Uf)}]`,i=[];r||i.push('"use strict";'),i.push(`var __wfW = ${o};`,'if (__wfW == null) { throw new ReferenceError("Webflow CLI internal: missing JSDOM window on module"); }',"var window = __wfW;","var document = __wfW.document;","var navigator = __wfW.navigator;","var HTMLElement = __wfW.HTMLElement;","var localStorage = __wfW.localStorage;","var sessionStorage = __wfW.sessionStorage;","var requestAnimationFrame = __wfW.requestAnimationFrame.bind(__wfW);","var cancelAnimationFrame = __wfW.cancelAnimationFrame.bind(__wfW);","var getComputedStyle = __wfW.getComputedStyle.bind(__wfW);","var performance = __wfW.performance;","");let s=i.join(`
55
55
  `)+`
56
- `;return r?e.slice(0,r[0].length)+s+e.slice(r[0].length):s+e}function Is(e,t){let r=e.readFileSync(t,"utf-8"),o=new fk.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=oA(r),s=new pk.default(t,module);Object.defineProperty(s,Kp,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,Kp),o.close()}}function iA(e,t){let r=`/${t}.js`,n=Is(e,r),o=n.exports.default||n.exports;if(o&&typeof o=="object")try{return(0,Bt.parseComponentMetadata)(o)}catch(i){let s=i instanceof Error?i.stack:String(i);throw new Error(`Error parsing component data for '${t}': ${s}`)}throw new Error(`Could not get declaration for '${t}'`)}async function sA({declarations:e,sources:t,overrideConfig:r={},performTypeCheck:n,bundler:o="webpack"}){let i=new zp.Volume,s=Yo(o),a=(0,Jp.default)(s.generateBaseConfig({entry:e,env:Bt.Environment.Client,publicPath:"/",libraryName:"metadata"}),s.getFrameworkConfig(Bt.Framework.React,Bt.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:n?[new s.typeCheckerPlugin]:[]}),l=s.mergeConfigs(Bt.Environment.Client,a,r);return await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}async function aA({declarations:e,sources:t,overrideConfig:r={},bundler:n}){let o=new zp.Volume,i=Yo(n),s=(0,Jp.default)(i.generateBaseConfig({entry:e,env:Bt.Environment.Client,publicPath:"/",libraryName:"source-maps"}),i.getFrameworkConfig(Bt.Framework.React,Bt.Environment.Client),{entry:e,mode:"production",optimization:{mangleExports:"deterministic",moduleIds:"deterministic",chunkIds:"deterministic"},output:{filename:"[name].[contenthash].js",path:"/",library:{type:"commonjs2"},devtoolModuleFilenameTemplate:"[resource-path]",hashFunction:i.hashFunction},externalsPresets:{node:!0},devtool:"source-map",plugins:[new Jl],externals:[(0,gk.default)()]}),a=i.mergeConfigs(Bt.Environment.Client,s,r);return a=i.replaceCssPlugin(a),await i.bundle({outputPath:"/",config:a,sourceVolumes:t?[t]:[],outputVolume:o,failOnWarnings:!1}),o}function lA(e){return Object.entries(e.toJSON()).reduce((t,[r,n])=>{if(r.endsWith(".map")&&n?.length){let o=mk.default.basename(r).split(".")[0];t[o]=n}return t},{})}async function ql({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n=!1,skipSourceMaps:o=!1,bundler:i="webpack"}){let[s,a]=await Promise.all([sA({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n,bundler:i}),o||i==="rspack"?Promise.resolve(null):aA({declarations:e,sources:t,overrideConfig:r,bundler:i})]),{metadata:l,options:c}=Object.keys(e).reduce((p,h)=>{let g=iA(s,h);return p.metadata[h]=g,p.options[h]=g.options||{},p},{metadata:{},options:{}});return{sourceMaps:a?lA(a):{},metadata:l,options:c}}function hk(e,{framework:t,sourceMaps:r}){return Object.fromEntries(Object.keys(e).map(n=>[n,{...e[n],id:n,framework:t,exportPath:"default",hash:r[n]}]))}Ae();var wk=D(require("md5"));pe();de();N();var qp=" ",Dk=`${qp}${al} `;function cA(e){return e==="added"?` ${V("(Added)")}`:e==="removed"?` ${ne("(Removed)")}`:e==="changed"?` ${_e("(Changed)")}`:""}function yk(e){if(!e)return"";let t=JSON.parse(e);return(0,wk.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(r=>!r.includes("@webflow/data-types")&&!r.includes("@webflow/react"))].sort()))}function uA({componentsMetadata:e,latestVersion:t,sourceMaps:r}){let n=t.resource.codeLibraryResource.manifest.components.reduce((s,a)=>(s[a.id]=a,s),{}),o={};return Object.entries(n).forEach(([s,a])=>{if(!e[s])o[s]={component:a,status:"removed"};else{let l=e[s],c=yk(r[s]),d=a.displayName&&l.displayName!==a.displayName,p=c&&a.hash&&c!==yk(a.hash),h=d||p;o[s]={component:l,status:h?"changed":"unchanged",previousName:d?a.displayName:void 0}}}),Object.entries(e).forEach(([s,a])=>{n[s]||(o[s]={component:a,status:"added"})}),Object.values(o).map(({component:s,status:a,previousName:l})=>{let c=s.displayName??"Unknown Component",d=l?`${l} ${ot} ${c}`:c;return`${R(`${Dk}${d}`)}${cA(a)}`}).sort().join(`
57
- `)}function dA({componentsMetadata:e}){return Object.values(e).map(r=>`${R(Dk+(r.displayName??"Unknown Component"))}`).sort().join(`
58
- `)}async function kk({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:r,sourceMaps:n,workspaceInfo:o}){if(W())return Promise.resolve(!0);let i=e.id?r.find(({profile:d})=>d.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?uA({componentsMetadata:t,latestVersion:i,sourceMaps:n}):dA({componentsMetadata:t}),l=s?`Ready to update ${_e(e.name)} on ${qu(o.name)}?`:`Ready to share ${_e(e.name)} with ${qu(o.name)}?`;return await Pe({message:`${l}
56
+ `;return n?e.slice(0,n[0].length)+s+e.slice(n[0].length):s+e}function aa(e,t){let n=e.readFileSync(t,"utf-8"),o=new vk.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=oI(n),s=new Ek.default(t,module);Object.defineProperty(s,Uf,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,Uf),o.close()}}function iI(e,t){let n=`/${t}.js`,r=aa(e,n),o=r.exports.default||r.exports;if(o&&typeof o=="object")try{return(0,Ht.parseComponentMetadata)(o)}catch(i){let s=i instanceof Error?i.stack:String(i);throw new Error(`Error parsing component data for '${t}': ${s}`)}throw new Error(`Could not get declaration for '${t}'`)}async function sI({declarations:e,sources:t,overrideConfig:n={},performTypeCheck:r,bundler:o="webpack"}){let i=new Wf.Volume,s=ki(o),a=(0,Hf.default)(s.generateBaseConfig({entry:e,env:Ht.Environment.Client,publicPath:"/",libraryName:"metadata"}),s.getFrameworkConfig(Ht.Framework.React,Ht.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:r?[new s.typeCheckerPlugin]:[]}),l=s.mergeConfigs(Ht.Environment.Client,a,n);return await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}async function aI({declarations:e,sources:t,overrideConfig:n={},bundler:r}){let o=new Wf.Volume,i=ki(r),s=(0,Hf.default)(i.generateBaseConfig({entry:e,env:Ht.Environment.Client,publicPath:"/",libraryName:"source-maps"}),i.getFrameworkConfig(Ht.Framework.React,Ht.Environment.Client),{entry:e,mode:"production",optimization:{mangleExports:"deterministic",moduleIds:"deterministic",chunkIds:"deterministic"},output:{filename:"[name].[contenthash].js",path:"/",library:{type:"commonjs2"},devtoolModuleFilenameTemplate:"[resource-path]",hashFunction:i.hashFunction},externalsPresets:{node:!0},devtool:"source-map",plugins:[new Ac],externals:[(0,xk.default)()]}),a=i.mergeConfigs(Ht.Environment.Client,s,n);return a=i.replaceCssPlugin(a),await i.bundle({outputPath:"/",config:a,sourceVolumes:t?[t]:[],outputVolume:o,failOnWarnings:!1}),o}function lI(e){return Object.entries(e.toJSON()).reduce((t,[n,r])=>{if(n.endsWith(".map")&&r?.length){let o=Sk.default.basename(n).split(".")[0];t[o]=r}return t},{})}async function Ic({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r=!1,skipSourceMaps:o=!1,bundler:i="webpack"}){let[s,a]=await Promise.all([sI({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r,bundler:i}),o||i==="rspack"?Promise.resolve(null):aI({declarations:e,sources:t,overrideConfig:n,bundler:i})]),{metadata:l,options:c}=Object.keys(e).reduce((p,m)=>{let h=iI(s,m);return p.metadata[m]=h,p.options[m]=h.options||{},p},{metadata:{},options:{}});return{sourceMaps:a?lI(a):{},metadata:l,options:c}}function Ck(e,{framework:t,sourceMaps:n}){return Object.fromEntries(Object.keys(e).map(r=>[r,{...e[r],id:r,framework:t,exportPath:"default",hash:n[r]}]))}Te();var _k=w(require("md5"));we();pe();M();var Vf=" ",Ak=`${Vf}${Hl} `;function cI(e){return e==="added"?` ${K("(Added)")}`:e==="removed"?` ${le("(Removed)")}`:e==="changed"?` ${Ne("(Changed)")}`:""}function Fk(e){if(!e)return"";let t=JSON.parse(e);return(0,_k.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(n=>!n.includes("@webflow/data-types")&&!n.includes("@webflow/react"))].sort()))}function uI({componentsMetadata:e,latestVersion:t,sourceMaps:n}){let r=t.resource.codeLibraryResource.manifest.components.reduce((s,a)=>(s[a.id]=a,s),{}),o={};return Object.entries(r).forEach(([s,a])=>{if(!e[s])o[s]={component:a,status:"removed"};else{let l=e[s],c=Fk(n[s]),d=a.displayName&&l.displayName!==a.displayName,p=c&&a.hash&&c!==Fk(a.hash),m=d||p;o[s]={component:l,status:m?"changed":"unchanged",previousName:d?a.displayName:void 0}}}),Object.entries(e).forEach(([s,a])=>{r[s]||(o[s]={component:a,status:"added"})}),Object.values(o).map(({component:s,status:a,previousName:l})=>{let c=s.displayName??"Unknown Component",d=l?`${l} ${at} ${c}`:c;return`${R(`${Ak}${d}`)}${cI(a)}`}).sort().join(`
57
+ `)}function dI({componentsMetadata:e}){return Object.values(e).map(n=>`${R(Ak+(n.displayName??"Unknown Component"))}`).sort().join(`
58
+ `)}async function Ik({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:n,sourceMaps:r,workspaceInfo:o}){if(V())return Promise.resolve(!0);let i=e.id?n.find(({profile:d})=>d.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?uI({componentsMetadata:t,latestVersion:i,sourceMaps:r}):dI({componentsMetadata:t}),l=s?`Ready to update ${Ne(e.name)} on ${Vd(o.name)}?`:`Ready to share ${Ne(e.name)} with ${Vd(o.name)}?`;return await Re({message:`${l}
59
59
 
60
- ${qp}${R("Code components:")}
60
+ ${Vf}${R("Code components:")}
61
61
  ${a}
62
62
 
63
- ${qp}Confirm to proceed`})}var Yl=require("path"),vk=require("memfs/lib/volume");var bk=D(require("fast-glob")),pA=e=>{let t=e.split("/");return t[t.length-1]},fA=e=>pA(e).split(".")[0];async function Ek(e,t){return(await bk.default.glob(e,{absolute:!0,...t||{}})).reduce((n,o)=>{let i=fA(o);if(n[i])throw new Error(`Duplicate component '${i}' found. Already declared at ${n[i]}, but also found at ${o}.`);return{...n,[i]:o}},{})}async function Xl(e){let t=await Ek(e.components,{cwd:(0,Yl.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(o=>o!=null)});if(!Object.keys(t).length)throw new Error("No declaration files found");let{componentsFiles:r,componentsVolume:n}=mA(t,e.renderer.client,e.globals);return{componentsFiles:r,componentsVolume:n}}function mA(e,t,r){let n={},o={};return Object.entries(e).forEach(([i,s])=>{let a=(0,Yl.extname)(s),l=`${gr}/${DD}/${i}${a}`;n[i]=l,o[l]=gA(t,s,r)}),{componentsFiles:n,componentsVolume:vk.Volume.fromJSON(o)}}function gA(e,t,r){return r?`
63
+ ${Vf}Confirm to proceed`})}var Rc=require("path"),Pk=require("memfs/lib/volume");var Rk=w(require("fast-glob")),pI=e=>{let t=e.split("/");return t[t.length-1]},fI=e=>pI(e).split(".")[0];async function Tk(e,t){return(await Rk.default.glob(e,{absolute:!0,...t||{}})).reduce((r,o)=>{let i=fI(o);if(r[i])throw new Error(`Duplicate component '${i}' found. Already declared at ${r[i]}, but also found at ${o}.`);return{...r,[i]:o}},{})}async function Tc(e){let t=await Tk(e.components,{cwd:(0,Rc.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(o=>o!=null)});if(!Object.keys(t).length)throw new Error("No declaration files found");let{componentsFiles:n,componentsVolume:r}=mI(t,e.renderer.client,e.globals);return{componentsFiles:n,componentsVolume:r}}function mI(e,t,n){let r={},o={};return Object.entries(e).forEach(([i,s])=>{let a=(0,Rc.extname)(s),l=`${Sn}/${Ab}/${i}${a}`;r[i]=l,o[l]=gI(t,s,n)}),{componentsFiles:r,componentsVolume:Pk.Volume.fromJSON(o)}}function gI(e,t,n){return n?`
64
64
  import { applyDecorators } from "${e}";
65
65
  import componentDefinition from "${t}";
66
- const globals = require("${r}") || {};
66
+ const globals = require("${n}") || {};
67
67
 
68
68
  const globalDecorators = globals?.decorators || [];
69
69
  const decoratedDefinition = {
@@ -82,56 +82,56 @@ export default decoratedDefinition;
82
82
  `.trim():`
83
83
  import componentDefinition from "${t}";
84
84
  export default {...componentDefinition};
85
- `.trim()}J();Rl();var Sk=require("@webflow/data-types"),Zl={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:Sk.Framework.React};var Qo=require("path"),ei=require("fs");Ae();x();Me();function Lr(e){return e.replace(/\\/g,"/")}pe();S();de();N();function xk(e){let t={...e};if(e.globals){let r=(0,Qo.resolve)(process.cwd(),e.globals);if(!(0,ei.existsSync)(r))throw new Error(`Globals file not found: ${e.globals}
86
- Resolved path: ${r}
87
- Please ensure the file exists or remove the 'globals' field from your manifest.`);t.globals=Lr(r)}if(e.bundleConfig){let r=(0,Qo.resolve)(process.cwd(),e.bundleConfig);if(!(0,ei.existsSync)(r))throw new Error(`Bundle config file not found: ${e.bundleConfig}
88
- Resolved path: ${r}
89
- Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);t.bundleConfig=Lr(r)}if(typeof e.renderer=="string"){let r=(0,Qo.resolve)(process.cwd(),e.renderer);(0,ei.existsSync)(r)&&(t.renderer=Lr(r))}else if(typeof e.renderer=="object"&&typeof t.renderer=="object"){if(typeof e.renderer.client=="string"){let r=(0,Qo.resolve)(process.cwd(),e.renderer.client);(0,ei.existsSync)(r)&&(t.renderer={...t.renderer,client:Lr(r)})}if(typeof e.renderer.server=="string"){let r=(0,Qo.resolve)(process.cwd(),e.renderer.server);(0,ei.existsSync)(r)&&(t.renderer={...t.renderer,server:Lr(r)})}}return t}async function hA({initialData:e}){let t=await Je({message:"Enter a name for your code library",validate:o=>o.trim()===""?"The library name cannot be empty.":!0,default:e?.name});if(t==null)throw new f("When --no-input mode is enabled please provide a name in your library manifest");let r=await Je({message:"Enter a description for your code library",default:e?.description??""});if(!await Pe({message:"Is the code (including 3rd party packages) you are uploading to Webflow trusted and secure?"}))throw new Error("Code library is not trusted and secure");return{name:t,description:r}}async function yA({existingCodeLibraries:e}){let t={name:"[Create new code library]",value:null},n=[...e].sort((i,s)=>{let a=i.resource.codeLibraryResource.manifest.name??"",l=s.resource.codeLibraryResource.manifest.name??"",c=a.localeCompare(l,void 0,{sensitivity:"base"});return c!==0?c:i.profile.slug.localeCompare(s.profile.slug,void 0,{sensitivity:"base"})}).map(({resource:i,profile:s})=>{let a=`${i.codeLibraryResource.manifest.name} (${s.slug})`;s.status==="ARCHIVED"&&(a+=` ${ne("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await dl({message:"Select an existing code library (or create new):",source:i=>{if(!i)return[t,...n];let s=i.toLowerCase(),a=n.filter(l=>{let c=l.value?.id??"",d=l.value?.name??"",p=l.value?.description??"";return c.toLowerCase().includes(s)||d.toLowerCase().includes(s)||p.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function Yp({initialData:e,existingCodeLibraries:t}){let r,n={components:Zl.components},o=t.length>0?await yA({existingCodeLibraries:t}):null;if(o)r={...n,...o,...e,id:o.id};else{let a=await hA({initialData:e});r={...n,...e,...a}}let i=xk(r);xe({library:i}),u.info(`${L} Library configuration updated in webflow.json`);let{path:s}=In();return{libraryManifest:i,manifestPath:s}}async function Ck({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:r,manifestPath:n}=Z(),o=ls(r,"library");if(!o.id){if(er())return t.succeed(),Yp({initialData:o,existingCodeLibraries:e});throw new Error("Library manifest does not have an id")}let i=o.name??e.find(({profile:a})=>a.slug===o.id)?.resource.codeLibraryResource.manifest.name;if(!i&&er())return t.succeed(),Yp({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=xk({...o,name:i});return Promise.resolve({libraryManifest:s,manifestPath:n})}catch(r){if(r instanceof Rn&&er())return t.info(r.message),Yp({existingCodeLibraries:e});throw t.fail(),r}}var Xp=require("memfs/lib/volume"),Ak=D(require("webpack-merge"));var Tk="/client-renderer.js",Rk="/server-renderer.js",_k=`${gr}/test-renderers${Tk}`,Fk=`${gr}/test-renderers${Rk}`,wA=new Set(["@webflow/react"]),DA=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function Ik(e){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(wA.has(e.client)&&DA.has(e.server))return;let t=await EA(e);kA(e.client,t),bA(e.server,t)}function kA(e,t){let r=Is(t,Tk);if(typeof r.exports.ClientRenderer!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'ClientRenderer' export.`);if(typeof r.exports.applyDecorators!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'applyDecorators' export.`);let n=()=>null,o=r.exports.ClientRenderer(n),i=["mount","hydrate","render","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid client renderer: ${e} ClientRenderer must return an object with a '${s}' function.`)}function bA(e,t){let r=Is(t,Rk);if(typeof r.exports.ServerRenderer!="function")throw new Error(`Invalid server renderer: ${e} does not have a valid 'ServerRenderer' export.`);let n=()=>null,o=r.exports.ServerRenderer(n),i=["renderToStream","renderToString","prerenderToString","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid server renderer: ${e} ServerRenderer must return an object with a '${s}' function.`)}async function EA(e){let t=new Xp.Volume,r=Lr(e.client),n=Lr(e.server),o={[_k]:`
90
- export * from "${r}";
91
- `,[Fk]:`
85
+ `.trim()}q();pc();var $k=require("@webflow/data-types"),Pc={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:$k.Framework.React};var Si=require("path"),xi=require("fs");Te();_();We();function Jn(e){return e.replace(/\\/g,"/")}we();C();pe();M();function Ok(e){let t={...e};if(e.globals){let n=(0,Si.resolve)(process.cwd(),e.globals);if(!(0,xi.existsSync)(n))throw new Error(`Globals file not found: ${e.globals}
86
+ Resolved path: ${n}
87
+ Please ensure the file exists or remove the 'globals' field from your manifest.`);t.globals=Jn(n)}if(e.bundleConfig){let n=(0,Si.resolve)(process.cwd(),e.bundleConfig);if(!(0,xi.existsSync)(n))throw new Error(`Bundle config file not found: ${e.bundleConfig}
88
+ Resolved path: ${n}
89
+ Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);t.bundleConfig=Jn(n)}if(typeof e.renderer=="string"){let n=(0,Si.resolve)(process.cwd(),e.renderer);(0,xi.existsSync)(n)&&(t.renderer=Jn(n))}else if(typeof e.renderer=="object"&&typeof t.renderer=="object"){if(typeof e.renderer.client=="string"){let n=(0,Si.resolve)(process.cwd(),e.renderer.client);(0,xi.existsSync)(n)&&(t.renderer={...t.renderer,client:Jn(n)})}if(typeof e.renderer.server=="string"){let n=(0,Si.resolve)(process.cwd(),e.renderer.server);(0,xi.existsSync)(n)&&(t.renderer={...t.renderer,server:Jn(n)})}}return t}async function hI({initialData:e}){let t=await Je({message:"Enter a name for your code library",validate:o=>o.trim()===""?"The library name cannot be empty.":!0,default:e?.name});if(t==null)throw new f("When --no-input mode is enabled please provide a name in your library manifest");let n=await Je({message:"Enter a description for your code library",default:e?.description??""});if(!await Re({message:"Is the code (including 3rd party packages) you are uploading to Webflow trusted and secure?"}))throw new Error("Code library is not trusted and secure");return{name:t,description:n}}async function yI({existingCodeLibraries:e}){let t={name:"[Create new code library]",value:null},r=[...e].sort((i,s)=>{let a=i.resource.codeLibraryResource.manifest.name??"",l=s.resource.codeLibraryResource.manifest.name??"",c=a.localeCompare(l,void 0,{sensitivity:"base"});return c!==0?c:i.profile.slug.localeCompare(s.profile.slug,void 0,{sensitivity:"base"})}).map(({resource:i,profile:s})=>{let a=`${i.codeLibraryResource.manifest.name} (${s.slug})`;s.status==="ARCHIVED"&&(a+=` ${le("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await Jl({message:"Select an existing code library (or create new):",source:i=>{if(!i)return[t,...r];let s=i.toLowerCase(),a=r.filter(l=>{let c=l.value?.id??"",d=l.value?.name??"",p=l.value?.description??"";return c.toLowerCase().includes(s)||d.toLowerCase().includes(s)||p.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function Gf({initialData:e,existingCodeLibraries:t}){let n,r={components:Pc.components},o=t.length>0?await yI({existingCodeLibraries:t}):null;if(o)n={...r,...o,...e,id:o.id};else{let a=await hI({initialData:e});n={...r,...e,...a}}let i=Ok(n);Se({library:i}),u.info(`${$} Library configuration updated in webflow.json`);let{path:s}=Yr();return{libraryManifest:i,manifestPath:s}}async function Lk({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:n,manifestPath:r}=ne(),o=Ms(n,"library");if(!o.id){if(on())return t.succeed(),Gf({initialData:o,existingCodeLibraries:e});throw new Error("Library manifest does not have an id")}let i=o.name??e.find(({profile:a})=>a.slug===o.id)?.resource.codeLibraryResource.manifest.name;if(!i&&on())return t.succeed(),Gf({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=Ok({...o,name:i});return Promise.resolve({libraryManifest:s,manifestPath:r})}catch(n){if(n instanceof Xr&&on())return t.info(n.message),Gf({existingCodeLibraries:e});throw t.fail(),n}}var Jf=require("memfs/lib/volume"),Mk=w(require("webpack-merge"));var Bk="/client-renderer.js",Uk="/server-renderer.js",Nk=`${Sn}/test-renderers${Bk}`,jk=`${Sn}/test-renderers${Uk}`,wI=new Set(["@webflow/react"]),DI=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function Wk(e){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(wI.has(e.client)&&DI.has(e.server))return;let t=await EI(e);bI(e.client,t),kI(e.server,t)}function bI(e,t){let n=aa(t,Bk);if(typeof n.exports.ClientRenderer!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'ClientRenderer' export.`);if(typeof n.exports.applyDecorators!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'applyDecorators' export.`);let r=()=>null,o=n.exports.ClientRenderer(r),i=["mount","hydrate","render","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid client renderer: ${e} ClientRenderer must return an object with a '${s}' function.`)}function kI(e,t){let n=aa(t,Uk);if(typeof n.exports.ServerRenderer!="function")throw new Error(`Invalid server renderer: ${e} does not have a valid 'ServerRenderer' export.`);let r=()=>null,o=n.exports.ServerRenderer(r),i=["renderToStream","renderToString","prerenderToString","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid server renderer: ${e} ServerRenderer must return an object with a '${s}' function.`)}async function EI(e){let t=new Jf.Volume,n=Jn(e.client),r=Jn(e.server),o={[Nk]:`
92
90
  export * from "${n}";
93
- `},i=(0,Ak.default)(Ul(),{entry:{"client-renderer":_k,"server-renderer":Fk},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await Vl({config:i,sourceVolumes:[Xp.Volume.fromJSON(o)],outputVolume:t,failOnWarnings:!1}),t}async function Ql({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:r}=await Ck({existingCodeLibraries:e}),{renderer:n,...o}=Zl,i=typeof t.renderer=="string"?{client:t.renderer,server:t.renderer}:{client:t.renderer?.client??n.client,server:t.renderer?.server??n.server};return i.server==="@webflow/react"&&(i.server="@webflow/react/server"),await Ik(i),{...o,...t,renderer:i,manifestPath:r}}S();N();async function vA(e,t){let{trackPerformance:r,libraryConfig:n}=e;return await r("collect_metadata",async()=>{let{componentsFiles:o,componentsVolume:i}=await Xl(n);u.debug(`Components: ${JSON.stringify(o,null,2)}`);let{sourceMaps:s,metadata:a,options:l}=await ql({declarations:o,sources:i,overrideConfig:e.overrideConfig,performTypeCheck:Tl(o,t),bundler:t?.bundler});return u.debug(`Metadata: ${JSON.stringify(a,null,2)}`),u.debug(`Source Maps:
91
+ `,[jk]:`
92
+ export * from "${r}";
93
+ `},i=(0,Mk.default)(Ec(),{entry:{"client-renderer":Nk,"server-renderer":jk},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await xc({config:i,sourceVolumes:[Jf.Volume.fromJSON(o)],outputVolume:t,failOnWarnings:!1}),t}async function $c({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:n}=await Lk({existingCodeLibraries:e}),{renderer:r,...o}=Pc,i=typeof t.renderer=="string"?{client:t.renderer,server:t.renderer}:{client:t.renderer?.client??r.client,server:t.renderer?.server??r.server};return i.server==="@webflow/react"&&(i.server="@webflow/react/server"),await Wk(i),{...o,...t,renderer:i,manifestPath:n}}C();M();async function vI(e,t){let{trackPerformance:n,libraryConfig:r}=e;return await n("collect_metadata",async()=>{let{componentsFiles:o,componentsVolume:i}=await Tc(r);u.debug(`Components: ${JSON.stringify(o,null,2)}`);let{sourceMaps:s,metadata:a,options:l}=await Ic({declarations:o,sources:i,overrideConfig:e.overrideConfig,performTypeCheck:dc(o,t),bundler:t?.bundler});return u.debug(`Metadata: ${JSON.stringify(a,null,2)}`),u.debug(`Source Maps:
94
94
 
95
95
  ${Object.entries(s).reduce((c,[d,p])=>(c+=`${d}: ${JSON.stringify(JSON.parse(p),null,2)}
96
96
 
97
- `,c),"")}`),{componentsFiles:o,componentsVolume:i,componentsMetadata:a,componentsOptions:l,sourceMaps:s}})}async function SA(e,t,r,n,o,i,s){let{trackPerformance:a,libraryConfig:l}=e;return await a("generate_library_bundle",async()=>await zl({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:an(i[ti.Environment.Client]),sourceVolumes:[r],componentsFiles:t,componentsOptions:n,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler}))}async function xA(e,t,r,n){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let d=(0,ec.resolve)((0,ec.join)(`/${c}`,`${l.name}`));return Fs(r.readFileSync(d,"utf8").toString(),d,{bundleEnvironment:c})}),{signatures:a}=await Lp({resourceId:n,files:s.map(({meta:l})=>l),options:i});await Promise.all(a.map(async l=>{let c=s.find(d=>d.meta.fileHash===l.hash);if(!c)throw new Error(`File not found: ${l.hash}`);await As(c,l.value)}))})}async function CA(e,t,r,n,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:an(o[ti.Environment.Client])+ds,loaderType:ti.ModuleLoader.FEDERATION},serverModule:{bundleUrl:an(o[ti.Environment.Server])+fs}},c=hk(t,{framework:s.framework,sourceMaps:r}),{taskId:d}=await Np({resourceId:n,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:d},null,2))})}async function Zp(e){e?.verbose&&(process.env.DEBUG="true");let t,r=Date.now(),n=await T({apiToken:e?.apiToken});u.debug("Initializing telemetry service...");let o=_.forCodeLibraries({authToken:n}),i=Ly(o);try{u.debug("Checking dependencies versions..."),new Pn().run();let s={apiToken:n};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await Pp({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let d=await Ql({existingCodeLibraries:c}),p=d.bundleConfig?require(d.bundleConfig):{},h={trackPerformance:i,apiOptions:s,libraryConfig:d,overrideConfig:p};t=u.spinner("Collecting metadata");let{componentsFiles:g,componentsVolume:m,componentsMetadata:w,componentsOptions:k,sourceMaps:F}=await vA(h,e);if(t.succeed(),!await kk({libraryConfig:d,componentsMetadata:w,existingCodeLibraries:c,sourceMaps:F,workspaceInfo:l}))return;t=u.spinner("Creating code library");let{resourceId:E,profileSlug:v,workspace:M,s3Urls:B,cdnUrls:U}=await i("init_code_library",async()=>await $p({name:d.name,slug:d.id,description:d.description,options:s}));t.succeed(),u.debug(JSON.stringify({resourceId:E,profileSlug:v,s3Urls:B,cdnUrls:U},null,2)),await o.sendUsage("library_initialized",{libraryName:d.name,framework:d.framework,resourceId:E,profileSlug:v}),d.id||(xe({library:{id:v}}),u.info(`${L} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:Ie,outputVolume:Ze}=await SA(h,g,m,k,E,U,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:d.name,componentCount:Object.keys(g).length,resourceId:E,profileSlug:v}),t=u.spinner("Uploading files"),await xA(h,Ie,Ze,E),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:d.name,fileCount:Ie.length,resourceId:E,profileSlug:v}),t=u.spinner("Sharing library"),await CA(h,w,F,E,U),t.succeed(),u.success(`Code library shared successfully${M?.slug?`: ${Uo}/dashboard/workspace/${M?.slug}/shared-libraries-and-templates`:"!"}`);let Ee=Date.now()-r;await o.sendUsage("share_library",{duration:Ee,componentCount:Object.keys(g).length,libraryName:d.name,framework:d.framework,resourceId:E,profileSlug:v})}catch(s){t?.fail();let a=Date.now()-r;throw await o.sendError(s instanceof Error?s:new Error(String(s)),"share_library",{duration:a}),new f(s)}}var tc=D(require("fs")),ri=require("path");x();Rl();S();var _A="CodeLibrary",FA="dist",AA="http://localhost/";async function Qp(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new Pn().run(),u.debug("Looking for manifest...");let r=await Ql({existingCodeLibraries:[]}),n=jl(r.name)||_A,o=`_${e.libraryId||n}`;e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(r,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:i,componentsVolume:s}=await Xl(r);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(i,null,2)}`);let a=r.bundleConfig?require(r.bundleConfig):{},{sourceMaps:l,metadata:c,options:d}=await ql({declarations:i,sources:s,overrideConfig:a,performTypeCheck:Tl(i,e),skipSourceMaps:!e?.debugBundler,bundler:e.bundler});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(c,null,2)}`),u.debug(`Source Maps:
97
+ `,c),"")}`),{componentsFiles:o,componentsVolume:i,componentsMetadata:a,componentsOptions:l,sourceMaps:s}})}async function SI(e,t,n,r,o,i,s){let{trackPerformance:a,libraryConfig:l}=e;return await a("generate_library_bundle",async()=>await _c({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:kr(i[Ci.Environment.Client]),sourceVolumes:[n],componentsFiles:t,componentsOptions:r,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler}))}async function xI(e,t,n,r){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let d=(0,Oc.resolve)((0,Oc.join)(`/${c}`,`${l.name}`));return ra(n.readFileSync(d,"utf8").toString(),d,{bundleEnvironment:c})}),{signatures:a}=await Rf({resourceId:r,files:s.map(({meta:l})=>l),options:i});await Promise.all(a.map(async l=>{let c=s.find(d=>d.meta.fileHash===l.hash);if(!c)throw new Error(`File not found: ${l.hash}`);await oa(c,l.value)}))})}async function CI(e,t,n,r,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:kr(o[Ci.Environment.Client])+Ws,loaderType:Ci.ModuleLoader.FEDERATION},serverModule:{bundleUrl:kr(o[Ci.Environment.Server])+Vs}},c=Ck(t,{framework:s.framework,sourceMaps:n}),{taskId:d}=await Tf({resourceId:r,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:d},null,2))})}async function Kf(e){e?.verbose&&(process.env.DEBUG="true");let t,n=Date.now(),r=await T({apiToken:e?.apiToken});u.debug("Initializing telemetry service...");let o=F.forCodeLibraries({authToken:r}),i=Jw(o);try{u.debug("Checking dependencies versions..."),new Qr().run();let s={apiToken:r};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await Af({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let d=await $c({existingCodeLibraries:c}),p=d.bundleConfig?require(d.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:d,overrideConfig:p};t=u.spinner("Collecting metadata");let{componentsFiles:h,componentsVolume:g,componentsMetadata:y,componentsOptions:b,sourceMaps:S}=await vI(m,e);if(t.succeed(),!await Ik({libraryConfig:d,componentsMetadata:y,existingCodeLibraries:c,sourceMaps:S,workspaceInfo:l}))return;t=u.spinner("Creating code library");let{resourceId:v,profileSlug:x,workspace:O,s3Urls:H,cdnUrls:B}=await i("init_code_library",async()=>await If({name:d.name,slug:d.id,description:d.description,options:s}));t.succeed(),u.debug(JSON.stringify({resourceId:v,profileSlug:x,s3Urls:H,cdnUrls:B},null,2)),await o.sendUsage("library_initialized",{libraryName:d.name,framework:d.framework,resourceId:v,profileSlug:x}),d.id||(Se({library:{id:x}}),u.info(`${$} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:ye,outputVolume:ve}=await SI(m,h,g,b,v,B,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:d.name,componentCount:Object.keys(h).length,resourceId:v,profileSlug:x}),t=u.spinner("Uploading files"),await xI(m,ye,ve,v),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:d.name,fileCount:ye.length,resourceId:v,profileSlug:x}),t=u.spinner("Sharing library"),await CI(m,y,S,v,B),t.succeed(),u.success(`Code library shared successfully${O?.slug?`: ${kn}/dashboard/workspace/${O?.slug}/shared-libraries-and-templates`:"!"}`);let me=Date.now()-n;await o.sendUsage("share_library",{duration:me,componentCount:Object.keys(h).length,libraryName:d.name,framework:d.framework,resourceId:v,profileSlug:x})}catch(s){t?.fail();let a=Date.now()-n;throw await o.sendError(s instanceof Error?s:new Error(String(s)),"share_library",{duration:a}),new f(s)}}var Lc=w(require("fs")),Fi=require("path");_();pc();C();var FI="CodeLibrary",_I="dist",AI="http://localhost/";async function zf(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new Qr().run(),u.debug("Looking for manifest...");let n=await $c({existingCodeLibraries:[]}),r=Dc(n.name)||FI,o=`_${e.libraryId||r}`;e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(n,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:i,componentsVolume:s}=await Tc(n);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(i,null,2)}`);let a=n.bundleConfig?require(n.bundleConfig):{},{sourceMaps:l,metadata:c,options:d}=await Ic({declarations:i,sources:s,overrideConfig:a,performTypeCheck:dc(i,e),skipSourceMaps:!e?.debugBundler,bundler:e.bundler});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(c,null,2)}`),u.debug(`Source Maps:
98
98
 
99
- ${Object.entries(l).reduce((g,[m,w])=>(g+=`${m}: ${JSON.stringify(JSON.parse(w),null,2)}
99
+ ${Object.entries(l).reduce((h,[g,y])=>(h+=`${g}: ${JSON.stringify(JSON.parse(y),null,2)}
100
100
 
101
- `,g),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:p,outputVolume:h}=await zl({libraryIdentifier:o,renderer:r.renderer,framework:r.framework,publicPath:an(e.publicPath||AA),sourceVolumes:[s],componentsFiles:i,componentsOptions:d,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:a,failOnWarnings:!e.force,bundler:e.bundler});t.succeed(),t=u.spinner("Writing to disk"),p.forEach(([g,m])=>{let w=(0,ri.join)(`/${m}`,`${g.name}`),k=Fs(h.readFileSync(w,"utf8").toString(),w,{bundleEnvironment:m}),F=(0,ri.join)(process.cwd(),e.outputPath||FA);tc.default.existsSync((0,ri.join)(F,`${m}`))||tc.default.mkdirSync((0,ri.join)(F,`${m}`),{recursive:!0}),tc.default.writeFileSync((0,ri.join)(F,m,g.name),k.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(r){throw t?.fail(),new f(r)}}x();N();var Os=D(require("fs-extra")),ef=D(require("path"));x();N();function TA(){try{if(!Os.default.existsSync(St))return null;let e=Os.default.readdirSync(St).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:ef.default.join(St,t),time:Os.default.statSync(ef.default.join(St,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);if(e.length===0)return null;for(let t of e)try{let n=Os.default.readFileSync(t.path,"utf8").match(/Command: (.+)/);if(n){let o=n[1];if(!/^(log|library\s+log)(\s|$)/.test(o))return t.path}}catch{continue}return null}catch{return null}}async function tf(){let e=TA();e&&u.info(`${Bo} Latest log: ${e}`),u.info(`${Bo} All logs: ${St}`)}async function Ok(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(tf)}var ge=require("commander");S();x();function st(e){let t=Object.fromEntries(e.map(r=>[r.toLowerCase(),r]));return r=>{let n=[],o=[];for(let i of r){let s=t[i.toLowerCase()];s?n.push(s):o.push(i)}return{valid:n,invalid:o}}}function De(e,t,r){let n=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(n);if(o.length===0)throw new f(`No valid fields specified. Available: ${r.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${r.join(", ")}`),o}de();x();var Pk=(e,t)=>e+" ".repeat(Math.max(0,t-pt(e).length));function We(e,t){let r=e.map((s,a)=>Math.max(pt(s).length,...t.map(l=>pt(String(l[a])).length))),n=r.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>Pk(s,r[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>Pk(String(a),r[l]+2)).join("")).join(`
101
+ `,h),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:p,outputVolume:m}=await _c({libraryIdentifier:o,renderer:n.renderer,framework:n.framework,publicPath:kr(e.publicPath||AI),sourceVolumes:[s],componentsFiles:i,componentsOptions:d,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:a,failOnWarnings:!e.force,bundler:e.bundler});t.succeed(),t=u.spinner("Writing to disk"),p.forEach(([h,g])=>{let y=(0,Fi.join)(`/${g}`,`${h.name}`),b=ra(m.readFileSync(y,"utf8").toString(),y,{bundleEnvironment:g}),S=(0,Fi.join)(process.cwd(),e.outputPath||_I);Lc.default.existsSync((0,Fi.join)(S,`${g}`))||Lc.default.mkdirSync((0,Fi.join)(S,`${g}`),{recursive:!0}),Lc.default.writeFileSync((0,Fi.join)(S,g,h.name),b.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(n){throw t?.fail(),new f(n)}}_();M();var la=w(require("fs-extra")),qf=w(require("path"));_();M();function II(){try{if(!la.default.existsSync(_t))return null;let e=la.default.readdirSync(_t).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:qf.default.join(_t,t),time:la.default.statSync(qf.default.join(_t,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);if(e.length===0)return null;for(let t of e)try{let r=la.default.readFileSync(t.path,"utf8").match(/Command: (.+)/);if(r){let o=r[1];if(!/^(log|library\s+log)(\s|$)/.test(o))return t.path}}catch{continue}return null}catch{return null}}async function Xf(){let e=II();e&&u.info(`${ui} Latest log: ${e}`),u.info(`${ui} All logs: ${_t}`)}async function Hk(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(Xf)}var De=require("commander");C();_();function ut(e){let t=Object.fromEntries(e.map(n=>[n.toLowerCase(),n]));return n=>{let r=[],o=[];for(let i of n){let s=t[i.toLowerCase()];s?r.push(s):o.push(i)}return{valid:r,invalid:o}}}function Ce(e,t,n){let r=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(r);if(o.length===0)throw new f(`No valid fields specified. Available: ${n.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${n.join(", ")}`),o}pe();_();var Vk=(e,t)=>e+" ".repeat(Math.max(0,t-wt(e).length));function ze(e,t){let n=e.map((s,a)=>Math.max(wt(s).length,...t.map(l=>wt(String(l[a])).length))),r=n.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>Vk(s,n[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>Vk(String(a),n[l]+2)).join("")).join(`
102
102
  `);return`${o}
103
- ${n}
104
- ${i}`}function ni(e){return e?`
103
+ ${r}
104
+ ${i}`}function _i(e){return e?`
105
105
 
106
- More: pass --cursor ${e}`:""}var $k=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],Lk=["id","url","lastPublished","fullSiteCompiledAt"],Nk=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],rc="id,name,siteId,createdAt",rf="id,name,description,siteId,appPath,createdAt",nc="id,url,lastPublished",oc="id,branch,deployUrl,latestDeploymentStatus,createdAt",RA=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function IA(e,t){return e==null||e===""?R("\u2014"):RA.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function Ps(e,t,r){if(e.length===0)return R(r);let n=t.map(i=>te(i)),o=e.map(i=>t.map(s=>IA(i[s],s)));return We(n,o)}var ic=st($k),jk=st(Lk),Mk=st(Nk);function cn(){return $k}function $s(){return Lk}function Ls(){return Nk}function sc(e,t=rc.split(",")){return Ps(e,t,"No apps found.")}function Bk(e,t=nc.split(",")){return Ps(e,t,"No domains found.")}function Uk(e,t=oc.split(",")){return Ps(e,t,"No environments found.")}function Wk(e){return e.siteName?`Permanently delete app "${e.name}" (attached to site "${e.siteName}", ${e.id}). This cannot be undone.`:`Archive standalone app "${e.name}" (${e.id}).`}var OA=["success","failed","canceled","unstaged"],ac=5,lc=600;function Hk(e){return OA.includes(e)}var Vk=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],Ns="id,status,sourceType,commitHash,buildStartedAt",cc=st(Vk);function un(){return Vk}function js(e,t=Ns.split(",")){return Ps(e,t,"No deployments found.")}var nf=()=>new ge.Option("--no-input","Avoid prompting or doing anything interactive. Use this for CI/CD pipelines. Auto-enabled when CI=true, when stdout or stdin is not a TTY, or when a coding agent's execution environment is detected."),Gk=()=>new ge.Option("--input","Force interactive mode, overriding the automatic no-input detection."),of=()=>new ge.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),sf=()=>new ge.Option("--skip-update-check","Skip checking for @webflow packages updates"),af=()=>new ge.Option("--verbose","Display more information for debugging purposes."),Ms=()=>new ge.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),Ct=()=>new ge.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Y=()=>new ge.Option("--json","Output as JSON"),Bs=()=>new ge.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),Us=()=>new ge.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),lf=()=>new ge.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),Te=()=>new ge.Option("--dry-run","Preview without executing"),oi=()=>new ge.Option("-y, --yes","Skip confirmation prompt"),ii=()=>new ge.Option("--order <dir>","Sort direction: asc or desc").default("asc"),uc=()=>new ge.Option("-a, --agent <ids>",'Target coding agent, repeatable and comma-separated (e.g. --agent claude-code,cursor). Use "all" for every supported agent.').argParser((e,t)=>[...t??[],e]),Ws=()=>new ge.Option("-g, --global","Operate on the per-user (home directory) install"),Hs=()=>new ge.Option("-p, --project","Operate on the current project's install"),Le=e=>new ge.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),si=e=>new ge.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),dc=()=>new ge.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),pc=()=>new ge.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),PA=100,fc=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new ge.InvalidArgumentError("must be a positive integer.");return t},cf=()=>new ge.Option("--limit <n>","Max log lines to return (default: 100)").default(PA).argParser(fc),$A=20,Kk=()=>new ge.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default($A).argParser(fc),zk=e=>{let t=Number(e);if(!Number.isInteger(t))throw new ge.InvalidArgumentError("must be an integer number of seconds.");return t},Jk=()=>new ge.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(ac).argParser(zk),qk=()=>new ge.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(lc).argParser(zk),Vs=e=>async(t,r)=>{let o={...r.parent?.opts()||{},...t};await e(o)};de();var LA=`${ne("[Deprecated]")} The 'library' commands will be removed in the next major release.`,NA=()=>{u.warn(`${he} ${ne("webflow library share")} is deprecated and will be removed in the next major release.
107
- Use ${V("webflow devlink import")} instead.
108
- `)},jA=()=>{u.warn(`${he} ${ne("webflow library bundle")} is deprecated and will be removed in the next major release.
109
- Use ${V("webflow devlink bundle")} instead.
110
- `)},MA=()=>{u.warn(`${he} ${ne("webflow library log")} is deprecated and will be removed in the next major release.
111
- Use ${V("webflow log")} instead.
112
- `)},BA="Import a library of Code Components into your Webflow Workspace.",UA="Bundle a library of Code Components for local development.",Yk=()=>new dn.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),Xk=()=>new dn.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),Zk=()=>new dn.Option("--dev","Bundle in development mode for debugging purposes."),Qk=()=>new dn.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),WA=()=>new dn.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),HA=()=>new dn.Option("--public-path <path>","Set the public path for the bundle."),VA=()=>new dn.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function uf(e,t){return e.command(t).description(BA).addOption(Ms()).addOption(Yk()).addOption(Xk()).addOption(Zk()).addOption(Qk()).action(Vs(Zp))}function df(e,t){return e.command(t).description(UA).addOption(WA()).addOption(HA()).addOption(VA()).addOption(Yk()).addOption(Xk()).addOption(Zk()).addOption(Qk()).action(Vs(Qp))}var eb=e=>{let t=e.command("library").description(LA);uf(t,"share").description(`${ne("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",NA),df(t,"bundle").description(`${ne("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",jA),t.command("log").description(`${ne("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",MA).action(tf)};de();var tb=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${ne("[Deprecated]")} Use 'webflow devlink export' instead. Sync your Webflow components to your filesystem.`).argument("[components...]","A list of components to sync. If none is provided, all components will be synced.").addOption(Ms()).addOption(Ct()).action(Yw),uf(t,"import"),df(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(Ms()).addOption(Ct()).action(Vs($l))};var Mr=D(require("fs")),Ut=D(require("path"));x();J();var we={New:"new",Existing:"existing"},rb="cli",Nr=3,jr=39,mc="astro",nb="cloud-scaffolds";var ob="package.json",Un="webflow.json",gc="wf-placeholder-name",ib="CLOUD_MOUNT_PATH",sb="gitignore";function pf(e){return!e.siteId}var Gs=async(e,t,r=mc,n,o,i)=>{try{let s,a;if("content"in n){let l=n.content;s=l.files,a=c=>Ut.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=n[r];if(!c)throw new Error(`Scaffold "${r}" not found`);s=c;let d=Ut.join(nb,r);a=p=>p.split(d)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=Ut.join(e,a(l)),d=l.includes("next.config.ts"),p=l.includes("astro.config.mjs"),h=d||p;if(l.includes(Un)&&Mr.existsSync(c))continue;if(l.includes(ob)||l.includes(Un)){let m=(await Mr.promises.readFile(l,"utf8")).replace(gc,e);await hc(c,m)}else if(h){let g=await Mr.promises.readFile(l,"utf8");await hc(c,g.replace(ib,t))}else if(Ut.basename(c).toLowerCase()===sb){let g=await Mr.promises.readFile(l,"utf8"),m=Ut.join(Ut.dirname(c),".gitignore");await hc(m,g)}else{let g=await Mr.promises.readFile(l);await hc(c,g)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Or({siteId:o,apiToken:i,directory:e})}catch(l){u.error(`Error creating .env file: ${l}`)}}catch(s){throw u.error(`Error applying scaffold: ${s}`),s}};var hc=async(e,t)=>{try{await Mr.promises.mkdir(Ut.dirname(e),{recursive:!0}),await Mr.promises.writeFile(e,t)}catch(r){throw u.error(`Error writing file ${e}: ${r}`),r}};var pn=D(require("fs")),ab=D(require("fs-extra")),fn=D(require("path")),yf=D(require("os")),lb=D(require("tar"));var qe=class extends Error{constructor(r,n,o){super(r);this.scaffoldId=n;this.supportedIds=o;this.name="ScaffoldError"}};var Ks={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v2",betaRef:"astro7"}},"nextjs-minimal":{id:"nextjs-minimal",name:"Next.js",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs",ref:"v1"}},astro:{id:"astro",name:"Astro (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-astro-devlink",ref:"v2",betaRef:"astro7"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function zs(e){let t=Ks[e];if(!t){let r=Object.keys(Ks);throw new qe(`Unsupported framework: "${e}". Supported: ${r.join(", ")}`,e,r)}return t}function ff(){return Object.keys(Ks)}function mf(){return[...new Set(ff().map(e=>e.replace(/-minimal$/,"")))]}function gf(){return["astro","nextjs"]}function hf(e){let r=`${e.replace(/-minimal$/,"")}-minimal`;if(!Ks[r]){let n=ff();throw new qe(`No minimal scaffold for "${e}". Supported: ${n.join(", ")}`,r,n)}return r}x();Qr();var GA="https://github.com";async function wf(e){let t=e.endsWith("-minimal")?e:hf(e);return yc(t)}async function yc(e){return zs(e).source.type==="github"?KA(e):cb(e)}async function cb(e){let t=zs(e);if(t.source.type!=="local")throw new qe(`Scaffold "${e}" does not have a local source`,e);let r=fn.isAbsolute(t.source.path)?t.source.path:fn.join(__dirname,t.source.path);if(!pn.existsSync(r))throw new qe(`Scaffold directory not found: ${r}`,e);let n=await Df(r);return{scaffoldId:e,files:n,extractionRoot:r}}async function KA(e){let t=zs(e);if(t.source.type!=="github")throw new qe(`Scaffold "${e}" does not have a GitHub source`,e);let r=(ct()?t.source.betaRef:void 0)??t.source.ref??"main",n=`${GA}/${t.source.repo}/archive/${r}.tar.gz`,o=await pn.promises.mkdtemp(fn.join(yf.tmpdir(),`webflow-scaffold-${e}-`)),i=u.spinner(`Downloading scaffold (${t.source.repo}@${r})`);try{let s;try{s=await fetch(n,{redirect:"follow",headers:{"User-Agent":"webflow-cli"}})}catch(g){throw i.fail("Download failed"),new qe(`Failed to fetch scaffold from GitHub: ${g instanceof Error?g.message:String(g)}. Repo: ${t.source.repo}, ref: ${r}`,e)}if(!s.ok)throw i.fail(`GitHub returned ${s.status} ${s.statusText}`),new qe(`Failed to fetch scaffold from GitHub: ${s.status} ${s.statusText}. Repo: ${t.source.repo}, ref: ${r}`,e);let a=Buffer.from(await s.arrayBuffer());i.succeed("Downloaded scaffold");let l=u.spinner("Unpacking scaffold");try{await zA(a,o),l.succeed("Scaffold ready")}catch(g){throw l.fail("Unpack failed"),g}let c=await pn.promises.readdir(o),d=c[0];if(!d||c.length!==1)throw new qe(`Unexpected tarball structure for ${t.source.repo}`,e);let p=fn.join(o,d),h=await Df(p);return{scaffoldId:e,files:h,extractionRoot:p}}catch(s){try{ab.default.removeSync(o)}catch{}throw s instanceof qe?s:new qe(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function zA(e,t){let r=fn.join(yf.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await pn.promises.writeFile(r,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await lb.extract({file:r,cwd:t})}finally{await pn.promises.unlink(r).catch(()=>{})}}async function Df(e){let t=[],r=await pn.promises.readdir(e,{withFileTypes:!0});for(let n of r){let o=fn.join(e,n.name);n.isDirectory()?t.push(...await Df(o)):t.push(o)}return t}var Gf=D(require("fs-extra"));J();z();var X=D(require("fs")),ce=D(require("path")),na=require("child_process"),Kb=D(require("tar"));var lt=D(require("fs")),or=D(require("path"));var $={};uh($,{BRAND:()=>D0,DIRTY:()=>Wn,EMPTY_PATH:()=>XA,INVALID:()=>K,NEVER:()=>nT,OK:()=>at,ParseStatus:()=>Qe,Schema:()=>re,ZodAny:()=>hn,ZodArray:()=>Hr,ZodBigInt:()=>Vn,ZodBoolean:()=>Gn,ZodBranded:()=>qs,ZodCatch:()=>ro,ZodDate:()=>Kn,ZodDefault:()=>to,ZodDiscriminatedUnion:()=>kc,ZodEffects:()=>Vt,ZodEnum:()=>Qn,ZodError:()=>ft,ZodFirstPartyTypeKind:()=>q,ZodFunction:()=>Ec,ZodIntersection:()=>Yn,ZodIssueCode:()=>C,ZodLazy:()=>Xn,ZodLiteral:()=>Zn,ZodMap:()=>pi,ZodNaN:()=>mi,ZodNativeEnum:()=>eo,ZodNever:()=>rr,ZodNull:()=>Jn,ZodNullable:()=>wr,ZodNumber:()=>Hn,ZodObject:()=>mt,ZodOptional:()=>Wt,ZodParsedType:()=>j,ZodPipeline:()=>Ys,ZodPromise:()=>yn,ZodReadonly:()=>no,ZodRecord:()=>bc,ZodSchema:()=>re,ZodSet:()=>fi,ZodString:()=>gn,ZodSymbol:()=>ui,ZodTransformer:()=>Vt,ZodTuple:()=>yr,ZodType:()=>re,ZodUndefined:()=>zn,ZodUnion:()=>qn,ZodUnknown:()=>Wr,ZodVoid:()=>di,addIssueToContext:()=>P,any:()=>F0,array:()=>I0,bigint:()=>v0,boolean:()=>kb,coerce:()=>rT,custom:()=>yb,date:()=>S0,datetimeRegex:()=>gb,defaultErrorMap:()=>Br,discriminatedUnion:()=>L0,effect:()=>J0,enum:()=>G0,function:()=>W0,getErrorMap:()=>ai,getParsedType:()=>hr,instanceof:()=>b0,intersection:()=>N0,isAborted:()=>wc,isAsync:()=>li,isDirty:()=>Dc,isValid:()=>mn,late:()=>k0,lazy:()=>H0,literal:()=>V0,makeIssue:()=>Js,map:()=>B0,nan:()=>E0,nativeEnum:()=>K0,never:()=>T0,null:()=>_0,nullable:()=>Y0,number:()=>Db,object:()=>O0,objectUtil:()=>kf,oboolean:()=>tT,onumber:()=>eT,optional:()=>q0,ostring:()=>Q0,pipeline:()=>Z0,preprocess:()=>X0,promise:()=>z0,quotelessJson:()=>JA,record:()=>M0,set:()=>U0,setErrorMap:()=>YA,strictObject:()=>P0,string:()=>wb,symbol:()=>x0,transformer:()=>J0,tuple:()=>j0,undefined:()=>C0,union:()=>$0,unknown:()=>A0,util:()=>se,void:()=>R0});var se;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(se||(se={}));var kf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(kf||(kf={}));var j=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hr=e=>{switch(typeof e){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(e)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(e)?j.array:e===null?j.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?j.promise:typeof Map<"u"&&e instanceof Map?j.map:typeof Set<"u"&&e instanceof Set?j.set:typeof Date<"u"&&e instanceof Date?j.date:j.object;default:return j.unknown}};var C=se.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),JA=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ft=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ft.create=e=>new ft(e);var qA=(e,t)=>{let r;switch(e.code){case C.invalid_type:e.received===j.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case C.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,se.jsonStringifyReplacer)}`;break;case C.unrecognized_keys:r=`Unrecognized key(s) in object: ${se.joinValues(e.keys,", ")}`;break;case C.invalid_union:r="Invalid input";break;case C.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${se.joinValues(e.options)}`;break;case C.invalid_enum_value:r=`Invalid enum value. Expected ${se.joinValues(e.options)}, received '${e.received}'`;break;case C.invalid_arguments:r="Invalid function arguments";break;case C.invalid_return_type:r="Invalid function return type";break;case C.invalid_date:r="Invalid date";break;case C.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:se.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case C.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case C.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case C.custom:r="Invalid input";break;case C.invalid_intersection_types:r="Intersection results could not be merged";break;case C.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case C.not_finite:r="Number must be finite";break;default:r=t.defaultError,se.assertNever(e)}return{message:r}},Br=qA;var ub=Br;function YA(e){ub=e}function ai(){return ub}var Js=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},XA=[];function P(e,t){let r=ai(),n=Js({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Br?void 0:Br].filter(o=>!!o)});e.common.issues.push(n)}var Qe=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return K;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return K;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},K=Object.freeze({status:"aborted"}),Wn=e=>({status:"dirty",value:e}),at=e=>({status:"valid",value:e}),wc=e=>e.status==="aborted",Dc=e=>e.status==="dirty",mn=e=>e.status==="valid",li=e=>typeof Promise<"u"&&e instanceof Promise;var H;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(H||(H={}));var Ht=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},db=(e,t)=>{if(mn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ft(e.common.issues);return this._error=r,this._error}}};function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:l}=e;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??r??a.defaultError}},description:o}}var re=class{get description(){return this._def.description}_getType(t){return hr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Qe,ctx:{common:t.parent.common,data:t.data,parsedType:hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(li(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)},o=this._parseSync({data:t,path:n.path,parent:n});return db(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return mn(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>mn(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(li(o)?o:Promise.resolve(o));return db(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:C.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Vt({schema:this,typeName:q.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Wt.create(this,this._def)}nullable(){return wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Hr.create(this)}promise(){return yn.create(this,this._def)}or(t){return qn.create([this,t],this._def)}and(t){return Yn.create(this,t,this._def)}transform(t){return new Vt({...Q(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new to({...Q(this._def),innerType:this,defaultValue:r,typeName:q.ZodDefault})}brand(){return new qs({typeName:q.ZodBranded,type:this,...Q(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ro({...Q(this._def),innerType:this,catchValue:r,typeName:q.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ys.create(this,t)}readonly(){return no.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ZA=/^c[^\s-]{8,}$/i,QA=/^[0-9a-z]+$/,e0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,t0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,r0=/^[a-z0-9_-]{21}$/i,n0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,o0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,i0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,s0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bf,a0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,l0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,c0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,u0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,d0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,p0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fb="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",f0=new RegExp(`^${fb}$`);function mb(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function m0(e){return new RegExp(`^${mb(e)}$`)}function gb(e){let t=`${fb}T${mb(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function g0(e,t){return!!((t==="v4"||!t)&&a0.test(e)||(t==="v6"||!t)&&c0.test(e))}function h0(e,t){if(!n0.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function y0(e,t){return!!((t==="v4"||!t)&&l0.test(e)||(t==="v6"||!t)&&u0.test(e))}var gn=class e extends re{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==j.string){let i=this._getOrReturnCtx(t);return P(i,{code:C.invalid_type,expected:j.string,received:i.parsedType}),K}let n=new Qe,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),P(o,{code:C.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),P(o,{code:C.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?P(o,{code:C.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&P(o,{code:C.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")i0.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"email",code:C.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")bf||(bf=new RegExp(s0,"u")),bf.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"emoji",code:C.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")t0.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"uuid",code:C.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")r0.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"nanoid",code:C.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")ZA.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"cuid",code:C.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")QA.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"cuid2",code:C.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")e0.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"ulid",code:C.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),P(o,{validation:"url",code:C.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"regex",code:C.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),P(o,{code:C.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),P(o,{code:C.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),P(o,{code:C.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?gb(i).test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{code:C.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?f0.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{code:C.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?m0(i).test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{code:C.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?o0.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"duration",code:C.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?g0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"ip",code:C.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?h0(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"jwt",code:C.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?y0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"cidr",code:C.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?d0.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"base64",code:C.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?p0.test(t.data)||(o=this._getOrReturnCtx(t,o),P(o,{validation:"base64url",code:C.invalid_string,message:i.message}),n.dirty()):se.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:C.invalid_string,...H.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...H.errToObj(t)})}url(t){return this._addCheck({kind:"url",...H.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...H.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...H.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...H.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...H.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...H.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...H.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...H.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...H.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...H.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...H.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...H.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...H.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...H.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...H.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...H.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...H.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...H.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...H.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...H.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...H.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...H.errToObj(r)})}nonempty(t){return this.min(1,H.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};gn.create=e=>new gn({checks:[],typeName:q.ZodString,coerce:e?.coerce??!1,...Q(e)});function w0(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var Hn=class e extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==j.number){let i=this._getOrReturnCtx(t);return P(i,{code:C.invalid_type,expected:j.number,received:i.parsedType}),K}let n,o=new Qe;for(let i of this._def.checks)i.kind==="int"?se.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),P(n,{code:C.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),P(n,{code:C.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),P(n,{code:C.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?w0(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),P(n,{code:C.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),P(n,{code:C.not_finite,message:i.message}),o.dirty()):se.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,H.toString(r))}gt(t,r){return this.setLimit("min",t,!1,H.toString(r))}lte(t,r){return this.setLimit("max",t,!0,H.toString(r))}lt(t,r){return this.setLimit("max",t,!1,H.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:H.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:H.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:H.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:H.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&se.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Hn.create=e=>new Hn({checks:[],typeName:q.ZodNumber,coerce:e?.coerce||!1,...Q(e)});var Vn=class e extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==j.bigint)return this._getInvalidInput(t);let n,o=new Qe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),P(n,{code:C.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),P(n,{code:C.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),P(n,{code:C.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):se.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return P(r,{code:C.invalid_type,expected:j.bigint,received:r.parsedType}),K}gte(t,r){return this.setLimit("min",t,!0,H.toString(r))}gt(t,r){return this.setLimit("min",t,!1,H.toString(r))}lte(t,r){return this.setLimit("max",t,!0,H.toString(r))}lt(t,r){return this.setLimit("max",t,!1,H.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:H.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:H.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Vn.create=e=>new Vn({checks:[],typeName:q.ZodBigInt,coerce:e?.coerce??!1,...Q(e)});var Gn=class extends re{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==j.boolean){let n=this._getOrReturnCtx(t);return P(n,{code:C.invalid_type,expected:j.boolean,received:n.parsedType}),K}return at(t.data)}};Gn.create=e=>new Gn({typeName:q.ZodBoolean,coerce:e?.coerce||!1,...Q(e)});var Kn=class e extends re{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==j.date){let i=this._getOrReturnCtx(t);return P(i,{code:C.invalid_type,expected:j.date,received:i.parsedType}),K}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return P(i,{code:C.invalid_date}),K}let n=new Qe,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),P(o,{code:C.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),P(o,{code:C.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):se.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:H.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:H.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Kn.create=e=>new Kn({checks:[],coerce:e?.coerce||!1,typeName:q.ZodDate,...Q(e)});var ui=class extends re{_parse(t){if(this._getType(t)!==j.symbol){let n=this._getOrReturnCtx(t);return P(n,{code:C.invalid_type,expected:j.symbol,received:n.parsedType}),K}return at(t.data)}};ui.create=e=>new ui({typeName:q.ZodSymbol,...Q(e)});var zn=class extends re{_parse(t){if(this._getType(t)!==j.undefined){let n=this._getOrReturnCtx(t);return P(n,{code:C.invalid_type,expected:j.undefined,received:n.parsedType}),K}return at(t.data)}};zn.create=e=>new zn({typeName:q.ZodUndefined,...Q(e)});var Jn=class extends re{_parse(t){if(this._getType(t)!==j.null){let n=this._getOrReturnCtx(t);return P(n,{code:C.invalid_type,expected:j.null,received:n.parsedType}),K}return at(t.data)}};Jn.create=e=>new Jn({typeName:q.ZodNull,...Q(e)});var hn=class extends re{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}};hn.create=e=>new hn({typeName:q.ZodAny,...Q(e)});var Wr=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(t){return at(t.data)}};Wr.create=e=>new Wr({typeName:q.ZodUnknown,...Q(e)});var rr=class extends re{_parse(t){let r=this._getOrReturnCtx(t);return P(r,{code:C.invalid_type,expected:j.never,received:r.parsedType}),K}};rr.create=e=>new rr({typeName:q.ZodNever,...Q(e)});var di=class extends re{_parse(t){if(this._getType(t)!==j.undefined){let n=this._getOrReturnCtx(t);return P(n,{code:C.invalid_type,expected:j.void,received:n.parsedType}),K}return at(t.data)}};di.create=e=>new di({typeName:q.ZodVoid,...Q(e)});var Hr=class e extends re{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==j.array)return P(r,{code:C.invalid_type,expected:j.array,received:r.parsedType}),K;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(P(r,{code:s?C.too_big:C.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(P(r,{code:C.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(P(r,{code:C.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new Ht(r,s,r.path,a)))).then(s=>Qe.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Ht(r,s,r.path,a)));return Qe.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:H.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:H.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:H.toString(r)}})}nonempty(t){return this.min(1,t)}};Hr.create=(e,t)=>new Hr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...Q(t)});function ci(e){if(e instanceof mt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Wt.create(ci(n))}return new mt({...e._def,shape:()=>t})}else return e instanceof Hr?new Hr({...e._def,type:ci(e.element)}):e instanceof Wt?Wt.create(ci(e.unwrap())):e instanceof wr?wr.create(ci(e.unwrap())):e instanceof yr?yr.create(e.items.map(t=>ci(t))):e}var mt=class e extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=se.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==j.object){let c=this._getOrReturnCtx(t);return P(c,{code:C.invalid_type,expected:j.object,received:c.parsedType}),K}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof rr&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let d=i[c],p=o.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new Ht(o,p,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof rr){let c=this._def.unknownKeys;if(c==="passthrough")for(let d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(c==="strict")a.length>0&&(P(o,{code:C.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let d of a){let p=o.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new Ht(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let d of l){let p=await d.key,h=await d.value;c.push({key:p,value:h,alwaysSet:d.alwaysSet})}return c}).then(c=>Qe.mergeObjectSync(n,c)):Qe.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return H.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:H.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:q.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of se.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of se.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return ci(this)}partial(t){let r={};for(let n of se.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of se.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Wt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return hb(se.objectKeys(this.shape))}};mt.create=(e,t)=>new mt({shape:()=>e,unknownKeys:"strip",catchall:rr.create(),typeName:q.ZodObject,...Q(t)});mt.strictCreate=(e,t)=>new mt({shape:()=>e,unknownKeys:"strict",catchall:rr.create(),typeName:q.ZodObject,...Q(t)});mt.lazycreate=(e,t)=>new mt({shape:e,unknownKeys:"strip",catchall:rr.create(),typeName:q.ZodObject,...Q(t)});var qn=class extends re{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new ft(a.ctx.common.issues));return P(r,{code:C.invalid_union,unionErrors:s}),K}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},d=l._parseSync({data:r.data,path:r.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new ft(l));return P(r,{code:C.invalid_union,unionErrors:a}),K}}get options(){return this._def.options}};qn.create=(e,t)=>new qn({options:e,typeName:q.ZodUnion,...Q(t)});var Ur=e=>e instanceof Xn?Ur(e.schema):e instanceof Vt?Ur(e.innerType()):e instanceof Zn?[e.value]:e instanceof Qn?e.options:e instanceof eo?se.objectValues(e.enum):e instanceof to?Ur(e._def.innerType):e instanceof zn?[void 0]:e instanceof Jn?[null]:e instanceof Wt?[void 0,...Ur(e.unwrap())]:e instanceof wr?[null,...Ur(e.unwrap())]:e instanceof qs||e instanceof no?Ur(e.unwrap()):e instanceof ro?Ur(e._def.innerType):[],kc=class e extends re{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==j.object)return P(r,{code:C.invalid_type,expected:j.object,received:r.parsedType}),K;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(P(r,{code:C.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),K)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=Ur(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:q.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Q(n)})}};function Ef(e,t){let r=hr(e),n=hr(t);if(e===t)return{valid:!0,data:e};if(r===j.object&&n===j.object){let o=se.objectKeys(t),i=se.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=Ef(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===j.array&&n===j.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],l=Ef(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return r===j.date&&n===j.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Yn=class extends re{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(wc(i)||wc(s))return K;let a=Ef(i.value,s.value);return a.valid?((Dc(i)||Dc(s))&&r.dirty(),{status:r.value,value:a.data}):(P(n,{code:C.invalid_intersection_types}),K)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Yn.create=(e,t,r)=>new Yn({left:e,right:t,typeName:q.ZodIntersection,...Q(r)});var yr=class e extends re{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==j.array)return P(n,{code:C.invalid_type,expected:j.array,received:n.parsedType}),K;if(n.data.length<this._def.items.length)return P(n,{code:C.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),K;!this._def.rest&&n.data.length>this._def.items.length&&(P(n,{code:C.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Ht(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Qe.mergeArray(r,s)):Qe.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};yr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yr({items:e,typeName:q.ZodTuple,rest:null,...Q(t)})};var bc=class e extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==j.object)return P(n,{code:C.invalid_type,expected:j.object,received:n.parsedType}),K;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Ht(n,a,n.path,a)),value:s._parse(new Ht(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Qe.mergeObjectAsync(r,o):Qe.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof re?new e({keyType:t,valueType:r,typeName:q.ZodRecord,...Q(n)}):new e({keyType:gn.create(),valueType:t,typeName:q.ZodRecord,...Q(r)})}},pi=class extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==j.map)return P(n,{code:C.invalid_type,expected:j.map,received:n.parsedType}),K;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:o._parse(new Ht(n,a,n.path,[c,"key"])),value:i._parse(new Ht(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return K;(c.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(c.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return K;(c.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(c.value,d.value)}return{status:r.value,value:a}}}};pi.create=(e,t,r)=>new pi({valueType:t,keyType:e,typeName:q.ZodMap,...Q(r)});var fi=class e extends re{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==j.set)return P(n,{code:C.invalid_type,expected:j.set,received:n.parsedType}),K;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(P(n,{code:C.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(P(n,{code:C.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let d of l){if(d.status==="aborted")return K;d.status==="dirty"&&r.dirty(),c.add(d.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>i._parse(new Ht(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:H.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:H.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};fi.create=(e,t)=>new fi({valueType:e,minSize:null,maxSize:null,typeName:q.ZodSet,...Q(t)});var Ec=class e extends re{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==j.function)return P(r,{code:C.invalid_type,expected:j.function,received:r.parsedType}),K;function n(a,l){return Js({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ai(),Br].filter(c=>!!c),issueData:{code:C.invalid_arguments,argumentsError:l}})}function o(a,l){return Js({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ai(),Br].filter(c=>!!c),issueData:{code:C.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof yn){let a=this;return at(async function(...l){let c=new ft([]),d=await a._def.args.parseAsync(l,i).catch(g=>{throw c.addIssue(n(l,g)),c}),p=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(p,i).catch(g=>{throw c.addIssue(o(p,g)),c})})}else{let a=this;return at(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new ft([n(l,c.error)]);let d=Reflect.apply(s,this,c.data),p=a._def.returns.safeParse(d,i);if(!p.success)throw new ft([o(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:yr.create(t).rest(Wr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||yr.create([]).rest(Wr.create()),returns:r||Wr.create(),typeName:q.ZodFunction,...Q(n)})}},Xn=class extends re{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Xn.create=(e,t)=>new Xn({getter:e,typeName:q.ZodLazy,...Q(t)});var Zn=class extends re{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return P(r,{received:r.data,code:C.invalid_literal,expected:this._def.value}),K}return{status:"valid",value:t.data}}get value(){return this._def.value}};Zn.create=(e,t)=>new Zn({value:e,typeName:q.ZodLiteral,...Q(t)});function hb(e,t){return new Qn({values:e,typeName:q.ZodEnum,...Q(t)})}var Qn=class e extends re{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return P(r,{expected:se.joinValues(n),received:r.parsedType,code:C.invalid_type}),K}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return P(r,{received:r.data,code:C.invalid_enum_value,options:n}),K}return at(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Qn.create=hb;var eo=class extends re{_parse(t){let r=se.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==j.string&&n.parsedType!==j.number){let o=se.objectValues(r);return P(n,{expected:se.joinValues(o),received:n.parsedType,code:C.invalid_type}),K}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=se.objectValues(r);return P(n,{received:n.data,code:C.invalid_enum_value,options:o}),K}return at(t.data)}get enum(){return this._def.values}};eo.create=(e,t)=>new eo({values:e,typeName:q.ZodNativeEnum,...Q(t)});var yn=class extends re{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==j.promise&&r.common.async===!1)return P(r,{code:C.invalid_type,expected:j.promise,received:r.parsedType}),K;let n=r.parsedType===j.promise?r.data:Promise.resolve(r.data);return at(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};yn.create=(e,t)=>new yn({type:e,typeName:q.ZodPromise,...Q(t)});var Vt=class extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{P(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return K;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?K:l.status==="dirty"?Wn(l.value):r.value==="dirty"?Wn(l.value):l});{if(r.value==="aborted")return K;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?K:a.status==="dirty"?Wn(a.value):r.value==="dirty"?Wn(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?K:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?K:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!mn(s))return K;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>mn(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):K);se.assertNever(o)}};Vt.create=(e,t,r)=>new Vt({schema:e,typeName:q.ZodEffects,effect:t,...Q(r)});Vt.createWithPreprocess=(e,t,r)=>new Vt({schema:t,effect:{type:"preprocess",transform:e},typeName:q.ZodEffects,...Q(r)});var Wt=class extends re{_parse(t){return this._getType(t)===j.undefined?at(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Wt.create=(e,t)=>new Wt({innerType:e,typeName:q.ZodOptional,...Q(t)});var wr=class extends re{_parse(t){return this._getType(t)===j.null?at(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};wr.create=(e,t)=>new wr({innerType:e,typeName:q.ZodNullable,...Q(t)});var to=class extends re{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===j.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};to.create=(e,t)=>new to({innerType:e,typeName:q.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Q(t)});var ro=class extends re{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return li(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ft(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ft(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ro.create=(e,t)=>new ro({innerType:e,typeName:q.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Q(t)});var mi=class extends re{_parse(t){if(this._getType(t)!==j.nan){let n=this._getOrReturnCtx(t);return P(n,{code:C.invalid_type,expected:j.nan,received:n.parsedType}),K}return{status:"valid",value:t.data}}};mi.create=e=>new mi({typeName:q.ZodNaN,...Q(e)});var D0=Symbol("zod_brand"),qs=class extends re{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ys=class e extends re{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?K:i.status==="dirty"?(r.dirty(),Wn(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?K:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:q.ZodPipeline})}},no=class extends re{_parse(t){let r=this._def.innerType._parse(t),n=o=>(mn(o)&&(o.value=Object.freeze(o.value)),o);return li(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};no.create=(e,t)=>new no({innerType:e,typeName:q.ZodReadonly,...Q(t)});function pb(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function yb(e,t={},r){return e?hn.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=pb(t,n),l=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=pb(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):hn.create()}var k0={object:mt.lazycreate},q;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(q||(q={}));var b0=(e,t={message:`Input not instance of ${e.name}`})=>yb(r=>r instanceof e,t),wb=gn.create,Db=Hn.create,E0=mi.create,v0=Vn.create,kb=Gn.create,S0=Kn.create,x0=ui.create,C0=zn.create,_0=Jn.create,F0=hn.create,A0=Wr.create,T0=rr.create,R0=di.create,I0=Hr.create,O0=mt.create,P0=mt.strictCreate,$0=qn.create,L0=kc.create,N0=Yn.create,j0=yr.create,M0=bc.create,B0=pi.create,U0=fi.create,W0=Ec.create,H0=Xn.create,V0=Zn.create,G0=Qn.create,K0=eo.create,z0=yn.create,J0=Vt.create,q0=Wt.create,Y0=wr.create,X0=Vt.createWithPreprocess,Z0=Ys.create,Q0=()=>wb().optional(),eT=()=>Db().optional(),tT=()=>kb().optional(),rT={string:(e=>gn.create({...e,coerce:!0})),number:(e=>Hn.create({...e,coerce:!0})),boolean:(e=>Gn.create({...e,coerce:!0})),bigint:(e=>Vn.create({...e,coerce:!0})),date:(e=>Kn.create({...e,coerce:!0}))};var nT=K;function vc(e,t=!1){let r=e.length,n=0,o="",i=0,s=16,a=0,l=0,c=0,d=0,p=0;function h(E,v){let M=0,B=0;for(;M<E||!v;){let U=e.charCodeAt(n);if(U>=48&&U<=57)B=B*16+U-48;else if(U>=65&&U<=70)B=B*16+U-65+10;else if(U>=97&&U<=102)B=B*16+U-97+10;else break;n++,M++}return M<E&&(B=-1),B}function g(E){n=E,o="",i=0,s=16,p=0}function m(){let E=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&gi(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&gi(e.charCodeAt(n)))for(n++;n<e.length&&gi(e.charCodeAt(n));)n++;else return p=3,e.substring(E,n);let v=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&gi(e.charCodeAt(n))){for(n++;n<e.length&&gi(e.charCodeAt(n));)n++;v=n}else p=3;return e.substring(E,v)}function w(){let E="",v=n;for(;;){if(n>=r){E+=e.substring(v,n),p=2;break}let M=e.charCodeAt(n);if(M===34){E+=e.substring(v,n),n++;break}if(M===92){if(E+=e.substring(v,n),n++,n>=r){p=2;break}switch(e.charCodeAt(n++)){case 34:E+='"';break;case 92:E+="\\";break;case 47:E+="/";break;case 98:E+="\b";break;case 102:E+="\f";break;case 110:E+=`
113
- `;break;case 114:E+="\r";break;case 116:E+=" ";break;case 117:let U=h(4,!0);U>=0?E+=String.fromCharCode(U):p=4;break;default:p=5}v=n;continue}if(M>=0&&M<=31)if(Xs(M)){E+=e.substring(v,n),p=2;break}else p=6;n++}return E}function k(){if(o="",p=0,i=n,l=a,d=c,n>=r)return i=r,s=17;let E=e.charCodeAt(n);if(vf(E)){do n++,o+=String.fromCharCode(E),E=e.charCodeAt(n);while(vf(E));return s=15}if(Xs(E))return n++,o+=String.fromCharCode(E),E===13&&e.charCodeAt(n)===10&&(n++,o+=`
114
- `),a++,c=n,s=14;switch(E){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,o=w(),s=10;case 47:let v=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!Xs(e.charCodeAt(n));)n++;return o=e.substring(v,n),s=12}if(e.charCodeAt(n+1)===42){n+=2;let M=r-1,B=!1;for(;n<M;){let U=e.charCodeAt(n);if(U===42&&e.charCodeAt(n+1)===47){n+=2,B=!0;break}n++,Xs(U)&&(U===13&&e.charCodeAt(n)===10&&n++,a++,c=n)}return B||(n++,p=1),o=e.substring(v,n),s=13}return o+=String.fromCharCode(E),n++,s=16;case 45:if(o+=String.fromCharCode(E),n++,n===r||!gi(e.charCodeAt(n)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=m(),s=11;default:for(;n<r&&F(E);)n++,E=e.charCodeAt(n);if(i!==n){switch(o=e.substring(i,n),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(E),n++,s=16}}function F(E){if(vf(E)||Xs(E))return!1;switch(E){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function A(){let E;do E=k();while(E>=12&&E<=15);return E}return{setPosition:g,getPosition:()=>n,scan:t?A:k,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>n-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-d,getTokenError:()=>p}}function vf(e){return e===32||e===9}function Xs(e){return e===10||e===13}function gi(e){return e>=48&&e<=57}var bb;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(bb||(bb={}));var iT=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),hi=200,sT={" ":{"\n":new Array(hi).fill(0).map((e,t)=>`
115
- `+" ".repeat(t)),"\r":new Array(hi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(hi).fill(0).map((e,t)=>`\r
116
- `+" ".repeat(t))}," ":{"\n":new Array(hi).fill(0).map((e,t)=>`
117
- `+" ".repeat(t)),"\r":new Array(hi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(hi).fill(0).map((e,t)=>`\r
118
- `+" ".repeat(t))}};var Sc;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Sc||(Sc={}));function Eb(e,t=[],r=Sc.DEFAULT){let n=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):n!==null&&(o[n]=l)}return vb(e,{onObjectBegin:()=>{let l={};s(l),i.push(o),o=l,n=null},onObjectProperty:l=>{n=l},onObjectEnd:()=>{o=i.pop()},onArrayBegin:()=>{let l=[];s(l),i.push(o),o=l,n=null},onArrayEnd:()=>{o=i.pop()},onLiteralValue:s,onError:(l,c,d)=>{t.push({error:l,offset:c,length:d})}},r),o[0]}function vb(e,t,r=Sc.DEFAULT){let n=vc(e,!1),o=[],i=0;function s(ie){return ie?()=>i===0&&ie(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(ie){return ie?Ve=>i===0&&ie(Ve,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(ie){return ie?Ve=>i===0&&ie(Ve,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}function c(ie){return ie?()=>{i>0?i++:ie(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function d(ie){return ie?()=>{i>0&&i--,i===0&&ie(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let p=c(t.onObjectBegin),h=l(t.onObjectProperty),g=d(t.onObjectEnd),m=c(t.onArrayBegin),w=d(t.onArrayEnd),k=l(t.onLiteralValue),F=a(t.onSeparator),A=s(t.onComment),E=a(t.onError),v=r&&r.disallowComments,M=r&&r.allowTrailingComma;function B(){for(;;){let ie=n.scan();switch(n.getTokenError()){case 4:U(14);break;case 5:U(15);break;case 3:U(13);break;case 1:v||U(11);break;case 2:U(12);break;case 6:U(16);break}switch(ie){case 12:case 13:v?U(10):A();break;case 16:U(1);break;case 15:case 14:break;default:return ie}}}function U(ie,Ve=[],ch=[]){if(E(ie),Ve.length+ch.length>0){let Va=n.getToken();for(;Va!==17;){if(Ve.indexOf(Va)!==-1){B();break}else if(ch.indexOf(Va)!==-1)break;Va=B()}}}function Ie(ie){let Ve=n.getTokenValue();return ie?k(Ve):(h(Ve),o.push(Ve)),B(),!0}function Ze(){switch(n.getToken()){case 11:let ie=n.getTokenValue(),Ve=Number(ie);isNaN(Ve)&&(U(2),Ve=0),k(Ve);break;case 7:k(null);break;case 8:k(!0);break;case 9:k(!1);break;default:return!1}return B(),!0}function Ee(){return n.getToken()!==10?(U(3,[],[2,5]),!1):(Ie(!1),n.getToken()===6?(F(":"),B(),Et()||U(4,[],[2,5])):U(5,[],[2,5]),o.pop(),!0)}function Ke(){p(),B();let ie=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(ie||U(4,[],[]),F(","),B(),n.getToken()===2&&M)break}else ie&&U(6,[],[]);Ee()||U(4,[],[2,5]),ie=!0}return g(),n.getToken()!==2?U(7,[2],[]):B(),!0}function ae(){m(),B();let ie=!0,Ve=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(Ve||U(4,[],[]),F(","),B(),n.getToken()===4&&M)break}else Ve&&U(6,[],[]);ie?(o.push(0),ie=!1):o[o.length-1]++,Et()||U(4,[],[4,5]),Ve=!0}return w(),ie||o.pop(),n.getToken()!==4?U(8,[4],[]):B(),!0}function Et(){switch(n.getToken()){case 3:return ae();case 1:return Ke();case 10:return Ie(!0);default:return Ze()}}return B(),n.getToken()===17?r.allowEmptyContent?!0:(U(4,[],[]),!1):Et()?(n.getToken()!==17&&U(9,[],[]),!0):(U(4,[],[]),!1)}var Sb;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Sb||(Sb={}));var xb;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(xb||(xb={}));var oo=Eb;var Cb;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Cb||(Cb={}));var vi=D(require("fs")),jb=D(require("path")),Mb=require("@webflow/cosmic-deploy-contract");var yi=class extends Error{remediation;documentationUrl;cause;constructor(t,r){super(t),this.name="FrameworkError",this.cause=r?.cause,this.remediation=r?.remediation,this.documentationUrl=r?.documentationUrl,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toDisplayString(){let t=this.message;return this.remediation&&(t+=`
106
+ More: pass --cursor ${e}`:""}var Gk=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],Jk=["id","url","lastPublished","fullSiteCompiledAt"],Kk=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],Nc="id,name,siteId,createdAt",Yf="id,name,description,siteId,appPath,createdAt",jc="id,url,lastPublished",Mc="id,branch,deployUrl,latestDeploymentStatus,createdAt",RI=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function TI(e,t){return e==null||e===""?R("\u2014"):RI.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function ca(e,t,n){if(e.length===0)return R(n);let r=t.map(i=>se(i)),o=e.map(i=>t.map(s=>TI(i[s],s)));return ze(r,o)}var Bc=ut(Gk),zk=ut(Jk),qk=ut(Kk);function vr(){return Gk}function ua(){return Jk}function da(){return Kk}function Uc(e,t=Nc.split(",")){return ca(e,t,"No apps found.")}function Xk(e,t=jc.split(",")){return ca(e,t,"No domains found.")}function Yk(e,t=Mc.split(",")){return ca(e,t,"No environments found.")}function Zk(e){return e.siteName?`Permanently delete app "${e.name}" (attached to site "${e.siteName}", ${e.id}). This cannot be undone.`:`Archive standalone app "${e.name}" (${e.id}).`}var PI=["success","failed","canceled","unstaged"],Wc=5,Hc=600;function Qk(e){return PI.includes(e)}var eE=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],pa="id,status,sourceType,commitHash,buildStartedAt",Vc=ut(eE);function Sr(){return eE}function fa(e,t=pa.split(",")){return ca(e,t,"No deployments found.")}var Zf=()=>new De.Option("--no-input","Avoid prompting or doing anything interactive. Use this for CI/CD pipelines. Auto-enabled when CI=true, when stdout or stdin is not a TTY, or when a coding agent's execution environment is detected."),tE=()=>new De.Option("--input","Force interactive mode, overriding the automatic no-input detection."),Qf=()=>new De.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),em=()=>new De.Option("--skip-update-check","Skip checking for @webflow packages updates"),tm=()=>new De.Option("--verbose","Display more information for debugging purposes."),Kn=()=>new De.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),It=()=>new De.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Ai=e=>{if(e.trim()==="")throw new De.InvalidArgumentError("must be a non-empty value.");return e},Gc=(e,t)=>`Supplying multiple filters combines them with AND (all must match), so ${t} plus a non-matching --q returns an empty page \u2014 that means nothing matched all filters, not that the ${e} is absent.`,Jc=e=>new De.Option("--q <text>",`Case-insensitive substring (contains) match on ${e}. Use it to discover matches; it never searches ids or variable values. For an exact single-item lookup, prefer the exact filter instead.`).argParser(Ai),oe=()=>new De.Option("--json","Output as JSON"),ma=()=>new De.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),ga=()=>new De.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),nm=()=>new De.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),Pe=()=>new De.Option("--dry-run","Preview without executing"),Ii=()=>new De.Option("-y, --yes","Skip confirmation prompt"),Ri=()=>new De.Option("--order <dir>","Sort direction: asc or desc").default("asc"),Kc=()=>new De.Option("-a, --agent <ids>",'Target coding agent, repeatable and comma-separated (e.g. --agent claude-code,cursor). Use "all" for every supported agent.').argParser((e,t)=>[...t??[],e]),ha=()=>new De.Option("-g, --global","Operate on the per-user (home directory) install"),ya=()=>new De.Option("-p, --project","Operate on the current project's install"),He=e=>new De.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),Ti=e=>new De.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),zc=()=>new De.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),qc=()=>new De.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),$I=100,Xc=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new De.InvalidArgumentError("must be a positive integer.");return t},rm=()=>new De.Option("--limit <n>","Max log lines to return (default: 100)").default($I).argParser(Xc),OI=20,nE=()=>new De.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(OI).argParser(Xc),rE=e=>{let t=Number(e);if(!Number.isInteger(t))throw new De.InvalidArgumentError("must be an integer number of seconds.");return t},oE=()=>new De.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(Wc).argParser(rE),iE=()=>new De.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(Hc).argParser(rE),wa=e=>async(t,n)=>{let o={...n.parent?.opts()||{},...t};await e(o)};pe();var LI=`${le("[Deprecated]")} The 'library' commands will be removed in the next major release.`,NI=()=>{u.warn(`${re} ${le("webflow library share")} is deprecated and will be removed in the next major release.
107
+ Use ${K("webflow devlink import")} instead.
108
+ `)},jI=()=>{u.warn(`${re} ${le("webflow library bundle")} is deprecated and will be removed in the next major release.
109
+ Use ${K("webflow devlink bundle")} instead.
110
+ `)},MI=()=>{u.warn(`${re} ${le("webflow library log")} is deprecated and will be removed in the next major release.
111
+ Use ${K("webflow log")} instead.
112
+ `)},BI="Import a library of Code Components into your Webflow Workspace.",UI="Bundle a library of Code Components for local development.",sE=()=>new xr.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),aE=()=>new xr.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),lE=()=>new xr.Option("--dev","Bundle in development mode for debugging purposes."),cE=()=>new xr.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),WI=()=>new xr.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),HI=()=>new xr.Option("--public-path <path>","Set the public path for the bundle."),VI=()=>new xr.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function om(e,t){return e.command(t).description(BI).addOption(Kn()).addOption(sE()).addOption(aE()).addOption(lE()).addOption(cE()).action(wa(Kf))}function im(e,t){return e.command(t).description(UI).addOption(WI()).addOption(HI()).addOption(VI()).addOption(sE()).addOption(aE()).addOption(lE()).addOption(cE()).action(wa(zf))}var uE=e=>{let t=e.command("library").description(LI);om(t,"share").description(`${le("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",NI),im(t,"bundle").description(`${le("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",jI),t.command("log").description(`${le("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",MI).action(Xf)};pe();var dE=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${le("[Deprecated]")} Use 'webflow devlink export' instead. Sync your Webflow components to your filesystem.`).argument("[components...]","A list of components to sync. If none is provided, all components will be synced.").addOption(Kn()).addOption(It()).action(sb),om(t,"import"),im(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(Kn()).addOption(It()).action(wa(hc))};var Xn=w(require("fs")),Vt=w(require("path"));_();q();var xe={New:"new",Existing:"existing"},pE="cli",zn=3,qn=39,Yc="astro",fE="cloud-scaffolds";var mE="package.json",ao="webflow.json",Zc="wf-placeholder-name",gE="CLOUD_MOUNT_PATH",hE="gitignore";function sm(e){return!e.siteId}var Da=async(e,t,n=Yc,r,o,i)=>{try{let s,a;if("content"in r){let l=r.content;s=l.files,a=c=>Vt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=r[n];if(!c)throw new Error(`Scaffold "${n}" not found`);s=c;let d=Vt.join(fE,n);a=p=>p.split(d)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=Vt.join(e,a(l)),d=l.includes("next.config.ts"),p=l.includes("astro.config.mjs"),m=d||p;if(l.includes(ao)&&Xn.existsSync(c))continue;if(l.includes(mE)||l.includes(ao)){let g=(await Xn.promises.readFile(l,"utf8")).replace(Zc,e);await Qc(c,g)}else if(m){let h=await Xn.promises.readFile(l,"utf8");await Qc(c,h.replace(gE,t))}else if(Vt.basename(c).toLowerCase()===hE){let h=await Xn.promises.readFile(l,"utf8"),g=Vt.join(Vt.dirname(c),".gitignore");await Qc(g,h)}else{let h=await Xn.promises.readFile(l);await Qc(c,h)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Hn({siteId:o,apiToken:i,directory:e})}catch(l){u.error(`Error creating .env file: ${l}`)}}catch(s){throw u.error(`Error applying scaffold: ${s}`),s}};var Qc=async(e,t)=>{try{await Xn.promises.mkdir(Vt.dirname(e),{recursive:!0}),await Xn.promises.writeFile(e,t)}catch(n){throw u.error(`Error writing file ${e}: ${n}`),n}};var Cr=w(require("fs")),yE=w(require("fs-extra")),Fr=w(require("path")),dm=w(require("os")),wE=w(require("tar"));var Ze=class extends Error{constructor(n,r,o){super(n);this.scaffoldId=r;this.supportedIds=o;this.name="ScaffoldError"}};var ba={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v2",betaRef:"astro7"}},"nextjs-minimal":{id:"nextjs-minimal",name:"Next.js",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs",ref:"v1"}},astro:{id:"astro",name:"Astro (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-astro-devlink",ref:"v2",betaRef:"astro7"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function ka(e){let t=ba[e];if(!t){let n=Object.keys(ba);throw new Ze(`Unsupported framework: "${e}". Supported: ${n.join(", ")}`,e,n)}return t}function am(){return Object.keys(ba)}function lm(){return[...new Set(am().map(e=>e.replace(/-minimal$/,"")))]}function cm(){return["astro","nextjs"]}function um(e){let n=`${e.replace(/-minimal$/,"")}-minimal`;if(!ba[n]){let r=am();throw new Ze(`No minimal scaffold for "${e}". Supported: ${r.join(", ")}`,n,r)}return n}_();Wn();var GI="https://github.com";async function pm(e){let t=e.endsWith("-minimal")?e:um(e);return eu(t)}async function eu(e){return ka(e).source.type==="github"?JI(e):DE(e)}async function DE(e){let t=ka(e);if(t.source.type!=="local")throw new Ze(`Scaffold "${e}" does not have a local source`,e);let n=Fr.isAbsolute(t.source.path)?t.source.path:Fr.join(__dirname,t.source.path);if(!Cr.existsSync(n))throw new Ze(`Scaffold directory not found: ${n}`,e);let r=await fm(n);return{scaffoldId:e,files:r,extractionRoot:n}}async function JI(e){let t=ka(e);if(t.source.type!=="github")throw new Ze(`Scaffold "${e}" does not have a GitHub source`,e);let n=(tt()?t.source.betaRef:void 0)??t.source.ref??"main",r=`${GI}/${t.source.repo}/archive/${n}.tar.gz`,o=await Cr.promises.mkdtemp(Fr.join(dm.tmpdir(),`webflow-scaffold-${e}-`)),i=u.spinner(`Downloading scaffold (${t.source.repo}@${n})`);try{let s;try{s=await fetch(r,{redirect:"follow",headers:{"User-Agent":"webflow-cli"}})}catch(h){throw i.fail("Download failed"),new Ze(`Failed to fetch scaffold from GitHub: ${h instanceof Error?h.message:String(h)}. Repo: ${t.source.repo}, ref: ${n}`,e)}if(!s.ok)throw i.fail(`GitHub returned ${s.status} ${s.statusText}`),new Ze(`Failed to fetch scaffold from GitHub: ${s.status} ${s.statusText}. Repo: ${t.source.repo}, ref: ${n}`,e);let a=Buffer.from(await s.arrayBuffer());i.succeed("Downloaded scaffold");let l=u.spinner("Unpacking scaffold");try{await KI(a,o),l.succeed("Scaffold ready")}catch(h){throw l.fail("Unpack failed"),h}let c=await Cr.promises.readdir(o),d=c[0];if(!d||c.length!==1)throw new Ze(`Unexpected tarball structure for ${t.source.repo}`,e);let p=Fr.join(o,d),m=await fm(p);return{scaffoldId:e,files:m,extractionRoot:p}}catch(s){try{yE.default.removeSync(o)}catch{}throw s instanceof Ze?s:new Ze(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function KI(e,t){let n=Fr.join(dm.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await Cr.promises.writeFile(n,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await wE.extract({file:n,cwd:t})}finally{await Cr.promises.unlink(n).catch(()=>{})}}async function fm(e){let t=[],n=await Cr.promises.readdir(e,{withFileTypes:!0});for(let r of n){let o=Fr.join(e,r.name);r.isDirectory()?t.push(...await fm(o)):t.push(o)}return t}var Mm=w(require("fs-extra"));q();X();var ee=w(require("fs")),ce=w(require("path")),La=require("child_process"),av=w(require("tar"));var ft=w(require("fs")),un=w(require("path"));var j={};by(j,{BRAND:()=>DR,DIRTY:()=>lo,EMPTY_PATH:()=>YI,INVALID:()=>Y,NEVER:()=>rT,OK:()=>dt,ParseStatus:()=>nt,Schema:()=>ae,ZodAny:()=>Ir,ZodArray:()=>er,ZodBigInt:()=>uo,ZodBoolean:()=>po,ZodBranded:()=>va,ZodCatch:()=>vo,ZodDate:()=>fo,ZodDefault:()=>Eo,ZodDiscriminatedUnion:()=>ru,ZodEffects:()=>Kt,ZodEnum:()=>bo,ZodError:()=>Dt,ZodFirstPartyTypeKind:()=>Q,ZodFunction:()=>iu,ZodIntersection:()=>yo,ZodIssueCode:()=>I,ZodLazy:()=>wo,ZodLiteral:()=>Do,ZodMap:()=>ji,ZodNaN:()=>Bi,ZodNativeEnum:()=>ko,ZodNever:()=>an,ZodNull:()=>go,ZodNullable:()=>Fn,ZodNumber:()=>co,ZodObject:()=>bt,ZodOptional:()=>Gt,ZodParsedType:()=>W,ZodPipeline:()=>Sa,ZodPromise:()=>Rr,ZodReadonly:()=>So,ZodRecord:()=>ou,ZodSchema:()=>ae,ZodSet:()=>Mi,ZodString:()=>Ar,ZodSymbol:()=>Li,ZodTransformer:()=>Kt,ZodTuple:()=>Cn,ZodType:()=>ae,ZodUndefined:()=>mo,ZodUnion:()=>ho,ZodUnknown:()=>Qn,ZodVoid:()=>Ni,addIssueToContext:()=>N,any:()=>_R,array:()=>TR,bigint:()=>vR,boolean:()=>IE,coerce:()=>nT,custom:()=>FE,date:()=>SR,datetimeRegex:()=>xE,defaultErrorMap:()=>Yn,discriminatedUnion:()=>LR,effect:()=>zR,enum:()=>GR,function:()=>WR,getErrorMap:()=>Pi,getParsedType:()=>xn,instanceof:()=>kR,intersection:()=>NR,isAborted:()=>tu,isAsync:()=>$i,isDirty:()=>nu,isValid:()=>_r,late:()=>bR,lazy:()=>HR,literal:()=>VR,makeIssue:()=>Ea,map:()=>BR,nan:()=>ER,nativeEnum:()=>JR,never:()=>IR,null:()=>FR,nullable:()=>XR,number:()=>AE,object:()=>PR,objectUtil:()=>mm,oboolean:()=>tT,onumber:()=>eT,optional:()=>qR,ostring:()=>QR,pipeline:()=>ZR,preprocess:()=>YR,promise:()=>KR,quotelessJson:()=>zI,record:()=>MR,set:()=>UR,setErrorMap:()=>XI,strictObject:()=>$R,string:()=>_E,symbol:()=>xR,transformer:()=>zR,tuple:()=>jR,undefined:()=>CR,union:()=>OR,unknown:()=>AR,util:()=>de,void:()=>RR});var de;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(de||(de={}));var mm;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(mm||(mm={}));var W=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xn=e=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(e)?W.array:e===null?W.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?W.promise:typeof Map<"u"&&e instanceof Map?W.map:typeof Set<"u"&&e instanceof Set?W.set:typeof Date<"u"&&e instanceof Date?W.date:W.object;default:return W.unknown}};var I=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),zI=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Dt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Dt.create=e=>new Dt(e);var qI=(e,t)=>{let n;switch(e.code){case I.invalid_type:e.received===W.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,de.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(e.keys,", ")}`;break;case I.invalid_union:n="Invalid input";break;case I.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(e.options)}`;break;case I.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:n="Invalid function arguments";break;case I.invalid_return_type:n="Invalid function return type";break;case I.invalid_date:n="Invalid date";break;case I.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:de.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case I.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case I.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case I.custom:n="Invalid input";break;case I.invalid_intersection_types:n="Intersection results could not be merged";break;case I.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:n="Number must be finite";break;default:n=t.defaultError,de.assertNever(e)}return{message:n}},Yn=qI;var bE=Yn;function XI(e){bE=e}function Pi(){return bE}var Ea=e=>{let{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},YI=[];function N(e,t){let n=Pi(),r=Ea({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Yn?void 0:Yn].filter(o=>!!o)});e.common.issues.push(r)}var nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let o of n){if(o.status==="aborted")return Y;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let o of n){let i=await o.key,s=await o.value;r.push({key:i,value:s})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let o of n){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Y;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},Y=Object.freeze({status:"aborted"}),lo=e=>({status:"dirty",value:e}),dt=e=>({status:"valid",value:e}),tu=e=>e.status==="aborted",nu=e=>e.status==="dirty",_r=e=>e.status==="valid",$i=e=>typeof Promise<"u"&&e instanceof Promise;var G;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(G||(G={}));var Jt=class{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},kE=(e,t)=>{if(_r(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Dt(e.common.issues);return this._error=n,this._error}}};function ie(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:l}=e;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}var ae=class{get description(){return this._def.description}_getType(t){return xn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:xn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nt,ctx:{common:t.parent.common,data:t.data,parsedType:xn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if($i(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:xn(t)},o=this._parseSync({data:t,path:r.path,parent:r});return kE(r,o)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:xn(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return _r(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>_r(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:xn(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await($i(o)?o:Promise.resolve(o));return kE(r,i)}refine(t,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:I.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Kt({schema:this,typeName:Q.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Gt.create(this,this._def)}nullable(){return Fn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return er.create(this)}promise(){return Rr.create(this,this._def)}or(t){return ho.create([this,t],this._def)}and(t){return yo.create(this,t,this._def)}transform(t){return new Kt({...ie(this._def),schema:this,typeName:Q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Eo({...ie(this._def),innerType:this,defaultValue:n,typeName:Q.ZodDefault})}brand(){return new va({typeName:Q.ZodBranded,type:this,...ie(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new vo({...ie(this._def),innerType:this,catchValue:n,typeName:Q.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Sa.create(this,t)}readonly(){return So.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ZI=/^c[^\s-]{8,}$/i,QI=/^[0-9a-z]+$/,eR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tR=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nR=/^[a-z0-9_-]{21}$/i,rR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oR=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gm,aR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vE="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",fR=new RegExp(`^${vE}$`);function SE(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function mR(e){return new RegExp(`^${SE(e)}$`)}function xE(e){let t=`${vE}T${SE(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function gR(e,t){return!!((t==="v4"||!t)&&aR.test(e)||(t==="v6"||!t)&&cR.test(e))}function hR(e,t){if(!rR.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function yR(e,t){return!!((t==="v4"||!t)&&lR.test(e)||(t==="v6"||!t)&&uR.test(e))}var Ar=class e extends ae{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==W.string){let i=this._getOrReturnCtx(t);return N(i,{code:I.invalid_type,expected:W.string,received:i.parsedType}),Y}let r=new nt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?N(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")iR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"email",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")gm||(gm=new RegExp(sR,"u")),gm.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"emoji",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")tR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"uuid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")nR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"nanoid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")ZI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")QI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid2",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")eR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ulid",code:I.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),N(o,{validation:"url",code:I.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"regex",code:I.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?xE(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?fR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?mR(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:I.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?oR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"duration",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?gR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ip",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?hR(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"jwt",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?yR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cidr",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?dR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64",code:I.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?pR.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64url",code:I.invalid_string,message:i.message}),r.dirty()):de.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:I.invalid_string,...G.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...G.errToObj(t)})}url(t){return this._addCheck({kind:"url",...G.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...G.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...G.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...G.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...G.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...G.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...G.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...G.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...G.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...G.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...G.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...G.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...G.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...G.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...G.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...G.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...G.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...G.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...G.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...G.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...G.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...G.errToObj(n)})}nonempty(t){return this.min(1,G.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Ar.create=e=>new Ar({checks:[],typeName:Q.ZodString,coerce:e?.coerce??!1,...ie(e)});function wR(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var co=class e extends ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==W.number){let i=this._getOrReturnCtx(t);return N(i,{code:I.invalid_type,expected:W.number,received:i.parsedType}),Y}let r,o=new nt;for(let i of this._def.checks)i.kind==="int"?de.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),N(r,{code:I.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?wR(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),N(r,{code:I.not_finite,message:i.message}),o.dirty()):de.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,G.toString(n))}gt(t,n){return this.setLimit("min",t,!1,G.toString(n))}lte(t,n){return this.setLimit("max",t,!0,G.toString(n))}lt(t,n){return this.setLimit("max",t,!1,G.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:G.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:G.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:G.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:G.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&de.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};co.create=e=>new co({checks:[],typeName:Q.ZodNumber,coerce:e?.coerce||!1,...ie(e)});var uo=class e extends ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==W.bigint)return this._getInvalidInput(t);let r,o=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),N(r,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):de.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return N(n,{code:I.invalid_type,expected:W.bigint,received:n.parsedType}),Y}gte(t,n){return this.setLimit("min",t,!0,G.toString(n))}gt(t,n){return this.setLimit("min",t,!1,G.toString(n))}lte(t,n){return this.setLimit("max",t,!0,G.toString(n))}lt(t,n){return this.setLimit("max",t,!1,G.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:G.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:G.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};uo.create=e=>new uo({checks:[],typeName:Q.ZodBigInt,coerce:e?.coerce??!1,...ie(e)});var po=class extends ae{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==W.boolean){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.boolean,received:r.parsedType}),Y}return dt(t.data)}};po.create=e=>new po({typeName:Q.ZodBoolean,coerce:e?.coerce||!1,...ie(e)});var fo=class e extends ae{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==W.date){let i=this._getOrReturnCtx(t);return N(i,{code:I.invalid_type,expected:W.date,received:i.parsedType}),Y}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return N(i,{code:I.invalid_date}),Y}let r=new nt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:I.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:I.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):de.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:G.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:G.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};fo.create=e=>new fo({checks:[],coerce:e?.coerce||!1,typeName:Q.ZodDate,...ie(e)});var Li=class extends ae{_parse(t){if(this._getType(t)!==W.symbol){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.symbol,received:r.parsedType}),Y}return dt(t.data)}};Li.create=e=>new Li({typeName:Q.ZodSymbol,...ie(e)});var mo=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.undefined,received:r.parsedType}),Y}return dt(t.data)}};mo.create=e=>new mo({typeName:Q.ZodUndefined,...ie(e)});var go=class extends ae{_parse(t){if(this._getType(t)!==W.null){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.null,received:r.parsedType}),Y}return dt(t.data)}};go.create=e=>new go({typeName:Q.ZodNull,...ie(e)});var Ir=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(t){return dt(t.data)}};Ir.create=e=>new Ir({typeName:Q.ZodAny,...ie(e)});var Qn=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dt(t.data)}};Qn.create=e=>new Qn({typeName:Q.ZodUnknown,...ie(e)});var an=class extends ae{_parse(t){let n=this._getOrReturnCtx(t);return N(n,{code:I.invalid_type,expected:W.never,received:n.parsedType}),Y}};an.create=e=>new an({typeName:Q.ZodNever,...ie(e)});var Ni=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.void,received:r.parsedType}),Y}return dt(t.data)}};Ni.create=e=>new Ni({typeName:Q.ZodVoid,...ie(e)});var er=class e extends ae{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==W.array)return N(n,{code:I.invalid_type,expected:W.array,received:n.parsedType}),Y;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(N(n,{code:s?I.too_big:I.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(N(n,{code:I.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(N(n,{code:I.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new Jt(n,s,n.path,a)))).then(s=>nt.mergeArray(r,s));let i=[...n.data].map((s,a)=>o.type._parseSync(new Jt(n,s,n.path,a)));return nt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:G.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:G.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:G.toString(n)}})}nonempty(t){return this.min(1,t)}};er.create=(e,t)=>new er({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Q.ZodArray,...ie(t)});function Oi(e){if(e instanceof bt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Gt.create(Oi(r))}return new bt({...e._def,shape:()=>t})}else return e instanceof er?new er({...e._def,type:Oi(e.element)}):e instanceof Gt?Gt.create(Oi(e.unwrap())):e instanceof Fn?Fn.create(Oi(e.unwrap())):e instanceof Cn?Cn.create(e.items.map(t=>Oi(t))):e}var bt=class e extends ae{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=de.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==W.object){let c=this._getOrReturnCtx(t);return N(c,{code:I.invalid_type,expected:W.object,received:c.parsedType}),Y}let{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof an&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let d=i[c],p=o.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new Jt(o,p,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof an){let c=this._def.unknownKeys;if(c==="passthrough")for(let d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(c==="strict")a.length>0&&(N(o,{code:I.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let d of a){let p=o.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new Jt(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let d of l){let p=await d.key,m=await d.value;c.push({key:p,value:m,alwaysSet:d.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(r,c)):nt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return G.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:G.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Q.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of de.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of de.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return Oi(this)}partial(t){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of de.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Gt;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return CE(de.objectKeys(this.shape))}};bt.create=(e,t)=>new bt({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Q.ZodObject,...ie(t)});bt.strictCreate=(e,t)=>new bt({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Q.ZodObject,...ie(t)});bt.lazycreate=(e,t)=>new bt({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Q.ZodObject,...ie(t)});var ho=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Dt(a.ctx.common.issues));return N(n,{code:I.invalid_union,unionErrors:s}),Y}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new Dt(l));return N(n,{code:I.invalid_union,unionErrors:a}),Y}}get options(){return this._def.options}};ho.create=(e,t)=>new ho({options:e,typeName:Q.ZodUnion,...ie(t)});var Zn=e=>e instanceof wo?Zn(e.schema):e instanceof Kt?Zn(e.innerType()):e instanceof Do?[e.value]:e instanceof bo?e.options:e instanceof ko?de.objectValues(e.enum):e instanceof Eo?Zn(e._def.innerType):e instanceof mo?[void 0]:e instanceof go?[null]:e instanceof Gt?[void 0,...Zn(e.unwrap())]:e instanceof Fn?[null,...Zn(e.unwrap())]:e instanceof va||e instanceof So?Zn(e.unwrap()):e instanceof vo?Zn(e._def.innerType):[],ru=class e extends ae{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.object)return N(n,{code:I.invalid_type,expected:W.object,received:n.parsedType}),Y;let r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(N(n,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let o=new Map;for(let i of n){let s=Zn(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:Q.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ie(r)})}};function hm(e,t){let n=xn(e),r=xn(t);if(e===t)return{valid:!0,data:e};if(n===W.object&&r===W.object){let o=de.objectKeys(t),i=de.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=hm(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===W.array&&r===W.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],l=hm(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===W.date&&r===W.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var yo=class extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(tu(i)||tu(s))return Y;let a=hm(i.value,s.value);return a.valid?((nu(i)||nu(s))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:I.invalid_intersection_types}),Y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};yo.create=(e,t,n)=>new yo({left:e,right:t,typeName:Q.ZodIntersection,...ie(n)});var Cn=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.array)return N(r,{code:I.invalid_type,expected:W.array,received:r.parsedType}),Y;if(r.data.length<this._def.items.length)return N(r,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Jt(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>nt.mergeArray(n,s)):nt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Cn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cn({items:e,typeName:Q.ZodTuple,rest:null,...ie(t)})};var ou=class e extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.object)return N(r,{code:I.invalid_type,expected:W.object,received:r.parsedType}),Y;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in r.data)o.push({key:i._parse(new Jt(r,a,r.path,a)),value:s._parse(new Jt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?nt.mergeObjectAsync(n,o):nt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ae?new e({keyType:t,valueType:n,typeName:Q.ZodRecord,...ie(r)}):new e({keyType:Ar.create(),valueType:t,typeName:Q.ZodRecord,...ie(n)})}},ji=class extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.map)return N(r,{code:I.invalid_type,expected:W.map,received:r.parsedType}),Y;let o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Jt(r,a,r.path,[c,"key"])),value:i._parse(new Jt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return Y;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(c.value,d.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return Y;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(c.value,d.value)}return{status:n.value,value:a}}}};ji.create=(e,t,n)=>new ji({valueType:t,keyType:e,typeName:Q.ZodMap,...ie(n)});var Mi=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.set)return N(r,{code:I.invalid_type,expected:W.set,received:r.parsedType}),Y;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(N(r,{code:I.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(N(r,{code:I.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let d of l){if(d.status==="aborted")return Y;d.status==="dirty"&&n.dirty(),c.add(d.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((l,c)=>i._parse(new Jt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:G.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:G.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Mi.create=(e,t)=>new Mi({valueType:e,minSize:null,maxSize:null,typeName:Q.ZodSet,...ie(t)});var iu=class e extends ae{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.function)return N(n,{code:I.invalid_type,expected:W.function,received:n.parsedType}),Y;function r(a,l){return Ea({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Pi(),Yn].filter(c=>!!c),issueData:{code:I.invalid_arguments,argumentsError:l}})}function o(a,l){return Ea({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Pi(),Yn].filter(c=>!!c),issueData:{code:I.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Rr){let a=this;return dt(async function(...l){let c=new Dt([]),d=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),p=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(p,i).catch(h=>{throw c.addIssue(o(p,h)),c})})}else{let a=this;return dt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new Dt([r(l,c.error)]);let d=Reflect.apply(s,this,c.data),p=a._def.returns.safeParse(d,i);if(!p.success)throw new Dt([o(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Cn.create(t).rest(Qn.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||Cn.create([]).rest(Qn.create()),returns:n||Qn.create(),typeName:Q.ZodFunction,...ie(r)})}},wo=class extends ae{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};wo.create=(e,t)=>new wo({getter:e,typeName:Q.ZodLazy,...ie(t)});var Do=class extends ae{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return N(n,{received:n.data,code:I.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:t.data}}get value(){return this._def.value}};Do.create=(e,t)=>new Do({value:e,typeName:Q.ZodLiteral,...ie(t)});function CE(e,t){return new bo({values:e,typeName:Q.ZodEnum,...ie(t)})}var bo=class e extends ae{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return N(n,{expected:de.joinValues(r),received:n.parsedType,code:I.invalid_type}),Y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return N(n,{received:n.data,code:I.invalid_enum_value,options:r}),Y}return dt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};bo.create=CE;var ko=class extends ae{_parse(t){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==W.string&&r.parsedType!==W.number){let o=de.objectValues(n);return N(r,{expected:de.joinValues(o),received:r.parsedType,code:I.invalid_type}),Y}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=de.objectValues(n);return N(r,{received:r.data,code:I.invalid_enum_value,options:o}),Y}return dt(t.data)}get enum(){return this._def.values}};ko.create=(e,t)=>new ko({values:e,typeName:Q.ZodNativeEnum,...ie(t)});var Rr=class extends ae{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.promise&&n.common.async===!1)return N(n,{code:I.invalid_type,expected:W.promise,received:n.parsedType}),Y;let r=n.parsedType===W.promise?n.data:Promise.resolve(n.data);return dt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Rr.create=(e,t)=>new Rr({type:e,typeName:Q.ZodPromise,...ie(t)});var Kt=class extends ae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{N(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Y;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Y:l.status==="dirty"?lo(l.value):n.value==="dirty"?lo(l.value):l});{if(n.value==="aborted")return Y;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?Y:a.status==="dirty"?lo(a.value):n.value==="dirty"?lo(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Y:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Y:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!_r(s))return Y;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>_r(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):Y);de.assertNever(o)}};Kt.create=(e,t,n)=>new Kt({schema:e,typeName:Q.ZodEffects,effect:t,...ie(n)});Kt.createWithPreprocess=(e,t,n)=>new Kt({schema:t,effect:{type:"preprocess",transform:e},typeName:Q.ZodEffects,...ie(n)});var Gt=class extends ae{_parse(t){return this._getType(t)===W.undefined?dt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Gt.create=(e,t)=>new Gt({innerType:e,typeName:Q.ZodOptional,...ie(t)});var Fn=class extends ae{_parse(t){return this._getType(t)===W.null?dt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Fn.create=(e,t)=>new Fn({innerType:e,typeName:Q.ZodNullable,...ie(t)});var Eo=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===W.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Eo.create=(e,t)=>new Eo({innerType:e,typeName:Q.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ie(t)});var vo=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return $i(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Dt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Dt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};vo.create=(e,t)=>new vo({innerType:e,typeName:Q.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ie(t)});var Bi=class extends ae{_parse(t){if(this._getType(t)!==W.nan){let r=this._getOrReturnCtx(t);return N(r,{code:I.invalid_type,expected:W.nan,received:r.parsedType}),Y}return{status:"valid",value:t.data}}};Bi.create=e=>new Bi({typeName:Q.ZodNaN,...ie(e)});var DR=Symbol("zod_brand"),va=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Sa=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Y:i.status==="dirty"?(n.dirty(),lo(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Y:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:Q.ZodPipeline})}},So=class extends ae{_parse(t){let n=this._def.innerType._parse(t),r=o=>(_r(o)&&(o.value=Object.freeze(o.value)),o);return $i(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};So.create=(e,t)=>new So({innerType:e,typeName:Q.ZodReadonly,...ie(t)});function EE(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function FE(e,t={},n){return e?Ir.create().superRefine((r,o)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=EE(t,r),l=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=EE(t,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Ir.create()}var bR={object:bt.lazycreate},Q;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Q||(Q={}));var kR=(e,t={message:`Input not instance of ${e.name}`})=>FE(n=>n instanceof e,t),_E=Ar.create,AE=co.create,ER=Bi.create,vR=uo.create,IE=po.create,SR=fo.create,xR=Li.create,CR=mo.create,FR=go.create,_R=Ir.create,AR=Qn.create,IR=an.create,RR=Ni.create,TR=er.create,PR=bt.create,$R=bt.strictCreate,OR=ho.create,LR=ru.create,NR=yo.create,jR=Cn.create,MR=ou.create,BR=ji.create,UR=Mi.create,WR=iu.create,HR=wo.create,VR=Do.create,GR=bo.create,JR=ko.create,KR=Rr.create,zR=Kt.create,qR=Gt.create,XR=Fn.create,YR=Kt.createWithPreprocess,ZR=Sa.create,QR=()=>_E().optional(),eT=()=>AE().optional(),tT=()=>IE().optional(),nT={string:(e=>Ar.create({...e,coerce:!0})),number:(e=>co.create({...e,coerce:!0})),boolean:(e=>po.create({...e,coerce:!0})),bigint:(e=>uo.create({...e,coerce:!0})),date:(e=>fo.create({...e,coerce:!0}))};var rT=Y;function su(e,t=!1){let n=e.length,r=0,o="",i=0,s=16,a=0,l=0,c=0,d=0,p=0;function m(v,x){let O=0,H=0;for(;O<v||!x;){let B=e.charCodeAt(r);if(B>=48&&B<=57)H=H*16+B-48;else if(B>=65&&B<=70)H=H*16+B-65+10;else if(B>=97&&B<=102)H=H*16+B-97+10;else break;r++,O++}return O<v&&(H=-1),H}function h(v){r=v,o="",i=0,s=16,p=0}function g(){let v=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Ui(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Ui(e.charCodeAt(r)))for(r++;r<e.length&&Ui(e.charCodeAt(r));)r++;else return p=3,e.substring(v,r);let x=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Ui(e.charCodeAt(r))){for(r++;r<e.length&&Ui(e.charCodeAt(r));)r++;x=r}else p=3;return e.substring(v,x)}function y(){let v="",x=r;for(;;){if(r>=n){v+=e.substring(x,r),p=2;break}let O=e.charCodeAt(r);if(O===34){v+=e.substring(x,r),r++;break}if(O===92){if(v+=e.substring(x,r),r++,r>=n){p=2;break}switch(e.charCodeAt(r++)){case 34:v+='"';break;case 92:v+="\\";break;case 47:v+="/";break;case 98:v+="\b";break;case 102:v+="\f";break;case 110:v+=`
113
+ `;break;case 114:v+="\r";break;case 116:v+=" ";break;case 117:let B=m(4,!0);B>=0?v+=String.fromCharCode(B):p=4;break;default:p=5}x=r;continue}if(O>=0&&O<=31)if(xa(O)){v+=e.substring(x,r),p=2;break}else p=6;r++}return v}function b(){if(o="",p=0,i=r,l=a,d=c,r>=n)return i=n,s=17;let v=e.charCodeAt(r);if(ym(v)){do r++,o+=String.fromCharCode(v),v=e.charCodeAt(r);while(ym(v));return s=15}if(xa(v))return r++,o+=String.fromCharCode(v),v===13&&e.charCodeAt(r)===10&&(r++,o+=`
114
+ `),a++,c=r,s=14;switch(v){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,o=y(),s=10;case 47:let x=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!xa(e.charCodeAt(r));)r++;return o=e.substring(x,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;let O=n-1,H=!1;for(;r<O;){let B=e.charCodeAt(r);if(B===42&&e.charCodeAt(r+1)===47){r+=2,H=!0;break}r++,xa(B)&&(B===13&&e.charCodeAt(r)===10&&r++,a++,c=r)}return H||(r++,p=1),o=e.substring(x,r),s=13}return o+=String.fromCharCode(v),r++,s=16;case 45:if(o+=String.fromCharCode(v),r++,r===n||!Ui(e.charCodeAt(r)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=g(),s=11;default:for(;r<n&&S(v);)r++,v=e.charCodeAt(r);if(i!==r){switch(o=e.substring(i,r),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(v),r++,s=16}}function S(v){if(ym(v)||xa(v))return!1;switch(v){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function A(){let v;do v=b();while(v>=12&&v<=15);return v}return{setPosition:h,getPosition:()=>r,scan:t?A:b,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-d,getTokenError:()=>p}}function ym(e){return e===32||e===9}function xa(e){return e===10||e===13}function Ui(e){return e>=48&&e<=57}var RE;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(RE||(RE={}));var iT=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),Wi=200,sT={" ":{"\n":new Array(Wi).fill(0).map((e,t)=>`
115
+ `+" ".repeat(t)),"\r":new Array(Wi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Wi).fill(0).map((e,t)=>`\r
116
+ `+" ".repeat(t))}," ":{"\n":new Array(Wi).fill(0).map((e,t)=>`
117
+ `+" ".repeat(t)),"\r":new Array(Wi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Wi).fill(0).map((e,t)=>`\r
118
+ `+" ".repeat(t))}};var au;(function(e){e.DEFAULT={allowTrailingComma:!1}})(au||(au={}));function TE(e,t=[],n=au.DEFAULT){let r=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):r!==null&&(o[r]=l)}return PE(e,{onObjectBegin:()=>{let l={};s(l),i.push(o),o=l,r=null},onObjectProperty:l=>{r=l},onObjectEnd:()=>{o=i.pop()},onArrayBegin:()=>{let l=[];s(l),i.push(o),o=l,r=null},onArrayEnd:()=>{o=i.pop()},onLiteralValue:s,onError:(l,c,d)=>{t.push({error:l,offset:c,length:d})}},n),o[0]}function PE(e,t,n=au.DEFAULT){let r=su(e,!1),o=[],i=0;function s(U){return U?()=>i===0&&U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(U){return U?ge=>i===0&&U(ge,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function l(U){return U?ge=>i===0&&U(ge,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function c(U){return U?()=>{i>0?i++:U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function d(U){return U?()=>{i>0&&i--,i===0&&U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let p=c(t.onObjectBegin),m=l(t.onObjectProperty),h=d(t.onObjectEnd),g=c(t.onArrayBegin),y=d(t.onArrayEnd),b=l(t.onLiteralValue),S=a(t.onSeparator),A=s(t.onComment),v=a(t.onError),x=n&&n.disallowComments,O=n&&n.allowTrailingComma;function H(){for(;;){let U=r.scan();switch(r.getTokenError()){case 4:B(14);break;case 5:B(15);break;case 3:B(13);break;case 1:x||B(11);break;case 2:B(12);break;case 6:B(16);break}switch(U){case 12:case 13:x?B(10):A();break;case 16:B(1);break;case 15:case 14:break;default:return U}}}function B(U,ge=[],lr=[]){if(v(U),ge.length+lr.length>0){let cr=r.getToken();for(;cr!==17;){if(ge.indexOf(cr)!==-1){H();break}else if(lr.indexOf(cr)!==-1)break;cr=H()}}}function ye(U){let ge=r.getTokenValue();return U?b(ge):(m(ge),o.push(ge)),H(),!0}function ve(){switch(r.getToken()){case 11:let U=r.getTokenValue(),ge=Number(U);isNaN(ge)&&(B(2),ge=0),b(ge);break;case 7:b(null);break;case 8:b(!0);break;case 9:b(!1);break;default:return!1}return H(),!0}function me(){return r.getToken()!==10?(B(3,[],[2,5]),!1):(ye(!1),r.getToken()===6?(S(":"),H(),z()||B(4,[],[2,5])):B(5,[],[2,5]),o.pop(),!0)}function Le(){p(),H();let U=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(U||B(4,[],[]),S(","),H(),r.getToken()===2&&O)break}else U&&B(6,[],[]);me()||B(4,[],[2,5]),U=!0}return h(),r.getToken()!==2?B(7,[2],[]):H(),!0}function E(){g(),H();let U=!0,ge=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(ge||B(4,[],[]),S(","),H(),r.getToken()===4&&O)break}else ge&&B(6,[],[]);U?(o.push(0),U=!1):o[o.length-1]++,z()||B(4,[],[4,5]),ge=!0}return y(),U||o.pop(),r.getToken()!==4?B(8,[4],[]):H(),!0}function z(){switch(r.getToken()){case 3:return E();case 1:return Le();case 10:return ye(!0);default:return ve()}}return H(),r.getToken()===17?n.allowEmptyContent?!0:(B(4,[],[]),!1):z()?(r.getToken()!==17&&B(9,[],[]),!0):(B(4,[],[]),!1)}var $E;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})($E||($E={}));var OE;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(OE||(OE={}));var xo=TE;var LE;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(LE||(LE={}));var qi=w(require("fs")),ZE=w(require("path")),QE=require("@webflow/cosmic-deploy-contract");var zE=w(require("fs")),qE=w(require("path"));var Hi=class extends Error{remediation;documentationUrl;cause;constructor(t,n){super(t),this.name="FrameworkError",this.cause=n?.cause,this.remediation=n?.remediation,this.documentationUrl=n?.documentationUrl,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toDisplayString(){let t=this.message;return this.remediation&&(t+=`
119
119
 
120
120
  How to fix: ${this.remediation}`),this.documentationUrl&&(t+=`
121
121
 
122
- Documentation: ${this.documentationUrl}`),t}},ke=class extends yi{constructor(t,r){super(t,r),this.name="FrameworkValidationError"}};var io=class extends yi{configFile;constructor(t,r){super(t,r),this.name="FrameworkConfigError",this.configFile=r?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
122
+ Documentation: ${this.documentationUrl}`),t}},Fe=class extends Hi{constructor(t,n){super(t,n),this.name="FrameworkValidationError"}};var Co=class extends Hi{configFile;constructor(t,n){super(t,n),this.name="FrameworkConfigError",this.configFile=n?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
123
123
 
124
- Config file: ${this.configFile}`),t}},wn=class extends yi{constructor(t,r){super(t,r),this.name="FrameworkDetectionError"}};var yt=D(require("path")),Qs=D(require("fs"));var _b=D(require("semver")),gt=class{static frameworkName="";ctx;constructor(t){this.ctx=t}static detect(t,r){return{detected:!1}}static detectFromBuiltOutput(t){return!1}static getOutputDeployMetadata(){throw new Error("getOutputDeployMetadata must be implemented by the framework subclass")}getOutputDeployMetadata(){return this.constructor.getOutputDeployMetadata()}getFrameworkVersion(){}async postBuild(){}getAdditionalConfigFiles(){return[]}getUserConfigPatterns(){return[]}hasDependency(t){let{packageJson:r}=this.ctx;return t in(r.dependencies||{})||t in(r.devDependencies||{})}getDependencyVersion(t){let{packageJson:r}=this.ctx;return r.dependencies?.[t]||r.devDependencies?.[t]}resolveFrameworkVersion(t){let r=this.getDependencyVersion(t);if(r)return _b.default.coerce(r)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}};var Ob=D(require("semver")),$e=D(require("fs")),Dr=D(require("path"));var so=D(require("semver"));function fT(){return process.version.slice(1)}function mT(e){let t=so.coerce(e);return t?t.major:null}function gT(e,t){let r=so.coerce(e),n=so.coerce(t);return!r||!n?!1:so.gte(r,n)}function Dn(e,t,r){let n=fT(),o=t.minimum;if(gT(n,o))e.debug(`Node.js version ${n} meets requirement ${o}`);else{let i=mT(o),s=`${r} requires Node.js ${o} or higher. Current version: ${n}`;if(t.severity==="error")throw new ke(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
124
+ Config file: ${this.configFile}`),t}},tr=class extends Hi{constructor(t,n){super(t,n),this.name="FrameworkDetectionError"}};var Et=w(require("path")),Fa=w(require("fs"));var NE=w(require("semver")),pt=class{static frameworkName="";ctx;constructor(t){this.ctx=t}static detect(t,n){return{detected:!1}}static detectFromBuiltOutput(t){return!1}static getOutputDeployMetadata(){throw new Error("getOutputDeployMetadata must be implemented by the framework subclass")}getOutputDeployMetadata(){return this.constructor.getOutputDeployMetadata()}getFrameworkVersion(){}async postBuild(){}getAdditionalConfigFiles(){return[]}getUserConfigPatterns(){return[]}hasDependency(t){let{packageJson:n}=this.ctx;return t in(n.dependencies||{})||t in(n.devDependencies||{})}getDependencyVersion(t){let{packageJson:n}=this.ctx;return n.dependencies?.[t]||n.devDependencies?.[t]}resolveFrameworkVersion(t){let n=this.getDependencyVersion(t);if(n)return NE.default.coerce(n)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}};var HE=w(require("semver")),$e=w(require("fs")),_n=w(require("path"));var Fo=w(require("semver"));function fT(){return process.version.slice(1)}function mT(e){let t=Fo.coerce(e);return t?t.major:null}function gT(e,t){let n=Fo.coerce(e),r=Fo.coerce(t);return!n||!r?!1:Fo.gte(n,r)}function Tr(e,t,n){let r=fT(),o=t.minimum;if(gT(r,o))e.debug(`Node.js version ${r} meets requirement ${o}`);else{let i=mT(o),s=`${n} requires Node.js ${o} or higher. Current version: ${r}`;if(t.severity==="error")throw new Fe(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
125
125
 
126
126
  nvm install ${i}
127
- nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var xc=D(require("fs")),Fb=D(require("path"));var Ab=$.object({name:$.string().optional(),version:$.string().optional(),dependencies:$.record($.string()).optional(),devDependencies:$.record($.string()).optional()});function Zs(e){let t=Fb.default.join(e,"package.json");if(!xc.statSync(t,{throwIfNoEntry:!1}))return;let r=xc.readFileSync(t).toString("utf8"),n;try{n=JSON.parse(r)}catch(o){throw new ke("package.json was not valid JSON",{cause:o})}try{return Ab.parse(n)}catch(o){throw new ke("package.json schema validation failed",{cause:o})}}var Cc=D(require("fs")),Tb=D(require("path"));var _c=$.object({cloud:$.object({contract_version:$.string().optional(),framework:$.string().optional(),framework_version:$.string().optional(),entrypoint_path:$.string().optional(),deployment_type:$.enum(["spa","ssg","ssr","ssr-spa-combo"]).optional(),skip_no_bundle:$.boolean().optional(),assets_path_prefix:$.string().optional(),assets_source_skip_mount_path:$.boolean().optional()}).passthrough().optional()}).passthrough();function wi(e,t,r="webflow.json"){let n=Tb.default.join(t,r);if(!Cc.statSync(n,{throwIfNoEntry:!1}))return r.endsWith(".json")?wi(e,t,r+"c"):void 0;let o=Cc.readFileSync(n).toString("utf8"),i;try{i=oo(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${n} ${JSON.stringify(o)}: ${s}`);return}try{let s=_c.parse(i);return e.debug(`loaded ${n}: ${JSON.stringify(s)}`),s}catch(s){e?.error(`${n} was valid JSON but schema validation failed: ${s}`);return}}var Rb=require("child_process"),Ib=["--no-update-notifier","--no-progress","--no-audit","--no-fund"];async function Ye(e){let{log:t,cwd:r,args:n}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...Ib,...n];t.debug(`npm ${i.join(" ")} (in ${r})`),(0,Rb.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:r,env:o,stdio:"inherit"})}function nr(e){if(!e)return null;let t=Ob.coerce(e);return t?t.major:null}function ao(e,t,r,n){let o=n?.exclude?Array.isArray(n.exclude)?n.exclude:[n.exclude]:[],i=Dr.basename(t);if(o.some(l=>i===l))return e.trace(`Skipping excluded: ${t}`),0;let s=$e.statSync(t,{throwIfNoEntry:!1});if(!s)return e.trace(`Source does not exist: ${t}`),0;if(s.isDirectory()){e.trace(`Copying directory: ${t} -> ${r}`);let l=$e.readdirSync(t),c=0;for(let d of l)c+=ao(e,Dr.join(t,d),Dr.join(r,d),n);return c}let a=Dr.dirname(r);return $e.existsSync(a)||$e.mkdirSync(a,{recursive:!0}),e.trace(`Copying file: ${t} -> ${r}`),$e.copyFileSync(t,r),1}function ht(e){return $e.existsSync(e)}function _t(...e){for(let t of e)if($e.existsSync(t))return t;return e[0]??""}async function kr(e,t,r,n){if(!$e.existsSync(t))throw new io(`Template not found: ${t}`,{configFile:t});let o=$e.readFileSync(t,"utf8");e.debug(`envsubst: ${t} -> ${r}`);let i=n||process.env,s=o.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(l,c)=>i[c]??"").replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(l,c)=>i[c]??""),a=Dr.dirname(r);$e.existsSync(a)||$e.mkdirSync(a,{recursive:!0}),$e.writeFileSync(r,s)}function br(e,t,r,n){for(let o of n){let i=Dr.join(t,`${r}.${o}`);if($e.existsSync(i)){let s=Dr.join(t,`clouduser.${r}.${o}`);return e.info(`Renaming user config: ${r}.${o} -> clouduser.${r}.${o}`),$e.renameSync(i,s),s}}return null}var xf=_t(yt.join(__dirname,"templates","astro","v5"),yt.join(__dirname,"templates","v5")),Pb=_t(yt.join(__dirname,"templates","astro"),yt.join(__dirname,"templates")),lo=class extends gt{static frameworkName="astro";get info(){return{name:"astro",version:"5.x",displayName:"Astro 5"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return n==="astro"?{detected:!0,reason:"Specified as astro in webflow.json"}:{detected:!1};let i=nr(o);return i!==null&&i>=6?{detected:!1}:{detected:!0,reason:`Found astro@${o}`}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Dn(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new ke("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^5.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new ke('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=nr(o);if(i!==null&&i>=6)throw new ke(`Astro ${i}.x detected but was routed to the Astro 5 builder. This is an internal error.`,{remediation:"Ensure your package.json has astro@^6.0.0 - the Astro 6 builder will be used automatically. If this persists, please report the issue."});t.info(`Validated Astro project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^12.0.0"}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^4.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();this.hasDependency(n.name)||(t.warn(`Installing ${n.name}@${n.version} (required for Cloudflare deployment)...`),await Ye({log:t,cwd:r,args:["install","--save",`${n.name}@${n.version}`]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ye({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:yt.join(xf,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return yt.join(xf,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,yt.join(Pb,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;br(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Qs.writeFileSync(yt.join(r,"clouduser.astro.config.mjs"),`export default {};
128
- `));let i=yt.join(Pb,"astro.config.webflow.ts");ht(i)&&(t.info("Copying astro.config.webflow.ts..."),Qs.copyFileSync(i,yt.join(r,"astro.config.webflow.ts")));let s=yt.join(xf,"astro.config.mjs.template"),a=yt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await kr(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();ht(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Qs.copyFileSync(l.templatePath,yt.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist",staticAssetsExclude:["_worker.js"],workerEntryPath:"dist/_worker.js/index.js",deploymentType:"ssr",dryRunEntryPath:"./index.js"}}};var wt=D(require("path")),ea=D(require("fs"));var Cf=_t(wt.join(__dirname,"templates","astro","v6"),wt.join(__dirname,"templates","v6")),$b=_t(wt.join(__dirname,"templates","astro"),wt.join(__dirname,"templates")),co=class extends gt{static frameworkName="astro";get info(){return{name:"astro",version:"6.x",displayName:"Astro 6"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=nr(o);return i!==null&&i>=7?{detected:!1}:i!==null&&i>=6?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Dn(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new ke("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^6.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new ke('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=nr(o);if(i!==null&&i<6)throw new ke(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro5Builder for Astro 5.x, or upgrade: npm install astro@^6.0.0"});if(i!==null&&i>=7)throw new ke(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro7Builder for Astro 7.x, or downgrade: npm install astro@^6.0.0"});t.info(`Validated Astro 6 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^13.0.0",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^5.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();if(this.hasDependency(n.name)||(t.warn(`Installing ${n.name}@${n.version} (required for Cloudflare deployment)...`),await Ye({log:t,cwd:r,args:["install","--save",`${n.name}@${n.version}`]})),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await Ye({log:t,cwd:r,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ye({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:wt.join(Cf,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return wt.join(Cf,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,wt.join($b,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;br(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),ea.writeFileSync(wt.join(r,"clouduser.astro.config.mjs"),`export default {};
129
- `));let i=wt.join($b,"astro.config.webflow.ts");ht(i)&&(t.info("Copying astro.config.webflow.ts..."),ea.copyFileSync(i,wt.join(r,"astro.config.webflow.ts")));let s=wt.join(Cf,"astro.config.mjs.template"),a=wt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await kr(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();ht(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),ea.copyFileSync(l.templatePath,wt.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}};var Dt=D(require("path")),ta=D(require("fs"));var _f=_t(Dt.join(__dirname,"templates","astro","v7"),Dt.join(__dirname,"templates","v7")),Lb=_t(Dt.join(__dirname,"templates","astro"),Dt.join(__dirname,"templates")),Di=class extends gt{static frameworkName="astro";get info(){return{name:"astro",version:"7.x",displayName:"Astro 7"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=nr(o);return i!==null&&i>=7?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Dn(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new ke("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^7.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new ke('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=nr(o);if(i!==null&&i<7)throw new ke(`Astro ${i}.x detected but Astro7Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro6Builder for Astro 6.x, or upgrade: npm install astro@^7.0.0"});t.info(`Validated Astro 7 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^14.1.0",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^6.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();if(this.hasDependency(n.name)||(t.warn(`Installing ${n.name}@${n.version} (required for Cloudflare deployment)...`),await Ye({log:t,cwd:r,args:["install","--save",`${n.name}@${n.version}`]})),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await Ye({log:t,cwd:r,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ye({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:Dt.join(_f,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return Dt.join(_f,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Dt.join(Lb,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;br(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),ta.writeFileSync(Dt.join(r,"clouduser.astro.config.mjs"),`export default {};
130
- `));let i=Dt.join(Lb,"astro.config.webflow.ts");ht(i)&&(t.info("Copying astro.config.webflow.ts..."),ta.copyFileSync(i,Dt.join(r,"astro.config.webflow.ts")));let s=Dt.join(_f,"astro.config.mjs.template"),a=Dt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await kr(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();ht(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),ta.copyFileSync(l.templatePath,Dt.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}};var Ne=D(require("path")),Gt=D(require("fs"));var ki=_t(Ne.join(__dirname,"templates","nextjs"),Ne.join(__dirname,"templates")),bi=class extends gt{static frameworkName="nextjs";get info(){return{name:"nextjs",version:"*",displayName:"Next.js"}}static detect(t,r){let n=r?.cloud?.framework;return n==="nextjs"?{detected:!0,reason:"Specified as nextjs in webflow.json"}:n&&n!=="nextjs"?{detected:!1}:t.dependencies?.next!==void 0||t.devDependencies?.next!==void 0?{detected:!0,reason:'Found "next" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=r.dependencies?.next||r.devDependencies?.next;if(!n)throw new ke("Next.js is not installed in this project.",{remediation:"Install Next.js by running: npm install next",documentationUrl:"https://nextjs.org/docs/getting-started/installation"});t.info(`Validated Next.js project: next@${n}`)}getCloudflareAdapter(){return{name:"@opennextjs/cloudflare",version:"*"}}getRequiredIntegrations(){return[]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();this.hasDependency(n.name)||(t.warn("nextjs integration requires @opennextjs/cloudflare and this project doesn't have it. installing now..."),await Ye({log:t,cwd:r,args:["install","--save",n.name]}))}getWebflowLoader(){return{templatePath:Ne.join(ki,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["next.config.mjs","next.config.cjs","next.config.js","next.config.ts"]}getWranglerTemplatePath(){return Ne.join(ki,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Ne.join(ki,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(Gt.existsSync(Ne.join(this.cwd,t)))return t}ensureOpenNextConfig(t){let{log:r,cwd:n}=this.ctx,o=this.findOpenNextConfig();if(o){r.info(`${o} found, skipping creation (opennextjs-cloudflare will validate)`);return}if(r.info("open-next.config not found, creating open-next.config.ts with default Webflow Cloud configuration..."),!Gt.existsSync(t))throw new io(`open-next.config.ts template not found at ${t}. This is a Webflow Cloud build system error.`,{configFile:t});let i=Ne.join(n,"open-next.config.ts");Gt.copyFileSync(t,i),r.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=br(t,r,"next.config",["mjs","cjs","js","ts"]);o===null?(t.info("no user next.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.next.config.ts stub"),Gt.writeFileSync(Ne.join(r,"clouduser.next.config.ts"),`export default {};
131
- `)):Ne.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${Ne.basename(o)}`),Gt.writeFileSync(Ne.join(r,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
127
+ nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var lu=w(require("fs")),jE=w(require("path"));var ME=j.object({name:j.string().optional(),version:j.string().optional(),dependencies:j.record(j.string()).optional(),devDependencies:j.record(j.string()).optional()});function Ca(e){let t=jE.default.join(e,"package.json");if(!lu.statSync(t,{throwIfNoEntry:!1}))return;let n=lu.readFileSync(t).toString("utf8"),r;try{r=JSON.parse(n)}catch(o){throw new Fe("package.json was not valid JSON",{cause:o})}try{return ME.parse(r)}catch(o){throw new Fe("package.json schema validation failed",{cause:o})}}var cu=w(require("fs")),BE=w(require("path"));var uu=j.object({cloud:j.object({contract_version:j.string().optional(),framework:j.string().optional(),framework_version:j.string().optional(),entrypoint_path:j.string().optional(),deployment_type:j.enum(["spa","ssg","ssr","ssr-spa-combo","static"]).optional(),skip_no_bundle:j.boolean().optional(),assets_path_prefix:j.string().optional(),assets_source_skip_mount_path:j.boolean().optional()}).passthrough().optional()}).passthrough();function Vi(e,t,n="webflow.json"){let r=BE.default.join(t,n);if(!cu.statSync(r,{throwIfNoEntry:!1}))return n.endsWith(".json")?Vi(e,t,n+"c"):void 0;let o=cu.readFileSync(r).toString("utf8"),i;try{i=xo(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${r} ${JSON.stringify(o)}: ${s}`);return}try{let s=uu.parse(i);return e.debug(`loaded ${r}: ${JSON.stringify(s)}`),s}catch(s){e?.error(`${r} was valid JSON but schema validation failed: ${s}`);return}}var UE=require("child_process"),WE=["--no-update-notifier","--no-progress","--no-audit","--no-fund"];async function Qe(e){let{log:t,cwd:n,args:r}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...WE,...r];t.debug(`npm ${i.join(" ")} (in ${n})`),(0,UE.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:n,env:o,stdio:"inherit"})}function ln(e){if(!e)return null;let t=HE.coerce(e);return t?t.major:null}function Pr(e,t,n,r){let o=r?.exclude?Array.isArray(r.exclude)?r.exclude:[r.exclude]:[],i=_n.basename(t);if(o.some(c=>i===c))return e.trace(`Skipping excluded: ${t}`),0;if(r?.excludeFn?.(i))return e.trace(`Skipping excluded (predicate): ${t}`),0;let s=r?.followSymlinks!==!1,a=s?$e.statSync(t,{throwIfNoEntry:!1}):$e.lstatSync(t,{throwIfNoEntry:!1});if(!a)return e.trace(`Source does not exist: ${t}`),0;if(!s&&a.isSymbolicLink())return e.trace(`Skipping symlink: ${t}`),0;if(a.isDirectory()){e.trace(`Copying directory: ${t} -> ${n}`);let c=$e.readdirSync(t),d=0;for(let p of c)d+=Pr(e,_n.join(t,p),_n.join(n,p),r);return d}let l=_n.dirname(n);return $e.existsSync(l)||$e.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${n}`),$e.copyFileSync(t,n),1}function kt(e){return $e.existsSync(e)}function ht(...e){for(let t of e)if($e.existsSync(t))return t;return e[0]??""}async function An(e,t,n,r){if(!$e.existsSync(t))throw new Co(`Template not found: ${t}`,{configFile:t});let o=$e.readFileSync(t,"utf8");e.debug(`envsubst: ${t} -> ${n}`);let i=r||process.env,s=o.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(l,c)=>i[c]??"").replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(l,c)=>i[c]??""),a=_n.dirname(n);$e.existsSync(a)||$e.mkdirSync(a,{recursive:!0}),$e.writeFileSync(n,s)}function In(e,t,n,r){for(let o of r){let i=_n.join(t,`${n}.${o}`);if($e.existsSync(i)){let s=_n.join(t,`clouduser.${n}.${o}`);return e.info(`Renaming user config: ${n}.${o} -> clouduser.${n}.${o}`),$e.renameSync(i,s),s}}return null}var Dm=ht(Et.join(__dirname,"templates","astro","v5"),Et.join(__dirname,"templates","v5")),VE=ht(Et.join(__dirname,"templates","astro"),Et.join(__dirname,"templates")),_o=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"5.x",displayName:"Astro 5"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return r==="astro"?{detected:!0,reason:"Specified as astro in webflow.json"}:{detected:!1};let i=ln(o);return i!==null&&i>=6?{detected:!1}:{detected:!0,reason:`Found astro@${o}`}}async validate(){let{log:t,packageJson:n}=this.ctx,r=this.getNodeVersionRequirement();r&&Tr(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Fe("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^5.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Fe('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=ln(o);if(i!==null&&i>=6)throw new Fe(`Astro ${i}.x detected but was routed to the Astro 5 builder. This is an internal error.`,{remediation:"Ensure your package.json has astro@^6.0.0 - the Astro 6 builder will be used automatically. If this persists, please report the issue."});t.info(`Validated Astro project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^12.0.0"}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^4.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:n}=this.ctx,r=this.getCloudflareAdapter();this.hasDependency(r.name)||(t.warn(`Installing ${r.name}@${r.version} (required for Cloudflare deployment)...`),await Qe({log:t,cwd:n,args:["install","--save",`${r.name}@${r.version}`]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Qe({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:Et.join(Dm,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return Et.join(Dm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Et.join(VE,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;In(t,n,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Fa.writeFileSync(Et.join(n,"clouduser.astro.config.mjs"),`export default {};
128
+ `));let i=Et.join(VE,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),Fa.copyFileSync(i,Et.join(n,"astro.config.webflow.ts")));let s=Et.join(Dm,"astro.config.mjs.template"),a=Et.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await An(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Fa.copyFileSync(l.templatePath,Et.join(n,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist",staticAssetsExclude:["_worker.js"],workerEntryPath:"dist/_worker.js/index.js",deploymentType:"ssr",dryRunEntryPath:"./index.js"}}};var vt=w(require("path")),_a=w(require("fs"));var bm=ht(vt.join(__dirname,"templates","astro","v6"),vt.join(__dirname,"templates","v6")),GE=ht(vt.join(__dirname,"templates","astro"),vt.join(__dirname,"templates")),Ao=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"6.x",displayName:"Astro 6"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=ln(o);return i!==null&&i>=7?{detected:!1}:i!==null&&i>=6?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:n}=this.ctx,r=this.getNodeVersionRequirement();r&&Tr(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Fe("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^6.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Fe('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=ln(o);if(i!==null&&i<6)throw new Fe(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro5Builder for Astro 5.x, or upgrade: npm install astro@^6.0.0"});if(i!==null&&i>=7)throw new Fe(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro7Builder for Astro 7.x, or downgrade: npm install astro@^6.0.0"});t.info(`Validated Astro 6 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^13.0.0",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^5.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:n}=this.ctx,r=this.getCloudflareAdapter();if(this.hasDependency(r.name)||(t.warn(`Installing ${r.name}@${r.version} (required for Cloudflare deployment)...`),await Qe({log:t,cwd:n,args:["install","--save",`${r.name}@${r.version}`]})),r.peerDependencies)for(let o of r.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${r.name})...`),await Qe({log:t,cwd:n,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Qe({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:vt.join(bm,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return vt.join(bm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,vt.join(GE,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;In(t,n,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),_a.writeFileSync(vt.join(n,"clouduser.astro.config.mjs"),`export default {};
129
+ `));let i=vt.join(GE,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),_a.copyFileSync(i,vt.join(n,"astro.config.webflow.ts")));let s=vt.join(bm,"astro.config.mjs.template"),a=vt.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await An(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),_a.copyFileSync(l.templatePath,vt.join(n,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}};var St=w(require("path")),Aa=w(require("fs"));var km=ht(St.join(__dirname,"templates","astro","v7"),St.join(__dirname,"templates","v7")),JE=ht(St.join(__dirname,"templates","astro"),St.join(__dirname,"templates")),Gi=class extends pt{static frameworkName="astro";get info(){return{name:"astro",version:"7.x",displayName:"Astro 7"}}static detect(t,n){let r=n?.cloud?.framework;if(r&&r!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=ln(o);return i!==null&&i>=7?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:n}=this.ctx,r=this.getNodeVersionRequirement();r&&Tr(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Fe("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^7.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Fe('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=ln(o);if(i!==null&&i<7)throw new Fe(`Astro ${i}.x detected but Astro7Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro6Builder for Astro 6.x, or upgrade: npm install astro@^7.0.0"});t.info(`Validated Astro 7 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^14.1.0",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^6.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:n}=this.ctx,r=this.getCloudflareAdapter();if(this.hasDependency(r.name)||(t.warn(`Installing ${r.name}@${r.version} (required for Cloudflare deployment)...`),await Qe({log:t,cwd:n,args:["install","--save",`${r.name}@${r.version}`]})),r.peerDependencies)for(let o of r.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${r.name})...`),await Qe({log:t,cwd:n,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Qe({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:St.join(km,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return St.join(km,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,St.join(JE,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;In(t,n,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Aa.writeFileSync(St.join(n,"clouduser.astro.config.mjs"),`export default {};
130
+ `));let i=St.join(JE,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),Aa.copyFileSync(i,St.join(n,"astro.config.webflow.ts")));let s=St.join(km,"astro.config.mjs.template"),a=St.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await An(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Aa.copyFileSync(l.templatePath,St.join(n,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}};var Ve=w(require("path")),zt=w(require("fs"));var Ji=ht(Ve.join(__dirname,"templates","nextjs"),Ve.join(__dirname,"templates")),Ki=class extends pt{static frameworkName="nextjs";get info(){return{name:"nextjs",version:"*",displayName:"Next.js"}}static detect(t,n){let r=n?.cloud?.framework;return r==="nextjs"?{detected:!0,reason:"Specified as nextjs in webflow.json"}:r&&r!=="nextjs"?{detected:!1}:t.dependencies?.next!==void 0||t.devDependencies?.next!==void 0?{detected:!0,reason:'Found "next" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:n}=this.ctx,r=n.dependencies?.next||n.devDependencies?.next;if(!r)throw new Fe("Next.js is not installed in this project.",{remediation:"Install Next.js by running: npm install next",documentationUrl:"https://nextjs.org/docs/getting-started/installation"});t.info(`Validated Next.js project: next@${r}`)}getCloudflareAdapter(){return{name:"@opennextjs/cloudflare",version:"*"}}getRequiredIntegrations(){return[]}async installDependencies(){let{log:t,cwd:n}=this.ctx,r=this.getCloudflareAdapter();this.hasDependency(r.name)||(t.warn("nextjs integration requires @opennextjs/cloudflare and this project doesn't have it. installing now..."),await Qe({log:t,cwd:n,args:["install","--save",r.name]}))}getWebflowLoader(){return{templatePath:Ve.join(Ji,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["next.config.mjs","next.config.cjs","next.config.js","next.config.ts"]}getWranglerTemplatePath(){return Ve.join(Ji,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Ve.join(Ji,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(zt.existsSync(Ve.join(this.cwd,t)))return t}ensureOpenNextConfig(t){let{log:n,cwd:r}=this.ctx,o=this.findOpenNextConfig();if(o){n.info(`${o} found, skipping creation (opennextjs-cloudflare will validate)`);return}if(n.info("open-next.config not found, creating open-next.config.ts with default Webflow Cloud configuration..."),!zt.existsSync(t))throw new Co(`open-next.config.ts template not found at ${t}. This is a Webflow Cloud build system error.`,{configFile:t});let i=Ve.join(r,"open-next.config.ts");zt.copyFileSync(t,i),n.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=In(t,n,"next.config",["mjs","cjs","js","ts"]);o===null?(t.info("no user next.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.next.config.ts stub"),zt.writeFileSync(Ve.join(n,"clouduser.next.config.ts"),`export default {};
131
+ `)):Ve.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${Ve.basename(o)}`),zt.writeFileSync(Ve.join(n,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
132
132
  declare const config: UserNextConfig;
133
133
  export default config;
134
- `));let i=Ne.join(ki,"next.config.webflow.ts");ht(i)&&(t.info("Copying next.config.webflow.ts..."),Gt.copyFileSync(i,Ne.join(r,"next.config.webflow.ts")));let s=Ne.join(ki,"next.config.ts.template"),a=Ne.join(r,"next.config.ts");t.info("Generating next.config.ts from template..."),await kr(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();ht(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Gt.copyFileSync(l.templatePath,Ne.join(r,l.destinationName)));let c=Ne.join(ki,"open-next.config.ts");this.ensureOpenNextConfig(c)}getBuildCommand(){return"opennextjs-cloudflare build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("next")}static getOutputDeployMetadata(){return{staticAssetsPath:".open-next/assets",workerEntryPath:".open-next/worker.js",deploymentType:"ssr",dryRunEntryPath:"./worker.js"}}static detectFromBuiltOutput(t){return Gt.statSync(Ne.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}};var Ft=D(require("path")),Kt=D(require("fs"));var Fc=_t(Ft.join(__dirname,"templates","vite"),Ft.join(__dirname,"templates")),Ei=class extends gt{static frameworkName="vite";get info(){return{name:"vite",version:"6.x",displayName:"Vite"}}static detect(t,r){let n=r?.cloud?.framework;return n==="vite"?{detected:!0,reason:"Specified as vite in webflow.json"}:n&&n!=="vite"?{detected:!1}:t.dependencies?.vite!==void 0||t.devDependencies?.vite!==void 0?{detected:!0,reason:'Found "vite" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=r.dependencies?.vite||r.devDependencies?.vite;if(!n)throw new ke("Vite is not installed in this project.",{remediation:"Install Vite by running: npm install vite",documentationUrl:"https://vitejs.dev/guide/"});t.info(`Validated Vite project: vite@${n}`)}getCloudflareAdapter(){return{name:"@cloudflare/vite-plugin",version:"*"}}getRequiredIntegrations(){return[{name:"@cloudflare/workers-types",version:"*",dev:!0}]}async installDependencies(){let{log:t,cwd:r,packageJson:n}=this.ctx,o=n.devDependencies?.vite||n.dependencies?.vite||"",i=nr(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await Ye({log:t,cwd:r,args:["install","--save-dev","vite@^6.1.0"]}));let s=this.getCloudflareAdapter();this.hasDependency(s.name)||(t.warn("Vite integration requires @cloudflare/vite-plugin, installing now..."),await Ye({log:t,cwd:r,args:["install","--save",s.name]}));let a=this.getRequiredIntegrations();for(let l of a)if(!this.hasDependency(l.name)){t.info(`Installing ${l.name}...`);let c=l.dev?["install","--save-dev",l.name]:["install","--save",l.name];await Ye({log:t,cwd:r,args:c})}}getWebflowLoader(){return null}getUserConfigPatterns(){return["vite.config.mjs","vite.config.cjs","vite.config.js","vite.config.ts"]}getWranglerTemplatePath(){return Ft.join(Fc,"wrangler.json")}getAdditionalConfigFiles(){return[Ft.join(Fc,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:r}=this.ctx;for(let n of["wrangler.json","wrangler.jsonc"]){let o=Ft.join(r,n);if(Kt.existsSync(o)){try{let i=Kt.readFileSync(o,"utf8"),s=oo(i);if(s?.main&&s.main!=="./src/worker.ts")return t.info(`user-provided ${n} has custom main entrypoint "${s.main}", will preserve user's worker`),!0}catch(i){t.warn(`failed to parse ${n}: ${i}`)}break}}return!1}ensureWorkerEntry(){let{log:t,cwd:r}=this.ctx,n=Ft.join(r,"src","worker.ts");if(Kt.existsSync(n)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),Kt.mkdirSync(Ft.join(r,"src"),{recursive:!0}),Kt.writeFileSync(n,`/// <reference types="@cloudflare/workers-types" />
134
+ `));let i=Ve.join(Ji,"next.config.webflow.ts");kt(i)&&(t.info("Copying next.config.webflow.ts..."),zt.copyFileSync(i,Ve.join(n,"next.config.webflow.ts")));let s=Ve.join(Ji,"next.config.ts.template"),a=Ve.join(n,"next.config.ts");t.info("Generating next.config.ts from template..."),await An(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),zt.copyFileSync(l.templatePath,Ve.join(n,l.destinationName)));let c=Ve.join(Ji,"open-next.config.ts");this.ensureOpenNextConfig(c)}getBuildCommand(){return"opennextjs-cloudflare build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("next")}static getOutputDeployMetadata(){return{staticAssetsPath:".open-next/assets",workerEntryPath:".open-next/worker.js",deploymentType:"ssr",dryRunEntryPath:"./worker.js"}}static detectFromBuiltOutput(t){return zt.statSync(Ve.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}};var Rt=w(require("path")),qt=w(require("fs"));var du=ht(Rt.join(__dirname,"templates","vite"),Rt.join(__dirname,"templates")),zi=class extends pt{static frameworkName="vite";get info(){return{name:"vite",version:"6.x",displayName:"Vite"}}static detect(t,n){let r=n?.cloud?.framework;return r==="vite"?{detected:!0,reason:"Specified as vite in webflow.json"}:r&&r!=="vite"?{detected:!1}:t.dependencies?.vite!==void 0||t.devDependencies?.vite!==void 0?{detected:!0,reason:'Found "vite" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:n}=this.ctx,r=n.dependencies?.vite||n.devDependencies?.vite;if(!r)throw new Fe("Vite is not installed in this project.",{remediation:"Install Vite by running: npm install vite",documentationUrl:"https://vitejs.dev/guide/"});t.info(`Validated Vite project: vite@${r}`)}getCloudflareAdapter(){return{name:"@cloudflare/vite-plugin",version:"*"}}getRequiredIntegrations(){return[{name:"@cloudflare/workers-types",version:"*",dev:!0}]}async installDependencies(){let{log:t,cwd:n,packageJson:r}=this.ctx,o=r.devDependencies?.vite||r.dependencies?.vite||"",i=ln(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await Qe({log:t,cwd:n,args:["install","--save-dev","vite@^6.1.0"]}));let s=this.getCloudflareAdapter();this.hasDependency(s.name)||(t.warn("Vite integration requires @cloudflare/vite-plugin, installing now..."),await Qe({log:t,cwd:n,args:["install","--save",s.name]}));let a=this.getRequiredIntegrations();for(let l of a)if(!this.hasDependency(l.name)){t.info(`Installing ${l.name}...`);let c=l.dev?["install","--save-dev",l.name]:["install","--save",l.name];await Qe({log:t,cwd:n,args:c})}}getWebflowLoader(){return null}getUserConfigPatterns(){return["vite.config.mjs","vite.config.cjs","vite.config.js","vite.config.ts"]}getWranglerTemplatePath(){return Rt.join(du,"wrangler.json")}getAdditionalConfigFiles(){return[Rt.join(du,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:n}=this.ctx;for(let r of["wrangler.json","wrangler.jsonc"]){let o=Rt.join(n,r);if(qt.existsSync(o)){try{let i=qt.readFileSync(o,"utf8"),s=xo(i);if(s?.main&&s.main!=="./src/worker.ts")return t.info(`user-provided ${r} has custom main entrypoint "${s.main}", will preserve user's worker`),!0}catch(i){t.warn(`failed to parse ${r}: ${i}`)}break}}return!1}ensureWorkerEntry(){let{log:t,cwd:n}=this.ctx,r=Rt.join(n,"src","worker.ts");if(qt.existsSync(r)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),qt.mkdirSync(Rt.join(n,"src"),{recursive:!0}),qt.writeFileSync(r,`/// <reference types="@cloudflare/workers-types" />
135
135
 
136
136
  interface Env {
137
137
  ASSETS: Fetcher;
@@ -142,143 +142,155 @@ export default {
142
142
  return env.ASSETS.fetch(request);
143
143
  },
144
144
  } satisfies ExportedHandler<Env>;
145
- `)}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=this.hasCustomWorkerEntry();br(t,r,"vite.config",["mjs","cjs","js","ts"])===null&&(t.info("no user vite.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.vite.config.ts stub"),Kt.writeFileSync(Ft.join(r,"clouduser.vite.config.ts"),`export default {};
146
- `));let s=Ft.join(Fc,"vite.config.webflow.ts");ht(s)&&(t.info("Copying vite.config.webflow.ts..."),Kt.copyFileSync(s,Ft.join(r,"vite.config.webflow.ts")));let a=Ft.join(Fc,"vite.config.ts.template"),l=Ft.join(r,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await kr(t,a,l,{...process.env,...n}),o||this.ensureWorkerEntry()}getBuildCommand(){return"vite build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("vite")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"./src/worker.ts",deploymentType:"ssr-spa-combo",usesAssetsBinding:!0}}};var Nb=[Di,co,lo,bi,Ei],ra=["astro","nextjs","vite"];function Ac(e,t){for(let r of Nb){let n=r.detect(e,t);if(n.detected)return{Builder:r,result:n}}return null}function Ff(e,t){let r=Ac(e.packageJson,t);if(!r)throw new wn("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${ra.join(", ")})`});return e.log.info(`Detected framework: ${r.result.reason}`),new r.Builder(e)}function Af(e,t,r,n){let o=jb.join(t,"webflow.json"),i={cloud:{}};if(vi.existsSync(o))try{let a=vi.readFileSync(o,"utf8"),l=JSON.parse(a),c=_c.safeParse(l);if(c.success)i=c.data;else{let d=c.error.issues.map(p=>`${p.path.join(".")}: ${p.message}`).join(", ");e.warn(`webflow.json has schema issues (will be corrected): ${d}`),i=l}i.cloud||(e.warn('webflow.json is missing "cloud" property, adding it'),i.cloud={})}catch(a){e.warn(`Failed to parse existing webflow.json, overwriting: ${a}`)}let s=i.cloud;if(s.framework=r,n){let a=n.getOutputDeployMetadata();s.contract_version="1",s.deployment_type=a.deploymentType,s.entrypoint_path=a.dryRunEntryPath??"./index.js",s.skip_no_bundle=a.skipNoBundle===!0;let l=n.getFrameworkVersion();l&&(s.framework_version=l),a.assetsSourceSkipMountPath&&(s.assets_source_skip_mount_path=!0),(0,Mb.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${r}`),vi.writeFileSync(o,JSON.stringify(i,null,2))}function Bb(e,t){let r=wi(e,t);if(r?.cloud?.framework)return r.cloud.framework;let n=Zs(t);if(!n)throw new wn("Cannot detect framework: no package.json found",{remediation:'Run this command from your project root, or add a webflow.json with: { "cloud": { "framework": "<name>" } }'});e.info("webflow.json has no framework \u2014 detecting from package.json...");let o=Ac(n,r);if(!o)throw new wn("Could not detect framework from package.json or webflow.json",{remediation:'Add a webflow.json with: { "cloud": { "framework": "<name>" } } (supported: astro, nextjs, vite)'});let i=o.Builder.frameworkName;return e.info(`Detected framework: ${o.result.reason}`),Af(e,t,i),i}x();var Ub=$.object({name:$.string(),main:$.string().optional(),compatibility_date:$.string(),compatibility_flags:$.array($.string()).optional(),placement:$.object({mode:$.string()}).passthrough().optional(),assets:$.object({directory:$.string(),binding:$.string().optional()}).passthrough().optional(),d1_databases:$.array($.object({database_name:$.string(),database_id:$.string(),binding:$.string(),migrations_dir:$.string().optional()}).passthrough()).default([]),kv_namespaces:$.array($.object({binding:$.string(),id:$.string()}).passthrough()).default([]),r2_buckets:$.array($.object({binding:$.string(),bucket_name:$.string()}).passthrough()).default([])}).passthrough();function Wb(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
147
- `)}function Hb(e,t="wrangler.json"){let r=or.join(e,t);if(!lt.existsSync(r)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),Hb(e,t+"c");u.warn(`/${t} not found`);return}let n=lt.readFileSync(r,"utf8");u.info(`reading /${t}...`);let o;try{o=oo(n)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=Ub.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
148
- ${Wb(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function Vb(e,t){let r=null,n=null,o=or.join(t,"wrangler.json"),i=or.join(t,"wrangler.jsonc");lt.existsSync(o)?(r=o,n=".json"):lt.existsSync(i)&&(r=i,n=".jsonc"),r&&n&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${n}...`),lt.copyFileSync(r,or.join(t,`clouduser.wrangler${n}`)));let s=r?Hb(t,or.basename(r)):null,a=e.getWranglerTemplatePath(),l=or.join(t,"wrangler.json");if(!lt.existsSync(a))throw new Error(`Wrangler template not found at ${a}. Make sure the template is properly copied during build.`);if(u.info(`copying wrangler template for ${e.info.name} to /wrangler.json`),lt.copyFileSync(a,l),!s)return;let c=JSON.parse(lt.readFileSync(l,"utf8"));if(s.kv_namespaces&&s.kv_namespaces.length>0&&(c.kv_namespaces=s.kv_namespaces,u.info(`merged ${s.kv_namespaces.length} KV namespace(s) into template`)),s.r2_buckets&&s.r2_buckets.length>0&&(c.r2_buckets=s.r2_buckets,u.info(`merged ${s.r2_buckets.length} R2 bucket(s) into template`)),s.d1_databases&&s.d1_databases.length>0&&(c.d1_databases=s.d1_databases,u.info(`merged ${s.d1_databases.length} D1 database(s) into template`)),lt.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let d in s.d1_databases){let p=s.d1_databases[d];if(!p.migrations_dir){u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir is not defined`);continue}let h=p.migrations_dir,g=or.join(t,h);if(!lt.existsSync(g)){u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir (/${h}) does not exist`);continue}let m=or.join(t,"clouduser","migrations",h),w=ao(u,g,m);w>0?u.info(`copied ${w} migrations to /clouduser/migrations/${h}`):u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir (/${h}) is empty`)}}function hT(e){if(!/^[a-z0-9-]+$/.test(e))throw new Error(`Invalid object storage bucket name ${JSON.stringify(e)}: Only lowercase letters, numbers, and hyphens are allowed.`);if(e.startsWith("-")||e.endsWith("-"))throw new Error(`Invalid object storage bucket name "${e}": Cannot begin or end with a hyphen.`);if(e.length>27)throw new Error(`Invalid object storage bucket name "${e}": Must be 27 characters or fewer (currently ${e.length} characters).`)}function Gb(e){let t=null;for(let s of[".json",".jsonc"]){let a=or.join(e,`clouduser.wrangler${s}`);if(lt.existsSync(a)){t=a;break}}if(!t)return;let r=lt.readFileSync(t,"utf8"),n;try{n=oo(r)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=Ub.safeParse(n);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
149
- ${Wb(o.error)}`);let i=o.data;if(i.r2_buckets&&i.r2_buckets.length>0){u.info(`validating ${i.r2_buckets.length} object storage bucket name(s)...`);for(let s of i.r2_buckets)hT(s.bucket_name)}}x();S();N();de();var yT="4.82.1",Tc=60;function Vr(e,t){let r=Math.min(Tc,process.stdout.columns??Tc),n=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,r-n.length));u.info(`
150
- ${te(`${n}${o}`)}`)}function Tf(e,t){let r=Math.min(Tc,process.stdout.columns??Tc),n=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,r-n.length));u.info(`
151
- ${te(vt(`${n}${o}`))}`)}async function zb(e=process.cwd(),t,r,n){let o=Zs(e);if(!o)throw new Error("No package.json file found");let i=wi(u,e),s={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:DT(r)}:{}};return Ff({cwd:e,log:u,packageJson:o,userEnv:s},i)}async function Jb(e,t={}){let r=t.projectPath||process.cwd(),n=Date.now(),o=ce.join(r,".tmp",`webflow-build-${n}`),i=t.outputDir||ce.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=Rf(r),c=t.telemetry,d=e.getBuildCommand(),p=e.getOutputDeployMetadata();await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),X.mkdirSync(o,{recursive:!0});try{Vr("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${p.deploymentType}`);let h=e.getNodeVersionRequirement();h&&Dn(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),u.info("Installing framework dependencies..."),await e.installDependencies(),Vr("\u2699\uFE0F ","Configure wrangler"),await Vb(e,r),u.info("Preparing framework configuration..."),await e.prepareConfig(),Af(u,r,e.info.name,e),Vr("\u{1F4E6}","Install dependencies"),await wT(r,e.info.name,t.telemetry),Gb(r),Vr("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${d}...`),await kT(r,d,t.telemetry),await e.postBuild(),Vr("\u{1F9EA}","Wrangler dry-run"),await bT(r,i),Vr("\u{1F4C1}","Copy assets"),await ET(r,i,e,s),Vr("\u{1F381}","Create tarball");let g=await vT(i),m=Date.now()-a;return u.info(`${L} Build completed in ${(m/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:m,framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),g}catch(h){let g=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:g,framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function Rf(e){let t=ce.join(e,"wrangler.json");if(!X.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let r=JSON.parse(X.readFileSync(t,"utf8")),n=r.kv_namespaces||[],o=r.d1_databases||[],i=r.r2_buckets||[],s=r.vars||{};return{hasKV:n.length>0,hasD1:o.length>0,hasR2:i.length>0,hasVars:Object.keys(s).length>0,kvCount:n.length,d1Count:o.length,r2Count:i.length,varCount:Object.keys(s).length}}catch(r){return console.debug("Failed to parse wrangler.json for bindings detection:",r),{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0}}}function qb(e){try{let t=ce.dirname(e);t.includes(".tmp/webflow-build-")&&(Vr("\u{1F9F9}","Clean up build artifacts"),X.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function Yb(e,t){try{Vr("\u{1F9F9}","Revert framework configuration");let r=t.getUserConfigPatterns(),n=new Set;for(let s of r){let a=ce.extname(s).slice(1),l=ce.basename(s,`.${a}`);if(!n.has(l)){n.add(l);for(let c of["mjs","cjs","js","ts"]){let d=ce.join(e,`clouduser.${l}.${c}`),p=ce.join(e,`${l}.${c}`);if(X.existsSync(d)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),X.existsSync(p)&&X.unlinkSync(p),X.renameSync(d,p);break}}}}for(let s of[".jsonc",".json"]){let a=ce.join(e,`clouduser.wrangler${s}`);if(X.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=ce.join(e,"wrangler.json");X.existsSync(l)&&X.unlinkSync(l);let c=ce.join(e,`wrangler${s}`);X.renameSync(a,c);break}}let o=ce.join(e,"clouduser");X.existsSync(o)&&(u.info("cleaning up clouduser directory..."),X.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=ce.join(e,ce.basename(s));X.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),X.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=ce.join(e,i.destinationName);X.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),X.unlinkSync(s))}}catch(r){u.warn(`Warning: Failed to cleanup framework configuration: ${r}`)}}async function wT(e,t,r){let n=Date.now(),o=["--no-update-notifier","--no-progress"],i=ce.join(e,"package-lock.json");try{X.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,na.execSync)(`npm ci --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"})):(u.info("Warning: No package-lock.json found, installing dependencies with npm install --include=dev"),(0,na.execSync)(`npm install --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"}));let s=Date.now()-n;await r?.sendUsage("cloud_install_dependencies_success",{duration:s,framework:t,hasPackageLock:X.existsSync(i)})}catch(s){let a=Date.now()-n;throw await r?.sendError(s instanceof Error?s:new Error(String(s)),"cloud_install_dependencies_failure",{duration:a,framework:t,hasPackageLock:X.existsSync(i)}),s}}function DT(e){let t="production",r;switch(t){case"development":r="wf-app-dev";break;case"acceptance":r="wf-app-acceptance";break;default:r="wf-app-prod"}return`https://${e}.${r}.cosmic.webflow.services`}async function kT(e,t,r){let n=Date.now();try{(0,na.execSync)(`npm exec -- ${t}`,{cwd:e,stdio:"inherit"});let o=Date.now()-n;await r?.sendUsage("cloud_build_command_success",{duration:o,buildCommand:t})}catch(o){let i=Date.now()-n;throw await r?.sendError(o instanceof Error?o:new Error(String(o)),"cloud_build_command_failure",{duration:i,buildCommand:t}),new Error(`Build command failed: ${t}`)}}async function bT(e,t){X.mkdirSync(t,{recursive:!0});let r=ce.join(e,"wrangler.json"),n=ce.join(e,"wrangler.jsonc");if(!X.existsSync(r)&&!X.existsSync(n))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,na.execSync)(`npx wrangler@${yT} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}async function ET(e,t,r,n){let o=r.getOutputDeployMetadata(),i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=n.replace(/\/+$/,"").replace(/^\/+/,"");if(!a&&l&&(r.info.name==="nextjs"||r.info.name==="astro")){let g=ce.join(e,i);if(X.existsSync(g)&&X.statSync(g).isDirectory()){let w=X.readdirSync(g,{withFileTypes:!0}).find(k=>!(!k.isDirectory()||s&&k.name===s||r.info.name==="astro"&&(k.name==="_routes.json"||k.name==="_worker.js")));w&&(i=`${i}/${w.name}`)}}let c=ce.join(t,"assets",l||"");X.mkdirSync(c,{recursive:!0});let d=ce.join(e,i);if(X.existsSync(d)&&X.statSync(d).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),ao(u,d,c,{exclude:s})):ao(u,d,c)}catch(g){u.error(g,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");let p=ce.join(e,"webflow.json");X.existsSync(p)?(u.info("including webflow.json in output..."),X.copyFileSync(p,ce.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection");let h=null;for(let g of[".json",".jsonc"]){let m=ce.join(e,`clouduser.wrangler${g}`);if(X.existsSync(m)){h=m;break}}if(h){u.info("including user wrangler config in output..."),X.copyFileSync(h,ce.join(t,"clouduser.wrangler.json"));let g=ce.join(e,"clouduser","migrations");if(X.existsSync(g)){u.info("copying migrations from clouduser/migrations to output/migrations...");let m=ce.join(t,"migrations");ao(u,g,m)}}}async function vT(e){let t=`${e}.tar.gz`;try{return await Kb.create({gzip:!0,file:t,cwd:ce.dirname(e)},[ce.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(r){throw new f(r,{prefix:"Failed to create tarball:"})}}Me();ye();x();var ST="DUPLICATE_ENVIRONMENT_MOUNT",xT="ENVIRONMENT_MOUNT_MISMATCH",CT="DUPLICATE_ENVIRONMENT_BRANCH",_T="INVALID_MOUNT_PATH_FORMAT",FT="INVALID_PROJECT_ID",AT="DUPLICATE_PROJECT_NAME",TT="MAX_PROJECTS_PER_SITE",Xb={[ST]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[xT]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[CT]:"An environment with this branch already exists for this app.",[_T]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[FT]:"Invalid app ID. This app may have been deleted or belongs to a different site. Please remove the 'app_id' field (or the legacy 'project_id' field) from your webflow.json and redeploy to create a new app.",[AT]:"An app with this name already exists on this site, usually because 'app_id' is missing from your webflow.json. To deploy to the existing app, provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json \u2014 you can find the ID in the Webflow Cloud dashboard.",[TT]:"This site has reached its limit of Cloud apps, so no new app can be created. Deploy to one of its existing apps, or delete an app you no longer need from the Webflow Cloud dashboard."};function Zb(e){let t={timestamp:new Date().toISOString()};if(e instanceof Error)t.code=e.name,t.msg=e.message,t.stack=e.stack;else if(typeof e=="object"&&e!==null){let i=e;t.code=typeof i.code=="string"?i.code:void 0,t.msg=typeof i.msg=="string"?i.msg:void 0,t.status=typeof i.status=="number"?i.status:void 0}let r=t.msg||"",n=t.status??t.code,o=typeof n=="number"?n:typeof n=="string"&&/^\d+$/.test(n)?Number(n):void 0;if(u.error(`Error Details: ${JSON.stringify({timestamp:t.timestamp,code:t.code,message:t.msg,status:t.status,stack:t.stack},null,2)}`),o===401)return"Your access token is expired or invalid. Run 'webflow auth login' to re-authenticate.";if(o===403)return"Your access token is missing required permissions. Run 'webflow auth login' to re-authenticate with the necessary scopes.";for(let i in Xb)if(r.includes(i))return Xb[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var xi=D(require("fs")),Of=require("child_process"),tE=D(require("semver"));x();S();N();S();pe();x();S();function Si(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0})}var RT={siteId:{missingFlag:"siteId",flagHint:"--site",env:"WEBFLOW_SITE_ID",manifest:e=>e.siteId},appId:{missingFlag:"appId",flagHint:"--app-id",env:"WEBFLOW_APP_ID",manifest:e=>e.cloud?.app_id??e.cloud?.project_id},environmentId:{missingFlag:"environmentId",flagHint:"--environment-id",env:"WEBFLOW_APP_ENVIRONMENT_ID",manifest:e=>e.cloud?.environment_id},workspaceId:{missingFlag:"workspaceId",flagHint:"--workspace-id",env:"WEBFLOW_WORKSPACE_ID",manifest:e=>e.cloud?.workspace_id}};function If(e){return typeof e=="string"&&e.trim()!==""}async function uo(e,t={}){let r=RT[e],{flagValue:n,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??W(),l=t.json??ze();if(If(n))return Si(n,e),n;let c=process.env[r.env];if(If(c))return Si(c,e),c;let d=r.manifest(o??{});if(If(d))return l||u.info(`Using ${e} from webflow.json`),Si(d,e),d;if(!a&&s){let h=await s();return Si(h,e),h}let p=i??r.flagHint;throw new f(`Missing required ${e}. Pass ${p}, set ${r.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:r.missingFlag})}async function kn(e,t={}){try{return await uo(e,t)}catch(r){if(r instanceof f&&r.missingFlag===e)return;throw r}}S();var IT=/[\x00-\x1f?#%/\\]/;function bn(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0});if(IT.test(e)||e.includes(".."))throw new f(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function Ce(e,t){bn(e,t)}function OT(e){if(!e)return"unknown";let t=tE.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var Qb=104857600;function eE(e){if(e===0)return"0 B";let t=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,n)).toFixed(1))} ${r[n]}`}function PT(){try{let e=(0,Of.execSync)("git rev-parse HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(!/^[0-9a-f]{40}$/.test(e))throw new Error("Invalid commit hash format");try{return(0,Of.execSync)("git status --porcelain --untracked-files=no",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().length>0?`git@${e}+dirty`:`git@${e}`}catch{return`git@${e}`}}catch{return`noversion@${new Date().toISOString()}`}}async function Pf(e,t,r){let n=await fetch(`${I}${t}`,{method:r.method,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:r.body?JSON.stringify(r.body):void 0});if(!n.ok){let o=await n.text(),i;try{i=JSON.parse(o)}catch{i={msg:o}}let s=Zb(i);throw new Error(s)}return n.json()}async function rE(e,t,r,n){let{manifest:o}=Z(),i=o.cloud||{},s=i.framework,a=await kn("appId",{flagValue:n?.appId,manifest:o});if(!s)throw new f("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=OT(i.framework_version),c=await $T({siteId:e.siteId,apiToken:e.accessToken,framework:s,frameworkVersion:l,mountPath:r,environment:t,projectId:a,projectName:n?.projectName,description:n?.description,directory:n?.directory,version:PT()});return!a&&c.project_id&&(xe({cloud:{...i,app_id:c.project_id}}),u.info(`${L} App ID updated in webflow.json`)),c}async function $T(e){let{siteId:t,framework:r,frameworkVersion:n,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:d}=e,p={framework:r,framework_version:n,mount_path:o,environment:i,version:s};a&&(p.project_id=a),l&&(p.project_name=l),c&&(p.description=c),d&&(p.app_path=d);let h=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return Pf(e.apiToken,h,{method:"POST",body:p})}async function nE(e,t){let{siteId:r,accessToken:n}=e,o=r?`/cosmic/${r}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Pf(n,o,{method:"GET"})}async function oE(e){let{siteId:t,accessToken:r}=e,n=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Pf(r,n,{method:"GET"})}async function iE(e,t){if(!xi.existsSync(e))throw new Error(`Tarball not found at ${e}`);let r=xi.statSync(e);if(r.size>Qb)throw new Error(`Build output is too large (${eE(r.size)}). Maximum allowed size is ${eE(Qb)}.`);let n=xi.readFileSync(e),o=JSON.parse(t);if(!o.fields)throw new Error("Upload URL is missing fields property");let i=new FormData;Object.entries(o.fields).forEach(([l,c])=>{i.append(l,c)});let s=new Blob([n],{type:"application/gzip"});i.append("file",s,"output.tar.gz");let a=await fetch(o.url,{method:"POST",body:i});if(!a.ok){let l=await a.text();throw new f(l,{prefix:`${b} Upload failed with response:`})}}async function sE(e,t){if(!e||e==="undefined")throw new f("Completion URL is undefined or invalid");let r=new URL(e);t&&r.searchParams.set("failed","true");let n=await fetch(r.toString(),{method:"GET"});if(!n.ok)throw new f(`Failed to trigger deployment: ${n.status} ${n.statusText}`)}var aE=require("webflow-api");ye();ye();S();function $f(e){return new aE.WebflowClient({accessToken:e,environment:{base:`${I}/v2`,dataApi:`${I}/v2`,contentDeliveryApi:`${ll}/v2`}})}async function oa(e,t){try{let n=await $f(e).sites.get(t);return{id:n.id||t,displayName:n.displayName||"Unknown Site",shortName:n.shortName||"unknown-site",customDomains:n.customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new f(r,{prefix:"Error fetching site details:"})}}async function Lf(e,t){try{return{customDomains:(await $f(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new f(r,{prefix:"Error fetching custom domains:"})}}async function Nf(e){try{let t=await fetch(`https://${e}/manifest.json`);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);return await t.json()}catch(t){throw new f(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function jf(e,t,r){return e.cosmic&&Array.isArray(e.cosmic)?e.cosmic.some(n=>{if(n.mountPath!==t)return!1;if(!r)return!0;if(n.workerUrl)try{return new URL(n.workerUrl).hostname.split(".")[0]===r}catch{return!1}return!1}):!1}async function lE(e,t,r){try{let n=$f(e),o=await oa(e,t),i=[];if(r?.domains&&r.domains.length>0)for(let s of r.domains){let a=o.customDomains?.find(l=>l.url===s);a?.id&&i.push(a.id)}await n.sites.publish(t,{customDomains:i,publishToWebflowSubdomain:r?.publishToWebflowSubdomain??!0})}catch(n){throw new f(n,{prefix:"Error publishing site:"})}}Ae();x();async function cE(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)throw new Error("Site ID is required for mount path validation. Apps without a connected site skip this step.");let i=u.spinner("Validating mount path configuration");try{let s=await oa(o,n),a=await Lf(o,n),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(m=>m.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let d=l.map(async m=>{try{let w=await Nf(m),k=Array.isArray(w.cosmic)?w.cosmic.map(A=>A.mountPath).filter(A=>typeof A=="string"):[],F=jf(w,t,r);return{domain:m,mountPaths:k,isValid:F===!0}}catch(w){return{domain:m,mountPaths:[],isValid:!1,error:w instanceof Error?w.message:String(w)}}finally{c++,i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (${c}/${l.length})`)}}),p=await Promise.all(d),h=p.some(m=>!m.isValid),g=p.every(m=>m.isValid);return i.succeed("Mount path validation completed"),{isValid:g,domains:p,needsPublishing:h}}catch(s){throw i.fail("Mount path validation failed"),s}}async function uE(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)return[];try{let i=await oa(o,n),s=await Lf(o,n),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(d=>d.url)||[]].map(async d=>{try{let p=await Nf(d),h=jf(p,t,r);return{domain:d,isValid:h}}catch(p){return u.debug(`Could not verify mount path for ${d}: ${p}`),{domain:d,isValid:!1}}});return(await Promise.all(l)).filter(d=>d.isValid).map(d=>d.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function dE(e,t){return e.map(r=>`${r.startsWith("localhost")||r.startsWith("127.0.0.1")?"http":"https"}://${r}${t}`)}async function pE(e){let t=e.map(n=>({name:n,value:n,checked:!0})),r=await fr({message:"Select which domains you want to publish to update the mount path configuration:",choices:t,validate:n=>n.length===0?"Please select at least one domain to publish to.":!0});return r??[]}async function fE(){return await Pe({message:"The mount path doesn't match on some domains. Would you like to publish the site to update the configuration?",default:!0})}async function Mf(e,t){let{siteId:r,accessToken:n}=e;if(!r)throw new Error("Site ID is required to publish. Apps without a connected site do not use this.");let o=u.spinner(`Publishing site to ${t.length} domain(s)`);try{let s=`${(await oa(n,r)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await lE(n,r,{domains:l,publishToWebflowSubdomain:a}),o.succeed(`Site published successfully to selected domains: ${t.join(", ")}`)}catch{throw o.fail("Failed to publish site"),new Error("Failed to publish site")}}x();de();var po=D(require("path"));Me();ye();pe();var mE="apps";function Bf(e){mE=e}function Ci(){return mE}var Pc=D(require("fs"));S();ye();Ae();S();x();async function Rc(e){let t=await fetch(`${I}/v2/workspaces`,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){let n=await t.text(),o={};try{o=JSON.parse(n)}catch{}throw t.status===403&&o.code==="missing_scopes"?new f(`Missing required scopes for workspace access.
145
+ `)}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=this.hasCustomWorkerEntry();In(t,n,"vite.config",["mjs","cjs","js","ts"])===null&&(t.info("no user vite.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.vite.config.ts stub"),qt.writeFileSync(Rt.join(n,"clouduser.vite.config.ts"),`export default {};
146
+ `));let s=Rt.join(du,"vite.config.webflow.ts");kt(s)&&(t.info("Copying vite.config.webflow.ts..."),qt.copyFileSync(s,Rt.join(n,"vite.config.webflow.ts")));let a=Rt.join(du,"vite.config.ts.template"),l=Rt.join(n,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await An(t,a,l,{...process.env,...r}),o||this.ensureWorkerEntry()}getBuildCommand(){return"vite build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("vite")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"./src/worker.ts",deploymentType:"ssr-spa-combo",usesAssetsBinding:!0}}};var KE=w(require("fs")),Ia=w(require("path"));var hT=ht(Ia.join(__dirname,"templates","static"),Ia.join(__dirname,"templates")),Ra=["_headers","_redirects"],Em=["node_modules","package.json","package-lock.json","yarn.lock","pnpm-lock.yaml","webflow.json","webflow.jsonc","wrangler.json","wrangler.jsonc","wrangler.toml","clouduser.wrangler.json","clouduser","terraform.tfstate","terraform.tfstate.*","*.tfvars","auth.json","*.pem","*.key","*.pfx","*.p12","id_rsa","id_rsa.*","id_dsa","id_ecdsa","id_ed25519"];function yT(e,t){if(!t.includes("*"))return e===t;let n=t.split("*").map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${n}$`).test(e)}function Ta(e){return e===".well-known"?!1:e.startsWith(".")||Ra.includes(e)?!0:Em.some(t=>yT(e,t))}var wT=["requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","composer.json","composer.lock","auth.json","Gemfile","Gemfile.lock","config.ru","go.mod","go.sum","Cargo.toml","Cargo.lock","pom.xml","build.gradle","build.gradle.kts","deno.json","deno.jsonc","bun.lockb","mix.exs","Dockerfile","Procfile"],DT=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],bT=new Set([...wT,...DT]);function Pa(e){let t=[],n=(r,o)=>{let i;try{i=KE.readdirSync(r,{withFileTypes:!0})}catch{return}for(let s of i){let a=o?`${o}/${s.name}`:s.name;if(s.isSymbolicLink())continue;if(s.isDirectory()){Ta(s.name)||n(Ia.join(r,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||bT.has(s.name))&&t.push(a)}};return n(e,""),t}var cn=class extends pt{static frameworkName="static";get info(){return{name:"static",version:"n/a",displayName:"Static (HTML/CSS/JS)"}}static detect(t,n){return n?.cloud?.framework==="static"?{detected:!0,reason:"Specified as static in webflow.json"}:{detected:!1}}async validate(){let t=Pa(this.cwd);t.length>0&&this.log.warn(`static app declared, but build/runtime files are present (${t.join(", ")}); they will be published as static assets unless removed`),this.log.info("Static app: no framework, no dependencies, no build \u2014 nothing to validate")}async installDependencies(){}async prepareConfig(){}getBuildCommand(){return""}getCloudflareAdapter(){return null}getRequiredIntegrations(){return[]}getWebflowLoader(){return null}getNodeVersionRequirement(){return null}getWranglerTemplatePath(){return Ia.join(hT,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}};var XE=[Gi,Ao,_o,Ki,zi,cn],$a=["astro","nextjs","vite","static"];function pu(e,t){for(let n of XE){let r=n.detect(e,t);if(r.detected)return{Builder:n,result:r}}return null}function vm(e,t){let n=pu(e.packageJson,t);if(!n)throw new tr("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${$a.join(", ")})`});return e.log.info(`Detected framework: ${n.result.reason}`),new n.Builder(e)}function YE(e){let{hasPackageJson:t,specifiedFramework:n,hasRootIndexHtmlFile:r,hasRuntimeIndicators:o}=e;if(n==="static")return!0;let i=n!=null&&n!=="static";return!t&&!i&&r&&!o}function Oa(e,t,n){let r=n?.cloud?.framework,i=zE.lstatSync(qE.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Pa(e),a=YE({hasPackageJson:t!=null,specifiedFramework:r,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&r==null)throw new tr(`Found index.html but also build/runtime indicators (${s.join(", ")}); this is not a no-framework static app and will not be published as static assets.`,{remediation:'Remove those files, or declare a framework in webflow.json (e.g. { "cloud": { "framework": "static" } } to force static).'});return{isStatic:a}}function fu(e,t,n,r){let o=ZE.join(t,"webflow.json"),i={cloud:{}};if(qi.existsSync(o))try{let a=qi.readFileSync(o,"utf8"),l=JSON.parse(a),c=uu.safeParse(l);if(c.success)i=c.data;else{let d=c.error.issues.map(p=>`${p.path.join(".")}: ${p.message}`).join(", ");e.warn(`webflow.json has schema issues (will be corrected): ${d}`),i=l}i.cloud||(e.warn('webflow.json is missing "cloud" property, adding it'),i.cloud={})}catch(a){e.warn(`Failed to parse existing webflow.json, overwriting: ${a}`)}let s=i.cloud;if(s.framework=n,r){let a=r.getOutputDeployMetadata();s.contract_version="1",s.deployment_type=a.deploymentType,a.deploymentType!=="static"&&(s.entrypoint_path=a.dryRunEntryPath??"./index.js"),s.skip_no_bundle=a.skipNoBundle===!0;let l=r.getFrameworkVersion();l&&(s.framework_version=l),a.assetsSourceSkipMountPath&&(s.assets_source_skip_mount_path=!0),(0,QE.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${n}`),qi.writeFileSync(o,JSON.stringify(i,null,2))}function ev(e,t){let n=Vi(e,t);if(n?.cloud?.framework)return n.cloud.framework;let r=Ca(t),{isStatic:o}=Oa(t,r,n);if(o)return e.info("Detected static app (no framework, no build)"),fu(e,t,cn.frameworkName),cn.frameworkName;if(!r)throw new tr("Cannot detect framework: no package.json found",{remediation:'Run this command from your project root, or add a webflow.json with: { "cloud": { "framework": "<name>" } }'});e.info("webflow.json has no framework \u2014 detecting from package.json...");let i=pu(r,n);if(!i)throw new tr("Could not detect framework from package.json or webflow.json",{remediation:'Add a webflow.json with: { "cloud": { "framework": "<name>" } } (supported: astro, nextjs, vite)'});let s=i.Builder.frameworkName;return e.info(`Detected framework: ${i.result.reason}`),fu(e,t,s),s}_();var tv=j.object({name:j.string(),main:j.string().optional(),compatibility_date:j.string(),compatibility_flags:j.array(j.string()).optional(),placement:j.object({mode:j.string()}).passthrough().optional(),assets:j.object({directory:j.string(),binding:j.string().optional()}).passthrough().optional(),d1_databases:j.array(j.object({database_name:j.string(),database_id:j.string(),binding:j.string(),migrations_dir:j.string().optional()}).passthrough()).default([]),kv_namespaces:j.array(j.object({binding:j.string(),id:j.string()}).passthrough()).default([]),r2_buckets:j.array(j.object({binding:j.string(),bucket_name:j.string()}).passthrough()).default([])}).passthrough();function nv(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
147
+ `)}function rv(e,t="wrangler.json"){let n=un.join(e,t);if(!ft.existsSync(n)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),rv(e,t+"c");u.warn(`/${t} not found`);return}let r=ft.readFileSync(n,"utf8");u.info(`reading /${t}...`);let o;try{o=xo(r)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=tv.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
148
+ ${nv(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function ov(e,t){let n=null,r=null,o=un.join(t,"wrangler.json"),i=un.join(t,"wrangler.jsonc");ft.existsSync(o)?(n=o,r=".json"):ft.existsSync(i)&&(n=i,r=".jsonc"),n&&r&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${r}...`),ft.copyFileSync(n,un.join(t,`clouduser.wrangler${r}`)));let s=n?rv(t,un.basename(n)):null,a=e.getWranglerTemplatePath(),l=un.join(t,"wrangler.json");if(!ft.existsSync(a))throw new Error(`Wrangler template not found at ${a}. Make sure the template is properly copied during build.`);if(u.info(`copying wrangler template for ${e.info.name} to /wrangler.json`),ft.copyFileSync(a,l),!s)return;let c=JSON.parse(ft.readFileSync(l,"utf8"));if(s.kv_namespaces&&s.kv_namespaces.length>0&&(c.kv_namespaces=s.kv_namespaces,u.info(`merged ${s.kv_namespaces.length} KV namespace(s) into template`)),s.r2_buckets&&s.r2_buckets.length>0&&(c.r2_buckets=s.r2_buckets,u.info(`merged ${s.r2_buckets.length} R2 bucket(s) into template`)),s.d1_databases&&s.d1_databases.length>0&&(c.d1_databases=s.d1_databases,u.info(`merged ${s.d1_databases.length} D1 database(s) into template`)),ft.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let d in s.d1_databases){let p=s.d1_databases[d];if(!p.migrations_dir){u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir is not defined`);continue}let m=p.migrations_dir,h=un.join(t,m);if(!ft.existsSync(h)){u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let g=un.join(t,"clouduser","migrations",m),y=Pr(u,h,g);y>0?u.info(`copied ${y} migrations to /clouduser/migrations/${m}`):u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir (/${m}) is empty`)}}function kT(e){if(!/^[a-z0-9-]+$/.test(e))throw new Error(`Invalid object storage bucket name ${JSON.stringify(e)}: Only lowercase letters, numbers, and hyphens are allowed.`);if(e.startsWith("-")||e.endsWith("-"))throw new Error(`Invalid object storage bucket name "${e}": Cannot begin or end with a hyphen.`);if(e.length>27)throw new Error(`Invalid object storage bucket name "${e}": Must be 27 characters or fewer (currently ${e.length} characters).`)}function iv(e){let t=null;for(let s of[".json",".jsonc"]){let a=un.join(e,`clouduser.wrangler${s}`);if(ft.existsSync(a)){t=a;break}}if(!t)return;let n=ft.readFileSync(t,"utf8"),r;try{r=xo(n)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=tv.safeParse(r);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
149
+ ${nv(o.error)}`);let i=o.data;if(i.r2_buckets&&i.r2_buckets.length>0){u.info(`validating ${i.r2_buckets.length} object storage bucket name(s)...`);for(let s of i.r2_buckets)kT(s.bucket_name)}}_();C();M();pe();var ET="4.82.1",mu=60;function nr(e,t){let n=Math.min(mu,process.stdout.columns??mu),r=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,n-r.length));u.info(`
150
+ ${se(`${r}${o}`)}`)}function Sm(e,t){let n=Math.min(mu,process.stdout.columns??mu),r=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,n-r.length));u.info(`
151
+ ${se(Ft(`${r}${o}`))}`)}async function lv(e=process.cwd(),t,n,r){let o=Ca(e),i=Vi(u,e),s={...r?{COSMIC_MOUNT_PATH:r}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...n&&!t?{COSMIC_DEPLOY_URL:ST(n)}:{}},a={cwd:e,log:u,packageJson:o??{},userEnv:s},{isStatic:l}=Oa(e,o,i);if(l)return new cn(a);if(!o)throw new Error("No package.json file found");return vm(a,i)}async function cv(e,t={}){let n=t.projectPath||process.cwd(),r=Date.now(),o=ce.join(n,".tmp",`webflow-build-${r}`),i=t.outputDir||ce.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=xm(n),c=t.telemetry,d=e.getBuildCommand(),p=e.getOutputDeployMetadata(),m=p.deploymentType==="static";await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),ee.mkdirSync(o,{recursive:!0});try{nr("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${p.deploymentType}`);let h=e.getNodeVersionRequirement();h&&Tr(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),nr("\u2699\uFE0F ","Configure wrangler"),await ov(e,n),u.info("Preparing framework configuration..."),await e.prepareConfig()),fu(u,n,e.info.name,e),m||(nr("\u{1F4E6}","Install dependencies"),await vT(n,e.info.name,t.telemetry),iv(n),nr("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${d}...`),await xT(n,d,t.telemetry),await e.postBuild(),nr("\u{1F9EA}","Wrangler dry-run"),await CT(n,i)),nr("\u{1F4C1}","Copy assets"),await _T(n,i,e,s),nr("\u{1F381}","Create tarball");let g=await AT(i),y=Date.now()-a;return u.info(`${$} Build completed in ${(y/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:y,framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),g}catch(h){let g=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:g,framework:e.info.name,buildCommand:d,deploymentType:p.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function xm(e){let t=ce.join(e,"wrangler.json");if(!ee.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let n=JSON.parse(ee.readFileSync(t,"utf8")),r=n.kv_namespaces||[],o=n.d1_databases||[],i=n.r2_buckets||[],s=n.vars||{};return{hasKV:r.length>0,hasD1:o.length>0,hasR2:i.length>0,hasVars:Object.keys(s).length>0,kvCount:r.length,d1Count:o.length,r2Count:i.length,varCount:Object.keys(s).length}}catch(n){return console.debug("Failed to parse wrangler.json for bindings detection:",n),{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0}}}function uv(e){try{let t=ce.dirname(e);t.includes(".tmp/webflow-build-")&&(nr("\u{1F9F9}","Clean up build artifacts"),ee.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function dv(e,t){try{nr("\u{1F9F9}","Revert framework configuration");let n=t.getUserConfigPatterns(),r=new Set;for(let s of n){let a=ce.extname(s).slice(1),l=ce.basename(s,`.${a}`);if(!r.has(l)){r.add(l);for(let c of["mjs","cjs","js","ts"]){let d=ce.join(e,`clouduser.${l}.${c}`),p=ce.join(e,`${l}.${c}`);if(ee.existsSync(d)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),ee.existsSync(p)&&ee.unlinkSync(p),ee.renameSync(d,p);break}}}}for(let s of[".jsonc",".json"]){let a=ce.join(e,`clouduser.wrangler${s}`);if(ee.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=ce.join(e,"wrangler.json");ee.existsSync(l)&&ee.unlinkSync(l);let c=ce.join(e,`wrangler${s}`);ee.renameSync(a,c);break}}let o=ce.join(e,"clouduser");ee.existsSync(o)&&(u.info("cleaning up clouduser directory..."),ee.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=ce.join(e,ce.basename(s));ee.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),ee.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=ce.join(e,i.destinationName);ee.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),ee.unlinkSync(s))}}catch(n){u.warn(`Warning: Failed to cleanup framework configuration: ${n}`)}}async function vT(e,t,n){let r=Date.now(),o=["--no-update-notifier","--no-progress"],i=ce.join(e,"package-lock.json");try{ee.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,La.execSync)(`npm ci --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"})):(u.info("Warning: No package-lock.json found, installing dependencies with npm install --include=dev"),(0,La.execSync)(`npm install --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"}));let s=Date.now()-r;await n?.sendUsage("cloud_install_dependencies_success",{duration:s,framework:t,hasPackageLock:ee.existsSync(i)})}catch(s){let a=Date.now()-r;throw await n?.sendError(s instanceof Error?s:new Error(String(s)),"cloud_install_dependencies_failure",{duration:a,framework:t,hasPackageLock:ee.existsSync(i)}),s}}function ST(e){let t="production",n;switch(t){case"development":n="wf-app-dev";break;case"acceptance":n="wf-app-acceptance";break;default:n="wf-app-prod"}return`https://${e}.${n}.cosmic.webflow.services`}async function xT(e,t,n){let r=Date.now();try{(0,La.execSync)(`npm exec -- ${t}`,{cwd:e,stdio:"inherit"});let o=Date.now()-r;await n?.sendUsage("cloud_build_command_success",{duration:o,buildCommand:t})}catch(o){let i=Date.now()-r;throw await n?.sendError(o instanceof Error?o:new Error(String(o)),"cloud_build_command_failure",{duration:i,buildCommand:t}),new Error(`Build command failed: ${t}`)}}async function CT(e,t){ee.mkdirSync(t,{recursive:!0});let n=ce.join(e,"wrangler.json"),r=ce.join(e,"wrangler.jsonc");if(!ee.existsSync(n)&&!ee.existsSync(r))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,La.execSync)(`npx wrangler@${ET} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function sv(e,t){let n=ce.join(e,"webflow.json");ee.existsSync(n)?(u.info("including webflow.json in output..."),ee.copyFileSync(n,ce.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function FT(e,t,n){let r=n.replace(/\/+$/,"").replace(/^\/+/,""),o=ce.join(t,"assets"),i=ce.join(o,r||"");ee.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${r}...`);for(let s of ee.readdirSync(e))Pr(u,ce.join(e,s),ce.join(i,s),{excludeFn:Ta,followSymlinks:!1});for(let s of Ra){let a=ce.join(e,s);ee.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),ee.copyFileSync(a,ce.join(o,s)))}}async function _T(e,t,n,r){let o=n.getOutputDeployMetadata();if(o.deploymentType==="static"){FT(e,t,r),sv(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=r.replace(/\/+$/,"").replace(/^\/+/,"");if(!a&&l&&(n.info.name==="nextjs"||n.info.name==="astro")){let m=ce.join(e,i);if(ee.existsSync(m)&&ee.statSync(m).isDirectory()){let g=ee.readdirSync(m,{withFileTypes:!0}).find(y=>!(!y.isDirectory()||s&&y.name===s||n.info.name==="astro"&&(y.name==="_routes.json"||y.name==="_worker.js")));g&&(i=`${i}/${g.name}`)}}let c=ce.join(t,"assets",l||"");ee.mkdirSync(c,{recursive:!0});let d=ce.join(e,i);if(ee.existsSync(d)&&ee.statSync(d).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),Pr(u,d,c,{exclude:s})):Pr(u,d,c)}catch(m){u.error(m,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");sv(e,t);let p=null;for(let m of[".json",".jsonc"]){let h=ce.join(e,`clouduser.wrangler${m}`);if(ee.existsSync(h)){p=h;break}}if(p){u.info("including user wrangler config in output..."),ee.copyFileSync(p,ce.join(t,"clouduser.wrangler.json"));let m=ce.join(e,"clouduser","migrations");if(ee.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let h=ce.join(t,"migrations");Pr(u,m,h)}}}async function AT(e){let t=`${e}.tar.gz`;try{return await av.create({gzip:!0,file:t,cwd:ce.dirname(e)},[ce.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(n){throw new f(n,{prefix:"Failed to create tarball:"})}}We();be();_();var IT="DUPLICATE_ENVIRONMENT_MOUNT",RT="ENVIRONMENT_MOUNT_MISMATCH",TT="DUPLICATE_ENVIRONMENT_BRANCH",PT="INVALID_MOUNT_PATH_FORMAT",$T="INVALID_PROJECT_ID",OT="DUPLICATE_PROJECT_NAME",LT="MAX_PROJECTS_PER_SITE",pv={[IT]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[RT]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[TT]:"An environment with this branch already exists for this app.",[PT]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[$T]:"Invalid app ID. This app may have been deleted or belongs to a different site. Please remove the 'app_id' field (or the legacy 'project_id' field) from your webflow.json and redeploy to create a new app.",[OT]:"An app with this name already exists on this site, usually because 'app_id' is missing from your webflow.json. To deploy to the existing app, provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json \u2014 you can find the ID in the Webflow Cloud dashboard.",[LT]:"This site has reached its limit of Cloud apps, so no new app can be created. Deploy to one of its existing apps, or delete an app you no longer need from the Webflow Cloud dashboard."};function fv(e){let t={timestamp:new Date().toISOString()};if(e instanceof Error)t.code=e.name,t.msg=e.message,t.stack=e.stack;else if(typeof e=="object"&&e!==null){let i=e;t.code=typeof i.code=="string"?i.code:void 0,t.msg=typeof i.msg=="string"?i.msg:void 0,t.status=typeof i.status=="number"?i.status:void 0}let n=t.msg||"",r=t.status??t.code,o=typeof r=="number"?r:typeof r=="string"&&/^\d+$/.test(r)?Number(r):void 0;if(u.error(`Error Details: ${JSON.stringify({timestamp:t.timestamp,code:t.code,message:t.msg,status:t.status,stack:t.stack},null,2)}`),o===401)return"Your access token is expired or invalid. Run 'webflow auth login' to re-authenticate.";if(o===403)return"Your access token is missing required permissions. Run 'webflow auth login' to re-authenticate with the necessary scopes.";for(let i in pv)if(n.includes(i))return pv[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var Yi=w(require("fs")),Fm=require("child_process"),hv=w(require("semver"));_();C();M();C();we();_();C();function Xi(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0})}var NT={siteId:{missingFlag:"siteId",flagHint:"--site",env:"WEBFLOW_SITE_ID",manifest:e=>e.siteId},appId:{missingFlag:"appId",flagHint:"--app-id",env:"WEBFLOW_APP_ID",manifest:e=>e.cloud?.app_id??e.cloud?.project_id},environmentId:{missingFlag:"environmentId",flagHint:"--environment-id",env:"WEBFLOW_APP_ENVIRONMENT_ID",manifest:e=>e.cloud?.environment_id},workspaceId:{missingFlag:"workspaceId",flagHint:"--workspace-id",env:"WEBFLOW_WORKSPACE_ID",manifest:e=>e.cloud?.workspace_id}};function Cm(e){return typeof e=="string"&&e.trim()!==""}async function Io(e,t={}){let n=NT[e],{flagValue:r,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??Ye();if(Cm(r))return Xi(r,e),r;let c=process.env[n.env];if(Cm(c))return Xi(c,e),c;let d=n.manifest(o??{});if(Cm(d))return l||u.info(`Using ${e} from webflow.json`),Xi(d,e),d;if(!a&&s){let m=await s();return Xi(m,e),m}let p=i??n.flagHint;throw new f(`Missing required ${e}. Pass ${p}, set ${n.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:n.missingFlag})}async function $r(e,t={}){try{return await Io(e,t)}catch(n){if(n instanceof f&&n.missingFlag===e)return;throw n}}C();var jT=/[\x00-\x1f?#%/\\]/;function Or(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0});if(jT.test(e)||e.includes(".."))throw new f(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function Oe(e,t){Or(e,t)}function MT(e){if(!e)return"unknown";let t=hv.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var mv=104857600;function gv(e){if(e===0)return"0 B";let t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function BT(){try{let e=(0,Fm.execSync)("git rev-parse HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(!/^[0-9a-f]{40}$/.test(e))throw new Error("Invalid commit hash format");try{return(0,Fm.execSync)("git status --porcelain --untracked-files=no",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().length>0?`git@${e}+dirty`:`git@${e}`}catch{return`git@${e}`}}catch{return`noversion@${new Date().toISOString()}`}}async function _m(e,t,n){let r=await fetch(`${P}${t}`,{method:n.method,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:n.body?JSON.stringify(n.body):void 0});if(!r.ok){let o=await r.text(),i;try{i=JSON.parse(o)}catch{i={msg:o}}let s=fv(i);throw new Error(s)}return r.json()}async function yv(e,t,n,r){let{manifest:o}=ne(),i=o.cloud||{},s=i.framework,a=await $r("appId",{flagValue:r?.appId,manifest:o});if(!s)throw new f("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=MT(i.framework_version),c=await UT({siteId:e.siteId,apiToken:e.accessToken,framework:s,frameworkVersion:l,mountPath:n,environment:t,projectId:a,projectName:r?.projectName,description:r?.description,directory:r?.directory,version:BT()});return!a&&c.project_id&&(Se({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function UT(e){let{siteId:t,framework:n,frameworkVersion:r,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:d}=e,p={framework:n,framework_version:r,mount_path:o,environment:i,version:s};a&&(p.project_id=a),l&&(p.project_name=l),c&&(p.description=c),d&&(p.app_path=d);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return _m(e.apiToken,m,{method:"POST",body:p})}async function wv(e,t){let{siteId:n,accessToken:r}=e,o=n?`/cosmic/${n}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return _m(r,o,{method:"GET"})}async function Dv(e){let{siteId:t,accessToken:n}=e,r=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return _m(n,r,{method:"GET"})}async function bv(e,t){if(!Yi.existsSync(e))throw new Error(`Tarball not found at ${e}`);let n=Yi.statSync(e);if(n.size>mv)throw new Error(`Build output is too large (${gv(n.size)}). Maximum allowed size is ${gv(mv)}.`);let r=Yi.readFileSync(e),o=JSON.parse(t);if(!o.fields)throw new Error("Upload URL is missing fields property");let i=new FormData;Object.entries(o.fields).forEach(([l,c])=>{i.append(l,c)});let s=new Blob([r],{type:"application/gzip"});i.append("file",s,"output.tar.gz");let a=await fetch(o.url,{method:"POST",body:i});if(!a.ok){let l=await a.text();throw new f(l,{prefix:`${k} Upload failed with response:`})}}async function kv(e,t){if(!e||e==="undefined")throw new f("Completion URL is undefined or invalid");let n=new URL(e);t&&n.searchParams.set("failed","true");let r=await fetch(n.toString(),{method:"GET"});if(!r.ok)throw new f(`Failed to trigger deployment: ${r.status} ${r.statusText}`)}var Ev=require("webflow-api");be();be();C();function Am(e){return new Ev.WebflowClient({accessToken:e,environment:{base:`${P}/v2`,dataApi:`${P}/v2`,contentDeliveryApi:`${di}/v2`}})}async function Na(e,t){try{let r=await Am(e).sites.get(t);return{id:r.id||t,displayName:r.displayName||"Unknown Site",shortName:r.shortName||"unknown-site",customDomains:r.customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(n){throw new f(n,{prefix:"Error fetching site details:"})}}async function Im(e,t){try{return{customDomains:(await Am(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(n){throw new f(n,{prefix:"Error fetching custom domains:"})}}async function Rm(e){try{let t=await fetch(`https://${e}/manifest.json`);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);return await t.json()}catch(t){throw new f(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function Tm(e,t,n){return e.cosmic&&Array.isArray(e.cosmic)?e.cosmic.some(r=>{if(r.mountPath!==t)return!1;if(!n)return!0;if(r.workerUrl)try{return new URL(r.workerUrl).hostname.split(".")[0]===n}catch{return!1}return!1}):!1}async function vv(e,t,n){try{let r=Am(e),o=await Na(e,t),i=[];if(n?.domains&&n.domains.length>0)for(let s of n.domains){let a=o.customDomains?.find(l=>l.url===s);a?.id&&i.push(a.id)}await r.sites.publish(t,{customDomains:i,publishToWebflowSubdomain:n?.publishToWebflowSubdomain??!0})}catch(r){throw new f(r,{prefix:"Error publishing site:"})}}Te();_();async function Sv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)throw new Error("Site ID is required for mount path validation. Apps without a connected site skip this step.");let i=u.spinner("Validating mount path configuration");try{let s=await Na(o,r),a=await Im(o,r),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(g=>g.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let d=l.map(async g=>{try{let y=await Rm(g),b=Array.isArray(y.cosmic)?y.cosmic.map(A=>A.mountPath).filter(A=>typeof A=="string"):[],S=Tm(y,t,n);return{domain:g,mountPaths:b,isValid:S===!0}}catch(y){return{domain:g,mountPaths:[],isValid:!1,error:y instanceof Error?y.message:String(y)}}finally{c++,i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (${c}/${l.length})`)}}),p=await Promise.all(d),m=p.some(g=>!g.isValid),h=p.every(g=>g.isValid);return i.succeed("Mount path validation completed"),{isValid:h,domains:p,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function xv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)return[];try{let i=await Na(o,r),s=await Im(o,r),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(d=>d.url)||[]].map(async d=>{try{let p=await Rm(d),m=Tm(p,t,n);return{domain:d,isValid:m}}catch(p){return u.debug(`Could not verify mount path for ${d}: ${p}`),{domain:d,isValid:!1}}});return(await Promise.all(l)).filter(d=>d.isValid).map(d=>d.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function Cv(e,t){return e.map(n=>`${n.startsWith("localhost")||n.startsWith("127.0.0.1")?"http":"https"}://${n}${t}`)}async function Fv(e){let t=e.map(r=>({name:r,value:r,checked:!0})),n=await En({message:"Select which domains you want to publish to update the mount path configuration:",choices:t,validate:r=>r.length===0?"Please select at least one domain to publish to.":!0});return n??[]}async function _v(){return await Re({message:"The mount path doesn't match on some domains. Would you like to publish the site to update the configuration?",default:!0})}async function Pm(e,t){let{siteId:n,accessToken:r}=e;if(!n)throw new Error("Site ID is required to publish. Apps without a connected site do not use this.");let o=u.spinner(`Publishing site to ${t.length} domain(s)`);try{let s=`${(await Na(r,n)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await vv(r,n,{domains:l,publishToWebflowSubdomain:a}),o.succeed(`Site published successfully to selected domains: ${t.join(", ")}`)}catch{throw o.fail("Failed to publish site"),new Error("Failed to publish site")}}_();pe();var Ro=w(require("path"));We();be();we();var Av="apps";function $m(e){Av=e}function Zi(){return Av}var hu=w(require("fs"));C();be();Te();C();_();async function Qi(e){let t=await fetch(`${P}/v2/workspaces`,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){let r=await t.text(),o={};try{o=JSON.parse(r)}catch{}throw t.status===403&&o.code==="missing_scopes"?new f(`Missing required scopes for workspace access.
152
152
  ${o.message??""}
153
153
  Re-run 'webflow auth login' to grant the necessary permissions.`):new f(`Failed to fetch workspaces: ${t.status} ${t.statusText}`+(o.message?`
154
- ${o.message}`:""))}return(await t.json()).workspaces}async function Ic(e){if(e.length===1)return e[0];let t=await Be({message:"Select the workspace for this app:",choices:e.map(r=>({name:r.name,value:r}))});return t||(u.warn(`Auto fallback to first workspace: ${e[0].name}`),e[0])}Ll();N();x();N();de();async function Uf(e,t){u.warn(`${he} ${ne("webflow cloud create")} is deprecated and will be removed in the next major release.
155
- Use ${V("webflow cloud init")} instead.
156
- `);let{framework:r}=t;if(!(await _i()).find(i=>i===r)){u.error(`Framework ${r} not found`);return}await Oc(e,"/app",r,void 0,we.Existing,void 0)}x();de();N();Qr();async function Wf(){let e=ct()?"webflow apps init":"webflow cloud init",t=ct()?`
157
- To list your Cloud apps, use ${V("webflow apps list")}.`:"";u.warn(`${he} ${ne("webflow cloud list")} is deprecated and will be removed in the next major release.
154
+ ${o.message}`:""))}return(await t.json()).workspaces}async function es(e){if(e.length===1)return e[0];let t=await Me({message:"Select the workspace for this app:",choices:e.map(n=>({name:n.name,value:n}))});return t||(u.warn(`Auto fallback to first workspace: ${e[0].name}`),e[0])}yc();M();_();M();pe();async function Om(e,t){u.warn(`${re} ${le("webflow cloud create")} is deprecated and will be removed in the next major release.
155
+ Use ${K("webflow cloud init")} instead.
156
+ `);let{framework:n}=t;if(!(await ts()).find(i=>i===n)){u.error(`Framework ${n} not found`);return}await gu(e,"/app",n,void 0,xe.Existing,void 0)}_();pe();M();Wn();async function Lm(){let e=tt()?"webflow apps init":"webflow cloud init",t=tt()?`
157
+ To list your Cloud apps, use ${K("webflow apps list")}.`:"";u.warn(`${re} ${le("webflow cloud list")} is deprecated and will be removed in the next major release.
158
158
  It lists scaffold templates, not your apps.
159
- Use ${V(`${e} --framework`)} / ${V("--help")} for available templates.${t}
160
- `);let r=await _i();u.info("Available app templates:"),r.length>0?r.forEach(n=>u.info(`- ${n}`)):u.info("No templates found.")}J();S();pe();Ae();x();N();var gE=D(require("path"));function En(e){if(!e||e.trim()==="")return"/";let t=gE.posix.normalize(e);return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/").map((n,o)=>o===0?n:encodeURIComponent(n)).join("/"),t}function ia(e){return!(!e||e.trim()===""||!e.startsWith("/")||e.includes(".."))}de();x();N();function sa(e,t){u.warn(`${he} ${ne(e)} is deprecated; use ${V(t)} instead.`)}async function Hf(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");e.projectName!==void 0&&sa("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new f("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new f("--new and --site-id are mutually exclusive. Use --site-id to connect to an existing site, or --new to create a standalone app.");let r=process.stdin.isTTY,n;r&&er()&&(n=await T());let o=!1;if(n&&!e.new&&!e.siteId)try{(await vs(n)).length===0&&(u.info(`${Fe} No existing Webflow sites in your workspace \u2014 starting a new app.`),o=!0)}catch(g){u.debug(`Skipped sites lookup in cloud init preflight: ${g}`)}let i=await _i(),s={};if(r&&er()){if(!e.new&&!o&&(s.initMode=await Be({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:we.New},{name:"Existing site",value:we.Existing}],default:we.New})),e?.framework||(s.scaffoldName=await Be({message:"Which framework would you like to use?",choices:i.map(m=>({name:m,value:m})),default:"astro"})),!t){let m=await Je({message:"What would you like to name your app?",validate:w=>{let k=w.trim();return k===""?"App name cannot be empty":k.length<Nr||k.length>jr?`App name must be between ${Nr} and ${jr} characters`:!0}});if(m==null)throw new f("When --no-input mode is enabled please provide the --app-name option.");s.appName=m}let g=e.new||o||s.initMode===we.New;if(!e.mount&&!g){let m=await Je({message:"What path do you want to use locally? (e.g., /app)",default:"/app"});s.mountPath=En(m)}}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?we.New:s.initMode??(e.siteId?we.Existing:W()?we.New:we.Existing),d=c===we.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",p=e.siteId,h=En(d);if(!a||typeof a!="string"||a.trim()==="")throw new f("--app-name cannot be empty");if(a.length<Nr||a.length>jr)throw new f(`--app-name must be between ${Nr} and ${jr} characters`);if(!l)throw new f("--framework is required");if(!i.includes(l)){let g=i.join(`
159
+ Use ${K(`${e} --framework`)} / ${K("--help")} for available templates.${t}
160
+ `);let n=await ts();u.info("Available app templates:"),n.length>0?n.forEach(r=>u.info(`- ${r}`)):u.info("No templates found.")}q();C();we();Te();_();M();var Iv=w(require("path"));function Lr(e){if(!e||e.trim()==="")return"/";let t=Iv.posix.normalize(e);return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/").map((r,o)=>o===0?r:encodeURIComponent(r)).join("/"),t}function ja(e){return!(!e||e.trim()===""||!e.startsWith("/")||e.includes(".."))}pe();_();M();function Ma(e,t){u.warn(`${re} ${le(e)} is deprecated; use ${K(t)} instead.`)}async function Nm(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");e.projectName!==void 0&&Ma("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new f("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new f("--new and --site-id are mutually exclusive. Use --site-id to connect to an existing site, or --new to create a standalone app.");let n=process.stdin.isTTY,r;n&&on()&&(r=await T());let o=!1;if(r&&!e.new&&!e.siteId)try{(await hr(r)).length===0&&(u.info(`${je} No existing Webflow sites in your workspace \u2014 starting a new app.`),o=!0)}catch(h){u.debug(`Skipped sites lookup in cloud init preflight: ${h}`)}let i=await ts(),s={};if(n&&on()){if(!e.new&&!o&&(s.initMode=await Me({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:xe.New},{name:"Existing site",value:xe.Existing}],default:xe.New})),e?.framework||(s.scaffoldName=await Me({message:"Which framework would you like to use?",choices:i.map(g=>({name:g,value:g})),default:"astro"})),!t){let g=await Je({message:"What would you like to name your app?",validate:y=>{let b=y.trim();return b===""?"App name cannot be empty":b.length<zn||b.length>qn?`App name must be between ${zn} and ${qn} characters`:!0}});if(g==null)throw new f("When --no-input mode is enabled please provide the --app-name option.");s.appName=g}let h=e.new||o||s.initMode===xe.New;if(!e.mount&&!h){let g=await Je({message:"What path do you want to use locally? (e.g., /app)",default:"/app"});s.mountPath=Lr(g)}}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?xe.New:s.initMode??(e.siteId?xe.Existing:V()?xe.New:xe.Existing),d=c===xe.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",p=e.siteId,m=Lr(d);if(!a||typeof a!="string"||a.trim()==="")throw new f("--app-name cannot be empty");if(a.length<zn||a.length>qn)throw new f(`--app-name must be between ${zn} and ${qn} characters`);if(!l)throw new f("--framework is required");if(!i.includes(l)){let h=i.join(`
161
161
  - `);throw new f(`--framework "${l}" not found
162
162
 
163
163
  Available frameworks:
164
- - ${g}`)}if(typeof h!="string"||!ia(h))throw new f("Invalid mount path: "+h);if(c===we.Existing&&!p&&(!r||W()))throw new f("--site-id is required when connecting to an existing site in non-interactive mode.");await Oc(a,h,l,p,c,e.workspaceId)}var bE=D(require("path"));J();S();pe();Ae();x();N();Me();z();var hE=require("crypto");ye();S();async function yE(e){let{accessToken:t,workspaceId:r,displayName:n,description:o,appPath:i}=e,a={requestId:(0,hE.randomUUID)(),cloudApp:{displayName:n,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:rb}}}},l=`${I}/cosmic/workspaces/${r}/cloudApps`,c=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Version":"1.0.0"},body:JSON.stringify(a)});if(!c.ok){let d=await c.text();throw LT(c.status,c.statusText,d)}return c.json()}function LT(e,t,r){let n={};try{n=JSON.parse(r)}catch{}return e===403?n.publicErrorCode==="missing_scopes"?new f(`Missing required scopes to create a Cloud app.
165
- ${n.msg??""}
166
- Re-run 'webflow auth login' to grant the necessary permissions.`):new f(n.msg??"You don't have permission to create apps in this workspace."):e===404?new f("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?n.publicErrorCode==="workspace_unhosted_project_limit"?new f(NT(n.planName,n.limit)):n.msg?.includes("No new sites can be created")?new f(`Failed to create app: your workspace has reached its app limit.
167
- Upgrade your plan or remove unused apps to create a new one.`):new f(n.msg??"A Cloud app creation request is already being processed. Please wait and try again."):new f(`Failed to create app: ${e} ${t}`+(n.msg?`
168
- ${n.msg}`:""))}function NT(e,t){let r="Upgrade your plan or remove unused apps to create a new one.",n=t===1?"Cloud app":"Cloud apps";return e&&typeof t=="number"&&t>0?`Your "${e}" workspace is limited to ${t} ${n}.
169
- ${r}`:typeof t=="number"&&t>0?`Your workspace is limited to ${t} ${n}.
170
- ${r}`:e?`Your "${e}" workspace has reached its Cloud app limit.
171
- ${r}`:`Failed to create app: your workspace has reached its app limit.
172
- `+r}Me();S();pe();Ae();J();async function kE(e={}){jT(e);let t=await MT(e,Z().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:Z().manifest}}function jT(e){if(e.siteId&&e.workspaceId)throw new f("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function MT(e,t){if(e.siteId)return wE(t,e.siteId);if(e.workspaceId)return DE(e.workspaceId);let r=await kn("siteId",{manifest:t});if(r)return wE(t,r);let n=await kn("workspaceId",{manifest:t});if(n)return DE(n);if(W()||!er())throw new f(`No identity configured for this app.
164
+ - ${h}`)}if(typeof m!="string"||!ja(m))throw new f("Invalid mount path: "+m);if(c===xe.Existing&&!p&&(!n||V()))throw new f("--site-id is required when connecting to an existing site in non-interactive mode.");await gu(a,m,l,p,c,e.workspaceId)}var Lv=w(require("path"));q();C();we();Te();_();M();We();X();var Rv=require("crypto");be();C();async function Tv(e){let{accessToken:t,workspaceId:n,displayName:r,description:o,appPath:i}=e,a={requestId:(0,Rv.randomUUID)(),cloudApp:{displayName:r,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:pE}}}},l=`${P}/cosmic/workspaces/${n}/cloudApps`,c=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Version":"1.0.0"},body:JSON.stringify(a)});if(!c.ok){let d=await c.text();throw WT(c.status,c.statusText,d)}return c.json()}function WT(e,t,n){let r={};try{r=JSON.parse(n)}catch{}return e===403?r.publicErrorCode==="missing_scopes"?new f(`Missing required scopes to create a Cloud app.
165
+ ${r.msg??""}
166
+ Re-run 'webflow auth login' to grant the necessary permissions.`):new f(r.msg??"You don't have permission to create apps in this workspace."):e===404?new f("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?r.publicErrorCode==="workspace_unhosted_project_limit"?new f(HT(r.planName,r.limit)):r.msg?.includes("No new sites can be created")?new f(`Failed to create app: your workspace has reached its app limit.
167
+ Upgrade your plan or remove unused apps to create a new one.`):new f(r.msg??"A Cloud app creation request is already being processed. Please wait and try again."):new f(`Failed to create app: ${e} ${t}`+(r.msg?`
168
+ ${r.msg}`:""))}function HT(e,t){let n="Upgrade your plan or remove unused apps to create a new one.",r=t===1?"Cloud app":"Cloud apps";return e&&typeof t=="number"&&t>0?`Your "${e}" workspace is limited to ${t} ${r}.
169
+ ${n}`:typeof t=="number"&&t>0?`Your workspace is limited to ${t} ${r}.
170
+ ${n}`:e?`Your "${e}" workspace has reached its Cloud app limit.
171
+ ${n}`:`Failed to create app: your workspace has reached its app limit.
172
+ `+n}We();C();we();Te();q();async function Ov(e={}){VT(e);let t=await GT(e,ne().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:ne().manifest}}function VT(e){if(e.siteId&&e.workspaceId)throw new f("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function GT(e,t){if(e.siteId)return Pv(t,e.siteId);if(e.workspaceId)return $v(e.workspaceId);let n=await $r("siteId",{manifest:t});if(n)return Pv(t,n);let r=await $r("workspaceId",{manifest:t});if(r)return $v(r);if(V()||!on())throw new f(`No identity configured for this app.
173
173
  Pass one of:
174
174
  --site-id <id> (deploy to an existing Webflow site)
175
175
  --workspace-id <id> (create a new Cloud app)
176
- Or run 'webflow cloud init' to scaffold a new app.`);return UT(t)}async function wE(e,t){return{credentials:await Ue(e,{site:t})}}async function DE(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function BT(){let e=await T(),t=await Rc(e);if(t.length===0)throw new rn("No workspaces found in your account. Please make sure you have at least one workspace.");let r=await Ic(t);return xe({cloud:{workspace_id:r.id}}),{workspaceId:r.id,credentials:{accessToken:e,siteId:""}}}async function UT(e){let t=await Be({message:"This app isn't initialized for Webflow Cloud. How would you like to deploy?",choices:[{name:"Create a new app",value:"standalone"},{name:"Attach to an existing Webflow site",value:"site-attached"},{name:"Cancel",value:"cancel"}]});if(t==="cancel"||!t)throw new f("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?BT():{credentials:await Ue(e,{})}}async function Vf(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");if(e.appId!==void 0&&e.projectId!==void 0)throw new f("--app-id and --project-id are aliases of the same option. Pass exactly one (--app-id is preferred; --project-id is deprecated).");e.projectName!==void 0&&sa("--project-name","--app-name"),e.projectId!==void 0&&sa("--project-id","--app-id");let t=e.appName??e.projectName,r=e.appId??e.projectId;if(e.directory)try{process.chdir(e.directory),u.info(`Changed directory to: ${e.directory}`)}catch(m){throw u.error(`Error: Could not change to directory ${e.directory}`),new f(m)}if(e.framework){if(!ra.includes(e.framework))throw new f(`Framework "${e.framework}" is not supported. Allowed: ${ra.join(", ")}.`);xe({cloud:{framework:e.framework}})}let n=await kE({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=n,{credentials:i,manifest:s}=n,a=!!o;if(o){let m=bE.default.basename(process.cwd()).trim(),w=m.length>=Nr&&m.length<=jr,k=t??(w?m:"Cloud App");if(k.length<Nr||k.length>jr)throw new f(`App name must be between ${Nr} and ${jr} characters (got ${k.length}).
177
- Use --app-name to provide a valid name.`);let F=u.spinner("Creating Cloud app...");try{let E=await yE({accessToken:i.accessToken,workspaceId:o,displayName:k});F.succeed(`Cloud app created: ${E.cloudApp.displayName}`),xe({siteId:E.cloudApp.siteId,cloud:{...s.cloud,app_id:E.cloudApp.project.id,environment_id:E.cloudApp.environment.id}}),Or({siteId:E.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=E.cloudApp.siteId,{manifest:s}=Z()}catch(E){throw F.fail("Failed to create app"),new f(E,{prefix:"Could not create app:"})}let A=s.siteId;if(!A)throw new f("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:A}}let l;try{l=_.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(m){u.debug(`Failed to initialize telemetry: ${m}`)}let c=await kn("appId",{flagValue:r,manifest:s}),d,p,h=t,g=e.description;if(e.environment&&e.mount){if(d=e.environment,p=En(e.mount),!ia(p))throw new f("Invalid mount path: "+p)}else{let m=[];if(!c){if(!h&&W())throw new f("When --no-input mode is enabled, provide --app-name to create an app, or provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json to deploy to an existing app.");try{let k=await oE(i);if(k.projects.length>0){let F=await Be({message:"Select an app to deploy to:",choices:[...k.projects.map(A=>({name:`${A.name} (${A.description||"No description"})`,value:A.id})),{name:"Create new app",value:null}]});F?(c=F,xe({cloud:{app_id:F}}),u.info(`${L} App ID updated in webflow.json`)):u.info("Creating a new app will be handled during deployment.")}else u.info(`
178
- No existing apps found. A new app will be created during deployment.`)}catch(k){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(k instanceof Error?k.message:String(k))}}if(!c&&!h&&(h=await Je({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:k=>k.trim()===""?"App name cannot be empty":!0})),c)try{let F=(await nE(i,c)).environments.map(A=>({name:`${A.branch} (${A.mount})`,value:{branch:A.branch,mount:A.mount}}));m.push(...F)}catch(k){throw new f(k,{prefix:"Error fetching app environments:"})}m.push({name:"Create new environment",value:null});let w=await Be({message:"Select an environment to deploy to:",choices:m});if(w)d=w.branch,p=En(w.mount);else if(e.environment?d=e.environment:d=await Je({message:"What environment would you like to deploy to?",default:"main",validate:k=>k.trim()===""?"Environment cannot be empty":!0}),e.mount)p=En(e.mount);else{let k=await Je({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"});p=En(k)}}if(!ia(p))throw new f("Invalid mount path: "+p);await EE(i,d,p,{projectName:h,description:g,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new f(t,{prefix:"Error during deployment setup:"})}}var aa=null;process.once("exit",()=>aa?.());var vE=(e,t,r)=>t instanceof Nn?"no-sites":t instanceof rn?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&r===we.New?"no-workspaces":"unknown",_i=async()=>{try{let e=mf(),t=gf();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},WT=async(e,t,r)=>{let n;if("content"in r)n=r.content.files;else{let l=r[t];if(!l)throw new Error(`Scaffold "${t}" not found`);n=l}let o=n.find(l=>l.includes(Un));if(!o)throw new Error(`No ${Un} found in scaffold "${t}"`);await Pc.promises.mkdir(e,{recursive:!0});let s=(await Pc.promises.readFile(o,"utf8")).replace(gc,e),a=po.join(e,Un);await Pc.promises.writeFile(a,s,"utf8")},Oc=async(e,t,r=mc,n,o=we.Existing,i)=>{if(o===we.New){try{let s=await wf(r);await HT(e,t,s.scaffoldId,{content:s},r,i)}catch(s){if(s instanceof qe){let a=s.message;throw s.supportedIds?.length&&(a+=`
179
- Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}return}try{let s=await yc(r);await VT(e,t,r,{content:s},n)}catch(s){if(s instanceof qe){let a=s.message;throw s.supportedIds?.length&&(a+=`
180
- Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}},HT=async(e,t,r,n,o,i)=>{let s=`./${e}`,a="content"in n&&typeof n.content=="object"&&"extractionRoot"in n.content?n.content:null,l=a?po.dirname(a.extractionRoot):null,c="auth",d=!1,p=!1,h=null;try{let g=Date.now(),m=await T();c="workspaces";let w;if(i)w={id:i};else{let A=await Rc(m);if(A.length===0)throw new rn("No workspaces found in your account. Please make sure you have at least one workspace.");w=await Ic(A)}c="scaffold",await Gs(e,t,r,n,void 0,void 0),p=!0,process.chdir(s);let k=o??r;xe({cloud:{framework:k,workspace_id:w.id}}),Or({apiToken:m,directory:"."}),process.env.WEBFLOW_API_TOKEN=m;let F=Date.now()-g;try{await _.forCloud({authToken:m}).sendUsage("project_init",{scaffold:k,scaffoldName:k,initMode:we.New,workspaceId:w.id,totalDuration:F,mountPath:t,namespace:Ci()})}catch{}d=!0}catch(g){if(h=g,g instanceof f||g instanceof Error&&g.message.includes("OAuth")){try{await Gs(e,t,r,n),process.chdir(s),xe({cloud:{framework:o??r}}),Or({directory:"."}),p=!0}catch{}throw u.error(g),new f(g,{skipLogging:!0})}throw g}finally{if(l)try{Gf.default.removeSync(l)}catch{}if(d){let g=xE(e,we.New);aa=()=>u.info(g)}else{let g=vE(c,h,we.New),m=CE(e,we.New,g,p);aa=()=>u.info(m)}}},VT=async(e,t,r,n,o)=>{let i=`./${e}`,s=null,a=!1,l="content"in n&&typeof n.content=="object"&&"extractionRoot"in n.content?n.content:null,c=l?po.dirname(l.extractionRoot):null,d="auth",p=!1,h=!1,g=null;try{let m=Date.now();await WT(e,r,n),process.chdir(i);let{manifest:w}=Z(),k=await Ue(w,{site:o}),F=k.accessToken,A=k.siteId;if(s=_.forCloud({authToken:F,siteId:A}),d="scaffold",await Gs(".",t,r,n,A,F),h=!0,d="devlink",A){u.info(`${Fe} Running devlink export to fetch your Webflow components`);try{await GT({site:A,apiToken:F}),a=!0}catch(v){Mn(v)?u.info(`${Fe} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(v,{prefix:"Failed to run devlink export:"})}}let E=Date.now()-m;await s?.sendUsage("project_init",{scaffold:r,scaffoldName:r,devlinkSyncStatus:a,totalDuration:E,mountPath:t,namespace:Ci()}),p=!0}catch(m){g=m,u.error(m);try{await Gs(".",t,r,n),h=!0}catch{}throw new f(m,{skipLogging:!0})}finally{if(c)try{Gf.default.removeSync(c)}catch{}if(p){let m=xE(e,we.Existing);aa=()=>u.info(m)}else{let m=vE(d,g,we.Existing),w=CE(e,we.Existing,m,h);aa=()=>u.info(w)}}},GT=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(Ll(),hD));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},KT=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=Z();return pf(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},zT=async(e,t,r,n)=>{u.info(_e("Validating mount path configuration..."));let o=await cE(e,t,r);if(o.isValid)u.info(V("Mount path validation passed"));else if(u.info(R(`
181
- Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?L:he,a=i.isValid?V(`${i.domain} (mountPath: ${i.mountPaths[0]})`):ne(`${i.domain} (no matching mountPath)`);u.info(`${s} ${a}`),i.error&&u.debug(` Error: ${i.error}`)}),o.needsPublishing)if(n){u.info("\u{1F680} Auto-publishing site to update mount path configuration...");let i=o.domains.filter(s=>!s.isValid).map(s=>s.domain);await Mf(e,i)}else if(await fE()&&er()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await pE(s);await Mf(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},JT=async(e,t,r,n)=>{Tf("\u{1F3D7}\uFE0F ","Building app");let o=await Jb(e,{mountPath:r,telemetry:n?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id});Tf("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await iE(o,t.upload_url);let s=Date.now()-i;return u.info(`${L} Upload completed in ${(s/1e3).toFixed(1)}s`),o},qT=async(e,t,r,n)=>{u.success(`
182
- \u{1F310} Your cloud app will soon be available at:`);try{let o=n?.domainsOverride??await uE(e,t,r),i=dE(o??[],t);i?.length>0?i.forEach(s=>{u.info(` ${s}`)}):u.warn(" No domains found with the correct mount path configuration yet.")}catch(o){u.warn(` Could not determine deployment links: ${o instanceof Error?o.message:o}`)}},YT=e=>{e.site_slug?u.success(`Visit your deployment:
176
+ Or run 'webflow cloud init' to scaffold a new app.`);return KT(t)}async function Pv(e,t){return{credentials:await Ke(e,{site:t})}}async function $v(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function JT(){let e=await T(),t=await Qi(e);if(t.length===0)throw new yr("No workspaces found in your account. Please make sure you have at least one workspace.");let n=await es(t);return Se({cloud:{workspace_id:n.id}}),{workspaceId:n.id,credentials:{accessToken:e,siteId:""}}}async function KT(e){let t=await Me({message:"This app isn't initialized for Webflow Cloud. How would you like to deploy?",choices:[{name:"Create a new app",value:"standalone"},{name:"Attach to an existing Webflow site",value:"site-attached"},{name:"Cancel",value:"cancel"}]});if(t==="cancel"||!t)throw new f("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?JT():{credentials:await Ke(e,{})}}async function jm(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");if(e.appId!==void 0&&e.projectId!==void 0)throw new f("--app-id and --project-id are aliases of the same option. Pass exactly one (--app-id is preferred; --project-id is deprecated).");e.projectName!==void 0&&Ma("--project-name","--app-name"),e.projectId!==void 0&&Ma("--project-id","--app-id");let t=e.appName??e.projectName,n=e.appId??e.projectId;if(e.directory)try{process.chdir(e.directory),u.info(`Changed directory to: ${e.directory}`)}catch(g){throw u.error(`Error: Could not change to directory ${e.directory}`),new f(g)}if(e.framework){if(!$a.includes(e.framework))throw new f(`Framework "${e.framework}" is not supported. Allowed: ${$a.join(", ")}.`);Se({cloud:{framework:e.framework}})}let r=await Ov({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=r,{credentials:i,manifest:s}=r,a=!!o;if(o){let g=Lv.default.basename(process.cwd()).trim(),y=g.length>=zn&&g.length<=qn,b=t??(y?g:"Cloud App");if(b.length<zn||b.length>qn)throw new f(`App name must be between ${zn} and ${qn} characters (got ${b.length}).
177
+ Use --app-name to provide a valid name.`);let S=u.spinner("Creating Cloud app...");try{let v=await Tv({accessToken:i.accessToken,workspaceId:o,displayName:b});S.succeed(`Cloud app created: ${v.cloudApp.displayName}`),Se({siteId:v.cloudApp.siteId,cloud:{...s.cloud,app_id:v.cloudApp.project.id,environment_id:v.cloudApp.environment.id}}),Hn({siteId:v.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=v.cloudApp.siteId,{manifest:s}=ne()}catch(v){throw S.fail("Failed to create app"),new f(v,{prefix:"Could not create app:"})}let A=s.siteId;if(!A)throw new f("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:A}}let l;try{l=F.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(g){u.debug(`Failed to initialize telemetry: ${g}`)}let c=await $r("appId",{flagValue:n,manifest:s}),d,p,m=t,h=e.description;if(e.environment&&e.mount){if(d=e.environment,p=Lr(e.mount),!ja(p))throw new f("Invalid mount path: "+p)}else{let g=[];if(!c){if(!m&&V())throw new f("When --no-input mode is enabled, provide --app-name to create an app, or provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json to deploy to an existing app.");try{let b=await Dv(i);if(b.projects.length>0){let S=await Me({message:"Select an app to deploy to:",choices:[...b.projects.map(A=>({name:`${A.name} (${A.description||"No description"})`,value:A.id})),{name:"Create new app",value:null}]});S?(c=S,Se({cloud:{app_id:S}}),u.info(`${$} App ID updated in webflow.json`)):u.info("Creating a new app will be handled during deployment.")}else u.info(`
178
+ No existing apps found. A new app will be created during deployment.`)}catch(b){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(b instanceof Error?b.message:String(b))}}if(!c&&!m&&(m=await Je({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:b=>b.trim()===""?"App name cannot be empty":!0})),c)try{let S=(await wv(i,c)).environments.map(A=>({name:`${A.branch} (${A.mount})`,value:{branch:A.branch,mount:A.mount}}));g.push(...S)}catch(b){throw new f(b,{prefix:"Error fetching app environments:"})}g.push({name:"Create new environment",value:null});let y=await Me({message:"Select an environment to deploy to:",choices:g});if(y)d=y.branch,p=Lr(y.mount);else if(e.environment?d=e.environment:d=await Je({message:"What environment would you like to deploy to?",default:"main",validate:b=>b.trim()===""?"Environment cannot be empty":!0}),e.mount)p=Lr(e.mount);else{let b=await Je({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"});p=Lr(b)}}if(!ja(p))throw new f("Invalid mount path: "+p);await Nv(i,d,p,{projectName:m,description:h,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new f(t,{prefix:"Error during deployment setup:"})}}var Ba=null;process.once("exit",()=>Ba?.());var jv=(e,t,n)=>t instanceof ro?"no-sites":t instanceof yr?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&n===xe.New?"no-workspaces":"unknown",ts=async()=>{try{let e=lm(),t=cm();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},zT=async(e,t,n)=>{let r;if("content"in n)r=n.content.files;else{let l=n[t];if(!l)throw new Error(`Scaffold "${t}" not found`);r=l}let o=r.find(l=>l.includes(ao));if(!o)throw new Error(`No ${ao} found in scaffold "${t}"`);await hu.promises.mkdir(e,{recursive:!0});let s=(await hu.promises.readFile(o,"utf8")).replace(Zc,e),a=Ro.join(e,ao);await hu.promises.writeFile(a,s,"utf8")},gu=async(e,t,n=Yc,r,o=xe.Existing,i)=>{if(o===xe.New){try{let s=await pm(n);await qT(e,t,s.scaffoldId,{content:s},n,i)}catch(s){if(s instanceof Ze){let a=s.message;throw s.supportedIds?.length&&(a+=`
179
+ Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}return}try{let s=await eu(n);await XT(e,t,n,{content:s},r)}catch(s){if(s instanceof Ze){let a=s.message;throw s.supportedIds?.length&&(a+=`
180
+ Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}},qT=async(e,t,n,r,o,i)=>{let s=`./${e}`,a="content"in r&&typeof r.content=="object"&&"extractionRoot"in r.content?r.content:null,l=a?Ro.dirname(a.extractionRoot):null,c="auth",d=!1,p=!1,m=null;try{let h=Date.now(),g=await T();c="workspaces";let y;if(i)y={id:i};else{let A=await Qi(g);if(A.length===0)throw new yr("No workspaces found in your account. Please make sure you have at least one workspace.");y=await es(A)}c="scaffold",await Da(e,t,n,r,void 0,void 0),p=!0,process.chdir(s);let b=o??n;Se({cloud:{framework:b,workspace_id:y.id}}),Hn({apiToken:g,directory:"."}),process.env.WEBFLOW_API_TOKEN=g;let S=Date.now()-h;try{await F.forCloud({authToken:g}).sendUsage("project_init",{scaffold:b,scaffoldName:b,initMode:xe.New,workspaceId:y.id,totalDuration:S,mountPath:t,namespace:Zi()})}catch{}d=!0}catch(h){if(m=h,h instanceof f||h instanceof Error&&h.message.includes("OAuth")){try{await Da(e,t,n,r),process.chdir(s),Se({cloud:{framework:o??n}}),Hn({directory:"."}),p=!0}catch{}throw u.error(h),new f(h,{skipLogging:!0})}throw h}finally{if(l)try{Mm.default.removeSync(l)}catch{}if(d){let h=Bv(e,xe.New);Ba=()=>u.info(h)}else{let h=jv(c,m,xe.New),g=Uv(e,xe.New,h,p);Ba=()=>u.info(g)}}},XT=async(e,t,n,r,o)=>{let i=`./${e}`,s=null,a=!1,l="content"in r&&typeof r.content=="object"&&"extractionRoot"in r.content?r.content:null,c=l?Ro.dirname(l.extractionRoot):null,d="auth",p=!1,m=!1,h=null;try{let g=Date.now();await zT(e,n,r),process.chdir(i);let{manifest:y}=ne(),b=await Ke(y,{site:o}),S=b.accessToken,A=b.siteId;if(s=F.forCloud({authToken:S,siteId:A}),d="scaffold",await Da(".",t,n,r,A,S),m=!0,d="devlink",A){u.info(`${je} Running devlink export to fetch your Webflow components`);try{await YT({site:A,apiToken:S}),a=!0}catch(x){io(x)?u.info(`${je} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(x,{prefix:"Failed to run devlink export:"})}}let v=Date.now()-g;await s?.sendUsage("project_init",{scaffold:n,scaffoldName:n,devlinkSyncStatus:a,totalDuration:v,mountPath:t,namespace:Zi()}),p=!0}catch(g){h=g,u.error(g);try{await Da(".",t,n,r),m=!0}catch{}throw new f(g,{skipLogging:!0})}finally{if(c)try{Mm.default.removeSync(c)}catch{}if(p){let g=Bv(e,xe.Existing);Ba=()=>u.info(g)}else{let g=jv(d,h,xe.Existing),y=Uv(e,xe.Existing,g,m);Ba=()=>u.info(y)}}},YT=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(yc(),Cb));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},ZT=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=ne();return sm(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},QT=async(e,t,n,r)=>{u.info(Ne("Validating mount path configuration..."));let o=await Sv(e,t,n);if(o.isValid)u.info(K("Mount path validation passed"));else if(u.info(R(`
181
+ Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?$:re,a=i.isValid?K(`${i.domain} (mountPath: ${i.mountPaths[0]})`):le(`${i.domain} (no matching mountPath)`);u.info(`${s} ${a}`),i.error&&u.debug(` Error: ${i.error}`)}),o.needsPublishing)if(r){u.info("\u{1F680} Auto-publishing site to update mount path configuration...");let i=o.domains.filter(s=>!s.isValid).map(s=>s.domain);await Pm(e,i)}else if(await _v()&&on()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await Fv(s);await Pm(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},eP=async(e,t,n,r)=>{Sm("\u{1F3D7}\uFE0F ","Building app");let o=await cv(e,{mountPath:n,telemetry:r?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id});Sm("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await bv(o,t.upload_url);let s=Date.now()-i;return u.info(`${$} Upload completed in ${(s/1e3).toFixed(1)}s`),o},tP=async(e,t,n,r)=>{u.success(`
182
+ \u{1F310} Your cloud app will soon be available at:`);try{let o=r?.domainsOverride??await xv(e,t,n),i=Cv(o??[],t);i?.length>0?i.forEach(s=>{u.info(` ${s}`)}):u.warn(" No domains found with the correct mount path configuration yet.")}catch(o){u.warn(` Could not determine deployment links: ${o instanceof Error?o.message:o}`)}},nP=e=>{e.site_slug?u.success(`Visit your deployment:
183
183
 
184
- ${Uo}/dashboard/sites/${e.site_slug}/webflow-cloud/projects/${e.project_id}/environments/${e.environment_id}/deployments/${e.deployment_id}`):u.info(`
185
- Visit the webflow Cloud dashboard to view your deployment: https://webflow.com/dashboard/sites`)},XT=async(e,t,r,n,o)=>{try{if(await sE(t.completion_url,!!n),n)u.error(`
186
- ${b} Deployment failed due to build error.`);else{u.success(`
187
- ${L} Deployment triggered successfully!`);let i;try{let{manifest:s}=Z();pf(s)&&(i=[`${o?.projectName??po.basename(process.cwd())}.webflow.io`])}catch(s){u.debug(`Could not read manifest for standalone deploy link hint: ${s instanceof Error?s.message:String(s)}`)}await qT(e,r,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),YT(t)}}catch(i){throw new f(i,{prefix:"Failed to trigger deployment:"})}},ZT=(e,t)=>{e&&Yb(process.cwd(),e),t&&qb(t)},EE=async(e,t,r,n)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=Rf(process.cwd()),d=n?.telemetry;await d?.sendUsage("cloud_deploy_start",{environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,cloudflareBindings:c,namespace:Ci()});try{Bb(u,process.cwd()),o=await rE(e,t,r,n),u.info("\u{1F527} Detecting framework..."),a=await zb(process.cwd(),o.deploy_url,o.environment_id,r),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),KT(n)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await zT(e,r,o.environment_id,n?.autoPublish),i=await JT(a,o,r,n),u.info(`Starting deployment process for environment: ${t} at mount path: ${r}`);let p=Date.now()-s;await d?.sendUsage("cloud_deploy_success",{duration:p,environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:Ci()})}catch(p){l=p instanceof Error?p:new Error(String(p)),u.error(l,{prefix:"Error during deployment initialization:"});let h=Date.now()-s;await d?.sendError(l,"cloud_deploy_failure",{duration:h,environment:t,mountPath:r,projectName:n?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:Ci()})}finally{if(ZT(a,i),o&&await XT(e,o,r,l,{projectName:n?.projectName}),l)throw new f(l,{skipLogging:!0})}},SE=e=>{let t=Math.max(...e.map(i=>pt(i).length)),r=R(`\u250C${"\u2500".repeat(t+2)}\u2510`),n=R(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-pt(i).length);return`${R("\u2502")} ${i}${s} ${R("\u2502")}`});return[r,...o,n].join(`
188
- `)},xE=(e,t)=>{let r=[vt(`${ot} Get started with the following commands:`),V(`cd ${e}`),V("npm install"),V("npm run dev"),V("webflow cloud deploy")];return t!==we.New&&(r.push(""),r.push(vt(`${ot} Run the following command to export Webflow components when they update:`)),r.push(V("webflow devlink export"))),SE(r)},CE=(e,t,r,n=!0)=>{let o=[],i=t===we.New?"webflow cloud init --new":"webflow cloud init",s=l=>n?`App scaffold created at ${e}/ but ${l}`:l.charAt(0).toUpperCase()+l.slice(1),a=n?[V(`cd ${e}`)]:[];switch(r){case"auth":o.push(vt(`${ot} ${s("Webflow authentication did not complete.")}`),"",vt(n?"To finish setup:":"To retry:"),...a,V("webflow auth login"),V(i));break;case"no-sites":o.push(vt(`${ot} ${s("no Webflow sites were found in your account.")}`),"",vt(n?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,V("webflow cloud init"));break;case"no-workspaces":o.push(vt(`${ot} ${s("no Webflow workspaces were found in your account.")}`),"",vt(n?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,V("webflow cloud init --new"));break;default:o.push(vt(`${ot} ${s("setup did not complete.")}`),"",vt(n?"To retry setup:":"To retry:"),...a,V(i));break}return SE(o)};N();Qr();var fo=require("commander");de();x();N();Qr();function _E(e,t,r){ct()&&e==="cloud"&&(r.json||u.warn(`${he} ${ne(`webflow cloud ${t}`)} is deprecated \u2014 use ${ne(`webflow apps ${t}`)} instead.`))}function $c(e,{namespace:t}){e.command("init").description("Bootstrap a new Webflow Cloud app").addOption(new fo.Option("-n, --app-name <name>","App name")).addOption(new fo.Option("--project-name <name>",`${Tr} Use --app-name instead.`)).option("-f, --framework <framework>","Framework to use (e.g., astro, nextjs)").option("-m, --mount <mount>","Mount path (default: '/' for new domain, '/app' for existing site)").option("-s, --site-id <siteId>","Webflow site ID to connect to").option("--new","Create an app without connecting to an existing site").option("-w, --workspace-id <workspaceId>","Workspace ID where the app should be deployed (skips workspace picker)").action(async(r,n)=>{Bf(t),_E(t,"init",r),await QT(r,n)})}function Lc(e,{namespace:t}){e.command("deploy").description("Deploy your Webflow Cloud app").option("-e, --environment <environment>","Environment name").option("-m, --mount <mount>","Mount path (e.g., /app)").addOption(new fo.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new fo.Option("--project-name <name>",`${Tr} Use --app-name instead.`)).option("-d, --directory <path>","App directory path (for new apps)").option("--description <description>","App description (for new apps)").option("--skip-mount-path-check","Skip mount path checking").option("--auto-publish","Automatically publish site for mount path updates").option("-s, --site-id <siteId>","Webflow site ID for site-attached deploys (skips site picker)").addOption(new fo.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new fo.Option("--project-id <appId>",`${Tr} Use --app-id instead.`)).option("-f, --framework <framework>","Override framework detection (e.g., nextjs, astro)").option("-w, --workspace-id <workspaceId>","Workspace ID where the app will be deployed (skips workspace picker)").action(async(r,n)=>{Bf(t),_E(t,"deploy",r),await eR(r,n)})}var QT=Hf,eR=Vf;var FE=e=>{let t=ct(),r=e.command("cloud").description(t?`${Tr} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");r.command("create").description(`${Tr} Use 'webflow ${t?"apps":"cloud"} init' instead. Quick non-interactive scaffold for site-attached apps (hardcoded to /app).`).argument("<name>","App name").option("-f, --framework <framework>","Framework to use","nextjs").action(Uf),r.command("list").description(t?`${Tr} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Tr} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(Wf),$c(r,{namespace:"cloud"}),Lc(r,{namespace:"cloud"})};var KE=require("commander");J();S();x();N();z();ye();S();dt();dt();S();async function la(e,t,r,n){let o=[],i=0,s=100;for(;;){let a=new URL(e);a.searchParams.set("limit",String(s)),a.searchParams.set("offset",String(i));let l=await G(a.toString(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!l.ok)throw new f(`${n}: ${l.status} ${l.statusText}`);let c=await l.json(),d=c[r]??[];o.push(...d);let p=c.pagination?.total??d.length;if(i+=d.length,i>=p||d.length<s)break}return o}function mo(e,t){if(Array.isArray(e))return{items:e,nextCursor:null};if(e&&typeof e=="object"){let r=e;return{items:r[t]??[],nextCursor:r.nextCursor??null}}return{items:[],nextCursor:null}}var tR=100;async function ca(e,t){let r=[],n=t?.maxPages??tR,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(r.push(...a),s+=1,!l)break;if(o.has(l))throw new f("Pagination aborted: the server returned a repeated cursor, which would loop indefinitely.");if(o.add(l),s>=n)throw new f(`Pagination aborted after ${n} pages (safety cap). The result set is larger than expected.`);i=l}return r}var Nc=100;function Fi(e,t={}){let r=[];return t.limit!==void 0&&Number.isFinite(t.limit)&&r.push(`limit=${encodeURIComponent(String(t.limit))}`),t.cursor&&r.push(`cursor=${encodeURIComponent(t.cursor)}`),r.length>0?`${e}?${r.join("&")}`:e}var rR="1.0.0";function ut(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":rR}}async function At(e,t={}){let{scopeLabel:r="apps",fallbackPrefix:n,userErrorOn4xx:o=!1}=t,i={};try{i=JSON.parse(await e.text())}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new f(`Missing required scopes for ${r}.
184
+ ${kn}/dashboard/sites/${e.site_slug}/webflow-cloud/projects/${e.project_id}/environments/${e.environment_id}/deployments/${e.deployment_id}`):u.info(`
185
+ Visit the webflow Cloud dashboard to view your deployment: https://webflow.com/dashboard/sites`)},rP=async(e,t,n,r,o)=>{try{if(await kv(t.completion_url,!!r),r)u.error(`
186
+ ${k} Deployment failed due to build error.`);else{u.success(`
187
+ ${$} Deployment triggered successfully!`);let i;try{let{manifest:s}=ne();sm(s)&&(i=[`${o?.projectName??Ro.basename(process.cwd())}.webflow.io`])}catch(s){u.debug(`Could not read manifest for standalone deploy link hint: ${s instanceof Error?s.message:String(s)}`)}await tP(e,n,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),nP(t)}}catch(i){throw new f(i,{prefix:"Failed to trigger deployment:"})}},oP=(e,t)=>{e&&dv(process.cwd(),e),t&&uv(t)},Nv=async(e,t,n,r)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=xm(process.cwd()),d=r?.telemetry;await d?.sendUsage("cloud_deploy_start",{environment:t,mountPath:n,projectName:r?.projectName,hasDescription:!!r?.description,hasDirectory:!!r?.directory,cloudflareBindings:c,namespace:Zi()});try{ev(u,process.cwd()),o=await yv(e,t,n,r),u.info("\u{1F527} Detecting framework..."),a=await lv(process.cwd(),o.deploy_url,o.environment_id,n),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),ZT(r)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await QT(e,n,o.environment_id,r?.autoPublish),i=await eP(a,o,n,r),u.info(`Starting deployment process for environment: ${t} at mount path: ${n}`);let p=Date.now()-s;await d?.sendUsage("cloud_deploy_success",{duration:p,environment:t,mountPath:n,projectName:r?.projectName,hasDescription:!!r?.description,hasDirectory:!!r?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:Zi()})}catch(p){l=p instanceof Error?p:new Error(String(p)),u.error(l,{prefix:"Error during deployment initialization:"});let m=Date.now()-s;await d?.sendError(l,"cloud_deploy_failure",{duration:m,environment:t,mountPath:n,projectName:r?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:Zi()})}finally{if(oP(a,i),o&&await rP(e,o,n,l,{projectName:r?.projectName}),l)throw new f(l,{skipLogging:!0})}},Mv=e=>{let t=Math.max(...e.map(i=>wt(i).length)),n=R(`\u250C${"\u2500".repeat(t+2)}\u2510`),r=R(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-wt(i).length);return`${R("\u2502")} ${i}${s} ${R("\u2502")}`});return[n,...o,r].join(`
188
+ `)},Bv=(e,t)=>{let n=[Ft(`${at} Get started with the following commands:`),K(`cd ${e}`),K("npm install"),K("npm run dev"),K("webflow cloud deploy")];return t!==xe.New&&(n.push(""),n.push(Ft(`${at} Run the following command to export Webflow components when they update:`)),n.push(K("webflow devlink export"))),Mv(n)},Uv=(e,t,n,r=!0)=>{let o=[],i=t===xe.New?"webflow cloud init --new":"webflow cloud init",s=l=>r?`App scaffold created at ${e}/ but ${l}`:l.charAt(0).toUpperCase()+l.slice(1),a=r?[K(`cd ${e}`)]:[];switch(n){case"auth":o.push(Ft(`${at} ${s("Webflow authentication did not complete.")}`),"",Ft(r?"To finish setup:":"To retry:"),...a,K("webflow auth login"),K(i));break;case"no-sites":o.push(Ft(`${at} ${s("no Webflow sites were found in your account.")}`),"",Ft(r?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,K("webflow cloud init"));break;case"no-workspaces":o.push(Ft(`${at} ${s("no Webflow workspaces were found in your account.")}`),"",Ft(r?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,K("webflow cloud init --new"));break;default:o.push(Ft(`${at} ${s("setup did not complete.")}`),"",Ft(r?"To retry setup:":"To retry:"),...a,K(i));break}return Mv(o)};M();Wn();var To=require("commander");pe();_();M();Wn();function Wv(e,t,n){tt()&&e==="cloud"&&(n.json||u.warn(`${re} ${le(`webflow cloud ${t}`)} is deprecated \u2014 use ${le(`webflow apps ${t}`)} instead.`))}function yu(e,{namespace:t}){e.command("init").description("Bootstrap a new Webflow Cloud app").addOption(new To.Option("-n, --app-name <name>","App name")).addOption(new To.Option("--project-name <name>",`${Mn} Use --app-name instead.`)).option("-f, --framework <framework>","Framework to use (e.g., astro, nextjs)").option("-m, --mount <mount>","Mount path (default: '/' for new domain, '/app' for existing site)").option("-s, --site-id <siteId>","Webflow site ID to connect to").option("--new","Create an app without connecting to an existing site").option("-w, --workspace-id <workspaceId>","Workspace ID where the app should be deployed (skips workspace picker)").action(async(n,r)=>{$m(t),Wv(t,"init",n),await iP(n,r)})}function wu(e,{namespace:t}){e.command("deploy").description("Deploy your Webflow Cloud app").option("-e, --environment <environment>","Environment name").option("-m, --mount <mount>","Mount path (e.g., /app)").addOption(new To.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new To.Option("--project-name <name>",`${Mn} Use --app-name instead.`)).option("-d, --directory <path>","App directory path (for new apps)").option("--description <description>","App description (for new apps)").option("--skip-mount-path-check","Skip mount path checking").option("--auto-publish","Automatically publish site for mount path updates").option("-s, --site-id <siteId>","Webflow site ID for site-attached deploys (skips site picker)").addOption(new To.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new To.Option("--project-id <appId>",`${Mn} Use --app-id instead.`)).option("-f, --framework <framework>","Override framework detection (e.g., nextjs, astro)").option("-w, --workspace-id <workspaceId>","Workspace ID where the app will be deployed (skips workspace picker)").action(async(n,r)=>{$m(t),Wv(t,"deploy",n),await sP(n,r)})}var iP=Nm,sP=jm;var Hv=e=>{let t=tt(),n=e.command("cloud").description(t?`${Mn} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");n.command("create").description(`${Mn} Use 'webflow ${t?"apps":"cloud"} init' instead. Quick non-interactive scaffold for site-attached apps (hardcoded to /app).`).argument("<name>","App name").option("-f, --framework <framework>","Framework to use","nextjs").action(Om),n.command("list").description(t?`${Mn} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Mn} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(Lm),yu(n,{namespace:"cloud"}),wu(n,{namespace:"cloud"})};var aS=require("commander");q();C();_();M();X();be();C();lt();lt();C();async function Ua(e,t,n,r){let o=[],i=0,s=100;for(;;){let a=new URL(e);a.searchParams.set("limit",String(s)),a.searchParams.set("offset",String(i));let l=await J(a.toString(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!l.ok)throw new f(`${r}: ${l.status} ${l.statusText}`);let c=await l.json(),d=c[n]??[];o.push(...d);let p=c.pagination?.total??d.length;if(i+=d.length,i>=p||d.length<s)break}return o}function Po(e,t){if(Array.isArray(e))return{items:e,nextCursor:null};if(e&&typeof e=="object"){let n=e;return{items:n[t]??[],nextCursor:n.nextCursor??null}}return{items:[],nextCursor:null}}var aP=100;async function Wa(e,t){let n=[],r=t?.maxPages??aP,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(n.push(...a),s+=1,!l)break;if(o.has(l))throw new f("Pagination aborted: the server returned a repeated cursor, which would loop indefinitely.");if(o.add(l),s>=r)throw new f(`Pagination aborted after ${r} pages (safety cap). The result set is larger than expected.`);i=l}return n}var Du=100;function ns(e){return Object.values(e).some(t=>t!==void 0)}function rs(e,t={}){let n=[];if(t.limit!==void 0&&Number.isFinite(t.limit)&&n.push(`limit=${encodeURIComponent(String(t.limit))}`),t.cursor&&n.push(`cursor=${encodeURIComponent(t.cursor)}`),t.filters)for(let[r,o]of Object.entries(t.filters)){if(o===void 0)continue;let i=o.trim();if(i==="")throw new f(`List filter "${r}" must be a non-empty value.`,{isUserError:!0});n.push(`${r}=${encodeURIComponent(i)}`)}return n.length>0?`${e}?${n.join("&")}`:e}var lP="1.0.0";function yt(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":lP}}async function Tt(e,t={}){let{scopeLabel:n="apps",fallbackPrefix:r,userErrorOn4xx:o=!1}=t,i={};try{i=JSON.parse(await e.text())}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new f(`Missing required scopes for ${n}.
189
189
  ${s??""}
190
- Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0});let a=n?`${n}: `:"",l=o&&e.status>=400&&e.status<500;return new f(`${a}${e.status} ${e.statusText}`+(s?`
191
- ${s}`:""),l?{isUserError:!0}:void 0)}async function nR(e,t){let r=await G(Fi(`${I}/cosmic/apps`,{limit:Nc,cursor:t}),{headers:ut(e)});if(!r.ok)throw await At(r);return mo(await r.json(),"apps")}async function jc(e){return ca(t=>nR(e,t))}async function Mc(e,t){Ce(t,"appId");let r=await G(`${I}/cosmic/apps/${encodeURIComponent(t)}`,{headers:ut(e)});if(!r.ok)throw await At(r);return await r.json()}async function AE(e,t,r){Ce(t,"appId");let n=await G(`${I}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...ut(e),"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw await At(n);return await n.json()}async function TE(e,t){Ce(t,"appId");let r=await G(`${I}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:ut(e)});if(!r.ok)throw await At(r);return await r.json()}async function RE(e,t,r={}){Ce(t,"appId");let n=Fi(`${I}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:r.limit,cursor:r.cursor}),o=await G(n,{headers:ut(e)});if(!o.ok)throw await At(o);let{items:i,nextCursor:s}=mo(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function oR(e,t,r){let n=await G(Fi(`${I}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:Nc,cursor:r}),{headers:ut(e)});if(!n.ok)throw await At(n);return mo(await n.json(),"environments")}async function Bc(e,t){return Ce(t,"appId"),ca(r=>oR(e,t,r))}function IE(e={}){let t=[];return e.limit!==void 0&&Number.isFinite(e.limit)&&t.push(`limit=${encodeURIComponent(String(e.limit))}`),e.cursor!==void 0&&t.push(`cursor=${encodeURIComponent(e.cursor)}`),e.since!==void 0&&t.push(`since=${encodeURIComponent(e.since)}`),e.q!==void 0&&t.push(`q=${encodeURIComponent(e.q)}`),t.length>0?`?${t.join("&")}`:""}async function OE(e,t,r,n,o={}){Ce(t,"appId"),Ce(r,"environmentId"),bn(n,"deploymentId");let i=await G(`${I}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/buildLogs${IE(o)}`,{headers:ut(e)});if(!i.ok)throw await At(i);return await i.json()}async function PE(e,t,r,n={}){Ce(t,"appId"),Ce(r,"environmentId");let o=await G(`${I}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/logs${IE(n)}`,{headers:ut(e)});if(!o.ok)throw await At(o);return await o.json()}async function Uc(e,t,r,n={}){Ce(t,"appId"),Ce(r,"environmentId");let o=await G(Fi(`${I}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{limit:n.limit,cursor:n.cursor}),{headers:ut(e)});if(!o.ok)throw await At(o);let{items:i,nextCursor:s}=mo(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function Wc(e,t,r,n,o={}){Ce(t,"appId"),Ce(r,"environmentId"),bn(n,"deploymentId");let i=await G(`${I}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}`,{headers:ut(e),signal:o.signal});if(!i.ok)throw await At(i);return await i.json()}async function $E(e,t,r,n,o={}){Ce(t,"appId"),Ce(r,"environmentId"),bn(n,"deploymentId");let i=await G(`${I}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/redeploy`,{method:"POST",headers:{...ut(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await At(i);return await i.json()}async function Kf(e){let t=await T(),r=_.forApps({authToken:t}),n=Date.now();try{let o=await jc(t);if(await r.sendUsage("apps_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No apps found.");return}let i=De(e.fields,ic,cn());u.info(sc(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to list apps:`}))}}J();S();x();N();z();Me();S();pe();Ae();async function Hc(e,t={}){let r=await jc(e);if(r.length===0)throw new f("No apps found in this workspace.",{isUserError:!0});if(r.length===1)return r[0].id;if(W()||t.json){let o=r.map(i=>` ${i.id} (${i.name})`).join(`
190
+ Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0});let a=r?`${r}: `:"",l=o&&e.status>=400&&e.status<500;return new f(`${a}${e.status} ${e.statusText}`+(s?`
191
+ ${s}`:""),l?{isUserError:!0}:void 0)}async function cP(e,t,n={}){let r=await J(rs(`${P}/cosmic/apps`,{limit:Du,cursor:t,filters:n}),{headers:yt(e)});if(!r.ok)throw await Tt(r);return Po(await r.json(),"apps")}async function bu(e,t={}){return Wa(n=>cP(e,n,t))}async function ku(e,t){Oe(t,"appId");let n=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}`,{headers:yt(e)});if(!n.ok)throw await Tt(n);return await n.json()}async function Vv(e,t,n){Oe(t,"appId");let r=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...yt(e),"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await Tt(r);return await r.json()}async function Gv(e,t){Oe(t,"appId");let n=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:yt(e)});if(!n.ok)throw await Tt(n);return await n.json()}async function Jv(e,t,n={}){Oe(t,"appId");let r=rs(`${P}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:n.limit,cursor:n.cursor}),o=await J(r,{headers:yt(e)});if(!o.ok)throw await Tt(o);let{items:i,nextCursor:s}=Po(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function uP(e,t,n,r={}){let o=await J(rs(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:Du,cursor:n,filters:r}),{headers:yt(e)});if(!o.ok)throw await Tt(o);return Po(await o.json(),"environments")}async function Eu(e,t,n={}){return Oe(t,"appId"),Wa(r=>uP(e,t,r,n))}function Kv(e={}){let t=[];return e.limit!==void 0&&Number.isFinite(e.limit)&&t.push(`limit=${encodeURIComponent(String(e.limit))}`),e.cursor!==void 0&&t.push(`cursor=${encodeURIComponent(e.cursor)}`),e.since!==void 0&&t.push(`since=${encodeURIComponent(e.since)}`),e.q!==void 0&&t.push(`q=${encodeURIComponent(e.q)}`),t.length>0?`?${t.join("&")}`:""}async function zv(e,t,n,r,o={}){Oe(t,"appId"),Oe(n,"environmentId"),Or(r,"deploymentId");let i=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/buildLogs${Kv(o)}`,{headers:yt(e)});if(!i.ok)throw await Tt(i);return await i.json()}async function qv(e,t,n,r={}){Oe(t,"appId"),Oe(n,"environmentId");let o=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/logs${Kv(r)}`,{headers:yt(e)});if(!o.ok)throw await Tt(o);return await o.json()}async function Xv(e,t,n,r={}){Oe(t,"appId"),Oe(n,"environmentId");let o=await J(rs(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments`,{limit:r.limit,cursor:r.cursor}),{headers:yt(e)});if(!o.ok)throw await Tt(o);let{items:i,nextCursor:s}=Po(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function vu(e,t,n,r,o={}){Oe(t,"appId"),Oe(n,"environmentId"),Or(r,"deploymentId");let i=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}`,{headers:yt(e),signal:o.signal});if(!i.ok)throw await Tt(i);return await i.json()}async function Yv(e,t,n,r,o={}){Oe(t,"appId"),Oe(n,"environmentId"),Or(r,"deploymentId");let i=await J(`${P}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/redeploy`,{method:"POST",headers:{...yt(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await Tt(i);return await i.json()}async function Bm(e){let t=await T(),n=F.forApps({authToken:t}),r=Date.now();try{let o={siteId:e.site,name:e.name,q:e.q},i=ns(o),s=await bu(t,o);if(await n.sendUsage("apps_list",{duration:Date.now()-r,count:s.length,filtered:i}),e.json){u.info(JSON.stringify(s,null,2));return}if(s.length===0){u.info(i?"No apps matched the given filters.":"No apps found.");return}let a=Ce(e.fields,Bc,vr());u.info(Uc(s,a))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list apps:`}))}}q();C();_();M();X();We();C();we();Te();async function Su(e,t={}){let n=await bu(e);if(n.length===0)throw new f("No apps found in this workspace.",{isUserError:!0});if(n.length===1)return n[0].id;if(V()||t.json){let o=n.map(i=>` ${i.id} (${i.name})`).join(`
192
192
  `);throw new f(`This workspace has multiple apps. Pass the app id to choose one:
193
- ${o}`,{isUserError:!0,missingFlag:"appId"})}let n=await Be({message:"Select an app:",choices:r.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!n)throw new f("No app selected.",{isUserError:!0});return n}async function Er(e,t,r){let{manifest:n}=Z();return uo("appId",{flagValue:t,manifest:n,isNoInput:!1,json:r.json,prompt:()=>Hc(e,{json:r.json})})}async function zf(e,t){let r=await T(),n=await Er(r,e,t),o=_.forApps({authToken:r}),i=Date.now();try{let s=await Mc(r,n);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=De(t.fields,ic,cn());u.info(sc([s],a))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new f(s,{prefix:`${b} Failed to get app:`}))}}J();S();x();N();z();async function Jf(e,t){let r=await T(),n=await Er(r,e,t),o=_.forApps({authToken:r}),i=Date.now();try{let s=await RE(r,n,{limit:t.limit,cursor:t.cursor});if(await o.sendUsage("apps_domains",{duration:Date.now()-i,count:s.customDomains.length}),t.json){u.info(JSON.stringify(s,null,2));return}if(s.customDomains.length===0){u.info("No domains found.");return}let a=De(t.fields,jk,$s());u.info(Bk(s.customDomains,a)+ni(s.nextCursor))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new f(s,{prefix:`${b} Failed to get app domains:`}))}}J();S();x();N();z();async function qf(e,t){let r=await T(),n=await Er(r,e,t),o=t.json?void 0:De(t.fields,Mk,Ls()),i=_.forApps({authToken:r}),s=Date.now();try{let a=await Bc(r,n);if(await i.sendUsage("apps_environments_list",{duration:Date.now()-s,count:a.length}),t.json){u.info(JSON.stringify(a,null,2));return}if(a.length===0){u.info("No environments found.");return}u.info(Uk(a,o))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new f(a,{prefix:`${b} Failed to list app environments:`}))}}J();S();x();N();z();de();var Yf=["timestamp","message","phase"],ua="timestamp,message",Vc=st(Yf);function vn(){return Yf}function iR(e,t){return e==null||e===""?R("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function sR(e,t=ua.split(",")){return e.map(r=>t.map(n=>iR(r[n],n)).join(" ")).join(`
194
- `)}function Gc(e,t,r){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":sR(e.logs,r)+ni(e.nextCursor)}function LE(e){return e[0]?.id}Me();S();pe();Ae();async function NE(e,t,r={}){let n=await Bc(e,t);if(n.length===0)throw new f("No environments found for this app.",{isUserError:!0});if(n.length===1)return n[0].id;if(W()||r.json){let i=n.map(s=>` ${s.id} (${s.branch})`).join(`
193
+ ${o}`,{isUserError:!0,missingFlag:"appId"})}let r=await Me({message:"Select an app:",choices:n.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!r)throw new f("No app selected.",{isUserError:!0});return r}async function Rn(e,t,n){let{manifest:r}=ne();return Io("appId",{flagValue:t,manifest:r,isNoInput:!1,json:n.json,prompt:()=>Su(e,{json:n.json})})}async function Um(e,t){let n=await T(),r=await Rn(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await ku(n,r);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=Ce(t.fields,Bc,vr());u.info(Uc([s],a))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to get app:`}))}}q();C();_();M();X();async function Wm(e,t){let n=await T(),r=await Rn(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await Jv(n,r,{limit:t.limit,cursor:t.cursor});if(await o.sendUsage("apps_domains",{duration:Date.now()-i,count:s.customDomains.length}),t.json){u.info(JSON.stringify(s,null,2));return}if(s.customDomains.length===0){u.info("No domains found.");return}let a=Ce(t.fields,zk,ua());u.info(Xk(s.customDomains,a)+_i(s.nextCursor))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to get app domains:`}))}}q();C();_();M();X();async function Hm(e,t){let n=await T(),r=await Rn(n,e,t),o=t.json?void 0:Ce(t.fields,qk,da()),i=F.forApps({authToken:n}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=ns(a),c=await Eu(n,r,a);if(await i.sendUsage("apps_environments_list",{duration:Date.now()-s,count:c.length,filtered:l}),t.json){u.info(JSON.stringify(c,null,2));return}if(c.length===0){u.info(l?"No environments matched the given filters.":"No environments found.");return}u.info(Yk(c,o))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to list app environments:`}))}}q();C();_();M();X();pe();var Vm=["timestamp","message","phase"],Ha="timestamp,message",xu=ut(Vm);function Nr(){return Vm}function dP(e,t){return e==null||e===""?R("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function pP(e,t=Ha.split(",")){return e.map(n=>t.map(r=>dP(n[r],r)).join(" ")).join(`
194
+ `)}function Cu(e,t,n){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":pP(e.logs,n)+_i(e.nextCursor)}We();C();we();Te();async function Zv(e,t,n={}){let r=await Eu(e,t);if(r.length===0)throw new f("No environments found for this app.",{isUserError:!0});if(r.length===1)return r[0].id;if(V()||n.json){let i=r.map(s=>` ${s.id} (${s.branch})`).join(`
195
195
  `);throw new f(`This app has multiple environments. Pass the environment id to choose one:
196
- ${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await Be({message:"Select an environment:",choices:n.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new f("No environment selected.",{isUserError:!0});return o}async function Xe(e,t){let{manifest:r}=Z(),n=await uo("appId",{flagValue:t.appId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>Hc(e,{json:t.json})}),o=await uo("environmentId",{flagValue:t.environmentId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>NE(e,n,{json:t.json})});return{appId:n,envId:o}}async function Xf(e,t){let r=await T(),{appId:n,envId:o}=await Xe(r,{json:t.json}),i=t.json?void 0:De(t.fields,Vc,vn()),s=_.forApps({authToken:r}),a=Date.now();try{let l=e;if(!l){let{deployments:d}=await Uc(r,n,o,{limit:1});if(l=LE(d),!l)throw new f("No deployments found for this environment.",{isUserError:!0})}let c=await OE(r,n,o,l,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_build",{duration:Date.now()-a,count:c.logs.length}),u.info(Gc(c,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new f(l,{prefix:`${b} Failed to read build logs:`}))}}J();S();x();N();z();async function Zf(e,t){let r=await T(),{appId:n,envId:o}=await Xe(r,{environmentId:e,json:t.json}),i=t.json?void 0:De(t.fields,Vc,vn()),s=_.forApps({authToken:r}),a=Date.now();try{let l=await PE(r,n,o,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_runtime",{duration:Date.now()-a,count:l.logs.length}),u.info(Gc(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new f(l,{prefix:`${b} Failed to read runtime logs:`}))}}J();S();x();N();z();async function Qf(e){let t=await T(),{appId:r,envId:n}=await Xe(t,{json:e.json}),o=e.json?void 0:De(e.fields,cc,un()),i=_.forApps({authToken:t}),s=Date.now();try{let a=await Uc(t,r,n,{limit:e.limit,cursor:e.cursor});if(await i.sendUsage("apps_deployments_list",{duration:Date.now()-s,count:a.deployments.length}),e.json){u.info(JSON.stringify(a,null,2));return}if(a.deployments.length===0){u.info("No deployments found.");return}u.info(js(a.deployments,o)+ni(a.nextCursor))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new f(a,{prefix:`${b} Failed to list deployments:`}))}}J();de();S();pe();x();N();z();var aR=5,jE=1800;function lR(e){return new Promise(t=>setTimeout(t,e))}async function ME(e,t,r,n,o={}){let i=Math.min(jE,Math.max(aR,o.interval??ac)),s=Math.min(jE,Math.max(1,o.timeout??lc)),a=Date.now()+s*1e3,l,c,d=!1;for(;;){let p=new AbortController,h=setTimeout(()=>p.abort(),Math.max(0,a-Date.now())),g;try{g=await Wc(e,t,r,n,{signal:p.signal})}catch(k){if(p.signal.aborted){d=!0;break}throw k}finally{clearTimeout(h)}c=g;let m=g.status;if(Hk(m))break;let w=a-Date.now();if(w<=0){d=!0;break}if(m!==l&&o.onStatusChange?.(l,m),l=m,await lR(Math.min(i*1e3,w)),Date.now()>=a){d=!0;break}}return{deployment:c,timedOut:d,timeoutSeconds:s}}async function em(e,t){let r=await T(),{appId:n,envId:o}=await Xe(r,{json:t.json}),i=t.json?void 0:De(t.fields,cc,un()),s=_.forApps({authToken:r}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let d=!t.json&&!W(),{deployment:p,timedOut:h,timeoutSeconds:g}=await ME(r,n,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:d?(w,k)=>u.info(R(w===void 0?k:`${w} \u2192 ${k}`)):void 0}),m=h?"timeout":p?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:m}),process.exitCode=!h&&p?.status==="success"?0:1,t.json){u.info(JSON.stringify(p??null,null,2));return}p&&u.info(js([p],i)),h&&u.warn(`Timed out after ${g}s waiting for a terminal status (last status: ${p?.status??"unknown"}).`);return}let c=await Wc(r,n,o,e);if(await s.sendUsage("apps_deployments_get",{duration:Date.now()-a}),t.json){u.info(JSON.stringify(c,null,2));return}u.info(js([c],i))}catch(c){throw c instanceof f&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new f(c,{prefix:`${b} Failed to ${t.wait?"watch":"get"} deployment:`}))}}J();de();S();x();N();z();async function tm(e,t){let r=await T(),{appId:n,envId:o}=await Xe(r,{json:t.json});if(t.dryRun){Ce(n,"appId"),Ce(o,"environmentId"),bn(e,"deploymentId"),t.json?u.info(JSON.stringify({deploymentId:e,appId:n,environmentId:o,dryRun:!0},null,2)):(u.info(`Would redeploy deployment ${e} (same commit) in app ${n}, environment ${o}.`),u.info("Dry run \u2014 no changes made."));return}let i=_.forApps({authToken:r,suppressCommand:!!t.idempotencyKey}),s=Date.now();try{let a=await $E(r,n,o,e,{idempotencyKey:t.idempotencyKey});if(await i.sendUsage("apps_deployments_redeploy",{duration:Date.now()-s}),t.json){u.info(JSON.stringify(a,null,2));return}let l=a.commitSha.slice(0,7);a.status==="queued"?u.info(`${L} Redeploy queued \u2014 commit ${l}`):u.info(`${Fe} Redeploy in progress \u2014 commit ${l} ${R("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_redeploy",{duration:Date.now()-s}),new f(a,{prefix:`${b} Failed to redeploy deployment:`}))}}J();S();x();N();z();async function rm(e,t){if(t.name===void 0&&t.description===void 0)throw new f("Provide --name or --description",{isUserError:!0});let r=await T(),n=await Er(r,e,t);if(Ce(n,"appId"),t.dryRun){u.info(`Dry run \u2014 would update app: ${n}`),t.name!==void 0&&u.info(` Name: ${t.name}`),t.description!==void 0&&u.info(` Description: ${t.description}`),u.info("Dry run complete \u2014 no changes made.");return}let o=_.forApps({authToken:r}),i=Date.now();try{let s=await AE(r,n,{name:t.name,description:t.description});if(await o.sendUsage("apps_update",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${L} App updated: ${s.id}`),s.name&&u.info(` Name: ${s.name}`),s.description!=null&&u.info(` Description: ${s.description}`)}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new f(s,{prefix:`${b} Failed to update app:`}))}}J();S();pe();Ae();x();N();z();async function nm(e,t){let r=await T(),n=await Er(r,e,t);if(Ce(n,"appId"),!t.dryRun&&!t.yes&&(W()||t.json))throw new f("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await Mc(r,n),a=Wk(s);if(t.dryRun){u.info(`Dry run \u2014 would delete app ${n}`),u.info(` ${a}`),u.info("Dry run complete \u2014 no changes made.");return}if(!await Pe({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=_.forApps({authToken:r}),i=Date.now();try{let s=await TE(r,n);if(await o.sendUsage("apps_delete",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(s.message)}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new f(s,{prefix:`${b} Failed to delete app:`}))}}J();S();x();N();z();ye();S();dt();var Ai=100;function om(e,t){return`${I}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function im(e,t){return At(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function cR(e,t,r,n){let o=Fi(om(t,r),{limit:Nc,cursor:n}),i=await G(o,{headers:ut(e)});if(!i.ok)throw await im(i,"Failed to list environment variables");return mo(await i.json(),"variables")}async function sm(e,t,r){return ca(n=>cR(e,t,r,n))}async function am(e,t,r,n){let o=await G(`${om(t,r)}/${encodeURIComponent(n)}`,{method:"DELETE",headers:ut(e)});if(!o.ok)throw await im(o,"Failed to delete environment variable")}async function da(e,t,r,n,o){let i=Object.keys(n).length;if(i>Ai)throw new f(`Cannot import more than ${Ai} variables at once (received ${i}).`,{isUserError:!0});let s=await G(`${om(t,r)}/bulk`,{method:"POST",headers:{...ut(e),"Content-Type":"application/json"},body:JSON.stringify({variables:n,overwriteExisting:o})});if(!s.ok)throw await im(s,"Failed to import environment variables");return await s.json()}var BE=require("dotenv");de();var UE=["key","isSecret","value","id","environmentId"],pa=["key","isSecret"];function Ti(){return UE}var lm=st(UE);function uR(e,t){switch(t){case"value":return e.isSecret?R("(secret)"):e.value!==""?e.value:R("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):R("\u2014")}}function cm(e,t=pa){if(e.length===0)return R("No environment variables found.");let r=t.map(o=>te(o)),n=e.map(o=>t.map(i=>uR(o,i)));return We(r,n)}function um(e){let t=e.split(/\r?\n/).map(r=>r.replace(/^\s*export\s+/,"")).join(`
197
- `);return(0,BE.parse)(t)}async function dm(e){let t=await T(),r=_.forAppsEnvVars({authToken:t}),n=Date.now();try{let{appId:o,envId:i}=await Xe(t,e),s=await sm(t,o,i);if(await r.sendUsage("apps_env_vars_list",{duration:Date.now()-n,variableCount:s.length}),e.json){u.info(JSON.stringify(s,null,2));return}if(s.length===0){u.info("No environment variables found.");return}let a=De(e.fields,lm,Ti());u.info(cm(s,a))}catch(o){throw o instanceof f&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to list environment variables:`}))}}J();S();x();N();z();S();pe();Ae();x();N();async function WE(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e).toString("utf8").replace(/\r?\n$/,"")}function pm(e){u.warn(`${he} Passing a secret as a command-line argument exposes it in your shell history and process list. Pipe it via stdin (e.g. \`printf %s "$VALUE" | webflow apps env-vars set ${e} --secret\`) or omit the value to be prompted.`)}async function HE(e,t){if(e!==void 0)return t.secret&&!t.json&&pm(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let r=await WE();if(r==="")throw new f(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:r,source:"stdin"}}if(!W()){let r=t.secret?await zy({message:`Enter the value for ${t.key}:`}):await Je({message:`Enter the value for ${t.key}:`});if(r===null||r==="")throw new f(`No value provided for ${t.key}.`,{isUserError:!0});return{value:r,source:"prompt"}}throw new f(`No value provided for ${t.key}. Pass it as an argument, pipe it via stdin, or run interactively (without --no-input).`,{isUserError:!0})}async function fm(e,t,r){let n=r.secret?" (secret)":"",o=await T(),i=_.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await Xe(o,r);if(r.dryRun){t!==void 0&&r.secret&&!r.json&&pm(e),r.json?u.info(JSON.stringify({key:e,...r.secret?{isSecret:!0}:{},appId:a,environmentId:l,dryRun:!0},null,2)):(u.info(`Would set ${e}${n} on app ${a}, environment ${l}.`),u.info("Dry run \u2014 no changes made."));return}try{let{value:c,source:d}=await HE(t,{key:e,secret:r.secret,json:r.json}),p={[e]:{value:c,...r.secret?{isSecret:!0}:{}}},h=await da(o,a,l,p,!0),g=[...h.created,...h.updated,...h.skipped].find(w=>w.key===e);if(!g){let w=h.errors.find(k=>k.key===e);throw new f(w?`Failed to set ${e}: ${w.error}`:`Set did not apply to ${e}.`,{isUserError:!!w})}let m=g.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:r.secret?"secret":"plain",valueSource:d}),r.json){u.info(JSON.stringify({key:e,isSecret:m,status:"set"},null,2));return}u.info(`${L} Set ${e}${m?" (secret)":""}`)}catch(c){throw c instanceof f&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new f(c,{prefix:`${b} Failed to set environment variable:`}))}}J();S();x();N();z();async function mm(e,t){let r=await T(),n=_.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await Xe(r,t);if(t.dryRun){t.json?u.info(JSON.stringify({key:e,appId:i,environmentId:s,dryRun:!0},null,2)):(u.info(`Would delete ${e} from app ${i}, environment ${s}.`),u.info("Dry run \u2014 no changes made."));return}try{if(await am(r,i,s,e),await n.sendUsage("apps_env_vars_delete",{duration:Date.now()-o}),t.json){u.info(JSON.stringify({key:e,status:"deleted"},null,2));return}u.info(`${L} Deleted ${e}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await n.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new f(a,{prefix:`${b} Failed to delete environment variable:`}))}}var VE=require("fs"),GE=require("path");J();S();x();N();z();function gm(e){return e.map(({id:t,environmentId:r,key:n,isSecret:o})=>({id:t,environmentId:r,key:n,isSecret:o}))}async function hm(e,t){let r=await T(),n=_.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await Xe(r,t),a;try{a=(0,VE.readFileSync)((0,GE.resolve)(e),"utf8")}catch{throw new f(`Could not read file: ${e}`,{isUserError:!0})}let l=um(a),c=Object.keys(l);if(c.length===0)throw new f(`No variables found in ${e}.`,{isUserError:!0});if(c.length>Ai)throw new f(`Cannot import more than ${Ai} variables at once (${e} has ${c.length}).`,{isUserError:!0});let d={};for(let p of c)d[p]={value:l[p],...t.secret?{isSecret:!0}:{}};if(t.dryRun){if(t.json)u.info(JSON.stringify({appId:i,environmentId:s,secret:!!t.secret,variables:c,dryRun:!0},null,2));else{u.info(`Would import ${c.length} variable(s)${t.secret?" as secrets":""} into app ${i}, environment ${s}:`);for(let p of c)u.info(` ${p}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let p=await da(r,i,s,d,!0);if(await n.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:p.created.length,updatedCount:p.updated.length,skippedCount:p.skipped.length,errorCount:p.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:gm(p.created),updated:gm(p.updated),skipped:gm(p.skipped),errors:p.errors},null,2));else{u.info(`${L} Imported: ${p.created.length} created, ${p.updated.length} updated, ${p.skipped.length} skipped, ${p.errors.length} failed`);for(let h of p.errors)u.warn(` ${h.key}: ${h.error}`)}if(p.errors.length>0)throw new f(`Import completed with ${p.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(p){throw p instanceof f&&p.isUserError?p:(await n.sendError(p instanceof Error?p:new Error(String(p)),"apps_env_vars_import",{duration:Date.now()-o}),new f(p,{prefix:`${b} Failed to import environment variables:`}))}}Qr();var zE=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");$c(t,{namespace:"apps"}),Lc(t,{namespace:"apps"}),t.command("list").description("List all apps in your Webflow workspace").addOption(Y()).addOption(Le([...cn()]).default(rc)).action(Kf),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(Y()).addOption(Le([...cn()]).default(rf)).action(zf),t.command("domains").description("List domains and live URLs for an app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(Le([...$s()]).default(nc)).addOption(Y()).option("--limit <n>","Max number of domains to return (server caps at 100)",fc).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Jf),ct()&&(t.command("update").description("Update an app's name or description. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--name <name>","New app name").option("--description <description>","New app description").addOption(Y()).addOption(Te()).action(rm),t.command("delete").description("Delete (or archive) an app. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(oi()).addOption(Y()).addOption(Te()).action(nm)),t.command("environments").description("Manage the environments of a Webflow Cloud app").command("list").description("List the environments of an app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(Le([...Ls()]).default(oc)).addOption(Y()).action(qf);let n=t.command("deployments").description("Inspect Webflow Cloud deployments");n.command("list").description("List the most recent deployments of an environment (newest first). Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").addOption(Kk()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(Y()).addOption(Le([...un()]).default(Ns)).action(Qf),n.command("get").description("Get details for a specific deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Pass --wait to poll until the deployment reaches a terminal status (exit 0 on success, 1 otherwise); --interval is floored at 5s and --timeout capped at 30min.").argument("<depId>","Deployment ID").addOption(new KE.Option("--wait","Poll until the deployment reaches a terminal status (success/failed/canceled/unstaged) or the timeout elapses, then exit 0 on success or 1 otherwise")).addOption(Jk()).addOption(qk()).addOption(Y()).addOption(Le([...un()]).default(Ns)).action(em),n.command("redeploy").description("Re-run a deployment at its SAME commit (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. To roll back, redeploy an earlier successful deployment's ID. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Use --dry-run to preview.").argument("<depId>","Deployment ID to re-run").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(Y()).addOption(Te()).action(tm);let o=t.command("logs").description("Read Webflow Cloud app logs");o.command("build").description("Read the build logs of a deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").argument("[depId]","Deployment ID (defaults to the latest deployment)").addOption(Y()).addOption(Le([...vn()]).default(ua)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(cf()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Xf),o.command("runtime").description("Read the runtime logs of an environment. Resolves the app from WEBFLOW_APP_ID / webflow.json (or a picker); the environment from the [envId] argument, WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or a picker.").argument("[envId]","Environment ID (defaults to the only env; required if the app has several)").addOption(Y()).addOption(Le([...vn()]).default(ua)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(cf()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Zf);let i=t.command("env-vars").description("Manage Webflow Cloud app environment variables");i.command("list").description("List environment variables for a Cloud app environment").addOption(Bs()).addOption(Us()).addOption(Y()).addOption(Le([...Ti()]).default(pa.join(","))).action(dm),i.command("set").description("Create or update an environment variable. Use --secret to encrypt the value. Use --dry-run to preview.").argument("<key>","Variable name").argument("[value]","Variable value. Omit to read from piped stdin or be prompted (recommended for secrets, keeps them out of shell history).").addOption(Bs()).addOption(Us()).addOption(lf()).addOption(Te()).addOption(Y()).action(fm),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(Bs()).addOption(Us()).addOption(Te()).addOption(Y()).action(mm),i.command("import").description("Bulk import environment variables from a .env file. Use --secret to mark every key secret. Use --dry-run to preview.").argument("<file>","Path to a .env (KEY=value) file").addOption(Bs()).addOption(Us()).addOption(lf()).addOption(Te()).addOption(Y()).action(hm)};ye();S();dt();S();function ee(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new f(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}async function vr(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function JE(e,t){ee(t,"siteId");let r=await G(`${I}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok){let o=await vr(r);throw r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to list collections: ${o}`)}return(await r.json()).collections??[]}async function qE(e,t){ee(t,"collectionId");let r=await G(`${I}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!r.ok)throw new f(`Failed to get collection: ${await vr(r)}`);let n=await r.json();return{...n,fields:n.fields??[]}}async function YE(e,t,r){ee(t,"siteId");let n={displayName:r.displayName,singularName:r.singularName};r.slug&&(n.slug=r.slug);let o=await G(`${I}/v2/sites/${t}/collections`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(!o.ok){let i=await vr(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create collection: ${i}`)}return await o.json()}async function XE(e,t,r){ee(t,"collectionId");let n=await G(`${I}/v2/collections/${t}/fields`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({displayName:r.displayName,type:r.type,isRequired:r.isRequired??!1})});if(!n.ok){let o=await vr(n);throw n.status===404?new f(`Collection "${t}" not found`,{isUserError:!0}):n.status>=400&&n.status<500?new f(o,{isUserError:!0}):new f(`Failed to create field: ${o}`)}return await n.json()}async function ym(e,t,r={}){ee(t,"collectionId");let n=new URLSearchParams;r.limit!=null&&n.set("limit",String(r.limit)),r.offset!=null&&n.set("offset",String(r.offset)),r.cmsLocaleId&&n.set("cmsLocaleId",r.cmsLocaleId);let o=n.toString()?`?${n.toString()}`:"",i=await G(`${I}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to list items: ${await vr(i)}`);let s=await i.json();return{items:s.items??[],total:s.total??0,count:s.count??s.items?.length??0,limit:s.limit??r.limit??100,offset:s.offset??r.offset??0}}async function ZE(e,t,r,n){ee(t,"collectionId"),ee(r,"itemId");let o=n?`?cmsLocaleId=${encodeURIComponent(n)}`:"",i=await G(`${I}/v2/collections/${t}/items/${r}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Item "${r}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to get item: ${await vr(i)}`);return await i.json()}async function wm(e,t,r,n=!1){ee(t,"collectionId");let o=await G(`${I}/v2/collections/${t}/items`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:r,isDraft:n})});if(!o.ok){let i=await vr(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create item: ${i}`)}return await o.json()}async function Dm(e,t,r,n){ee(t,"collectionId"),ee(r,"itemId");let o=await G(`${I}/v2/collections/${t}/items/${r}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:n})});if(o.status===404)throw new f(`Item "${r}" not found`,{isUserError:!0});if(!o.ok)throw new f(`Failed to update item: ${await vr(o)}`);return await o.json()}async function QE(e,t,r){ee(t,"collectionId"),ee(r,"itemId");let n=await G(`${I}/v2/collections/${t}/items/${r}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new f(`Item "${r}" not found`,{isUserError:!0});if(!n.ok)throw new f(`Failed to delete item: ${await vr(n)}`)}async function ev(e,t,r){ee(t,"collectionId"),r.forEach(o=>ee(o,"itemId"));let n=await G(`${I}/v2/collections/${t}/items/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({itemIds:r})});if(!n.ok){let o=await vr(n);throw n.status>=400&&n.status<500?new f(o,{isUserError:!0}):new f(`Failed to publish items: ${o}`)}return await n.json()}de();J();Me();async function Kc(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=Z(),r=await Ue(t);return{token:r.accessToken,siteId:r.siteId}}function tv(e,t=["id","displayName","slug"]){if(e.length===0)return R("No collections found.");let r=["id","displayName","singularName","slug","lastUpdated"],n=Object.fromEntries(r.map(a=>[a.toLowerCase(),a])),o=t.map(a=>n[a.toLowerCase()]).filter(a=>a!=null);if(o.length===0)return Lt(`Invalid fields. Available: ${r.join(", ")}`);let i=o.map(a=>te(a)),s=e.map(a=>o.map(l=>{let c=a[l];return c?l==="lastUpdated"?new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c:R("\u2014")}));return We(i,s)}function rv(e){let t=[`${te("Collection:")} ${e.displayName}`,`${te("ID:")} ${e.id}`,`${te("Slug:")} ${e.slug}`,`${te("Singular:")} ${e.singularName}`,`${te("Updated:")} ${new Date(e.lastUpdated).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`,"",te("Fields:")];if(e.fields.length===0)return t.push(R(" No fields defined.")),t.join(`
198
- `);let r=["NAME","SLUG","TYPE","REQUIRED"].map(o=>te(o)),n=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(We(r,n)),t.join(`
199
- `)}function nv(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return R("No items found.");let r=t.map(o=>te(o)),n=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?ne("draft"):V("live");if(i==="isArchived")return o.isArchived?R("archived"):"";if(i==="lastUpdated"||i==="lastPublished"||i==="createdOn"){let a=o[i];return a?new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):R("\u2014")}let s=o[i];return s==null?R("\u2014"):String(s)}));return We(r,n)}S();x();N();function zc(e,t,r="asc"){return[...e].sort((n,o)=>{let i=n[t],s=o[t];if(i==null&&s==null)return 0;if(i==null)return 1;if(s==null)return-1;let a=0;return typeof i=="string"&&typeof s=="string"?a=i.localeCompare(s):typeof i=="number"&&typeof s=="number"?a=i-s:a=String(i).localeCompare(String(s)),r==="desc"?-a:a})}z();async function km(e){let{token:t,siteId:r}=await Kc(e),n=_.forCms({authToken:t,siteId:r}),o=Date.now();try{let i=await JE(t,r);if(await n.sendUsage("cms_collections_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No collections found.");return}let s=["displayName","slug","lastUpdated"];if(s.includes(e.sortBy)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${s.join(", ")}. Defaulting to displayName.`),e.sortBy="displayName"),!["asc","desc"].includes(e.order))throw new f(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=zc(i,e.sortBy,e.order);if(e.json){u.info(JSON.stringify(a,null,2));return}let l=e.fields.split(",").map(c=>c.trim());u.info(tv(a,l))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${b} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_list",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to list collections:`})}}J();S();x();N();z();async function bm(e,t){let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await qE(r,e);if(await n.sendUsage("cms_collections_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(rv(i))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${b} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_get",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to get collection:`})}}S();x();N();z();async function Em(e){let t=e.singularName??e.name,r=e.slug??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(e.dryRun){u.info("Dry run \u2014 would create collection:"),u.info(JSON.stringify({displayName:e.name,singularName:t,slug:r},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let{token:n,siteId:o}=await Kc(e),i=_.forCms({authToken:n,siteId:o}),s=Date.now();try{let a=await YE(n,o,{displayName:e.name,singularName:t,slug:r});if(await i.sendUsage("cms_collections_create",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}u.info(`${L} Collection created: ${a.id}`),u.info(` Name: ${a.displayName}`),u.info(` Slug: ${a.slug}`),u.info(`
200
- Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof f&&a.isUserError){u.info(`${b} ${a.message}`),process.exitCode=1;return}throw await i.sendError(a instanceof Error?a:new Error(String(a)),"cms_collections_create",{duration:Date.now()-s}),new f(a,{prefix:`${b} Failed to create collection:`})}}J();S();x();N();z();async function vm(e){if(e.dryRun){u.info("Dry run \u2014 would create field:"),u.info(JSON.stringify({collectionId:e.collection,displayName:e.name,type:e.type,isRequired:e.required??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{let o=await XE(t,e.collection,{displayName:e.name,type:e.type,isRequired:e.required??!1});if(await r.sendUsage("cms_fields_create",{duration:Date.now()-n}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(`${L} Field created: ${o.id}`),u.info(` Name: ${o.displayName}`),u.info(` Type: ${o.type}`),u.info(` Slug: ${o.slug}`)}catch(o){if(o instanceof f&&o.isUserError){u.info(`${b} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_fields_create",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to create field:`})}}J();S();x();N();z();async function Sm(e){let t=await T(),r=_.forCms({authToken:t}),n=Date.now(),o=e.limit??100,i=e.offset??0;try{let s=await ym(t,e.collection,{limit:o,offset:i,cmsLocaleId:e.locale});if(await r.sendUsage("cms_items_list",{duration:Date.now()-n,count:s.items.length}),s.items.length===0){u.info("No items found.");return}if(e.json){u.info(JSON.stringify(s,null,2));return}let a=e.fields.split(",").map(p=>p.trim());u.info(nv(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let p=s.total>0?` of ${s.total}`:"";u.info(`
201
- Showing ${l}\u2013${c}${p} items. Use --offset ${c} to load next page.`)}}catch(s){if(s instanceof f&&s.isUserError){u.info(`${b} ${s.message}`),process.exitCode=1;return}throw await r.sendError(s instanceof Error?s:new Error(String(s)),"cms_items_list",{duration:Date.now()-n}),new f(s,{prefix:`${b} Failed to list items:`})}}J();S();x();N();z();async function xm(e){let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{let o=await ZE(t,e.collection,e.item,e.locale);if(await r.sendUsage("cms_items_get",{duration:Date.now()-n}),e.json){u.info(JSON.stringify(o,null,2));return}let i=o.isArchived?"archived":o.isDraft?"draft":"live";u.info(`${o.id} [${i}]`),u.info(` Last updated: ${new Date(o.lastUpdated).toLocaleString()}`),o.lastPublished&&u.info(` Last published: ${new Date(o.lastPublished).toLocaleString()}`),u.info(" Fields:"),u.info(JSON.stringify(o.fieldData,null,4).replace(/^/gm," "))}catch(o){if(o instanceof f&&o.isUserError){u.info(`${b} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_get",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to get item:`})}}J();S();x();N();z();async function Cm(e){let t;try{t=JSON.parse(e.data)}catch{throw new f(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would create item:"),u.info(JSON.stringify({fieldData:t,isDraft:e.draft??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await wm(r,e.collection,t,e.draft??!1);if(await n.sendUsage("cms_items_create",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${L} Item created: ${i.id}`)}catch(i){if(i instanceof f&&i.isUserError){u.info(`${b} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_create",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to create item:`})}}J();S();x();N();z();async function _m(e){let t;try{t=JSON.parse(e.data)}catch{throw new f(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would update item:"),u.info(JSON.stringify({collectionId:e.collection,itemId:e.item,fieldData:t},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await Dm(r,e.collection,e.item,t);if(await n.sendUsage("cms_items_update",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${L} Item updated: ${i.id}`)}catch(i){if(i instanceof f&&i.isUserError){u.info(`${b} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_update",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to update item:`})}}J();S();x();N();z();async function Fm(e){if(e.dryRun){u.info(`Dry run \u2014 would delete item ${e.item} from collection ${e.collection}`),u.info("Dry run complete \u2014 no changes made.");return}let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{await QE(t,e.collection,e.item),await r.sendUsage("cms_items_delete",{duration:Date.now()-n,dryRun:!1}),u.info(`${L} Item deleted: ${e.item}`)}catch(o){if(o instanceof f&&o.isUserError){u.info(`${b} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_delete",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to delete item:`})}}J();S();x();N();z();async function Am(e){let t=e.items.split(",").map(i=>i.trim());if(e.dryRun){u.info(`Dry run \u2014 would publish ${t.length} item(s) in collection ${e.collection}:`),t.forEach(i=>u.info(` ${i}`)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await ev(r,e.collection,t);if(await n.sendUsage("cms_items_publish",{duration:Date.now()-o,itemCount:t.length,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishedItemIds?.length??0;u.info(`${L} Published ${s} item(s)`),i.errors?.length&&i.errors.forEach(a=>u.warn(` ${a.itemId}: ${a.message}`))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${b} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_publish",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to publish items:`})}}var ov=e=>{let t=e.command("cms").description("Manage Webflow CMS content"),r=t.command("collections").description("Manage CMS collections");r.command("list").description("List all CMS collections for a site").addOption(Ct()).addOption(Y()).addOption(Le(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption(si(["displayName","slug","lastUpdated"]).default("displayName")).addOption(ii()).action(km),r.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(Y()).action(bm),r.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(Ct()).requiredOption("--name <displayName>","Collection display name").option("--singular-name <singularName>","Singular name (defaults to --name)").option("--slug <slug>","URL slug for the collection (auto-derived from --name if omitted)").addOption(Te()).addOption(Y()).action(Em),t.command("fields").description("Manage CMS collection fields").command("create").description("Add a field to a CMS collection. Use --dry-run to preview.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--name <displayName>","Field display name").requiredOption("--type <type>","Field type (e.g. PlainText, RichText, Number, DateTime, Link, Image, Video, Color, Bool, Option, ItemRef, ItemRefSet)").option("--required","Mark field as required").addOption(Te()).addOption(Y()).action(vm);let o=t.command("items").description("Manage CMS items");o.command("list").description("List items in a CMS collection").requiredOption("--collection <collectionId>","Collection ID").option("--locale <cmsLocaleId>","CMS locale ID to filter by").addOption(dc()).addOption(pc()).addOption(Y()).addOption(Le(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(Sm),o.command("get").description("Get a single CMS item by ID").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").option("--locale <cmsLocaleId>","CMS locale ID to retrieve content for").addOption(Y()).action(xm),o.command("create").description("Create a new CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--data <json>","Item field data as a JSON string").option("--draft","Create as draft (not published)").addOption(Te()).addOption(Y()).action(Cm),o.command("update").description("Update an existing CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").requiredOption("--data <json>","Updated field data as a JSON string").addOption(Te()).addOption(Y()).action(_m),o.command("delete").description("Delete a CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").addOption(Te()).action(Fm),o.command("publish").description("Publish one or more CMS items. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--items <itemIds>","Comma-separated item IDs to publish").addOption(Te()).addOption(Y()).action(Am)};J();de();S();x();N();Me();z();ye();dt();S();S();de();var iv={png:{category:"image",maxBytes:4*1024*1024},jpeg:{category:"image",maxBytes:4*1024*1024},jpg:{category:"image",maxBytes:4*1024*1024},gif:{category:"image",maxBytes:4*1024*1024},svg:{category:"image",maxBytes:4*1024*1024},webp:{category:"image",maxBytes:4*1024*1024},avif:{category:"image",maxBytes:4*1024*1024},pdf:{category:"document",maxBytes:10*1024*1024},doc:{category:"document",maxBytes:10*1024*1024},docx:{category:"document",maxBytes:10*1024*1024},xls:{category:"document",maxBytes:10*1024*1024},xlsx:{category:"document",maxBytes:10*1024*1024},ppt:{category:"document",maxBytes:10*1024*1024},pptx:{category:"document",maxBytes:10*1024*1024},txt:{category:"document",maxBytes:10*1024*1024},csv:{category:"document",maxBytes:10*1024*1024},odt:{category:"document",maxBytes:10*1024*1024},ods:{category:"document",maxBytes:10*1024*1024},odp:{category:"document",maxBytes:10*1024*1024},json:{category:"lottie",maxBytes:10*1024*1024},lottie:{category:"lottie",maxBytes:10*1024*1024}};function Jc(e,t){let r=e.split(".").pop()?.toLowerCase()??"",n=iv[r];if(!n){let o=Object.keys(iv).join(", ");throw new f(`Unsupported file type ".${r}". Allowed types: ${o}`,{isUserError:!0})}if(t>n.maxBytes){let o=n.maxBytes/1048576,i=(t/(1024*1024)).toFixed(1);throw new f(`File too large: ${i} MB exceeds the ${o} MB limit for ${n.category} files.`,{isUserError:!0})}}var Tm=["id","displayName","originalFileName","contentType","size","lastUpdated"];function sv(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return R("No assets found.");let r=Object.fromEntries(Tm.map(l=>[l.toLowerCase(),l])),n=t.map(l=>r[l.toLowerCase()]).filter(l=>l!=null);if(n.length===0)return Lt(`Invalid fields. Available: ${Tm.join(", ")}`);let o=t.filter(l=>r[l.toLowerCase()]==null),i=o.length>0?ne(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${Tm.join(", ")}
202
- `):"",s=n.map(l=>te(l)),a=e.map(l=>n.map(c=>{let d=l[c];if(d==null||c==="size"&&d===0)return R("\u2014");if(c==="size")return dR(Number(d));if(c==="lastUpdated"){let h=new Date(String(d)),g=String(h.getMonth()+1).padStart(2,"0"),m=String(h.getDate()).padStart(2,"0"),w=String(h.getFullYear()).slice(-2),k=String(h.getHours()).padStart(2,"0"),F=String(h.getMinutes()).padStart(2,"0");return`${g}/${m}/${w} ${k}:${F}`}let p=String(d);return c==="displayName"&&p.length>40?R("\u2026")+p.slice(-39):p}));return i+We(s,a)}function dR(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function av(e){if(e.length===0)return R("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),r=["id","displayName","assets","lastUpdated"].map(o=>te(o)),n=t.map(o=>[o.id,o.displayName,String(o.assets.length),new Date(o.lastUpdated).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]);return We(r,n)}async function lv(e,t,r={}){if(ee(t,"siteId"),r.folderId){ee(r.folderId,"folderId");let a=await pR(e,r.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],d=0,p=100;for(;;){let k=await G(`${I}/v2/sites/${t}/assets?limit=${p}&offset=${d}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!k.ok)throw new f(`Failed to list assets: ${k.status} ${k.statusText}`);let F=await k.json(),A=F.assets??[];c.push(...A);let E=F.pagination?.total??0;if(d+=A.length,d>=E||A.length===0)break}let h=c.filter(k=>l.has(k.id)),g=r.offset??0,m=r.limit??h.length,w=h.slice(g,g+m);return{assets:w,pagination:{total:h.length,limit:w.length,offset:g}}}let n=new URLSearchParams;r.limit!=null&&n.set("limit",String(r.limit)),r.offset!=null&&n.set("offset",String(r.offset));let o=n.toString(),i=await G(`${I}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new f(`Failed to list assets: ${i.status} ${i.statusText}`);let s=await i.json();return{assets:s.assets??[],pagination:s.pagination??{total:0,limit:100,offset:0}}}async function cv(e,t,r,n,o){ee(t,"siteId"),o&&ee(o,"folderId");let i=_s(r);Jc(i.meta.title,i.meta.size);let s=n??i.meta.title,a={fileName:i.meta.title,fileHash:i.meta.fileHash,displayName:s};o&&(a.parentFolder=o);let l=await G(`${I}/v2/sites/${t}/assets`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(a)});if(!l.ok)throw new f(`Failed to initiate asset upload: ${l.status} ${l.statusText}`);let c=await l.json(),d={fields:c.uploadDetails,_id:c.id,s3Url:c.hostedUrl??"",url:c.uploadUrl??"",contentType:c.contentType??"",origFileName:c.originalFileName??i.meta.title,success_action_redirect:"",createdOn:"",updatedOn:""};try{await As(i,d)}catch(p){throw await G(`${I}/v2/assets/${d._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),p}return{id:d._id,hostedUrl:d.s3Url,displayName:s,originalFileName:i.meta.title}}async function uv(e,t,r){ee(t,"assetId");let n=await G(`${I}/v2/assets/${t}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!n.ok)throw new f(`Failed to update asset: ${n.status} ${n.statusText}`);return await n.json()}async function pR(e,t){ee(t,"folderId");let r=await G(`${I}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new f(`Failed to get folder: ${r.status} ${r.statusText}`);return await r.json()}async function dv(e,t){ee(t,"siteId");let r=await G(`${I}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new f(`Failed to list folders: ${r.status} ${r.statusText}`);return(await r.json()).assetFolders??[]}async function pv(e,t,r,n){ee(t,"siteId"),n&&ee(n,"parentFolderId");let o={displayName:r};n&&(o.parentFolder=n);let i=await G(`${I}/v2/sites/${t}/asset_folders`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new f(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function Rm(e){let t,r;if(e.site)t=await T(),r=e.site;else{let{manifest:i}=Z(),s=await Ue(i);t=s.accessToken,r=s.siteId}let n=_.forAssets({authToken:t,siteId:r}),o=Date.now();try{let{assets:i,pagination:s}=await lv(t,r,{limit:e.limit,offset:e.offset,folderId:e.folder});if(await n.sendUsage("assets_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No assets found.");return}let a=["displayName","originalFileName","contentType","size","lastUpdated"],l=e.sortBy;a.includes(l)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${a.join(", ")}. Defaulting to displayName.`),l="displayName");let c=e.order;["asc","desc"].includes(e.order)||(u.warn(`Unknown --order "${e.order}". Valid values: asc, desc. Defaulting to asc.`),c="asc");let d=zc(i,l,c);if(e.json){u.info(JSON.stringify({assets:d,pagination:s},null,2));return}let p=e.fields.split(",").map(g=>g.trim());u.info(sv(d,p));let h=(e.offset??0)+i.length;h<s.total&&u.info(R(`Showing ${h} of ${s.total} assets. Use --offset ${h} to see more.`))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to list assets:`})}}J();S();x();N();Me();z();async function Im(e,t){let r=_s(e);if(Jc(r.meta.title,r.meta.size),t.dryRun){u.info(`Dry run \u2014 would upload: ${e} (validated)`),t.name&&u.info(` Display name: ${t.name}`),t.folder&&u.info(` Folder: ${t.folder}`),u.info("Dry run complete \u2014 no changes made.");return}let n,o;if(t.site)n=await T(),o=t.site;else{let{manifest:a}=Z(),l=await Ue(a);n=l.accessToken,o=l.siteId}let i=_.forAssets({authToken:n,siteId:o}),s=Date.now();try{let a=await cv(n,o,e,t.name,t.folder);if(await i.sendUsage("assets_upload",{duration:Date.now()-s,dryRun:!1}),t.json){u.info(JSON.stringify(a,null,2));return}u.info(`${L} Asset uploaded: ${a.id}`),a.hostedUrl&&u.info(` URL: ${a.hostedUrl}`)}catch(a){throw await i.sendError(a instanceof Error?a:new Error(String(a)),"assets_upload",{duration:Date.now()-s}),new f(a,{prefix:`${b} Failed to upload asset:`})}}J();S();x();N();z();async function Om(e,t){if(!t.altText&&!t.displayName)throw new f("Provide at least one of --alt-text or --display-name.",{isUserError:!0});if(t.dryRun){u.info(`Dry run \u2014 would update asset: ${e}`),t.altText&&u.info(` Alt text: ${t.altText}`),t.displayName&&u.info(` Display name: ${t.displayName}`),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forAssets({authToken:r}),o=Date.now();try{let i=await uv(r,e,{altText:t.altText,displayName:t.displayName});if(await n.sendUsage("assets_update",{duration:Date.now()-o,dryRun:!1}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${L} Asset updated: ${i.id}`),i.displayName&&u.info(` Display name: ${i.displayName}`),i.altText&&u.info(` Alt text: ${i.altText}`)}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_update",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to update asset:`})}}J();S();x();N();Me();z();async function Pm(e){let t,r;if(e.site)t=await T(),r=e.site;else{let{manifest:i}=Z(),s=await Ue(i);t=s.accessToken,r=s.siteId}let n=_.forAssets({authToken:t,siteId:r}),o=Date.now();try{let i=await dv(t,r);if(await n.sendUsage("assets_folders_list",{duration:Date.now()-o,count:i.length}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(av(i))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to list folders:`})}}J();S();x();N();as();z();async function $m(e,t){let r,n;if(t.site)r=await T(),n=t.site;else{let{manifest:s}=Z(),a=await Ue(s);r=a.accessToken,n=a.siteId}let o=_.forAssets({authToken:r,siteId:n}),i=Date.now();try{let s=await pv(r,n,e,t.parent);if(await o.sendUsage("assets_folders_create",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${L} Folder created: ${s.id}`),u.info(` Name: ${s.displayName}`),s.parentFolder&&u.info(` Parent: ${s.parentFolder}`)}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"assets_folders_create",{duration:Date.now()-i}),new f(s,{prefix:`${b} Failed to create folder:`})}}var fv=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(Ct()).option("--folder <folderId>","Filter by folder ID").addOption(Y()).addOption(Le(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(dc()).addOption(pc()).addOption(si(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(ii()).action(Rm),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
203
- Supported types: png, jpg, jpeg, gif, svg, webp, avif (\u22644 MB); pdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, odt, ods, odp, json, lottie (\u226410 MB)`).argument("<file>","Path to the file to upload (see supported types above)").addOption(Ct()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(Te()).addOption(Y()).action(Im),t.command("update").description("Update an asset's metadata. Use --dry-run to preview.").argument("<assetId>","Asset ID to update").option("--alt-text <text>","Alt text for the asset").option("--display-name <name>","New display name for the asset").addOption(Te()).addOption(Y()).action(Om);let r=t.command("folders").description("Manage asset folders");r.command("list").description("List all asset folders for a site").addOption(Ct()).addOption(Y()).action(Pm),r.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(Ct()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(Y()).action($m)};J();S();x();N();z();ye();S();dt();async function mv(e,t){ee(t,"siteId");let r=await G(`${I}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new f(`Failed to get site: ${r.status} ${r.statusText}`);return await r.json()}async function gv(e){return la(`${I}/v2/sites`,e,"sites","Failed to list sites")}async function hv(e,t){ee(t,"siteId");let r=await G(`${I}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new f(`Failed to get custom domains: ${r.status} ${r.statusText}`);return(await r.json()).customDomains??[]}async function yv(e,t,r=[],n){ee(t,"siteId"),n&&ee(n,"pageId");let o=r.length>0?{customDomains:r}:{publishToWebflowSubdomain:!0};n&&(o.pageId=n);let i=await G(`${I}/v2/sites/${t}/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new f(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}S();de();var Lm=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],wv=st(Lm);function Dv(){return Lm}function kv(e,t=["id","displayName","lastPublished"]){if(e.length===0)return R("No sites found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${Lm.join(", ")}`,{isUserError:!0});let r=t.map(o=>te(o)),n=e.map(o=>t.map(i=>{let s=o[i];return s?i==="lastPublished"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:R("\u2014")}));return We(r,n)}function bv(e){if(e.length===0)return R("No custom domains configured.");let t=[te("id"),te("url"),te("lastPublished")],r=e.map(n=>[n.id,n.url,n.lastPublished?new Date(n.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):R("\u2014")]);return We(t,r)}async function Nm(e){let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=await gv(t);if(await r.sendUsage("sites_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No sites found.");return}let i=De(e.fields,wv,Dv());u.info(kv(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to list sites:`}))}}J();S();x();N();z();async function jm(e,t){let r=await T(),n=_.forSites({authToken:r}),o=Date.now();try{let i=await mv(r,e);if(await n.sendUsage("sites_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${i.displayName} (${i.id})`),u.info(` Short name: ${i.shortName}`),u.info(` Time zone: ${i.timeZone}`),i.lastPublished&&u.info(` Published: ${new Date(i.lastPublished).toLocaleString()}`),i.previewUrl&&u.info(` Preview: ${i.previewUrl}`)}catch(i){throw i instanceof f&&i.isUserError?i:(await n.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new f(i,{prefix:`${b} Failed to get site:`}))}}J();S();x();N();z();async function Mm(e){let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=await hv(t,e.site);if(await r.sendUsage("sites_domains",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(bv(o))}catch(o){throw o instanceof f&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to get custom domains:`}))}}J();S();x();N();z();async function Bm(e){if(ee(e.site,"siteId"),e.dryRun){u.info(`Would publish ${e.page?`page ${e.page} on`:"site"} ${e.site}`),e.domains?u.info(` Custom domains: ${e.domains}`):u.info(" Domains: Webflow subdomain");return}let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=e.domains?e.domains.split(",").map(l=>l.trim()):[],i=await yv(t,e.site,o,e.page);if(await r.sendUsage("sites_publish",{duration:Date.now()-n,dryRun:!1,publishScope:i.publishScope}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishScope==="page"?"Page":"Site";u.info(`${L} ${s} published successfully`);let a=i.customDomains??[];a.length>0?a.forEach(l=>{let c=l.lastPublished?` (${new Date(l.lastPublished).toLocaleString()})`:"";u.info(` Live at: https://${l.url}${c}`)}):i.publishToWebflowSubdomain&&u.info(" Published to Webflow subdomain")}catch(o){throw o instanceof f&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to publish site:`}))}}var Ev=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(Y()).addOption(Le(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Nm),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(Y()).action(jm),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(Y()).action(Mm),t.command("publish").description("Publish a Webflow site (defaults to Webflow subdomain)").requiredOption("--site <siteId>","Site ID to publish").option("--domains <domains>","Comma-separated custom domain IDs to publish to").option("--page <pageId>","Publish a single page instead of the whole site").addOption(Te()).addOption(Y()).action(Bm)};J();S();x();N();z();ye();async function vv(e,t){return ee(t,"siteId"),la(`${I}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function Sv(e,t,r){return ee(t,"siteId"),ee(r,"formId"),la(`${I}/v2/sites/${t}/forms/${r}/submissions`,e,"formSubmissions","Failed to list submissions")}S();de();var Um=["id","displayName","name","slug","createdOn","lastUpdated"],xv=st(Um);function Cv(){return Um}function _v(e,t=["id","displayName","slug"]){if(e.length===0)return R("No forms found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${Um.join(", ")}`,{isUserError:!0});let r=t.map(o=>te(o)),n=e.map(o=>t.map(i=>{let s=o[i];return s?i==="createdOn"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:R("\u2014")}));return We(r,n)}function Fv(e){if(e.length===0)return R("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),r=["id","dateSubmitted",...t].map(o=>te(o)),n=e.map(o=>[o.id,new Date(o.dateSubmitted).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),...t.map(i=>{let s=o.formResponse[i];return s==null?R("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return We(r,n)}function Av(e){if(e.length===0)return"";let r=["id","formId","displayName","dateSubmitted",...Array.from(new Set(e.flatMap(i=>Object.keys(i.formResponse))))],n=i=>{let s=i==null?"":typeof i=="object"?JSON.stringify(i):String(i);return s.includes(",")||s.includes('"')||s.includes(`
204
- `)?`"${s.replace(/"/g,'""')}"`:s};return[r.join(","),...e.map(i=>r.map(s=>n(s==="id"?i.id:s==="formId"?i.formId:s==="displayName"?i.displayName:s==="dateSubmitted"?i.dateSubmitted:i.formResponse[s])).join(","))].join(`
205
- `)}async function Wm(e){ee(e.site,"siteId");let t=await T(),r=_.forForms({authToken:t}),n=Date.now();try{let o=await vv(t,e.site);if(await r.sendUsage("forms_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No forms found.");return}let i=De(e.fields,xv,Cv());u.info(_v(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to list forms:`}))}}var Tv=D(require("fs"));J();S();x();N();z();async function Hm(e){ee(e.site,"siteId"),ee(e.form,"formId"),e.output&&e.json&&u.warn("--json is ignored when --output is set.");let t=await T(),r=_.forForms({authToken:t}),n=Date.now();try{let o=await Sv(t,e.site,e.form);if(await r.sendUsage("forms_submissions",{duration:Date.now()-n,count:o.length}),o.length===0){u.info("No submissions found.");return}if(e.output){let i=Av(o);Tv.default.writeFileSync(e.output,i,"utf8"),u.info(`${L} ${o.length} submission${o.length===1?"":"s"} written to ${e.output}`);return}if(e.json){u.info(JSON.stringify(o,null,2));return}u.info(Fv(o))}catch(o){throw await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-n}),new f(o,{prefix:`${b} Failed to fetch submissions:`})}}var Rv=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(Ct()).addOption(Y()).addOption(Le(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(Wm),t.command("submissions").description("List or export form submissions").requiredOption("--site <siteId>","Site ID").requiredOption("--form <formId>","Form ID").option("--json","Output as JSON").option("--output <file>","Save submissions as CSV to a file").action(Hm)};var ag=D(require("fs")),lg=D(require("path"));x();var yo=D(require("fs")),ho=D(require("path")),Xc=D(require("tar"));S();x();var Gm=D(require("fs")),Sn=D(require("path"));S();var fR=[/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,/\x1b[P^_][\s\S]*?\x1b\\/g,/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g,/\x1b[\x20-\x7e]/g,/[\x80-\x9f]/g,/[\x00-\x08\x0b-\x1f\x7f]/g,/[\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/g],mR=/[\r\n\u2028\u2029]+/g;function Vm(e){if(e==null)return"";let t=String(e);for(let r of fR)t=t.replace(r,"");return t}function y(e){return Vm(e).replace(mR," ").trim()}var Iv={impl:Sn.default.posix,caseInsensitive:!1},Km={impl:Sn.default.win32,caseInsensitive:!0};function go(){let e=process.platform;return e==="win32"?Km:{impl:Sn.default.posix,caseInsensitive:e==="darwin"}}function qc(e,t){let r=t.impl.resolve(e);return t.caseInsensitive?r.toLowerCase():r}function xn(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function et(e,t,r=go()){if(xn(e)||xn(t))return!1;let n=qc(e,r),o=qc(t,r);if(n===o)return!0;let i=r.impl.relative(n,o);return i===""?!0:r.impl.isAbsolute(i)?!1:!i.split(/[\\/]/).some(s=>s===".."||s==="")}async function Yc(e,t,r=go()){if(xn(e)||xn(t))return!1;let[n,o]=await Promise.all([ir(e),ir(t)]);return et(n,o,r)}function Re(e,t,r,n=go()){if(!et(e,t,n))throw new f(`Refusing to continue: ${r} resolves outside the directory it must stay inside.
206
- expected inside: ${y(e)}
207
- resolved to: ${y(t)}
208
- Please report this.`)}async function Ri(e,t,r,n=go()){if(!await Yc(e,t,n))throw new f(`Refusing to continue: ${r} resolves outside the directory it must stay inside once symlinks are followed.
209
- expected inside: ${y(e)}
210
- resolved to: ${y(t)}
211
- Please report this.`)}function gR(e,t,r=go()){return et(e,t,r)||et(t,e,r)}async function zm(e,t,r=go()){if(xn(e)||xn(t))return!1;let[n,o]=await Promise.all([ir(e),ir(t)]);return gR(n,o,r)}function He(e,t,r=go()){return typeof e!="string"||typeof t!="string"||xn(e)||xn(t)?!1:qc(e,r)===qc(t,r)}async function ir(e){let t=Sn.default.resolve(e);try{return await Gm.default.promises.realpath(t)}catch{}try{let r=await Gm.default.promises.realpath(Sn.default.dirname(t));return Sn.default.join(r,Sn.default.basename(t))}catch{return t}}var hR=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function Ii(e){if(!e)return"empty entry path";if(e.includes("\0"))return"NUL byte in entry path";if(/[\x01-\x1f\x7f]/.test(e))return"control character in entry path";if(e.startsWith("/")||e.startsWith("\\"))return"absolute entry path";if(/^[A-Za-z]:/.test(e))return"Windows drive-relative entry path";if(e.includes("\\"))return"backslash in entry path";for(let t of e.split("/")){if(t===""||t==="."){if(t===".")return'traversal segment "." in entry path';continue}if(t==="..")return'traversal segment ".." in entry path';if(/[. ]$/.test(t))return"entry path segment ends with a dot or space";if(hR.test(t))return"Windows reserved device name in entry path"}return null}var Ym=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),yR=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),wR=32,DR=512,Jm=10,$v=100,Ov=100;function Lv(){return{retained:[],fatal:[],fatalCount:0,count:0}}function Nv(e,t,r){e.count+=1;let n={code:t,message:Vm(r)};e.retained.length<Ov&&e.retained.push(n),yR.has(t)&&(e.fatalCount+=1,e.fatal.length<Ov&&e.fatal.push(n))}async function jv(e,t,r){let n=await kR(r.containmentRoot),o=await bR(n,t),i=await Pv(e),s=await vR(e,r),a=await xR(e,o,r);if(a.warnings.fatal.length>0)throw Vv(a.warnings.fatal,a.warnings.fatalCount);for(let c of a.warnings.retained)u.debug(`tar warning ${c.code}: ${c.message}`);if(a.refused.length>0)throw FR(a.refused,a.refusedCount);let l=await Pv(e);if(i!==l)throw new f("Refusing to continue: the downloaded archive changed while it was being read, so what was validated is not what was extracted. Nothing about the extracted directory can be trusted. Please retry.");return await CR(n,o),{skipped:s.skipped,fileCount:a.fileCount,unpackedBytes:a.unpackedBytes,warnings:[...s.warnings.retained,...a.warnings.retained],warningCount:s.warnings.count+a.warnings.count}}async function Pv(e){try{let t=await yo.default.promises.stat(e);return[t.dev,t.ino,t.size,t.mtimeMs,t.ctimeMs].join(":")}catch(t){throw new f(`Could not read the downloaded archive: ${t instanceof Error?t.message:String(t)}`)}}async function kR(e){try{return await yo.default.promises.realpath(ho.default.resolve(e))}catch(t){throw new f(`Refusing to extract: the directory the extraction must stay inside ("${y(e)}") could not be resolved: ${t instanceof Error?t.message:String(t)}`)}}async function bR(e,t){let r=ho.default.resolve(t);Re(e,r,"the extraction directory");let o=ho.default.relative(e,r).split(ho.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=ho.default.join(i,s);let a=await ER(i);if(a===null){await yo.default.promises.mkdir(i);continue}if(a.isSymbolicLink())throw new f(`Refusing to extract: "${y(i)}" is a symbolic link, and extracting into it would write the archive somewhere other than where it was checked. Remove or replace it with a real directory and retry.`);if(!a.isDirectory())throw new f(`Refusing to extract: "${y(i)}" exists and is not a directory.`)}return r}async function ER(e){try{return await yo.default.promises.lstat(e)}catch(t){if(t.code==="ENOENT")return null;throw new f(`Could not inspect "${y(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function vR(e,t){let r=Mv(t.limits),n=Wv(t.consumedSubtrees),o=[],i=[],s=Lv(),a=0,l=0,c=0,d=!1,p=!1,h=(g,m)=>{c+=1,o.length<$v&&o.push({entryPath:g,reason:m})};try{await Xc.list({file:e,onReadEntry:g=>{let m=g.path,w=g.type;if(Bv(w)||(a+=1,a>r.maxFiles&&!d&&(d=!0,h(m,`archive has more than ${r.maxFiles} files`))),!Ym.has(w)){let A=`unsupported entry type ${w}`;n(m)?h(m,A):d||i.push({entryPath:m,reason:A});return}let k=Ii(m)??Uv(m,r);if(k){h(m,k);return}let F=g.size;F>r.maxEntryBytes&&h(m,`entry is ${Oi(F)}, over the ${Oi(r.maxEntryBytes)} per-file cap`),l+=F,l>r.maxUnpackedBytes&&!p&&(p=!0,h(m,`unpacked total passes the ${Oi(r.maxUnpackedBytes)} cap`))},onwarn:(g,m)=>{Nv(s,g,m)}})}catch(g){throw g instanceof f?g:new f(`Could not read the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}if(o.length>0)throw _R(o,c);if(s.fatal.length>0)throw Vv(s.fatal,s.fatalCount);for(let g of i)u.debug(`Skipped archive entry "${y(g.entryPath)}": ${g.reason}`);return{skipped:i,warnings:s}}function SR(e,t,r,n){if(!Ym.has(t))return`unsupported entry type ${t}`;let o=Ii(e)??Uv(e,n);return o||(r>n.maxEntryBytes?`entry is ${Oi(r)}, over the ${Oi(n.maxEntryBytes)} per-file cap`:null)}async function xR(e,t,r){let n=Mv(r.limits),o=Wv(r.consumedSubtrees),i=Lv(),s=[],a=0,l=0,c=0,d=(g,m)=>(a+=1,s.length<$v&&s.push({entryPath:g,reason:m}),!1),p=()=>!1,h=(g,m)=>{let w="type"in m?m.type:m.isDirectory()?"Directory":"File",k=m.size;if(!Ym.has(w)&&!o(g))return p();let F=SR(g,w,k,n);if(F)return d(g,F);if(c+k>n.maxUnpackedBytes)return d(g,`unpacked total passes the ${Oi(n.maxUnpackedBytes)} cap`);if(!Bv(w)){if(l+1>n.maxFiles)return d(g,`archive has more than ${n.maxFiles} files`);l+=1}return c+=k,!0};try{await Xc.extract({file:e,cwd:t,strip:r.strip??0,preservePaths:!1,filter:h,onwarn:(g,m)=>{Nv(i,g,m)}})}catch(g){throw g instanceof f?g:new f(`Could not extract the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}return{warnings:i,fileCount:l,unpackedBytes:c,refused:s,refusedCount:a}}async function CR(e,t){Re(e,await yo.default.promises.realpath(t),"the extracted directory");let r=[t];for(;r.length>0;){let n=r.pop(),o=await yo.default.promises.readdir(n,{withFileTypes:!0});for(let i of o){let s=ho.default.join(n,i.name);if(!i.isFile()&&!i.isDirectory())throw new f(`Refusing to continue: extraction produced a non-regular entry at "${y(s)}". Please report this.`);Re(e,s,"an extracted archive entry"),i.isDirectory()&&r.push(s)}}}function Mv(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??wR,maxPathLength:e.maxPathLength??DR}}function Bv(e){return e==="Directory"||e==="GNUDumpDir"}function qm(e){return e.replace(/\/+$/,"")}function Uv(e,t){let r=qm(e);if(r.length>t.maxPathLength)return`entry path is ${r.length} characters, over the ${t.maxPathLength}-character limit`;let n=r.split("/").filter(o=>o!=="").length;return n>t.maxPathDepth?`entry path is ${n} levels deep, over the ${t.maxPathDepth}-level limit`:null}function Wv(e){let t=e.map(qm);return r=>{let n=qm(r).split("/").slice(1).join("/");return t.some(o=>n===o||n.startsWith(`${o}/`))}}function Oi(e){if(e<1024)return`${e} B`;let t=["KiB","MiB","GiB"],r=e/1024,n=t[0];for(let o=1;o<t.length&&r>=1024;o+=1)r/=1024,n=t[o];return`${parseFloat(r.toFixed(1))} ${n}`}function _R(e,t){return new f(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
212
- ${Hv(e,t).join(`
196
+ ${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await Me({message:"Select an environment:",choices:r.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new f("No environment selected.",{isUserError:!0});return o}async function et(e,t){let{manifest:n}=ne(),r=await Io("appId",{flagValue:t.appId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>Su(e,{json:t.json})}),o=await Io("environmentId",{flagValue:t.environmentId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>Zv(e,r,{json:t.json})});return{appId:r,envId:o}}async function Gm(e,t){if(!e)throw new f("Missing deployment ID. Run 'webflow apps deployments list' to find one, then pass it as the argument.",{isUserError:!0,missingFlag:"depId"});let n=await T(),{appId:r,envId:o}=await et(n,{json:t.json}),i=t.json?void 0:Ce(t.fields,xu,Nr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await zv(n,r,o,e,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_build",{duration:Date.now()-a,count:l.logs.length}),u.info(Cu(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new f(l,{prefix:`${k} Failed to read build logs:`}))}}q();C();_();M();X();async function Jm(e,t){let n=await T(),{appId:r,envId:o}=await et(n,{environmentId:e,json:t.json}),i=t.json?void 0:Ce(t.fields,xu,Nr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await qv(n,r,o,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_runtime",{duration:Date.now()-a,count:l.logs.length}),u.info(Cu(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new f(l,{prefix:`${k} Failed to read runtime logs:`}))}}q();C();_();M();X();async function Km(e){let t=await T(),{appId:n,envId:r}=await et(t,{json:e.json}),o=e.json?void 0:Ce(e.fields,Vc,Sr()),i=F.forApps({authToken:t}),s=Date.now();try{let a=await Xv(t,n,r,{limit:e.limit,cursor:e.cursor});if(await i.sendUsage("apps_deployments_list",{duration:Date.now()-s,count:a.deployments.length}),e.json){u.info(JSON.stringify(a,null,2));return}if(a.deployments.length===0){u.info("No deployments found.");return}u.info(fa(a.deployments,o)+_i(a.nextCursor))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to list deployments:`}))}}q();pe();C();we();_();M();X();var fP=5,Qv=1800;function mP(e){return new Promise(t=>setTimeout(t,e))}async function eS(e,t,n,r,o={}){let i=Math.min(Qv,Math.max(fP,o.interval??Wc)),s=Math.min(Qv,Math.max(1,o.timeout??Hc)),a=Date.now()+s*1e3,l,c,d=!1;for(;;){let p=new AbortController,m=setTimeout(()=>p.abort(),Math.max(0,a-Date.now())),h;try{h=await vu(e,t,n,r,{signal:p.signal})}catch(b){if(p.signal.aborted){d=!0;break}throw b}finally{clearTimeout(m)}c=h;let g=h.status;if(Qk(g))break;let y=a-Date.now();if(y<=0){d=!0;break}if(g!==l&&o.onStatusChange?.(l,g),l=g,await mP(Math.min(i*1e3,y)),Date.now()>=a){d=!0;break}}return{deployment:c,timedOut:d,timeoutSeconds:s}}async function zm(e,t){let n=await T(),{appId:r,envId:o}=await et(n,{json:t.json}),i=t.json?void 0:Ce(t.fields,Vc,Sr()),s=F.forApps({authToken:n}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let d=!t.json&&!V(),{deployment:p,timedOut:m,timeoutSeconds:h}=await eS(n,r,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:d?(y,b)=>u.info(R(y===void 0?b:`${y} \u2192 ${b}`)):void 0}),g=m?"timeout":p?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:g}),process.exitCode=!m&&p?.status==="success"?0:1,t.json){u.info(JSON.stringify(p??null,null,2));return}p&&u.info(fa([p],i)),m&&u.warn(`Timed out after ${h}s waiting for a terminal status (last status: ${p?.status??"unknown"}).`);return}let c=await vu(n,r,o,e);if(await s.sendUsage("apps_deployments_get",{duration:Date.now()-a}),t.json){u.info(JSON.stringify(c,null,2));return}u.info(fa([c],i))}catch(c){throw c instanceof f&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new f(c,{prefix:`${k} Failed to ${t.wait?"watch":"get"} deployment:`}))}}q();pe();C();_();M();X();async function qm(e,t){let n=await T(),{appId:r,envId:o}=await et(n,{json:t.json});if(t.dryRun){Oe(r,"appId"),Oe(o,"environmentId"),Or(e,"deploymentId"),t.json?u.info(JSON.stringify({deploymentId:e,appId:r,environmentId:o,dryRun:!0},null,2)):(u.info(`Would redeploy deployment ${e} (same commit) in app ${r}, environment ${o}.`),u.info("Dry run \u2014 no changes made."));return}let i=F.forApps({authToken:n,suppressCommand:!!t.idempotencyKey}),s=Date.now();try{let a=await Yv(n,r,o,e,{idempotencyKey:t.idempotencyKey});if(await i.sendUsage("apps_deployments_redeploy",{duration:Date.now()-s}),t.json){u.info(JSON.stringify(a,null,2));return}let l=a.commitSha.slice(0,7);a.status==="queued"?u.info(`${$} Redeploy queued \u2014 commit ${l}`):u.info(`${je} Redeploy in progress \u2014 commit ${l} ${R("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_redeploy",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to redeploy deployment:`}))}}q();C();_();M();X();async function Xm(e,t){if(t.name===void 0&&t.description===void 0)throw new f("Provide --name or --description",{isUserError:!0});let n=await T(),r=await Rn(n,e,t);if(Oe(r,"appId"),t.dryRun){u.info(`Dry run \u2014 would update app: ${r}`),t.name!==void 0&&u.info(` Name: ${t.name}`),t.description!==void 0&&u.info(` Description: ${t.description}`),u.info("Dry run complete \u2014 no changes made.");return}let o=F.forApps({authToken:n}),i=Date.now();try{let s=await Vv(n,r,{name:t.name,description:t.description});if(await o.sendUsage("apps_update",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} App updated: ${s.id}`),s.name&&u.info(` Name: ${s.name}`),s.description!=null&&u.info(` Description: ${s.description}`)}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to update app:`}))}}q();C();we();Te();_();M();X();async function Ym(e,t){let n=await T(),r=await Rn(n,e,t);if(Oe(r,"appId"),!t.dryRun&&!t.yes&&(V()||t.json))throw new f("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await ku(n,r),a=Zk(s);if(t.dryRun){u.info(`Dry run \u2014 would delete app ${r}`),u.info(` ${a}`),u.info("Dry run complete \u2014 no changes made.");return}if(!await Re({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=F.forApps({authToken:n}),i=Date.now();try{let s=await Gv(n,r);if(await o.sendUsage("apps_delete",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(s.message)}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to delete app:`}))}}q();C();_();M();X();be();C();lt();var os=100;function Zm(e,t){return`${P}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function Qm(e,t){return Tt(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function gP(e,t,n,r,o={}){let i=rs(Zm(t,n),{limit:Du,cursor:r,filters:o}),s=await J(i,{headers:yt(e)});if(!s.ok)throw await Qm(s,"Failed to list environment variables");return Po(await s.json(),"variables")}async function eg(e,t,n,r={}){return Wa(o=>gP(e,t,n,o,r))}async function tg(e,t,n,r){let o=await J(`${Zm(t,n)}/${encodeURIComponent(r)}`,{method:"DELETE",headers:yt(e)});if(!o.ok)throw await Qm(o,"Failed to delete environment variable")}async function Va(e,t,n,r,o){let i=Object.keys(r).length;if(i>os)throw new f(`Cannot import more than ${os} variables at once (received ${i}).`,{isUserError:!0});let s=await J(`${Zm(t,n)}/bulk`,{method:"POST",headers:{...yt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:r,overwriteExisting:o})});if(!s.ok)throw await Qm(s,"Failed to import environment variables");return await s.json()}var tS=require("dotenv");pe();var nS=["key","isSecret","value","id","environmentId"],Ga=["key","isSecret"];function is(){return nS}var ng=ut(nS);function hP(e,t){switch(t){case"value":return e.isSecret?R("(secret)"):e.value!==""?e.value:R("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):R("\u2014")}}function rg(e,t=Ga){if(e.length===0)return R("No environment variables found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>hP(o,i)));return ze(n,r)}function og(e){let t=e.split(/\r?\n/).map(n=>n.replace(/^\s*export\s+/,"")).join(`
197
+ `);return(0,tS.parse)(t)}async function ig(e){let t=await T(),n=F.forAppsEnvVars({authToken:t}),r=Date.now();try{let{appId:o,envId:i}=await et(t,e),s={key:e.key,q:e.q},a=ns(s),l=await eg(t,o,i,s);if(await n.sendUsage("apps_env_vars_list",{duration:Date.now()-r,variableCount:l.length,filtered:a}),e.json){u.info(JSON.stringify(l,null,2));return}if(l.length===0){u.info(a?"No environment variables matched the given filters.":"No environment variables found.");return}let c=Ce(e.fields,ng,is());u.info(rg(l,c))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list environment variables:`}))}}q();C();_();M();X();C();we();Te();_();M();async function rS(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e).toString("utf8").replace(/\r?\n$/,"")}function sg(e){u.warn(`${re} Passing a secret as a command-line argument exposes it in your shell history and process list. Pipe it via stdin (e.g. \`printf %s "$VALUE" | webflow apps env-vars set ${e} --secret\`) or omit the value to be prompted.`)}async function oS(e,t){if(e!==void 0)return t.secret&&!t.json&&sg(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let n=await rS();if(n==="")throw new f(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:n,source:"stdin"}}if(!V()){let n=t.secret?await rD({message:`Enter the value for ${t.key}:`}):await Je({message:`Enter the value for ${t.key}:`});if(n===null||n==="")throw new f(`No value provided for ${t.key}.`,{isUserError:!0});return{value:n,source:"prompt"}}throw new f(`No value provided for ${t.key}. Pass it as an argument, pipe it via stdin, or run interactively (without --no-input).`,{isUserError:!0})}async function ag(e,t,n){let r=n.secret?" (secret)":"",o=await T(),i=F.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await et(o,n);if(n.dryRun){t!==void 0&&n.secret&&!n.json&&sg(e),n.json?u.info(JSON.stringify({key:e,...n.secret?{isSecret:!0}:{},appId:a,environmentId:l,dryRun:!0},null,2)):(u.info(`Would set ${e}${r} on app ${a}, environment ${l}.`),u.info("Dry run \u2014 no changes made."));return}try{let{value:c,source:d}=await oS(t,{key:e,secret:n.secret,json:n.json}),p={[e]:{value:c,...n.secret?{isSecret:!0}:{}}},m=await Va(o,a,l,p,!0),h=[...m.created,...m.updated,...m.skipped].find(y=>y.key===e);if(!h){let y=m.errors.find(b=>b.key===e);throw new f(y?`Failed to set ${e}: ${y.error}`:`Set did not apply to ${e}.`,{isUserError:!!y})}let g=h.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:n.secret?"secret":"plain",valueSource:d}),n.json){u.info(JSON.stringify({key:e,isSecret:g,status:"set"},null,2));return}u.info(`${$} Set ${e}${g?" (secret)":""}`)}catch(c){throw c instanceof f&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new f(c,{prefix:`${k} Failed to set environment variable:`}))}}q();C();_();M();X();async function lg(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await et(n,t);if(t.dryRun){t.json?u.info(JSON.stringify({key:e,appId:i,environmentId:s,dryRun:!0},null,2)):(u.info(`Would delete ${e} from app ${i}, environment ${s}.`),u.info("Dry run \u2014 no changes made."));return}try{if(await tg(n,i,s,e),await r.sendUsage("apps_env_vars_delete",{duration:Date.now()-o}),t.json){u.info(JSON.stringify({key:e,status:"deleted"},null,2));return}u.info(`${$} Deleted ${e}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await r.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new f(a,{prefix:`${k} Failed to delete environment variable:`}))}}var iS=require("fs"),sS=require("path");q();C();_();M();X();function cg(e){return e.map(({id:t,environmentId:n,key:r,isSecret:o})=>({id:t,environmentId:n,key:r,isSecret:o}))}async function ug(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await et(n,t),a;try{a=(0,iS.readFileSync)((0,sS.resolve)(e),"utf8")}catch{throw new f(`Could not read file: ${e}`,{isUserError:!0})}let l=og(a),c=Object.keys(l);if(c.length===0)throw new f(`No variables found in ${e}.`,{isUserError:!0});if(c.length>os)throw new f(`Cannot import more than ${os} variables at once (${e} has ${c.length}).`,{isUserError:!0});let d={};for(let p of c)d[p]={value:l[p],...t.secret?{isSecret:!0}:{}};if(t.dryRun){if(t.json)u.info(JSON.stringify({appId:i,environmentId:s,secret:!!t.secret,variables:c,dryRun:!0},null,2));else{u.info(`Would import ${c.length} variable(s)${t.secret?" as secrets":""} into app ${i}, environment ${s}:`);for(let p of c)u.info(` ${p}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let p=await Va(n,i,s,d,!0);if(await r.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:p.created.length,updatedCount:p.updated.length,skippedCount:p.skipped.length,errorCount:p.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:cg(p.created),updated:cg(p.updated),skipped:cg(p.skipped),errors:p.errors},null,2));else{u.info(`${$} Imported: ${p.created.length} created, ${p.updated.length} updated, ${p.skipped.length} skipped, ${p.errors.length} failed`);for(let m of p.errors)u.warn(` ${m.key}: ${m.error}`)}if(p.errors.length>0)throw new f(`Import completed with ${p.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(p){throw p instanceof f&&p.isUserError?p:(await r.sendError(p instanceof Error?p:new Error(String(p)),"apps_env_vars_import",{duration:Date.now()-o}),new f(p,{prefix:`${k} Failed to import environment variables:`}))}}Wn();var lS=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");yu(t,{namespace:"apps"}),wu(t,{namespace:"apps"}),t.command("list").description(`List all apps in your Webflow workspace. Optional filters: --site (exact site id), --name (exact, case-sensitive), and --q (case-insensitive substring on name). App names are unique only within a site, so pass --site AND --name together to resolve to at most one app; --site alone can match many apps and --name alone can match apps across sites. ${Gc("app","an exact filter")}`).option("-s, --site <site-id>","Filter apps to an exact Webflow site id. Combine with --name to resolve to at most one app. Does not default from webflow.json.",Ai).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",Ai).addOption(Jc("the app name")).addOption(oe()).addOption(He([...vr()]).default(Nc)).action(Bm),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(oe()).addOption(He([...vr()]).default(Yf)).action(Um),t.command("domains").description("List domains and live URLs for an app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(He([...ua()]).default(jc)).addOption(oe()).option("--limit <n>","Max number of domains to return (server caps at 100)",Xc).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Wm),tt()&&(t.command("update").description("Update an app's name or description. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--name <name>","New app name").option("--description <description>","New app description").addOption(oe()).addOption(Pe()).action(Xm),t.command("delete").description("Delete (or archive) an app. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(Ii()).addOption(oe()).addOption(Pe()).action(Ym)),t.command("environments").description("Manage the environments of a Webflow Cloud app").command("list").description(`List the environments of an app. Optional filters: --branch (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on branch, for discovery). ${Gc("environment","--branch")}`).argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--branch <branch>","Filter environments by exact branch name (case-sensitive) \u2014 resolves to at most one environment.",Ai).addOption(Jc("the environment branch")).addOption(He([...da()]).default(Mc)).addOption(oe()).action(Hm);let r=t.command("deployments").description("Inspect Webflow Cloud deployments");r.command("list").description("List the most recent deployments of an environment (newest first). Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").addOption(nE()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(oe()).addOption(He([...Sr()]).default(pa)).action(Km),r.command("get").description("Get details for a specific deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Pass --wait to poll until the deployment reaches a terminal status (exit 0 on success, 1 otherwise); --interval is floored at 5s and --timeout capped at 30min.").argument("<depId>","Deployment ID").addOption(new aS.Option("--wait","Poll until the deployment reaches a terminal status (success/failed/canceled/unstaged) or the timeout elapses, then exit 0 on success or 1 otherwise")).addOption(oE()).addOption(iE()).addOption(oe()).addOption(He([...Sr()]).default(pa)).action(zm),r.command("redeploy").description("Re-run a deployment at its SAME commit (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. To roll back, redeploy an earlier successful deployment's ID. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Use --dry-run to preview.").argument("<depId>","Deployment ID to re-run").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(oe()).addOption(Pe()).action(qm);let o=t.command("logs").description("Read Webflow Cloud app logs");o.command("build").description("Read the build logs of a deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").argument("[depId]","Deployment ID (required) \u2014 run 'webflow apps deployments list' to find one").addOption(oe()).addOption(He([...Nr()]).default(Ha)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(rm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Gm),o.command("runtime").description("Read the runtime logs of an environment. Resolves the app from WEBFLOW_APP_ID / webflow.json (or a picker); the environment from the [envId] argument, WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or a picker.").argument("[envId]","Environment ID (defaults to the only env; required if the app has several)").addOption(oe()).addOption(He([...Nr()]).default(Ha)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(rm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Jm);let i=t.command("env-vars").description("Manage Webflow Cloud app environment variables");i.command("list").description(`List environment variables for a Cloud app environment. Optional filters: --key (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on key, for discovery \u2014 --q never searches values). ${Gc("variable","--key")} Secret values are never returned.`).addOption(ma()).addOption(ga()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",Ai).addOption(Jc("the variable key")).addOption(oe()).addOption(He([...is()]).default(Ga.join(","))).action(ig),i.command("set").description("Create or update an environment variable. Use --secret to encrypt the value. Use --dry-run to preview.").argument("<key>","Variable name").argument("[value]","Variable value. Omit to read from piped stdin or be prompted (recommended for secrets, keeps them out of shell history).").addOption(ma()).addOption(ga()).addOption(nm()).addOption(Pe()).addOption(oe()).action(ag),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ma()).addOption(ga()).addOption(Pe()).addOption(oe()).action(lg),i.command("import").description("Bulk import environment variables from a .env file. Use --secret to mark every key secret. Use --dry-run to preview.").argument("<file>","Path to a .env (KEY=value) file").addOption(ma()).addOption(ga()).addOption(nm()).addOption(Pe()).addOption(oe()).action(ug)};be();C();lt();C();function Z(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new f(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}async function Tn(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function cS(e,t){Z(t,"siteId");let n=await J(`${P}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok){let o=await Tn(n);throw n.status>=400&&n.status<500?new f(o,{isUserError:!0}):new f(`Failed to list collections: ${o}`)}return(await n.json()).collections??[]}async function uS(e,t){Z(t,"collectionId");let n=await J(`${P}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!n.ok)throw new f(`Failed to get collection: ${await Tn(n)}`);let r=await n.json();return{...r,fields:r.fields??[]}}async function dS(e,t,n){Z(t,"siteId");let r={displayName:n.displayName,singularName:n.singularName};n.slug&&(r.slug=n.slug);let o=await J(`${P}/v2/sites/${t}/collections`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!o.ok){let i=await Tn(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create collection: ${i}`)}return await o.json()}async function pS(e,t,n){Z(t,"collectionId");let r=await J(`${P}/v2/collections/${t}/fields`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({displayName:n.displayName,type:n.type,isRequired:n.isRequired??!1})});if(!r.ok){let o=await Tn(r);throw r.status===404?new f(`Collection "${t}" not found`,{isUserError:!0}):r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to create field: ${o}`)}return await r.json()}async function dg(e,t,n={}){Z(t,"collectionId");let r=new URLSearchParams;n.limit!=null&&r.set("limit",String(n.limit)),n.offset!=null&&r.set("offset",String(n.offset)),n.cmsLocaleId&&r.set("cmsLocaleId",n.cmsLocaleId);let o=r.toString()?`?${r.toString()}`:"",i=await J(`${P}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to list items: ${await Tn(i)}`);let s=await i.json();return{items:s.items??[],total:s.total??0,count:s.count??s.items?.length??0,limit:s.limit??n.limit??100,offset:s.offset??n.offset??0}}async function fS(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=r?`?cmsLocaleId=${encodeURIComponent(r)}`:"",i=await J(`${P}/v2/collections/${t}/items/${n}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to get item: ${await Tn(i)}`);return await i.json()}async function pg(e,t,n,r=!1){Z(t,"collectionId");let o=await J(`${P}/v2/collections/${t}/items`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:n,isDraft:r})});if(!o.ok){let i=await Tn(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create item: ${i}`)}return await o.json()}async function fg(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=await J(`${P}/v2/collections/${t}/items/${n}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:r})});if(o.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!o.ok)throw new f(`Failed to update item: ${await Tn(o)}`);return await o.json()}async function mS(e,t,n){Z(t,"collectionId"),Z(n,"itemId");let r=await J(`${P}/v2/collections/${t}/items/${n}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!r.ok)throw new f(`Failed to delete item: ${await Tn(r)}`)}async function gS(e,t,n){Z(t,"collectionId"),n.forEach(o=>Z(o,"itemId"));let r=await J(`${P}/v2/collections/${t}/items/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({itemIds:n})});if(!r.ok){let o=await Tn(r);throw r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to publish items: ${o}`)}return await r.json()}pe();q();We();async function Fu(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=ne(),n=await Ke(t);return{token:n.accessToken,siteId:n.siteId}}function hS(e,t=["id","displayName","slug"]){if(e.length===0)return R("No collections found.");let n=["id","displayName","singularName","slug","lastUpdated"],r=Object.fromEntries(n.map(a=>[a.toLowerCase(),a])),o=t.map(a=>r[a.toLowerCase()]).filter(a=>a!=null);if(o.length===0)return Mt(`Invalid fields. Available: ${n.join(", ")}`);let i=o.map(a=>se(a)),s=e.map(a=>o.map(l=>{let c=a[l];return c?l==="lastUpdated"?new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c:R("\u2014")}));return ze(i,s)}function yS(e){let t=[`${se("Collection:")} ${e.displayName}`,`${se("ID:")} ${e.id}`,`${se("Slug:")} ${e.slug}`,`${se("Singular:")} ${e.singularName}`,`${se("Updated:")} ${new Date(e.lastUpdated).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`,"",se("Fields:")];if(e.fields.length===0)return t.push(R(" No fields defined.")),t.join(`
198
+ `);let n=["NAME","SLUG","TYPE","REQUIRED"].map(o=>se(o)),r=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(ze(n,r)),t.join(`
199
+ `)}function wS(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return R("No items found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?le("draft"):K("live");if(i==="isArchived")return o.isArchived?R("archived"):"";if(i==="lastUpdated"||i==="lastPublished"||i==="createdOn"){let a=o[i];return a?new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):R("\u2014")}let s=o[i];return s==null?R("\u2014"):String(s)}));return ze(n,r)}C();_();M();function _u(e,t,n="asc"){return[...e].sort((r,o)=>{let i=r[t],s=o[t];if(i==null&&s==null)return 0;if(i==null)return 1;if(s==null)return-1;let a=0;return typeof i=="string"&&typeof s=="string"?a=i.localeCompare(s):typeof i=="number"&&typeof s=="number"?a=i-s:a=String(i).localeCompare(String(s)),n==="desc"?-a:a})}X();async function mg(e){let{token:t,siteId:n}=await Fu(e),r=F.forCms({authToken:t,siteId:n}),o=Date.now();try{let i=await cS(t,n);if(await r.sendUsage("cms_collections_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No collections found.");return}let s=["displayName","slug","lastUpdated"];if(s.includes(e.sortBy)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${s.join(", ")}. Defaulting to displayName.`),e.sortBy="displayName"),!["asc","desc"].includes(e.order))throw new f(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=_u(i,e.sortBy,e.order);if(e.json){u.info(JSON.stringify(a,null,2));return}let l=e.fields.split(",").map(c=>c.trim());u.info(hS(a,l))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list collections:`})}}q();C();_();M();X();async function gg(e,t){let n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await uS(n,e);if(await r.sendUsage("cms_collections_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(yS(i))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_get",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to get collection:`})}}C();_();M();X();async function hg(e){let t=e.singularName??e.name,n=e.slug??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(e.dryRun){u.info("Dry run \u2014 would create collection:"),u.info(JSON.stringify({displayName:e.name,singularName:t,slug:n},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let{token:r,siteId:o}=await Fu(e),i=F.forCms({authToken:r,siteId:o}),s=Date.now();try{let a=await dS(r,o,{displayName:e.name,singularName:t,slug:n});if(await i.sendUsage("cms_collections_create",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}u.info(`${$} Collection created: ${a.id}`),u.info(` Name: ${a.displayName}`),u.info(` Slug: ${a.slug}`),u.info(`
200
+ Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof f&&a.isUserError){u.info(`${k} ${a.message}`),process.exitCode=1;return}throw await i.sendError(a instanceof Error?a:new Error(String(a)),"cms_collections_create",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to create collection:`})}}q();C();_();M();X();async function yg(e){if(e.dryRun){u.info("Dry run \u2014 would create field:"),u.info(JSON.stringify({collectionId:e.collection,displayName:e.name,type:e.type,isRequired:e.required??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let t=await T(),n=F.forCms({authToken:t}),r=Date.now();try{let o=await pS(t,e.collection,{displayName:e.name,type:e.type,isRequired:e.required??!1});if(await n.sendUsage("cms_fields_create",{duration:Date.now()-r}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(`${$} Field created: ${o.id}`),u.info(` Name: ${o.displayName}`),u.info(` Type: ${o.type}`),u.info(` Slug: ${o.slug}`)}catch(o){if(o instanceof f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_fields_create",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to create field:`})}}q();C();_();M();X();async function wg(e){let t=await T(),n=F.forCms({authToken:t}),r=Date.now(),o=e.limit??100,i=e.offset??0;try{let s=await dg(t,e.collection,{limit:o,offset:i,cmsLocaleId:e.locale});if(await n.sendUsage("cms_items_list",{duration:Date.now()-r,count:s.items.length}),s.items.length===0){u.info("No items found.");return}if(e.json){u.info(JSON.stringify(s,null,2));return}let a=e.fields.split(",").map(p=>p.trim());u.info(wS(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let p=s.total>0?` of ${s.total}`:"";u.info(`
201
+ Showing ${l}\u2013${c}${p} items. Use --offset ${c} to load next page.`)}}catch(s){if(s instanceof f&&s.isUserError){u.info(`${k} ${s.message}`),process.exitCode=1;return}throw await n.sendError(s instanceof Error?s:new Error(String(s)),"cms_items_list",{duration:Date.now()-r}),new f(s,{prefix:`${k} Failed to list items:`})}}q();C();_();M();X();async function Dg(e){let t=await T(),n=F.forCms({authToken:t}),r=Date.now();try{let o=await fS(t,e.collection,e.item,e.locale);if(await n.sendUsage("cms_items_get",{duration:Date.now()-r}),e.json){u.info(JSON.stringify(o,null,2));return}let i=o.isArchived?"archived":o.isDraft?"draft":"live";u.info(`${o.id} [${i}]`),u.info(` Last updated: ${new Date(o.lastUpdated).toLocaleString()}`),o.lastPublished&&u.info(` Last published: ${new Date(o.lastPublished).toLocaleString()}`),u.info(" Fields:"),u.info(JSON.stringify(o.fieldData,null,4).replace(/^/gm," "))}catch(o){if(o instanceof f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_get",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to get item:`})}}q();C();_();M();X();async function bg(e){let t;try{t=JSON.parse(e.data)}catch{throw new f(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would create item:"),u.info(JSON.stringify({fieldData:t,isDraft:e.draft??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await pg(n,e.collection,t,e.draft??!1);if(await r.sendUsage("cms_items_create",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Item created: ${i.id}`)}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_create",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to create item:`})}}q();C();_();M();X();async function kg(e){let t;try{t=JSON.parse(e.data)}catch{throw new f(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would update item:"),u.info(JSON.stringify({collectionId:e.collection,itemId:e.item,fieldData:t},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await fg(n,e.collection,e.item,t);if(await r.sendUsage("cms_items_update",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Item updated: ${i.id}`)}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_update",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to update item:`})}}q();C();_();M();X();async function Eg(e){if(e.dryRun){u.info(`Dry run \u2014 would delete item ${e.item} from collection ${e.collection}`),u.info("Dry run complete \u2014 no changes made.");return}let t=await T(),n=F.forCms({authToken:t}),r=Date.now();try{await mS(t,e.collection,e.item),await n.sendUsage("cms_items_delete",{duration:Date.now()-r,dryRun:!1}),u.info(`${$} Item deleted: ${e.item}`)}catch(o){if(o instanceof f&&o.isUserError){u.info(`${k} ${o.message}`),process.exitCode=1;return}throw await n.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_delete",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to delete item:`})}}q();C();_();M();X();async function vg(e){let t=e.items.split(",").map(i=>i.trim());if(e.dryRun){u.info(`Dry run \u2014 would publish ${t.length} item(s) in collection ${e.collection}:`),t.forEach(i=>u.info(` ${i}`)),u.info("Dry run complete \u2014 no changes made.");return}let n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await gS(n,e.collection,t);if(await r.sendUsage("cms_items_publish",{duration:Date.now()-o,itemCount:t.length,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishedItemIds?.length??0;u.info(`${$} Published ${s} item(s)`),i.errors?.length&&i.errors.forEach(a=>u.warn(` ${a.itemId}: ${a.message}`))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_publish",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to publish items:`})}}var DS=e=>{let t=e.command("cms").description("Manage Webflow CMS content"),n=t.command("collections").description("Manage CMS collections");n.command("list").description("List all CMS collections for a site").addOption(It()).addOption(oe()).addOption(He(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption(Ti(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Ri()).action(mg),n.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(oe()).action(gg),n.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(It()).requiredOption("--name <displayName>","Collection display name").option("--singular-name <singularName>","Singular name (defaults to --name)").option("--slug <slug>","URL slug for the collection (auto-derived from --name if omitted)").addOption(Pe()).addOption(oe()).action(hg),t.command("fields").description("Manage CMS collection fields").command("create").description("Add a field to a CMS collection. Use --dry-run to preview.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--name <displayName>","Field display name").requiredOption("--type <type>","Field type (e.g. PlainText, RichText, Number, DateTime, Link, Image, Video, Color, Bool, Option, ItemRef, ItemRefSet)").option("--required","Mark field as required").addOption(Pe()).addOption(oe()).action(yg);let o=t.command("items").description("Manage CMS items");o.command("list").description("List items in a CMS collection").requiredOption("--collection <collectionId>","Collection ID").option("--locale <cmsLocaleId>","CMS locale ID to filter by").addOption(zc()).addOption(qc()).addOption(oe()).addOption(He(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(wg),o.command("get").description("Get a single CMS item by ID").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").option("--locale <cmsLocaleId>","CMS locale ID to retrieve content for").addOption(oe()).action(Dg),o.command("create").description("Create a new CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--data <json>","Item field data as a JSON string").option("--draft","Create as draft (not published)").addOption(Pe()).addOption(oe()).action(bg),o.command("update").description("Update an existing CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").requiredOption("--data <json>","Updated field data as a JSON string").addOption(Pe()).addOption(oe()).action(kg),o.command("delete").description("Delete a CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").addOption(Pe()).action(Eg),o.command("publish").description("Publish one or more CMS items. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--items <itemIds>","Comma-separated item IDs to publish").addOption(Pe()).addOption(oe()).action(vg)};q();pe();C();_();M();We();X();be();lt();C();C();pe();var bS={png:{category:"image",maxBytes:4*1024*1024},jpeg:{category:"image",maxBytes:4*1024*1024},jpg:{category:"image",maxBytes:4*1024*1024},gif:{category:"image",maxBytes:4*1024*1024},svg:{category:"image",maxBytes:4*1024*1024},webp:{category:"image",maxBytes:4*1024*1024},avif:{category:"image",maxBytes:4*1024*1024},pdf:{category:"document",maxBytes:10*1024*1024},doc:{category:"document",maxBytes:10*1024*1024},docx:{category:"document",maxBytes:10*1024*1024},xls:{category:"document",maxBytes:10*1024*1024},xlsx:{category:"document",maxBytes:10*1024*1024},ppt:{category:"document",maxBytes:10*1024*1024},pptx:{category:"document",maxBytes:10*1024*1024},txt:{category:"document",maxBytes:10*1024*1024},csv:{category:"document",maxBytes:10*1024*1024},odt:{category:"document",maxBytes:10*1024*1024},ods:{category:"document",maxBytes:10*1024*1024},odp:{category:"document",maxBytes:10*1024*1024},json:{category:"lottie",maxBytes:10*1024*1024},lottie:{category:"lottie",maxBytes:10*1024*1024}};function Au(e,t){let n=e.split(".").pop()?.toLowerCase()??"",r=bS[n];if(!r){let o=Object.keys(bS).join(", ");throw new f(`Unsupported file type ".${n}". Allowed types: ${o}`,{isUserError:!0})}if(t>r.maxBytes){let o=r.maxBytes/1048576,i=(t/(1024*1024)).toFixed(1);throw new f(`File too large: ${i} MB exceeds the ${o} MB limit for ${r.category} files.`,{isUserError:!0})}}var Sg=["id","displayName","originalFileName","contentType","size","lastUpdated"];function kS(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return R("No assets found.");let n=Object.fromEntries(Sg.map(l=>[l.toLowerCase(),l])),r=t.map(l=>n[l.toLowerCase()]).filter(l=>l!=null);if(r.length===0)return Mt(`Invalid fields. Available: ${Sg.join(", ")}`);let o=t.filter(l=>n[l.toLowerCase()]==null),i=o.length>0?le(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${Sg.join(", ")}
202
+ `):"",s=r.map(l=>se(l)),a=e.map(l=>r.map(c=>{let d=l[c];if(d==null||c==="size"&&d===0)return R("\u2014");if(c==="size")return yP(Number(d));if(c==="lastUpdated"){let m=new Date(String(d)),h=String(m.getMonth()+1).padStart(2,"0"),g=String(m.getDate()).padStart(2,"0"),y=String(m.getFullYear()).slice(-2),b=String(m.getHours()).padStart(2,"0"),S=String(m.getMinutes()).padStart(2,"0");return`${h}/${g}/${y} ${b}:${S}`}let p=String(d);return c==="displayName"&&p.length>40?R("\u2026")+p.slice(-39):p}));return i+ze(s,a)}function yP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ES(e){if(e.length===0)return R("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),n=["id","displayName","assets","lastUpdated"].map(o=>se(o)),r=t.map(o=>[o.id,o.displayName,String(o.assets.length),new Date(o.lastUpdated).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]);return ze(n,r)}async function vS(e,t,n={}){if(Z(t,"siteId"),n.folderId){Z(n.folderId,"folderId");let a=await wP(e,n.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],d=0,p=100;for(;;){let b=await J(`${P}/v2/sites/${t}/assets?limit=${p}&offset=${d}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!b.ok)throw new f(`Failed to list assets: ${b.status} ${b.statusText}`);let S=await b.json(),A=S.assets??[];c.push(...A);let v=S.pagination?.total??0;if(d+=A.length,d>=v||A.length===0)break}let m=c.filter(b=>l.has(b.id)),h=n.offset??0,g=n.limit??m.length,y=m.slice(h,h+g);return{assets:y,pagination:{total:m.length,limit:y.length,offset:h}}}let r=new URLSearchParams;n.limit!=null&&r.set("limit",String(n.limit)),n.offset!=null&&r.set("offset",String(n.offset));let o=r.toString(),i=await J(`${P}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new f(`Failed to list assets: ${i.status} ${i.statusText}`);let s=await i.json();return{assets:s.assets??[],pagination:s.pagination??{total:0,limit:100,offset:0}}}async function SS(e,t,n,r,o){Z(t,"siteId"),o&&Z(o,"folderId");let i=na(n);Au(i.meta.title,i.meta.size);let s=r??i.meta.title,a={fileName:i.meta.title,fileHash:i.meta.fileHash,displayName:s};o&&(a.parentFolder=o);let l=await J(`${P}/v2/sites/${t}/assets`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(a)});if(!l.ok)throw new f(`Failed to initiate asset upload: ${l.status} ${l.statusText}`);let c=await l.json(),d={fields:c.uploadDetails,_id:c.id,s3Url:c.hostedUrl??"",url:c.uploadUrl??"",contentType:c.contentType??"",origFileName:c.originalFileName??i.meta.title,success_action_redirect:"",createdOn:"",updatedOn:""};try{await oa(i,d)}catch(p){throw await J(`${P}/v2/assets/${d._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),p}return{id:d._id,hostedUrl:d.s3Url,displayName:s,originalFileName:i.meta.title}}async function xS(e,t,n){Z(t,"assetId");let r=await J(`${P}/v2/assets/${t}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new f(`Failed to update asset: ${r.status} ${r.statusText}`);return await r.json()}async function wP(e,t){Z(t,"folderId");let n=await J(`${P}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get folder: ${n.status} ${n.statusText}`);return await n.json()}async function CS(e,t){Z(t,"siteId");let n=await J(`${P}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to list folders: ${n.status} ${n.statusText}`);return(await n.json()).assetFolders??[]}async function FS(e,t,n,r){Z(t,"siteId"),r&&Z(r,"parentFolderId");let o={displayName:n};r&&(o.parentFolder=r);let i=await J(`${P}/v2/sites/${t}/asset_folders`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new f(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function xg(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ne(),s=await Ke(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let{assets:i,pagination:s}=await vS(t,n,{limit:e.limit,offset:e.offset,folderId:e.folder});if(await r.sendUsage("assets_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No assets found.");return}let a=["displayName","originalFileName","contentType","size","lastUpdated"],l=e.sortBy;a.includes(l)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${a.join(", ")}. Defaulting to displayName.`),l="displayName");let c=e.order;["asc","desc"].includes(e.order)||(u.warn(`Unknown --order "${e.order}". Valid values: asc, desc. Defaulting to asc.`),c="asc");let d=_u(i,l,c);if(e.json){u.info(JSON.stringify({assets:d,pagination:s},null,2));return}let p=e.fields.split(",").map(h=>h.trim());u.info(kS(d,p));let m=(e.offset??0)+i.length;m<s.total&&u.info(R(`Showing ${m} of ${s.total} assets. Use --offset ${m} to see more.`))}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list assets:`})}}q();C();_();M();We();X();async function Cg(e,t){let n=na(e);if(Au(n.meta.title,n.meta.size),t.dryRun){u.info(`Dry run \u2014 would upload: ${e} (validated)`),t.name&&u.info(` Display name: ${t.name}`),t.folder&&u.info(` Folder: ${t.folder}`),u.info("Dry run complete \u2014 no changes made.");return}let r,o;if(t.site)r=await T(),o=t.site;else{let{manifest:a}=ne(),l=await Ke(a);r=l.accessToken,o=l.siteId}let i=F.forAssets({authToken:r,siteId:o}),s=Date.now();try{let a=await SS(r,o,e,t.name,t.folder);if(await i.sendUsage("assets_upload",{duration:Date.now()-s,dryRun:!1}),t.json){u.info(JSON.stringify(a,null,2));return}u.info(`${$} Asset uploaded: ${a.id}`),a.hostedUrl&&u.info(` URL: ${a.hostedUrl}`)}catch(a){throw await i.sendError(a instanceof Error?a:new Error(String(a)),"assets_upload",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to upload asset:`})}}q();C();_();M();X();async function Fg(e,t){if(!t.altText&&!t.displayName)throw new f("Provide at least one of --alt-text or --display-name.",{isUserError:!0});if(t.dryRun){u.info(`Dry run \u2014 would update asset: ${e}`),t.altText&&u.info(` Alt text: ${t.altText}`),t.displayName&&u.info(` Display name: ${t.displayName}`),u.info("Dry run complete \u2014 no changes made.");return}let n=await T(),r=F.forAssets({authToken:n}),o=Date.now();try{let i=await xS(n,e,{altText:t.altText,displayName:t.displayName});if(await r.sendUsage("assets_update",{duration:Date.now()-o,dryRun:!1}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Asset updated: ${i.id}`),i.displayName&&u.info(` Display name: ${i.displayName}`),i.altText&&u.info(` Alt text: ${i.altText}`)}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_update",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to update asset:`})}}q();C();_();M();We();X();async function _g(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ne(),s=await Ke(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let i=await CS(t,n);if(await r.sendUsage("assets_folders_list",{duration:Date.now()-o,count:i.length}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(ES(i))}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list folders:`})}}q();C();_();M();js();X();async function Ag(e,t){let n,r;if(t.site)n=await T(),r=t.site;else{let{manifest:s}=ne(),a=await Ke(s);n=a.accessToken,r=a.siteId}let o=F.forAssets({authToken:n,siteId:r}),i=Date.now();try{let s=await FS(n,r,e,t.parent);if(await o.sendUsage("assets_folders_create",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} Folder created: ${s.id}`),u.info(` Name: ${s.displayName}`),s.parentFolder&&u.info(` Parent: ${s.parentFolder}`)}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"assets_folders_create",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to create folder:`})}}var _S=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(It()).option("--folder <folderId>","Filter by folder ID").addOption(oe()).addOption(He(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(zc()).addOption(qc()).addOption(Ti(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Ri()).action(xg),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
203
+ Supported types: png, jpg, jpeg, gif, svg, webp, avif (\u22644 MB); pdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, odt, ods, odp, json, lottie (\u226410 MB)`).argument("<file>","Path to the file to upload (see supported types above)").addOption(It()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(Pe()).addOption(oe()).action(Cg),t.command("update").description("Update an asset's metadata. Use --dry-run to preview.").argument("<assetId>","Asset ID to update").option("--alt-text <text>","Alt text for the asset").option("--display-name <name>","New display name for the asset").addOption(Pe()).addOption(oe()).action(Fg);let n=t.command("folders").description("Manage asset folders");n.command("list").description("List all asset folders for a site").addOption(It()).addOption(oe()).action(_g),n.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(It()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(oe()).action(Ag)};q();C();_();M();X();be();C();lt();async function AS(e,t){Z(t,"siteId");let n=await J(`${P}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get site: ${n.status} ${n.statusText}`);return await n.json()}async function IS(e){return Ua(`${P}/v2/sites`,e,"sites","Failed to list sites")}async function RS(e,t){Z(t,"siteId");let n=await J(`${P}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get custom domains: ${n.status} ${n.statusText}`);return(await n.json()).customDomains??[]}async function TS(e,t,n=[],r){Z(t,"siteId"),r&&Z(r,"pageId");let o=n.length>0?{customDomains:n}:{publishToWebflowSubdomain:!0};r&&(o.pageId=r);let i=await J(`${P}/v2/sites/${t}/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new f(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}C();pe();var Ig=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],PS=ut(Ig);function $S(){return Ig}function OS(e,t=["id","displayName","lastPublished"]){if(e.length===0)return R("No sites found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${Ig.join(", ")}`,{isUserError:!0});let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>{let s=o[i];return s?i==="lastPublished"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:R("\u2014")}));return ze(n,r)}function LS(e){if(e.length===0)return R("No custom domains configured.");let t=[se("id"),se("url"),se("lastPublished")],n=e.map(r=>[r.id,r.url,r.lastPublished?new Date(r.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):R("\u2014")]);return ze(t,n)}async function Rg(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await IS(t);if(await n.sendUsage("sites_list",{duration:Date.now()-r,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No sites found.");return}let i=Ce(e.fields,PS,$S());u.info(OS(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list sites:`}))}}q();C();_();M();X();async function Tg(e,t){let n=await T(),r=F.forSites({authToken:n}),o=Date.now();try{let i=await AS(n,e);if(await r.sendUsage("sites_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${i.displayName} (${i.id})`),u.info(` Short name: ${i.shortName}`),u.info(` Time zone: ${i.timeZone}`),i.lastPublished&&u.info(` Published: ${new Date(i.lastPublished).toLocaleString()}`),i.previewUrl&&u.info(` Preview: ${i.previewUrl}`)}catch(i){throw i instanceof f&&i.isUserError?i:(await r.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to get site:`}))}}q();C();_();M();X();async function Pg(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await RS(t,e.site);if(await n.sendUsage("sites_domains",{duration:Date.now()-r,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(LS(o))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to get custom domains:`}))}}q();C();_();M();X();async function $g(e){if(Z(e.site,"siteId"),e.dryRun){u.info(`Would publish ${e.page?`page ${e.page} on`:"site"} ${e.site}`),e.domains?u.info(` Custom domains: ${e.domains}`):u.info(" Domains: Webflow subdomain");return}let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=e.domains?e.domains.split(",").map(l=>l.trim()):[],i=await TS(t,e.site,o,e.page);if(await n.sendUsage("sites_publish",{duration:Date.now()-r,dryRun:!1,publishScope:i.publishScope}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishScope==="page"?"Page":"Site";u.info(`${$} ${s} published successfully`);let a=i.customDomains??[];a.length>0?a.forEach(l=>{let c=l.lastPublished?` (${new Date(l.lastPublished).toLocaleString()})`:"";u.info(` Live at: https://${l.url}${c}`)}):i.publishToWebflowSubdomain&&u.info(" Published to Webflow subdomain")}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to publish site:`}))}}q();q();be();C();we();Te();_();M();We();X();be();lt();C();var Iu="not_enterprise_plan_workspace";async function NS(e,t,n){Z(t,"workspaceId");let r=n.trim();if(!r)throw new f("Site name cannot be empty.",{isUserError:!0});let o=await J(`${P}/v2/workspaces/${t}/sites`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({name:r})});if(!o.ok){let s=await o.text().catch(()=>""),a;try{a=JSON.parse(s).code}catch{}throw a===Iu?new f("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:Iu}):a==="missing_scopes"?new f(`Your token is missing the 'workspace:write' scope.
204
+ Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new f(`Failed to create site "${r}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new f("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??r,shortName:i.shortName??""}}function DP(e){Se({siteId:e.id});let{manifestPath:t}=ne();u.info(`${$} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function bP(e,t){let n=new Map;for(let i of t)i.workspaceId&&n.set(i.workspaceId,(n.get(i.workspaceId)??0)+1);let r=[...n.keys()];if(r.length===1)return r[0];if(r.length===0){let i=await Qi(e);if(i.length===0)throw new f("Could not determine a workspace for this token.",{isUserError:!0});if(i.length===1)return i[0].id;if(V())throw new f(`This token can access ${i.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});return(await es(i)).id}if(V())throw new f(`This token's sites span ${r.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});let o=await Me({message:"Which workspace should the new site be created in?",choices:r.map(i=>({name:`${i} (${n.get(i)} site${n.get(i)===1?"":"s"})`,value:i}))});if(!o)throw new f("No workspace selected.",{isUserError:!0});return o}async function kP(e,t){if(u.warn(`${k} ${t.message}
205
+ Create the site in the Webflow dashboard: ${kn}/dashboard
206
+ then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await Re({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let r=await hr(e);if(r.length===0)throw new f("No existing sites are accessible with this token yet. Create one in the Webflow dashboard, then re-run `webflow sites init`.",{isUserError:!0});return{site:await hi(r),created:!1}}async function EP(e,t,n){let r=await bP(e,t),o=n.name;if(o||(o=await Je({message:"Name for the new site:",validate:s=>s.trim().length>0||"Site name cannot be empty."})??void 0),!o||!o.trim())throw new f("A site name is required. Pass --name <name> to skip the prompt.",{isUserError:!0});let i;try{i=await NS(e,r,o)}catch(s){if(s instanceof f&&s.code===Iu)return kP(e,s);throw s}return u.info(`${$} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function Ru(e={}){let t=await T({apiToken:e.apiToken}),n=F.forSites({authToken:t}),r=Date.now(),o=!1;try{if(e.siteId&&(e.create||e.name))throw new f("--site-id and --create/--name are mutually exclusive. Bind to an existing site OR create a new one.",{isUserError:!0});let i=await hr(t),s;if(e.siteId){Z(e.siteId,"siteId");let a=i.find(l=>l.id===e.siteId);if(!a)throw new f(`Site "${e.siteId}" is not among the ${i.length} site(s) this token can access.`,{isUserError:!0});s=a}else{let a=!!(e.create||e.name);if(!a&&V())throw new f("`webflow sites init` needs an explicit target when prompts are unavailable. Pass --site-id <siteId> to bind, or --create --name <name> to create a new site.",{isUserError:!0,missingFlag:"site-id"});if(a||(i.length===0?(u.info("No sites are accessible with this token."),a=!0):a=await Me({message:"How do you want to connect this project?",choices:[{name:"Bind to an existing Webflow site",value:"bind"},{name:"Create a new Webflow site",value:"create"}],default:"bind"})==="create"),a){let l=await EP(t,i,e);s=l.site,o=l.created}else s=await hi(i)}DP(s),await n.sendUsage("site_init",{duration:Date.now()-r,created:o})}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"site_init",{duration:Date.now()-r}),i instanceof f?i:new f(i,{prefix:`${k} Failed to initialize site:`})}}q();pe();C();_();M();X();be();lt();C();function vP(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function SP(e,t){let n=await t.text(),r;try{r=JSON.parse(n)}catch{}throw t.status===404&&r?.error==="Not found"&&!r.code?new f(`Failed to ${e}: WFS Sync is not enabled on this environment (the server feature flag is off, or the host does not serve /api/ai/wfs).`,{isUserError:!0}):r?.code==="SCHEMA_STALE"?new f(`Failed to ${e}: the site's filesystem schema changed since the last pull. Run \`webflow sites pull\` and re-apply your changes.`,{isUserError:!0}):r?.code&&r.error?new f(`Failed to ${e}: ${r.error} (${r.code})`,{isUserError:t.status<500}):new f(`Failed to ${e}: ${t.status} ${t.statusText}${vP(n)}`)}async function jS(e,t,n,r){let o=await J(`${kn}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});o.ok||await SP(e,o);let i=await o.json();if(!i||i.status!=="ok"||i.result==null)throw new f(`Invalid response from the WFS Sync API: expected an ok envelope${i?.error?` (${i.error})`:""}.`);return i.result}async function Ja(e,t,n){Z(t,"siteId");let r=await jS("pull the site files","pull",e,{siteId:t,...n?.pageIds&&n.pageIds.length>0?{pageIds:n.pageIds}:{},...n?.manifestOnly?{manifestOnly:!0}:{}});return{...r,pages:r.pages.map(o=>({...o,folderSegments:Array.isArray(o.folderSegments)?o.folderSegments:[]}))}}async function MS(e,t,n,r){Z(t,"siteId");let o=await jS("push the site files","push",e,{siteId:t,changes:n,...r?.conflictPolicy?{conflictPolicy:r.conflictPolicy}:{},...r?.schemaHash?{schemaHash:r.schemaHash}:{}});if(!Array.isArray(o.results))throw new f("Invalid response from the WFS Sync API: expected a `results` array.");return o}We();q();C();var Tu=require("path");function Og(e){return e.split(Tu.sep).join("/").replace(/\\/g,"/")}function $o(e){if(e===""||e.includes("\0")||(0,Tu.isAbsolute)(e))return!1;let t=Og(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(n=>n==="..")}var xP={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},BS={library:{pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat"},astro:{pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat"},nextjs:{pagesRoot:"src/app",componentsRoot:"src/components",pagesShape:"nested"},"nextjs-pages":{pagesRoot:"pages",componentsRoot:"src/components",pagesShape:"flat"}};function CP(e){return e.endsWith("/")?e.slice(0,-1):e}function US(e,t,n){let r=e.trim();if(!$o(r))throw new f(`"site.layout.${t}" in ${n} must be a path inside the project ("src/components"), not "${e}".`,{isUserError:!0});let o=r.split("/").filter(i=>i!==""&&i!==".").join("/");if(o==="")throw new f(`"site.layout.${t}" in ${n} must name a directory inside the project, not "${e}".`,{isUserError:!0});return CP(o)}function FP(e,t,n){let r=e.split("/"),o=t.split("/"),i=[];for(let s=0;s<Math.min(r.length,o.length)-1&&r[s]===o[s];s++)i.push(r[s]);return i.length>0?`${i.join("/")}/${n}`:n}function _P(e,t){let n=e?.layout;if(!n)return xP;let r=n.preset?BS[n.preset]:void 0;if(n.preset&&!r)throw new f(`Unknown "site.layout.preset" value "${n.preset}" in ${t}. Known presets: ${Object.keys(BS).join(", ")}.`,{isUserError:!0});let o=n.pagesRoot??r?.pagesRoot,i=n.componentsRoot??r?.componentsRoot;if(!o||!i)throw new f(`"site.layout" in ${t} must specify both "pagesRoot" and "componentsRoot" (directly, or via a "preset" that provides them).`,{isUserError:!0});let s=n.pagesShape??r?.pagesShape??"flat",a=US(o,"pagesRoot",t),l=US(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:FP(a,l,"theme")}}function ss(e){let{manifest:t,manifestPath:n}=ne(),r=e?.trim();r&&Z(r,"site-id");let o=r||no(t);if(!o||o.trim()==="")throw new f(`Missing "siteId" in ${n}. Run \`webflow sites init\` to select a site, set WEBFLOW_SITE_ID, or pass --site-id.`,{isUserError:!0});let i=_P(t.site,n);return{siteId:o,layout:i}}var rr=require("@babel/types");var WS=require("@babel/parser");function Xt(e){try{return(0,WS.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function*jr(e){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let t of e)yield*jr(t);return}if(typeof e.type=="string"){yield e;for(let[t,n]of Object.entries(e))t==="loc"||t==="leadingComments"||t==="trailingComments"||(yield*jr(n))}}}function Mr(e,t){if(t.length===0)return e;let n=e;for(let{start:r,end:o,text:i}of[...t].sort((s,a)=>a.start-s.start))n=n.slice(0,r)+i+n.slice(o);return n}function HS(e){let t;for(let n of jr(e.program))if((0,rr.isCallExpression)(n)&&(0,rr.isIdentifier)(n.callee,{name:"component"})&&(0,rr.isObjectExpression)(n.arguments[0])){let r=n.arguments[0];(t===void 0||(r.start??0)<(t.start??0))&&(t=r)}return t}function VS(e){return e.properties.some(t=>(0,rr.isObjectProperty)(t)&&!t.computed&&(0,rr.isIdentifier)(t.key,{name:"id"}))}function GS(e,t){let n=Xt(e),r=n&&HS(n);if(!r||r.start==null||VS(r))return;let o=r.start,i=e.slice(o+1);if(i.slice(0,i.includes(`
207
+ `)?i.indexOf(`
208
+ `):i.length).trim()===""){let l=i.split(`
209
+ `),c=" ";for(let d of l.slice(1))if(d.trim()!==""){c=d.match(/^\s*/)?.[0]??c;break}return e.slice(0,o+1)+`
210
+ ${c}id: ${t},`+e.slice(o+1)}let a=i.startsWith(" ")?"":" ";return e.slice(0,o+1)+` id: ${t},${a}`+e.slice(o+1)}function JS(e,t){return GS(e,`"${t}"`)}function KS(e){return GS(e,"null")}function zS(e){let t=Xt(e),n=t&&HS(t);return n?VS(n):!0}var XS=require("crypto"),te=require("@babel/types");function qS(e){return(0,XS.createHash)("sha256").update(e,"utf8").digest("hex").slice(0,16)}var dn=e=>e.join(",");function YS(e){let t=Xt(e),n=t&&Ng(t);if(!n)return[];let r=[],o=s=>s.start!=null&&s.end!=null?e.slice(s.start,s.end):"";function i(s,a){let l=ZS(s);r.push({path:a,kind:"element",...l?{tag:l}:{},hash:qS(o(s))});let c=0;for(let d of s.children){if(jg(d))continue;let p=Mg(d)!==void 0,m=ex(d)!==void 0;if(p||m){r.push({path:[...a,c++],kind:"string",hash:qS(o(d))});continue}(0,te.isJSXElement)(d)&&i(d,[...a,c++])}}return i(n,[]),r}function AP(e,t){let n=new Map,r=new Set,o=(l,c)=>l.kind===c.kind&&(l.tag===void 0||l.tag===c.tag),i=(l,c)=>{r.add(c),n.set(dn(l.path),c)},s=new Map(t.map(l=>[dn(l.path),l])),a=new Map;for(let l of t)l.hash!==void 0&&a.set(l.hash,[...a.get(l.hash)??[],l]);for(let l of e){let c=s.get(dn(l.path));c&&c.hash!==void 0&&c.hash===l.hash&&!r.has(c)&&o(c,l)&&i(l,c)}for(let l of e){if(n.has(dn(l.path)))continue;let c=(a.get(l.hash)??[]).find(d=>!r.has(d)&&o(d,l));c&&i(l,c)}for(let l of e){if(n.has(dn(l.path)))continue;let c=s.get(dn(l.path));c&&!r.has(c)&&o(c,l)&&i(l,c)}return n}function Ng(e){for(let t of jr(e.program)){if(!(0,te.isCallExpression)(t)||!((0,te.isIdentifier)(t.callee,{name:"page"})||(0,te.isIdentifier)(t.callee,{name:"component"})))continue;let n=t.arguments[t.arguments.length-1];if(!n||!(0,te.isArrowFunctionExpression)(n)&&!(0,te.isFunctionExpression)(n))continue;let{body:r}=n;if((0,te.isJSXElement)(r))return r;if((0,te.isBlockStatement)(r)){for(let o of r.body)if((0,te.isReturnStatement)(o)&&o.argument&&(0,te.isJSXElement)(o.argument))return o.argument}}}function ZS(e){let{name:t}=e.openingElement;if((0,te.isJSXIdentifier)(t))return t.name;if((0,te.isJSXMemberExpression)(t)){let n=t.object;if((0,te.isJSXIdentifier)(n))return`${n.name}.${t.property.name}`}}function jg(e){if(!(0,te.isJSXElement)(e))return!1;let t=e.openingElement.name;return(0,te.isJSXMemberExpression)(t)&&(0,te.isJSXIdentifier)(t.object,{name:"Basic"})&&(0,te.isJSXIdentifier)(t.property,{name:"String"})}function Lg(e){for(let t of e.openingElement.attributes)if((0,te.isJSXAttribute)(t)&&(0,te.isJSXIdentifier)(t.name,{name:"uid"})&&(0,te.isStringLiteral)(t.value))return t.value.value}function IP(e){return e.replace(/^\s*\n\s*/,"").replace(/\s*\n\s*$/,"").replace(/\s*\n\s*/g," ")}function RP(e){let t=e.children.filter(r=>!((0,te.isJSXText)(r)&&r.value.trim()===""));if(t.length!==1)return;let[n]=t;if((0,te.isJSXText)(n))return IP(n.value);if((0,te.isJSXExpressionContainer)(n)&&(0,te.isStringLiteral)(n.expression))return n.expression.value}function Mg(e){if(!(!(0,te.isJSXExpressionContainer)(e)||!(0,te.isStringLiteral)(e.expression)))return e.expression.value}function QS(e){return(0,te.isIdentifier)(e)}function TP(e){let t=e.children.filter(o=>!((0,te.isJSXText)(o)&&o.value.trim()===""));if(t.length!==1)return;let[n]=t;if(!(0,te.isJSXExpressionContainer)(n))return;let{expression:r}=n;if(QS(r)&&!(r.start==null||r.end==null))return{start:r.start,end:r.end}}function ex(e){if(!(0,te.isJSXExpressionContainer)(e))return;let{expression:t}=e;if(QS(t)&&!(t.start==null||t.end==null))return{start:t.start,end:t.end}}function PP(e,t){let r=t.openingElement.attributes.find(a=>(0,te.isJSXAttribute)(a)&&(0,te.isJSXIdentifier)(a.name,{name:"uid"})&&(0,te.isStringLiteral)(a.value));if(!r||r.start==null||r.end==null)return;let o=e.lastIndexOf(`
211
+ `,r.start-1)+1,i=e.indexOf(`
212
+ `,r.end),s=i===-1?e.length:i;return/^\s*$/.test(e.slice(o,r.start))&&/^\s*$/.test(e.slice(r.end,s))?{start:o,end:i===-1?e.length:i+1}:e[r.end]===" "?{start:r.start,end:r.end+1}:r.start>0&&e[r.start-1]===" "?{start:r.start-1,end:r.end}:{start:r.start,end:r.end}}function Pu(e){let t=Xt(e),n=t&&Ng(t);if(!n)return{sugared:e,entries:[]};let r=[],o=[];function i(l,c){let d=Lg(l);if(d===void 0)return;let p=PP(e,l);if(!p)return;let m=ZS(l);r.push({path:c,uid:d,kind:"element",...m?{tag:m}:{}}),o.push({start:p.start,end:p.end,text:""})}function s(l,c){let d=0;for(let p of l.children){if(jg(p)){let m=Lg(p);if(m===void 0||p.start==null||p.end==null)continue;let h=RP(p),g=h===void 0?TP(p):void 0;if(h===void 0&&g===void 0)continue;r.push({path:[...c,d++],uid:m,kind:"string"}),o.push({start:p.start,end:p.end,text:h!==void 0?`{${JSON.stringify(h)}}`:`{${e.slice(g.start,g.end)}}`});continue}if(Mg(p)!==void 0){d++;continue}if((0,te.isJSXElement)(p)){let m=[...c,d++];i(p,m),s(p,m)}}}if(i(n,[]),s(n,[]),o.length===0)return{sugared:e,entries:[]};let a=Mr(e,o);return{sugared:a,entries:Bg(a,r)}}function Bg(e,t){if(t.length===0)return t;let n=new Map(YS(e).map(r=>[dn(r.path),r.hash]));return t.map(r=>{let o=n.get(dn(r.path));return o?{...r,hash:o}:r})}function tx(e,t){let n=Xt(e),r=n&&Ng(n);if(!r)return{desugared:e,hasNewNodes:!1};let o=AP(YS(e),t),i=[],s=!1;function a(c,d){if(Lg(c)!==void 0)return;let p=o.get(dn(d));if(!p||p.kind!=="element"){s=!0;return}let m=c.openingElement.name.end;m!=null&&i.push({start:m,end:m,text:` uid=${JSON.stringify(p.uid)}`})}function l(c,d){let p=0;for(let m of c.children){if(jg(m))continue;let h=Mg(m);if(h!==void 0){let y=[...d,p++];if(m.start==null||m.end==null)continue;let b=o.get(dn(y));if(!b||b.kind!=="string"){s=!0;continue}i.push({start:m.start,end:m.end,text:`<Basic.String uid=${JSON.stringify(b.uid)}>{${JSON.stringify(h)}}</Basic.String>`});continue}let g=ex(m);if(g!==void 0){let y=[...d,p++];if(m.start==null||m.end==null)continue;let b=o.get(dn(y));if(!b||b.kind!=="string"){s=!0;continue}i.push({start:m.start,end:m.end,text:`<Basic.String uid=${JSON.stringify(b.uid)}>{${e.slice(g.start,g.end)}}</Basic.String>`});continue}if((0,te.isJSXElement)(m)){let y=[...d,p++];a(m,y),l(m,y)}}}return a(r,[]),l(r,[]),{desugared:Mr(e,i),hasNewNodes:s}}var mt=require("@babel/types");function $P(e){if(!(0,mt.isVariableDeclarator)(e)||!(0,mt.isIdentifier)(e.id)||!e.init)return;let{init:t}=e;if(!(!(0,mt.isCallExpression)(t)||!(0,mt.isIdentifier)(t.callee,{name:"style"})))return{ident:e.id.name,call:t}}function nx(e){let t=e.arguments[2];return t&&(0,mt.isObjectExpression)(t)?t:void 0}function rx(e){for(let t of e.properties){if(!(0,mt.isObjectProperty)(t)||t.computed)continue;if(((0,mt.isIdentifier)(t.key,{name:"__wfId"})||(0,mt.isStringLiteral)(t.key)&&t.key.value==="__wfId")&&(0,mt.isStringLiteral)(t.value))return t}}function ox(e){let t=[];for(let n of jr(e.program)){let r=$P(n);r&&t.push(r)}return t.sort((n,r)=>(n.call.start??0)-(r.call.start??0))}function $u(e){let t=Xt(e);if(!t)return{sugared:e,entries:[]};let n=[],r=[];for(let{ident:o,call:i}of ox(t)){let s=nx(i);if(!s)continue;let a=rx(s);if(!a||!(0,mt.isStringLiteral)(a.value))continue;let l=i.arguments[1];if(!(a.start==null||a.end==null))if(n.push({ident:o,wfId:a.value.value}),s.properties.length===1){if(l?.end==null||s.end==null)continue;r.push({start:l.end,end:s.end,text:""})}else{let c=s.properties[1];if(c?.start==null)continue;r.push({start:a.start,end:c.start,text:""})}}return r.length===0?{sugared:e,entries:[]}:{sugared:Mr(e,r),entries:n}}function ix(e,t){let n=Xt(e);if(!n)return{desugared:e,hasNewStyles:!1};let r=new Map(t.map(s=>[s.ident,s])),o=[],i=!1;for(let{ident:s,call:a}of ox(n)){let l=nx(a);if(l&&rx(l))continue;let c=r.get(s);if(!c){i=!0;continue}let d=JSON.stringify(c.wfId);if(l){let p=l.properties[0];p?.start!=null?o.push({start:p.start,end:p.start,text:`__wfId: ${d}, `}):l.start!=null&&o.push({start:l.start+1,end:l.start+1,text:` __wfId: ${d} `})}else{let p=a.arguments[1];p?.end!=null&&o.push({start:p.end,end:p.end,text:`, { __wfId: ${d} }`})}}return{desugared:Mr(e,o),hasNewStyles:i}}var Ur=require("fs"),as=require("path"),hx=w(require("fast-glob"));C();var sx=require("crypto"),gt=require("fs"),Oo=require("path");C();var Br=".webflow/wfs";function pn(e){return(0,sx.createHash)("sha256").update(e,"utf8").digest("hex")}function ax(e){return(0,Oo.join)(e,Br,"index.json")}function Ug(e,t){return $o(t)?(0,Oo.join)(e,Br,`${t}.json`):void 0}function lx(e){let t=ax(e);if((0,gt.existsSync)(t))try{let n=JSON.parse((0,gt.readFileSync)(t,"utf8"));return!n||typeof n.schemaHash!="string"||!Array.isArray(n.files)?"corrupt":{...typeof n.siteId=="string"?{siteId:n.siteId}:{},schemaHash:n.schemaHash,files:n.files}}catch{return"corrupt"}}function Ou(e=process.cwd()){let t=lx(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${Br}/index.json could not be read`};let n={},r=[];for(let{wirePath:o}of t.files){let i=Ug(e,o);if(!i){r.push(o);continue}if(!(0,gt.existsSync)(i)){r.push(o);continue}try{let s=JSON.parse((0,gt.readFileSync)(i,"utf8"));if(s.localPath!==void 0&&!$o(s.localPath)){r.push(o);continue}n[o]=s}catch{r.push(o)}}return{kind:"ok",lockfile:{...t.siteId?{siteId:t.siteId}:{},schemaHash:t.schemaHash,files:n},corruptPaths:r}}function Ka(e,t=process.cwd()){let n=lx(t),r=new Set(n&&n!=="corrupt"?n.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=Ug(t,s);if(!a)throw new f(`Refusing to write a lock entry outside ${Br}: "${s}"`);(0,gt.mkdirSync)((0,Oo.dirname)(a),{recursive:!0}),(0,gt.writeFileSync)(a,`${JSON.stringify(e.files[s],null,2)}
213
+ `,"utf8")}for(let s of r){if(s in e.files)continue;let a=Ug(t,s);a&&(0,gt.existsSync)(a)&&(0,gt.rmSync)(a)}let o={...e.siteId?{siteId:e.siteId}:{},schemaHash:e.schemaHash,files:Object.keys(e.files).sort().map(s=>({wirePath:s,localPath:e.files[s].localPath??s}))},i=ax(t);(0,gt.mkdirSync)((0,Oo.dirname)(i),{recursive:!0}),(0,gt.writeFileSync)(i,`${JSON.stringify(o,null,2)}
214
+ `,"utf8")}function cx(e=process.cwd()){(0,gt.rmSync)((0,Oo.join)(e,Br),{recursive:!0,force:!0})}C();function ux(e){if(!$o(e))throw new f(`Refusing to write unsafe path from server: "${e}"`)}var OP=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function za(e){return OP.exec(e)?.[1]}var dx=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function LP(e){return dx.exec(e)?.[2]}function NP(e){let t=dx.exec(e);return t?t[1]??"":void 0}function Hg(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function Vg(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function Gg(e,t){let r=e.slice(t.length+1).split("/");if(r.length===1)return"";if(r.length===2)return r[0]}function px(e,t){if(t.pagesShape==="nested"){let r=e.isDefault?[]:[...e.folderSegments,e.slug];return r.length>0?`${t.pagesRoot}/${r.join("/")}/page.tsw`:`${t.pagesRoot}/page.tsw`}let n=e.isDefault?["index"]:[...e.folderSegments,e.slug];return`${t.pagesRoot}/${n.join("/")}.tsw`}function Jg(e,t,n){if(n)return n;let r=LP(e);if(!r)return;let o=NP(e)??"";return o?`${t.componentsRoot}/${o}/${r}.tsw`:`${t.componentsRoot}/${r}.tsw`}function fx(e,t){let n=Vg(e,t);if(!n)return;let r=Gg(e,t);if(r!==void 0)return Hg(n,r)}var Wg="site/theme/";function mx(e,t){if(e.startsWith(Wg))return`${t.themeRoot}/${e.slice(Wg.length)}`}function Lu(e,t){let n=`${t}/`;if(e.startsWith(n))return`${Wg}${e.slice(n.length)}`}async function yx(e,t,n=process.cwd(),r=!1){let o=[],i=[],s=[],a=[],l=[],c=[],d={},p=new Map,m=new Map;for(let[y,b]of Object.entries(e.files)){let S=b.localPath??y;p.set(y,S),m.set(S,y)}let h=new Set((await(0,hx.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:n,onlyFiles:!0,dot:!1})).map(Og)),g=new Map;for(let y of Object.keys(e.files).sort()){let b=e.files[y],S=p.get(y);if(b.deletedUpstream){(0,Ur.existsSync)((0,as.join)(n,S))&&c.push(S);continue}if(!(0,Ur.existsSync)((0,as.join)(n,S))){i.push(S),g.set(b.contentSha256,S);continue}d[y]=S;let A=(0,Ur.readFileSync)((0,as.join)(n,S),"utf8");(r||pn(A)!==b.contentSha256)&&o.push({path:y,content:A,baseHash:b.serverHash})}for(let y of[...h].sort()){if(m.has(y))continue;let b=(0,Ur.readFileSync)((0,as.join)(n,y),"utf8"),S=g.get(pn(b));if(S!==void 0){s.push({oldPath:S,newPath:y});continue}let A=MP(y,t);if(A.kind==="unmappable"){a.push(y);continue}let{wirePath:v}=A,x=p.get(v);if(x!==void 0&&x!==y){l.push(y);continue}d[v]=y;let O=e.files[v];o.push(O?{path:v,content:b,baseHash:O.serverHash}:{path:v,content:b})}return{changes:o,missing:i,renameCandidates:s,unmappable:a,stale:l,orphanedUpstream:c,localPaths:d}}function MP(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let r=Vg(e,t.componentsRoot);if(!r)return{kind:"unmappable"};let o=Gg(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:Hg(r,o)}}let n=Lu(e,t.themeRoot);return n!==void 0?{kind:"theme",wirePath:n}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function Nu(e){let t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20));return t}function wx(e){let t=e.filter(a=>!za(a.path)),n=new Map;for(let a of e){let l=za(a.path);if(!l)continue;let c=n.get(l)??[];c.push(a),n.set(l,c)}let r=n.size>0?199:200;if(t.length>r)throw new f(`Too many changed site-global files to push in one request (${t.length} > ${r}). Run \`webflow sites push\` without --force to send only the files that changed, then use --force just for the ones that still conflict.`,{isUserError:!0});let o=[],i=[...t],s=0;for(let[,a]of n)!(s<20&&i.length+a.length<=200)&&(i.length>0||s>0)&&(o.push(i),i=[],s=0),i.push(...a),s+=1;return i.length>0&&o.push(i),o}function ju(e,t=process.cwd()){let n=(0,as.join)(t,e);if((0,Ur.existsSync)(n))return(0,Ur.readFileSync)(n,"utf8")}var BP="site/current-page.tsw";function Mu(e){return za(e)!==void 0?BP:e}function UP(e,t){let n=e.split("/").slice(0,-1);for(let r of t.split("/"))if(!(r===""||r===".")){if(r===".."){n.length>0&&n.pop();continue}n.push(r)}return n.join("/")}function WP(e,t){let n=e.split("/").slice(0,-1),r=t.split("/"),o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;let i=n.length-o,s=r.slice(o).join("/");return i>0?`${"../".repeat(i)}${s}`:`./${s}`}function Bu(e,t,n,r){let o=Xt(e);if(!o)return e;let i=[];for(let s of o.program.body){if(s.type!=="ImportDeclaration")continue;let a=s.source;if(a.start==null||a.end==null)continue;let l=a.value;if(!l.endsWith(".tsw")||!l.startsWith("./")&&!l.startsWith("../"))continue;let c=r(UP(t,l));if(c===void 0)continue;let d=WP(n,c);if(d===l)continue;let p=e[a.start],m=p==="'"||p==='"'?`${p}${d}${p}`:JSON.stringify(d);i.push({start:a.start,end:a.end,text:m})}return Mr(e,i)}function HP(e,t){return n=>t[n]??e.files[n]?.localPath??n}function VP(e,t){let n=e.outcome==="committed"||e.outcome==="noop"?$:k,i=Object.keys(e.hashes??e.currentHashes??{}).map(t).find(a=>a.endsWith(".tsw"))??`page ${e.pageId}`,s=[`${n} ${i}: ${e.outcome}`];if(e.outcome==="conflict")for(let a of Object.keys(e.currentHashes??{}))s.push(R(` ${t(a)} changed upstream \u2014 run \`webflow sites pull\`, re-apply your edit, and push again (or push with --force to overwrite).`));e.outcome==="skipped"&&s.push(R(" an earlier change carrying site-global files failed to commit in this push, so this page was never attempted \u2014 resolve the issue above and push again.")),e.error&&s.push(R(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${re} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
215
+ `)}function GP(e,t,n,r){let o=new Map;for(let[i,s]of Object.entries(t.files))o.set(s.localPath??i,i);for(let i of e)o.set(n[i.path]??i.path,i.path);return e.map(i=>{let s=n[i.path]??i.path;if(i.content===void 0||!s.endsWith(".tsw"))return i;let a=Bu(i.content,s,Mu(i.path),l=>o.get(l)??Lu(l,r.themeRoot)??fx(l,r.componentsRoot));return{...i,content:a}})}function JP(e,t){let n=new Set,r=new Set;return{pushChanges:e.map(i=>{if(!i.path.endsWith(".tsw")||i.content===void 0)return i;let s=t.files[i.path]?.nodeIds??[],{desugared:a,hasNewNodes:l}=tx(i.content,s);l&&n.add(i.path);let c=t.files[i.path]?.styleIds??[],{desugared:d,hasNewStyles:p}=ix(a,c);return p&&r.add(i.path),{...i,content:d}}),pathsWithNewNodes:n,pathsWithNewStyles:r}}function KP(e,t){let n=[],r=[];for(let o of e){let i=t.files[o.path]?.componentId;if(o.content===void 0){r.push(o);continue}if(i){let a=JS(o.content,i);if(a===void 0){n.push(o.path);continue}r.push({...o,content:a});continue}if(o.baseHash!==void 0){r.push(o);continue}let s=KS(o.content);r.push(s===void 0?o:{...o,content:s})}return{pushChanges:r,spliceFailures:n}}function zP(e,t,n,r){let o=GP(e,t,n,r),{pushChanges:i,pathsWithNewNodes:s,pathsWithNewStyles:a}=JP(o,t),{pushChanges:l,spliceFailures:c}=KP(i,t);return{pushChanges:l,pathsWithNewNodes:s,pathsWithNewStyles:a,spliceFailures:c}}async function qP(e,t,n,r,o){let i=[],s=!1,a=!1;for(let[l,c]of n.entries()){let d;try{d=await MS(e,t,c,{conflictPolicy:r,schemaHash:o})}catch(m){throw s&&u.warn(`${re} The push failed after ${l} of ${n.length} batches committed. Local sync state may be stale \u2014 run \`webflow sites pull\` before pushing again.`),m}o=d.schemaHash,i.push(...d.results);let p=d.results.some(m=>m.outcome==="conflict"||m.outcome==="error"||m.outcome==="skipped"||(m.rejected?.length??0)>0);if(d.results.some(m=>m.outcome==="committed")&&(s=!0),p&&l<n.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function XP(e){let t=[];for(let n of e)if(n.outcome==="committed")for(let[r,o]of Object.entries(n.createdComponents??{}))t.push({path:r,componentId:o,hash:n.hashes?.[r]});return t}function YP(e,t,n,r,o,i){let s={...e.files};for(let l of i)if(l.outcome==="committed")for(let[c,d]of Object.entries(l.hashes??{})){let p=r.get(c);if(!p||p.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:d,contentSha256:pn(p.content),...m?{localPath:m}:{}}}let a=XP(i);for(let{path:l,componentId:c,hash:d}of a){let p=r.get(l)?.content;if(p===void 0||d===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:d,contentSha256:pn(p),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{siteId:e.siteId??t,schemaHash:n,files:s},created:a}}function ZP(e,t){for(let{path:n,componentId:r}of e)u.info(`${$} Created component ${t(n)} (id ${r})`),u.info(R(" id tracked locally \u2014 it will be spliced into this file on future pushes without changing it on disk"))}async function QP(e,t,n,r,o,i){let s=new Set([...r,...o]),a=[...new Set(n.filter(c=>c.outcome==="committed"&&Object.keys(c.hashes??{}).some(d=>s.has(d))).map(c=>c.pageId))];if(a.length===0)return i;let l={...i.files};for(let c of Nu(a)){let d=await Ja(e,t,{pageIds:c});for(let p of d.files){let m=l[p.path];if(!m)continue;let h={};if(r.has(p.path)){let{entries:g}=Pu(p.content);g.length>0&&(h.nodeIds=g)}if(o.has(p.path)){let{entries:g}=$u(p.content);g.length>0&&(h.styleIds=g)}Object.keys(h).length>0&&(l[p.path]={...m,...h})}}return{...i,files:l}}function e$({missing:e,renameCandidates:t,unmappable:n,stale:r,orphanedUpstream:o},i){for(let s of e)u.warn(`${re} ${s} is tracked but missing on disk \u2014 deletions are not supported by the WFS Sync API; the file is skipped. Restore it with \`webflow sites pull\`.`);for(let{oldPath:s,newPath:a}of t){let l=s.startsWith(`${i.pagesRoot}/`),c=l?`Webflow doesn't support renaming a page's file directly: restore ${s}, then rename or move the page in the Designer instead, push, then \`webflow sites pull\` to get the file moved automatically.`:`Webflow doesn't support renaming a component's file directly: restore ${s}, edit its \`name:\` meta in place instead, push, then \`webflow sites pull\` to get the file moved automatically.`;u.warn(`${re} ${a} looks like ${s} renamed locally \u2014 skipped, since its content is byte-for-byte unchanged. ${c} (If you also edited the content before this push, this warning won't catch it \u2014 rename first, push, THEN make content edits, or the push may create a duplicate ${l?"page":"component"} instead of updating the original.)`)}for(let s of o)u.warn(`${re} ${s} was deleted or renamed in the Designer, but still has local edits \u2014 skipped. Pushing it would re-create it. Merge anything you need elsewhere, then delete it.`);for(let s of r)u.warn(`${re} ${s} is a leftover copy of a file that now lives elsewhere \u2014 skipped. Pushing it would overwrite the current version with this stale content. Delete it, or merge anything you still need into the tracked file first.`);for(let s of n){let a=s.startsWith(`${i.pagesRoot}/`);u.warn(a?`${re} ${s} doesn't match a tracked page \u2014 creating a page via push isn't supported yet. Create it in the Designer, then \`webflow sites pull\`.`:`${re} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function t$(e){let t=Ou();if(t.kind==="missing")throw new f("No WFS sync state found (.webflow/wfs/). Run `webflow sites pull` first.",{isUserError:!0});if(t.kind==="corrupt")throw new f(`This project's sync state is unreadable (${t.reason}), so push can't tell which files are tracked. Run \`webflow sites pull\` to rebuild it (add --reset to discard it first).`,{isUserError:!0});if(t.corruptPaths.length>0)throw new f(`${t.corruptPaths.length} tracked file(s) have unreadable sync state (${t.corruptPaths.slice(0,3).join(", ")}${t.corruptPaths.length>3?", \u2026":""}). Pushing now would re-create them as new objects instead of updating them. Run \`webflow sites pull\` to rebuild the state first.`,{isUserError:!0});let n=t.lockfile;if(n.siteId!==void 0&&n.siteId!==e)throw new f(`This project's sync state was pulled from site ${n.siteId}, but push targets ${e}. Run \`webflow sites pull\` to sync against ${e} first (add --reset to discard the existing state).`,{isUserError:!0});return n}function n$(e,t,n,r){return JSON.stringify({dryRun:!0,siteId:e,changes:t.map(o=>({path:o.path,localPath:n[o.path]??o.path,isNew:o.baseHash===void 0})),...r.length>0?{blocked:r.map(o=>n[o]??o)}:{}},null,2)}function r$(e,t,n,r,o){let i=new Set(r),s=e.filter(a=>!i.has(a.path));u.info(`Would push ${s.length} file(s) to site ${o}:`);for(let a of s){let l=a.baseHash===void 0&&a.path.startsWith("site/components/")&&a.path.endsWith(".tsw")&&a.content!==void 0&&!zS(a.content),c=t.files[a.path]?.componentId,d=n[a.path]??a.path,p=l?R(" (new component \u2014 the platform will assign an id, tracked locally without changing this file)"):c?R(` (previously assigned id ${c} will be spliced in on push)`):a.baseHash?"":R(" (new)");u.info(` ${d}${p}`)}u.info("Dry run \u2014 no changes made.")}async function Uu(e={}){let t=ss(),n=t$(t.siteId),r=await yx(n,t.layout,void 0,e.force),{changes:o,localPaths:i}=r;if(e$(r,t.layout),o.length===0){u.info(e.json?JSON.stringify({schemaHash:n.schemaHash,results:[]},null,2):"No local changes to push.");return}let s=await T({apiToken:e.apiToken}),a=F.forSites({authToken:s}),l=Date.now(),c=HP(n,i);try{let{pushChanges:d,pathsWithNewNodes:p,pathsWithNewStyles:m,spliceFailures:h}=zP(o,n,i,t.layout);for(let E of h)u.warn(`${re} ${c(E)} no longer matches the shape its assigned component id can be spliced into \u2014 run \`webflow sites pull\` to restore the canonical module before pushing this file again.`);if(e.dryRun){e.json?u.info(n$(t.siteId,o,i,h)):r$(o,n,i,h,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let g=wx(d),{results:y,schemaHash:b,aborted:S}=await qP(s,t.siteId,g,e.force?"rebase":void 0,n.schemaHash),A=new Map(o.map(E=>[E.path,E])),{lockfile:v,created:x}=YP(n,t.siteId,b,A,i,y);Ka(v);let O=new Set(y.flatMap(E=>E.outcome==="committed"?Object.keys(E.hashes??{}):[])),H=new Set([...p].filter(E=>O.has(E))),B=new Set([...m].filter(E=>O.has(E)));if(H.size>0||B.size>0)try{Ka(await QP(s,t.siteId,y,H,B,v))}catch(E){u.warn(`${re} The push committed, but the follow-up fetch of newly created element/style ids failed (${E instanceof Error?E.message:String(E)}). Run \`webflow sites pull\` before pushing again \u2014 otherwise the new nodes are sent without ids and duplicated.`)}let ye=y.filter(E=>E.outcome==="conflict"),ve=y.filter(E=>E.outcome==="error"),me=y.filter(E=>E.outcome==="skipped"),Le=y.flatMap(E=>E.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:b,results:y},null,2));else{ZP(x,c);for(let U of y)u.info(VP(U,c));let E=y.filter(U=>U.outcome==="committed").length,z=x.length>0?` Created ${x.length} component(s) (ids tracked locally, not written to source).`:"";u.info(`Pushed ${o.length-h.length} file(s) across ${y.length} page group(s): ${E} committed, ${ye.length} conflicted, ${ve.length} failed, ${me.length} skipped.${z}`),S&&u.warn(`${re} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(ye.length>0||ve.length>0||me.length>0||Le.length>0||h.length>0)throw new f(`${re} Push finished with ${ye.length} conflict(s), ${ve.length} error(s), ${me.length} skipped page(s), ${Le.length} rejected file(s), ${h.length} file(s) that could not be sent. Resolve the issues above and try again.`,{isUserError:!0,skipLogging:!!e.json});await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,createdComponents:x.length,dryRun:!1})}catch(d){throw await a.sendError(d instanceof Error?d:new Error(String(d)),"site_push",{duration:Date.now()-l}),d instanceof f?d:new f(d,{prefix:`${k} Failed to push site files:`})}}var No=require("fs"),Dx=require("module"),Lo=require("path");q();pe();C();_();M();X();function o$(e,t,n,r){let o=n.get(e.path);if(o)return px(o,t);let i=mx(e.path,t);if(i)return i;let s=r?.files[e.path]?.localPath;return Jg(e.path,t,s)??e.path}function i$(e,t,n){if(!Array.isArray(e)||e.length===0)return;let r=(0,Dx.createRequire)((0,Lo.join)(t,"package.json")),o=[];for(let i of e){if(typeof i!="string"){o.push(i);continue}try{o.push(r.resolve(i))}catch{u.debug(`Prettier plugin "${i}" from this project's config could not be resolved; formatting ${n} without it.`)}}return o}async function s$(e,t){try{let{format:n,resolveConfig:r}=await import("prettier"),o=await r(t,{editorconfig:!0}),i=i$(o?.plugins,process.cwd(),t);return await n(e,{...o,...i?{plugins:i}:{},filepath:t,parser:"babel-ts"})}catch(n){return u.debug(`Prettier could not format ${t}, writing it unformatted: ${n instanceof Error?n.message:String(n)}`),e}}function a$(e,t){if(t){cx();return}let n=Ou();if(n.kind==="missing")return;if(n.kind==="corrupt")throw new f(`This project's sync state is unreadable (${n.reason}), so a pull can't tell which local files have changed since the last sync. Restore ${Br}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});if(n.corruptPaths.length>0)throw new f(`${n.corruptPaths.length} tracked file(s) have unreadable sync state (${n.corruptPaths.slice(0,3).join(", ")}${n.corruptPaths.length>3?", \u2026":""}), so a pull can't tell whether their local copies changed. Restore ${Br}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});let r=n.lockfile;if(r?.siteId!==void 0&&r.siteId!==e&&Object.keys(r.files).length>0)throw new f(`This project's sync state was pulled from site ${r.siteId}, but this pull targets ${e}. Pulling a second site into the same project would leave \`webflow sites push\` (which always targets the site in webflow.json) applying it to the wrong one. Re-run with --reset to discard the existing state and pull ${e} from scratch.`,{isUserError:!0});return r}async function Wu(e={}){let t=ss(e.siteId),n=a$(t.siteId,!!e.reset),r=await T({apiToken:e.apiToken}),o=F.forSites({authToken:r}),i=Date.now();try{let s=await Ja(r,t.siteId,{manifestOnly:!0});if(s.useTsw===!1)throw new f("This site is served as a WFDL projection, which `webflow sites pull` doesn't support \u2014 it reads and writes `.tsw` modules. No files were written.",{isUserError:!0});let a=s.pages.map(E=>E.pageId);if(a.length===0){await o.sendUsage("site_pull",{duration:Date.now()-i,count:0}),u.info(e.json?JSON.stringify({schemaHash:s.schemaHash,pages:[],files:[]},null,2):"The site has no static pages to pull.");return}let l=new Map,c=s.schemaHash,d={},p=[];for(let E of Nu(a)){let z=await Ja(r,t.siteId,{pageIds:E});c=z.schemaHash,d=z.componentIds??d,z.warnings&&p.push(...z.warnings);for(let U of z.files)l.set(U.path,U)}let m=[...l.values()].sort((E,z)=>E.path.localeCompare(z.path)),h=new Map(s.pages.map(E=>[E.path,E])),g=new Map;for(let E of m){let z=n?.files[E.path];if(!z)continue;let U=z.localPath??E.path,ge=ju(U),lr=ge!==void 0&&pn(ge)!==z.contentSha256,cr=E.hash!==z.serverHash;lr&&cr&&g.set(E.path,U)}let y=!e.force,b=[...g.values()],S=process.cwd(),A=new Map(m.map(E=>[E.path,o$(E,t.layout,h,n)])),v=new Map;for(let[E,z]of A)v.set(z,[...v.get(z)??[],E]);let x=[...v.entries()].filter(([,E])=>E.length>1);if(x.length>0){let E=x.map(([z,U])=>`${z} \u2190 ${U.join(", ")}`).join("; ");throw new f(`Two or more files resolve to the same local path, so pulling would overwrite one with the other: ${E}. This usually means pages share a slug across Designer Page Folders without distinct folder segments. No files were written.`,{isUserError:!0})}let O={siteId:t.siteId,schemaHash:c,files:{}},H=new Set(A.values()),B=[],ye=[],ve=[],me=[];for(let E of m){let z=n?.files[E.path];if(y&&g.has(E.path)){z&&(O.files[E.path]=z);continue}let U=A.get(E.path);ux(U);let ge=(0,Lo.join)(S,U);(0,No.mkdirSync)((0,Lo.dirname)(ge),{recursive:!0});let lr=U.endsWith(".tsw")?Bu(E.content,Mu(E.path),U,ii=>A.get(ii)??Jg(ii,t.layout,n?.files[ii]?.localPath)):E.content,{sugared:cr,entries:x_}=Pu(lr),{sugared:hy,entries:yy}=$u(cr),Ud=U.endsWith(".tsw")?await s$(hy,ge):hy;(0,No.writeFileSync)(ge,Ud,"utf8");let wy=Bg(Ud,x_);B.push(E);let zr=z?z.localPath??E.path:void 0;if(z&&zr&&zr!==U&&!H.has(zr)){let ii=ju(zr);ii===void 0||(pn(ii)===z.contentSha256?((0,No.rmSync)((0,Lo.join)(S,zr),{force:!0}),ye.push({from:zr,to:U})):ve.push({from:zr,to:U}))}let Dy=d[E.path],Cl=h.get(E.path);O.files[E.path]={serverHash:E.hash,contentSha256:pn(Ud),localPath:U,...Dy?{componentId:Dy}:{},...wy.length>0?{nodeIds:wy}:{},...yy.length>0?{styleIds:yy}:{},...Cl?{slug:Cl.slug,isDefault:Cl.isDefault,folderSegments:Cl.folderSegments}:{}}}let Le=new Set(m.map(E=>E.path));for(let[E,z]of Object.entries(n?.files??{})){if(Le.has(E))continue;let U=z.localPath??E;if(H.has(U))continue;let ge=ju(U);ge!==void 0&&(pn(ge)===z.contentSha256?((0,No.rmSync)((0,Lo.join)(S,U),{force:!0}),me.push(U)):(ve.push({from:U,to:"(no longer on the site)"}),O.files[E]={...z,deletedUpstream:!0}))}if(Ka(O),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:E,slug:z,title:U,path:ge,folderSegments:lr})=>({pageId:E,slug:z,title:U,path:ge,folderSegments:lr})),files:B.map(E=>({path:E.path,hash:E.hash,size:E.size,localPath:O.files[E.path]?.localPath})),...y&&b.length>0?{skipped:b}:{},...me.length>0?{removed:me}:{},...ye.length>0?{relocated:ye}:{},...ve.length>0?{orphaned:ve}:{}},null,2));else{for(let E of B){let z=h.get(E.path),U=O.files[E.path]?.localPath??E.path,ge=z?R(` (page, slug: "${z.slug}")`):"";u.info(`${$} ${U}${ge}`)}u.info(`Pulled ${B.length} file(s) across ${a.length} page(s).`);for(let E of me)u.info(R(` removed ${E} (no longer on the site)`));for(let{from:E,to:z}of ye)u.info(R(` moved ${E} \u2192 ${z}`))}for(let E of b)u.warn(y?`${re} ${E} changed both locally and in the Designer since the last sync \u2014 left as-is, so your local edit is intact. Commit or move it, then pull again (or pull with --force to take the Designer's version).`:`${re} ${E} changed both locally and in the Designer since the last sync \u2014 the local edit was overwritten by --force; recover it from git if needed.`);for(let{from:E,to:z}of ve)u.warn(`${re} ${E} is now at ${z}, but the old file has local edits so it was left in place. \`sites push\` will skip it \u2014 merge anything you still need into ${z} and delete ${E}, since while it's there the two copies disagree.`);for(let{path:E,reason:z}of p){let U=O.files[E]?.localPath??E;u.warn(`${re} ${U}: ${z}`)}await o.sendUsage("site_pull",{duration:Date.now()-i,count:B.length,skipped:y?b.length:0})}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"site_pull",{duration:Date.now()-i}),s instanceof f?s:new f(s,{prefix:`${k} Failed to pull site files:`})}}Wn();var bx=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(oe()).addOption(He(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Rg),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(oe()).action(Tg),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(oe()).action(Pg),t.command("publish").description("Publish a Webflow site (defaults to Webflow subdomain)").requiredOption("--site <siteId>","Site ID to publish").option("--domains <domains>","Comma-separated custom domain IDs to publish to").option("--page <pageId>","Publish a single page instead of the whole site").addOption(Pe()).addOption(oe()).action($g),tt()&&(t.command("init").description("Bind this project to an existing Webflow site or create a new one, saving its ID as `siteId` in webflow.json.").addOption(Kn()).option("--site-id <siteId>","Skip the interactive picker and bind to this site ID (CI/scripted setup).").option("--create","Create a new Webflow site instead of binding.").option("--name <name>","Name for the new site (implies --create; skips the prompt).").action(Ru),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(Kn()).addOption(Pe()).addOption(oe()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(Uu),t.command("pull").description("Pull your Webflow Site's source files. Files edited both locally and in the Designer are left alone unless --force.").addOption(Kn()).addOption(oe()).option("--site-id <siteId>","Pull from this site only, bypassing (and not modifying) the siteId in webflow.json. Needs --reset when the project is already synced with another site.").option("--force","Overwrite local files that changed both here and in the Designer since the last sync.").option("--reset","Discard the existing local sync state and pull from scratch.").action(Wu))};q();C();_();M();X();be();async function kx(e,t){return Z(t,"siteId"),Ua(`${P}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function Ex(e,t,n){return Z(t,"siteId"),Z(n,"formId"),Ua(`${P}/v2/sites/${t}/forms/${n}/submissions`,e,"formSubmissions","Failed to list submissions")}C();pe();var zg=["id","displayName","name","slug","createdOn","lastUpdated"],vx=ut(zg);function Sx(){return zg}function xx(e,t=["id","displayName","slug"]){if(e.length===0)return R("No forms found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${zg.join(", ")}`,{isUserError:!0});let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>{let s=o[i];return s?i==="createdOn"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:R("\u2014")}));return ze(n,r)}function Cx(e){if(e.length===0)return R("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),n=["id","dateSubmitted",...t].map(o=>se(o)),r=e.map(o=>[o.id,new Date(o.dateSubmitted).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),...t.map(i=>{let s=o.formResponse[i];return s==null?R("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return ze(n,r)}function Fx(e){if(e.length===0)return"";let n=["id","formId","displayName","dateSubmitted",...Array.from(new Set(e.flatMap(i=>Object.keys(i.formResponse))))],r=i=>{let s=i==null?"":typeof i=="object"?JSON.stringify(i):String(i);return s.includes(",")||s.includes('"')||s.includes(`
216
+ `)?`"${s.replace(/"/g,'""')}"`:s};return[n.join(","),...e.map(i=>n.map(s=>r(s==="id"?i.id:s==="formId"?i.formId:s==="displayName"?i.displayName:s==="dateSubmitted"?i.dateSubmitted:i.formResponse[s])).join(","))].join(`
217
+ `)}async function qg(e){Z(e.site,"siteId");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await kx(t,e.site);if(await n.sendUsage("forms_list",{duration:Date.now()-r,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No forms found.");return}let i=Ce(e.fields,vx,Sx());u.info(xx(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list forms:`}))}}var _x=w(require("fs"));q();C();_();M();X();async function Xg(e){Z(e.site,"siteId"),Z(e.form,"formId"),e.output&&e.json&&u.warn("--json is ignored when --output is set.");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await Ex(t,e.site,e.form);if(await n.sendUsage("forms_submissions",{duration:Date.now()-r,count:o.length}),o.length===0){u.info("No submissions found.");return}if(e.output){let i=Fx(o);_x.default.writeFileSync(e.output,i,"utf8"),u.info(`${$} ${o.length} submission${o.length===1?"":"s"} written to ${e.output}`);return}if(e.json){u.info(JSON.stringify(o,null,2));return}u.info(Cx(o))}catch(o){throw await n.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to fetch submissions:`})}}var Ax=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(It()).addOption(oe()).addOption(He(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(qg),t.command("submissions").description("List or export form submissions").requiredOption("--site <siteId>","Site ID").requiredOption("--form <formId>","Form ID").option("--json","Output as JSON").option("--output <file>","Save submissions as CSV to a file").action(Xg)};var mh=w(require("fs")),gh=w(require("path"));_();var Bo=w(require("fs")),Mo=w(require("path")),Gu=w(require("tar"));C();_();var Zg=w(require("fs")),Wr=w(require("path"));C();var l$=[/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,/\x1b[P^_][\s\S]*?\x1b\\/g,/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g,/\x1b[\x20-\x7e]/g,/[\x80-\x9f]/g,/[\x00-\x08\x0b-\x1f\x7f]/g,/[\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/g],c$=/[\r\n\u2028\u2029]+/g;function Yg(e){if(e==null)return"";let t=String(e);for(let n of l$)t=t.replace(n,"");return t}function D(e){return Yg(e).replace(c$," ").trim()}var Ix={impl:Wr.default.posix,caseInsensitive:!1},Qg={impl:Wr.default.win32,caseInsensitive:!0};function jo(){let e=process.platform;return e==="win32"?Qg:{impl:Wr.default.posix,caseInsensitive:e==="darwin"}}function Hu(e,t){let n=t.impl.resolve(e);return t.caseInsensitive?n.toLowerCase():n}function Hr(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function rt(e,t,n=jo()){if(Hr(e)||Hr(t))return!1;let r=Hu(e,n),o=Hu(t,n);if(r===o)return!0;let i=n.impl.relative(r,o);return i===""?!0:n.impl.isAbsolute(i)?!1:!i.split(/[\\/]/).some(s=>s===".."||s==="")}async function Vu(e,t,n=jo()){if(Hr(e)||Hr(t))return!1;let[r,o]=await Promise.all([fn(e),fn(t)]);return rt(r,o,n)}function Be(e,t,n,r=jo()){if(!rt(e,t,r))throw new f(`Refusing to continue: ${n} resolves outside the directory it must stay inside.
218
+ expected inside: ${D(e)}
219
+ resolved to: ${D(t)}
220
+ Please report this.`)}async function ls(e,t,n,r=jo()){if(!await Vu(e,t,r))throw new f(`Refusing to continue: ${n} resolves outside the directory it must stay inside once symlinks are followed.
221
+ expected inside: ${D(e)}
222
+ resolved to: ${D(t)}
223
+ Please report this.`)}function u$(e,t,n=jo()){return rt(e,t,n)||rt(t,e,n)}async function eh(e,t,n=jo()){if(Hr(e)||Hr(t))return!1;let[r,o]=await Promise.all([fn(e),fn(t)]);return u$(r,o,n)}function qe(e,t,n=jo()){return typeof e!="string"||typeof t!="string"||Hr(e)||Hr(t)?!1:Hu(e,n)===Hu(t,n)}async function fn(e){let t=Wr.default.resolve(e);try{return await Zg.default.promises.realpath(t)}catch{}try{let n=await Zg.default.promises.realpath(Wr.default.dirname(t));return Wr.default.join(n,Wr.default.basename(t))}catch{return t}}var d$=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function cs(e){if(!e)return"empty entry path";if(e.includes("\0"))return"NUL byte in entry path";if(/[\x01-\x1f\x7f]/.test(e))return"control character in entry path";if(e.startsWith("/")||e.startsWith("\\"))return"absolute entry path";if(/^[A-Za-z]:/.test(e))return"Windows drive-relative entry path";if(e.includes("\\"))return"backslash in entry path";for(let t of e.split("/")){if(t===""||t==="."){if(t===".")return'traversal segment "." in entry path';continue}if(t==="..")return'traversal segment ".." in entry path';if(/[. ]$/.test(t))return"entry path segment ends with a dot or space";if(d$.test(t))return"Windows reserved device name in entry path"}return null}var rh=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),p$=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),f$=32,m$=512,th=10,Px=100,Rx=100;function $x(){return{retained:[],fatal:[],fatalCount:0,count:0}}function Ox(e,t,n){e.count+=1;let r={code:t,message:Yg(n)};e.retained.length<Rx&&e.retained.push(r),p$.has(t)&&(e.fatalCount+=1,e.fatal.length<Rx&&e.fatal.push(r))}async function Lx(e,t,n){let r=await g$(n.containmentRoot),o=await h$(r,t),i=await Tx(e),s=await w$(e,n),a=await b$(e,o,n);if(a.warnings.fatal.length>0)throw Wx(a.warnings.fatal,a.warnings.fatalCount);for(let c of a.warnings.retained)u.debug(`tar warning ${c.code}: ${c.message}`);if(a.refused.length>0)throw v$(a.refused,a.refusedCount);let l=await Tx(e);if(i!==l)throw new f("Refusing to continue: the downloaded archive changed while it was being read, so what was validated is not what was extracted. Nothing about the extracted directory can be trusted. Please retry.");return await k$(r,o),{skipped:s.skipped,fileCount:a.fileCount,unpackedBytes:a.unpackedBytes,warnings:[...s.warnings.retained,...a.warnings.retained],warningCount:s.warnings.count+a.warnings.count}}async function Tx(e){try{let t=await Bo.default.promises.stat(e);return[t.dev,t.ino,t.size,t.mtimeMs,t.ctimeMs].join(":")}catch(t){throw new f(`Could not read the downloaded archive: ${t instanceof Error?t.message:String(t)}`)}}async function g$(e){try{return await Bo.default.promises.realpath(Mo.default.resolve(e))}catch(t){throw new f(`Refusing to extract: the directory the extraction must stay inside ("${D(e)}") could not be resolved: ${t instanceof Error?t.message:String(t)}`)}}async function h$(e,t){let n=Mo.default.resolve(t);Be(e,n,"the extraction directory");let o=Mo.default.relative(e,n).split(Mo.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Mo.default.join(i,s);let a=await y$(i);if(a===null){await Bo.default.promises.mkdir(i);continue}if(a.isSymbolicLink())throw new f(`Refusing to extract: "${D(i)}" is a symbolic link, and extracting into it would write the archive somewhere other than where it was checked. Remove or replace it with a real directory and retry.`);if(!a.isDirectory())throw new f(`Refusing to extract: "${D(i)}" exists and is not a directory.`)}return n}async function y$(e){try{return await Bo.default.promises.lstat(e)}catch(t){if(t.code==="ENOENT")return null;throw new f(`Could not inspect "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function w$(e,t){let n=Nx(t.limits),r=Bx(t.consumedSubtrees),o=[],i=[],s=$x(),a=0,l=0,c=0,d=!1,p=!1,m=(h,g)=>{c+=1,o.length<Px&&o.push({entryPath:h,reason:g})};try{await Gu.list({file:e,onReadEntry:h=>{let g=h.path,y=h.type;if(jx(y)||(a+=1,a>n.maxFiles&&!d&&(d=!0,m(g,`archive has more than ${n.maxFiles} files`))),!rh.has(y)){let A=`unsupported entry type ${y}`;r(g)?m(g,A):d||i.push({entryPath:g,reason:A});return}let b=cs(g)??Mx(g,n);if(b){m(g,b);return}let S=h.size;S>n.maxEntryBytes&&m(g,`entry is ${us(S)}, over the ${us(n.maxEntryBytes)} per-file cap`),l+=S,l>n.maxUnpackedBytes&&!p&&(p=!0,m(g,`unpacked total passes the ${us(n.maxUnpackedBytes)} cap`))},onwarn:(h,g)=>{Ox(s,h,g)}})}catch(h){throw h instanceof f?h:new f(`Could not read the downloaded archive: ${h instanceof Error?h.message:String(h)}`)}if(o.length>0)throw E$(o,c);if(s.fatal.length>0)throw Wx(s.fatal,s.fatalCount);for(let h of i)u.debug(`Skipped archive entry "${D(h.entryPath)}": ${h.reason}`);return{skipped:i,warnings:s}}function D$(e,t,n,r){if(!rh.has(t))return`unsupported entry type ${t}`;let o=cs(e)??Mx(e,r);return o||(n>r.maxEntryBytes?`entry is ${us(n)}, over the ${us(r.maxEntryBytes)} per-file cap`:null)}async function b$(e,t,n){let r=Nx(n.limits),o=Bx(n.consumedSubtrees),i=$x(),s=[],a=0,l=0,c=0,d=(h,g)=>(a+=1,s.length<Px&&s.push({entryPath:h,reason:g}),!1),p=()=>!1,m=(h,g)=>{let y="type"in g?g.type:g.isDirectory()?"Directory":"File",b=g.size;if(!rh.has(y)&&!o(h))return p();let S=D$(h,y,b,r);if(S)return d(h,S);if(c+b>r.maxUnpackedBytes)return d(h,`unpacked total passes the ${us(r.maxUnpackedBytes)} cap`);if(!jx(y)){if(l+1>r.maxFiles)return d(h,`archive has more than ${r.maxFiles} files`);l+=1}return c+=b,!0};try{await Gu.extract({file:e,cwd:t,strip:n.strip??0,preservePaths:!1,filter:m,onwarn:(h,g)=>{Ox(i,h,g)}})}catch(h){throw h instanceof f?h:new f(`Could not extract the downloaded archive: ${h instanceof Error?h.message:String(h)}`)}return{warnings:i,fileCount:l,unpackedBytes:c,refused:s,refusedCount:a}}async function k$(e,t){Be(e,await Bo.default.promises.realpath(t),"the extracted directory");let n=[t];for(;n.length>0;){let r=n.pop(),o=await Bo.default.promises.readdir(r,{withFileTypes:!0});for(let i of o){let s=Mo.default.join(r,i.name);if(!i.isFile()&&!i.isDirectory())throw new f(`Refusing to continue: extraction produced a non-regular entry at "${D(s)}". Please report this.`);Be(e,s,"an extracted archive entry"),i.isDirectory()&&n.push(s)}}}function Nx(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??f$,maxPathLength:e.maxPathLength??m$}}function jx(e){return e==="Directory"||e==="GNUDumpDir"}function nh(e){return e.replace(/\/+$/,"")}function Mx(e,t){let n=nh(e);if(n.length>t.maxPathLength)return`entry path is ${n.length} characters, over the ${t.maxPathLength}-character limit`;let r=n.split("/").filter(o=>o!=="").length;return r>t.maxPathDepth?`entry path is ${r} levels deep, over the ${t.maxPathDepth}-level limit`:null}function Bx(e){let t=e.map(nh);return n=>{let r=nh(n).split("/").slice(1).join("/");return t.some(o=>r===o||r.startsWith(`${o}/`))}}function us(e){if(e<1024)return`${e} B`;let t=["KiB","MiB","GiB"],n=e/1024,r=t[0];for(let o=1;o<t.length&&n>=1024;o+=1)n/=1024,r=t[o];return`${parseFloat(n.toFixed(1))} ${r}`}function E$(e,t){return new f(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
224
+ ${Ux(e,t).join(`
213
225
  `)}
214
- Nothing was extracted. Please report this.`)}function FR(e,t){return new f(`Refusing to continue: the downloaded archive changed while it was being read. ${t} ${t===1?"entry":"entries"} that passed validation would not have passed it on the second read.
215
- ${Hv(e,t).join(`
226
+ Nothing was extracted. Please report this.`)}function v$(e,t){return new f(`Refusing to continue: the downloaded archive changed while it was being read. ${t} ${t===1?"entry":"entries"} that passed validation would not have passed it on the second read.
227
+ ${Ux(e,t).join(`
216
228
  `)}
217
- The extracted directory cannot be trusted. Please retry.`)}function Hv(e,t){let r=e.slice(0,Jm),n=r.map(i=>` - "${y(i.entryPath)}": ${i.reason}`),o=t-r.length;return o>0&&n.push(` \u2026 and ${o} more.`),n}function Vv(e,t){let r=e.slice(0,Jm).map(o=>` - ${o.code}: ${o.message}`),n=t-Math.min(e.length,Jm);return n>0&&r.push(` \u2026 and ${n} more.`),new f(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
218
- ${r.join(`
229
+ The extracted directory cannot be trusted. Please retry.`)}function Ux(e,t){let n=e.slice(0,th),r=n.map(i=>` - "${D(i.entryPath)}": ${i.reason}`),o=t-n.length;return o>0&&r.push(` \u2026 and ${o} more.`),r}function Wx(e,t){let n=e.slice(0,th).map(o=>` - ${o.code}: ${o.message}`),r=t-Math.min(e.length,th);return r>0&&n.push(` \u2026 and ${r} more.`),new f(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
230
+ ${n.join(`
219
231
  `)}
220
- This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var AR="webflow",Xm="webflow-skills",ue=`${AR}/${Xm}`,je="main",Zc=`plugins/${Xm}`,Gr=`${Zc}/.claude-plugin/plugin.json`,Zm=[`${Zc}/skills`,"skills"],Gv=[`${Zc}/skills`,`${Zc}/.claude-plugin`];function Kv(e){return`${Xm}-${e}`}var zt=/^[0-9a-f]{40}$/,Qc=/^[A-Za-z0-9._/-]{1,255}$/,TR=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function zv(e){let t=e.split(":",1)[0];return TR.includes(t)}var Tt="https://api.github.com",wo="https://codeload.github.com";var Jv="skills",eu="download-",tu="extract-";var zr=D(require("fs")),ou=D(require("path"));ml();S();x();S();function Yv(e){let t=r=>Math.round(r*10)/10;return e>=1024*1024?`${t(e/(1024*1024))} MiB`:e>=1024?`${t(e/1024)} KiB`:`${e} bytes`}function sr(e){try{return new URL(e).hostname}catch{return e}}function RR(e){return new f(`Could not find ref "${y(e)}" in ${ue}.
221
- \u2022 The default branch is "${je}".
232
+ This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var S$="webflow",oh="webflow-skills",he=`${S$}/${oh}`,Ge="main",Ju=`plugins/${oh}`,or=`${Ju}/.claude-plugin/plugin.json`,ih=[`${Ju}/skills`,"skills"],Hx=[`${Ju}/skills`,`${Ju}/.claude-plugin`];function Vx(e){return`${oh}-${e}`}var Yt=/^[0-9a-f]{40}$/,Ku=/^[A-Za-z0-9._/-]{1,255}$/,x$=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function Gx(e){let t=e.split(":",1)[0];return x$.includes(t)}var Pt="https://api.github.com",Uo="https://codeload.github.com";var Jx="skills",zu="download-",qu="extract-";var sr=w(require("fs")),Zu=w(require("path"));ql();C();_();C();function zx(e){let t=n=>Math.round(n*10)/10;return e>=1024*1024?`${t(e/(1024*1024))} MiB`:e>=1024?`${t(e/1024)} KiB`:`${e} bytes`}function mn(e){try{return new URL(e).hostname}catch{return e}}function C$(e){return new f(`Could not find ref "${D(e)}" in ${he}.
233
+ \u2022 The default branch is "${Ge}".
222
234
  \u2022 This repo has no tags or releases yet, so "--ref v1.0.7" will not resolve.
223
- \u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function IR(e){if(!e)return"a few minutes";let t=Number(e);if(!Number.isFinite(t)||t<=0)return"a few minutes";let r=new Date(t*1e3);if(Number.isNaN(r.getTime()))return"a few minutes";let n=String(r.getHours()).padStart(2,"0"),o=String(r.getMinutes()).padStart(2,"0");return`${n}:${o} local time`}function OR(e){return new f(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
224
- \u2022 Retry after ${IR(e)}.
235
+ \u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function F$(e){if(!e)return"a few minutes";let t=Number(e);if(!Number.isFinite(t)||t<=0)return"a few minutes";let n=new Date(t*1e3);if(Number.isNaN(n.getTime()))return"a few minutes";let r=String(n.getHours()).padStart(2,"0"),o=String(n.getMinutes()).padStart(2,"0");return`${r}:${o} local time`}function _$(e){return new f(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
236
+ \u2022 Retry after ${F$(e)}.
225
237
  \u2022 Or set GITHUB_TOKEN / GH_TOKEN in your environment to raise the limit to 5,000/hour.
226
- \u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function PR(){return new f(`GitHub refused the request (403). This is a permission error, not a rate limit.
227
- \u2022 If you are behind a proxy that filters ${sr(Tt)}, set HTTPS_PROXY.
228
- \u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function $R(e,t){return new f(`${sr(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function LR(e,t,r){return new f(`${sr(e)} returned an unexpected ${t} ${y(r)} response. Please report this if it persists.`)}function Pi(e,t,r){let{status:n}=t;if(n===404)return RR(r??je);let o=t.headers.get("x-ratelimit-remaining");return n===429||n===403&&o==="0"?OR(t.headers.get("x-ratelimit-reset")):n===403?PR():n>=500?$R(e,n):LR(e,n,t.statusText)}function Xv(e){let t=e?sr(e):"an unnamed host";return new f(`Refusing to follow a redirect to ${y(t)} while a GitHub token is attached, because the token would be re-sent to that host. Unset GITHUB_TOKEN / GH_TOKEN to retry unauthenticated, or report this if ${sr(Tt)} is genuinely redirecting.`,{isUserError:!0})}function qv(e,t){return new f(`Could not reach ${sr(e)}${t?` (${t})`:""}.
238
+ \u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function A$(){return new f(`GitHub refused the request (403). This is a permission error, not a rate limit.
239
+ \u2022 If you are behind a proxy that filters ${mn(Pt)}, set HTTPS_PROXY.
240
+ \u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function I$(e,t){return new f(`${mn(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function R$(e,t,n){return new f(`${mn(e)} returned an unexpected ${t} ${D(n)} response. Please report this if it persists.`)}function ds(e,t,n){let{status:r}=t;if(r===404)return C$(n??Ge);let o=t.headers.get("x-ratelimit-remaining");return r===429||r===403&&o==="0"?_$(t.headers.get("x-ratelimit-reset")):r===403?A$():r>=500?I$(e,r):R$(e,r,t.statusText)}function qx(e){let t=e?mn(e):"an unnamed host";return new f(`Refusing to follow a redirect to ${D(t)} while a GitHub token is attached, because the token would be re-sent to that host. Unset GITHUB_TOKEN / GH_TOKEN to retry unauthenticated, or report this if ${mn(Pt)} is genuinely redirecting.`,{isUserError:!0})}function Kx(e,t){return new f(`Could not reach ${mn(e)}${t?` (${t})`:""}.
229
241
  \u2022 Check your network connection.
230
242
  \u2022 Behind a corporate proxy, set HTTPS_PROXY. Note that the CLI's HTTP client does not read proxy environment variables automatically.
231
- \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function ru(e,t){return new f(`Timed out after ${Math.round(t/1e3)}s waiting for ${sr(e)}.
243
+ \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Xu(e,t){return new f(`Timed out after ${Math.round(t/1e3)}s waiting for ${mn(e)}.
232
244
  \u2022 Check your network connection, then retry.
233
245
  \u2022 Behind a corporate proxy, set HTTPS_PROXY.
234
- \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function nu(){return new f(`The skills catalog download exceeded ${Yv(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function Zv(e){return new f(`Commit ${y(e)} of ${ue} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
235
- \u2022 Retry without --ref to take the current "${je}".`,{isUserError:!0})}function Qv(){return new f("The skills catalog download returned no response body. Please retry.")}function fa(e){return new f(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function eS(){return new f(`${sr(Tt)} answered the ref lookup with something that is not a 40-character commit SHA. Refusing to guess at what to install. Please report this if it persists.`)}function tS(){return new f(`${sr(Tt)} answered the ref lookup with more than ${Yv(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
236
- \u2022 If a proxy is intercepting ${sr(Tt)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function $i(e){return new f(`Expected a full 40-character commit SHA but got "${y(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function Kr(e,t){return new f(`Invalid --ref "${y(e)}": ${t}.
237
- \u2022 Pass a branch name (e.g. "${je}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function rS(e,t){let r=t.length===0?"nothing":t.map(n=>`"${y(n)}"`).join(", ");return new f(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${r}. Please report this.`)}var NR=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function jR(e){if(typeof e!="object"||e===null)return;let t=e;if(typeof t.code=="string")return t.code;if(typeof t.errno=="string")return t.errno}function ga(e,t,r){if(r instanceof f)return r;let n=jR(r);if(n==="ENOSPC"||n==="EDQUOT"||n==="EFBIG")return fa("writing the skills catalog");if(n&&NR.has(n))return qv(e,n);let o=r?.type;if(o==="request-timeout")return ru(e,t);if(o==="max-size")return nu();let i=r instanceof Error?r.message:String(r);return/network timeout|timed? ?out/i.test(i)?ru(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?qv(e,""):new f(`Could not fetch the skills catalog from ${sr(e)}: ${y(i)}`)}function Li(){return ou.default.join(tw(),Jv)}function eg(e){if(!zt.test(e))throw $i(e);return ou.default.join(Li(),e)}async function ha(){let e=Li();try{return await zr.default.promises.mkdir(e,{recursive:!0,mode:448}),await zr.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?fa("creating the skills cache directory"):new f(`Could not create the skills cache directory "${y(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function tg(e){let t=eg(e),r;try{r=await zr.default.promises.lstat(t)}catch(n){return n.code==="ENOENT"||u.debug(`Could not inspect skills cache entry: ${n instanceof Error?n.message:String(n)}`),null}if(r.isSymbolicLink())throw new f(`Refusing to use the skills cache: "${y(t)}" is a symbolic link, so reading it would install whatever it points at. Remove it and retry.`);return r.isDirectory()?t:(u.debug(`Skills cache entry for ${e} is not a directory; treating as a miss.`),null)}var BR=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function UR(e){try{return(await zr.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function rg(e,t){let r=eg(e),n=Li();await Ri(n,r,"the skills cache entry"),await Ri(n,t,"the extracted skills catalog being published");try{return await zr.default.promises.rename(t,r),{dir:r,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw fa("publishing the skills catalog to the cache");if(i!==void 0&&BR.has(i)&&await UR(r))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:r,published:!1};throw new f(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function Do(e){await Ri(Li(),e,"the skills cache path being removed");try{await zr.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${y(e)}": ${t instanceof Error?t.message:String(t)}`)}}function WR(e){return zt.test(e)||e.startsWith(eu)||e.startsWith(tu)}async function iu(e){let t=Li(),r;try{r=await zr.default.promises.readdir(t,{withFileTypes:!0})}catch(o){o.code!=="ENOENT"&&u.debug(`Skills cache sweep skipped: ${o instanceof Error?o.message:String(o)}`);return}let n=Date.now()-6048e5;for(let o of r){if(o.name===e||!WR(o.name))continue;let i=ou.default.join(t,o.name);try{if((await zr.default.promises.lstat(i)).mtimeMs>=n)continue;await Do(i),u.debug(`Swept stale skills cache entry "${o.name}".`)}catch(s){u.debug(`Skills cache sweep could not handle "${o.name}": ${s instanceof Error?s.message:String(s)}`)}}}var ig=D(require("fs")),ng=D(require("path")),iS=require("stream"),sS=require("stream/promises");dt();x();var HR="catalog.tar.gz",ya=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},su=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},og=class extends iS.Transform{constructor(r){super();this.cap=r}bytes=0;_transform(r,n,o){let i=Buffer.isBuffer(r)?r:Buffer.from(r);if(this.bytes+=i.length,this.bytes>this.cap){o(new su);return}o(null,i)}};async function sg(e){if(!zt.test(e))throw $i(e);let t=await ha(),r=await ig.default.promises.mkdtemp(ng.default.join(t,eu)),n=ng.default.join(r,HR),o=`${wo}/${ue}/tar.gz/${e}`;try{let i=await VR(o,e),s=await GR(i,n);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:n,downloadDir:r,bytes:s}}catch(i){throw await Do(r),ga(wo,6e4,i)}}async function VR(e,t){let r=0;for(let n=0;n<2;n+=1){let o=await G(e,{headers:{Accept:"application/x-gzip"},timeout:6e4});if(o.ok){let i=Number(o.headers.get("content-length"));if(Number.isFinite(i)&&i>33554432)throw nu();return o}if(o.status>=500&&n===0){r=o.status,u.debug(`codeload.github.com returned ${o.status}; retrying once in ${1e3}ms.`),await new Promise(i=>{setTimeout(i,1e3)});continue}throw o.status===404?Zv(t):Pi(wo,o)}throw Pi(wo,{status:r||500,statusText:"Server Error",headers:{get:()=>null}})}async function GR(e,t){let r=e.body;if(!r)throw Qv();let n=new og(33554432),o=setTimeout(()=>{r.destroy?.(new ya),n.destroy(new ya)},6e4);o.unref?.();try{await(0,sS.pipeline)(r,n,ig.default.createWriteStream(t,{mode:384}))}catch(i){throw oS(i,su)?nu():oS(i,ya)?ru(wo,6e4):i}finally{clearTimeout(o)}return n.bytes}function oS(e,t){if(e instanceof t)return!0;if(e instanceof Error){if(e.name===t.name)return!0;let r=e.cause;if(r instanceof t||r instanceof Error&&r.name===t.name)return!0}return!1}dt();x();var KR=["GITHUB_TOKEN","GH_TOKEN"];function zR(){for(let e of KR){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function JR(e){if(e==="")throw Kr(e,"it is empty");if(!Qc.test(e))throw Kr(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw Kr(e,"it starts with '-'");if(e.includes(".."))throw Kr(e,"it contains '..'");if(e.endsWith(".lock"))throw Kr(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw Kr(e,"it starts or ends with '/'");if(e.includes("//"))throw Kr(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw Kr(e,"a path component ends with '.'")}function qR(e){return e.split("/").map(encodeURIComponent).join("/")}function YR(e){return new Promise(t=>{setTimeout(t,e)})}async function ka(e=je){if(zt.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};JR(e);let t=zR(),r=`${Tt}/repos/${ue}/commits/${qR(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let n=await XR(r,e,t),o=await QR(n);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function XR(e,t,r){let n=null;for(let o=0;o<2;o+=1){let i;try{i=await G(e,{headers:{Accept:"application/vnd.github.sha",...r?{Authorization:`Bearer ${r}`}:{}},timeout:1e4,...r?{redirect:"manual"}:{}})}catch(s){throw ga(Tt,1e4,s)}if(r&&i.status>=300&&i.status<400)throw Xv(i.headers.get("location"));if(i.ok)return i;if(i.status>=500&&(n=i.status,o===0)){u.debug(`api.github.com returned ${i.status}; retrying once in ${1e3}ms.`),await YR(1e3);continue}throw Pi(Tt,i,t)}throw Pi(Tt,{status:n??500,statusText:"Server Error",headers:{get:()=>null}},t)}var lu=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function ZR(e){let t=e.body;if(!t)return"";let r=[],n=0;for await(let o of t){let i=Buffer.isBuffer(o)?o:Buffer.from(o);if(n+=i.length,n>4096)throw new lu;r.push(i)}return Buffer.concat(r).toString("utf8")}async function QR(e){let t;try{t=await ZR(e)}catch(n){throw n instanceof lu?tS():ga(Tt,1e4,n)}let r=t.trim();if(!zt.test(r))throw eS();return r}async function Ni(e={}){let t=await eI(e),{commit:r,ref:n}=t,o=await tg(r);if(o)return u.debug(`Using cached skills catalog for ${r}.`),await iu(r),{ref:n,commit:r,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await tI(r);return await iu(r),{ref:n,commit:r,...i}}async function eI(e){if(e.commit!==void 0){if(!zt.test(e.commit))throw $i(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return ka(e.ref)}async function tI(e){let t=await ha(),r=await sg(e),n=await ag.default.promises.mkdtemp(lg.default.join(t,tu));try{let o=await jv(r.tarPath,n,{strip:0,containmentRoot:t,consumedSubtrees:Gv,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await rI(n,e),{dir:s,published:a}=await rg(e,i);return u.debug(`Extracted skills catalog ${e}: ${o.fileCount} files, ${o.unpackedBytes} bytes, ${o.skipped.length} entries skipped${a?"":" (another process published first)"}.`),{root:s,fromCache:!1,skippedEntries:o.skipped,downloadedBytes:r.bytes}}finally{await Do(n),await Do(r.downloadDir)}}async function rI(e,t){let r=Kv(t),n=await ag.default.promises.readdir(e,{withFileTypes:!0}),o=n.filter(i=>i.isDirectory());if(n.length!==1||o.length!==1||o[0].name!==r)throw rS(r,n.map(i=>i.name));return lg.default.join(e,r)}var ko=`https://github.com/${ue}/issues`,Rt="SKILL.md",ba=new Set([".git","node_modules","__pycache__",".DS_Store"]),bo=new Set([".git","node_modules","__pycache__"]),Eo=new Set([".DS_Store","Thumbs.db"]),vo=8,cu=512,uu=128,uS=1024,dS=32,pS=256,fS=64,mS=64,cg=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,gS=256,hS=4;var ug=D(require("fs")),ji=D(require("path"));S();async function Mi(e){let t=ji.default.join(e,...Gr.split("/"));Re(e,t,"the catalog plugin manifest");let r;try{r=await ug.default.promises.readFile(t,"utf8")}catch(i){if(!iI(i))throw new f(`Failed to read the catalog manifest at ${Gr}: ${i instanceof Error?i.message:String(i)}`)}if(r===void 0)return{...await yS(e),version:"",source:"fallback"};let n=oI(r);if(n.skills===void 0)return{...await yS(e),version:n.version,source:"fallback"};let o=await nI(t,n.skills,e);if(!o)throw new f(`The catalog manifest at ${Gr} declares its skills directory as "${y(n.skills)}", which does not exist in the downloaded catalog. This is a bug in ${ue}. Please report it.`);return{version:n.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function nI(e,t,r){let n=ji.default.dirname(e),o=[{base:ji.default.dirname(n),relativeTo:"plugin root"},{base:n,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=ji.default.resolve(s.base,t);if(Re(r,a,"the catalog skills directory"),!!await wS(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${Gr} declares "skills": "${y(t)}", which only resolves relative to the ${s.relativeTo}. This means ${ue} changed its layout; please report it at ${ko}.`]}}}function oI(e){let t;try{t=JSON.parse(e)}catch(o){throw new f(`The catalog manifest at ${Gr} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${ue}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new f(`The catalog manifest at ${Gr} is not a JSON object. This is a bug in ${ue}. Please report it.`);let r=t,n=r.skills;if(n!==void 0&&(typeof n!="string"||n.trim()===""))throw new f(`The catalog manifest at ${Gr} declares "skills" as ${sI(n)}, but it must be a non-empty string. This is a bug in ${ue}. Please report it.`);return{version:typeof r.version=="string"?r.version.trim():"",skills:typeof n=="string"?n:void 0}}async function yS(e){for(let t of Zm){let r=ji.default.join(e,...t.split("/"));if(Re(e,r,"the catalog skills directory"),!!await wS(r))return{skillsDir:r,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${ue} changed its layout; please report it at ${ko}.`]}}throw new f(`The downloaded catalog has no skills directory: ${Gr} is absent and none of ${Zm.join(", ")} exists. This is a bug in ${ue}. Please report it.`)}async function wS(e){try{return(await ug.default.promises.stat(e)).isDirectory()}catch{return!1}}function iI(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function sI(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="string"?"an empty string":typeof e=="object"?"an object":`a ${typeof e}`}var DS=require("yaml");var It=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},aI=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,lI=/^\uFEFF/,cI="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",kS="\u2014 wrap the value in double quotes",uI={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},dI=100,pI=$.object({name:$.string().trim().min(1).max(uu),description:$.string().trim().min(1).max(uS),"mcp-version":$.string().max(dS).optional(),compatibility:$.string().max(pS).optional(),license:$.string().max(fS).optional(),metadata:$.record($.unknown()).optional()}).passthrough(),dg=["name","description"];function So(e){let t=e.replace(lI,""),r=aI.exec(t);if(!r){if(t.trimStart().startsWith("---"))throw new It(cI);return{frontmatter:pg({}),body:t,raw:e}}let n=r[1]??"",o=r[2]??"",i=fI(n,1);return{frontmatter:pg(i),body:o,raw:e}}function fI(e,t){let r=(0,DS.parseDocument)(e,uI),[n]=r.errors;if(n)throw new It(mI(n,e,t));let o;try{o=r.toJS({maxAliasCount:dI})}catch(i){throw new It(`YAML parse error: ${i instanceof Error?i.message:String(i)}`)}if(o==null)return{};if(typeof o!="object"||Array.isArray(o)||o instanceof Date)throw new It(`frontmatter is not a YAML mapping (parsed as ${fg(o)})`);return o}function mI(e,t,r){let n=e.pos?.[0],o="",i="";if(typeof n=="number"&&n>=0){let a=t.slice(0,n),l=a.split(`
238
- `).length,c=n-(a.lastIndexOf(`
239
- `)+1)+1;o=` at line ${l+r}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${kS}`:"";return`YAML parse error: ${e.message}${o}${s}`}function pg(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new It(`frontmatter is not a YAML mapping (parsed as ${fg(e)})`);let t={...e},r=dg.filter(i=>!(i in t)||t[i]===void 0);if(r.length>0)throw new It(`missing required frontmatter field(s): ${r.join(", ")}`);let n=dg.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(n.length>0){let i=dg.map(a=>fg(t[a])).join(" and "),s=n.some(a=>hI(t[a]));throw new It(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${kS}`:""}`)}t.metadata=gI(t.metadata),t.metadata===void 0&&delete t.metadata;let o=pI.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new It(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function gI(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function hI(e){return!(e==null||typeof e=="string")}function fg(e){return e===null?"null":e===void 0?"nothing":Array.isArray(e)?"list":e instanceof Date?"date":typeof e=="string"?e.trim()===""?"empty string":"string":typeof e=="object"?"mapping":typeof e}function mg(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function gg(e){let t=e.metadata?.category;if(typeof t!="string")return;let r=t.trim();return r===""?void 0:r}var du=D(require("path"));S();var yI=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),hg="/webflow-skills-store";function Bi(e){if(typeof e!="string")return;let t=bS(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,mS),r=bS(t);if(r&&!yI.has(r)&&wI(r))return r}function bS(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function wI(e){return[Iv,Km].every(r=>{let n=r.impl.join(hg,e);return!et(hg,n,r)||r.impl.basename(n)!==e?!1:r.impl.dirname(n)===r.impl.normalize(hg)})}function yg(e){return cg.test(e)}var Cn=e=>du.default.posix.basename(du.default.posix.dirname(e.split(du.default.win32.sep).join("/")));function Jr(e,t){let r=typeof e=="string"?e.trim():"",n=()=>({kind:"none",candidates:[...new Set(t.map(s=>s.dir))].sort()});if(r==="")return n();let o=[s=>s.name===r,s=>s.folderName===r,s=>s.dir===r],i=Bi(r);i!==void 0&&o.push(s=>s.dir===i||Bi(s.name)===i||Bi(s.folderName)===i);for(let s of o){let a=t.filter(s);if(a.length===1)return{kind:"match",skill:a[0]};if(a.length>1)return{kind:"ambiguous",matches:a}}return n()}function ES(e){return vS(e,t=>t.dir)}function wg(e){let[t]=ES(e);if(!t)return;let r=t.skills.length,n=t.skills.map(o=>` "${y(o.name)}" (${y(o.skillPath)})`);throw new f(`${r===2?"Two":String(r)} skills resolve to the same install directory "${y(t.value)}":
240
- ${n.join(`
246
+ \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Yu(){return new f(`The skills catalog download exceeded ${zx(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function Xx(e){return new f(`Commit ${D(e)} of ${he} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
247
+ \u2022 Retry without --ref to take the current "${Ge}".`,{isUserError:!0})}function Yx(){return new f("The skills catalog download returned no response body. Please retry.")}function qa(e){return new f(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function Zx(){return new f(`${mn(Pt)} answered the ref lookup with something that is not a 40-character commit SHA. Refusing to guess at what to install. Please report this if it persists.`)}function Qx(){return new f(`${mn(Pt)} answered the ref lookup with more than ${zx(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
248
+ \u2022 If a proxy is intercepting ${mn(Pt)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function ps(e){return new f(`Expected a full 40-character commit SHA but got "${D(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function ir(e,t){return new f(`Invalid --ref "${D(e)}": ${t}.
249
+ \u2022 Pass a branch name (e.g. "${Ge}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function eC(e,t){let n=t.length===0?"nothing":t.map(r=>`"${D(r)}"`).join(", ");return new f(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${n}. Please report this.`)}var T$=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function P$(e){if(typeof e!="object"||e===null)return;let t=e;if(typeof t.code=="string")return t.code;if(typeof t.errno=="string")return t.errno}function Ya(e,t,n){if(n instanceof f)return n;let r=P$(n);if(r==="ENOSPC"||r==="EDQUOT"||r==="EFBIG")return qa("writing the skills catalog");if(r&&T$.has(r))return Kx(e,r);let o=n?.type;if(o==="request-timeout")return Xu(e,t);if(o==="max-size")return Yu();let i=n instanceof Error?n.message:String(n);return/network timeout|timed? ?out/i.test(i)?Xu(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?Kx(e,""):new f(`Could not fetch the skills catalog from ${mn(e)}: ${D(i)}`)}function fs(){return Zu.default.join(dD(),Jx)}function ah(e){if(!Yt.test(e))throw ps(e);return Zu.default.join(fs(),e)}async function Za(){let e=fs();try{return await sr.default.promises.mkdir(e,{recursive:!0,mode:448}),await sr.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?qa("creating the skills cache directory"):new f(`Could not create the skills cache directory "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function lh(e){let t=ah(e),n;try{n=await sr.default.promises.lstat(t)}catch(r){return r.code==="ENOENT"||u.debug(`Could not inspect skills cache entry: ${r instanceof Error?r.message:String(r)}`),null}if(n.isSymbolicLink())throw new f(`Refusing to use the skills cache: "${D(t)}" is a symbolic link, so reading it would install whatever it points at. Remove it and retry.`);return n.isDirectory()?t:(u.debug(`Skills cache entry for ${e} is not a directory; treating as a miss.`),null)}var O$=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function L$(e){try{return(await sr.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function ch(e,t){let n=ah(e),r=fs();await ls(r,n,"the skills cache entry"),await ls(r,t,"the extracted skills catalog being published");try{return await sr.default.promises.rename(t,n),{dir:n,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw qa("publishing the skills catalog to the cache");if(i!==void 0&&O$.has(i)&&await L$(n))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:n,published:!1};throw new f(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function Wo(e){await ls(fs(),e,"the skills cache path being removed");try{await sr.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}function N$(e){return Yt.test(e)||e.startsWith(zu)||e.startsWith(qu)}async function Qu(e){let t=fs(),n;try{n=await sr.default.promises.readdir(t,{withFileTypes:!0})}catch(o){o.code!=="ENOENT"&&u.debug(`Skills cache sweep skipped: ${o instanceof Error?o.message:String(o)}`);return}let r=Date.now()-6048e5;for(let o of n){if(o.name===e||!N$(o.name))continue;let i=Zu.default.join(t,o.name);try{if((await sr.default.promises.lstat(i)).mtimeMs>=r)continue;await Wo(i),u.debug(`Swept stale skills cache entry "${o.name}".`)}catch(s){u.debug(`Skills cache sweep could not handle "${o.name}": ${s instanceof Error?s.message:String(s)}`)}}}var ph=w(require("fs")),uh=w(require("path")),rC=require("stream"),oC=require("stream/promises");lt();_();var j$="catalog.tar.gz",Qa=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},ed=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},dh=class extends rC.Transform{constructor(n){super();this.cap=n}bytes=0;_transform(n,r,o){let i=Buffer.isBuffer(n)?n:Buffer.from(n);if(this.bytes+=i.length,this.bytes>this.cap){o(new ed);return}o(null,i)}};async function fh(e){if(!Yt.test(e))throw ps(e);let t=await Za(),n=await ph.default.promises.mkdtemp(uh.default.join(t,zu)),r=uh.default.join(n,j$),o=`${Uo}/${he}/tar.gz/${e}`;try{let i=await M$(o,e),s=await B$(i,r);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:r,downloadDir:n,bytes:s}}catch(i){throw await Wo(n),Ya(Uo,6e4,i)}}async function M$(e,t){let n=0;for(let r=0;r<2;r+=1){let o=await J(e,{headers:{Accept:"application/x-gzip"},timeout:6e4});if(o.ok){let i=Number(o.headers.get("content-length"));if(Number.isFinite(i)&&i>33554432)throw Yu();return o}if(o.status>=500&&r===0){n=o.status,u.debug(`codeload.github.com returned ${o.status}; retrying once in ${1e3}ms.`),await new Promise(i=>{setTimeout(i,1e3)});continue}throw o.status===404?Xx(t):ds(Uo,o)}throw ds(Uo,{status:n||500,statusText:"Server Error",headers:{get:()=>null}})}async function B$(e,t){let n=e.body;if(!n)throw Yx();let r=new dh(33554432),o=setTimeout(()=>{n.destroy?.(new Qa),r.destroy(new Qa)},6e4);o.unref?.();try{await(0,oC.pipeline)(n,r,ph.default.createWriteStream(t,{mode:384}))}catch(i){throw nC(i,ed)?Yu():nC(i,Qa)?Xu(Uo,6e4):i}finally{clearTimeout(o)}return r.bytes}function nC(e,t){if(e instanceof t)return!0;if(e instanceof Error){if(e.name===t.name)return!0;let n=e.cause;if(n instanceof t||n instanceof Error&&n.name===t.name)return!0}return!1}lt();_();var U$=["GITHUB_TOKEN","GH_TOKEN"];function W$(){for(let e of U$){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function H$(e){if(e==="")throw ir(e,"it is empty");if(!Ku.test(e))throw ir(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw ir(e,"it starts with '-'");if(e.includes(".."))throw ir(e,"it contains '..'");if(e.endsWith(".lock"))throw ir(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw ir(e,"it starts or ends with '/'");if(e.includes("//"))throw ir(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw ir(e,"a path component ends with '.'")}function V$(e){return e.split("/").map(encodeURIComponent).join("/")}function G$(e){return new Promise(t=>{setTimeout(t,e)})}async function nl(e=Ge){if(Yt.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};H$(e);let t=W$(),n=`${Pt}/repos/${he}/commits/${V$(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let r=await J$(n,e,t),o=await z$(r);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function J$(e,t,n){let r=null;for(let o=0;o<2;o+=1){let i;try{i=await J(e,{headers:{Accept:"application/vnd.github.sha",...n?{Authorization:`Bearer ${n}`}:{}},timeout:1e4,...n?{redirect:"manual"}:{}})}catch(s){throw Ya(Pt,1e4,s)}if(n&&i.status>=300&&i.status<400)throw qx(i.headers.get("location"));if(i.ok)return i;if(i.status>=500&&(r=i.status,o===0)){u.debug(`api.github.com returned ${i.status}; retrying once in ${1e3}ms.`),await G$(1e3);continue}throw ds(Pt,i,t)}throw ds(Pt,{status:r??500,statusText:"Server Error",headers:{get:()=>null}},t)}var nd=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function K$(e){let t=e.body;if(!t)return"";let n=[],r=0;for await(let o of t){let i=Buffer.isBuffer(o)?o:Buffer.from(o);if(r+=i.length,r>4096)throw new nd;n.push(i)}return Buffer.concat(n).toString("utf8")}async function z$(e){let t;try{t=await K$(e)}catch(r){throw r instanceof nd?Qx():Ya(Pt,1e4,r)}let n=t.trim();if(!Yt.test(n))throw Zx();return n}async function ms(e={}){let t=await q$(e),{commit:n,ref:r}=t,o=await lh(n);if(o)return u.debug(`Using cached skills catalog for ${n}.`),await Qu(n),{ref:r,commit:n,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await X$(n);return await Qu(n),{ref:r,commit:n,...i}}async function q$(e){if(e.commit!==void 0){if(!Yt.test(e.commit))throw ps(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return nl(e.ref)}async function X$(e){let t=await Za(),n=await fh(e),r=await mh.default.promises.mkdtemp(gh.default.join(t,qu));try{let o=await Lx(n.tarPath,r,{strip:0,containmentRoot:t,consumedSubtrees:Hx,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await Y$(r,e),{dir:s,published:a}=await ch(e,i);return u.debug(`Extracted skills catalog ${e}: ${o.fileCount} files, ${o.unpackedBytes} bytes, ${o.skipped.length} entries skipped${a?"":" (another process published first)"}.`),{root:s,fromCache:!1,skippedEntries:o.skipped,downloadedBytes:n.bytes}}finally{await Wo(r),await Wo(n.downloadDir)}}async function Y$(e,t){let n=Vx(t),r=await mh.default.promises.readdir(e,{withFileTypes:!0}),o=r.filter(i=>i.isDirectory());if(r.length!==1||o.length!==1||o[0].name!==n)throw eC(n,r.map(i=>i.name));return gh.default.join(e,n)}var Ho=`https://github.com/${he}/issues`,$t="SKILL.md",rl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Vo=new Set([".git","node_modules","__pycache__"]),Go=new Set([".DS_Store","Thumbs.db"]),Jo=8,rd=512,od=128,lC=1024,cC=32,uC=256,dC=64,pC=64,hh=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,fC=256,mC=4;var yh=w(require("fs")),gs=w(require("path"));C();async function hs(e){let t=gs.default.join(e,...or.split("/"));Be(e,t,"the catalog plugin manifest");let n;try{n=await yh.default.promises.readFile(t,"utf8")}catch(i){if(!eO(i))throw new f(`Failed to read the catalog manifest at ${or}: ${i instanceof Error?i.message:String(i)}`)}if(n===void 0)return{...await gC(e),version:"",source:"fallback"};let r=Q$(n);if(r.skills===void 0)return{...await gC(e),version:r.version,source:"fallback"};let o=await Z$(t,r.skills,e);if(!o)throw new f(`The catalog manifest at ${or} declares its skills directory as "${D(r.skills)}", which does not exist in the downloaded catalog. This is a bug in ${he}. Please report it.`);return{version:r.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function Z$(e,t,n){let r=gs.default.dirname(e),o=[{base:gs.default.dirname(r),relativeTo:"plugin root"},{base:r,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=gs.default.resolve(s.base,t);if(Be(n,a,"the catalog skills directory"),!!await hC(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${or} declares "skills": "${D(t)}", which only resolves relative to the ${s.relativeTo}. This means ${he} changed its layout; please report it at ${Ho}.`]}}}function Q$(e){let t;try{t=JSON.parse(e)}catch(o){throw new f(`The catalog manifest at ${or} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${he}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new f(`The catalog manifest at ${or} is not a JSON object. This is a bug in ${he}. Please report it.`);let n=t,r=n.skills;if(r!==void 0&&(typeof r!="string"||r.trim()===""))throw new f(`The catalog manifest at ${or} declares "skills" as ${tO(r)}, but it must be a non-empty string. This is a bug in ${he}. Please report it.`);return{version:typeof n.version=="string"?n.version.trim():"",skills:typeof r=="string"?r:void 0}}async function gC(e){for(let t of ih){let n=gs.default.join(e,...t.split("/"));if(Be(e,n,"the catalog skills directory"),!!await hC(n))return{skillsDir:n,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${he} changed its layout; please report it at ${Ho}.`]}}throw new f(`The downloaded catalog has no skills directory: ${or} is absent and none of ${ih.join(", ")} exists. This is a bug in ${he}. Please report it.`)}async function hC(e){try{return(await yh.default.promises.stat(e)).isDirectory()}catch{return!1}}function eO(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function tO(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="string"?"an empty string":typeof e=="object"?"an object":`a ${typeof e}`}var yC=require("yaml");var Ot=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},nO=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,rO=/^\uFEFF/,oO="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",wC="\u2014 wrap the value in double quotes",iO={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},sO=100,aO=j.object({name:j.string().trim().min(1).max(od),description:j.string().trim().min(1).max(lC),"mcp-version":j.string().max(cC).optional(),compatibility:j.string().max(uC).optional(),license:j.string().max(dC).optional(),metadata:j.record(j.unknown()).optional()}).passthrough(),wh=["name","description"];function Ko(e){let t=e.replace(rO,""),n=nO.exec(t);if(!n){if(t.trimStart().startsWith("---"))throw new Ot(oO);return{frontmatter:Dh({}),body:t,raw:e}}let r=n[1]??"",o=n[2]??"",i=lO(r,1);return{frontmatter:Dh(i),body:o,raw:e}}function lO(e,t){let n=(0,yC.parseDocument)(e,iO),[r]=n.errors;if(r)throw new Ot(cO(r,e,t));let o;try{o=n.toJS({maxAliasCount:sO})}catch(i){throw new Ot(`YAML parse error: ${i instanceof Error?i.message:String(i)}`)}if(o==null)return{};if(typeof o!="object"||Array.isArray(o)||o instanceof Date)throw new Ot(`frontmatter is not a YAML mapping (parsed as ${bh(o)})`);return o}function cO(e,t,n){let r=e.pos?.[0],o="",i="";if(typeof r=="number"&&r>=0){let a=t.slice(0,r),l=a.split(`
250
+ `).length,c=r-(a.lastIndexOf(`
251
+ `)+1)+1;o=` at line ${l+n}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${wC}`:"";return`YAML parse error: ${e.message}${o}${s}`}function Dh(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new Ot(`frontmatter is not a YAML mapping (parsed as ${bh(e)})`);let t={...e},n=wh.filter(i=>!(i in t)||t[i]===void 0);if(n.length>0)throw new Ot(`missing required frontmatter field(s): ${n.join(", ")}`);let r=wh.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(r.length>0){let i=wh.map(a=>bh(t[a])).join(" and "),s=r.some(a=>dO(t[a]));throw new Ot(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${wC}`:""}`)}t.metadata=uO(t.metadata),t.metadata===void 0&&delete t.metadata;let o=aO.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new Ot(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function uO(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function dO(e){return!(e==null||typeof e=="string")}function bh(e){return e===null?"null":e===void 0?"nothing":Array.isArray(e)?"list":e instanceof Date?"date":typeof e=="string"?e.trim()===""?"empty string":"string":typeof e=="object"?"mapping":typeof e}function kh(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function Eh(e){let t=e.metadata?.category;if(typeof t!="string")return;let n=t.trim();return n===""?void 0:n}var id=w(require("path"));C();var pO=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),vh="/webflow-skills-store";function ys(e){if(typeof e!="string")return;let t=DC(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,pC),n=DC(t);if(n&&!pO.has(n)&&fO(n))return n}function DC(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function fO(e){return[Ix,Qg].every(n=>{let r=n.impl.join(vh,e);return!rt(vh,r,n)||n.impl.basename(r)!==e?!1:n.impl.dirname(r)===n.impl.normalize(vh)})}function Sh(e){return hh.test(e)}var Vr=e=>id.default.posix.basename(id.default.posix.dirname(e.split(id.default.win32.sep).join("/")));function ar(e,t){let n=typeof e=="string"?e.trim():"",r=()=>({kind:"none",candidates:[...new Set(t.map(s=>s.dir))].sort()});if(n==="")return r();let o=[s=>s.name===n,s=>s.folderName===n,s=>s.dir===n],i=ys(n);i!==void 0&&o.push(s=>s.dir===i||ys(s.name)===i||ys(s.folderName)===i);for(let s of o){let a=t.filter(s);if(a.length===1)return{kind:"match",skill:a[0]};if(a.length>1)return{kind:"ambiguous",matches:a}}return r()}function bC(e){return kC(e,t=>t.dir)}function xh(e){let[t]=bC(e);if(!t)return;let n=t.skills.length,r=t.skills.map(o=>` "${D(o.name)}" (${D(o.skillPath)})`);throw new f(`${n===2?"Two":String(n)} skills resolve to the same install directory "${D(t.value)}":
252
+ ${r.join(`
241
253
  `)}
242
- This is a bug in ${ue}. Please report it.`)}function Dg(e){return vS(e,t=>t.name)}function kg(e){let[t,...r]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${y(e.value)}": ${e.skills.map(n=>y(n.skillPath)).join(", ")}. Using ${y(t?.skillPath??"")} and ignoring ${r.length===1?"the other":"the others"}. This is a bug in ${ue}. Please report it.`}function vS(e,t){let r=new Map;for(let n of e){let o=t(n),i=r.get(o);i?i.push(n):r.set(o,[n])}return[...r.entries()].filter(([,n])=>n.length>1).map(([n,o])=>({value:n,skills:o}))}var Ui=D(require("fs")),Jt=D(require("path"));S();async function Wi(e,t){Re(t,e,"the catalog skills directory");let r=[],n=[],o=[],i=new Set,s=p=>(o.push(...p.warnings),p.kind==="skipped"?(n.push({skillPath:p.skillPath,reason:p.reason}),!1):(r.push(p.skill),!p.skill.internal));for(let p of await Ea(e,"the catalog skills directory")){if(ba.has(p.name))continue;let h=Jt.default.join(e,p.name);if(!await bg(h,p))continue;let g=await xS(h);if(g.kind!=="none"&&i.add(g.path),!(g.kind!=="none"&&s(await SS({skillDir:h,manifest:g,extractRoot:t}))))for(let m of await Ea(h)){if(ba.has(m.name))continue;let w=Jt.default.join(h,m.name);if(!await bg(w,m))continue;let k=await xS(w);k.kind!=="none"&&(i.add(k.path),s(await SS({skillDir:w,manifest:k,extractRoot:t,parentCategory:p.name})))}}let a=await kI(r),l=Dg(a),c=new Set;for(let p of l){o.push(kg(p));for(let h of p.skills.slice(1))c.add(h.skillPath)}let d=a.filter(p=>!c.has(p.skillPath));wg(d),o.push(...await bI(e,t,i));for(let p of n)o.push(`Skipped ${p.skillPath} \u2014 ${p.reason}`);return n.length>0&&o.push(`${n.length} skill${n.length===1?" was":"s were"} skipped. ${n.length===1?"This is a defect":"These are defects"} in ${ue} \u2014 please report ${n.length===1?"it":"them"} at ${ko}.`),{skills:d,skipped:n,warnings:o}}async function SS(e){let{skillDir:t,manifest:r,extractRoot:n,parentCategory:o}=e,i=FS(n,r.path),s=[],a=m=>({kind:"skipped",skillPath:i,reason:y(m),warnings:s});if(r.kind==="symlink")return a(`${Rt} is a symbolic link; skill files must be regular files`);let l;try{l=await Ui.default.promises.readFile(r.path,"utf8")}catch(m){return a(`failed to read file: ${m instanceof Error?m.message:String(m)}`)}let c;try{c=So(l).frontmatter}catch(m){if(m instanceof It)return a(m.reason);throw m}let d=y(c.name),p=y(c.description);if(d==="")return a(`frontmatter name "${y(c.name)}" cannot be used as a directory name`);let h=Bi(d);if(h===void 0)return a(`frontmatter name "${d}" cannot be used as a directory name`);yg(d)||s.push(`${i} declares a non-standard skill name "${d}"; it installs as "${h}". This is a bug in ${ue}.`);let g=await DI(t,r.path);return g.symlink?a(`contains a symbolic link (${g.symlink}); skill files must be regular files`):(g.truncated&&s.push(`${i} sits in a directory with more than ${cu} files; only the first ${cu} are listed.`),{kind:"skill",warnings:s,skill:{name:d,dir:h,folderName:Cn(i),description:p,category:gg(c)??o,internal:mg(c),path:t,skillPath:i,supplementaryFiles:g.files}})}async function xS(e){let t=Jt.default.join(e,Rt),r=await CS(t);if(r)return r;let n=Rt.toLowerCase();for(let o of await Ea(e)){if(o.name===Rt||o.name.toLowerCase()!==n)continue;let i=await CS(Jt.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function CS(e){try{let t=await Ui.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function bg(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await Ui.default.promises.stat(e)).isDirectory()}catch{return!1}}async function Ea(e,t){try{return(await Ui.default.promises.readdir(e,{withFileTypes:!0})).sort((n,o)=>n.name<o.name?-1:n.name>o.name?1:0)}catch(r){if(!t)return[];throw new f(`Failed to read ${t} (${y(e)}): ${r instanceof Error?r.message:String(r)}`)}}async function DI(e,t){let r=[],n,o=!1,i=async(s,a)=>{if(!(a>vo||n!==void 0))for(let l of await Ea(s)){if(n!==void 0)return;let c=Jt.default.join(s,l.name);if(l.isSymbolicLink()){n=_S(e,c);return}if(l.isDirectory()){if(bo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!Eo.has(l.name)&&c!==t){if(r.length>=cu){o=!0;return}r.push(_S(e,c))}}};return await i(e,1),{files:r.sort(),symlink:n,truncated:o}}async function kI(e){let t=new Set,r=[];for(let n of e){let o;try{o=await Ui.default.promises.realpath(n.path)}catch{o=Jt.default.resolve(n.path)}t.has(o)||(t.add(o),r.push(n))}return r}async function bI(e,t,r){let n=[],o=gS,i=async(s,a)=>{if(!(a>hS||o<=0)){o-=1;for(let l of await Ea(s)){if(ba.has(l.name))continue;let c=Jt.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Rt.toLowerCase()){r.has(c)||n.push(FS(t,c));continue}await bg(c,l)&&await i(c,a+1)}}};return await i(e,1),n.length===0?[]:[`${n.length} ${Rt} file(s) in the catalog sit outside the layout this CLI reads (for example ${n[0]}) and were ignored. ${ue} may have changed its layout; please report it at ${ko}.`]}function FS(e,t){return Jt.default.relative(e,t).split(Jt.default.sep).join("/")}function _S(e,t){return Jt.default.relative(e,t).split(Jt.default.sep).join("/")}var ar=D(require("os")),Sr=D(require("path"));function xo(e,t){let r=process.env[e]?.trim();return r||t}function AS(e){let t=process.env[e]?.trim();return t||void 0}var oe={home:()=>ar.default.homedir(),configHome:()=>xo("XDG_CONFIG_HOME",Sr.default.join(ar.default.homedir(),".config")),hardcodedConfigHome:()=>Sr.default.join(ar.default.homedir(),".config"),claudeHome:()=>xo("CLAUDE_CONFIG_DIR",Sr.default.join(ar.default.homedir(),".claude")),codexHome:()=>xo("CODEX_HOME",Sr.default.join(ar.default.homedir(),".codex")),vibeHome:()=>xo("VIBE_HOME",Sr.default.join(ar.default.homedir(),".vibe")),hermesHome:()=>xo("HERMES_HOME",Sr.default.join(ar.default.homedir(),".hermes")),autohandHome:()=>xo("AUTOHAND_HOME",Sr.default.join(ar.default.homedir(),".autohand")),grokHome:()=>xo("GROK_HOME",Sr.default.join(ar.default.homedir(),".grok")),appData:()=>AS("APPDATA"),flatpakConfigHome:()=>AS("FLATPAK_XDG_CONFIG_HOME")};function lr(...e){return Sr.default.join(ar.default.homedir(),...e)}var BS=D(require("fs")),fe=D(require("path"));S();N();var kt=D(require("path"));var Eg=[".openclaw",".clawdbot",".moltbot"];function TS(e,t){let r=Eg.find(n=>t(kt.default.join(e,n)));return kt.default.join(e,r??Eg[0],"skills")}function RS(e,t){return Eg.some(r=>t(kt.default.join(e,r)))}function IS(e,t,r=oe.appData(),n=oe.flatpakConfigHome()){return!!(t(kt.default.join(e,"zed"))||r&&t(kt.default.join(r,"Zed"))||n&&t(kt.default.join(n,"zed")))}var vI="/Applications/ZCode.app";function OS(e,t){return t(kt.default.join(e,".zcode"))||t(vI)}function PS(e,t){return t(kt.default.join(e,"kimchi"))}var SI="/etc/codex";function $S(e,t){return t(e)||t(SI)}function LS(e,t){return t(kt.default.join(e,".replit"))}function NS(e,t){return t(kt.default.join(e,".promptscript"))||t(kt.default.join(e,"promptscript.yaml"))}function jS(e,t,r){return r(kt.default.join(t,"data","skills"))||r(kt.default.join(e,".astrbot"))}function MS(){return!1}function xI(e){try{return BS.default.existsSync(e)}catch{return!1}}function le(e,t,r){return{id:e,displayName:t,skillsDir:`${r}/skills`,globalSkillsDir:()=>lr(r,"skills"),detect:n=>n.pathExists(fe.default.join(n.homeDir,r)),sharedStore:!1}}function tt(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>lr(...e.global),detect:t=>t.pathExists(fe.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Ge=".agents/skills",va=[le("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Ge,globalSkillsDir:()=>fe.default.join(oe.configHome(),"agents","skills"),detect:e=>e.pathExists(fe.default.join(e.configHome,"amp")),sharedStore:!0},tt({id:"antigravity",displayName:"Antigravity",project:Ge,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),tt({id:"antigravity-cli",displayName:"Antigravity CLI",project:Ge,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>lr(".astrbot","data","skills"),detect:e=>jS(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>fe.default.join(oe.autohandHome(),"skills"),detect:e=>e.pathExists(oe.autohandHome()),sharedStore:!1},le("augment","Augment",".augment"),le("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>fe.default.join(oe.claudeHome(),"skills"),detect:e=>e.pathExists(oe.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>TS(oe.home(),xI),detect:e=>RS(e.homeDir,e.pathExists),sharedStore:!1},tt({id:"cline",displayName:"Cline",project:Ge,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),le("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>lr(".codebuddy","skills"),detect:e=>e.pathExists(fe.default.join(e.cwd,".codebuddy"))||e.pathExists(fe.default.join(e.homeDir,".codebuddy")),sharedStore:!1},le("codemaker","Codemaker",".codemaker"),le("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Ge,globalSkillsDir:()=>fe.default.join(oe.codexHome(),"skills"),detect:e=>$S(oe.codexHome(),e.pathExists),sharedStore:!0},le("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>lr(".continue","skills"),detect:e=>e.pathExists(fe.default.join(e.cwd,".continue"))||e.pathExists(fe.default.join(e.homeDir,".continue")),sharedStore:!1},tt({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>fe.default.join(oe.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(fe.default.join(oe.hardcodedConfigHome(),"crush")),sharedStore:!1},tt({id:"cursor",displayName:"Cursor",project:Ge,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),tt({id:"deepagents",displayName:"Deep Agents",project:Ge,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>fe.default.join(oe.configHome(),"devin","skills"),detect:e=>e.pathExists(fe.default.join(e.configHome,"devin")),sharedStore:!1},tt({id:"dexto",displayName:"Dexto",project:Ge,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),le("droid","Droid",".factory"),tt({id:"firebender",displayName:"Firebender",project:Ge,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),le("forgecode","ForgeCode",".forge"),tt({id:"gemini-cli",displayName:"Gemini CLI",project:Ge,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),tt({id:"github-copilot",displayName:"GitHub Copilot",project:Ge,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>fe.default.join(oe.configHome(),"goose","skills"),detect:e=>e.pathExists(fe.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>fe.default.join(oe.grokHome(),"skills"),detect:e=>e.pathExists(oe.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>fe.default.join(oe.hermesHome(),"skills"),detect:e=>e.pathExists(oe.hermesHome()),sharedStore:!1},le("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>lr(".jazz","skills"),detect:e=>e.pathExists(fe.default.join(e.homeDir,".jazz"))||e.pathExists(fe.default.join(e.cwd,".jazz")),sharedStore:!1},le("junie","Junie",".junie"),le("iflow-cli","iFlow CLI",".iflow"),le("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>fe.default.join(oe.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>PS(oe.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Ge,globalSkillsDir:()=>lr(".agents","skills"),detect:e=>e.pathExists(fe.default.join(e.homeDir,".kimi-code"))||e.pathExists(fe.default.join(e.homeDir,".kimi")),sharedStore:!0},le("kiro-cli","Kiro CLI",".kiro"),le("kode","Kode",".kode"),le("lingma","Lingma",".lingma"),tt({id:"loaf",displayName:"Loaf",project:Ge,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),le("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>fe.default.join(oe.vibeHome(),"skills"),detect:e=>e.pathExists(oe.vibeHome()),sharedStore:!1},le("moxby","Moxby",".moxby"),le("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Ge,globalSkillsDir:()=>fe.default.join(oe.configHome(),"opencode","skills"),detect:e=>e.pathExists(fe.default.join(e.configHome,"opencode")),sharedStore:!0},le("openhands","OpenHands",".openhands"),le("ona","Ona",".ona"),tt({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),le("qoder","Qoder",".qoder"),tt({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),le("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Ge,globalSkillsDir:()=>fe.default.join(oe.configHome(),"agents","skills"),detect:e=>LS(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},le("reasonix","Reasonix",".reasonix"),le("rovodev","Rovo Dev",".rovodev"),le("roo","Roo Code",".roo"),tt({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),le("terramind","Terramind",".terramind"),le("tinycloud","Tinycloud",".tinycloud"),le("trae","Trae",".trae"),tt({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),tt({id:"warp",displayName:"Warp",project:Ge,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),tt({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Ge,globalSkillsDir:()=>lr(".agents","skills"),detect:e=>IS(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>lr(".zcode","skills"),detect:e=>OS(e.homeDir,e.pathExists),sharedStore:!1},le("zencoder","Zencoder",".zencoder"),le("zenflow","Zenflow",".zencoder"),le("neovate","Neovate",".neovate"),le("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Ge,globalSkillsDir:()=>{},detect:e=>NS(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},le("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Ge,globalSkillsDir:()=>fe.default.join(oe.configHome(),"agents","skills"),detect:MS,sharedStore:!0,showInSharedList:!1}],vg=new Map(va.map(e=>[e.id,e])),Co=va.map(e=>e.id);function Sa(e){return vg.has(e)}function xr(e){return vg.get(e)}function pu(e){let t=vg.get(e);if(t)return t;throw new f(`${b} Unknown agent: ${y(e)}
243
- ${Co.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function fu(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function Cr(e){return va.filter(t=>fu(t,e))}var Sg=D(require("path"));S();N();var mu=".agents",gu="skills";function rt(e,t){let r=e==="global"?oe.home():t;return Sg.default.join(r,mu,gu)}function Ot(e,t,r){if(t==="global")return e.globalSkillsDir()??null;let n=Sg.default.resolve(r,...e.skillsDir.split("/"));return Re(r,n,`${e.id} project skills directory`),n}function xg(e,t,r){return He(Ot(e,t,r),rt(t,r))}var Cg=D(require("fs")),US=D(require("path"));function CI(e){try{return Cg.default.existsSync(e)}catch{return!1}}function _I(e){try{let t=JSON.parse(Cg.default.readFileSync(US.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function WS(e){return{homeDir:oe.home(),configHome:oe.configHome(),cwd:e,pathExists:CI,readPackageJson:_I}}async function xa(e,t,r=WS(t)){return HS(Cr(e),r).map(n=>n.id)}function HS(e,t){return e.filter(r=>{try{return r.detect(t)}catch{return!1}})}var VS=D(require("fs")),GS=D(require("path"));S();pe();Ae();x();N();var Ca=[".git","package.json","webflow.json"];function _a(e){for(let t of Ca)try{if(VS.default.existsSync(GS.default.join(e,t)))return t}catch{}return null}function Fa(e){return _a(e)===null?"global":"project"}function KS(e){let t=_a(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${Ca.join(", ")} found in this directory.`}async function hu(e,t){if(e.global&&e.project)throw new f(`${b} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let r=Fa(t);return e.yes||W()?(u.info(KS(t)),r):Be({message:"Where should these skills be installed?",default:r,choices:[{value:"project",name:"This project \u2014 skills live in the repository"},{value:"global",name:"Globally \u2014 skills available in every project"}]})}S();pe();Ae();x();N();var Aa="all",qt="universal",FI=6,AI=20,TI=80;function Hi(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function RI(e,t){let r=Array.from({length:t.length+1},(n,o)=>o);for(let n=1;n<=e.length;n+=1){let o=[n];for(let i=1;i<=t.length;i+=1)o[i]=Math.min(r[i]+1,o[i-1]+1,r[i-1]+(e[n-1]===t[i-1]?0:1));r=o}return r[t.length]}function qS(e){let t=e.toLowerCase(),r=Math.max(1,Math.floor(t.length/3)),n=null,o=Number.POSITIVE_INFINITY;for(let i of Co){let s=RI(t,i);s<o&&(o=s,n=i)}return o<=r?n:null}function Vi(e){let t=e.filter(r=>!Sa(r));if(t.length>0){let r=Array.from(new Set(t.map(o=>qS(o)).filter(o=>o!==null))),n=r.length>0?` Did you mean: ${r.join(", ")}?
244
- `:"";throw new f(`${b} Unknown agent(s): ${t.map(o=>y(o)).join(", ")}
245
- `+n+` ${Co.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(r=>xr(r))}function wu(e,t){return Cr(e).filter(r=>xg(r,e,t))}function YS(e,t){return wu(e,t).filter(r=>r.showInSharedList!==!1)}function XS(e,t){let n=e.filter(s=>s.showInSharedPrompt!==!1).slice(0,Math.max(0,t)),o=e.length-n.length,i=n.map(s=>s.displayName).join(", ");return o>0?`${i} +${o} more`:i}function ZS(e,t,r=FI){return XS(YS(e,t),r)}function zS(e,t){let r=process.stdout.columns??TI,n=Math.max(20,r-t);return e.length<=n?e:`${e.slice(0,n-1)}\u2026`}function II(e,t,r){return t==="project"?e.skillsDir:Ot(e,t,r)??""}function yu(e,...t){let r=new Set(t.flat());return Cr(e).filter(n=>r.has(n.id))}async function JS(e,t,r){let n=wu(e,t),o=new Set(n.map(p=>p.id)),i=Cr(e).filter(p=>!o.has(p.id)),s=new Set(r),a=ZS(e,t),l=rt(e,t),c=[];n.length>0&&c.push({value:"",name:zS(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let p of i){let h=II(p,e,t),g=s.has(p.id)?" (detected)":"";c.push({value:p.id,name:zS(`${p.displayName} ${h}${g}`,8),checked:s.has(p.id)})}let d=await fr({message:n.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(AI,Math.max(4,c.length)),validate:p=>p.length>0||n.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return yu(e,n.map(p=>p.id),(d??[]).filter(Boolean))}async function Ta(e){let{scope:t,cwd:r,options:n}=e,o=Hi(n.agent),i=n.allAgents===!0||o.includes(Aa),s=o.filter(c=>c!==Aa),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(d=>Sa(d));return{agents:yu(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(d=>!Sa(d))}}if(s.length>0&&!i){let c=Vi(s),d=c.filter(p=>!fu(p,t));if(d.length>0){let p=d.map(h=>h.displayName).join(", ");throw new f(`${b} ${p} does not support global skill installation \u2014 its skills live inside a project.
246
- Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:yu(t,c.map(p=>p.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...Cr(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await xa(t,r);if(l.length===0){if(W()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${rt(t,r)}).`);let c=xr(qt);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await JS(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}return n.yes||W()?{agents:yu(t,wu(t,r).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await JS(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}var rx=D(require("os")),_n=D(require("path"));de();N();var Fn=1,OI=24,PI=100,nx=8,$I=5;function _o(e,t={}){if(e==="")return"";let r=_n.default.resolve(e),n=_n.default.resolve(t.cwd??process.cwd()),o=_n.default.resolve(t.home??rx.default.homedir()),i=QS(n,r);if(i!==null)return y(i===""?".":`.${_n.default.sep}${i}`);let s=QS(o,r);return s!==null?y(s===""?"~":`~${_n.default.sep}${s}`):y(r)}function Du(e={}){return t=>_o(t,e)}function QS(e,t){let r=_n.default.relative(e,t);return r===""?"":r.startsWith("..")||_n.default.isAbsolute(r)?null:r}var ex={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function Fg(e){let{plan:t,materialized:r,dryRun:n}=e,o=[],i=[];for(let g of t.skills){let m=ex[g.storeOverwrite];m!==void 0&&!t.force&&o.push({name:g.name,dir:g.dir,overwrite:g.storeOverwrite,reason:m,requiredFlag:"--force",...g.detail!==void 0?{detail:g.detail}:{}});for(let w of g.targets){if(!w.blocked)continue;let k=ex[w.overwrite];k!==void 0&&o.push({name:g.name,dir:g.dir,agent:w.agent,overwrite:w.overwrite,reason:k,requiredFlag:"--force",...w.detail!==void 0?{detail:w.detail}:{}})}}let s=new Map;for(let g of t.skills)for(let m of g.targets){if(!m.blocked)continue;let w=s.get(g.name)??new Set;w.add(m.path),s.set(g.name,w)}let a=0,l=0,c=0,d=0,p=0,h=0;for(let g of r){if(g.storeAction==="written"&&(l+=1),g.storeAction==="failed"){i.push({name:g.name,message:g.error??"the canonical store could not be written"});continue}if(g.storeAction!=="blocked"){(g.storeAction==="written"||g.storeAction==="adopted"||g.storeAction==="unchanged")&&(a+=1);for(let m of g.targets){if(m.skipped===!0){h+=1;continue}if(!m.success){if(s.get(g.name)?.has(m.path))continue;i.push({name:g.name,agent:m.agent,...m.errno!==void 0?{errno:m.errno}:{},message:m.error??"the destination could not be written"});continue}m.link==="symlink"&&(c+=1),m.link==="copy"&&m.requestedMode==="copy"&&(d+=1),m.symlinkFailed===!0&&(p+=1)}}}return n&&(h=t.skills.reduce((g,m)=>g+m.targets.filter(w=>w.skipped).length,0)),{blocked:o,failures:i,summary:{requested:t.skills.length,installed:a,skipped:h,blocked:o.length,failed:i.length,storeWrites:l,symlinks:c,copies:d,symlinkFallbacks:p}}}function Ag(e,t){let r=t.display??(o=>o),n=[];n.push(te(t.dryRun?"Installation plan (dry run)":"Installation plan")),n.push(` scope ${e.scope} (${r(e.root)})`),n.push(` source ${LI(e.source)}`),n.push(` store ${r(e.storeBase)}`),n.push(` mode ${e.mode}`);for(let o of e.skills)n.push(""),n.push(` ${y(o.dir)}`),n.push(` store ${r(o.storePath)}`),n.push(...NI(o,r)),o.blocked&&o.detail!==void 0&&n.push(` ${ne("blocked")} ${o.detail}`);if(e.warnings.length>0){n.push("");for(let o of e.warnings)n.push(` ${ne("\u26A0")} ${o}`)}return n.join(`
247
- `)}function LI(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${ox(e.commit)}${t}`}function ox(e){return e.slice(0,nx)}function NI(e,t){let r=[],n=e.targets.filter(s=>s.link==="canonical"),o=e.targets.filter(s=>!s.skipped&&s.link==="symlink"),i=e.targets.filter(s=>!s.skipped&&s.link==="copy");n.length>0&&r.push(` shared ${Ra(n)}`),o.length>0&&r.push(` symlink \u2192 ${tx(o,t)}`),i.length>0&&r.push(` copy \u2192 ${tx(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&r.push(` ${R("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&r.push(` overwrites ${s.label} ${R(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return r}function tx(e,t){if(e.length===1){let r=e[0];return`${r.label} (${t(r.path)})`}return Ra(e)}function Ra(e,t=$I){let r=e.map(n=>y(n.label));return r.length<=t?r.join(", "):`${r.slice(0,t).join(", ")} +${r.length-t} more`}function ix(e,t={}){let r=t.display??(i=>i),n=[],{summary:o}=e;n.push(V(`Installed ${o.installed} ${_g(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;n.push(` ${y(r(i.storePath))}`);let s=i.targets.filter(c=>c.success&&c.link==="canonical"),a=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="symlink"),l=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="copy");s.length>0&&n.push(` shared: ${Ra(s)}`),a.length>0&&n.push(` symlinked: ${Ra(a)}`),l.length>0&&n.push(` copied: ${Ra(l)}`),i.detail!==void 0&&n.push(` ${R(i.detail)}`)}if(o.symlinkFallbacks>0){let i=jI(e.materialized);n.push(`${ne("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${_g(o.symlinkFallbacks,"destination")}${i.length>0?` (${i.join(", ")})`:""}. Files were copied instead.`),n.push(" On Windows, enable Developer Mode in Settings, or pass --copy to make this the default and silence this warning.")}return n.push(...MI(e.blocked)),n.push(...BI(e.failures)),n.push(...ku(e.plan.warnings)),n.join(`
248
- `)}function jI(e){let t=new Set;for(let r of e)for(let n of r.targets)n.symlinkFailed===!0&&n.errno!==void 0&&t.add(n.errno);return[...t].sort()}function MI(e){if(e.length===0)return[];let t=["",ne(e.length===1?"1 destination needs --force and was left untouched:":`${e.length} destinations need --force and were left untouched:`)];for(let r of e){let n=r.agent===void 0?"shared store":y(r.agent);t.push(` \u2022 ${y(r.name)} (${n})`),r.detail!==void 0&&t.push(` ${r.detail}`)}return t}function BI(e){if(e.length===0)return[];let t=["",Lt(`${e.length} ${_g(e.length,"failure")}:`)];for(let r of e){let n=r.agent===void 0?"":` (${y(r.agent)})`;t.push(` \u2022 ${y(r.name)}${n}: ${y(r.message)}`)}return t}function ku(e){return e.length===0?[]:["",...e.map(t=>`${ne("\u26A0")} ${t}`)]}function _g(e,t){return e===1?t:`${t}s`}function bu(e){let{plan:t}=e,r=new Map(e.materialized.map(n=>[n.name,n]));return{kind:"skills.install",schemaVersion:Fn,dryRun:e.dryRun,restored:e.restored,scope:t.scope,root:t.root,store:t.storeBase,mode:t.mode,force:t.force,lockfile:e.lockfilePath,source:{...t.source,cacheHit:e.cacheHit},...e.extraSources!==void 0&&e.extraSources.length>0?{sources:[t.source,...e.extraSources]}:{},skills:t.skills.map(n=>UI(n,r.get(n.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function UI(e,t){let r=new Map((t?.targets??[]).map(n=>[n.path,n]));return{name:e.name,dir:e.dir,description:e.description,skillPath:e.skillPath,storePath:e.storePath,storeOverwrite:e.storeOverwrite,storeAction:t?.storeAction??null,contentHash:t?.hashes?.contentHash??null,modeHash:t?.hashes?.modeHash??null,upToDate:e.upToDate,fileCount:e.fileCount,byteCount:e.byteCount,blocked:e.blocked,detail:e.detail??null,targets:e.targets.map(n=>WI(n,r.get(n.path)))}}function WI(e,t){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:t?.link??e.link,overwrite:e.overwrite,blocked:e.blocked,skipped:t?.skipped??e.skipped,skipReason:t?.skipReason??e.skipReason??null,symlinkFailed:t?.symlinkFailed??!1,errno:t?.errno??null,error:t?.error??null}}var Fo=["name","dir","description","status","mode","agents","scope"],Ia="name,status,agents",Gi=["name","dir","status","scope"],HI={"up-to-date":V,modified:ne,missing:Lt,unmanaged:R};function sx(e,t,r={}){let n=r.columns??process.stdout.columns??PI,o=e.map(l=>t.map(c=>VI(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((d,p,h)=>{if(h===i)return d;let g=Math.max(p.length,...o.map(m=>m[h].length),0);return d+g+2},0),c=Math.max(OI,n-l-2);for(let d of o)d[i]=KI(d[i],c)}let s=t.map(l=>te(l)),a=o.map((l,c)=>l.map((d,p)=>t[p]==="status"?HI[e[c].status](d):d));return We(s,a)}function VI(e,t){switch(t){case"name":return y(e.name);case"dir":return y(e.dir);case"description":return y(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return GI(e);case"scope":return e.scope}}var ax="shared";function GI(e){let t=[],r=0;for(let n of e.agents){let o=y(n.id);if(!n.present){t.push(`${o} (missing)`);continue}if(n.link==="canonical"){r+=1;continue}t.push(o)}return r>0?[ax,...t].join(", "):t.join(", ")}function lx(e,t={}){let r=t.display??(s=>s),n=new Set;for(let s of e)for(let a of s.agents)a.present&&a.link==="canonical"&&n.add(a.id);if(n.size===0)return"";let o=[...n].sort().join(", "),i=t.store===void 0?"":` = ${r(t.store)}`;return R(`${ax}${i}, read directly by ${n.size} agent${n.size===1?"":"s"}:
249
- ${o}`)}function KI(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function cx(e,t={}){let r=t.display??(l=>l),n=e.scope==="project"?"Project":"Global",o=e.source.commit,i=e.source.pluginVersion,s=o===void 0?"":` (pinned ${ox(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return te(`${n} skills \u2014 ${r(a)}${s}`)}function Tg(e){let t={total:0,upToDate:0,modified:0,missing:0,unmanaged:0};for(let r of e)for(let n of r.skills)t.total+=1,n.status==="up-to-date"?t.upToDate+=1:n.status==="modified"?t.modified+=1:n.status==="missing"?t.missing+=1:t.unmanaged+=1;return t}function ux(e){return{kind:"skills.list",schemaVersion:Fn,scopes:e.inventories.map(t=>({scope:t.scope,root:t.root,store:t.store,lockfile:t.lockfile,source:t.source,skills:t.skills.map(r=>({name:r.name,dir:r.dir,description:r.description,skillPath:r.skillPath??null,storePath:r.storePath,recordedHash:r.recordedHash,onDiskHash:r.onDiskHash,status:r.status,statusDetail:r.statusDetail??null,mode:r.mode,commit:r.commit??null,ref:r.ref??null,category:r.category??null,agents:r.agents.map(n=>({id:n.id,label:n.label,path:n.path,link:n.link,present:n.present,diverged:n.diverged??!1}))}))})),summary:Tg(e.inventories),warnings:[...e.warnings]}}var Rg="No skills installed. Run `webflow skills install` to get started.";function dx(e,t){let r=t==="desc"?-1:1;return(n,o)=>{let i=String(n[e]??""),s=String(o[e]??"");return i===s?n.name<o.name?-1:n.name>o.name?1:0:(i<s?-1:1)*r}}function px(e){let t=[],{summary:r}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return Rg;if(e.source.upToDate)t.push(`${L} ${y(e.source.repo)}@${y(e.source.ref)} is still ${zI(e.source.resolvedCommit)} \u2014 all ${r.checked} skill${r.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${Fe} ${r.outdated+r.conflicts} of ${r.checked} skills would change.`:`${L} Updated ${r.updated} skill${r.updated===1?"":"s"}`+(r.blocked>0?`, skipped ${r.blocked}`:"")+(r.failed>0?`, ${r.failed} failed`:"");t.push(o)}let n=e.skills.filter(o=>!(e.source.upToDate&&o.state==="unchanged")).map(o=>[y(o.dir),o.action,o.detail?y(o.detail):""]);n.length>0&&t.push("",We(["SKILL","ACTION","DETAIL"],n));for(let o of e.skills)for(let i of o.targets)i.action==="relinked"&&t.push(` ${e.checkOnly?"would-relink":"relinked"} ${y(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${y(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${b} ${y(o.name)}: ${y(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
250
- `)}function zI(e){return e===null?"unknown":e.slice(0,nx)}function Ig(e,t,r={}){let n=i=>y((r.display??_o)(i)),o=[];o.push(`${r.dryRun?"Would remove":"Skills to remove"} ${e.length} skill${e.length===1?"":"s"} (${t} scope):`,"");for(let i of e){if(o.push(` ${y(i.name)} \u2192 ${y(i.dir)}`),!i.onDisk&&i.targets.length===0){o.push(" (lockfile entry only \u2014 no directory on disk; the stale entry will be removed)");continue}i.onDisk&&o.push(` ${n(i.storePath)} store (`+(i.storeWillBeDeleted?"delete":`keep \u2014 still referenced by ${i.keptBecause.map(s=>y(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${n(s.path)} ${y(s.label)} (unlink)`)}return r.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
251
- `)}function fx(e,t={}){let r=o=>y((t.display??_o)(o));if(e.skills.length===0)return"No skills removed.";let n=[];n.push(`${L} Removed ${e.summary.removed} skill${e.summary.removed===1?"":"s"}`+(e.summary.failed>0?`, ${e.summary.failed} failed`:""));for(let o of e.skills){let i=o.targets.filter(a=>a.action==="unlinked"),s=o.storeAction==="deleted"?"store directory deleted":o.storeAction==="kept"?`store kept \u2014 still used by ${o.keptBecause.map(a=>y(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";n.push(` ${y(o.name)} \u2014 unlinked from ${i.length} location${i.length===1?"":"s"}, ${s}`)}e.removedDirectories.length>0&&n.push(` removed empty directories: ${e.removedDirectories.map(o=>r(o)).join(", ")}`);for(let o of e.failures)n.push(`${b} ${y(o.name)}: ${y(o.message)}`);return e.lockfileDeleted?n.push(`${Fe} ${r(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&n.push(`${Fe} ${r(e.lockfile)} is now empty \u2014 commit the change, or delete the file if you are done with Webflow skills in this project.`),n.join(`
252
- `)}J();S();pe();Ae();x();N();z();pe();x();function JI(e){let t=_a(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${Ca.join(", ")} found in this directory.`}async function Eu(e,t,r){return!(e.global===!0||e.project===!0)&&(e.yes===!0||W())?(r||u.info(JI(t)),Fa(t)):hu(e,t)}function Ki(e){return e==="locally-modified"||e==="unmanaged"}var To=D(require("fs")),cr=D(require("path"));S();var Pg=require("crypto"),Cu=D(require("fs"));S();var Ao=D(require("fs")),_r=D(require("path"));S();var Og=2e3,gx=8;async function vu(e){let t=_r.default.resolve(e),r=[],n=[],o=async(i,s)=>{if(s>vo)throw new f(`Skill directory ${y(t)} nests deeper than ${vo} levels at ${y(i)}. Refusing to copy or hash a tree this deep.`);let a=await Ao.default.promises.readdir(i,{withFileTypes:!0});a.sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0);for(let l of a){let c=_r.default.join(i,l.name);if(Re(t,c,"a skill file"),l.isSymbolicLink()){n.push(mx(t,c));continue}if(l.isDirectory()){if(bo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||Eo.has(l.name))continue;let d=await Ao.default.promises.lstat(c);if(r.length>=Og)throw new f(`Skill directory ${y(t)} contains more than ${Og} files. Refusing to copy or hash it.`);let p=mx(t,c);r.push({rel:p,key:p.normalize("NFC"),abs:c,mode:d.mode&511,size:d.size})}};return await o(t,1),r.sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0),n.sort(),{files:r,symlinks:n}}function Su(e,t){let[r]=t.symlinks;if(r!==void 0)throw new f(`Skill directory ${y(e)} contains a symbolic link ("${y(r)}"); skill files must be regular files. If this came from ${ue}, please report it.`)}async function xu(e,t){let r=_r.default.resolve(e),n=_r.default.resolve(t),o=await vu(r);Su(r,o),await Ao.default.promises.mkdir(n,{recursive:!0});let i=new Set;for(let a of o.files){let l=_r.default.dirname(_r.default.join(n,...a.rel.split("/")));l!==n&&i.add(l)}for(let a of[...i].sort())Re(n,a,"a skill destination directory"),await Ao.default.promises.mkdir(a,{recursive:!0});let s=0;return await qI(o.files,gx,async a=>{let l=_r.default.join(n,...a.rel.split("/"));Re(n,l,"a skill destination file"),await Ao.default.promises.copyFile(a.abs,l),await Ao.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function mx(e,t){return _r.default.relative(e,t).split(_r.default.sep).join("/")}async function qI(e,t,r){let n=0,o=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;n<e.length;){let i=e[n++];if(i===void 0)return;await r(i)}});await Promise.all(o)}var yx=1024*1024,wx=4294967295,$g=Buffer.from([0]);async function _u(e){let t=await vu(e);Su(e,t);let r=(0,Pg.createHash)("sha256"),n=(0,Pg.createHash)("sha256"),o=0;for(let i of t.files)await YI(r,i),XI(n,i),o+=i.size;return{contentHash:`sha256:${r.digest("hex")}`,modeHash:`sha256:${n.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function Yt(e){try{return await _u(e)}catch(t){if(eO(t))return null;throw t}}function Pt(e,t,r=process.platform){return!e||!t||!e.contentHash||!t.contentHash||e.contentHash!==t.contentHash?!1:r==="win32"||!e.modeHash||!t.modeHash?!0:e.modeHash===t.modeHash}async function YI(e,t){if(t.size<=yx){let o=await Cu.default.promises.readFile(t.abs);return hx(e,t,o.length),e.update(o),o.length}let r=await ZI(t.abs);hx(e,t,r);let n=await QI(e,t.abs,r);if(n!==r)throw new f(`${y(t.abs)} changed while it was being hashed (${r} bytes, then ${n}). Re-run the command.`);return n}function hx(e,t,r){if(r>wx)throw new f(`${y(t.abs)} is ${r} bytes, which is too large to hash. Remove it from the skill folder and re-run.`);e.update(t.key,"utf8"),e.update($g);let n=Buffer.alloc(4);n.writeUInt32BE(r,0),e.update(n)}function XI(e,t){e.update(t.key,"utf8"),e.update($g),e.update((t.mode&73)!==0?"x":"-"),e.update($g)}async function ZI(e){let t=0;for await(let r of Cu.default.createReadStream(e))t+=r.length;return t}async function QI(e,t,r){let n=0;for await(let o of Cu.default.createReadStream(t)){let i=o;if(n+=i.length,n>r)return e.update(i.subarray(0,i.length-(n-r))),n;e.update(i)}return n}function eO(e){return An(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:An(e.cause)==="ENOENT"}function An(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var bx=require("crypto"),be=D(require("fs")),me=D(require("path"));S();x();var tO=/\.[0-9a-f]{6}\.tmp$/,Ex=3600*1e3;async function Ng(e,t=r=>r){let r=me.default.join(e,mu);for(let n of[r,me.default.join(r,gu)]){if(await vx(n)==="other")throw new f(`${y(t(n))} exists but is not a directory. The Webflow CLI needs it as the shared skills store. Remove or rename it, then re-run.`,{isUserError:!0});if(await Fu(e,n))throw new f(`${y(t(n))} resolves outside ${y(t(e))} once symlinks are followed. The Webflow CLI will not use it as the shared skills store. Remove or repoint it, then re-run.`,{isUserError:!0})}}async function Fu(e,t){if(!et(e,t)||await jg(e,t)!==void 0)return!0;try{await be.default.promises.lstat(t)}catch{return!1}return!await Yc(e,t)}async function jg(e,t){let r=me.default.resolve(e),n=me.default.relative(r,me.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(me.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=me.default.join(i,s);let a;try{a=await be.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await Yc(r,i))return i}}async function Au(e,t){let r=me.default.resolve(e),n=me.default.relative(r,me.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(me.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=me.default.join(i,s);let a=await vx(i);if(a==="absent")return;if(a==="other")return i}}async function Oa(e,t={}){if(t.dryRun)return[];let r=t.maxAgeMs??Ex,n=t.now??Date.now(),o=[],i;try{i=await be.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!tO.test(s.name))continue;let a=me.default.join(e,s.name);try{Re(e,a,"a stale staging directory");let l=await be.default.promises.lstat(a);if(n-l.mtimeMs<r)continue;await be.default.promises.rm(a,{recursive:!0,force:!0}),o.push(a)}catch(l){u.debug(`Could not sweep staging directory ${a}: ${l instanceof Error?l.message:String(l)}`)}}return o}async function Tu(e){let{storeDir:t,slug:r,root:n,mode:o,agent:i,label:s}=e,a=e.platform??process.platform,l=me.default.resolve(e.linkPath),c={agent:i,label:s,path:l,canonicalPath:t,requestedMode:o},d=w=>({...c,success:!1,link:o,error:w});if(me.default.basename(l)!==r)return d(`Refusing to write ${y(l)}: its final component is not "${y(r)}".`);let p=w=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${y(l)} for ${y(s)}: ${w}`});if(!et(n,l))return p(`it resolves outside ${y(n)}.`);let h=await jg(n,l);if(h!==void 0)return p(`${y(h)} is a symbolic link that leaves ${y(n)}.`);let g=await Au(n,l);if(g!==void 0)return d(`${y(g)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(He(t,l))return{...c,success:!0,link:"canonical"};let m=await oO(l,t);if(m&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!m){let[w,k]=await Promise.all([ir(t),ir(l)]);if(He(w,k))return{...c,success:!0,link:"canonical"};if(He(await kx(t),await kx(l)))return{...c,success:!0,link:"canonical"};if(await zm(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await Dx(t,l,r),{...c,success:!0,link:"copy"}}catch(w){return{...c,success:!1,link:"copy",errno:An(w),error:Lg(w)}}try{if(await iO(l,r),await be.default.promises.mkdir(me.default.dirname(l),{recursive:!0}),a==="win32")await be.default.promises.symlink(me.default.resolve(t),l,"junction");else{let w=await ir(me.default.dirname(l));await be.default.promises.symlink(me.default.relative(w,t),l)}return{...c,success:!0,link:"symlink"}}catch(w){let k=An(w);try{return await Dx(t,l,r),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:k}}catch(F){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:An(F)??k,error:Lg(F)}}}}async function Pa(e,t,r={}){if(Re(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),me.default.basename(t.storePath)!==t.dir)throw new f(`Refusing to write ${y(t.storePath)}: its final component is not "${y(t.dir)}". Please report this.`);let n={name:t.name,dir:t.dir,storePath:t.storePath};if(Ki(t.storeOverwrite)&&!e.force)return{...n,storeAction:"blocked",hashes:null,targets:[],success:!1,error:t.detail};let o,i,s;try{t.storeOverwrite==="adoptable"?(i="adopted",o=t.onDisk??t.upstream):t.upToDate?(i="unchanged",o=t.onDisk??t.upstream):await zm(t.sourceDir,t.storePath)?(i="unchanged",o=t.onDisk??t.upstream,s="the extracted source and the canonical store are the same directory; nothing to copy"):(o=await rO(t),i="written")}catch(l){return{...n,storeAction:"failed",hashes:null,targets:[],success:!1,error:Lg(l)}}let a=[];for(let l of t.targets)a.push(await nO(e,t,l,r));return{...n,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function rO(e){await be.default.promises.mkdir(me.default.dirname(e.storePath),{recursive:!0});let t=Bg(e.storePath);try{await xu(e.sourceDir,t),await Mg(e.storePath,e.dir),await be.default.promises.rename(t,e.storePath)}finally{await be.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return _u(e.storePath)}async function nO(e,t,r,n){let o={agent:r.agent,label:r.label,path:r.path,canonicalPath:t.storePath,requestedMode:e.mode};return r.link==="canonical"?{...o,success:!0,link:"canonical"}:r.skipped?{...o,success:!0,link:r.link,skipped:!0,skipReason:r.skipReason,error:void 0}:r.blocked?{...o,success:!1,link:r.link,error:r.detail}:Tu({storeDir:t.storePath,linkPath:r.path,slug:t.dir,root:e.root,mode:e.mode,agent:r.agent,label:r.label,platform:n.platform})}async function Dx(e,t,r){await be.default.promises.mkdir(me.default.dirname(t),{recursive:!0});let n=Bg(t);try{await xu(e,n),await Mg(t,r),await be.default.promises.rename(n,t)}finally{await be.default.promises.rm(n,{recursive:!0,force:!0}).catch(()=>{})}}async function oO(e,t){let r;try{r=await be.default.promises.lstat(e)}catch{return!1}if(!r.isSymbolicLink())return!1;let n=await be.default.promises.readlink(e).catch(()=>null);if(n===null)return!1;let o=me.default.resolve(me.default.dirname(e),n);if(He(o,t))return!0;let[i,s]=await Promise.all([ir(o),ir(t)]);return He(i,s)}async function iO(e,t){let r;try{r=await be.default.promises.lstat(e)}catch(n){An(n)==="ELOOP"&&await be.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(r.isSymbolicLink()){await be.default.promises.rm(e,{force:!0});return}await Mg(e,t)}async function Mg(e,t){if(me.default.basename(e)!==t)throw new f(`Refusing to delete ${y(e)}: its final component is not "${y(t)}". Please report this.`);let r;try{r=await be.default.promises.lstat(e)}catch{return}if(r.isSymbolicLink()){await be.default.promises.rm(e,{force:!0});return}await be.default.promises.rm(e,{recursive:!0,force:!0})}function Bg(e){return`${e}.${(0,bx.randomBytes)(3).toString("hex")}.tmp`}async function kx(e){let t=me.default.resolve(e),r=await ir(me.default.dirname(t));return me.default.join(r,me.default.basename(t))}async function vx(e){let t;try{t=await be.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await be.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function Lg(e){let t=e instanceof Error?e.message:String(e);return y(t)}var sO=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],aO=64;async function $a(e){let t=e.platform??process.platform,r=e.display??(c=>c),n=cr.default.resolve(e.root),o=rt(e.scope,n),i=e.recorded??{},s=new Set(e.warnings??[]);await Ng(n,r);let a=await lO({targets:e.targets,scope:e.scope,root:n,storeBase:o,display:r,warn:c=>s.add(c)});for(let c of await pO({groups:a,skills:e.skills,display:r}))s.add(c);let l=[];for(let c of e.skills)l.push(await dO({discovered:c,groups:a,storeBase:o,mode:e.mode,force:e.force,recorded:i[c.name]??null,platform:t,display:r}));return{scope:e.scope,root:n,storeBase:o,mode:e.mode,force:e.force,source:e.source,skills:l,warnings:[...s],blocked:l.filter(c=>c.blocked)}}async function lO(e){let{targets:t,scope:r,root:n,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let d=Ot(c.agent,r,n);if(d===null){s(`${y(c.agent.displayName)} does not support ${r} installation and was skipped.`);continue}let p=a.get(d);p?(p.agents.push(c.agent),p.explicit=p.explicit||c.explicit):a.set(d,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,d]of a){let p=d.agents.slice().sort((m,w)=>m.id<w.id?-1:m.id>w.id?1:0);if(He(c,o)){l.push({dir:c,agents:p,canonical:!0});continue}if(await Fu(n,c)){let m=Ru(c),w=`${y(i(c))} resolves outside ${y(i(n))}`+(m?` (check $${m})`:"")+"; refusing to install there.";s(w),l.push({dir:c,agents:p,canonical:!1,skipReason:"unsafe-destination",detail:w});continue}let h=await Au(n,c);if(h!==void 0){let m=`${y(i(h))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(m),l.push({dir:c,agents:p,canonical:!1,skipReason:"path-conflict",detail:m});continue}if(!(d.explicit||await uO(d.agents,r,n,c))){l.push({dir:c,agents:p,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${y(i(o))}`});continue}l.push({dir:c,agents:p,canonical:!1})}return l}function cO(e,t,r,n){if(t==="global")return cr.default.dirname(n);let[o]=e.skillsDir.split(/[\\/]/);return cr.default.join(r,o??e.skillsDir)}async function uO(e,t,r,n){for(let o of e)if(await fO(cO(o,t,r,n)))return!0;return!1}async function dO(e){let{discovered:t,groups:r,storeBase:n,mode:o,force:i,platform:s,display:a}=e,l=cr.default.join(n,t.dir),c=await mO(t.path),d=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,p=e.recorded!==null&&d===null,h=await xx({dest:l,storePath:l,recorded:d,recordedUnverifiable:p,upstream:c,platform:s}),g=[];for(let F of r){let A=F.canonical?l:cr.default.join(F.dir,t.dir),E=F.canonical?"canonical":o;if(F.canonical||F.skipReason!==void 0){g.push({agent:Cx(F),agents:F.agents.map(B=>B.id),label:_x(F),path:A,link:E,overwrite:F.canonical?h.overwrite:"fresh",blocked:F.canonical?h.blocked:!1,skipped:!F.canonical,...F.skipReason!==void 0?{skipReason:F.skipReason}:{},...F.detail!==void 0?{detail:F.detail}:{}});continue}let v=await xx({dest:A,storePath:l,recorded:d,recordedUnverifiable:p,upstream:c,platform:s}),M=Ki(v.overwrite)&&!i;g.push({agent:Cx(F),agents:F.agents.map(B=>B.id),label:_x(F),path:A,link:E,overwrite:v.overwrite,blocked:M,skipped:!1,...M?{detail:Sx(v,A,a)}:{}})}let m=Ki(h.overwrite)&&!i,w=g.find(F=>F.blocked),k=m?Sx(h,l,a):w?.detail;return{name:t.name,dir:t.dir,description:t.description,skillPath:t.skillPath,sourceDir:t.path,storePath:l,storeOverwrite:h.overwrite,upToDate:h.upToDate,targets:g,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:h.onDisk,recorded:d,blocked:m||w!==void 0,...k!==void 0?{detail:k}:{}}}function Sx(e,t,r){return e.problem===void 0?Ax(e.overwrite,t,r):`${y(r(t))} could not be verified: ${e.problem} It was not installed by the Webflow CLI, or has been changed since. Re-run with --force to replace it.`}async function xx(e){let{dest:t,storePath:r,recorded:n,upstream:o,platform:i}=e,s=(c,d,p)=>({overwrite:c,upToDate:d,onDisk:p,blocked:!1}),a;try{a=await To.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await To.default.promises.readlink(t).catch(()=>null),d=c===null?null:cr.default.resolve(cr.default.dirname(t),c);return d!==null&&He(d,r)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await Yt(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:y(c instanceof Error?c.message:String(c))}}if(l===null)return s("fresh",!1,null);if(n===null&&e.recordedUnverifiable)return s("managed-update",!1,l);if(n!==null)return Pt(l,n,i)?s("managed-update",Pt(l,o,i),l):s("locally-modified",!1,l);if(Pt(l,o,i)){let c=await Fx(t);return c===void 0?s("adoptable",!0,l):{overwrite:"unmanaged",upToDate:!1,onDisk:l,blocked:!1,problem:`it matches the pinned upstream content but also contains "${y(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function Fx(e,t="",r=0){if(r>vo)return;let n;try{n=await To.default.promises.readdir(e,{withFileTypes:!0})}catch{return}n.sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0);for(let o of n){let i=t===""?o.name:`${t}/${o.name}`;if(o.isDirectory()){if(bo.has(o.name))return i;let s=await Fx(cr.default.join(e,o.name),i,r+1);if(s!==void 0)return s;continue}if(!o.isFile()||Eo.has(o.name))return i}}function Ax(e,t,r=n=>n){let n=y(r(t));return e==="locally-modified"?`${n} was installed by the Webflow CLI and has been edited since. Re-run with --force to discard those edits and replace it.`:`${n} already exists, differs from the pinned upstream content, and was not installed by the Webflow CLI (no lockfile entry). It may be managed by another tool \u2014 the Claude Code plugin marketplace installs the same skills. Re-run with --force to take ownership and replace it.`}async function pO(e){let{groups:t,skills:r,display:n}=e,o=new Map(r.map(s=>[s.name,s.dir]));if(o.size===0)return[];let i=[];for(let s of t){if(s.skipReason!==void 0)continue;let a;try{a=await To.default.promises.readdir(s.dir,{withFileTypes:!0})}catch{continue}a.sort((c,d)=>c.name<d.name?-1:c.name>d.name?1:0);let l=aO;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let d=cr.default.join(s.dir,c.name,Rt),p;try{p=So(await To.default.promises.readFile(d,"utf8")).frontmatter.name}catch{continue}let h=o.get(p);h===void 0||h===c.name||i.push(`${y(n(s.dir))} already contains "${y(c.name)}", whose ${Rt} declares the name "${y(p)}" \u2014 the same skill this install writes to "${y(h)}". Your agent would load it twice; remove one of them.`)}}return i}function Ru(e){let t=cr.default.resolve(e);for(let r of sO){let n=process.env[r]?.trim();if(n&&et(n,t))return r}}function Cx(e){return e.agents[0]?.id??""}function _x(e){let t=e.agents.map(r=>r.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function fO(e){try{return await To.default.promises.lstat(e),!0}catch{return!1}}async function mO(e){let t=await Yt(e);if(t!==null)return t;throw new f(`The extracted skill directory ${y(e)} is no longer present. Re-run the command.`)}var $t=1,Px=/^sha256:[0-9a-f]{64}$/,Ug=128,Wg=1024,Tx=256,gO=/[\x00-\x1f\x7f]/;function $x(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>Ug?`must be at most ${Ug} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":Ii(e)}function Iu(e){return e.trim()===""?"must not be empty":e.length>Wg?`must be at most ${Wg} characters`:Ii(e)}function Rx(e){return(t,r)=>{let n=e(t);n!==null&&r.addIssue({code:$.ZodIssueCode.custom,message:n})}}var Lx=$.string().regex(zt,"must be a 40-character lowercase commit SHA"),Nx=$.string().regex(Qc,"is not a usable git ref for this repository"),Ix=$.string().regex(Px,'must look like "sha256:<64 lowercase hex>"'),hO=$.string().min(1,"must not be empty").max(uu).refine(e=>e.trim()!=="","must not be blank").refine(e=>!gO.test(e),"must not contain control characters"),Ox=$.string().datetime({offset:!0}),jx=$.object({commit:Lx,dir:$.string().superRefine(Rx($x)),skillPath:$.string().superRefine(Rx(Iu)).optional(),contentHash:Ix.optional(),modeHash:Ix.optional(),ref:Nx.optional(),agents:$.array($.string().min(1).max(64)).default([]),mode:$.enum(["symlink","copy"]).default("symlink"),category:$.string().min(1).max(64).optional(),installedAt:Ox.optional(),updatedAt:Ox.optional()}).passthrough(),Mx=$.object({repo:$.string().min(1).max(Tx).default(ue),ref:Nx.default(je),commit:Lx.optional(),pluginVersion:$.string().min(1).max(Tx).optional()}).passthrough(),Bx=$.object({lockfileVersion:$.number().int().min(0),source:Mx.default({}),skills:$.record(hO,jx).default({})}).passthrough();function Ux(e){return e.length===0?"the lockfile":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?t:/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`).join("")}function Hg(e){let[t]=e.issues;return t?`${Ux([...t.path])} ${t.message}`:"did not match the expected shape"}function Ou(e){return Bx.safeParse(e)}var Pu=D(require("path"));ml();S();var Wx="webflow-skills-lock.json",Hx="skills-lock.json";function Ro(e){if(typeof e!="string"||e.trim()==="")throw new f("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return Pu.default.join(Pu.default.resolve(e),Wx)}function Io(){return Pu.default.join(fl(),Hx)}function La(e,t){return e==="global"?Io():Ro(t??"")}var Gx=D(require("fs"));var yO=/^<{7}/m,wO=/^\uFEFF/;async function Fr(e){let t;try{t=await Gx.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:DO(c)}}let r=t.replace(wO,"");if(yO.test(r))return{kind:"corrupt",path:e,reason:"merge-conflict",detail:"unresolved merge-conflict markers"};if(r.trim()==="")return{kind:"corrupt",path:e,reason:"invalid-json",detail:"the file is empty"};let n;try{n=JSON.parse(r)}catch(c){return{kind:"corrupt",path:e,reason:"invalid-json",detail:kO(c,r)}}if(n===null||typeof n!="object"||Array.isArray(n))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${Vx(n)}, not an object`};let o=n,i=o.lockfileVersion;if(i!==void 0&&!Number.isInteger(i))return{kind:"corrupt",path:e,reason:"schema",detail:`lockfileVersion must be an integer (got ${Vx(i)})`};let s=typeof i=="number"?i:0;if(s>$t){let c=Ou(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<$t?{...o,lockfileVersion:$t}:o,l=Ou(a);return l.success?s<$t?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:Hg(l.error)}}function DO(e){let t=e.code,r=e instanceof Error?e.message:String(e);return t?`${{EACCES:"permission denied",EPERM:"operation not permitted",EISDIR:"the path is a directory, not a file",ELOOP:"too many symbolic links",ENOTDIR:"a parent path component is not a directory"}[t]??r} (${t})`:r}function kO(e,t){let r=e instanceof Error?e.message:String(e),n=/position (\d+)/.exec(r);if(!n)return r;let o=Number(n[1]);if(!Number.isFinite(o)||o<0)return r;let i=t.slice(0,o),s=i.split(`
254
+ This is a bug in ${he}. Please report it.`)}function Ch(e){return kC(e,t=>t.name)}function Fh(e){let[t,...n]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${D(e.value)}": ${e.skills.map(r=>D(r.skillPath)).join(", ")}. Using ${D(t?.skillPath??"")} and ignoring ${n.length===1?"the other":"the others"}. This is a bug in ${he}. Please report it.`}function kC(e,t){let n=new Map;for(let r of e){let o=t(r),i=n.get(o);i?i.push(r):n.set(o,[r])}return[...n.entries()].filter(([,r])=>r.length>1).map(([r,o])=>({value:r,skills:o}))}var ws=w(require("fs")),Zt=w(require("path"));C();async function Ds(e,t){Be(t,e,"the catalog skills directory");let n=[],r=[],o=[],i=new Set,s=p=>(o.push(...p.warnings),p.kind==="skipped"?(r.push({skillPath:p.skillPath,reason:p.reason}),!1):(n.push(p.skill),!p.skill.internal));for(let p of await ol(e,"the catalog skills directory")){if(rl.has(p.name))continue;let m=Zt.default.join(e,p.name);if(!await _h(m,p))continue;let h=await vC(m);if(h.kind!=="none"&&i.add(h.path),!(h.kind!=="none"&&s(await EC({skillDir:m,manifest:h,extractRoot:t}))))for(let g of await ol(m)){if(rl.has(g.name))continue;let y=Zt.default.join(m,g.name);if(!await _h(y,g))continue;let b=await vC(y);b.kind!=="none"&&(i.add(b.path),s(await EC({skillDir:y,manifest:b,extractRoot:t,parentCategory:p.name})))}}let a=await gO(n),l=Ch(a),c=new Set;for(let p of l){o.push(Fh(p));for(let m of p.skills.slice(1))c.add(m.skillPath)}let d=a.filter(p=>!c.has(p.skillPath));xh(d),o.push(...await hO(e,t,i));for(let p of r)o.push(`Skipped ${p.skillPath} \u2014 ${p.reason}`);return r.length>0&&o.push(`${r.length} skill${r.length===1?" was":"s were"} skipped. ${r.length===1?"This is a defect":"These are defects"} in ${he} \u2014 please report ${r.length===1?"it":"them"} at ${Ho}.`),{skills:d,skipped:r,warnings:o}}async function EC(e){let{skillDir:t,manifest:n,extractRoot:r,parentCategory:o}=e,i=CC(r,n.path),s=[],a=g=>({kind:"skipped",skillPath:i,reason:D(g),warnings:s});if(n.kind==="symlink")return a(`${$t} is a symbolic link; skill files must be regular files`);let l;try{l=await ws.default.promises.readFile(n.path,"utf8")}catch(g){return a(`failed to read file: ${g instanceof Error?g.message:String(g)}`)}let c;try{c=Ko(l).frontmatter}catch(g){if(g instanceof Ot)return a(g.reason);throw g}let d=D(c.name),p=D(c.description);if(d==="")return a(`frontmatter name "${D(c.name)}" cannot be used as a directory name`);let m=ys(d);if(m===void 0)return a(`frontmatter name "${d}" cannot be used as a directory name`);Sh(d)||s.push(`${i} declares a non-standard skill name "${d}"; it installs as "${m}". This is a bug in ${he}.`);let h=await mO(t,n.path);return h.symlink?a(`contains a symbolic link (${h.symlink}); skill files must be regular files`):(h.truncated&&s.push(`${i} sits in a directory with more than ${rd} files; only the first ${rd} are listed.`),{kind:"skill",warnings:s,skill:{name:d,dir:m,folderName:Vr(i),description:p,category:Eh(c)??o,internal:kh(c),path:t,skillPath:i,supplementaryFiles:h.files}})}async function vC(e){let t=Zt.default.join(e,$t),n=await SC(t);if(n)return n;let r=$t.toLowerCase();for(let o of await ol(e)){if(o.name===$t||o.name.toLowerCase()!==r)continue;let i=await SC(Zt.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function SC(e){try{let t=await ws.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function _h(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await ws.default.promises.stat(e)).isDirectory()}catch{return!1}}async function ol(e,t){try{return(await ws.default.promises.readdir(e,{withFileTypes:!0})).sort((r,o)=>r.name<o.name?-1:r.name>o.name?1:0)}catch(n){if(!t)return[];throw new f(`Failed to read ${t} (${D(e)}): ${n instanceof Error?n.message:String(n)}`)}}async function mO(e,t){let n=[],r,o=!1,i=async(s,a)=>{if(!(a>Jo||r!==void 0))for(let l of await ol(s)){if(r!==void 0)return;let c=Zt.default.join(s,l.name);if(l.isSymbolicLink()){r=xC(e,c);return}if(l.isDirectory()){if(Vo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!Go.has(l.name)&&c!==t){if(n.length>=rd){o=!0;return}n.push(xC(e,c))}}};return await i(e,1),{files:n.sort(),symlink:r,truncated:o}}async function gO(e){let t=new Set,n=[];for(let r of e){let o;try{o=await ws.default.promises.realpath(r.path)}catch{o=Zt.default.resolve(r.path)}t.has(o)||(t.add(o),n.push(r))}return n}async function hO(e,t,n){let r=[],o=fC,i=async(s,a)=>{if(!(a>mC||o<=0)){o-=1;for(let l of await ol(s)){if(rl.has(l.name))continue;let c=Zt.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===$t.toLowerCase()){n.has(c)||r.push(CC(t,c));continue}await _h(c,l)&&await i(c,a+1)}}};return await i(e,1),r.length===0?[]:[`${r.length} ${$t} file(s) in the catalog sit outside the layout this CLI reads (for example ${r[0]}) and were ignored. ${he} may have changed its layout; please report it at ${Ho}.`]}function CC(e,t){return Zt.default.relative(e,t).split(Zt.default.sep).join("/")}function xC(e,t){return Zt.default.relative(e,t).split(Zt.default.sep).join("/")}var gn=w(require("os")),Pn=w(require("path"));function zo(e,t){let n=process.env[e]?.trim();return n||t}function FC(e){let t=process.env[e]?.trim();return t||void 0}var ue={home:()=>gn.default.homedir(),configHome:()=>zo("XDG_CONFIG_HOME",Pn.default.join(gn.default.homedir(),".config")),hardcodedConfigHome:()=>Pn.default.join(gn.default.homedir(),".config"),claudeHome:()=>zo("CLAUDE_CONFIG_DIR",Pn.default.join(gn.default.homedir(),".claude")),codexHome:()=>zo("CODEX_HOME",Pn.default.join(gn.default.homedir(),".codex")),vibeHome:()=>zo("VIBE_HOME",Pn.default.join(gn.default.homedir(),".vibe")),hermesHome:()=>zo("HERMES_HOME",Pn.default.join(gn.default.homedir(),".hermes")),autohandHome:()=>zo("AUTOHAND_HOME",Pn.default.join(gn.default.homedir(),".autohand")),grokHome:()=>zo("GROK_HOME",Pn.default.join(gn.default.homedir(),".grok")),appData:()=>FC("APPDATA"),flatpakConfigHome:()=>FC("FLATPAK_XDG_CONFIG_HOME")};function hn(...e){return Pn.default.join(gn.default.homedir(),...e)}var jC=w(require("fs")),ke=w(require("path"));C();M();var xt=w(require("path"));var Ah=[".openclaw",".clawdbot",".moltbot"];function _C(e,t){let n=Ah.find(r=>t(xt.default.join(e,r)));return xt.default.join(e,n??Ah[0],"skills")}function AC(e,t){return Ah.some(n=>t(xt.default.join(e,n)))}function IC(e,t,n=ue.appData(),r=ue.flatpakConfigHome()){return!!(t(xt.default.join(e,"zed"))||n&&t(xt.default.join(n,"Zed"))||r&&t(xt.default.join(r,"zed")))}var wO="/Applications/ZCode.app";function RC(e,t){return t(xt.default.join(e,".zcode"))||t(wO)}function TC(e,t){return t(xt.default.join(e,"kimchi"))}var DO="/etc/codex";function PC(e,t){return t(e)||t(DO)}function $C(e,t){return t(xt.default.join(e,".replit"))}function OC(e,t){return t(xt.default.join(e,".promptscript"))||t(xt.default.join(e,"promptscript.yaml"))}function LC(e,t,n){return n(xt.default.join(t,"data","skills"))||n(xt.default.join(e,".astrbot"))}function NC(){return!1}function bO(e){try{return jC.default.existsSync(e)}catch{return!1}}function fe(e,t,n){return{id:e,displayName:t,skillsDir:`${n}/skills`,globalSkillsDir:()=>hn(n,"skills"),detect:r=>r.pathExists(ke.default.join(r.homeDir,n)),sharedStore:!1}}function ot(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>hn(...e.global),detect:t=>t.pathExists(ke.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Xe=".agents/skills",il=[fe("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.configHome(),"agents","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"amp")),sharedStore:!0},ot({id:"antigravity",displayName:"Antigravity",project:Xe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),ot({id:"antigravity-cli",displayName:"Antigravity CLI",project:Xe,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>hn(".astrbot","data","skills"),detect:e=>LC(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>ke.default.join(ue.autohandHome(),"skills"),detect:e=>e.pathExists(ue.autohandHome()),sharedStore:!1},fe("augment","Augment",".augment"),fe("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>ke.default.join(ue.claudeHome(),"skills"),detect:e=>e.pathExists(ue.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>_C(ue.home(),bO),detect:e=>AC(e.homeDir,e.pathExists),sharedStore:!1},ot({id:"cline",displayName:"Cline",project:Xe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),fe("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>hn(".codebuddy","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".codebuddy"))||e.pathExists(ke.default.join(e.homeDir,".codebuddy")),sharedStore:!1},fe("codemaker","Codemaker",".codemaker"),fe("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.codexHome(),"skills"),detect:e=>PC(ue.codexHome(),e.pathExists),sharedStore:!0},fe("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>hn(".continue","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".continue"))||e.pathExists(ke.default.join(e.homeDir,".continue")),sharedStore:!1},ot({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>ke.default.join(ue.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(ke.default.join(ue.hardcodedConfigHome(),"crush")),sharedStore:!1},ot({id:"cursor",displayName:"Cursor",project:Xe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),ot({id:"deepagents",displayName:"Deep Agents",project:Xe,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>ke.default.join(ue.configHome(),"devin","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"devin")),sharedStore:!1},ot({id:"dexto",displayName:"Dexto",project:Xe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),fe("droid","Droid",".factory"),ot({id:"firebender",displayName:"Firebender",project:Xe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),fe("forgecode","ForgeCode",".forge"),ot({id:"gemini-cli",displayName:"Gemini CLI",project:Xe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),ot({id:"github-copilot",displayName:"GitHub Copilot",project:Xe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>ke.default.join(ue.configHome(),"goose","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>ke.default.join(ue.grokHome(),"skills"),detect:e=>e.pathExists(ue.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>ke.default.join(ue.hermesHome(),"skills"),detect:e=>e.pathExists(ue.hermesHome()),sharedStore:!1},fe("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>hn(".jazz","skills"),detect:e=>e.pathExists(ke.default.join(e.homeDir,".jazz"))||e.pathExists(ke.default.join(e.cwd,".jazz")),sharedStore:!1},fe("junie","Junie",".junie"),fe("iflow-cli","iFlow CLI",".iflow"),fe("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>ke.default.join(ue.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>TC(ue.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Xe,globalSkillsDir:()=>hn(".agents","skills"),detect:e=>e.pathExists(ke.default.join(e.homeDir,".kimi-code"))||e.pathExists(ke.default.join(e.homeDir,".kimi")),sharedStore:!0},fe("kiro-cli","Kiro CLI",".kiro"),fe("kode","Kode",".kode"),fe("lingma","Lingma",".lingma"),ot({id:"loaf",displayName:"Loaf",project:Xe,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),fe("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>ke.default.join(ue.vibeHome(),"skills"),detect:e=>e.pathExists(ue.vibeHome()),sharedStore:!1},fe("moxby","Moxby",".moxby"),fe("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.configHome(),"opencode","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"opencode")),sharedStore:!0},fe("openhands","OpenHands",".openhands"),fe("ona","Ona",".ona"),ot({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),fe("qoder","Qoder",".qoder"),ot({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),fe("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.configHome(),"agents","skills"),detect:e=>$C(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},fe("reasonix","Reasonix",".reasonix"),fe("rovodev","Rovo Dev",".rovodev"),fe("roo","Roo Code",".roo"),ot({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),fe("terramind","Terramind",".terramind"),fe("tinycloud","Tinycloud",".tinycloud"),fe("trae","Trae",".trae"),ot({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),ot({id:"warp",displayName:"Warp",project:Xe,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),ot({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Xe,globalSkillsDir:()=>hn(".agents","skills"),detect:e=>IC(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>hn(".zcode","skills"),detect:e=>RC(e.homeDir,e.pathExists),sharedStore:!1},fe("zencoder","Zencoder",".zencoder"),fe("zenflow","Zenflow",".zencoder"),fe("neovate","Neovate",".neovate"),fe("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Xe,globalSkillsDir:()=>{},detect:e=>OC(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},fe("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Xe,globalSkillsDir:()=>ke.default.join(ue.configHome(),"agents","skills"),detect:NC,sharedStore:!0,showInSharedList:!1}],Ih=new Map(il.map(e=>[e.id,e])),qo=il.map(e=>e.id);function sl(e){return Ih.has(e)}function $n(e){return Ih.get(e)}function sd(e){let t=Ih.get(e);if(t)return t;throw new f(`${k} Unknown agent: ${D(e)}
255
+ ${qo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function ad(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function On(e){return il.filter(t=>ad(t,e))}var Rh=w(require("path"));C();M();var ld=".agents",cd="skills";function it(e,t){let n=e==="global"?ue.home():t;return Rh.default.join(n,ld,cd)}function Lt(e,t,n){if(t==="global")return e.globalSkillsDir()??null;let r=Rh.default.resolve(n,...e.skillsDir.split("/"));return Be(n,r,`${e.id} project skills directory`),r}function Th(e,t,n){return qe(Lt(e,t,n),it(t,n))}var Ph=w(require("fs")),MC=w(require("path"));function kO(e){try{return Ph.default.existsSync(e)}catch{return!1}}function EO(e){try{let t=JSON.parse(Ph.default.readFileSync(MC.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function BC(e){return{homeDir:ue.home(),configHome:ue.configHome(),cwd:e,pathExists:kO,readPackageJson:EO}}async function al(e,t,n=BC(t)){return UC(On(e),n).map(r=>r.id)}function UC(e,t){return e.filter(n=>{try{return n.detect(t)}catch{return!1}})}var WC=w(require("fs")),HC=w(require("path"));C();we();Te();_();M();var ll=[".git","package.json","webflow.json"];function cl(e){for(let t of ll)try{if(WC.default.existsSync(HC.default.join(e,t)))return t}catch{}return null}function ul(e){return cl(e)===null?"global":"project"}function VC(e){let t=cl(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${ll.join(", ")} found in this directory.`}async function ud(e,t){if(e.global&&e.project)throw new f(`${k} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let n=ul(t);return e.yes||V()?(u.info(VC(t)),n):Me({message:"Where should these skills be installed?",default:n,choices:[{value:"project",name:"This project \u2014 skills live in the repository"},{value:"global",name:"Globally \u2014 skills available in every project"}]})}C();we();Te();_();M();var dl="all",Qt="universal",vO=6,SO=20,xO=80;function bs(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function CO(e,t){let n=Array.from({length:t.length+1},(r,o)=>o);for(let r=1;r<=e.length;r+=1){let o=[r];for(let i=1;i<=t.length;i+=1)o[i]=Math.min(n[i]+1,o[i-1]+1,n[i-1]+(e[r-1]===t[i-1]?0:1));n=o}return n[t.length]}function KC(e){let t=e.toLowerCase(),n=Math.max(1,Math.floor(t.length/3)),r=null,o=Number.POSITIVE_INFINITY;for(let i of qo){let s=CO(t,i);s<o&&(o=s,r=i)}return o<=n?r:null}function ks(e){let t=e.filter(n=>!sl(n));if(t.length>0){let n=Array.from(new Set(t.map(o=>KC(o)).filter(o=>o!==null))),r=n.length>0?` Did you mean: ${n.join(", ")}?
256
+ `:"";throw new f(`${k} Unknown agent(s): ${t.map(o=>D(o)).join(", ")}
257
+ `+r+` ${qo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(n=>$n(n))}function pd(e,t){return On(e).filter(n=>Th(n,e,t))}function zC(e,t){return pd(e,t).filter(n=>n.showInSharedList!==!1)}function qC(e,t){let r=e.filter(s=>s.showInSharedPrompt!==!1).slice(0,Math.max(0,t)),o=e.length-r.length,i=r.map(s=>s.displayName).join(", ");return o>0?`${i} +${o} more`:i}function XC(e,t,n=vO){return qC(zC(e,t),n)}function GC(e,t){let n=process.stdout.columns??xO,r=Math.max(20,n-t);return e.length<=r?e:`${e.slice(0,r-1)}\u2026`}function FO(e,t,n){return t==="project"?e.skillsDir:Lt(e,t,n)??""}function dd(e,...t){let n=new Set(t.flat());return On(e).filter(r=>n.has(r.id))}async function JC(e,t,n){let r=pd(e,t),o=new Set(r.map(p=>p.id)),i=On(e).filter(p=>!o.has(p.id)),s=new Set(n),a=XC(e,t),l=it(e,t),c=[];r.length>0&&c.push({value:"",name:GC(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let p of i){let m=FO(p,e,t),h=s.has(p.id)?" (detected)":"";c.push({value:p.id,name:GC(`${p.displayName} ${m}${h}`,8),checked:s.has(p.id)})}let d=await En({message:r.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(SO,Math.max(4,c.length)),validate:p=>p.length>0||r.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return dd(e,r.map(p=>p.id),(d??[]).filter(Boolean))}async function pl(e){let{scope:t,cwd:n,options:r}=e,o=bs(r.agent),i=r.allAgents===!0||o.includes(dl),s=o.filter(c=>c!==dl),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(d=>sl(d));return{agents:dd(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(d=>!sl(d))}}if(s.length>0&&!i){let c=ks(s),d=c.filter(p=>!ad(p,t));if(d.length>0){let p=d.map(m=>m.displayName).join(", ");throw new f(`${k} ${p} does not support global skill installation \u2014 its skills live inside a project.
258
+ Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:dd(t,c.map(p=>p.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...On(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await al(t,n);if(l.length===0){if(V()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${it(t,n)}).`);let c=$n(Qt);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await JC(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}return r.yes||V()?{agents:dd(t,pd(t,n).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await JC(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}var eF=w(require("os")),Gr=w(require("path"));pe();M();var Jr=1,_O=24,AO=100,tF=8,IO=5;function Xo(e,t={}){if(e==="")return"";let n=Gr.default.resolve(e),r=Gr.default.resolve(t.cwd??process.cwd()),o=Gr.default.resolve(t.home??eF.default.homedir()),i=YC(r,n);if(i!==null)return D(i===""?".":`.${Gr.default.sep}${i}`);let s=YC(o,n);return s!==null?D(s===""?"~":`~${Gr.default.sep}${s}`):D(n)}function fd(e={}){return t=>Xo(t,e)}function YC(e,t){let n=Gr.default.relative(e,t);return n===""?"":n.startsWith("..")||Gr.default.isAbsolute(n)?null:n}var ZC={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function Oh(e){let{plan:t,materialized:n,dryRun:r}=e,o=[],i=[];for(let h of t.skills){let g=ZC[h.storeOverwrite];g!==void 0&&!t.force&&o.push({name:h.name,dir:h.dir,overwrite:h.storeOverwrite,reason:g,requiredFlag:"--force",...h.detail!==void 0?{detail:h.detail}:{}});for(let y of h.targets){if(!y.blocked)continue;let b=ZC[y.overwrite];b!==void 0&&o.push({name:h.name,dir:h.dir,agent:y.agent,overwrite:y.overwrite,reason:b,requiredFlag:"--force",...y.detail!==void 0?{detail:y.detail}:{}})}}let s=new Map;for(let h of t.skills)for(let g of h.targets){if(!g.blocked)continue;let y=s.get(h.name)??new Set;y.add(g.path),s.set(h.name,y)}let a=0,l=0,c=0,d=0,p=0,m=0;for(let h of n){if(h.storeAction==="written"&&(l+=1),h.storeAction==="failed"){i.push({name:h.name,message:h.error??"the canonical store could not be written"});continue}if(h.storeAction!=="blocked"){(h.storeAction==="written"||h.storeAction==="adopted"||h.storeAction==="unchanged")&&(a+=1);for(let g of h.targets){if(g.skipped===!0){m+=1;continue}if(!g.success){if(s.get(h.name)?.has(g.path))continue;i.push({name:h.name,agent:g.agent,...g.errno!==void 0?{errno:g.errno}:{},message:g.error??"the destination could not be written"});continue}g.link==="symlink"&&(c+=1),g.link==="copy"&&g.requestedMode==="copy"&&(d+=1),g.symlinkFailed===!0&&(p+=1)}}}return r&&(m=t.skills.reduce((h,g)=>h+g.targets.filter(y=>y.skipped).length,0)),{blocked:o,failures:i,summary:{requested:t.skills.length,installed:a,skipped:m,blocked:o.length,failed:i.length,storeWrites:l,symlinks:c,copies:d,symlinkFallbacks:p}}}function Lh(e,t){let n=t.display??(o=>o),r=[];r.push(se(t.dryRun?"Installation plan (dry run)":"Installation plan")),r.push(` scope ${e.scope} (${n(e.root)})`),r.push(` source ${RO(e.source)}`),r.push(` store ${n(e.storeBase)}`),r.push(` mode ${e.mode}`);for(let o of e.skills)r.push(""),r.push(` ${D(o.dir)}`),r.push(` store ${n(o.storePath)}`),r.push(...TO(o,n)),o.blocked&&o.detail!==void 0&&r.push(` ${le("blocked")} ${o.detail}`);if(e.warnings.length>0){r.push("");for(let o of e.warnings)r.push(` ${le("\u26A0")} ${o}`)}return r.join(`
259
+ `)}function RO(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${nF(e.commit)}${t}`}function nF(e){return e.slice(0,tF)}function TO(e,t){let n=[],r=e.targets.filter(s=>s.link==="canonical"),o=e.targets.filter(s=>!s.skipped&&s.link==="symlink"),i=e.targets.filter(s=>!s.skipped&&s.link==="copy");r.length>0&&n.push(` shared ${fl(r)}`),o.length>0&&n.push(` symlink \u2192 ${QC(o,t)}`),i.length>0&&n.push(` copy \u2192 ${QC(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&n.push(` ${R("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&n.push(` overwrites ${s.label} ${R(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return n}function QC(e,t){if(e.length===1){let n=e[0];return`${n.label} (${t(n.path)})`}return fl(e)}function fl(e,t=IO){let n=e.map(r=>D(r.label));return n.length<=t?n.join(", "):`${n.slice(0,t).join(", ")} +${n.length-t} more`}function rF(e,t={}){let n=t.display??(i=>i),r=[],{summary:o}=e;r.push(K(`Installed ${o.installed} ${$h(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;r.push(` ${D(n(i.storePath))}`);let s=i.targets.filter(c=>c.success&&c.link==="canonical"),a=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="symlink"),l=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="copy");s.length>0&&r.push(` shared: ${fl(s)}`),a.length>0&&r.push(` symlinked: ${fl(a)}`),l.length>0&&r.push(` copied: ${fl(l)}`),i.detail!==void 0&&r.push(` ${R(i.detail)}`)}if(o.symlinkFallbacks>0){let i=PO(e.materialized);r.push(`${le("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${$h(o.symlinkFallbacks,"destination")}${i.length>0?` (${i.join(", ")})`:""}. Files were copied instead.`),r.push(" On Windows, enable Developer Mode in Settings, or pass --copy to make this the default and silence this warning.")}return r.push(...$O(e.blocked)),r.push(...OO(e.failures)),r.push(...md(e.plan.warnings)),r.join(`
260
+ `)}function PO(e){let t=new Set;for(let n of e)for(let r of n.targets)r.symlinkFailed===!0&&r.errno!==void 0&&t.add(r.errno);return[...t].sort()}function $O(e){if(e.length===0)return[];let t=["",le(e.length===1?"1 destination needs --force and was left untouched:":`${e.length} destinations need --force and were left untouched:`)];for(let n of e){let r=n.agent===void 0?"shared store":D(n.agent);t.push(` \u2022 ${D(n.name)} (${r})`),n.detail!==void 0&&t.push(` ${n.detail}`)}return t}function OO(e){if(e.length===0)return[];let t=["",Mt(`${e.length} ${$h(e.length,"failure")}:`)];for(let n of e){let r=n.agent===void 0?"":` (${D(n.agent)})`;t.push(` \u2022 ${D(n.name)}${r}: ${D(n.message)}`)}return t}function md(e){return e.length===0?[]:["",...e.map(t=>`${le("\u26A0")} ${t}`)]}function $h(e,t){return e===1?t:`${t}s`}function gd(e){let{plan:t}=e,n=new Map(e.materialized.map(r=>[r.name,r]));return{kind:"skills.install",schemaVersion:Jr,dryRun:e.dryRun,restored:e.restored,scope:t.scope,root:t.root,store:t.storeBase,mode:t.mode,force:t.force,lockfile:e.lockfilePath,source:{...t.source,cacheHit:e.cacheHit},...e.extraSources!==void 0&&e.extraSources.length>0?{sources:[t.source,...e.extraSources]}:{},skills:t.skills.map(r=>LO(r,n.get(r.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function LO(e,t){let n=new Map((t?.targets??[]).map(r=>[r.path,r]));return{name:e.name,dir:e.dir,description:e.description,skillPath:e.skillPath,storePath:e.storePath,storeOverwrite:e.storeOverwrite,storeAction:t?.storeAction??null,contentHash:t?.hashes?.contentHash??null,modeHash:t?.hashes?.modeHash??null,upToDate:e.upToDate,fileCount:e.fileCount,byteCount:e.byteCount,blocked:e.blocked,detail:e.detail??null,targets:e.targets.map(r=>NO(r,n.get(r.path)))}}function NO(e,t){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:t?.link??e.link,overwrite:e.overwrite,blocked:e.blocked,skipped:t?.skipped??e.skipped,skipReason:t?.skipReason??e.skipReason??null,symlinkFailed:t?.symlinkFailed??!1,errno:t?.errno??null,error:t?.error??null}}var Yo=["name","dir","description","status","mode","agents","scope"],ml="name,status,agents",Es=["name","dir","status","scope"],jO={"up-to-date":K,modified:le,missing:Mt,unmanaged:R};function oF(e,t,n={}){let r=n.columns??process.stdout.columns??AO,o=e.map(l=>t.map(c=>MO(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((d,p,m)=>{if(m===i)return d;let h=Math.max(p.length,...o.map(g=>g[m].length),0);return d+h+2},0),c=Math.max(_O,r-l-2);for(let d of o)d[i]=UO(d[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((d,p)=>t[p]==="status"?jO[e[c].status](d):d));return ze(s,a)}function MO(e,t){switch(t){case"name":return D(e.name);case"dir":return D(e.dir);case"description":return D(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return BO(e);case"scope":return e.scope}}var iF="shared";function BO(e){let t=[],n=0;for(let r of e.agents){let o=D(r.id);if(!r.present){t.push(`${o} (missing)`);continue}if(r.link==="canonical"){n+=1;continue}t.push(o)}return n>0?[iF,...t].join(", "):t.join(", ")}function sF(e,t={}){let n=t.display??(s=>s),r=new Set;for(let s of e)for(let a of s.agents)a.present&&a.link==="canonical"&&r.add(a.id);if(r.size===0)return"";let o=[...r].sort().join(", "),i=t.store===void 0?"":` = ${n(t.store)}`;return R(`${iF}${i}, read directly by ${r.size} agent${r.size===1?"":"s"}:
261
+ ${o}`)}function UO(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function aF(e,t={}){let n=t.display??(l=>l),r=e.scope==="project"?"Project":"Global",o=e.source.commit,i=e.source.pluginVersion,s=o===void 0?"":` (pinned ${nF(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${r} skills \u2014 ${n(a)}${s}`)}function Nh(e){let t={total:0,upToDate:0,modified:0,missing:0,unmanaged:0};for(let n of e)for(let r of n.skills)t.total+=1,r.status==="up-to-date"?t.upToDate+=1:r.status==="modified"?t.modified+=1:r.status==="missing"?t.missing+=1:t.unmanaged+=1;return t}function lF(e){return{kind:"skills.list",schemaVersion:Jr,scopes:e.inventories.map(t=>({scope:t.scope,root:t.root,store:t.store,lockfile:t.lockfile,source:t.source,skills:t.skills.map(n=>({name:n.name,dir:n.dir,description:n.description,skillPath:n.skillPath??null,storePath:n.storePath,recordedHash:n.recordedHash,onDiskHash:n.onDiskHash,status:n.status,statusDetail:n.statusDetail??null,mode:n.mode,commit:n.commit??null,ref:n.ref??null,category:n.category??null,agents:n.agents.map(r=>({id:r.id,label:r.label,path:r.path,link:r.link,present:r.present,diverged:r.diverged??!1}))}))})),summary:Nh(e.inventories),warnings:[...e.warnings]}}var jh="No skills installed. Run `webflow skills install` to get started.";function cF(e,t){let n=t==="desc"?-1:1;return(r,o)=>{let i=String(r[e]??""),s=String(o[e]??"");return i===s?r.name<o.name?-1:r.name>o.name?1:0:(i<s?-1:1)*n}}function uF(e){let t=[],{summary:n}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return jh;if(e.source.upToDate)t.push(`${$} ${D(e.source.repo)}@${D(e.source.ref)} is still ${WO(e.source.resolvedCommit)} \u2014 all ${n.checked} skill${n.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${je} ${n.outdated+n.conflicts} of ${n.checked} skills would change.`:`${$} Updated ${n.updated} skill${n.updated===1?"":"s"}`+(n.blocked>0?`, skipped ${n.blocked}`:"")+(n.failed>0?`, ${n.failed} failed`:"");t.push(o)}let r=e.skills.filter(o=>!(e.source.upToDate&&o.state==="unchanged")).map(o=>[D(o.dir),o.action,o.detail?D(o.detail):""]);r.length>0&&t.push("",ze(["SKILL","ACTION","DETAIL"],r));for(let o of e.skills)for(let i of o.targets)i.action==="relinked"&&t.push(` ${e.checkOnly?"would-relink":"relinked"} ${D(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${D(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${k} ${D(o.name)}: ${D(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
262
+ `)}function WO(e){return e===null?"unknown":e.slice(0,tF)}function Mh(e,t,n={}){let r=i=>D((n.display??Xo)(i)),o=[];o.push(`${n.dryRun?"Would remove":"Skills to remove"} ${e.length} skill${e.length===1?"":"s"} (${t} scope):`,"");for(let i of e){if(o.push(` ${D(i.name)} \u2192 ${D(i.dir)}`),!i.onDisk&&i.targets.length===0){o.push(" (lockfile entry only \u2014 no directory on disk; the stale entry will be removed)");continue}i.onDisk&&o.push(` ${r(i.storePath)} store (`+(i.storeWillBeDeleted?"delete":`keep \u2014 still referenced by ${i.keptBecause.map(s=>D(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${r(s.path)} ${D(s.label)} (unlink)`)}return n.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
263
+ `)}function dF(e,t={}){let n=o=>D((t.display??Xo)(o));if(e.skills.length===0)return"No skills removed.";let r=[];r.push(`${$} Removed ${e.summary.removed} skill${e.summary.removed===1?"":"s"}`+(e.summary.failed>0?`, ${e.summary.failed} failed`:""));for(let o of e.skills){let i=o.targets.filter(a=>a.action==="unlinked"),s=o.storeAction==="deleted"?"store directory deleted":o.storeAction==="kept"?`store kept \u2014 still used by ${o.keptBecause.map(a=>D(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";r.push(` ${D(o.name)} \u2014 unlinked from ${i.length} location${i.length===1?"":"s"}, ${s}`)}e.removedDirectories.length>0&&r.push(` removed empty directories: ${e.removedDirectories.map(o=>n(o)).join(", ")}`);for(let o of e.failures)r.push(`${k} ${D(o.name)}: ${D(o.message)}`);return e.lockfileDeleted?r.push(`${je} ${n(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&r.push(`${je} ${n(e.lockfile)} is now empty \u2014 commit the change, or delete the file if you are done with Webflow skills in this project.`),r.join(`
264
+ `)}q();C();we();Te();_();M();X();we();_();function HO(e){let t=cl(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${ll.join(", ")} found in this directory.`}async function hd(e,t,n){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(n||u.info(HO(t)),ul(t)):ud(e,t)}function vs(e){return e==="locally-modified"||e==="unmanaged"}var Qo=w(require("fs")),yn=w(require("path"));C();var Uh=require("crypto"),bd=w(require("fs"));C();var Zo=w(require("fs")),Ln=w(require("path"));C();var Bh=2e3,fF=8;async function yd(e){let t=Ln.default.resolve(e),n=[],r=[],o=async(i,s)=>{if(s>Jo)throw new f(`Skill directory ${D(t)} nests deeper than ${Jo} levels at ${D(i)}. Refusing to copy or hash a tree this deep.`);let a=await Zo.default.promises.readdir(i,{withFileTypes:!0});a.sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0);for(let l of a){let c=Ln.default.join(i,l.name);if(Be(t,c,"a skill file"),l.isSymbolicLink()){r.push(pF(t,c));continue}if(l.isDirectory()){if(Vo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||Go.has(l.name))continue;let d=await Zo.default.promises.lstat(c);if(n.length>=Bh)throw new f(`Skill directory ${D(t)} contains more than ${Bh} files. Refusing to copy or hash it.`);let p=pF(t,c);n.push({rel:p,key:p.normalize("NFC"),abs:c,mode:d.mode&511,size:d.size})}};return await o(t,1),n.sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0),r.sort(),{files:n,symlinks:r}}function wd(e,t){let[n]=t.symlinks;if(n!==void 0)throw new f(`Skill directory ${D(e)} contains a symbolic link ("${D(n)}"); skill files must be regular files. If this came from ${he}, please report it.`)}async function Dd(e,t){let n=Ln.default.resolve(e),r=Ln.default.resolve(t),o=await yd(n);wd(n,o),await Zo.default.promises.mkdir(r,{recursive:!0});let i=new Set;for(let a of o.files){let l=Ln.default.dirname(Ln.default.join(r,...a.rel.split("/")));l!==r&&i.add(l)}for(let a of[...i].sort())Be(r,a,"a skill destination directory"),await Zo.default.promises.mkdir(a,{recursive:!0});let s=0;return await VO(o.files,fF,async a=>{let l=Ln.default.join(r,...a.rel.split("/"));Be(r,l,"a skill destination file"),await Zo.default.promises.copyFile(a.abs,l),await Zo.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function pF(e,t){return Ln.default.relative(e,t).split(Ln.default.sep).join("/")}async function VO(e,t,n){let r=0,o=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;r<e.length;){let i=e[r++];if(i===void 0)return;await n(i)}});await Promise.all(o)}var gF=1024*1024,hF=4294967295,Wh=Buffer.from([0]);async function kd(e){let t=await yd(e);wd(e,t);let n=(0,Uh.createHash)("sha256"),r=(0,Uh.createHash)("sha256"),o=0;for(let i of t.files)await GO(n,i),JO(r,i),o+=i.size;return{contentHash:`sha256:${n.digest("hex")}`,modeHash:`sha256:${r.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function en(e){try{return await kd(e)}catch(t){if(qO(t))return null;throw t}}function Nt(e,t,n=process.platform){return!e||!t||!e.contentHash||!t.contentHash||e.contentHash!==t.contentHash?!1:n==="win32"||!e.modeHash||!t.modeHash?!0:e.modeHash===t.modeHash}async function GO(e,t){if(t.size<=gF){let o=await bd.default.promises.readFile(t.abs);return mF(e,t,o.length),e.update(o),o.length}let n=await KO(t.abs);mF(e,t,n);let r=await zO(e,t.abs,n);if(r!==n)throw new f(`${D(t.abs)} changed while it was being hashed (${n} bytes, then ${r}). Re-run the command.`);return r}function mF(e,t,n){if(n>hF)throw new f(`${D(t.abs)} is ${n} bytes, which is too large to hash. Remove it from the skill folder and re-run.`);e.update(t.key,"utf8"),e.update(Wh);let r=Buffer.alloc(4);r.writeUInt32BE(n,0),e.update(r)}function JO(e,t){e.update(t.key,"utf8"),e.update(Wh),e.update((t.mode&73)!==0?"x":"-"),e.update(Wh)}async function KO(e){let t=0;for await(let n of bd.default.createReadStream(e))t+=n.length;return t}async function zO(e,t,n){let r=0;for await(let o of bd.default.createReadStream(t)){let i=o;if(r+=i.length,r>n)return e.update(i.subarray(0,i.length-(r-n))),r;e.update(i)}return r}function qO(e){return Kr(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:Kr(e.cause)==="ENOENT"}function Kr(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var DF=require("crypto"),_e=w(require("fs")),Ee=w(require("path"));C();_();var XO=/\.[0-9a-f]{6}\.tmp$/,bF=3600*1e3;async function Vh(e,t=n=>n){let n=Ee.default.join(e,ld);for(let r of[n,Ee.default.join(n,cd)]){if(await kF(r)==="other")throw new f(`${D(t(r))} exists but is not a directory. The Webflow CLI needs it as the shared skills store. Remove or rename it, then re-run.`,{isUserError:!0});if(await Ed(e,r))throw new f(`${D(t(r))} resolves outside ${D(t(e))} once symlinks are followed. The Webflow CLI will not use it as the shared skills store. Remove or repoint it, then re-run.`,{isUserError:!0})}}async function Ed(e,t){if(!rt(e,t)||await Gh(e,t)!==void 0)return!0;try{await _e.default.promises.lstat(t)}catch{return!1}return!await Vu(e,t)}async function Gh(e,t){let n=Ee.default.resolve(e),r=Ee.default.relative(n,Ee.default.resolve(t));if(r===""||r.startsWith(".."))return;let o=r.split(Ee.default.sep).filter(s=>s!==""),i=n;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a;try{a=await _e.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await Vu(n,i))return i}}async function vd(e,t){let n=Ee.default.resolve(e),r=Ee.default.relative(n,Ee.default.resolve(t));if(r===""||r.startsWith(".."))return;let o=r.split(Ee.default.sep).filter(s=>s!==""),i=n;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a=await kF(i);if(a==="absent")return;if(a==="other")return i}}async function gl(e,t={}){if(t.dryRun)return[];let n=t.maxAgeMs??bF,r=t.now??Date.now(),o=[],i;try{i=await _e.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!XO.test(s.name))continue;let a=Ee.default.join(e,s.name);try{Be(e,a,"a stale staging directory");let l=await _e.default.promises.lstat(a);if(r-l.mtimeMs<n)continue;await _e.default.promises.rm(a,{recursive:!0,force:!0}),o.push(a)}catch(l){u.debug(`Could not sweep staging directory ${a}: ${l instanceof Error?l.message:String(l)}`)}}return o}async function Sd(e){let{storeDir:t,slug:n,root:r,mode:o,agent:i,label:s}=e,a=e.platform??process.platform,l=Ee.default.resolve(e.linkPath),c={agent:i,label:s,path:l,canonicalPath:t,requestedMode:o},d=y=>({...c,success:!1,link:o,error:y});if(Ee.default.basename(l)!==n)return d(`Refusing to write ${D(l)}: its final component is not "${D(n)}".`);let p=y=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${D(l)} for ${D(s)}: ${y}`});if(!rt(r,l))return p(`it resolves outside ${D(r)}.`);let m=await Gh(r,l);if(m!==void 0)return p(`${D(m)} is a symbolic link that leaves ${D(r)}.`);let h=await vd(r,l);if(h!==void 0)return d(`${D(h)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(qe(t,l))return{...c,success:!0,link:"canonical"};let g=await QO(l,t);if(g&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!g){let[y,b]=await Promise.all([fn(t),fn(l)]);if(qe(y,b))return{...c,success:!0,link:"canonical"};if(qe(await wF(t),await wF(l)))return{...c,success:!0,link:"canonical"};if(await eh(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await yF(t,l,n),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:Kr(y),error:Hh(y)}}try{if(await eL(l,n),await _e.default.promises.mkdir(Ee.default.dirname(l),{recursive:!0}),a==="win32")await _e.default.promises.symlink(Ee.default.resolve(t),l,"junction");else{let y=await fn(Ee.default.dirname(l));await _e.default.promises.symlink(Ee.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let b=Kr(y);try{return await yF(t,l,n),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:b}}catch(S){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:Kr(S)??b,error:Hh(S)}}}}async function hl(e,t,n={}){if(Be(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),Ee.default.basename(t.storePath)!==t.dir)throw new f(`Refusing to write ${D(t.storePath)}: its final component is not "${D(t.dir)}". Please report this.`);let r={name:t.name,dir:t.dir,storePath:t.storePath};if(vs(t.storeOverwrite)&&!e.force)return{...r,storeAction:"blocked",hashes:null,targets:[],success:!1,error:t.detail};let o,i,s;try{t.storeOverwrite==="adoptable"?(i="adopted",o=t.onDisk??t.upstream):t.upToDate?(i="unchanged",o=t.onDisk??t.upstream):await eh(t.sourceDir,t.storePath)?(i="unchanged",o=t.onDisk??t.upstream,s="the extracted source and the canonical store are the same directory; nothing to copy"):(o=await YO(t),i="written")}catch(l){return{...r,storeAction:"failed",hashes:null,targets:[],success:!1,error:Hh(l)}}let a=[];for(let l of t.targets)a.push(await ZO(e,t,l,n));return{...r,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function YO(e){await _e.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=Kh(e.storePath);try{await Dd(e.sourceDir,t),await Jh(e.storePath,e.dir),await _e.default.promises.rename(t,e.storePath)}finally{await _e.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return kd(e.storePath)}async function ZO(e,t,n,r){let o={agent:n.agent,label:n.label,path:n.path,canonicalPath:t.storePath,requestedMode:e.mode};return n.link==="canonical"?{...o,success:!0,link:"canonical"}:n.skipped?{...o,success:!0,link:n.link,skipped:!0,skipReason:n.skipReason,error:void 0}:n.blocked?{...o,success:!1,link:n.link,error:n.detail}:Sd({storeDir:t.storePath,linkPath:n.path,slug:t.dir,root:e.root,mode:e.mode,agent:n.agent,label:n.label,platform:r.platform})}async function yF(e,t,n){await _e.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let r=Kh(t);try{await Dd(e,r),await Jh(t,n),await _e.default.promises.rename(r,t)}finally{await _e.default.promises.rm(r,{recursive:!0,force:!0}).catch(()=>{})}}async function QO(e,t){let n;try{n=await _e.default.promises.lstat(e)}catch{return!1}if(!n.isSymbolicLink())return!1;let r=await _e.default.promises.readlink(e).catch(()=>null);if(r===null)return!1;let o=Ee.default.resolve(Ee.default.dirname(e),r);if(qe(o,t))return!0;let[i,s]=await Promise.all([fn(o),fn(t)]);return qe(i,s)}async function eL(e,t){let n;try{n=await _e.default.promises.lstat(e)}catch(r){Kr(r)==="ELOOP"&&await _e.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(n.isSymbolicLink()){await _e.default.promises.rm(e,{force:!0});return}await Jh(e,t)}async function Jh(e,t){if(Ee.default.basename(e)!==t)throw new f(`Refusing to delete ${D(e)}: its final component is not "${D(t)}". Please report this.`);let n;try{n=await _e.default.promises.lstat(e)}catch{return}if(n.isSymbolicLink()){await _e.default.promises.rm(e,{force:!0});return}await _e.default.promises.rm(e,{recursive:!0,force:!0})}function Kh(e){return`${e}.${(0,DF.randomBytes)(3).toString("hex")}.tmp`}async function wF(e){let t=Ee.default.resolve(e),n=await fn(Ee.default.dirname(t));return Ee.default.join(n,Ee.default.basename(t))}async function kF(e){let t;try{t=await _e.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await _e.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function Hh(e){let t=e instanceof Error?e.message:String(e);return D(t)}var tL=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],nL=64;async function yl(e){let t=e.platform??process.platform,n=e.display??(c=>c),r=yn.default.resolve(e.root),o=it(e.scope,r),i=e.recorded??{},s=new Set(e.warnings??[]);await Vh(r,n);let a=await rL({targets:e.targets,scope:e.scope,root:r,storeBase:o,display:n,warn:c=>s.add(c)});for(let c of await aL({groups:a,skills:e.skills,display:n}))s.add(c);let l=[];for(let c of e.skills)l.push(await sL({discovered:c,groups:a,storeBase:o,mode:e.mode,force:e.force,recorded:i[c.name]??null,platform:t,display:n}));return{scope:e.scope,root:r,storeBase:o,mode:e.mode,force:e.force,source:e.source,skills:l,warnings:[...s],blocked:l.filter(c=>c.blocked)}}async function rL(e){let{targets:t,scope:n,root:r,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let d=Lt(c.agent,n,r);if(d===null){s(`${D(c.agent.displayName)} does not support ${n} installation and was skipped.`);continue}let p=a.get(d);p?(p.agents.push(c.agent),p.explicit=p.explicit||c.explicit):a.set(d,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,d]of a){let p=d.agents.slice().sort((g,y)=>g.id<y.id?-1:g.id>y.id?1:0);if(qe(c,o)){l.push({dir:c,agents:p,canonical:!0});continue}if(await Ed(r,c)){let g=xd(c),y=`${D(i(c))} resolves outside ${D(i(r))}`+(g?` (check $${g})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:p,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await vd(r,c);if(m!==void 0){let g=`${D(i(m))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(g),l.push({dir:c,agents:p,canonical:!1,skipReason:"path-conflict",detail:g});continue}if(!(d.explicit||await iL(d.agents,n,r,c))){l.push({dir:c,agents:p,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${D(i(o))}`});continue}l.push({dir:c,agents:p,canonical:!1})}return l}function oL(e,t,n,r){if(t==="global")return yn.default.dirname(r);let[o]=e.skillsDir.split(/[\\/]/);return yn.default.join(n,o??e.skillsDir)}async function iL(e,t,n,r){for(let o of e)if(await lL(oL(o,t,n,r)))return!0;return!1}async function sL(e){let{discovered:t,groups:n,storeBase:r,mode:o,force:i,platform:s,display:a}=e,l=yn.default.join(r,t.dir),c=await cL(t.path),d=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,p=e.recorded!==null&&d===null,m=await vF({dest:l,storePath:l,recorded:d,recordedUnverifiable:p,upstream:c,platform:s}),h=[];for(let S of n){let A=S.canonical?l:yn.default.join(S.dir,t.dir),v=S.canonical?"canonical":o;if(S.canonical||S.skipReason!==void 0){h.push({agent:SF(S),agents:S.agents.map(H=>H.id),label:xF(S),path:A,link:v,overwrite:S.canonical?m.overwrite:"fresh",blocked:S.canonical?m.blocked:!1,skipped:!S.canonical,...S.skipReason!==void 0?{skipReason:S.skipReason}:{},...S.detail!==void 0?{detail:S.detail}:{}});continue}let x=await vF({dest:A,storePath:l,recorded:d,recordedUnverifiable:p,upstream:c,platform:s}),O=vs(x.overwrite)&&!i;h.push({agent:SF(S),agents:S.agents.map(H=>H.id),label:xF(S),path:A,link:v,overwrite:x.overwrite,blocked:O,skipped:!1,...O?{detail:EF(x,A,a)}:{}})}let g=vs(m.overwrite)&&!i,y=h.find(S=>S.blocked),b=g?EF(m,l,a):y?.detail;return{name:t.name,dir:t.dir,description:t.description,skillPath:t.skillPath,sourceDir:t.path,storePath:l,storeOverwrite:m.overwrite,upToDate:m.upToDate,targets:h,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:m.onDisk,recorded:d,blocked:g||y!==void 0,...b!==void 0?{detail:b}:{}}}function EF(e,t,n){return e.problem===void 0?FF(e.overwrite,t,n):`${D(n(t))} could not be verified: ${e.problem} It was not installed by the Webflow CLI, or has been changed since. Re-run with --force to replace it.`}async function vF(e){let{dest:t,storePath:n,recorded:r,upstream:o,platform:i}=e,s=(c,d,p)=>({overwrite:c,upToDate:d,onDisk:p,blocked:!1}),a;try{a=await Qo.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await Qo.default.promises.readlink(t).catch(()=>null),d=c===null?null:yn.default.resolve(yn.default.dirname(t),c);return d!==null&&qe(d,n)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await en(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:D(c instanceof Error?c.message:String(c))}}if(l===null)return s("fresh",!1,null);if(r===null&&e.recordedUnverifiable)return s("managed-update",!1,l);if(r!==null)return Nt(l,r,i)?s("managed-update",Nt(l,o,i),l):s("locally-modified",!1,l);if(Nt(l,o,i)){let c=await CF(t);return c===void 0?s("adoptable",!0,l):{overwrite:"unmanaged",upToDate:!1,onDisk:l,blocked:!1,problem:`it matches the pinned upstream content but also contains "${D(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function CF(e,t="",n=0){if(n>Jo)return;let r;try{r=await Qo.default.promises.readdir(e,{withFileTypes:!0})}catch{return}r.sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0);for(let o of r){let i=t===""?o.name:`${t}/${o.name}`;if(o.isDirectory()){if(Vo.has(o.name))return i;let s=await CF(yn.default.join(e,o.name),i,n+1);if(s!==void 0)return s;continue}if(!o.isFile()||Go.has(o.name))return i}}function FF(e,t,n=r=>r){let r=D(n(t));return e==="locally-modified"?`${r} was installed by the Webflow CLI and has been edited since. Re-run with --force to discard those edits and replace it.`:`${r} already exists, differs from the pinned upstream content, and was not installed by the Webflow CLI (no lockfile entry). It may be managed by another tool \u2014 the Claude Code plugin marketplace installs the same skills. Re-run with --force to take ownership and replace it.`}async function aL(e){let{groups:t,skills:n,display:r}=e,o=new Map(n.map(s=>[s.name,s.dir]));if(o.size===0)return[];let i=[];for(let s of t){if(s.skipReason!==void 0)continue;let a;try{a=await Qo.default.promises.readdir(s.dir,{withFileTypes:!0})}catch{continue}a.sort((c,d)=>c.name<d.name?-1:c.name>d.name?1:0);let l=nL;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let d=yn.default.join(s.dir,c.name,$t),p;try{p=Ko(await Qo.default.promises.readFile(d,"utf8")).frontmatter.name}catch{continue}let m=o.get(p);m===void 0||m===c.name||i.push(`${D(r(s.dir))} already contains "${D(c.name)}", whose ${$t} declares the name "${D(p)}" \u2014 the same skill this install writes to "${D(m)}". Your agent would load it twice; remove one of them.`)}}return i}function xd(e){let t=yn.default.resolve(e);for(let n of tL){let r=process.env[n]?.trim();if(r&&rt(r,t))return n}}function SF(e){return e.agents[0]?.id??""}function xF(e){let t=e.agents.map(n=>n.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function lL(e){try{return await Qo.default.promises.lstat(e),!0}catch{return!1}}async function cL(e){let t=await en(e);if(t!==null)return t;throw new f(`The extracted skill directory ${D(e)} is no longer present. Re-run the command.`)}var jt=1,TF=/^sha256:[0-9a-f]{64}$/,zh=128,qh=1024,_F=256,uL=/[\x00-\x1f\x7f]/;function PF(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>zh?`must be at most ${zh} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":cs(e)}function Cd(e){return e.trim()===""?"must not be empty":e.length>qh?`must be at most ${qh} characters`:cs(e)}function AF(e){return(t,n)=>{let r=e(t);r!==null&&n.addIssue({code:j.ZodIssueCode.custom,message:r})}}var $F=j.string().regex(Yt,"must be a 40-character lowercase commit SHA"),OF=j.string().regex(Ku,"is not a usable git ref for this repository"),IF=j.string().regex(TF,'must look like "sha256:<64 lowercase hex>"'),dL=j.string().min(1,"must not be empty").max(od).refine(e=>e.trim()!=="","must not be blank").refine(e=>!uL.test(e),"must not contain control characters"),RF=j.string().datetime({offset:!0}),LF=j.object({commit:$F,dir:j.string().superRefine(AF(PF)),skillPath:j.string().superRefine(AF(Cd)).optional(),contentHash:IF.optional(),modeHash:IF.optional(),ref:OF.optional(),agents:j.array(j.string().min(1).max(64)).default([]),mode:j.enum(["symlink","copy"]).default("symlink"),category:j.string().min(1).max(64).optional(),installedAt:RF.optional(),updatedAt:RF.optional()}).passthrough(),NF=j.object({repo:j.string().min(1).max(_F).default(he),ref:OF.default(Ge),commit:$F.optional(),pluginVersion:j.string().min(1).max(_F).optional()}).passthrough(),jF=j.object({lockfileVersion:j.number().int().min(0),source:NF.default({}),skills:j.record(dL,LF).default({})}).passthrough();function MF(e){return e.length===0?"the lockfile":e.map((t,n)=>typeof t=="number"?`[${t}]`:n===0?t:/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`).join("")}function Xh(e){let[t]=e.issues;return t?`${MF([...t.path])} ${t.message}`:"did not match the expected shape"}function Fd(e){return jF.safeParse(e)}var _d=w(require("path"));ql();C();var BF="webflow-skills-lock.json",UF="skills-lock.json";function ei(e){if(typeof e!="string"||e.trim()==="")throw new f("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return _d.default.join(_d.default.resolve(e),BF)}function ti(){return _d.default.join(zl(),UF)}function wl(e,t){return e==="global"?ti():ei(t??"")}var HF=w(require("fs"));var pL=/^<{7}/m,fL=/^\uFEFF/;async function Nn(e){let t;try{t=await HF.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:mL(c)}}let n=t.replace(fL,"");if(pL.test(n))return{kind:"corrupt",path:e,reason:"merge-conflict",detail:"unresolved merge-conflict markers"};if(n.trim()==="")return{kind:"corrupt",path:e,reason:"invalid-json",detail:"the file is empty"};let r;try{r=JSON.parse(n)}catch(c){return{kind:"corrupt",path:e,reason:"invalid-json",detail:gL(c,n)}}if(r===null||typeof r!="object"||Array.isArray(r))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${WF(r)}, not an object`};let o=r,i=o.lockfileVersion;if(i!==void 0&&!Number.isInteger(i))return{kind:"corrupt",path:e,reason:"schema",detail:`lockfileVersion must be an integer (got ${WF(i)})`};let s=typeof i=="number"?i:0;if(s>jt){let c=Fd(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<jt?{...o,lockfileVersion:jt}:o,l=Fd(a);return l.success?s<jt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:Xh(l.error)}}function mL(e){let t=e.code,n=e instanceof Error?e.message:String(e);return t?`${{EACCES:"permission denied",EPERM:"operation not permitted",EISDIR:"the path is a directory, not a file",ELOOP:"too many symbolic links",ENOTDIR:"a parent path component is not a directory"}[t]??n} (${t})`:n}function gL(e,t){let n=e instanceof Error?e.message:String(e),r=/position (\d+)/.exec(n);if(!r)return n;let o=Number(r[1]);if(!Number.isFinite(o)||o<0)return n;let i=t.slice(0,o),s=i.split(`
253
265
  `).length,a=o-(i.lastIndexOf(`
254
- `)+1)+1;return`${r.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function Vx(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="object"?"an object":typeof e=="string"?"a string":typeof e=="number"?"a number":typeof e=="boolean"?"a boolean":typeof e}function Na(e,t){return e<t?-1:e>t?1:0}function zi(e){return[...new Set(e)].sort(Na)}function Ji(e){return{lockfileVersion:$t,source:{repo:ue,ref:je,...e},skills:{}}}function ur(e){return Object.keys(e.skills).sort(Na)}function $u(e){return Object.keys(e.skills).length===0}function ja(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function Vg(e,t){return{...e,skills:{...e.skills,...t}}}function Gg(e,t){return{...e,source:{...e.source,...t}}}function Kg(e,t){let r=[],n=[],o={...e.skills};for(let i of t)Object.prototype.hasOwnProperty.call(o,i)?(delete o[i],r.push(i)):n.push(i);return{lock:{...e,skills:o},removed:r,missing:n}}function Ma(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function zg(e){let{installedAt:t,updatedAt:r,...n}=e;return n}var zx=require("crypto"),qi=D(require("fs")),Xg=D(require("path"));x();var Kx=D(require("path"));S();function Lu(e){return y(Kx.default.basename(e))}function Jg(e){return y(e)}function Oo(e){let t=Lu(e.path),r=y(e.detail);if(e.reason==="merge-conflict")return new f(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new f(`Could not read ${t}: ${r}.
255
- ${Jg(e.path)}`,{isUserError:!0});let n=e.reason==="invalid-json"?`${t} is not valid JSON: ${r}`:`${t} is not a valid lockfile: ${r}`;return new f(`${n}.
256
- ${Jg(e.path)}
257
- Fix the file and re-run. It is not read as empty on purpose \u2014 that would discard the record of every installed skill on the next write.`,{isUserError:!0})}function Po(e){return new f(`Your ${Lu(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${$t}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function qg(e,t){return new f(`Refusing to write ${Lu(e)}: it is at lockfile version ${t} and this CLI supports ${$t}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function Yg(e,t){let r=y(t instanceof Error?t.message:String(t));return new f(`Could not write ${Lu(e)}: ${r}.
258
- ${Jg(e)}
259
- Your skills are on disk but are not recorded, so 'webflow skills update' and 'webflow skills remove' will not see them. Fix the problem and re-run the same install \u2014 it adopts the existing directories and does not need --force.`)}var Jx=420,qx=448,Yx=8;function Nu(e){if(Array.isArray(e))return e.map(Nu);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(Na).map(r=>[r,Nu(t[r])]))}return e}function bO(e,t){let r={};for(let[n,o]of Object.entries(e.skills)){let i={...o,agents:zi(o.agents??[])};r[n]=t==="project"?zg(i):i}return{...e,skills:r}}function Xx(e,t){let r=bO(e,t.kind);return`${JSON.stringify(Nu(r),null,2)}
260
- `}async function Zx(e,t,r){if(t.lockfileVersion>$t)throw qg(e,t.lockfileVersion);let n=Xg.default.resolve(e),o=Xg.default.dirname(n),i=Xx(t,r),s=`${n}.${(0,zx.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await qi.default.promises.mkdir(o,{recursive:!0,mode:qx});let l=await qi.default.promises.open(s,"wx",Jx);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await qi.default.promises.rename(s,n),a=!0}catch(l){throw Yg(e,l)}finally{a||await qi.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function Zg(e){try{return await qi.default.promises.unlink(e),!0}catch(t){return t.code!=="ENOENT"&&u.debug(`Could not remove the empty skills state file: ${t instanceof Error?t.message:String(t)}`),!1}}function $o(e){let t=e.batchSize??Yx,r=e.lock,n=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await Zx(e.path,r,{kind:e.kind}),n=0,i=!1,o+=1)},a=async()=>{n+=1,i=!0,n>=t&&await s()};return{get lock(){return r},get pendingCount(){return n},get flushCount(){return o},async record(l,c){r=Vg(r,{[l]:c}),await a()},async forget(l){let c=Kg(r,[l]);return r=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){r=Gg(r,l),i=!0},flush:s}}var Qx="skills_install";async function Mu(e,t){let r=Date.now(),n=xt(),o=n?_.forSkills({authToken:n}):null;try{let i=await EO(e??[],t);await o?.sendUsage(Qx,{duration:Date.now()-r,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),Qx,{duration:Date.now()-r}),new f(i,{prefix:`${b} Failed to install skills:`,...i instanceof f&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function EO(e,t){let r=t.json===!0||ze(),n=t.dryRun===!0,o=process.cwd(),i=await Eu({global:t.global,project:t.project,yes:t.yes},o,r),s=t.global!==!0&&t.project!==!0,a=i==="global"?oe.home():o,l=Du({cwd:o,home:oe.home()}),c=i==="global"?"global":"project",d=La(c,a),p=await Fr(d);if(p.kind==="corrupt")throw Oo(p);if(p.kind==="too-new")throw Po(p);let h=p.kind==="ok"?p.lock:Ji({ref:t.ref??je}),g=ur(h),m=e.length===0&&t.allSkills!==!0&&g.length>0&&(W()||t.yes===!0);await Oa(rt(i,a),{dryRun:n});let w=m?CO(h,g,t.ref):[null],k=[],F=[],A=!1,E=[],v=0,M=0;for(let Ee of w){let Ke=await vO({group:Ee,names:e,options:t,scope:i,root:a,lock:h,display:l,json:r});Ke!==null&&(k.push(Ke.plan),A=A||Ke.cacheHit,E=Ke.agents,v=Math.max(v,Ke.detectedCount),M+=Ke.duplicateNameWarnings)}if(k.length===0||k.every(Ee=>Ee.skills.length===0))return r?u.info(JSON.stringify(bu(OO({plan:k[0]??null,scope:i,root:a,lockPath:d,dryRun:n,restore:m,cacheHit:A,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),ju({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:m,cacheHit:A,plans:k,materialized:[],agents:E,detectedCount:v,duplicateNameWarnings:M});let B=k[0];if(n){let Ee=rC({plans:k,materialized:[],dryRun:!0,restore:m,cacheHit:A,lockPath:d});if(r)u.info(JSON.stringify(bu(Ee),null,2));else{for(let Ke of k)u.info(Ag(Ke,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return ju({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:m,cacheHit:A,plans:k,materialized:[],agents:E,detectedCount:v,duplicateNameWarnings:M})}if(t.yes!==!0&&!W()&&r)throw new f(`Installation requires confirmation, and --json cannot prompt.
261
- Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!W()){for(let Ke of k)u.info(Ag(Ke,{dryRun:!1,display:l}));if(!await Pe({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),ju({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:m,cacheHit:A,plans:k,materialized:[],agents:E,detectedCount:v,duplicateNameWarnings:M,cancelled:!0})}let U=$o({path:d,kind:c,lock:h}),Ie=new Date().toISOString();for(let Ee of k)for(let Ke of Ee.skills){let ae=await Pa(Ee,Ke);F.push(ae);let Et=IO({plan:Ee,skill:ae,skillPath:Ke.skillPath,existing:ja(U.lock,ae.name),previousAgents:ja(h,ae.name)?.agents??[],restore:m,kind:c,now:Ie});Et!==null&&await U.record(ae.name,Et)}U.updateSource({repo:B.source.repo,ref:B.source.ref,commit:B.source.commit,pluginVersion:B.source.pluginVersion}),await U.flush({force:!0});let Ze=rC({plans:k,materialized:F,dryRun:!1,restore:m,cacheHit:A,lockPath:d});return r?u.info(JSON.stringify(bu(Ze),null,2)):(u.info(ix(Ze,{display:l})),u.info(`Wrote ${l(d)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(Ze.failures.length>0||Ze.summary.blocked>0&&Ze.summary.installed===0)&&(process.exitCode=1),ju({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:m,cacheHit:A,plans:k,materialized:F,agents:E,detectedCount:v,duplicateNameWarnings:M})}async function vO(e){let{group:t,names:r,options:n,scope:o,root:i,lock:s,display:a}=e,l=await Ni(t===null||t.commit===void 0?{ref:t?.ref??n.ref}:{commit:t.commit,ref:t.ref}),c=await Mi(l.root),d=await Wi(c.skillsDir,l.root),p=[...c.warnings,...d.warnings],h=await _O({discovered:d.skills,names:r,allSkills:n.allSkills===!0,restoreNames:t?.names,recordedNames:ur(s),warn:E=>p.push(E)});if(h.length===0)return null;let g=t===null?void 0:zi(t.names.flatMap(E=>ja(s,E)?.agents??[])),m=await SO({scope:o,root:i,options:n,json:e.json,...g!==void 0&&g.length>0?{recordedAgents:g}:{}});for(let E of m.unknownRecorded)p.push(`The lockfile records the agent "${y(E)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let w=m.source==="explicit"||m.source==="prompt",k=m.agents.map(E=>({agent:E,explicit:w})),F={repo:ue,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},A=await $a({scope:o,root:i,mode:t?.mode??(n.copy===!0?"copy":"symlink"),force:n.force===!0,source:F,skills:h,targets:k,recorded:s.skills,warnings:p,display:a});return{plan:A,cacheHit:l.fromCache,agents:m.agents,detectedCount:m.detected.length,duplicateNameWarnings:xO(A.warnings)}}async function SO(e){let{scope:t,root:r,options:n,json:o}=e,i={scope:t,cwd:r,options:{agent:n.agent,allAgents:n.allAgents,yes:n.yes},...e.recordedAgents!==void 0?{recordedAgents:e.recordedAgents}:{}},s=(n.agent?.length??0)>0||n.allAgents===!0||(e.recordedAgents?.length??0)>0;if(o&&!s){let a=await xa(t,r);if(a.length===0){let l=pu(qt);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return Ta({...i,detected:a})}return Ta(i)}function xO(e){return e.filter(t=>t.includes("would load it twice")).length}function CO(e,t,r){let n=new Map;for(let o of t){let i=e.skills[o],s=i.ref??e.source.ref,a=r===void 0?`${i.commit}|${i.mode}`:i.mode,l=n.get(a);if(l){l.names.push(o);continue}n.set(a,{...r===void 0?{commit:i.commit}:{},ref:r??s,mode:i.mode,names:[o]})}return[...n.values()]}async function _O(e){let{discovered:t,names:r,allSkills:n,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let d of o){let p=t.find(h=>h.name===d);if(p===void 0){s(`${y(d)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(p)}return c}let a=t.filter(c=>!c.internal);if(n)return a;if(r.length>0)return r.map(c=>FO(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(W())throw new f(`No skills were named. Pass skill names, or --all-skills to install every skill in the catalog (${a.length} available).`,{isUserError:!0,missingFlag:"all-skills"});return TO(a,l)}function FO(e,t){let r=Jr(e,[...t]);if(r.kind==="match")return r.skill;throw r.kind==="ambiguous"?new f(`"${y(e)}" matches more than one skill: ${r.matches.map(n=>y(n.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new f(`No skill matches "${y(e)}".`+(r.candidates.length>0?`
262
- Available: ${r.candidates.map(n=>y(n)).join(", ")}`:""),{isUserError:!0})}var AO=20,eC=60;async function TO(e,t){let r=new Set(t.map(s=>s.name)),n=[...e].sort((s,a)=>tC(s.category??"",a.category??"")||tC(s.name,a.name)),o=await fr({message:"Select skills to install",pageSize:Math.min(AO,Math.max(4,n.length)),choices:n.map(s=>({value:s.name,name:`${y(s.name)} ${RO(y(s.description))}`,checked:r.has(s.name)})),validate:s=>s.length>0?!0:"Select at least one skill, or press Ctrl-C to cancel."}),i=new Set(o??[]);return n.filter(s=>i.has(s.name))}function tC(e,t){return e<t?-1:e>t?1:0}function RO(e){return e.length<=eC?e:`${e.slice(0,eC-1)}\u2026`}function IO(e){let{plan:t,skill:r,existing:n,restore:o,kind:i,now:s}=e;if(!(r.storeAction==="written"||r.storeAction==="adopted"||r.storeAction==="unchanged")||r.hashes===null)return null;let l=new Map(t.skills.find(p=>p.name===r.name)?.targets.map(p=>[p.path,p.agents])??[]),c=[];for(let p of r.targets)p.skipped===!0||!p.success||c.push(...l.get(p.path)??[p.agent]);o&&c.push(...e.previousAgents);let d={agents:zi(c),commit:t.source.commit,contentHash:r.hashes.contentHash,modeHash:r.hashes.modeHash,dir:r.dir,mode:t.mode,ref:t.source.ref,skillPath:e.skillPath};return i==="global"?Ma(d,{...n?{existing:n}:{},now:s}):d}function rC(e){let{plans:t,materialized:r,dryRun:n,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(d=>d.skills),warnings:[...new Set(t.flatMap(d=>d.warnings))],blocked:t.flatMap(d=>d.blocked)},c=Fg({plan:l,materialized:r,dryRun:n});return{plan:l,dryRun:n,restored:o,cacheHit:i,materialized:[...r],lockfilePath:s,...c,...t.length>1?{extraSources:t.slice(1).map(d=>d.source)}:{}}}function OO(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:ue,ref:e.options.ref??je,commit:"",pluginVersion:""},skills:[],warnings:[],blocked:[]};return{plan:e.plan??t,dryRun:e.dryRun,restored:e.restore,cacheHit:e.cacheHit,materialized:[],lockfilePath:e.lockPath,blocked:[],failures:[],summary:{requested:0,installed:0,skipped:0,blocked:0,failed:0,storeWrites:0,symlinks:0,copies:0,symlinkFallbacks:0}}}function ju(e){let t=e.plans[0],r=e.plans.flatMap(i=>i.skills),n={};for(let i of r)n[i.storeOverwrite]=(n[i.storeOverwrite]??0)+1;let o=t?Fg({plan:{...t,skills:r,blocked:[]},materialized:e.materialized,dryRun:e.dryRun}):null;return{count:o?.summary.installed??0,scope:e.scope,scopeAutoDetected:e.scopeAutoDetected,mode:t?.mode??(e.options.copy===!0?"copy":"symlink"),agentCount:e.agents.length,agentIds:e.agents.map(i=>i.id),detectedAgentCount:e.detectedCount,sharedDirTargetCount:r.reduce((i,s)=>i+s.targets.filter(a=>a.link==="canonical").length,0),symlinkFallbackCount:o?.summary.symlinkFallbacks??0,symlinkFallbackErrno:[...new Set(e.materialized.flatMap(i=>i.targets.filter(s=>s.symlinkFailed===!0).map(s=>s.errno??"unknown")))].sort(),skillNames:r.map(i=>i.name),refKind:PO(e.options.ref),commit:t?.source.commit??"",pluginVersion:t?.source.pluginVersion??"",cacheHit:e.cacheHit,dryRun:e.dryRun,forced:e.options.force===!0,overwriteClasses:n,blockedCount:o?.summary.blocked??0,skippedCount:o?.summary.skipped??0,warningCount:[...new Set(e.plans.flatMap(i=>i.warnings))].length,restored:e.restore,duplicateNameWarnings:e.duplicateNameWarnings,...e.cancelled===!0?{cancelled:!0}:{}}}function PO(e){return e===void 0||e===je?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}J();S();pe();x();N();z();var Bu=D(require("fs")),Yi=D(require("path"));var $O=256;async function nC(e){let{scope:t,lock:r}=e,n=Yi.default.resolve(e.root),o=rt(t,n),i=e.display??(d=>d),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let d of Object.keys(r.skills).sort()){let p=r.skills[d];c.add(p.dir),l.push(await LO({name:d,entry:p,scope:t,root:n,store:o,platform:s,display:i,warn:h=>a.push(h)}))}return l.push(...await BO({scope:t,root:n,store:o,recordedDirs:c})),{scope:t,root:n,store:o,lockfile:e.lockfile,source:r.source,skills:l,warnings:a}}async function LO(e){let{name:t,entry:r,scope:n,root:o,store:i,platform:s,display:a,warn:l}=e,c=Yi.default.join(i,r.dir),d=jO(r),p=await Yt(c),h={name:t,dir:r.dir,description:await UO(c),scope:n,status:"up-to-date",mode:r.mode,storePath:c,recordedHash:r.contentHash??null,onDiskHash:p?.contentHash??null,...r.skillPath!==void 0?{skillPath:r.skillPath}:{},...r.commit!==void 0?{commit:r.commit}:{},...r.ref!==void 0?{ref:r.ref}:{},...r.category!==void 0?{category:r.category}:{},agents:[]},g=[],m;for(let w of r.agents){let k=xr(w);if(k===void 0){g.push({id:w,label:w,path:null,link:"missing",present:!1}),l(`${y(t)} records the agent "${y(w)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let F=Ot(k,n,o);if(F===null){g.push({id:w,label:k.displayName,path:null,link:"missing",present:!1});continue}let A=Yi.default.join(F,r.dir);if(He(A,c)){g.push({id:w,label:k.displayName,path:A,link:"canonical",present:p!==null});continue}let E=await MO(A);if(E==="missing"){g.push({id:w,label:k.displayName,path:A,link:"missing",present:!1}),l(`${y(t)} is recorded for ${y(k.displayName)} but ${y(a(A))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let v=!1;if(r.mode==="copy"&&E==="copy"&&d!==null){let M=await Yt(A);v=M===null||!Pt(M,d,s),v&&m===void 0&&(m=k.displayName)}g.push({id:w,label:k.displayName,path:A,link:E,present:!0,...v?{diverged:!0}:{}})}return{...h,agents:g,...NO({onDisk:p,recorded:d,platform:s,divergedLabel:m})}}function NO(e){let{onDisk:t,recorded:r,platform:n,divergedLabel:o}=e;return t===null?{status:"missing"}:r!==null&&!Pt(t,r,n)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${y(o)} copy diverges`}:{status:"up-to-date"}}function jO(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function MO(e){try{let t=await Bu.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function BO(e){let{scope:t,store:r,recordedDirs:n}=e,o;try{o=await Bu.default.promises.readdir(r,{withFileTypes:!0})}catch{return[]}let i=[],s=$O;for(let a of[...o].sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0)){if(s<=0)break;if(!a.isDirectory()&&!a.isSymbolicLink()||n.has(a.name)||/\.[0-9a-f]{6}\.tmp$/.test(a.name))continue;s-=1;let l=Yi.default.join(r,a.name),c=await Yt(l);if(c===null)continue;let d=await oC(l);d!==null&&zv(d.name)&&i.push({name:d.name,dir:a.name,description:d.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function UO(e){return(await oC(e))?.description??""}async function oC(e){try{let t=await Bu.default.promises.readFile(Yi.default.join(e,Rt),"utf8"),r=So(t);return{name:r.frontmatter.name,description:r.frontmatter.description}}catch{return null}}var iC="skills_list",WO="name",HO=st(Fo);async function Uu(e){let t=Date.now(),r=xt(),n=r?_.forSkills({authToken:r}):null;try{let o=await VO(e);await n?.sendUsage(iC,{duration:Date.now()-t,...o})}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),iC,{duration:Date.now()-t}),new f(o,{prefix:`${b} Failed to list skills:`,...o instanceof f&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function VO(e){let t=e.json===!0||ze(),r=process.cwd(),n=Du({cwd:r,home:oe.home()}),o=[],i=KO(e.fields,o),s=zO(e.sortBy),a=JO(e.order),l=qO(e.agent),c=GO(e),d=[],p=0;for(let m of c){let w=m==="global"?oe.home():r,k=La(m==="global"?"global":"project",w),F=await Fr(k),A;if(F.kind==="ok")A=F.lock;else if(F.kind==="too-new")A=F.lock??Ji(),o.push(`${n(k)} was written by a newer Webflow CLI (lockfile version ${F.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(F.kind==="corrupt"){o.push(`Skipped ${n(k)} \u2014 ${F.detail}. Fix the file and re-run.`);continue}else A=Ji();let E=await nC({scope:m,root:w,lockfile:k,lock:A,display:n});o.push(...E.warnings),p+=E.skills.length,l!==null&&(E.skills=E.skills.filter(v=>v.agents.some(M=>l.has(M.id)))),E.skills.sort(dx(s,a)),d.push(E)}let h=Tg(d);if(t)return u.info(JSON.stringify(ux({inventories:d,warnings:o}),null,2)),Qg({inventories:d,summary:h,fields:i,json:t,agentFilter:l});if(h.total===0){u.info(l!==null&&p>0?`No skills are linked into ${[...l].sort().join(", ")}. ${p} ${p===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${p===1?"it":"them"}.`:Rg);for(let m of ku(o))u.info(m);return Qg({inventories:d,summary:h,fields:i,json:t,agentFilter:l})}let g=[];for(let m of d){if(m.skills.length===0)continue;let w=lx(m.skills,{store:m.store,display:n});g.push([cx(m,{display:n}),"",sx(m.skills,i),...w===""?[]:["",w]].join(`
263
- `))}u.info(g.join(`
266
+ `)+1)+1;return`${n.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function WF(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="object"?"an object":typeof e=="string"?"a string":typeof e=="number"?"a number":typeof e=="boolean"?"a boolean":typeof e}function Dl(e,t){return e<t?-1:e>t?1:0}function Ss(e){return[...new Set(e)].sort(Dl)}function xs(e){return{lockfileVersion:jt,source:{repo:he,ref:Ge,...e},skills:{}}}function wn(e){return Object.keys(e.skills).sort(Dl)}function Ad(e){return Object.keys(e.skills).length===0}function bl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function Yh(e,t){return{...e,skills:{...e.skills,...t}}}function Zh(e,t){return{...e,source:{...e.source,...t}}}function Qh(e,t){let n=[],r=[],o={...e.skills};for(let i of t)Object.prototype.hasOwnProperty.call(o,i)?(delete o[i],n.push(i)):r.push(i);return{lock:{...e,skills:o},removed:n,missing:r}}function kl(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function ey(e){let{installedAt:t,updatedAt:n,...r}=e;return r}var GF=require("crypto"),Cs=w(require("fs")),oy=w(require("path"));_();var VF=w(require("path"));C();function Id(e){return D(VF.default.basename(e))}function ty(e){return D(e)}function ni(e){let t=Id(e.path),n=D(e.detail);if(e.reason==="merge-conflict")return new f(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new f(`Could not read ${t}: ${n}.
267
+ ${ty(e.path)}`,{isUserError:!0});let r=e.reason==="invalid-json"?`${t} is not valid JSON: ${n}`:`${t} is not a valid lockfile: ${n}`;return new f(`${r}.
268
+ ${ty(e.path)}
269
+ Fix the file and re-run. It is not read as empty on purpose \u2014 that would discard the record of every installed skill on the next write.`,{isUserError:!0})}function ri(e){return new f(`Your ${Id(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${jt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function ny(e,t){return new f(`Refusing to write ${Id(e)}: it is at lockfile version ${t} and this CLI supports ${jt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function ry(e,t){let n=D(t instanceof Error?t.message:String(t));return new f(`Could not write ${Id(e)}: ${n}.
270
+ ${ty(e)}
271
+ Your skills are on disk but are not recorded, so 'webflow skills update' and 'webflow skills remove' will not see them. Fix the problem and re-run the same install \u2014 it adopts the existing directories and does not need --force.`)}var JF=420,KF=448,zF=8;function Rd(e){if(Array.isArray(e))return e.map(Rd);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(Dl).map(n=>[n,Rd(t[n])]))}return e}function hL(e,t){let n={};for(let[r,o]of Object.entries(e.skills)){let i={...o,agents:Ss(o.agents??[])};n[r]=t==="project"?ey(i):i}return{...e,skills:n}}function qF(e,t){let n=hL(e,t.kind);return`${JSON.stringify(Rd(n),null,2)}
272
+ `}async function XF(e,t,n){if(t.lockfileVersion>jt)throw ny(e,t.lockfileVersion);let r=oy.default.resolve(e),o=oy.default.dirname(r),i=qF(t,n),s=`${r}.${(0,GF.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await Cs.default.promises.mkdir(o,{recursive:!0,mode:KF});let l=await Cs.default.promises.open(s,"wx",JF);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await Cs.default.promises.rename(s,r),a=!0}catch(l){throw ry(e,l)}finally{a||await Cs.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function iy(e){try{return await Cs.default.promises.unlink(e),!0}catch(t){return t.code!=="ENOENT"&&u.debug(`Could not remove the empty skills state file: ${t instanceof Error?t.message:String(t)}`),!1}}function oi(e){let t=e.batchSize??zF,n=e.lock,r=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await XF(e.path,n,{kind:e.kind}),r=0,i=!1,o+=1)},a=async()=>{r+=1,i=!0,r>=t&&await s()};return{get lock(){return n},get pendingCount(){return r},get flushCount(){return o},async record(l,c){n=Yh(n,{[l]:c}),await a()},async forget(l){let c=Qh(n,[l]);return n=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){n=Zh(n,l),i=!0},flush:s}}var YF="skills_install";async function Pd(e,t){let n=Date.now(),r=At(),o=r?F.forSkills({authToken:r}):null;try{let i=await yL(e??[],t);await o?.sendUsage(YF,{duration:Date.now()-n,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),YF,{duration:Date.now()-n}),new f(i,{prefix:`${k} Failed to install skills:`,...i instanceof f&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function yL(e,t){let n=t.json===!0||Ye(),r=t.dryRun===!0,o=process.cwd(),i=await hd({global:t.global,project:t.project,yes:t.yes},o,n),s=t.global!==!0&&t.project!==!0,a=i==="global"?ue.home():o,l=fd({cwd:o,home:ue.home()}),c=i==="global"?"global":"project",d=wl(c,a),p=await Nn(d);if(p.kind==="corrupt")throw ni(p);if(p.kind==="too-new")throw ri(p);let m=p.kind==="ok"?p.lock:xs({ref:t.ref??Ge}),h=wn(m),g=e.length===0&&t.allSkills!==!0&&h.length>0&&(V()||t.yes===!0);await gl(it(i,a),{dryRun:r});let y=g?kL(m,h,t.ref):[null],b=[],S=[],A=!1,v=[],x=0,O=0;for(let me of y){let Le=await wL({group:me,names:e,options:t,scope:i,root:a,lock:m,display:l,json:n});Le!==null&&(b.push(Le.plan),A=A||Le.cacheHit,v=Le.agents,x=Math.max(x,Le.detectedCount),O+=Le.duplicateNameWarnings)}if(b.length===0||b.every(me=>me.skills.length===0))return n?u.info(JSON.stringify(gd(_L({plan:b[0]??null,scope:i,root:a,lockPath:d,dryRun:r,restore:g,cacheHit:A,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),Td({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:A,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O});let H=b[0];if(r){let me=e_({plans:b,materialized:[],dryRun:!0,restore:g,cacheHit:A,lockPath:d});if(n)u.info(JSON.stringify(gd(me),null,2));else{for(let Le of b)u.info(Lh(Le,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return Td({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:A,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O})}if(t.yes!==!0&&!V()&&n)throw new f(`Installation requires confirmation, and --json cannot prompt.
273
+ Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!V()){for(let Le of b)u.info(Lh(Le,{dryRun:!1,display:l}));if(!await Re({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),Td({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:A,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O,cancelled:!0})}let B=oi({path:d,kind:c,lock:m}),ye=new Date().toISOString();for(let me of b)for(let Le of me.skills){let E=await hl(me,Le);S.push(E);let z=FL({plan:me,skill:E,skillPath:Le.skillPath,existing:bl(B.lock,E.name),previousAgents:bl(m,E.name)?.agents??[],restore:g,kind:c,now:ye});z!==null&&await B.record(E.name,z)}B.updateSource({repo:H.source.repo,ref:H.source.ref,commit:H.source.commit,pluginVersion:H.source.pluginVersion}),await B.flush({force:!0});let ve=e_({plans:b,materialized:S,dryRun:!1,restore:g,cacheHit:A,lockPath:d});return n?u.info(JSON.stringify(gd(ve),null,2)):(u.info(rF(ve,{display:l})),u.info(`Wrote ${l(d)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(ve.failures.length>0||ve.summary.blocked>0&&ve.summary.installed===0)&&(process.exitCode=1),Td({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:A,plans:b,materialized:S,agents:v,detectedCount:x,duplicateNameWarnings:O})}async function wL(e){let{group:t,names:n,options:r,scope:o,root:i,lock:s,display:a}=e,l=await ms(t===null||t.commit===void 0?{ref:t?.ref??r.ref}:{commit:t.commit,ref:t.ref}),c=await hs(l.root),d=await Ds(c.skillsDir,l.root),p=[...c.warnings,...d.warnings],m=await EL({discovered:d.skills,names:n,allSkills:r.allSkills===!0,restoreNames:t?.names,recordedNames:wn(s),warn:v=>p.push(v)});if(m.length===0)return null;let h=t===null?void 0:Ss(t.names.flatMap(v=>bl(s,v)?.agents??[])),g=await DL({scope:o,root:i,options:r,json:e.json,...h!==void 0&&h.length>0?{recordedAgents:h}:{}});for(let v of g.unknownRecorded)p.push(`The lockfile records the agent "${D(v)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let y=g.source==="explicit"||g.source==="prompt",b=g.agents.map(v=>({agent:v,explicit:y})),S={repo:he,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},A=await yl({scope:o,root:i,mode:t?.mode??(r.copy===!0?"copy":"symlink"),force:r.force===!0,source:S,skills:m,targets:b,recorded:s.skills,warnings:p,display:a});return{plan:A,cacheHit:l.fromCache,agents:g.agents,detectedCount:g.detected.length,duplicateNameWarnings:bL(A.warnings)}}async function DL(e){let{scope:t,root:n,options:r,json:o}=e,i={scope:t,cwd:n,options:{agent:r.agent,allAgents:r.allAgents,yes:r.yes},...e.recordedAgents!==void 0?{recordedAgents:e.recordedAgents}:{}},s=(r.agent?.length??0)>0||r.allAgents===!0||(e.recordedAgents?.length??0)>0;if(o&&!s){let a=await al(t,n);if(a.length===0){let l=sd(Qt);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return pl({...i,detected:a})}return pl(i)}function bL(e){return e.filter(t=>t.includes("would load it twice")).length}function kL(e,t,n){let r=new Map;for(let o of t){let i=e.skills[o],s=i.ref??e.source.ref,a=n===void 0?`${i.commit}|${i.mode}`:i.mode,l=r.get(a);if(l){l.names.push(o);continue}r.set(a,{...n===void 0?{commit:i.commit}:{},ref:n??s,mode:i.mode,names:[o]})}return[...r.values()]}async function EL(e){let{discovered:t,names:n,allSkills:r,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let d of o){let p=t.find(m=>m.name===d);if(p===void 0){s(`${D(d)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(p)}return c}let a=t.filter(c=>!c.internal);if(r)return a;if(n.length>0)return n.map(c=>vL(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(V())throw new f(`No skills were named. Pass skill names, or --all-skills to install every skill in the catalog (${a.length} available).`,{isUserError:!0,missingFlag:"all-skills"});return xL(a,l)}function vL(e,t){let n=ar(e,[...t]);if(n.kind==="match")return n.skill;throw n.kind==="ambiguous"?new f(`"${D(e)}" matches more than one skill: ${n.matches.map(r=>D(r.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new f(`No skill matches "${D(e)}".`+(n.candidates.length>0?`
274
+ Available: ${n.candidates.map(r=>D(r)).join(", ")}`:""),{isUserError:!0})}var SL=20,ZF=60;async function xL(e,t){let n=new Set(t.map(s=>s.name)),r=[...e].sort((s,a)=>QF(s.category??"",a.category??"")||QF(s.name,a.name)),o=await En({message:"Select skills to install",pageSize:Math.min(SL,Math.max(4,r.length)),choices:r.map(s=>({value:s.name,name:`${D(s.name)} ${CL(D(s.description))}`,checked:n.has(s.name)})),validate:s=>s.length>0?!0:"Select at least one skill, or press Ctrl-C to cancel."}),i=new Set(o??[]);return r.filter(s=>i.has(s.name))}function QF(e,t){return e<t?-1:e>t?1:0}function CL(e){return e.length<=ZF?e:`${e.slice(0,ZF-1)}\u2026`}function FL(e){let{plan:t,skill:n,existing:r,restore:o,kind:i,now:s}=e;if(!(n.storeAction==="written"||n.storeAction==="adopted"||n.storeAction==="unchanged")||n.hashes===null)return null;let l=new Map(t.skills.find(p=>p.name===n.name)?.targets.map(p=>[p.path,p.agents])??[]),c=[];for(let p of n.targets)p.skipped===!0||!p.success||c.push(...l.get(p.path)??[p.agent]);o&&c.push(...e.previousAgents);let d={agents:Ss(c),commit:t.source.commit,contentHash:n.hashes.contentHash,modeHash:n.hashes.modeHash,dir:n.dir,mode:t.mode,ref:t.source.ref,skillPath:e.skillPath};return i==="global"?kl(d,{...r?{existing:r}:{},now:s}):d}function e_(e){let{plans:t,materialized:n,dryRun:r,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(d=>d.skills),warnings:[...new Set(t.flatMap(d=>d.warnings))],blocked:t.flatMap(d=>d.blocked)},c=Oh({plan:l,materialized:n,dryRun:r});return{plan:l,dryRun:r,restored:o,cacheHit:i,materialized:[...n],lockfilePath:s,...c,...t.length>1?{extraSources:t.slice(1).map(d=>d.source)}:{}}}function _L(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:he,ref:e.options.ref??Ge,commit:"",pluginVersion:""},skills:[],warnings:[],blocked:[]};return{plan:e.plan??t,dryRun:e.dryRun,restored:e.restore,cacheHit:e.cacheHit,materialized:[],lockfilePath:e.lockPath,blocked:[],failures:[],summary:{requested:0,installed:0,skipped:0,blocked:0,failed:0,storeWrites:0,symlinks:0,copies:0,symlinkFallbacks:0}}}function Td(e){let t=e.plans[0],n=e.plans.flatMap(i=>i.skills),r={};for(let i of n)r[i.storeOverwrite]=(r[i.storeOverwrite]??0)+1;let o=t?Oh({plan:{...t,skills:n,blocked:[]},materialized:e.materialized,dryRun:e.dryRun}):null;return{count:o?.summary.installed??0,scope:e.scope,scopeAutoDetected:e.scopeAutoDetected,mode:t?.mode??(e.options.copy===!0?"copy":"symlink"),agentCount:e.agents.length,agentIds:e.agents.map(i=>i.id),detectedAgentCount:e.detectedCount,sharedDirTargetCount:n.reduce((i,s)=>i+s.targets.filter(a=>a.link==="canonical").length,0),symlinkFallbackCount:o?.summary.symlinkFallbacks??0,symlinkFallbackErrno:[...new Set(e.materialized.flatMap(i=>i.targets.filter(s=>s.symlinkFailed===!0).map(s=>s.errno??"unknown")))].sort(),skillNames:n.map(i=>i.name),refKind:AL(e.options.ref),commit:t?.source.commit??"",pluginVersion:t?.source.pluginVersion??"",cacheHit:e.cacheHit,dryRun:e.dryRun,forced:e.options.force===!0,overwriteClasses:r,blockedCount:o?.summary.blocked??0,skippedCount:o?.summary.skipped??0,warningCount:[...new Set(e.plans.flatMap(i=>i.warnings))].length,restored:e.restore,duplicateNameWarnings:e.duplicateNameWarnings,...e.cancelled===!0?{cancelled:!0}:{}}}function AL(e){return e===void 0||e===Ge?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}q();C();we();_();M();X();var $d=w(require("fs")),Fs=w(require("path"));var IL=256;async function t_(e){let{scope:t,lock:n}=e,r=Fs.default.resolve(e.root),o=it(t,r),i=e.display??(d=>d),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let d of Object.keys(n.skills).sort()){let p=n.skills[d];c.add(p.dir),l.push(await RL({name:d,entry:p,scope:t,root:r,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await OL({scope:t,root:r,store:o,recordedDirs:c})),{scope:t,root:r,store:o,lockfile:e.lockfile,source:n.source,skills:l,warnings:a}}async function RL(e){let{name:t,entry:n,scope:r,root:o,store:i,platform:s,display:a,warn:l}=e,c=Fs.default.join(i,n.dir),d=PL(n),p=await en(c),m={name:t,dir:n.dir,description:await LL(c),scope:r,status:"up-to-date",mode:n.mode,storePath:c,recordedHash:n.contentHash??null,onDiskHash:p?.contentHash??null,...n.skillPath!==void 0?{skillPath:n.skillPath}:{},...n.commit!==void 0?{commit:n.commit}:{},...n.ref!==void 0?{ref:n.ref}:{},...n.category!==void 0?{category:n.category}:{},agents:[]},h=[],g;for(let y of n.agents){let b=$n(y);if(b===void 0){h.push({id:y,label:y,path:null,link:"missing",present:!1}),l(`${D(t)} records the agent "${D(y)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let S=Lt(b,r,o);if(S===null){h.push({id:y,label:b.displayName,path:null,link:"missing",present:!1});continue}let A=Fs.default.join(S,n.dir);if(qe(A,c)){h.push({id:y,label:b.displayName,path:A,link:"canonical",present:p!==null});continue}let v=await $L(A);if(v==="missing"){h.push({id:y,label:b.displayName,path:A,link:"missing",present:!1}),l(`${D(t)} is recorded for ${D(b.displayName)} but ${D(a(A))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let x=!1;if(n.mode==="copy"&&v==="copy"&&d!==null){let O=await en(A);x=O===null||!Nt(O,d,s),x&&g===void 0&&(g=b.displayName)}h.push({id:y,label:b.displayName,path:A,link:v,present:!0,...x?{diverged:!0}:{}})}return{...m,agents:h,...TL({onDisk:p,recorded:d,platform:s,divergedLabel:g})}}function TL(e){let{onDisk:t,recorded:n,platform:r,divergedLabel:o}=e;return t===null?{status:"missing"}:n!==null&&!Nt(t,n,r)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${D(o)} copy diverges`}:{status:"up-to-date"}}function PL(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function $L(e){try{let t=await $d.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function OL(e){let{scope:t,store:n,recordedDirs:r}=e,o;try{o=await $d.default.promises.readdir(n,{withFileTypes:!0})}catch{return[]}let i=[],s=IL;for(let a of[...o].sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0)){if(s<=0)break;if(!a.isDirectory()&&!a.isSymbolicLink()||r.has(a.name)||/\.[0-9a-f]{6}\.tmp$/.test(a.name))continue;s-=1;let l=Fs.default.join(n,a.name),c=await en(l);if(c===null)continue;let d=await n_(l);d!==null&&Gx(d.name)&&i.push({name:d.name,dir:a.name,description:d.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function LL(e){return(await n_(e))?.description??""}async function n_(e){try{let t=await $d.default.promises.readFile(Fs.default.join(e,$t),"utf8"),n=Ko(t);return{name:n.frontmatter.name,description:n.frontmatter.description}}catch{return null}}var r_="skills_list",NL="name",jL=ut(Yo);async function Od(e){let t=Date.now(),n=At(),r=n?F.forSkills({authToken:n}):null;try{let o=await ML(e);await r?.sendUsage(r_,{duration:Date.now()-t,...o})}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),r_,{duration:Date.now()-t}),new f(o,{prefix:`${k} Failed to list skills:`,...o instanceof f&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function ML(e){let t=e.json===!0||Ye(),n=process.cwd(),r=fd({cwd:n,home:ue.home()}),o=[],i=UL(e.fields,o),s=WL(e.sortBy),a=HL(e.order),l=VL(e.agent),c=BL(e),d=[],p=0;for(let g of c){let y=g==="global"?ue.home():n,b=wl(g==="global"?"global":"project",y),S=await Nn(b),A;if(S.kind==="ok")A=S.lock;else if(S.kind==="too-new")A=S.lock??xs(),o.push(`${r(b)} was written by a newer Webflow CLI (lockfile version ${S.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(S.kind==="corrupt"){o.push(`Skipped ${r(b)} \u2014 ${S.detail}. Fix the file and re-run.`);continue}else A=xs();let v=await t_({scope:g,root:y,lockfile:b,lock:A,display:r});o.push(...v.warnings),p+=v.skills.length,l!==null&&(v.skills=v.skills.filter(x=>x.agents.some(O=>l.has(O.id)))),v.skills.sort(cF(s,a)),d.push(v)}let m=Nh(d);if(t)return u.info(JSON.stringify(lF({inventories:d,warnings:o}),null,2)),sy({inventories:d,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&p>0?`No skills are linked into ${[...l].sort().join(", ")}. ${p} ${p===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${p===1?"it":"them"}.`:jh);for(let g of md(o))u.info(g);return sy({inventories:d,summary:m,fields:i,json:t,agentFilter:l})}let h=[];for(let g of d){if(g.skills.length===0)continue;let y=sF(g.skills,{store:g.store,display:r});h.push([aF(g,{display:r}),"",oF(g.skills,i),...y===""?[]:["",y]].join(`
275
+ `))}u.info(h.join(`
264
276
 
265
- `));for(let m of ku(o))u.info(m);return Qg({inventories:d,summary:h,fields:i,json:t,agentFilter:l})}function GO(e){if(e.global===!0&&e.project===!0)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function KO(e,t){let r=(e??Ia).split(",").map(i=>i.trim()).filter(Boolean),{valid:n,invalid:o}=HO(r);if(n.length===0)throw new f(`No valid fields specified. Available: ${Fo.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${Fo.join(", ")}`),n}function zO(e){if(e===void 0||e==="")return WO;let t=Gi.find(r=>r===e.trim().toLowerCase());if(t===void 0)throw new f(`Cannot sort by "${e}". Available: ${Gi.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function JO(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new f(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function qO(e){let t=Hi(e);return t.length===0?null:new Set(Vi(t).map(r=>r.id))}function Qg(e){let t=new Set;for(let r of e.inventories)for(let n of r.skills)for(let o of n.agents)t.add(o.id);return{count:e.summary.total,scopes:e.inventories.map(r=>r.scope),statusCounts:{upToDate:e.summary.upToDate,modified:e.summary.modified,missing:e.summary.missing,unmanaged:e.summary.unmanaged},agentIds:[...t].sort(),json:e.json,fieldCount:e.fields.length,agentFiltered:e.agentFilter!==null}}var bt=D(require("fs")),Ba=D(require("os")),nt=D(require("path"));J();S();pe();Ae();x();N();z();async function Gu(e,t){let r=Date.now(),n=fP();try{let o=t.json===!0||ze(),i=await YO(e,t,o);await n?.sendUsage("skills_remove",{duration:Date.now()-r,count:i.summary.requested,removed:i.summary.removed,storeDeleted:i.summary.storeDeleted,storeKept:i.summary.storeKept,failed:i.summary.failed,dryRun:i.dryRun,agentFiltered:i.agents!==null}),lP(i,o),i.failures.length>0&&(process.exitCode=1)}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),"skills_remove",{duration:Date.now()-r,dryRun:t.dryRun===!0}),o instanceof f?o:new f(o,{prefix:`${b} Failed to remove skills:`})}}async function YO(e,t,r){let n=process.cwd(),o=[],i=t.dryRun===!0,s=await Eu(t,n,r),a=s==="global"?Ba.default.homedir():n,l=rt(s,a),c=s==="global"?Io():Ro(a),d=await Fr(c);if(d.kind==="corrupt")throw Oo(d);if(d.kind==="too-new")throw Po(d);let p=d.kind==="ok"?d.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},h=Hi(t.agent),m=h.length===0||h.includes(Aa)?null:Vi(h).map(ae=>ae.id),w=Cr(s),k=await XO({agents:w,scope:s,root:a,storeBase:l,warnings:o}),F=uC(k.dirNames,p),A=await QO({names:e,options:t,identities:F,scope:s,cwd:n,json:r,warnings:o});if(A.length===0)return cC({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:m,warnings:o,lock:p});let E=new Set(m??[...Co,qt]);if(m?.includes(qt))for(let ae of A){let Et=(ae.entry?.agents??[]).filter(ie=>ie!==qt&&!E.has(ie));if(Et.length>0)throw new f(`Cannot remove the shared store for "${y(ae.name)}" while ${Et.map(ie=>y(ie)).join(", ")} still link to it.
266
- Remove those first, or run \`webflow skills remove ${y(ae.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${b} Cannot remove skills:`})}let v=[];for(let ae of A)v.push(await tP({identity:ae,agents:m===null?w:w.filter(Et=>m.includes(Et.id)),allAgents:w,scope:s,root:a,storeBase:l,removalTargets:E}));if(i)return{...eh({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:m,warnings:o,lock:p,plans:v}),skills:v.map(ae=>dP(ae,s)),summary:{requested:v.length,removed:0,storeDeleted:v.filter(ae=>ae.storeWillBeDeleted).length,storeKept:v.filter(ae=>ae.onDisk&&!ae.storeWillBeDeleted).length,staleLockEntriesRemoved:v.filter(ae=>!ae.onDisk).length,failed:0},lockfileEmpty:uP(p,v),lockfileDeleted:!1};if(!await aP(v,s,t,r))return r||u.info("Removal cancelled \u2014 no changes made."),cC({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:m,warnings:o,lock:p});let M=new Set(k.skillDirs),B=$o({path:c,kind:s,lock:p}),U=[],Ie=[],Ze=[];for(let ae of v){let Et=A.find(ie=>ie.dir===ae.dir);Ie.push(await nP({plan:ae,identity:Et,scope:s,root:a,storeBase:l,knownDirs:M,writer:B,failures:U,removedDirectories:Ze}))}await B.flush({force:!0});let Ee=$u(B.lock),Ke=!1;return Ee&&s==="global"&&(Ke=await Zg(c)),{...eh({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:m,warnings:o,lock:p,plans:v}),skills:Ie,removedDirectories:Ze,failures:U,summary:{requested:v.length,removed:Ie.filter(ae=>ae.success).length,storeDeleted:Ie.filter(ae=>ae.storeAction==="deleted").length,storeKept:Ie.filter(ae=>ae.storeAction==="kept").length,staleLockEntriesRemoved:Ie.filter(ae=>ae.storeAction==="absent"&&ae.lockEntry==="removed").length,failed:U.length},lockfileEmpty:Ee,lockfileDeleted:Ke}}async function XO(e){let{agents:t,scope:r,root:n,storeBase:o,warnings:i}=e,s=new Set,a=new Set,l=c=>i.push(c);for(let c of[o,...rh(t,r,n,l)]){if(await pP(c)){i.push(`${Ua(c)} is a symbolic link, not a directory. Skills are not removed through one \u2014 repoint or replace it, then re-run.`);continue}a.add(c);let d;try{d=await bt.default.promises.readdir(c,{withFileTypes:!0})}catch(p){let h=p.code;h!=="ENOENT"&&h!=="ENOTDIR"&&i.push(`Could not read ${Ua(c)}: ${th(p)}`);continue}for(let p of d)(p.isDirectory()||p.isSymbolicLink())&&s.add(p.name)}return{dirNames:s,skillDirs:a}}function rh(e,t,r,n){let o=new Set;for(let i of e){try{let a=Ot(i,t,r);if(a!==null){if(et(r,a))o.add(a);else if(n){let l=Ru(a);n(`${Ua(a)} resolves outside ${Ua(r)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=nt.default.resolve(r,...i.skillsDir.split("/"));s.startsWith(nt.default.resolve(r)+nt.default.sep)&&o.add(s)}return[...o]}function uC(e,t){let r=new Map;for(let n of e)r.set(n,{name:n,dir:n,folderName:n,entry:null});for(let n of ur(t)){let o=t.skills[n];r.set(o.dir,{name:n,dir:o.dir,folderName:o.skillPath?Cn(o.skillPath):o.dir,entry:o})}return[...r.values()]}function Wu(e){return e.entry===null}function ZO(e){return new f(`"${y(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
267
- It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${b} Refusing to remove an unmanaged skill directory:`})}async function QO(e){let{names:t,options:r,identities:n,scope:o,cwd:i,json:s,warnings:a}=e,l=r.force===!0,c=n.filter(g=>!Wu(g)),d=n.filter(Wu);if(t.length>0){let g=[];for(let m of t){let w=Jr(m,n);if(w.kind==="match"){if(!l&&Wu(w.skill))throw ZO(w.skill);g.includes(w.skill)||g.push(w.skill);continue}throw w.kind==="ambiguous"?new f(`"${y(m)}" matches ${w.matches.length} installed skills: ${w.matches.map(k=>y(k.dir)).join(", ")}.
268
- Name one of them exactly.`,{isUserError:!0,prefix:`${b} Cannot remove skills:`}):await eP(m,w.candidates,o,i)}return g}if(r.all)return l?n:(sC(d,a),c);if(W()||s)throw new f("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${b} Nothing to remove:`});let p=l?n:c;return l||sC(d,a),p.length===0?[]:await fr({message:`Which skills should be removed (${o} scope)?`,choices:p.map(g=>({value:g,name:`${y(g.dir)}${Wu(g)?" (not in the lockfile)":""}`})),validate:g=>g.length>0?!0:"Select at least one skill."})??[]}function sC(e,t){e.length!==0&&t.push(`${e.length} skill ${e.length===1?"directory":"directories"} have no lockfile entry and were left untouched: ${e.map(r=>y(r.dir)).join(", ")}. Pass --force to remove them too.`)}async function eP(e,t,r,n){let o=r==="project"?"global":"project",i=o==="global"?Ba.default.homedir():n,s=o==="global"?Io():Ro(i),a=await Fr(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await bt.default.promises.readdir(rt(o,i)).catch(()=>[]);if(Jr(e,uC(c,l)).kind!=="none")return new f(`"${y(e)}" is not installed at ${r} scope (${Ua(r==="global"?Ba.default.homedir():n)}), but it IS installed ${o==="global"?"globally":"in this project"}. Re-run with --${o} to remove it.`,{isUserError:!0,missingFlag:o,prefix:`${b} Cannot remove skills:`})}}return new f(`"${y(e)}" is not installed at ${r} scope.
269
- `+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>y(l)).join(", ")}`),{isUserError:!0,prefix:`${b} Cannot remove skills:`})}async function tP(e){let{identity:t,agents:r,scope:n,root:o,storeBase:i,removalTargets:s}=e,a=nt.default.join(i,t.dir),l=new Map;for(let h of r)for(let g of rh([h],n,o)){let m=nt.default.join(g,t.dir);if(He(m,a))continue;let w=l.get(m);if(w){w.agents.push(h.id);continue}await Vu(m)&&l.set(m,{agent:h.id,agents:[h.id],label:h.displayName,path:m})}let c=[...l.values()].sort((h,g)=>h.path<g.path?-1:h.path>g.path?1:0),{deleted:d,keptBecause:p}=await rP({identity:t,allAgents:e.allAgents,scope:n,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await Vu(a),targets:c,storeWillBeDeleted:d,keptBecause:p}}async function rP(e){let{identity:t,removalTargets:r}=e,n=t.entry?.agents??[];if(n.length>0){let i=n.filter(s=>!r.has(s)).sort((s,a)=>s<a?-1:s>a?1:0);return{deleted:i.length===0,keptBecause:i}}let o=[];for(let i of e.allAgents)if(!r.has(i.id))for(let s of rh([i],e.scope,e.root)){let a=nt.default.join(s,t.dir);if(!He(a,nt.default.join(e.storeBase,t.dir))&&await Vu(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function nP(e){let{plan:t,identity:r,scope:n,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let p of t.targets){let h=await Vu(p.path);try{await aC({target:p.path,slug:t.dir,knownDirs:o,root:e.root}),await lC(p.path),a.push({...p,action:h?"unlinked":"absent",error:null})}catch(g){l=!0;let m=th(g);s.push({name:r.name,agent:p.agent,...Hu(g)!==void 0?{errno:Hu(g)}:{},message:m}),a.push({...p,action:"failed",error:m})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await aC({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await lC(t.storePath),c="deleted"}catch(p){l=!0,c="failed",s.push({name:r.name,...Hu(p)!==void 0?{errno:Hu(p)}:{},message:th(p)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let d="absent";return!l&&r.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(r.name,{...r.entry,agents:t.keptBecause}),d="updated"):d=await i.forget(r.name)?"removed":"absent"),l||e.removedDirectories.push(...await iP({targets:t.targets,storeBase:e.storeBase,storeDeleted:c==="deleted"||c==="absent",root:e.root,scope:n})),{name:r.name,dir:t.dir,scope:n,storePath:t.storePath,storeAction:c,keptBecause:t.keptBecause,lockEntry:d,targets:a,success:!l,error:null}}async function aC(e){let{target:t,slug:r,knownDirs:n,root:o}=e;if(nt.default.basename(t)!==r)throw new f(`Refusing to delete ${y(t)}: its final component is not "${y(r)}".`);let i=nt.default.dirname(t),s;try{s=await bt.default.promises.realpath(i)}catch{throw new f(`Refusing to delete ${y(t)}: its parent directory ${y(i)} could not be resolved.`)}if(!await oP(n,s))throw new f(`Refusing to delete ${y(t)}: ${y(i)} is not a known skills directory.`);let l=await bt.default.promises.realpath(o).catch(()=>o);if(He(s,l))throw new f(`Refusing to delete ${y(t)}: ${y(i)} resolves to the scope root itself, not to a skills directory.`);Re(l,nt.default.join(s,nt.default.basename(t)),"a skill directory being removed")}async function oP(e,t){for(let r of e){if(He(r,t))return!0;let n=await bt.default.promises.realpath(r).catch(()=>null);if(n!==null&&He(n,t))return!0}return!1}async function lC(e){let t=null;try{t=await bt.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await bt.default.promises.rm(e,{force:!0});return}await bt.default.promises.rm(e,{recursive:!0,force:!0})}async function iP(e){let t=[],r=new Set([e.root,Ba.default.homedir(),nt.default.dirname(e.root)].map(o=>nt.default.resolve(o))),n=[];for(let o of e.targets)n.push(nt.default.dirname(o.path));e.storeDeleted&&n.push(e.storeBase,nt.default.dirname(e.storeBase));for(let o of n){let i=nt.default.resolve(o);if(!r.has(i)&&et(e.root,i))try{let s=await bt.default.promises.realpath(i);if(r.has(s)||!await sP(e.root,s))continue;await bt.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function sP(e,t){let r=await bt.default.promises.realpath(e).catch(()=>e);return et(r,t)&&!He(r,t)}async function aP(e,t,r,n){if(r.yes)return!0;if(W()||n)throw new f(`Removal requires confirmation in non-interactive mode.
270
- Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${b} Cannot remove skills:`});return u.info(Ig(e,t)),Pe({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function lP(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${he} ${y(r)}`);if(e.dryRun){u.info(Ig(e.skills.map(r=>({name:r.name,dir:r.dir,storePath:r.storePath,onDisk:r.storeAction!=="absent",targets:r.targets,storeWillBeDeleted:r.storeAction==="deleted",keptBecause:r.keptBecause})),e.scope,{dryRun:!0}));return}u.info(fx(e))}function cP(e,t){let r=new Set;for(let o of e??[]){let i=t.skills[o.name]?.mode;i!==void 0&&r.add(i)}if(r.size!==1)return null;let[n]=[...r];return n==="copy"?"copy":"symlink"}function eh(e){return{kind:"skills.remove",schemaVersion:Fn,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:cP(e.plans,e.lock),source:{...e.lock.source},agents:e.filterIds,skills:[],removedDirectories:[],failures:[],summary:{requested:0,removed:0,storeDeleted:0,storeKept:0,staleLockEntriesRemoved:0,failed:0},lockfileEmpty:!1,lockfileDeleted:!1,warnings:[...new Set(e.warnings)]}}function cC(e){return{...eh(e),lockfileEmpty:$u(e.lock)}}function uP(e,t){let r=new Set(t.filter(n=>n.keptBecause.length===0).map(n=>n.name));return ur(e).every(n=>r.has(n))}function dP(e,t){return{name:e.name,dir:e.dir,scope:t,storePath:e.storePath,storeAction:e.onDisk?e.storeWillBeDeleted?"deleted":"kept":"absent",keptBecause:e.keptBecause,lockEntry:e.keptBecause.length>0?"updated":"removed",targets:e.targets.map(r=>({...r,action:"unlinked",error:null})),success:!0,error:null}}async function pP(e){try{return(await bt.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function Vu(e){try{return await bt.default.promises.lstat(e),!0}catch{return!1}}function Hu(e){let t=e?.code;return typeof t=="string"?t:void 0}function th(e){return y(e instanceof Error?e.message:String(e))}function fP(){let e=xt();return e?_.forSkills({authToken:e}):null}function Ua(e){return _o(e)}var Xi=D(require("fs")),fC=D(require("os")),dr=D(require("path"));J();S();pe();Ae();x();N();z();function mC(e){let{presence:t,upstream:r,local:n,force:o}=e;if(!e.hasSkillPath){if(!e.foundByName)return{guard:"G2",state:"untracked",action:"skipped",willWrite:!1,blocked:!1,reason:"tracking-unrepairable"};let c=n==="differs";return{guard:"G2",state:"untracked",action:"repaired",willWrite:n==="absent"||r==="differs"&&!c||o,blocked:!1,reason:c&&!o?"locally-modified":null}}if(n==="absent"&&t==="missing")return{guard:"G3",state:"stale-entry",action:"stale",willWrite:!1,blocked:!1,reason:"not-on-disk-and-removed-upstream"};if(n==="absent")return{guard:"G4",state:"missing",action:"reinstalled",willWrite:!0,blocked:!1,reason:"store-directory-missing"};if(t==="missing")return{guard:"G5",state:"removed-upstream",action:"orphaned",willWrite:!1,blocked:!1,reason:n==="differs"?"removed-upstream-and-locally-modified":"removed-upstream"};let i=t==="moved",s=i?"renamed-upstream":n==="differs"?r==="differs"?"conflict":"locally-modified":r==="differs"?"upstream-changed":"unchanged";if(n==="same")return i?{guard:"grid",state:s,action:r==="differs"?"moved+updated":"moved",willWrite:!0,blocked:!1,reason:"renamed-upstream"}:r==="differs"?{guard:"grid",state:s,action:"updated",willWrite:!0,blocked:!1,reason:null}:{guard:"grid",state:s,action:"unchanged",willWrite:!1,blocked:!1,reason:null};let a=i?r==="differs"?"moved-upstream-changed-upstream-and-locally-modified":"moved-upstream-and-locally-modified":r==="differs"?"locally-modified-and-upstream-changed":"locally-modified";if(o)return{guard:"grid",state:s,action:i?r==="differs"?"moved+updated":"moved":"updated",willWrite:!0,blocked:!1,reason:a};let l=!i&&r==="same";return{guard:"grid",state:s,action:l?"skipped":"blocked",willWrite:!1,blocked:!l,reason:a}}async function Ku(e,t){let r=Date.now(),n=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${b} Cannot update skills:`});let i=NP(),s=t.json===!0||ze();try{let a=await mP({names:e,options:t,checkOnly:n,force:o,json:s});await i?.sendUsage("skills_update",{duration:Date.now()-r,count:a.summary.checked,updated:a.summary.updated,blocked:a.summary.blocked,failed:a.summary.failed,relinked:a.summary.relinked,checkOnly:n,force:o,scopeCount:a.scopes.length}),$P(a,s),(a.failures.length>0||!n&&a.summary.conflicts>0&&a.summary.updated===0)&&(process.exitCode=1)}catch(a){throw await i?.sendError(a instanceof Error?a:new Error(String(a)),"skills_update",{duration:Date.now()-r,checkOnly:n,force:o}),a instanceof f?a:new f(a,{prefix:`${b} Failed to update skills:`})}}async function mP(e){let{names:t,options:r,checkOnly:n,force:o,json:i}=e,s=[],a=process.cwd(),l=await gP(r,a,n,s);if(l.length===0)return oh({checkOnly:n,force:o,warnings:s});let c=hP(l,t,r);if(c.length===0)return oh({checkOnly:n,force:o,warnings:s,scopes:l.map(v=>v.scope)});let d=new Map;for(let{state:v,key:M}of c){let B=nh(r,v.lock,M);d.has(B)||d.set(B,(await ka(B)).commit)}let p=new Map;for(let{state:v,key:M}of c){let B=v.lock.skills[M];p.set(`${v.scope}\0${M}`,await kP(v,B))}let h=c.every(({state:v,key:M})=>{let B=v.lock.skills[M];return d.get(nh(r,v.lock,M))===B.commit}),g=c.every(({state:v,key:M})=>p.get(`${v.scope}\0${M}`)!==null);if(h&&g&&r.ref===void 0&&!o)return PP({selected:c,states:l,localDigests:p,refs:d,options:r,checkOnly:n,force:o,warnings:s});let m=new Map;for(let v of new Set(d.values()))m.set(v,await DP(v,s));let w=[],k=[];for(let{state:v,key:M}of c){let B=v.lock.skills[M],U=nh(r,v.lock,M),Ie=d.get(U),Ze=m.get(Ie);try{w.push(await bP({state:v,key:M,entry:B,ref:U,commit:Ie,catalog:Ze,force:o,checkOnly:n,localDigest:p.get(`${v.scope}\0${M}`)??null,warnings:s}))}catch(Ee){k.push({name:M,errno:pC(Ee),message:ih(Ee)})}}let F=w.filter(v=>v.localDrift==="differs"&&v.outcome.willWrite);if(!n&&F.length>0&&!await TP(F,r,i))return oh({checkOnly:n,force:o,warnings:s,scopes:l.map(M=>M.scope),cancelled:!0});let A=new Map,E=[];if(!n)for(let v of l)v.readOnly||await Oa(v.storeBase,{dryRun:!1});for(let v of w)try{E.push(await SP({candidate:v,checkOnly:n,force:o,options:r,writers:A,failures:k,warnings:s}))}catch(M){k.push({name:v.key,errno:pC(M),message:ih(M)}),E.push(RP(v,ih(M)))}if(r.ref!==void 0&&!n)for(let v of l)v.readOnly||gC(v,A);for(let[v,M]of A){let B=l.find(Ee=>Ee.scope===v),U=r.ref??B.lock.source.ref??je,Ie=d.get(U)??w.find(Ee=>Ee.scopeState.scope===v)?.commit,Ze=DC(m);M.updateSource({ref:U,...Ie!==void 0?{commit:Ie}:{},...Ze!==void 0?{pluginVersion:Ze}:{}}),await M.flush({force:!0})}return OP({reports:E,candidates:w,failures:k,states:l,refs:d,catalogs:m,options:r,checkOnly:n,force:o,warnings:s})}async function gP(e,t,r,n){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?fC.default.homedir():t,l=s==="global"?Io():Ro(a),c=await Fr(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw Oo(c);if(c.kind==="too-new"){if(!r||c.lock===null)throw Po(c);n.push(`${Ha(l)} was written by a newer Webflow CLI (lockfile version ${c.version}); reporting read-only.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:rt(s,a),readOnly:!0});continue}c.migratedFrom!==void 0&&n.push(`${Ha(l)} uses lockfile version ${c.migratedFrom}; the next write upgrades it.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:rt(s,a),readOnly:r})}}return i}function hP(e,t,r){if(t.length===0)return e.flatMap(s=>ur(s.lock).map(a=>({state:s,key:a})));let n=r.global===!0||r.project===!0,o=[],i=new Set;for(let s of t){let a=[];for(let l of e){let c=Jr(s,wP(l.lock));if(c.kind==="ambiguous")throw new f(`"${y(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(d=>y(d.name)).join(", ")}.
271
- Name one of them exactly.`,{isUserError:!0,prefix:`${b} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw yP(s,e);if(a.length>1&&!n)throw new f(`"${y(s)}" is installed at more than one scope:
272
- `+a.map(l=>` ${l.state.scope}: ${Ha(l.state.lockPath)}`).join(`
277
+ `));for(let g of md(o))u.info(g);return sy({inventories:d,summary:m,fields:i,json:t,agentFilter:l})}function BL(e){if(e.global===!0&&e.project===!0)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function UL(e,t){let n=(e??ml).split(",").map(i=>i.trim()).filter(Boolean),{valid:r,invalid:o}=jL(n);if(r.length===0)throw new f(`No valid fields specified. Available: ${Yo.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${Yo.join(", ")}`),r}function WL(e){if(e===void 0||e==="")return NL;let t=Es.find(n=>n===e.trim().toLowerCase());if(t===void 0)throw new f(`Cannot sort by "${e}". Available: ${Es.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function HL(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new f(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function VL(e){let t=bs(e);return t.length===0?null:new Set(ks(t).map(n=>n.id))}function sy(e){let t=new Set;for(let n of e.inventories)for(let r of n.skills)for(let o of r.agents)t.add(o.id);return{count:e.summary.total,scopes:e.inventories.map(n=>n.scope),statusCounts:{upToDate:e.summary.upToDate,modified:e.summary.modified,missing:e.summary.missing,unmanaged:e.summary.unmanaged},agentIds:[...t].sort(),json:e.json,fieldCount:e.fields.length,agentFiltered:e.agentFilter!==null}}var Ct=w(require("fs")),El=w(require("os")),st=w(require("path"));q();C();we();Te();_();M();X();async function Md(e,t){let n=Date.now(),r=lN();try{let o=t.json===!0||Ye(),i=await GL(e,t,o);await r?.sendUsage("skills_remove",{duration:Date.now()-n,count:i.summary.requested,removed:i.summary.removed,storeDeleted:i.summary.storeDeleted,storeKept:i.summary.storeKept,failed:i.summary.failed,dryRun:i.dryRun,agentFiltered:i.agents!==null}),rN(i,o),i.failures.length>0&&(process.exitCode=1)}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),"skills_remove",{duration:Date.now()-n,dryRun:t.dryRun===!0}),o instanceof f?o:new f(o,{prefix:`${k} Failed to remove skills:`})}}async function GL(e,t,n){let r=process.cwd(),o=[],i=t.dryRun===!0,s=await hd(t,r,n),a=s==="global"?El.default.homedir():r,l=it(s,a),c=s==="global"?ti():ei(a),d=await Nn(c);if(d.kind==="corrupt")throw ni(d);if(d.kind==="too-new")throw ri(d);let p=d.kind==="ok"?d.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=bs(t.agent),g=m.length===0||m.includes(dl)?null:ks(m).map(E=>E.id),y=On(s),b=await JL({agents:y,scope:s,root:a,storeBase:l,warnings:o}),S=l_(b.dirNames,p),A=await zL({names:e,options:t,identities:S,scope:s,cwd:r,json:n,warnings:o});if(A.length===0)return a_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p});let v=new Set(g??[...qo,Qt]);if(g?.includes(Qt))for(let E of A){let z=(E.entry?.agents??[]).filter(U=>U!==Qt&&!v.has(U));if(z.length>0)throw new f(`Cannot remove the shared store for "${D(E.name)}" while ${z.map(U=>D(U)).join(", ")} still link to it.
278
+ Remove those first, or run \`webflow skills remove ${D(E.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${k} Cannot remove skills:`})}let x=[];for(let E of A)x.push(await XL({identity:E,agents:g===null?y:y.filter(z=>g.includes(z.id)),allAgents:y,scope:s,root:a,storeBase:l,removalTargets:v}));if(i)return{...ay({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p,plans:x}),skills:x.map(E=>sN(E,s)),summary:{requested:x.length,removed:0,storeDeleted:x.filter(E=>E.storeWillBeDeleted).length,storeKept:x.filter(E=>E.onDisk&&!E.storeWillBeDeleted).length,staleLockEntriesRemoved:x.filter(E=>!E.onDisk).length,failed:0},lockfileEmpty:iN(p,x),lockfileDeleted:!1};if(!await nN(x,s,t,n))return n||u.info("Removal cancelled \u2014 no changes made."),a_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p});let O=new Set(b.skillDirs),H=oi({path:c,kind:s,lock:p}),B=[],ye=[],ve=[];for(let E of x){let z=A.find(U=>U.dir===E.dir);ye.push(await ZL({plan:E,identity:z,scope:s,root:a,storeBase:l,knownDirs:O,writer:H,failures:B,removedDirectories:ve}))}await H.flush({force:!0});let me=Ad(H.lock),Le=!1;return me&&s==="global"&&(Le=await iy(c)),{...ay({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p,plans:x}),skills:ye,removedDirectories:ve,failures:B,summary:{requested:x.length,removed:ye.filter(E=>E.success).length,storeDeleted:ye.filter(E=>E.storeAction==="deleted").length,storeKept:ye.filter(E=>E.storeAction==="kept").length,staleLockEntriesRemoved:ye.filter(E=>E.storeAction==="absent"&&E.lockEntry==="removed").length,failed:B.length},lockfileEmpty:me,lockfileDeleted:Le}}async function JL(e){let{agents:t,scope:n,root:r,storeBase:o,warnings:i}=e,s=new Set,a=new Set,l=c=>i.push(c);for(let c of[o,...cy(t,n,r,l)]){if(await aN(c)){i.push(`${vl(c)} is a symbolic link, not a directory. Skills are not removed through one \u2014 repoint or replace it, then re-run.`);continue}a.add(c);let d;try{d=await Ct.default.promises.readdir(c,{withFileTypes:!0})}catch(p){let m=p.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${vl(c)}: ${ly(p)}`);continue}for(let p of d)(p.isDirectory()||p.isSymbolicLink())&&s.add(p.name)}return{dirNames:s,skillDirs:a}}function cy(e,t,n,r){let o=new Set;for(let i of e){try{let a=Lt(i,t,n);if(a!==null){if(rt(n,a))o.add(a);else if(r){let l=xd(a);r(`${vl(a)} resolves outside ${vl(n)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=st.default.resolve(n,...i.skillsDir.split("/"));s.startsWith(st.default.resolve(n)+st.default.sep)&&o.add(s)}return[...o]}function l_(e,t){let n=new Map;for(let r of e)n.set(r,{name:r,dir:r,folderName:r,entry:null});for(let r of wn(t)){let o=t.skills[r];n.set(o.dir,{name:r,dir:o.dir,folderName:o.skillPath?Vr(o.skillPath):o.dir,entry:o})}return[...n.values()]}function Ld(e){return e.entry===null}function KL(e){return new f(`"${D(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
279
+ It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${k} Refusing to remove an unmanaged skill directory:`})}async function zL(e){let{names:t,options:n,identities:r,scope:o,cwd:i,json:s,warnings:a}=e,l=n.force===!0,c=r.filter(h=>!Ld(h)),d=r.filter(Ld);if(t.length>0){let h=[];for(let g of t){let y=ar(g,r);if(y.kind==="match"){if(!l&&Ld(y.skill))throw KL(y.skill);h.includes(y.skill)||h.push(y.skill);continue}throw y.kind==="ambiguous"?new f(`"${D(g)}" matches ${y.matches.length} installed skills: ${y.matches.map(b=>D(b.dir)).join(", ")}.
280
+ Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot remove skills:`}):await qL(g,y.candidates,o,i)}return h}if(n.all)return l?r:(o_(d,a),c);if(V()||s)throw new f("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${k} Nothing to remove:`});let p=l?r:c;return l||o_(d,a),p.length===0?[]:await En({message:`Which skills should be removed (${o} scope)?`,choices:p.map(h=>({value:h,name:`${D(h.dir)}${Ld(h)?" (not in the lockfile)":""}`})),validate:h=>h.length>0?!0:"Select at least one skill."})??[]}function o_(e,t){e.length!==0&&t.push(`${e.length} skill ${e.length===1?"directory":"directories"} have no lockfile entry and were left untouched: ${e.map(n=>D(n.dir)).join(", ")}. Pass --force to remove them too.`)}async function qL(e,t,n,r){let o=n==="project"?"global":"project",i=o==="global"?El.default.homedir():r,s=o==="global"?ti():ei(i),a=await Nn(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await Ct.default.promises.readdir(it(o,i)).catch(()=>[]);if(ar(e,l_(c,l)).kind!=="none")return new f(`"${D(e)}" is not installed at ${n} scope (${vl(n==="global"?El.default.homedir():r)}), but it IS installed ${o==="global"?"globally":"in this project"}. Re-run with --${o} to remove it.`,{isUserError:!0,missingFlag:o,prefix:`${k} Cannot remove skills:`})}}return new f(`"${D(e)}" is not installed at ${n} scope.
281
+ `+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>D(l)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot remove skills:`})}async function XL(e){let{identity:t,agents:n,scope:r,root:o,storeBase:i,removalTargets:s}=e,a=st.default.join(i,t.dir),l=new Map;for(let m of n)for(let h of cy([m],r,o)){let g=st.default.join(h,t.dir);if(qe(g,a))continue;let y=l.get(g);if(y){y.agents.push(m.id);continue}await jd(g)&&l.set(g,{agent:m.id,agents:[m.id],label:m.displayName,path:g})}let c=[...l.values()].sort((m,h)=>m.path<h.path?-1:m.path>h.path?1:0),{deleted:d,keptBecause:p}=await YL({identity:t,allAgents:e.allAgents,scope:r,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await jd(a),targets:c,storeWillBeDeleted:d,keptBecause:p}}async function YL(e){let{identity:t,removalTargets:n}=e,r=t.entry?.agents??[];if(r.length>0){let i=r.filter(s=>!n.has(s)).sort((s,a)=>s<a?-1:s>a?1:0);return{deleted:i.length===0,keptBecause:i}}let o=[];for(let i of e.allAgents)if(!n.has(i.id))for(let s of cy([i],e.scope,e.root)){let a=st.default.join(s,t.dir);if(!qe(a,st.default.join(e.storeBase,t.dir))&&await jd(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function ZL(e){let{plan:t,identity:n,scope:r,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let p of t.targets){let m=await jd(p.path);try{await i_({target:p.path,slug:t.dir,knownDirs:o,root:e.root}),await s_(p.path),a.push({...p,action:m?"unlinked":"absent",error:null})}catch(h){l=!0;let g=ly(h);s.push({name:n.name,agent:p.agent,...Nd(h)!==void 0?{errno:Nd(h)}:{},message:g}),a.push({...p,action:"failed",error:g})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await i_({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await s_(t.storePath),c="deleted"}catch(p){l=!0,c="failed",s.push({name:n.name,...Nd(p)!==void 0?{errno:Nd(p)}:{},message:ly(p)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let d="absent";return!l&&n.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(n.name,{...n.entry,agents:t.keptBecause}),d="updated"):d=await i.forget(n.name)?"removed":"absent"),l||e.removedDirectories.push(...await eN({targets:t.targets,storeBase:e.storeBase,storeDeleted:c==="deleted"||c==="absent",root:e.root,scope:r})),{name:n.name,dir:t.dir,scope:r,storePath:t.storePath,storeAction:c,keptBecause:t.keptBecause,lockEntry:d,targets:a,success:!l,error:null}}async function i_(e){let{target:t,slug:n,knownDirs:r,root:o}=e;if(st.default.basename(t)!==n)throw new f(`Refusing to delete ${D(t)}: its final component is not "${D(n)}".`);let i=st.default.dirname(t),s;try{s=await Ct.default.promises.realpath(i)}catch{throw new f(`Refusing to delete ${D(t)}: its parent directory ${D(i)} could not be resolved.`)}if(!await QL(r,s))throw new f(`Refusing to delete ${D(t)}: ${D(i)} is not a known skills directory.`);let l=await Ct.default.promises.realpath(o).catch(()=>o);if(qe(s,l))throw new f(`Refusing to delete ${D(t)}: ${D(i)} resolves to the scope root itself, not to a skills directory.`);Be(l,st.default.join(s,st.default.basename(t)),"a skill directory being removed")}async function QL(e,t){for(let n of e){if(qe(n,t))return!0;let r=await Ct.default.promises.realpath(n).catch(()=>null);if(r!==null&&qe(r,t))return!0}return!1}async function s_(e){let t=null;try{t=await Ct.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await Ct.default.promises.rm(e,{force:!0});return}await Ct.default.promises.rm(e,{recursive:!0,force:!0})}async function eN(e){let t=[],n=new Set([e.root,El.default.homedir(),st.default.dirname(e.root)].map(o=>st.default.resolve(o))),r=[];for(let o of e.targets)r.push(st.default.dirname(o.path));e.storeDeleted&&r.push(e.storeBase,st.default.dirname(e.storeBase));for(let o of r){let i=st.default.resolve(o);if(!n.has(i)&&rt(e.root,i))try{let s=await Ct.default.promises.realpath(i);if(n.has(s)||!await tN(e.root,s))continue;await Ct.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function tN(e,t){let n=await Ct.default.promises.realpath(e).catch(()=>e);return rt(n,t)&&!qe(n,t)}async function nN(e,t,n,r){if(n.yes)return!0;if(V()||r)throw new f(`Removal requires confirmation in non-interactive mode.
282
+ Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot remove skills:`});return u.info(Mh(e,t)),Re({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function rN(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let n of e.warnings)u.warn(`${re} ${D(n)}`);if(e.dryRun){u.info(Mh(e.skills.map(n=>({name:n.name,dir:n.dir,storePath:n.storePath,onDisk:n.storeAction!=="absent",targets:n.targets,storeWillBeDeleted:n.storeAction==="deleted",keptBecause:n.keptBecause})),e.scope,{dryRun:!0}));return}u.info(dF(e))}function oN(e,t){let n=new Set;for(let o of e??[]){let i=t.skills[o.name]?.mode;i!==void 0&&n.add(i)}if(n.size!==1)return null;let[r]=[...n];return r==="copy"?"copy":"symlink"}function ay(e){return{kind:"skills.remove",schemaVersion:Jr,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:oN(e.plans,e.lock),source:{...e.lock.source},agents:e.filterIds,skills:[],removedDirectories:[],failures:[],summary:{requested:0,removed:0,storeDeleted:0,storeKept:0,staleLockEntriesRemoved:0,failed:0},lockfileEmpty:!1,lockfileDeleted:!1,warnings:[...new Set(e.warnings)]}}function a_(e){return{...ay(e),lockfileEmpty:Ad(e.lock)}}function iN(e,t){let n=new Set(t.filter(r=>r.keptBecause.length===0).map(r=>r.name));return wn(e).every(r=>n.has(r))}function sN(e,t){return{name:e.name,dir:e.dir,scope:t,storePath:e.storePath,storeAction:e.onDisk?e.storeWillBeDeleted?"deleted":"kept":"absent",keptBecause:e.keptBecause,lockEntry:e.keptBecause.length>0?"updated":"removed",targets:e.targets.map(n=>({...n,action:"unlinked",error:null})),success:!0,error:null}}async function aN(e){try{return(await Ct.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function jd(e){try{return await Ct.default.promises.lstat(e),!0}catch{return!1}}function Nd(e){let t=e?.code;return typeof t=="string"?t:void 0}function ly(e){return D(e instanceof Error?e.message:String(e))}function lN(){let e=At();return e?F.forSkills({authToken:e}):null}function vl(e){return Xo(e)}var _s=w(require("fs")),d_=w(require("os")),Dn=w(require("path"));q();C();we();Te();_();M();X();function p_(e){let{presence:t,upstream:n,local:r,force:o}=e;if(!e.hasSkillPath){if(!e.foundByName)return{guard:"G2",state:"untracked",action:"skipped",willWrite:!1,blocked:!1,reason:"tracking-unrepairable"};let c=r==="differs";return{guard:"G2",state:"untracked",action:"repaired",willWrite:r==="absent"||n==="differs"&&!c||o,blocked:!1,reason:c&&!o?"locally-modified":null}}if(r==="absent"&&t==="missing")return{guard:"G3",state:"stale-entry",action:"stale",willWrite:!1,blocked:!1,reason:"not-on-disk-and-removed-upstream"};if(r==="absent")return{guard:"G4",state:"missing",action:"reinstalled",willWrite:!0,blocked:!1,reason:"store-directory-missing"};if(t==="missing")return{guard:"G5",state:"removed-upstream",action:"orphaned",willWrite:!1,blocked:!1,reason:r==="differs"?"removed-upstream-and-locally-modified":"removed-upstream"};let i=t==="moved",s=i?"renamed-upstream":r==="differs"?n==="differs"?"conflict":"locally-modified":n==="differs"?"upstream-changed":"unchanged";if(r==="same")return i?{guard:"grid",state:s,action:n==="differs"?"moved+updated":"moved",willWrite:!0,blocked:!1,reason:"renamed-upstream"}:n==="differs"?{guard:"grid",state:s,action:"updated",willWrite:!0,blocked:!1,reason:null}:{guard:"grid",state:s,action:"unchanged",willWrite:!1,blocked:!1,reason:null};let a=i?n==="differs"?"moved-upstream-changed-upstream-and-locally-modified":"moved-upstream-and-locally-modified":n==="differs"?"locally-modified-and-upstream-changed":"locally-modified";if(o)return{guard:"grid",state:s,action:i?n==="differs"?"moved+updated":"moved":"updated",willWrite:!0,blocked:!1,reason:a};let l=!i&&n==="same";return{guard:"grid",state:s,action:l?"skipped":"blocked",willWrite:!1,blocked:!l,reason:a}}async function Bd(e,t){let n=Date.now(),r=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${k} Cannot update skills:`});let i=TN(),s=t.json===!0||Ye();try{let a=await cN({names:e,options:t,checkOnly:r,force:o,json:s});await i?.sendUsage("skills_update",{duration:Date.now()-n,count:a.summary.checked,updated:a.summary.updated,blocked:a.summary.blocked,failed:a.summary.failed,relinked:a.summary.relinked,checkOnly:r,force:o,scopeCount:a.scopes.length}),IN(a,s),(a.failures.length>0||!r&&a.summary.conflicts>0&&a.summary.updated===0)&&(process.exitCode=1)}catch(a){throw await i?.sendError(a instanceof Error?a:new Error(String(a)),"skills_update",{duration:Date.now()-n,checkOnly:r,force:o}),a instanceof f?a:new f(a,{prefix:`${k} Failed to update skills:`})}}async function cN(e){let{names:t,options:n,checkOnly:r,force:o,json:i}=e,s=[],a=process.cwd(),l=await uN(n,a,r,s);if(l.length===0)return dy({checkOnly:r,force:o,warnings:s});let c=dN(l,t,n);if(c.length===0)return dy({checkOnly:r,force:o,warnings:s,scopes:l.map(x=>x.scope)});let d=new Map;for(let{state:x,key:O}of c){let H=uy(n,x.lock,O);d.has(H)||d.set(H,(await nl(H)).commit)}let p=new Map;for(let{state:x,key:O}of c){let H=x.lock.skills[O];p.set(`${x.scope}\0${O}`,await gN(x,H))}let m=c.every(({state:x,key:O})=>{let H=x.lock.skills[O];return d.get(uy(n,x.lock,O))===H.commit}),h=c.every(({state:x,key:O})=>p.get(`${x.scope}\0${O}`)!==null);if(m&&h&&n.ref===void 0&&!o)return AN({selected:c,states:l,localDigests:p,refs:d,options:n,checkOnly:r,force:o,warnings:s});let g=new Map;for(let x of new Set(d.values()))g.set(x,await mN(x,s));let y=[],b=[];for(let{state:x,key:O}of c){let H=x.lock.skills[O],B=uy(n,x.lock,O),ye=d.get(B),ve=g.get(ye);try{y.push(await hN({state:x,key:O,entry:H,ref:B,commit:ye,catalog:ve,force:o,checkOnly:r,localDigest:p.get(`${x.scope}\0${O}`)??null,warnings:s}))}catch(me){b.push({name:O,errno:u_(me),message:py(me)})}}let S=y.filter(x=>x.localDrift==="differs"&&x.outcome.willWrite);if(!r&&S.length>0&&!await xN(S,n,i))return dy({checkOnly:r,force:o,warnings:s,scopes:l.map(O=>O.scope),cancelled:!0});let A=new Map,v=[];if(!r)for(let x of l)x.readOnly||await gl(x.storeBase,{dryRun:!1});for(let x of y)try{v.push(await DN({candidate:x,checkOnly:r,force:o,options:n,writers:A,failures:b,warnings:s}))}catch(O){b.push({name:x.key,errno:u_(O),message:py(O)}),v.push(CN(x,py(O)))}if(n.ref!==void 0&&!r)for(let x of l)x.readOnly||f_(x,A);for(let[x,O]of A){let H=l.find(me=>me.scope===x),B=n.ref??H.lock.source.ref??Ge,ye=d.get(B)??y.find(me=>me.scopeState.scope===x)?.commit,ve=y_(g);O.updateSource({ref:B,...ye!==void 0?{commit:ye}:{},...ve!==void 0?{pluginVersion:ve}:{}}),await O.flush({force:!0})}return _N({reports:v,candidates:y,failures:b,states:l,refs:d,catalogs:g,options:n,checkOnly:r,force:o,warnings:s})}async function uN(e,t,n,r){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?d_.default.homedir():t,l=s==="global"?ti():ei(a),c=await Nn(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw ni(c);if(c.kind==="too-new"){if(!n||c.lock===null)throw ri(c);r.push(`${xl(l)} was written by a newer Webflow CLI (lockfile version ${c.version}); reporting read-only.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:it(s,a),readOnly:!0});continue}c.migratedFrom!==void 0&&r.push(`${xl(l)} uses lockfile version ${c.migratedFrom}; the next write upgrades it.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:it(s,a),readOnly:n})}}return i}function dN(e,t,n){if(t.length===0)return e.flatMap(s=>wn(s.lock).map(a=>({state:s,key:a})));let r=n.global===!0||n.project===!0,o=[],i=new Set;for(let s of t){let a=[];for(let l of e){let c=ar(s,fN(l.lock));if(c.kind==="ambiguous")throw new f(`"${D(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(d=>D(d.name)).join(", ")}.
283
+ Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw pN(s,e);if(a.length>1&&!r)throw new f(`"${D(s)}" is installed at more than one scope:
284
+ `+a.map(l=>` ${l.state.scope}: ${xl(l.state.lockPath)}`).join(`
273
285
  `)+`
274
- Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${b} Cannot update skills:`});for(let l of a){let c=`${l.state.scope}\0${l.key}`;i.has(c)||(i.add(c),o.push(l))}}return o}function yP(e,t){let r=t.flatMap(n=>ur(n.lock).map(o=>n.lock.skills[o]?.dir??o));return new f(`"${y(e)}" is not installed.
275
- `+(r.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(r)].sort().map(n=>y(n)).join(", ")}`),{isUserError:!0,prefix:`${b} Cannot update skills:`})}function wP(e){return ur(e).map(t=>{let r=e.skills[t];return{name:t,dir:r.dir,folderName:r.skillPath?Cn(r.skillPath):r.dir}})}function nh(e,t,r){return e.ref??t.skills[r]?.ref??t.source.ref??je}async function DP(e,t){let r=await Ni({commit:e}),n=await Mi(r.root),o=await Wi(n.skillsDir,r.root);return t.push(...n.warnings,...o.warnings),{commit:e,root:r.root,pluginVersion:n.version,skills:o.skills}}async function kP(e,t){let r=dr.default.join(e.storeBase,t.dir),n=await Yt(r);if(n===null)return null;if(t.mode!=="copy")return n;let o=ah(t);if(o===null)return n;for(let i of LP(t)){let s=Ot(i,e.scope,e.root);if(s===null)continue;let a=await Yt(dr.default.join(s,t.dir));if(a!==null&&!Pt(a,o))return a}return n}async function bP(e){let{state:t,key:r,entry:n,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=ah(n),d=dr.default.join(t.storeBase,n.dir),p=EP(n,s,l,r),h=s.skills.find(Ie=>Ie.name===r)??null,g=p!==null?"exists":h!==null?"moved":"missing",m=g==="exists"?p:g==="moved"?h.path:null,w=m===null?null:await Yt(m),k=e.localDigest===null?"absent":c===null||Pt(e.localDigest,c)?"same":"differs",F=Pt(w,c)?"same":"differs",A=mC({hasSkillPath:typeof n.skillPath=="string"&&n.skillPath!=="",foundByName:h!==null,presence:g,upstream:F,local:k,force:a}),E=g==="moved"&&h!==null?h.dir:n.dir,v=g==="exists"?n.skillPath:g==="moved"?h.skillPath:n.skillPath??null,{agents:M,dropped:B}=vP(t,n,l),U=m===null||v===null?null:{name:r,dir:E,folderName:Cn(v),description:h?.description??"",...h?.category!==void 0?{category:h.category}:{},internal:h?.internal??!1,path:m,skillPath:v,supplementaryFiles:h?.supplementaryFiles??[]};return{scopeState:t,key:r,entry:n,dir:n.dir,newDir:E,storeDir:d,mode:n.mode,agents:M,droppedAgents:B,presence:g,upstreamDrift:F,localDrift:k,outcome:A,recorded:c,onDisk:e.localDigest,upstream:w,discovered:U,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:IP(A,{key:r,storeDir:d,recordedSkillPath:n.skillPath??null,newSkillPath:v,checkOnly:e.checkOnly})}}function EP(e,t,r,n){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=Iu(o);if(i!==null)return r.push(`The recorded path for "${y(n)}" ${i}; locating it by name instead.`),null;let s=dr.default.resolve(t.root,...o.split("/"));return Re(t.root,s,"the recorded skill path"),Xi.default.existsSync(s)?dr.default.dirname(s):null}function vP(e,t,r){let n=[],o=[];for(let i of t.agents??[]){if(i===qt){n.push(i);continue}let s=xr(i);if(s===void 0){n.push(i);continue}if(Ot(s,e.scope,e.root)===null){o.push(i),r.push(`${y(s.displayName)} does not support ${e.scope} scope; dropping it from the recorded placement.`);continue}n.push(i)}return{agents:n,dropped:o}}async function SP(e){let{candidate:t,checkOnly:r,force:n,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Wa(t,r,[]);let l=await xP(t,n),c=new Set(t.droppedAgents);for(let m of l.targets)if(m.skipReason==="agent-dir-absent")for(let w of m.agents)c.add(w);e.warnings.push(...l.warnings);let d=t.agents.filter(m=>!c.has(m));if(d.length===0&&d.push(qt),r)return Wa(t,!0,l.targets.map(m=>sh(m)),[...c]);let p,h=t.onDisk;if(a.willWrite){let m=await Pa(l.plan,l.skill);if(p=m.targets.map((w,k)=>hC(w,l.targets[k])),h=m.hashes,!m.success||m.storeAction==="failed"){let w=m.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:w});for(let k of m.targets)!k.success&&k.error&&s.push({name:t.key,agent:k.agent,...k.errno!==void 0?{errno:k.errno}:{},message:k.error});return{...Wa(t,!1,p,[...c]),state:"failed",action:"failed",detail:w}}t.newDir!==t.dir&&await _P(t,l.targets)}else{p=[];for(let m of l.targets)p.push(await CP(t,m))}let g=d.length!==(t.entry.agents??[]).length||d.some((m,w)=>(t.entry.agents??[])[w]!==m);return FP(t,a,g,o)&&!t.scopeState.readOnly&&await gC(t.scopeState,i).record(t.key,AP(t,h,a,o,d)),Wa(t,!1,p,[...c])}async function xP(e,t){let r={repo:e.scopeState.lock.source.repo,ref:e.ref,commit:e.commit,pluginVersion:e.pluginVersion},n=[];for(let s of e.agents){if(s===qt)continue;let a=xr(s);a!==void 0&&n.push({agent:a,explicit:!1})}let o=await $a({scope:e.scopeState.scope,root:e.scopeState.root,mode:e.mode,force:t,source:r,skills:[e.discovered],targets:n,recorded:e.scopeState.lock.skills,platform:process.platform,display:Ha}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function CP(e,t){if(t.skipped||t.link==="canonical")return sh(t);if(t.overwrite!=="fresh")return{...sh(t),action:"unchanged"};let r=await Tu({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...hC(r,t),action:r.success?"relinked":"failed"}}async function _P(e,t){let r=e.dir,n=e.scopeState.root,o=[e.scopeState.storeBase,...t.filter(i=>!i.skipped&&i.skipReason===void 0).map(i=>dr.default.dirname(i.path))];for(let i of new Set(o)){let s=dr.default.join(i,r);if(dr.default.basename(s)===r&&s!==dr.default.join(i,e.newDir))try{let a=await Xi.default.promises.realpath(i);if(!et(n,a))continue;await Ri(n,dr.default.join(a,r),"a renamed skill directory"),(await Xi.default.promises.lstat(s)).isSymbolicLink()?await Xi.default.promises.rm(s,{force:!0}):await Xi.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function FP(e,t,r,n){return t.willWrite||t.guard==="G2"&&t.action==="repaired"||n.ref!==void 0&&n.ref!==e.entry.ref?!0:r}function AP(e,t,r,n,o){let i=r.willWrite,s={...e.entry,commit:i?e.commit:e.entry.commit,dir:i?e.newDir:e.entry.dir,agents:[...o],mode:e.mode,...e.discovered!==null?{skillPath:e.discovered.skillPath}:{},...n.ref!==void 0?{ref:n.ref}:{}};return i&&t!==null&&(s.contentHash=t.contentHash,s.modeHash=t.modeHash),e.scopeState.scope==="global"?Ma(s,{existing:e.entry,now:new Date().toISOString()}):s}function gC(e,t){let r=t.get(e.scope);if(r)return r;let n=$o({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,n),n}async function TP(e,t,r){if(t.yes)return!0;if(W()||r)throw new f(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
276
- `+e.map(n=>` ${y(n.key)}`).join(`
286
+ Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${k} Cannot update skills:`});for(let l of a){let c=`${l.state.scope}\0${l.key}`;i.has(c)||(i.add(c),o.push(l))}}return o}function pN(e,t){let n=t.flatMap(r=>wn(r.lock).map(o=>r.lock.skills[o]?.dir??o));return new f(`"${D(e)}" is not installed.
287
+ `+(n.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(n)].sort().map(r=>D(r)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot update skills:`})}function fN(e){return wn(e).map(t=>{let n=e.skills[t];return{name:t,dir:n.dir,folderName:n.skillPath?Vr(n.skillPath):n.dir}})}function uy(e,t,n){return e.ref??t.skills[n]?.ref??t.source.ref??Ge}async function mN(e,t){let n=await ms({commit:e}),r=await hs(n.root),o=await Ds(r.skillsDir,n.root);return t.push(...r.warnings,...o.warnings),{commit:e,root:n.root,pluginVersion:r.version,skills:o.skills}}async function gN(e,t){let n=Dn.default.join(e.storeBase,t.dir),r=await en(n);if(r===null)return null;if(t.mode!=="copy")return r;let o=my(t);if(o===null)return r;for(let i of RN(t)){let s=Lt(i,e.scope,e.root);if(s===null)continue;let a=await en(Dn.default.join(s,t.dir));if(a!==null&&!Nt(a,o))return a}return r}async function hN(e){let{state:t,key:n,entry:r,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=my(r),d=Dn.default.join(t.storeBase,r.dir),p=yN(r,s,l,n),m=s.skills.find(ye=>ye.name===n)??null,h=p!==null?"exists":m!==null?"moved":"missing",g=h==="exists"?p:h==="moved"?m.path:null,y=g===null?null:await en(g),b=e.localDigest===null?"absent":c===null||Nt(e.localDigest,c)?"same":"differs",S=Nt(y,c)?"same":"differs",A=p_({hasSkillPath:typeof r.skillPath=="string"&&r.skillPath!=="",foundByName:m!==null,presence:h,upstream:S,local:b,force:a}),v=h==="moved"&&m!==null?m.dir:r.dir,x=h==="exists"?r.skillPath:h==="moved"?m.skillPath:r.skillPath??null,{agents:O,dropped:H}=wN(t,r,l),B=g===null||x===null?null:{name:n,dir:v,folderName:Vr(x),description:m?.description??"",...m?.category!==void 0?{category:m.category}:{},internal:m?.internal??!1,path:g,skillPath:x,supplementaryFiles:m?.supplementaryFiles??[]};return{scopeState:t,key:n,entry:r,dir:r.dir,newDir:v,storeDir:d,mode:r.mode,agents:O,droppedAgents:H,presence:h,upstreamDrift:S,localDrift:b,outcome:A,recorded:c,onDisk:e.localDigest,upstream:y,discovered:B,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:FN(A,{key:n,storeDir:d,recordedSkillPath:r.skillPath??null,newSkillPath:x,checkOnly:e.checkOnly})}}function yN(e,t,n,r){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=Cd(o);if(i!==null)return n.push(`The recorded path for "${D(r)}" ${i}; locating it by name instead.`),null;let s=Dn.default.resolve(t.root,...o.split("/"));return Be(t.root,s,"the recorded skill path"),_s.default.existsSync(s)?Dn.default.dirname(s):null}function wN(e,t,n){let r=[],o=[];for(let i of t.agents??[]){if(i===Qt){r.push(i);continue}let s=$n(i);if(s===void 0){r.push(i);continue}if(Lt(s,e.scope,e.root)===null){o.push(i),n.push(`${D(s.displayName)} does not support ${e.scope} scope; dropping it from the recorded placement.`);continue}r.push(i)}return{agents:r,dropped:o}}async function DN(e){let{candidate:t,checkOnly:n,force:r,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Sl(t,n,[]);let l=await bN(t,r),c=new Set(t.droppedAgents);for(let g of l.targets)if(g.skipReason==="agent-dir-absent")for(let y of g.agents)c.add(y);e.warnings.push(...l.warnings);let d=t.agents.filter(g=>!c.has(g));if(d.length===0&&d.push(Qt),n)return Sl(t,!0,l.targets.map(g=>fy(g)),[...c]);let p,m=t.onDisk;if(a.willWrite){let g=await hl(l.plan,l.skill);if(p=g.targets.map((y,b)=>m_(y,l.targets[b])),m=g.hashes,!g.success||g.storeAction==="failed"){let y=g.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:y});for(let b of g.targets)!b.success&&b.error&&s.push({name:t.key,agent:b.agent,...b.errno!==void 0?{errno:b.errno}:{},message:b.error});return{...Sl(t,!1,p,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await EN(t,l.targets)}else{p=[];for(let g of l.targets)p.push(await kN(t,g))}let h=d.length!==(t.entry.agents??[]).length||d.some((g,y)=>(t.entry.agents??[])[y]!==g);return vN(t,a,h,o)&&!t.scopeState.readOnly&&await f_(t.scopeState,i).record(t.key,SN(t,m,a,o,d)),Sl(t,!1,p,[...c])}async function bN(e,t){let n={repo:e.scopeState.lock.source.repo,ref:e.ref,commit:e.commit,pluginVersion:e.pluginVersion},r=[];for(let s of e.agents){if(s===Qt)continue;let a=$n(s);a!==void 0&&r.push({agent:a,explicit:!1})}let o=await yl({scope:e.scopeState.scope,root:e.scopeState.root,mode:e.mode,force:t,source:n,skills:[e.discovered],targets:r,recorded:e.scopeState.lock.skills,platform:process.platform,display:xl}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function kN(e,t){if(t.skipped||t.link==="canonical")return fy(t);if(t.overwrite!=="fresh")return{...fy(t),action:"unchanged"};let n=await Sd({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...m_(n,t),action:n.success?"relinked":"failed"}}async function EN(e,t){let n=e.dir,r=e.scopeState.root,o=[e.scopeState.storeBase,...t.filter(i=>!i.skipped&&i.skipReason===void 0).map(i=>Dn.default.dirname(i.path))];for(let i of new Set(o)){let s=Dn.default.join(i,n);if(Dn.default.basename(s)===n&&s!==Dn.default.join(i,e.newDir))try{let a=await _s.default.promises.realpath(i);if(!rt(r,a))continue;await ls(r,Dn.default.join(a,n),"a renamed skill directory"),(await _s.default.promises.lstat(s)).isSymbolicLink()?await _s.default.promises.rm(s,{force:!0}):await _s.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function vN(e,t,n,r){return t.willWrite||t.guard==="G2"&&t.action==="repaired"||r.ref!==void 0&&r.ref!==e.entry.ref?!0:n}function SN(e,t,n,r,o){let i=n.willWrite,s={...e.entry,commit:i?e.commit:e.entry.commit,dir:i?e.newDir:e.entry.dir,agents:[...o],mode:e.mode,...e.discovered!==null?{skillPath:e.discovered.skillPath}:{},...r.ref!==void 0?{ref:r.ref}:{}};return i&&t!==null&&(s.contentHash=t.contentHash,s.modeHash=t.modeHash),e.scopeState.scope==="global"?kl(s,{existing:e.entry,now:new Date().toISOString()}):s}function f_(e,t){let n=t.get(e.scope);if(n)return n;let r=oi({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,r),r}async function xN(e,t,n){if(t.yes)return!0;if(V()||n)throw new f(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
288
+ `+e.map(r=>` ${D(r.key)}`).join(`
277
289
  `)+`
278
- Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${b} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let n of e)u.warn(` ${y(n.key)}`);return Pe({message:"Discard local changes and replace with upstream?",default:!1})}function Wa(e,t,r,n=e.droppedAgents){return{name:e.key,dir:e.newDir,scope:e.scopeState.scope,guard:e.outcome.guard,state:e.outcome.state,action:yC(e.outcome.action,t),recordedHash:e.recorded?.contentHash??null,upstreamHash:e.upstream?.contentHash??null,onDiskHash:e.onDisk?.contentHash??null,agents:e.agents.filter(o=>!n.includes(o)),droppedAgents:n,reason:e.outcome.reason,detail:e.detail,fromCommit:e.entry.commit,toCommit:e.outcome.willWrite?e.commit:null,skillPath:e.discovered?.skillPath??e.entry.skillPath??null,targets:r}}function RP(e,t){return{...Wa(e,!1,[]),state:"failed",action:"failed",detail:t}}function sh(e){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.overwrite==="fresh"?"relinked":"unchanged",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:!1,errno:null,error:e.detail??null}}function hC(e,t){return{agent:e.agent,agents:t?.agents??[e.agent],label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.success?"linked":"failed",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:e.symlinkFailed===!0,errno:e.errno??null,error:e.error??null}}function yC(e,t){if(!t)return e;switch(e){case"updated":return"would-update";case"moved":return"would-move";case"moved+updated":return"would-move-and-update";case"reinstalled":return"would-reinstall";case"repaired":return"would-repair";default:return e}}function IP(e,t){let r=y(t.key),{checkOnly:n}=t;switch(e.reason){case"tracking-unrepairable":return"update tracking is missing and no upstream skill declares this name; nothing was changed.";case"not-on-disk-and-removed-upstream":return`not on disk and no longer published upstream. Clear the entry with \`webflow skills remove ${r}\`.`;case"store-directory-missing":return n?"the store directory is missing and would be restored.":"the store directory was missing and has been restored.";case"removed-upstream":return`no longer published upstream. Your copy is untouched \u2014 remove it with \`webflow skills remove ${r}\`.`;case"removed-upstream-and-locally-modified":return`no longer published upstream (locally modified). Your copy is untouched \u2014 remove it with \`webflow skills remove ${r}\`.`;case"locally-modified":return e.willWrite?dC(n):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?dC(n):`updating would discard your edits. Review ${Ha(t.storeDir)}, then run \`webflow skills update ${r} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${y(t.recordedSkillPath)} \u2192 ${y(t.newSkillPath)}`:"moved upstream.";case"moved-upstream-and-locally-modified":return e.willWrite?n?"moved upstream; local changes would be discarded.":"moved upstream; local changes were discarded.":"moved upstream AND locally modified. Re-run with --force.";case"moved-upstream-changed-upstream-and-locally-modified":return e.willWrite?n?"moved and changed upstream; local changes would be discarded.":"moved and changed upstream; local changes were discarded.":"moved upstream, changed upstream, AND locally modified. Re-run with --force.";default:return null}}function dC(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function OP(e){let{reports:t,candidates:r,failures:n,states:o,refs:i,options:s}=e,a=o[0],l=s.ref??a?.lock.source.ref??je;return{kind:"skills.update",schemaVersion:Fn,checkOnly:e.checkOnly,force:e.force,scopes:o.map(c=>c.scope),source:{repo:a?.lock.source.repo??"",ref:l,recordedCommit:a?.lock.source.commit??null,resolvedCommit:i.get(l)??null,recordedPluginVersion:a?.lock.source.pluginVersion??null,resolvedPluginVersion:DC(e.catalogs)??null,upToDate:!1},skills:t,blocked:r.filter(c=>c.outcome.blocked).map(c=>({name:c.key,dir:c.dir,scope:c.scopeState.scope,state:c.outcome.state,reason:c.outcome.reason,requiredFlag:"--force"})),failures:n,summary:wC(t,n,e.checkOnly),warnings:[...new Set(e.warnings)]}}function wC(e,t,r){let n=(...i)=>e.filter(s=>i.includes(s.state)).length,o=new Set(["updated","moved","moved+updated","reinstalled","repaired"]);return{checked:e.length,outdated:n("upstream-changed","renamed-upstream","missing","untracked"),unchanged:n("unchanged"),locallyModified:n("locally-modified"),conflicts:n("conflict"),removedUpstream:n("removed-upstream","stale-entry"),updated:r?0:e.filter(i=>o.has(i.action)).length,relinked:e.reduce((i,s)=>i+s.targets.filter(a=>a.action==="relinked").length,0),unlinked:e.reduce((i,s)=>i+s.droppedAgents.length,0),blocked:e.filter(i=>i.action==="blocked").length,failed:t.length}}function PP(e){let{selected:t,states:r,localDigests:n,refs:o,options:i}=e,s=r[0],a=i.ref??s?.lock.source.ref??je,l=t.map(({state:c,key:d})=>{let p=c.lock.skills[d],h=ah(p),g=n.get(`${c.scope}\0${d}`)??null,m=h!==null&&!Pt(g,h);return{name:d,dir:p.dir,scope:c.scope,guard:"grid",state:m?"locally-modified":"unchanged",action:m?"skipped":"unchanged",recordedHash:h?.contentHash??null,upstreamHash:h?.contentHash??null,onDiskHash:g?.contentHash??null,agents:p.agents??[],droppedAgents:[],reason:m?"locally-modified":null,detail:m?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:p.commit,toCommit:null,skillPath:p.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:Fn,checkOnly:e.checkOnly,force:e.force,scopes:r.map(c=>c.scope),source:{repo:s?.lock.source.repo??"",ref:a,recordedCommit:s?.lock.source.commit??null,resolvedCommit:o.get(a)??null,recordedPluginVersion:s?.lock.source.pluginVersion??null,resolvedPluginVersion:s?.lock.source.pluginVersion??null,upToDate:!0},skills:l,blocked:[],failures:[],summary:wC(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function oh(e){return{kind:"skills.update",schemaVersion:Fn,checkOnly:e.checkOnly,force:e.force,...e.cancelled===!0?{cancelled:!0}:{},scopes:e.scopes??[],source:{repo:"",ref:je,recordedCommit:null,resolvedCommit:null,recordedPluginVersion:null,resolvedPluginVersion:null,upToDate:!0},skills:[],blocked:[],failures:[],summary:{checked:0,outdated:0,unchanged:0,locallyModified:0,conflicts:0,removedUpstream:0,updated:0,relinked:0,unlinked:0,blocked:0,failed:0},warnings:[...new Set(e.warnings)]}}function $P(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${he} ${y(r)}`);u.info(px(e))}function ah(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function LP(e){let t=[];for(let r of e.agents??[]){let n=xr(r);n!==void 0&&t.push(n)}return t}function DC(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function pC(e){let t=e?.code;return typeof t=="string"?t:void 0}function ih(e){return y(e instanceof Error?e.message:String(e))}function NP(){let e=xt();return e?_.forSkills({authToken:e}):null}function Ha(e){return _o(e)}var kC=e=>{let t=e.command("skills").description("Install and manage Webflow's first-party agent skills");t.command("install").description(`Install Webflow skills into your coding agents. Writes into your home directory for --global installs; use --dry-run to preview every path first.
279
- With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(uc()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(Ws()).addOption(Hs()).option("--copy","Copy files instead of symlinking from the shared store").option("--ref <branch|sha>","Pin to a branch or 40-character commit SHA (default: main)").option("--force","Replace destinations that were modified locally or installed elsewhere").addOption(oi()).addOption(Te()).addOption(Y()).action(Mu),t.command("update").description("Update installed skills to the latest upstream commit. Overwrites files in your agent directories; use --check to report what would change, or --dry-run to preview.").argument("[names...]","Skill names to update (default: all installed)").option("--check","Report what would change without writing anything").addOption(Ws()).addOption(Hs()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(oi()).addOption(Te()).addOption(Y()).action(Ku),t.command("list").description("List installed skills and the agents they are linked into").addOption(Ws()).addOption(Hs()).addOption(uc()).addOption(Le([...Fo]).default(Ia)).addOption(si([...Gi]).default("name")).addOption(ii()).addOption(Y()).action(Uu),t.command("remove").description("Remove installed skills. Deletes skill directories and unlinks them from every agent; use --dry-run to preview exactly what is deleted.").argument("[names...]","Skill names to remove (default: choose interactively)").addOption(uc()).option("--all","Remove every installed skill for the scope").addOption(Ws()).addOption(Hs()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(oi()).addOption(Te()).addOption(Y()).action(Gu)};var EC=D(sl());function lh(e,t){t.forEach(r=>{e.addOption(r())}),e.commands.forEach(r=>lh(r,t))}function vC(e){let t=EC.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(r,n){return bC.Help.prototype.formatHelp.call(this,r,n).split(`
280
- `).flatMap(o=>o.startsWith("Usage:")?["",te(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[te(o)]:/^Webflow CLI$/.test(o)?[ph(o)]:o.trim()===""?[o]:[R(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
290
+ Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let r of e)u.warn(` ${D(r.key)}`);return Re({message:"Discard local changes and replace with upstream?",default:!1})}function Sl(e,t,n,r=e.droppedAgents){return{name:e.key,dir:e.newDir,scope:e.scopeState.scope,guard:e.outcome.guard,state:e.outcome.state,action:g_(e.outcome.action,t),recordedHash:e.recorded?.contentHash??null,upstreamHash:e.upstream?.contentHash??null,onDiskHash:e.onDisk?.contentHash??null,agents:e.agents.filter(o=>!r.includes(o)),droppedAgents:r,reason:e.outcome.reason,detail:e.detail,fromCommit:e.entry.commit,toCommit:e.outcome.willWrite?e.commit:null,skillPath:e.discovered?.skillPath??e.entry.skillPath??null,targets:n}}function CN(e,t){return{...Sl(e,!1,[]),state:"failed",action:"failed",detail:t}}function fy(e){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.overwrite==="fresh"?"relinked":"unchanged",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:!1,errno:null,error:e.detail??null}}function m_(e,t){return{agent:e.agent,agents:t?.agents??[e.agent],label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.success?"linked":"failed",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:e.symlinkFailed===!0,errno:e.errno??null,error:e.error??null}}function g_(e,t){if(!t)return e;switch(e){case"updated":return"would-update";case"moved":return"would-move";case"moved+updated":return"would-move-and-update";case"reinstalled":return"would-reinstall";case"repaired":return"would-repair";default:return e}}function FN(e,t){let n=D(t.key),{checkOnly:r}=t;switch(e.reason){case"tracking-unrepairable":return"update tracking is missing and no upstream skill declares this name; nothing was changed.";case"not-on-disk-and-removed-upstream":return`not on disk and no longer published upstream. Clear the entry with \`webflow skills remove ${n}\`.`;case"store-directory-missing":return r?"the store directory is missing and would be restored.":"the store directory was missing and has been restored.";case"removed-upstream":return`no longer published upstream. Your copy is untouched \u2014 remove it with \`webflow skills remove ${n}\`.`;case"removed-upstream-and-locally-modified":return`no longer published upstream (locally modified). Your copy is untouched \u2014 remove it with \`webflow skills remove ${n}\`.`;case"locally-modified":return e.willWrite?c_(r):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?c_(r):`updating would discard your edits. Review ${xl(t.storeDir)}, then run \`webflow skills update ${n} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${D(t.recordedSkillPath)} \u2192 ${D(t.newSkillPath)}`:"moved upstream.";case"moved-upstream-and-locally-modified":return e.willWrite?r?"moved upstream; local changes would be discarded.":"moved upstream; local changes were discarded.":"moved upstream AND locally modified. Re-run with --force.";case"moved-upstream-changed-upstream-and-locally-modified":return e.willWrite?r?"moved and changed upstream; local changes would be discarded.":"moved and changed upstream; local changes were discarded.":"moved upstream, changed upstream, AND locally modified. Re-run with --force.";default:return null}}function c_(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function _N(e){let{reports:t,candidates:n,failures:r,states:o,refs:i,options:s}=e,a=o[0],l=s.ref??a?.lock.source.ref??Ge;return{kind:"skills.update",schemaVersion:Jr,checkOnly:e.checkOnly,force:e.force,scopes:o.map(c=>c.scope),source:{repo:a?.lock.source.repo??"",ref:l,recordedCommit:a?.lock.source.commit??null,resolvedCommit:i.get(l)??null,recordedPluginVersion:a?.lock.source.pluginVersion??null,resolvedPluginVersion:y_(e.catalogs)??null,upToDate:!1},skills:t,blocked:n.filter(c=>c.outcome.blocked).map(c=>({name:c.key,dir:c.dir,scope:c.scopeState.scope,state:c.outcome.state,reason:c.outcome.reason,requiredFlag:"--force"})),failures:r,summary:h_(t,r,e.checkOnly),warnings:[...new Set(e.warnings)]}}function h_(e,t,n){let r=(...i)=>e.filter(s=>i.includes(s.state)).length,o=new Set(["updated","moved","moved+updated","reinstalled","repaired"]);return{checked:e.length,outdated:r("upstream-changed","renamed-upstream","missing","untracked"),unchanged:r("unchanged"),locallyModified:r("locally-modified"),conflicts:r("conflict"),removedUpstream:r("removed-upstream","stale-entry"),updated:n?0:e.filter(i=>o.has(i.action)).length,relinked:e.reduce((i,s)=>i+s.targets.filter(a=>a.action==="relinked").length,0),unlinked:e.reduce((i,s)=>i+s.droppedAgents.length,0),blocked:e.filter(i=>i.action==="blocked").length,failed:t.length}}function AN(e){let{selected:t,states:n,localDigests:r,refs:o,options:i}=e,s=n[0],a=i.ref??s?.lock.source.ref??Ge,l=t.map(({state:c,key:d})=>{let p=c.lock.skills[d],m=my(p),h=r.get(`${c.scope}\0${d}`)??null,g=m!==null&&!Nt(h,m);return{name:d,dir:p.dir,scope:c.scope,guard:"grid",state:g?"locally-modified":"unchanged",action:g?"skipped":"unchanged",recordedHash:m?.contentHash??null,upstreamHash:m?.contentHash??null,onDiskHash:h?.contentHash??null,agents:p.agents??[],droppedAgents:[],reason:g?"locally-modified":null,detail:g?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:p.commit,toCommit:null,skillPath:p.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:Jr,checkOnly:e.checkOnly,force:e.force,scopes:n.map(c=>c.scope),source:{repo:s?.lock.source.repo??"",ref:a,recordedCommit:s?.lock.source.commit??null,resolvedCommit:o.get(a)??null,recordedPluginVersion:s?.lock.source.pluginVersion??null,resolvedPluginVersion:s?.lock.source.pluginVersion??null,upToDate:!0},skills:l,blocked:[],failures:[],summary:h_(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function dy(e){return{kind:"skills.update",schemaVersion:Jr,checkOnly:e.checkOnly,force:e.force,...e.cancelled===!0?{cancelled:!0}:{},scopes:e.scopes??[],source:{repo:"",ref:Ge,recordedCommit:null,resolvedCommit:null,recordedPluginVersion:null,resolvedPluginVersion:null,upToDate:!0},skills:[],blocked:[],failures:[],summary:{checked:0,outdated:0,unchanged:0,locallyModified:0,conflicts:0,removedUpstream:0,updated:0,relinked:0,unlinked:0,blocked:0,failed:0},warnings:[...new Set(e.warnings)]}}function IN(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let n of e.warnings)u.warn(`${re} ${D(n)}`);u.info(uF(e))}function my(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function RN(e){let t=[];for(let n of e.agents??[]){let r=$n(n);r!==void 0&&t.push(r)}return t}function y_(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function u_(e){let t=e?.code;return typeof t=="string"?t:void 0}function py(e){return D(e instanceof Error?e.message:String(e))}function TN(){let e=At();return e?F.forSkills({authToken:e}):null}function xl(e){return Xo(e)}var w_=e=>{let t=e.command("skills").description("Install and manage Webflow's first-party agent skills");t.command("install").description(`Install Webflow skills into your coding agents. Writes into your home directory for --global installs; use --dry-run to preview every path first.
291
+ With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(Kc()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(ha()).addOption(ya()).option("--copy","Copy files instead of symlinking from the shared store").option("--ref <branch|sha>","Pin to a branch or 40-character commit SHA (default: main)").option("--force","Replace destinations that were modified locally or installed elsewhere").addOption(Ii()).addOption(Pe()).addOption(oe()).action(Pd),t.command("update").description("Update installed skills to the latest upstream commit. Overwrites files in your agent directories; use --check to report what would change, or --dry-run to preview.").argument("[names...]","Skill names to update (default: all installed)").option("--check","Report what would change without writing anything").addOption(ha()).addOption(ya()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(Ii()).addOption(Pe()).addOption(oe()).action(Bd),t.command("list").description("List installed skills and the agents they are linked into").addOption(ha()).addOption(ya()).addOption(Kc()).addOption(He([...Yo]).default(ml)).addOption(Ti([...Es]).default("name")).addOption(Ri()).addOption(oe()).action(Od),t.command("remove").description("Remove installed skills. Deletes skill directories and unlinks them from every agent; use --dry-run to preview exactly what is deleted.").argument("[names...]","Skill names to remove (default: choose interactively)").addOption(Kc()).option("--all","Remove every installed skill for the scope").addOption(ha()).addOption(ya()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(Ii()).addOption(Pe()).addOption(oe()).action(Md)};var b_=w(Wl());function gy(e,t){t.forEach(n=>{e.addOption(n())}),e.commands.forEach(n=>gy(n,t))}function k_(e){let t=b_.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(n,r){return D_.Help.prototype.formatHelp.call(this,n,r).split(`
292
+ `).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[Ey(o)]:o.trim()===""?[o]:[R(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
281
293
  `)+`
282
- `}}).addOption(nf()).addOption(Gk()).addOption(of()).addOption(sf()).addOption(af()).showHelpAfterError(),e.hook("preAction",async(r,n)=>{let o=r.opts();o.input?r.getOptionValueSource("input")==="cli"&&wy(!0):yy(!0),n.opts().json&&ky(!0),Rr.start(),o.manifest&&by(o.manifest);try{await _.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!ze()&&await new ys().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Rr.displayGrouped(),Rr.stop()}),hw(e),ov(e),Kw(e),tb(e),FE(e),ct()&&zE(e),eb(e),fv(e),Ev(e),Rv(e),kC(e),Ok(e),e.commands.forEach(r=>{lh(r,[nf,of,sf,af])})}x();S();pe();var CC=new xC.Command;vC(CC);function jP(e){let t=e instanceof Error?e.message:String(e),r=e instanceof f?e.missingFlag:void 0,n=e instanceof f?e.prefix:void 0,o=n?pt(n).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;Uy(e,{prefix:n});let i=JSON.stringify({error:{message:t,context:o,missingFlag:r}});SC.default.writeSync(1,`${i}
283
- `)}CC.parseAsync().catch(e=>{if(!(e instanceof f&&e.skipLogging))if(ze())jP(e);else if(e instanceof f)if(e.isUserError){let t=e.prefix?`${e.prefix} `:"";console.error(`${t}${e.message}`)}else u.error(e,{prefix:e.prefix});else u.error(e);process.exit(1)});
294
+ `}}).addOption(Zf()).addOption(tE()).addOption(Qf()).addOption(em()).addOption(tm()).showHelpAfterError(),e.hook("preAction",async(n,r)=>{let o=n.opts();o.input?n.getOptionValueSource("input")==="cli"&&_w(!0):Fw(!0),r.opts().json&&Iw(!0),Bn.start(),o.manifest&&Rw(o.manifest);try{await F.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!Ye()&&await new zs().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Bn.displayGrouped(),Bn.stop()}),CD(e),DS(e),nb(e),dE(e),Hv(e),tt()&&lS(e),uE(e),_S(e),bx(e),Ax(e),w_(e),Hk(e),e.commands.forEach(n=>{gy(n,[Zf,Qf,em,tm])})}_();C();we();var S_=new v_.Command;k_(S_);function PN(e){let t=e instanceof Error?e.message:String(e),n=e instanceof f?e.missingFlag:void 0,r=e instanceof f?e.prefix:void 0,o=r?wt(r).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;Yw(e,{prefix:r});let i=JSON.stringify({error:{message:t,context:o,missingFlag:n}});E_.default.writeSync(1,`${i}
295
+ `)}S_.parseAsync().catch(e=>{if(!(e instanceof f&&e.skipLogging))if(Ye())PN(e);else if(e instanceof f)if(e.isUserError){let t=e.prefix?`${e.prefix} `:"";console.error(`${t}${e.message}`)}else u.error(e,{prefix:e.prefix});else u.error(e);process.exit(1)});
284
296
  //# sourceMappingURL=index.js.map