@webflow/webflow-cli 2.4.0 → 2.5.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,71 +1,115 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var z_=Object.create;var Xd=Object.defineProperty;var q_=Object.getOwnPropertyDescriptor;var X_=Object.getOwnPropertyNames;var Y_=Object.getPrototypeOf,Z_=Object.prototype.hasOwnProperty;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var Yd=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Py=(e,t)=>{for(var n in t)Xd(e,n,{get:t[n],enumerable:!0})},Q_=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of X_(t))!Z_.call(e,o)&&o!==n&&Xd(e,o,{get:()=>t[o],enumerable:!(r=q_(t,o))||r.enumerable});return e};var w=(e,t,n)=>(n=e!=null?z_(Y_(e)):{},Q_(t||!e||!e.__esModule?Xd(n,"default",{value:e,enumerable:!0}):n,e));var Oy,je,Zd,Bt,le,_t,J,se,I,pe=L(()=>{"use strict";Oy=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,je=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,Zd=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Bt=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,le=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,_t=e=>`\x1B[97m${e}\x1B[0m`,J=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,I=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function oA(){let e=new Map;for(let[t,n]of Object.entries(Te)){for(let[r,o]of Object.entries(n))Te[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=Te[r],e.set(o[0],o[1]);Object.defineProperty(Te,t,{value:n,enumerable:!1})}return Object.defineProperty(Te,"codes",{value:e,enumerable:!1}),Te.color.close="\x1B[39m",Te.bgColor.close="\x1B[49m",Te.color.ansi=Ly(),Te.color.ansi256=Ny(),Te.color.ansi16m=jy(),Te.bgColor.ansi=Ly(10),Te.bgColor.ansi256=Ny(10),Te.bgColor.ansi16m=jy(10),Object.defineProperties(Te,{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=>Te.rgbToAnsi256(...Te.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)=>Te.ansi256ToAnsi(Te.rgbToAnsi256(t,n,r)),enumerable:!1},hexToAnsi:{value:t=>Te.ansi256ToAnsi(Te.hexToAnsi256(t)),enumerable:!1}}),Te}var Ly,Ny,jy,Te,cj,nA,rA,uj,iA,nn,My=L(()=>{"use strict";Ly=(e=0)=>t=>`\x1B[${t+e}m`,Ny=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,jy=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,Te={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]}},cj=Object.keys(Te.modifier),nA=Object.keys(Te.color),rA=Object.keys(Te.bgColor),uj=[...nA,...rA];iA=oA(),nn=iA});function Ut(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 sA(){if("FORCE_COLOR"in We)return We.FORCE_COLOR==="true"?1:We.FORCE_COLOR==="false"?0:We.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(We.FORCE_COLOR,10),3)}function aA(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function lA(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=sA();r!==void 0&&(Pl=r);let o=n?Pl:r;if(o===0)return 0;if(n){if(Ut("color=16m")||Ut("color=full")||Ut("color=truecolor"))return 3;if(Ut("color=256"))return 2}if("TF_BUILD"in We&&"AGENT_NAME"in We)return 1;if(e&&!t&&o===void 0)return 0;let i=o||0;if(We.TERM==="dumb")return i;if($l.default.platform==="win32"){let s=Uy.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in We)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in We)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in We)||We.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in We)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(We.TEAMCITY_VERSION)?1:0;if(We.COLORTERM==="truecolor"||We.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in We){let s=Number.parseInt((We.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(We.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(We.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(We.TERM)||"COLORTERM"in We?1:i}function By(e,t={}){let n=lA(e,{streamIsTTY:e&&e.isTTY,...t});return aA(n)}var $l,Uy,Qd,We,Pl,cA,Wy,Hy=L(()=>{"use strict";$l=w(require("process"),1),Uy=w(require("os"),1),Qd=w(require("tty"),1);({env:We}=$l.default);Ut("no-color")||Ut("no-colors")||Ut("color=false")||Ut("color=never")?Pl=0:(Ut("color")||Ut("colors")||Ut("color=true")||Ut("color=always"))&&(Pl=1);cA={stdout:By({isTTY:Qd.default.isatty(1)}),stderr:By({isTTY:Qd.default.isatty(2)})},Wy=cA});function Vy(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 Gy(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
2
+ "use strict";var tR=Object.create;var mp=Object.defineProperty;var rR=Object.getOwnPropertyDescriptor;var nR=Object.getOwnPropertyNames;var oR=Object.getPrototypeOf,iR=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var gp=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hp=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},sR=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of nR(t))!iR.call(e,o)&&o!==r&&mp(e,o,{get:()=>t[o],enumerable:!(n=rR(t,o))||n.enumerable});return e};var w=(e,t,r)=>(r=e!=null?tR(oR(e)):{},sR(t||!e||!e.__esModule?mp(r,"default",{value:e,enumerable:!0}):r,e));var dw,Ne,yp,Ut,ue,_t,z,se,P,me=x(()=>{"use strict";dw=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,Ne=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,yp=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Ut=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,ue=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,_t=e=>`\x1B[97m${e}\x1B[0m`,z=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,P=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function dR(){let e=new Map;for(let[t,r]of Object.entries(Ie)){for(let[n,o]of Object.entries(r))Ie[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Ie[n],e.set(o[0],o[1]);Object.defineProperty(Ie,t,{value:r,enumerable:!1})}return Object.defineProperty(Ie,"codes",{value:e,enumerable:!1}),Ie.color.close="\x1B[39m",Ie.bgColor.close="\x1B[49m",Ie.color.ansi=pw(),Ie.color.ansi256=fw(),Ie.color.ansi16m=mw(),Ie.bgColor.ansi=pw(10),Ie.bgColor.ansi256=fw(10),Ie.bgColor.ansi16m=mw(10),Object.defineProperties(Ie,{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=>Ie.rgbToAnsi256(...Ie.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)=>Ie.ansi256ToAnsi(Ie.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>Ie.ansi256ToAnsi(Ie.hexToAnsi256(t)),enumerable:!1}}),Ie}var pw,fw,mw,Ie,O1,cR,uR,L1,pR,ir,gw=x(()=>{"use strict";pw=(e=0)=>t=>`\x1B[${t+e}m`,fw=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,mw=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,Ie={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]}},O1=Object.keys(Ie.modifier),cR=Object.keys(Ie.color),uR=Object.keys(Ie.bgColor),L1=[...cR,...uR];pR=dR(),ir=pR});function Wt(e,t=globalThis.Deno?globalThis.Deno.args:Kl.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 fR(){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 mR(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function gR(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=fR();n!==void 0&&(Gl=n);let o=r?Gl:n;if(o===0)return 0;if(r){if(Wt("color=16m")||Wt("color=full")||Wt("color=truecolor"))return 3;if(Wt("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(Kl.default.platform==="win32"){let s=yw.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 hw(e,t={}){let r=gR(e,{streamIsTTY:e&&e.isTTY,...t});return mR(r)}var Kl,yw,wp,Ue,Gl,hR,ww,bw=x(()=>{"use strict";Kl=w(require("process"),1),yw=w(require("os"),1),wp=w(require("tty"),1);({env:Ue}=Kl.default);Wt("no-color")||Wt("no-colors")||Wt("color=false")||Wt("color=never")?Gl=0:(Wt("color")||Wt("colors")||Wt("color=true")||Wt("color=always"))&&(Gl=1);hR={stdout:hw({isTTY:wp.default.isatty(1)}),stderr:hw({isTTY:wp.default.isatty(2)})},ww=hR});function kw(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 Dw(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
3
3
  `:`
4
- `)+n,o=r+1,r=e.indexOf(`
5
- `,o)}while(r!==-1);return i+=e.slice(o),i}var Ky=L(()=>{"use strict"});function $s(e){return dA(e)}var Jy,zy,ep,ci,Ps,qy,ui,uA,dA,tp,pA,fA,np,Ol,mA,gA,yj,rn,rp=L(()=>{"use strict";My();Hy();Ky();({stdout:Jy,stderr:zy}=Wy),ep=Symbol("GENERATOR"),ci=Symbol("STYLER"),Ps=Symbol("IS_EMPTY"),qy=["ansi","ansi","ansi256","ansi16m"],ui=Object.create(null),uA=(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=Jy?Jy.level:0;e.level=t.level===void 0?n:t.level},dA=e=>{let t=(...n)=>n.join(" ");return uA(t,e),Object.setPrototypeOf(t,$s.prototype),t};Object.setPrototypeOf($s.prototype,Function.prototype);for(let[e,t]of Object.entries(nn))ui[e]={get(){let n=Ol(this,np(t.open,t.close,this[ci]),this[Ps]);return Object.defineProperty(this,e,{value:n}),n}};ui.visible={get(){let e=Ol(this,this[ci],!0);return Object.defineProperty(this,"visible",{value:e}),e}};tp=(e,t,n,...r)=>e==="rgb"?t==="ansi16m"?nn[n].ansi16m(...r):t==="ansi256"?nn[n].ansi256(nn.rgbToAnsi256(...r)):nn[n].ansi(nn.rgbToAnsi(...r)):e==="hex"?tp("rgb",t,n,...nn.hexToRgb(...r)):nn[n][e](...r),pA=["rgb","hex","ansi256"];for(let e of pA){ui[e]={get(){let{level:n}=this;return function(...r){let o=np(tp(e,qy[n],"color",...r),nn.color.close,this[ci]);return Ol(this,o,this[Ps])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);ui[t]={get(){let{level:n}=this;return function(...r){let o=np(tp(e,qy[n],"bgColor",...r),nn.bgColor.close,this[ci]);return Ol(this,o,this[Ps])}}}}fA=Object.defineProperties(()=>{},{...ui,level:{enumerable:!0,get(){return this[ep].level},set(e){this[ep].level=e}}}),np=(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}},Ol=(e,t,n)=>{let r=(...o)=>mA(r,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(r,fA),r[ep]=e,r[ci]=t,r[Ps]=n,r},mA=(e,t)=>{if(e.level<=0||!t)return e[Ps]?"":t;let n=e[ci];if(n===void 0)return t;let{openAll:r,closeAll:o}=n;if(t.includes("\x1B"))for(;n!==void 0;)t=Vy(t,n.close,n.open),n=n.parent;let i=t.indexOf(`
6
- `);return i!==-1&&(t=Gy(t,o,r,i)),r+t+o};Object.defineProperties($s.prototype,ui);gA=$s(),yj=$s({level:zy?zy.level:0}),rn=gA});function op(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let o of Reflect.ownKeys(t))hA(e,t,o,n);return wA(e,t),EA(e,t,r),e}var hA,yA,wA,bA,DA,kA,EA,Xy=L(()=>{"use strict";hA=(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);!yA(o,i)&&r||Object.defineProperty(e,n,i)},yA=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)},wA=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},bA=(e,t)=>`/* Wrapped ${e}*/
7
- ${t}`,DA=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),kA=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),EA=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=bA.bind(null,r,t.toString());Object.defineProperty(o,"name",kA);let{writable:i,enumerable:s,configurable:a}=DA;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var Ll,Yy,Zy,Qy=L(()=>{"use strict";Xy();Ll=new WeakMap,Yy=(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(Ll.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 op(i,e),Ll.set(i,r),i};Yy.callCount=e=>{if(!Ll.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Ll.get(e)};Zy=Yy});var Yr,ew=L(()=>{"use strict";Yr=[];Yr.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Yr.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Yr.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Nl,ip,sp,vA,ap,jl,SA,lp,cp,up,tw,Sj,xj,nw=L(()=>{"use strict";ew();Nl=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",ip=Symbol.for("signal-exit emitter"),sp=globalThis,vA=Object.defineProperty.bind(Object),ap=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(sp[ip])return sp[ip];vA(sp,ip,{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}},jl=class{},SA=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),lp=class extends jl{onExit(){return()=>{}}load(){}unload(){}},cp=class extends jl{#s=up.platform==="win32"?"SIGINT":"SIGHUP";#n=new ap;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let n of Yr)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(!Nl(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 Yr)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,Yr.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 Nl(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"&&Nl(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)}},up=globalThis.process,{onExit:tw,load:Sj,unload:xj}=SA(Nl(up)?new cp(up):new lp)});var Os,rw,xA,ow,iw=L(()=>{"use strict";Os=w(require("process"),1);Qy();nw();rw=Os.default.stderr.isTTY?Os.default.stderr:Os.default.stdout.isTTY?Os.default.stdout:void 0,xA=rw?Zy(()=>{tw(()=>{rw.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},ow=xA});var dp,Ml,di,pp,sw=L(()=>{"use strict";dp=w(require("process"),1);iw();Ml=!1,di={};di.show=(e=dp.default.stderr)=>{e.isTTY&&(Ml=!1,e.write("\x1B[?25h"))};di.hide=(e=dp.default.stderr)=>{e.isTTY&&(ow(),Ml=!0,e.write("\x1B[?25l"))};di.toggle=(e,t)=>{e!==void 0&&(Ml=e),Ml?di.show(t):di.hide(t)};pp=di});var aw=Yd((Tj,CA)=>{CA.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 fp=Yd((Pj,cw)=>{"use strict";var Bl=Object.assign({},aw()),lw=Object.keys(Bl);Object.defineProperty(Bl,"random",{get(){let e=Math.floor(Math.random()*lw.length),t=lw[e];return Bl[t]}});cw.exports=Bl});function mp(){return Wt.default.platform!=="win32"?Wt.default.env.TERM!=="linux":!!Wt.default.env.CI||!!Wt.default.env.WT_SESSION||!!Wt.default.env.TERMINUS_SUBLIME||Wt.default.env.ConEmuTask==="{cmd::Cmder}"||Wt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Wt.default.env.TERM_PROGRAM==="vscode"||Wt.default.env.TERM==="xterm-256color"||Wt.default.env.TERM==="alacritty"||Wt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Wt,uw=L(()=>{"use strict";Wt=w(require("process"),1)});var FA,_A,AA,Ls,dw=L(()=>{"use strict";rp();uw();FA={info:rn.blue("\u2139"),success:rn.green("\u2714"),warning:rn.yellow("\u26A0"),error:rn.red("\u2716")},_A={info:rn.blue("i"),success:rn.green("\u221A"),warning:rn.yellow("\u203C"),error:rn.red("\xD7")},AA=mp()?FA:_A,Ls=AA});function gp({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 pw=L(()=>{"use strict"});function hp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(RA,"")}var RA,fw=L(()=>{"use strict";pw();RA=gp()});function yp({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 mw=L(()=>{"use strict"});function wp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(IA,"")}var IA,gw=L(()=>{"use strict";mw();IA=yp()});var Ul,Wl,bp,Dp,Ns,hw=L(()=>{"use strict";Ul=[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],Wl=[12288,12288,65281,65376,65504,65510],bp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Dp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ns=[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 Hl,yw=L(()=>{"use strict";Hl=(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 BA(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(ww>=o&&ww<=i)return[o,i];i-o>n-t&&(t=o,n=i)}return[t,n]}var TA,PA,$A,OA,zj,qj,Xj,Yj,LA,NA,ww,jA,MA,bw,Dw,kw,Ew=L(()=>{"use strict";hw();yw();TA=Ul[0],PA=Ul.at(-1),$A=Wl[0],OA=Wl.at(-1),zj=bp[0],qj=bp.at(-1),Xj=Dp[0],Yj=Dp.at(-1),LA=Ns[0],NA=Ns.at(-1),ww=19968,[jA,MA]=BA(Ns);bw=e=>e<TA||e>PA?!1:Hl(Ul,e),Dw=e=>e<$A||e>OA?!1:Hl(Wl,e),kw=e=>e>=jA&&e<=MA?!0:e<LA||e>NA?!1:Hl(Ns,e)});function UA(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function vw(e,{ambiguousAsWide:t=!1}={}){return UA(e),Dw(e)||kw(e)||t&&bw(e)?2:1}var Sw=L(()=>{"use strict";Ew()});var xw,Cw=L(()=>{"use strict";xw=()=>/[#*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 kp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=wp(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!n};for(let{segment:s}of WA.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)&&!HA.test(s)){if(xw().test(s)){o+=2;continue}o+=vw(a,i)}}return o}var WA,HA,Fw=L(()=>{"use strict";gw();Sw();Cw();WA=new Intl.Segmenter,HA=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function Ep({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var _w=L(()=>{"use strict"});function Sp(){let{env:e}=vp.default,{TERM:t,TERM_PROGRAM:n}=e;return vp.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 vp,Aw=L(()=>{"use strict";vp=w(require("process"),1)});var on,VA,xp,GA,Cp,Rw=L(()=>{"use strict";on=w(require("process"),1),VA=3,xp=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(){on.default.platform==="win32"||!on.default.stdin.isTTY||(on.default.stdin.setRawMode(!0),on.default.stdin.on("data",this.#o),on.default.stdin.resume())}#e(){on.default.stdin.isTTY&&(on.default.stdin.off("data",this.#o),on.default.stdin.pause(),on.default.stdin.setRawMode(!1))}#o(t){t[0]===VA&&on.default.emit("SIGINT")}},GA=new xp,Cp=GA});function _p(e){return new Fp(e)}var js,Ms,KA,Fp,Iw=L(()=>{"use strict";js=w(require("process"),1);rp();sw();Ms=w(fp(),1);dw();fw();Fw();_w();Aw();Rw();KA=w(fp(),1),Fp=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:js.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:Ep({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,js.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(!Sp())this.#i=Ms.default.line;else if(t===void 0)this.#i=Ms.default.dots;else if(t!=="default"&&Ms.default[t])this.#i=Ms.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 hp(o).split(`
8
- `))this.#e+=Math.max(1,Math.ceil(kp(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=rn[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&&pp.hide(this.#r),this.#t.discardStdin&&js.default.stdin.isTTY&&(this.#n=!0,Cp.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&&pp.show(this.#r),this.#t.discardStdin&&js.default.stdin.isTTY&&this.#n&&(Cp.stop(),this.#n=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Ls.success,text:t})}fail(t){return this.stopAndPersist({symbol:Ls.error,text:t})}warn(t){return this.stopAndPersist({symbol:Ls.warning,text:t})}info(t){return this.stopAndPersist({symbol:Ls.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," "),p=r+o+a+c+`
10
- `;return this.stop(),this.#r.write(p),this}}});function Bs(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),Vl.default.platform==="darwin"?JA(e):Vl.default.platform==="win32"?zA(e):qA(e)}var Pe,Ap,Vl,pr,Rp,pi,JA,zA,qA,Ip=L(()=>{"use strict";Pe=w(require("path"),1),Ap=w(require("os"),1),Vl=w(require("process"),1),pr=Ap.default.homedir(),Rp=Ap.default.tmpdir(),{env:pi}=Vl.default,JA=e=>{let t=Pe.default.join(pr,"Library");return{data:Pe.default.join(t,"Application Support",e),config:Pe.default.join(t,"Preferences",e),cache:Pe.default.join(t,"Caches",e),log:Pe.default.join(t,"Logs",e),temp:Pe.default.join(Rp,e)}},zA=e=>{let t=pi.APPDATA||Pe.default.join(pr,"AppData","Roaming"),n=pi.LOCALAPPDATA||Pe.default.join(pr,"AppData","Local");return{data:Pe.default.join(n,e,"Data"),config:Pe.default.join(t,e,"Config"),cache:Pe.default.join(n,e,"Cache"),log:Pe.default.join(n,e,"Log"),temp:Pe.default.join(Rp,e)}},qA=e=>{let t=Pe.default.basename(pr);return{data:Pe.default.join(pi.XDG_DATA_HOME||Pe.default.join(pr,".local","share"),e),config:Pe.default.join(pi.XDG_CONFIG_HOME||Pe.default.join(pr,".config"),e),cache:Pe.default.join(pi.XDG_CACHE_HOME||Pe.default.join(pr,".cache"),e),log:Pe.default.join(pi.XDG_STATE_HOME||Pe.default.join(pr,".local","state"),e),temp:Pe.default.join(Rp,t,e)}}});function Gl(){return/[<>:"/\\|?*\u0000-\u001F]/g}function Tw(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var Pw=L(()=>{"use strict"});function Us(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(Gl().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(YA,o),e=e.replace(Gl(),o),e=e.replace(n,o),e=e.replace(ZA,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=Tw().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:XA;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 XA,YA,ZA,Tp=L(()=>{"use strict";Pw();XA=100,YA=/^\.+(\\|\/)|^\.+$/,ZA=/\.+$/});var QA,$w=L(()=>{"use strict";QA=w(require("path"),1);Tp()});var Ow=L(()=>{"use strict";Tp();$w()});var Kl,Pp=L(()=>{"use strict";Kl="webflow.json"});var Zr,$p=L(()=>{"use strict";Zr=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function Bw(e){Lw=e}function Uw(e){Nw=e}function e0(){for(let e of Ww){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function t0(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||e0()!==null}function V(){return Lw?!0:Nw?!1:t0()}function sn(){return!V()}function Hw(e){jw=e}function et(){return jw}function Vw(e){Mw=e}function Gw(){return Mw}var Lw,Nw,jw,Mw,Ww,I1,be=L(()=>{"use strict";Lw=!1,Nw=!1,jw=!1;Ww=[{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=Ww.map(e=>e.variable)});function Qr(){let e=Gw();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Kw.statSync)(e)?.isDirectory())return{path:(0,Jw.join)(e,Kl),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:`./${Kl}`,isUserDefined:!1}}var Kw,Jw,Op=L(()=>{"use strict";Kw=require("fs"),Jw=require("path");Pp();be()});var zw,n0,r0,Lp,qw=L(()=>{"use strict";zw=w(require("ajv")),n0=new zw.default,r0={type:"object",properties:{region:{type:"string",enum:["us","eu"]},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:[]}}},Lp=n0.compile(r0)});function Xw(e){return e instanceof Error?e:new Error("Unknown error")}function ee(){let{path:e}=Qr();if(!(0,Jl.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,Jl.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${Xw(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: ${Xw(o).message}`)}if(!Lp(r)){let o=Lp.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:r,manifestPath:e}}var Jl,Ws=L(()=>{"use strict";Jl=require("fs");Op();qw()});function Hs(e,t){let n=e[t];if(!n)throw new Zr(t);return n}var Yw=L(()=>{"use strict";$p()});function xe(e){let t=ee(),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,Zw.writeFileSync)(r,JSON.stringify(o,null,2),"utf-8"),o}var Zw,Np=L(()=>{"use strict";Zw=require("fs");Ws()});var Me=L(()=>{"use strict";Pp();$p();Ws();Op();Yw();Np()});var zl=Yd((Y1,o0)=>{o0.exports={name:"@webflow/webflow-cli",version:"2.4.0",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 Bn(){try{return zl().version}catch{return"unknown"}}function kn(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=Vs.default.homedir();if(n){let o=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let r=Vs.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 jp(e){if(e.stack)return kn(e.stack)}function fr(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]=kn(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?n[r]=fr(o):Array.isArray(o)?n[r]=o.map(s=>typeof s=="object"&&s!==null?fr(s):typeof s=="string"?kn(s):s):n[r]=o}return n}function Qw(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${Vs.default.type()} ${Vs.default.release()}`}}function Mp(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var Vs,Gs=L(()=>{"use strict";Vs=w(require("os"))});var $,k,Ce,fi,Bp,at,re,ql,Up,Un,M=L(()=>{"use strict";pe();$=J("\u2713"),k=Bt("\u2716"),Ce=je("\u2139"),fi=J("\u279C"),Bp=Bt("\u279C"),at="\u279C",re=le("\u26A0"),ql=I("\u2732"),Up=J("\u2732"),Un=le("[Deprecated]")});var mr,Wp=L(()=>{"use strict";Me();Gs();A();pe();M();be();mr=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 ee(),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()?(et()||u.info(`${Ce} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(et()||(u.info(`${Up} ${I("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${Up} ${I("To opt out, run")} ${J("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:Bn()}}};await xe(n),et()||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 G(e,t){let r={"User-Agent":`webflow-cli@${Bn()}`};return(0,eb.default)(e,{...t,headers:{...t?.headers,...r}})}var eb,lt=L(()=>{"use strict";eb=w(require("node-fetch"));X()});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 nb(e){tb=e}function rb(){return tb}function Hp(e,t){if(Ks.includes(e))return e;throw new f(`Invalid region "${e}" from ${t}. Valid regions: ${Ks.join(", ")}.`,{isUserError:!0})}function ob(e){if(e)return Hp(e,"--region");let t=process.env.WEBFLOW_REGION;if(t)return Hp(t,"WEBFLOW_REGION");let n;try{n=ee().manifest.region}catch(r){if(r instanceof Error&&r.message.startsWith("Invalid manifest:"))throw new f(r.message,{isUserError:!0});return"us"}return n?Hp(n,"webflow.json"):"us"}var Ks,tb,Xl=L(()=>{"use strict";C();Me();Ks=["us","eu"],tb="us"});var ib,sb=L(()=>{"use strict";ib=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});function s0(){let e="production";return e==="development"||e==="acceptance"||e==="sai"?e:"production"}function Gp(){return i0[s0()][rb()]}function P(){return process.env.WEBFLOW_API_HOST?Vp("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):Gp().api}function mi(){return process.env.WEBFLOW_CDN_API_HOST?Vp("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):Gp().cdnApi}function En(){return process.env.WEBFLOW_HOST?Vp("WEBFLOW_HOST",process.env.WEBFLOW_HOST):Gp().webflow}var Vp,i0,Js,Kp,zs,qs,gi,De=L(()=>{"use strict";Xl();sb();Vp=(e,t)=>(ib(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),i0={development:{us:{webflow:"https://wfdev.io:8443",api:"https://api.wfdev.io:8443",cdnApi:"https://api-cdn.wfdev.io:8443"},eu:{webflow:"https://eu.wfdev.io:8443",api:"https://api.eu.wfdev.io:8443",cdnApi:"https://api-cdn.eu.wfdev.io:8443"}},acceptance:{us:{webflow:"https://webflowtest.com",api:"https://api.webflowtest.com",cdnApi:"https://api-cdn.webflowtest.com"},eu:{webflow:"https://eu.webflowtest.com",api:"https://api.eu.webflowtest.com",cdnApi:"https://api-cdn.eu.webflowtest.com"}},sai:{us:{webflow:"https://webflow-sai.com",api:"https://api.webflow-sai.com",cdnApi:"https://api-cdn.webflow-sai.com"},eu:{webflow:"https://eu.webflow-sai.com",api:"https://api.eu.webflow-sai.com",cdnApi:"https://api-cdn.eu.webflow-sai.com"}},production:{us:{webflow:"https://webflow.com",api:"https://api.webflow.com",cdnApi:"https://api-cdn.webflow.com"},eu:{webflow:"https://eu.webflow.com",api:"https://api.eu.webflow.com",cdnApi:"https://api-cdn.eu.webflow.com"}}};Js="wf-manifest.json",Kp="mf-manifest.json",zs="@webflow_renderer",qs="ssr-bundle.tar",gi="index.js"});function a0(){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&&ab.has(r.slice(0,o))){t.push(`${r.slice(0,o)}=<redacted>`);continue}t.push(r),ab.has(r)&&n+1<e.length&&(t.push("<redacted>"),n+=1)}return t.join(" ")||void 0}var ab,F,Jp=L(()=>{"use strict";Wp();Gs();A();lt();De();ab=new Set(["--ref","--name","--q","--branch","--key"]);F=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=mr.getInstance(),this.sessionId=Mp(),this.platformInfo=Qw()}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:jp(t),context:n,metadata:r?fr(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?fr(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=mr.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:Bn(),command:this.config.suppressCommand?void 0:a0(),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=kn(n.message)),n.stack&&(n.stack=kn(n.stack)),n.context&&(n.context=kn(n.context)),n.metadata&&(n.metadata=fr(n.metadata)),n.data&&(n.data=fr(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 G(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 lb=L(()=>{"use strict"});function cb(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";Jp();Wp();lb();Gs();Gs()});var qp,zp,l0,Wn,Xp=L(()=>{"use strict";qp=Symbol("webflow-cli-warn"),zp=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]===qp){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(`
4
+ `)+r,o=n+1,n=e.indexOf(`
5
+ `,o)}while(n!==-1);return i+=e.slice(o),i}var Ew=x(()=>{"use strict"});function Gs(e){return wR(e)}var vw,Sw,bp,mi,Vs,xw,gi,yR,wR,kp,bR,kR,Dp,Jl,DR,ER,H1,sr,Ep=x(()=>{"use strict";gw();bw();Ew();({stdout:vw,stderr:Sw}=ww),bp=Symbol("GENERATOR"),mi=Symbol("STYLER"),Vs=Symbol("IS_EMPTY"),xw=["ansi","ansi","ansi256","ansi16m"],gi=Object.create(null),yR=(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=vw?vw.level:0;e.level=t.level===void 0?r:t.level},wR=e=>{let t=(...r)=>r.join(" ");return yR(t,e),Object.setPrototypeOf(t,Gs.prototype),t};Object.setPrototypeOf(Gs.prototype,Function.prototype);for(let[e,t]of Object.entries(ir))gi[e]={get(){let r=Jl(this,Dp(t.open,t.close,this[mi]),this[Vs]);return Object.defineProperty(this,e,{value:r}),r}};gi.visible={get(){let e=Jl(this,this[mi],!0);return Object.defineProperty(this,"visible",{value:e}),e}};kp=(e,t,r,...n)=>e==="rgb"?t==="ansi16m"?ir[r].ansi16m(...n):t==="ansi256"?ir[r].ansi256(ir.rgbToAnsi256(...n)):ir[r].ansi(ir.rgbToAnsi(...n)):e==="hex"?kp("rgb",t,r,...ir.hexToRgb(...n)):ir[r][e](...n),bR=["rgb","hex","ansi256"];for(let e of bR){gi[e]={get(){let{level:r}=this;return function(...n){let o=Dp(kp(e,xw[r],"color",...n),ir.color.close,this[mi]);return Jl(this,o,this[Vs])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);gi[t]={get(){let{level:r}=this;return function(...n){let o=Dp(kp(e,xw[r],"bgColor",...n),ir.bgColor.close,this[mi]);return Jl(this,o,this[Vs])}}}}kR=Object.defineProperties(()=>{},{...gi,level:{enumerable:!0,get(){return this[bp].level},set(e){this[bp].level=e}}}),Dp=(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}},Jl=(e,t,r)=>{let n=(...o)=>DR(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,kR),n[bp]=e,n[mi]=t,n[Vs]=r,n},DR=(e,t)=>{if(e.level<=0||!t)return e[Vs]?"":t;let r=e[mi];if(r===void 0)return t;let{openAll:n,closeAll:o}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=kw(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
6
+ `);return i!==-1&&(t=Dw(t,o,n,i)),n+t+o};Object.defineProperties(Gs.prototype,gi);ER=Gs(),H1=Gs({level:Sw?Sw.level:0}),sr=ER});function vp(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))vR(e,t,o,r);return xR(e,t),AR(e,t,n),e}var vR,SR,xR,CR,FR,_R,AR,Cw=x(()=>{"use strict";vR=(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);!SR(o,i)&&n||Object.defineProperty(e,r,i)},SR=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)},xR=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},CR=(e,t)=>`/* Wrapped ${e}*/
7
+ ${t}`,FR=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),_R=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),AR=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=CR.bind(null,n,t.toString());Object.defineProperty(o,"name",_R);let{writable:i,enumerable:s,configurable:a}=FR;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var zl,Fw,_w,Aw=x(()=>{"use strict";Cw();zl=new WeakMap,Fw=(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(zl.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 vp(i,e),zl.set(i,n),i};Fw.callCount=e=>{if(!zl.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return zl.get(e)};_w=Fw});var no,Rw=x(()=>{"use strict";no=[];no.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&no.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&no.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var ql,Sp,xp,RR,Cp,Yl,IR,Fp,_p,Ap,Iw,Y1,X1,Tw=x(()=>{"use strict";Rw();ql=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",Sp=Symbol.for("signal-exit emitter"),xp=globalThis,RR=Object.defineProperty.bind(Object),Cp=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(xp[Sp])return xp[Sp];RR(xp,Sp,{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}},Yl=class{},IR=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Fp=class extends Yl{onExit(){return()=>{}}load(){}unload(){}},_p=class extends Yl{#s=Ap.platform==="win32"?"SIGINT":"SIGHUP";#r=new Cp;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let r of no)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(!ql(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 no)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,no.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 ql(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"&&ql(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)}},Ap=globalThis.process,{onExit:Iw,load:Y1,unload:X1}=IR(ql(Ap)?new _p(Ap):new Fp)});var Ks,Pw,TR,$w,Ow=x(()=>{"use strict";Ks=w(require("process"),1);Aw();Tw();Pw=Ks.default.stderr.isTTY?Ks.default.stderr:Ks.default.stdout.isTTY?Ks.default.stdout:void 0,TR=Pw?_w(()=>{Iw(()=>{Pw.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},$w=TR});var Rp,Xl,hi,Ip,Lw=x(()=>{"use strict";Rp=w(require("process"),1);Ow();Xl=!1,hi={};hi.show=(e=Rp.default.stderr)=>{e.isTTY&&(Xl=!1,e.write("\x1B[?25h"))};hi.hide=(e=Rp.default.stderr)=>{e.isTTY&&($w(),Xl=!0,e.write("\x1B[?25l"))};hi.toggle=(e,t)=>{e!==void 0&&(Xl=e),Xl?hi.show(t):hi.hide(t)};Ip=hi});var Nw=gp((o2,PR)=>{PR.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 Tp=gp((i2,Mw)=>{"use strict";var Zl=Object.assign({},Nw()),jw=Object.keys(Zl);Object.defineProperty(Zl,"random",{get(){let e=Math.floor(Math.random()*jw.length),t=jw[e];return Zl[t]}});Mw.exports=Zl});function Pp(){return Ht.default.platform!=="win32"?Ht.default.env.TERM!=="linux":!!Ht.default.env.CI||!!Ht.default.env.WT_SESSION||!!Ht.default.env.TERMINUS_SUBLIME||Ht.default.env.ConEmuTask==="{cmd::Cmder}"||Ht.default.env.TERM_PROGRAM==="Terminus-Sublime"||Ht.default.env.TERM_PROGRAM==="vscode"||Ht.default.env.TERM==="xterm-256color"||Ht.default.env.TERM==="alacritty"||Ht.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ht,Bw=x(()=>{"use strict";Ht=w(require("process"),1)});var $R,OR,LR,Js,Uw=x(()=>{"use strict";Ep();Bw();$R={info:sr.blue("\u2139"),success:sr.green("\u2714"),warning:sr.yellow("\u26A0"),error:sr.red("\u2716")},OR={info:sr.blue("i"),success:sr.green("\u221A"),warning:sr.yellow("\u203C"),error:sr.red("\xD7")},LR=Pp()?$R:OR,Js=LR});function $p({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 Ww=x(()=>{"use strict"});function Op(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(NR,"")}var NR,Hw=x(()=>{"use strict";Ww();NR=$p()});function Lp({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 Vw=x(()=>{"use strict"});function Np(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(jR,"")}var jR,Gw=x(()=>{"use strict";Vw();jR=Lp()});var Ql,ec,jp,Mp,zs,Kw=x(()=>{"use strict";Ql=[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],ec=[12288,12288,65281,65376,65504,65510],jp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Mp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],zs=[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 tc,Jw=x(()=>{"use strict";tc=(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 JR(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(zw>=o&&zw<=i)return[o,i];i-o>r-t&&(t=o,r=i)}return[t,r]}var MR,BR,UR,WR,k2,D2,E2,v2,HR,VR,zw,GR,KR,qw,Yw,Xw,Zw=x(()=>{"use strict";Kw();Jw();MR=Ql[0],BR=Ql.at(-1),UR=ec[0],WR=ec.at(-1),k2=jp[0],D2=jp.at(-1),E2=Mp[0],v2=Mp.at(-1),HR=zs[0],VR=zs.at(-1),zw=19968,[GR,KR]=JR(zs);qw=e=>e<MR||e>BR?!1:tc(Ql,e),Yw=e=>e<UR||e>WR?!1:tc(ec,e),Xw=e=>e>=GR&&e<=KR?!0:e<HR||e>VR?!1:tc(zs,e)});function zR(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Qw(e,{ambiguousAsWide:t=!1}={}){return zR(e),Yw(e)||Xw(e)||t&&qw(e)?2:1}var eb=x(()=>{"use strict";Zw()});var tb,rb=x(()=>{"use strict";tb=()=>/[#*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 Bp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=Np(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!r};for(let{segment:s}of qR.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)&&!YR.test(s)){if(tb().test(s)){o+=2;continue}o+=Qw(a,i)}}return o}var qR,YR,nb=x(()=>{"use strict";Gw();eb();rb();qR=new Intl.Segmenter,YR=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function Up({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var ob=x(()=>{"use strict"});function Hp(){let{env:e}=Wp.default,{TERM:t,TERM_PROGRAM:r}=e;return Wp.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 Wp,ib=x(()=>{"use strict";Wp=w(require("process"),1)});var ar,XR,Vp,ZR,Gp,sb=x(()=>{"use strict";ar=w(require("process"),1),XR=3,Vp=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(){ar.default.platform==="win32"||!ar.default.stdin.isTTY||(ar.default.stdin.setRawMode(!0),ar.default.stdin.on("data",this.#o),ar.default.stdin.resume())}#e(){ar.default.stdin.isTTY&&(ar.default.stdin.off("data",this.#o),ar.default.stdin.pause(),ar.default.stdin.setRawMode(!1))}#o(t){t[0]===XR&&ar.default.emit("SIGINT")}},ZR=new Vp,Gp=ZR});function Jp(e){return new Kp(e)}var qs,Ys,QR,Kp,ab=x(()=>{"use strict";qs=w(require("process"),1);Ep();Lw();Ys=w(Tp(),1);Uw();Hw();nb();ob();ib();sb();QR=w(Tp(),1),Kp=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:qs.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:Up({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,qs.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(!Hp())this.#i=Ys.default.line;else if(t===void 0)this.#i=Ys.default.dots;else if(t!=="default"&&Ys.default[t])this.#i=Ys.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 Op(o).split(`
8
+ `))this.#e+=Math.max(1,Math.ceil(Bp(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=sr[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&&Ip.hide(this.#n),this.#t.discardStdin&&qs.default.stdin.isTTY&&(this.#r=!0,Gp.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&&Ip.show(this.#n),this.#t.discardStdin&&qs.default.stdin.isTTY&&this.#r&&(Gp.stop(),this.#r=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Js.success,text:t})}fail(t){return this.stopAndPersist({symbol:Js.error,text:t})}warn(t){return this.stopAndPersist({symbol:Js.warning,text:t})}info(t){return this.stopAndPersist({symbol:Js.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," "),p=n+o+a+c+`
10
+ `;return this.stop(),this.#n.write(p),this}}});function Xs(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),rc.default.platform==="darwin"?eI(e):rc.default.platform==="win32"?tI(e):rI(e)}var Te,zp,rc,wn,qp,yi,eI,tI,rI,Yp=x(()=>{"use strict";Te=w(require("path"),1),zp=w(require("os"),1),rc=w(require("process"),1),wn=zp.default.homedir(),qp=zp.default.tmpdir(),{env:yi}=rc.default,eI=e=>{let t=Te.default.join(wn,"Library");return{data:Te.default.join(t,"Application Support",e),config:Te.default.join(t,"Preferences",e),cache:Te.default.join(t,"Caches",e),log:Te.default.join(t,"Logs",e),temp:Te.default.join(qp,e)}},tI=e=>{let t=yi.APPDATA||Te.default.join(wn,"AppData","Roaming"),r=yi.LOCALAPPDATA||Te.default.join(wn,"AppData","Local");return{data:Te.default.join(r,e,"Data"),config:Te.default.join(t,e,"Config"),cache:Te.default.join(r,e,"Cache"),log:Te.default.join(r,e,"Log"),temp:Te.default.join(qp,e)}},rI=e=>{let t=Te.default.basename(wn);return{data:Te.default.join(yi.XDG_DATA_HOME||Te.default.join(wn,".local","share"),e),config:Te.default.join(yi.XDG_CONFIG_HOME||Te.default.join(wn,".config"),e),cache:Te.default.join(yi.XDG_CACHE_HOME||Te.default.join(wn,".cache"),e),log:Te.default.join(yi.XDG_STATE_HOME||Te.default.join(wn,".local","state"),e),temp:Te.default.join(qp,t,e)}}});function nc(){return/[<>:"/\\|?*\u0000-\u001F]/g}function lb(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var cb=x(()=>{"use strict"});function Zs(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(nc().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(oI,o),e=e.replace(nc(),o),e=e.replace(r,o),e=e.replace(iI,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=lb().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:nI;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 nI,oI,iI,Xp=x(()=>{"use strict";cb();nI=100,oI=/^\.+(\\|\/)|^\.+$/,iI=/\.+$/});var sI,ub=x(()=>{"use strict";sI=w(require("path"),1);Xp()});var db=x(()=>{"use strict";Xp();ub()});var oc,Zp=x(()=>{"use strict";oc="webflow.json"});var oo,Qp=x(()=>{"use strict";oo=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function hb(e){pb=e}function yb(e){fb=e}function aI(){for(let e of wb){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function lI(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||aI()!==null}function V(){return pb?!0:fb?!1:lI()}function lr(){return!V()}function bb(e){mb=e}function Xe(){return mb}function kb(e){gb=e}function ic(){return gb}var pb,fb,mb,gb,wb,nM,we=x(()=>{"use strict";pb=!1,fb=!1,mb=!1;wb=[{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"}],nM=wb.map(e=>e.variable)});function cr(){let e=ic();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Db.statSync)(e)?.isDirectory())return{path:(0,Eb.join)(e,oc),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:`./${oc}`,isUserDefined:!1}}var Db,Eb,ef=x(()=>{"use strict";Db=require("fs"),Eb=require("path");Zp();we()});var vb,cI,uI,tf,Sb=x(()=>{"use strict";vb=w(require("ajv")),cI=new vb.default,uI={type:"object",properties:{region:{type:"string",enum:["us","eu"]},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:[]}}},tf=cI.compile(uI)});function xb(e){return e instanceof Error?e:new Error("Unknown error")}function oe(){let{path:e}=cr();if(!(0,sc.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,sc.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${xb(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: ${xb(o).message}`)}if(!tf(n)){let o=tf.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:n,manifestPath:e}}var sc,Qs=x(()=>{"use strict";sc=require("fs");ef();Sb()});function ea(e,t){let r=e[t];if(!r)throw new oo(t);return r}var Cb=x(()=>{"use strict";Qp()});function Se(e){let t=oe(),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,Fb.writeFileSync)(n,JSON.stringify(o,null,2),"utf-8"),o}var Fb,rf=x(()=>{"use strict";Fb=require("fs");Qs()});var Pe=x(()=>{"use strict";Zp();Qp();Qs();ef();Cb();rf()});var ac=gp((vM,dI)=>{dI.exports={name:"@webflow/webflow-cli",version:"2.5.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/app":"0.1.0-beta.6","@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.23","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 Sr(){try{return ac().version}catch{return"unknown"}}function ur(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=ta.default.homedir();if(r){let o=new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let n=ta.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 nf(e){if(e.stack)return ur(e.stack)}function bn(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]=ur(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?r[n]=bn(o):Array.isArray(o)?r[n]=o.map(s=>typeof s=="object"&&s!==null?bn(s):typeof s=="string"?ur(s):s):r[n]=o}return r}function _b(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${ta.default.type()} ${ta.default.release()}`}}function of(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var ta,ra=x(()=>{"use strict";ta=w(require("os"))});function wi(){if(process.platform==="win32"){let r=process.env.APPDATA??na.default.join(sf.default.homedir(),"AppData","Roaming");return na.default.join(r,Ab)}let t=process.env.XDG_CONFIG_HOME??na.default.join(sf.default.homedir(),".config");return na.default.join(t,Ab)}function Rb(){return Xs("webflow-cli").cache}var sf,na,Ab,oa=x(()=>{"use strict";sf=w(require("os")),na=w(require("path"));Yp();Ab="webflow"});function ia(){return af.default.join(wi(),pI)}function lf(){let e=ia();try{if(!bi.default.existsSync(e))return null;let t=bi.default.readFileSync(e,"utf8"),r=JSON.parse(t);return typeof r=="object"&&r!==null&&typeof r.allowTelemetry=="boolean"?r:null}catch{return null}}function cf(e){let t=ia(),r=af.default.dirname(t);bi.default.existsSync(r)||bi.default.mkdirSync(r,{recursive:!0,mode:448}),bi.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}var bi,af,pI,uf=x(()=>{"use strict";bi=w(require("fs")),af=w(require("path"));oa();pI="telemetry.json"});var $,D,xe,ki,df,rt,X,lc,pf,Kr,j=x(()=>{"use strict";me();$=z("\u2713"),D=Ut("\u2716"),xe=Ne("\u2139"),ki=z("\u279C"),df=Ut("\u279C"),rt="\u279C",X=ue("\u26A0"),lc=P("\u2732"),pf=z("\u2732"),Kr=ue("[Deprecated]")});var Ib,kn,ff=x(()=>{"use strict";Ib=w(require("fs"));Pe();ra();uf();R();me();j();we();kn=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}static localManifestExists(){try{let{path:t}=cr();return Ib.default.existsSync(t)}catch{return!1}}static readLocalPreference(){if(e.localManifestExists())try{let{manifest:t}=oe();return t?.telemetry?.global?.allowTelemetry}catch{return}}static readGlobalPreference(){return lf()?.allowTelemetry}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;let t=e.readLocalPreference();if(t!==void 0)return this.cache=t,t;let r=e.readGlobalPreference();if(r!==void 0)return this.cache=r,r}async setPreference(t,r){this.cache=t,r?.local?await this.setLocalPreference(t):await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(Xe()||u.info(`${xe} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(Xe()||(u.info(`${pf} ${P("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${pf} ${P("To opt out, run")} ${z("webflow auth telemetry --disable")}`)),await this.setGlobalPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return e.isDoNotTrackEnabled()?!1:e.readGlobalPreference()}async setGlobalPreference(t){cf({allowTelemetry:t,lastPrompted:Date.now(),version:Sr()}),Xe()||u.info(`${$} Telemetry configuration updated in ${ia()}`);let r=e.readLocalPreference();if(r!==void 0&&r!==t){let{path:n}=cr();u.warn(`${X} ${n} sets telemetry to ${r?"enabled":"disabled"} and overrides the global config for commands run in this directory. Re-run with --local to update it.`)}this.cache=t}async setLocalPreference(t){let r={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:Sr()}}};if(Se(r),!Xe()){let{path:n}=cr();u.info(`${$} Telemetry configuration updated in ${n}`)}this.cache=t}async hasGlobalPreference(){return e.readGlobalPreference()!==void 0}async getTelemetryStatus(){if(e.isDoNotTrackEnabled())return{enabled:!1,source:"env",hasPreference:!0};let t=e.readLocalPreference();if(t!==void 0)return{enabled:t,source:"local",hasPreference:!0};let r=e.readGlobalPreference();return r!==void 0?{enabled:r,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,r){this.cache=r}}});async function K(e,t){let n={"User-Agent":`webflow-cli@${Sr()}`};return(0,Tb.default)(e,{...t,headers:{...t?.headers,...n}})}var Tb,lt=x(()=>{"use strict";Tb=w(require("node-fetch"));Z()});var d,C=x(()=>{"use strict";d=class e extends Error{prefix;skipLogging;isUserError;missingFlag;code;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,this.code=r?.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 $b(e){Pb=e}function ct(){return Pb}function mf(e,t){if(io.includes(e))return e;throw new d(`Invalid region "${e}" from ${t}. Valid regions: ${io.join(", ")}.`,{isUserError:!0})}function Ob(e){if(e)return mf(e,"--region");let t=process.env.WEBFLOW_REGION;if(t)return mf(t,"WEBFLOW_REGION");let r;try{r=oe().manifest.region}catch(n){if(n instanceof Error&&n.message.startsWith("Invalid manifest:"))throw new d(n.message,{isUserError:!0});return"us"}return r?mf(r,"webflow.json"):"us"}var io,Pb,Dn=x(()=>{"use strict";C();Pe();io=["us","eu"],Pb="us"});var Lb,Nb=x(()=>{"use strict";Lb=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});function cc(){let e="production";return e==="development"||e==="acceptance"||e==="sai"?e:"production"}function hf(){return fI[cc()][ct()]}function O(){return process.env.WEBFLOW_API_HOST?gf("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):hf().api}function Di(){return process.env.WEBFLOW_CDN_API_HOST?gf("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):hf().cdnApi}function xr(){return process.env.WEBFLOW_HOST?gf("WEBFLOW_HOST",process.env.WEBFLOW_HOST):hf().webflow}var gf,fI,sa,yf,aa,la,Ei,ke=x(()=>{"use strict";Dn();Nb();gf=(e,t)=>(Lb(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),fI={development:{us:{webflow:"https://wfdev.io:8443",api:"https://api.wfdev.io:8443",cdnApi:"https://api-cdn.wfdev.io:8443"},eu:{webflow:"https://eu.wfdev.io:8443",api:"https://api.eu.wfdev.io:8443",cdnApi:"https://api-cdn.eu.wfdev.io:8443"}},acceptance:{us:{webflow:"https://webflowtest.com",api:"https://api.webflowtest.com",cdnApi:"https://api-cdn.webflowtest.com"},eu:{webflow:"https://eu.webflowtest.com",api:"https://api.eu.webflowtest.com",cdnApi:"https://api-cdn.eu.webflowtest.com"}},sai:{us:{webflow:"https://webflow-sai.com",api:"https://api.webflow-sai.com",cdnApi:"https://api-cdn.webflow-sai.com"},eu:{webflow:"https://eu.webflow-sai.com",api:"https://api.eu.webflow-sai.com",cdnApi:"https://api-cdn.eu.webflow-sai.com"}},production:{us:{webflow:"https://webflow.com",api:"https://api.webflow.com",cdnApi:"https://api-cdn.webflow.com"},eu:{webflow:"https://eu.webflow.com",api:"https://api.eu.webflow.com",cdnApi:"https://api-cdn.eu.webflow.com"}}};sa="wf-manifest.json",yf="mf-manifest.json",aa="@webflow_renderer",la="ssr-bundle.tar",Ei="index.js"});function mI(){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&&jb.has(n.slice(0,o))){t.push(`${n.slice(0,o)}=<redacted>`);continue}t.push(n),jb.has(n)&&r+1<e.length&&(t.push("<redacted>"),r+=1)}return t.join(" ")||void 0}var jb,_,wf=x(()=>{"use strict";ff();ra();R();lt();ke();jb=new Set(["--ref","--name","--q","--branch","--key"]);_=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=kn.getInstance(),this.sessionId=of(),this.platformInfo=_b()}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,feature:r,name:t.name,message:t.message,cause:t.cause,stack:nf(t),context:r,metadata:n?bn(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?bn(o):void 0})}async sendPerformance(t,r,n,o){await this.sendEvent({eventType:"performance",feature:o,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=kn.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:Sr(),command:this.config.suppressCommand?void 0:mI(),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=ur(r.message)),r.stack&&(r.stack=ur(r.stack)),r.feature&&(r.feature=ur(r.feature)),r.context&&(r.context=ur(r.context)),r.metadata&&(r.metadata=bn(r.metadata)),r.data&&(r.data=bn(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 K(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||O(),authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"skills"})}}});var Mb=x(()=>{"use strict"});function Bb(e,t){return async(r,n,o)=>{let i=Date.now(),s=process.memoryUsage().heapUsed;try{let a=await n(),l=Date.now()-i,c=process.memoryUsage().heapUsed;return await e.sendPerformance(r,l,{memoryDelta:c-s,...o},t),a}catch(a){let l=Date.now()-i;throw await e.sendPerformance(r,l,{failed:1,...o},t),a}}}var Z=x(()=>{"use strict";wf();ff();uf();Mb();ra();ra()});var kf,bf,gI,Jr,Df=x(()=>{"use strict";kf=Symbol("webflow-cli-warn"),bf=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]===kf){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(`
12
12
  \u26A0\uFE0F Warnings:
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(`
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(`
14
14
  \u{1F41B} Debug: Captured Warnings
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("")})}},l0=new zp,Wn=l0});function wt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function pb(e,t){if(!e)return t;let n=parseInt(e,10);return isNaN(n)||n<=0?t:n}function Hn(e){Ys.push(kn(e)),Ys.length>d0&&Ys.shift()}function fb(e){Zp=e}function ub(e){return Hn(`DEBUG: ${e}`),e}function f0(e){return Hn(`INFO: ${e}`),e}function m0(e){return Hn(`WARN: ${e}`),e}function g0(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Hn(`ERROR: ${r}${n}`),Qp=!0;let o=e instanceof Error?e.message:String(e);return Bt(`${r}${o}`)}function h0(e){return Hn(`SUCCESS: ${e}`),J(e)}function b0(e){let t=_p({text:`${e}...`,indent:1}).start(),n=!1,r=o=>i=>{if(Hn(`${y0[o]||"INFO"}: ${i||e}`),o==="fail"&&(Qp=!0),o==="update"){t.text=i||e;return}n||(n=!0,t.stopAndPersist({symbol:w0[o],text:I(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 D0(){let e=hi.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:hi.default.statSync(Yl.default.join(At,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);for(;e.length>=u0;)try{let t=e.pop();if(!t)break;hi.default.removeSync(Yl.default.join(At,t.name))}catch{}}function ef(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;hi.default.ensureDirSync(At),D0(),Ys.unshift(`CLI Version: ${Bn()}`,`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()}`,...Zp?[`Sync ID: ${Zp}`]:[],"");let n=Ys.map(wt);hi.default.writeFileSync(Yp,n.join(`
17
- `)),Qp&&(console.info(`
18
- ${k} ${I("An error occurred. See logs for more information:")}`),console.info(` ${Bp} Latest log: ${Yp}`),console.info(` ${Bp} All logs: ${At}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
19
- ${$} Command completed successfully. Logs written to:`),console.info(` ${fi} Latest log: ${Yp}`),console.info(` ${fi} All logs: ${At}`))}catch(t){console.error("Failed to write logs:",t)}}function mb(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Hn(`ERROR: ${r}${n}`)}var hi,Yl,P2,c0,At,u0,d0,p0,Yp,Ys,Qp,Zp,y0,w0,yi,db,Xs,k0,u,A=L(()=>{"use strict";hi=w(require("fs-extra")),Yl=w(require("path")),P2=require("source-map-support/register");Iw();Ip();Ow();X();pe();Xp();M();c0=Bs("webflow-cli"),At=c0.log;u0=pb(process.env.MAX_PERSISTED_LOGS,50),d0=pb(process.env.MAX_IN_MEMORY_LOGS,1e3),p0=`${Us(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Yp=Yl.default.join(At,p0);Ys=[],Qp=!1;y0={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},w0={succeed:$,fail:k,warn:re,info:Ce,neutral:" ",update:void 0};yi=!1;process.on("uncaughtException",e=>{yi||(yi=!0,Hn(`UNCAUGHT EXCEPTION: ${e?.stack}`),ef(1)),Wn.displayGrouped(),Wn.stop(),process.exit(1)});process.on("unhandledRejection",e=>{yi||(yi=!0,Hn(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),ef(1)),Wn.displayGrouped(),Wn.stop(),process.exit(1)});process.on("exit",e=>{yi||(yi=!0,ef(e))});db=!0,Xs=e=>{let t=e.split(`
20
- `).map(n=>n.length?` ${n}`:n).join(`
21
- `);return db?(db=!1,`
22
- `+t):t};k0={debug:e=>{let t=ub(e);process.env.DEBUG&&console.debug(Xs(t))},trace:e=>{let t=ub(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(Xs(f0(e))),warn:e=>console.warn(Xs(m0(e)),qp),error:(e,t)=>{console.error(Xs(g0(e,t)))},success:e=>console.log(Xs(h0(e))),spinner:b0},u=k0});async function wi(e){process.stdout.write(`
23
- `);try{return await e()}catch(t){throw t instanceof Error&&_0.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 $e(e){return V()?e.default??!1:wi(()=>ct.confirm({...e,theme:v0}))}async function Be(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:` ${I(r)}`}});return wi(()=>ct.select({...e,choices:t,theme:x0}))}async function Ke(e){return V()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:wi(()=>ct.input({...e,theme:yb}))}async function Db(e){return V()?null:wi(()=>ct.password({...e,theme:yb}))}async function vn(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:` ${I(r)}`}});return wi(()=>ct.checkbox({...e,choices:t,theme:C0}))}async function Ql(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:` ${I(i.name??"")}`}));return wi(()=>ct.search({...e,source:t,theme:F0}))}var ct,v0,yb,Zs,wb,rf,of,bb,S0,x0,C0,F0,_0,Oe=L(()=>{"use strict";ct=w(require("@inquirer/prompts"));be();A();pe();v0={prefix:` ${je("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
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("")})}},gI=new bf,Jr=gI});function bt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function Hb(e,t){if(!e)return t;let r=parseInt(e,10);return isNaN(r)||r<=0?t:r}function zr(e){ua.push(ur(e)),ua.length>wI&&ua.shift()}function Vb(e){vf=e}function Ub(e){return zr(`DEBUG: ${e}`),e}function kI(e){return zr(`INFO: ${e}`),e}function DI(e){return zr(`WARN: ${e}`),e}function EI(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";zr(`ERROR: ${n}${r}`),Sf=!0;let o=e instanceof Error?e.message:String(e);return Ut(`${n}${o}`)}function vI(e){return zr(`SUCCESS: ${e}`),z(e)}function CI(e){let t=Jp({text:`${e}...`,indent:1}).start(),r=!1,n=o=>i=>{if(zr(`${SI[o]||"INFO"}: ${i||e}`),o==="fail"&&(Sf=!0),o==="update"){t.text=i||e;return}r||(r=!0,t.stopAndPersist({symbol:xI[o],text:P(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 FI(){let e=vi.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:vi.default.statSync(uc.default.join(At,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);for(;e.length>=yI;)try{let t=e.pop();if(!t)break;vi.default.removeSync(uc.default.join(At,t.name))}catch{}}function xf(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;vi.default.ensureDirSync(At),FI(),ua.unshift(`CLI Version: ${Sr()}`,`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()}`,...vf?[`Sync ID: ${vf}`]:[],"");let r=ua.map(bt);vi.default.writeFileSync(Ef,r.join(`
17
+ `)),Sf&&(console.info(`
18
+ ${D} ${P("An error occurred. See logs for more information:")}`),console.info(` ${df} Latest log: ${Ef}`),console.info(` ${df} All logs: ${At}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
19
+ ${$} Command completed successfully. Logs written to:`),console.info(` ${ki} Latest log: ${Ef}`),console.info(` ${ki} All logs: ${At}`))}catch(t){console.error("Failed to write logs:",t)}}function Gb(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";zr(`ERROR: ${n}${r}`)}var vi,uc,dB,hI,At,yI,wI,bI,Ef,ua,Sf,vf,SI,xI,Si,Wb,ca,_I,u,R=x(()=>{"use strict";vi=w(require("fs-extra")),uc=w(require("path")),dB=require("source-map-support/register");ab();Yp();db();Z();me();Df();j();hI=Xs("webflow-cli"),At=hI.log;yI=Hb(process.env.MAX_PERSISTED_LOGS,50),wI=Hb(process.env.MAX_IN_MEMORY_LOGS,1e3),bI=`${Zs(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Ef=uc.default.join(At,bI);ua=[],Sf=!1;SI={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},xI={succeed:$,fail:D,warn:X,info:xe,neutral:" ",update:void 0};Si=!1;process.on("uncaughtException",e=>{Si||(Si=!0,zr(`UNCAUGHT EXCEPTION: ${e?.stack}`),xf(1)),Jr.displayGrouped(),Jr.stop(),process.exit(1)});process.on("unhandledRejection",e=>{Si||(Si=!0,zr(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),xf(1)),Jr.displayGrouped(),Jr.stop(),process.exit(1)});process.on("exit",e=>{Si||(Si=!0,xf(e))});Wb=!0,ca=e=>{let t=e.split(`
20
+ `).map(r=>r.length?` ${r}`:r).join(`
21
+ `);return Wb?(Wb=!1,`
22
+ `+t):t};_I={debug:e=>{let t=Ub(e);process.env.DEBUG&&console.debug(ca(t))},trace:e=>{let t=Ub(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(ca(kI(e))),warn:e=>console.warn(ca(DI(e)),kf),error:(e,t)=>{console.error(ca(EI(e,t)))},success:e=>console.log(ca(vI(e))),spinner:CI},u=_I});async function xi(e){process.stdout.write(`
23
+ `);try{return await e()}catch(t){throw t instanceof Error&&OI.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 $e(e){return V()?e.default??!1:xi(()=>ut.confirm({...e,theme:RI}))}async function je(e){if(V())return"default"in e?e.default:null;let t=e.choices.map(r=>{if(!r||typeof r!="object"||ut.Separator.isSeparator(r)||r.type==="separator")return r;let n=r.name??String(r.value??"");return{...r,name:` ${P(n)}`}});return xi(()=>ut.select({...e,choices:t,theme:TI}))}async function Ge(e){return V()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:xi(()=>ut.input({...e,theme:zb}))}async function Xb(e){return V()?null:xi(()=>ut.password({...e,theme:zb}))}async function Cr(e){if(V()){let r=[];return await e.validate?.(r)!==!0?null:r}let t=e.choices.map(r=>{if(!r||typeof r!="object"||r.type==="separator"||ut.Separator.isSeparator(r))return r;let n=r.name??String(r.value??"");return{...r,name:` ${P(n)}`}});return xi(()=>ut.checkbox({...e,choices:t,theme:PI}))}async function pc(e){if(V())return"default"in e?e.default:null;let t=(async(r,n)=>(await e.source(r,n)).map(i=>!i||typeof i!="object"||ut.Separator.isSeparator(i)?i:{...i,name:` ${P(i.name??"")}`}));return xi(()=>ut.search({...e,source:t,theme:$I}))}var ut,RI,zb,da,qb,_f,Af,Yb,II,TI,PI,$I,OI,Oe=x(()=>{"use strict";ut=w(require("@inquirer/prompts"));we();R();me();RI={prefix:` ${Ne("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
24
24
  `:`${se(e)}
25
- `,answer:e=>` ${I(e)}`}},yb={prefix:` ${je("?")}`,style:{message:e=>`${se(e)}
26
- `,answer:e=>I(e)}},Zs=2,wb=1,rf=(e,t)=>t==="done"?`${se(e)}
27
- `:se(e),of=e=>` ${I(wt(e).trim())}`,bb=e=>{let t=wt(e),n=t.slice(0,Zs),r=t.slice(Zs+1+wb);return je(`${n} ${r}`)},S0=e=>{let t=wt(e),n=t.slice(0,Zs),r=t[Zs+2],o=t.slice(Zs+3+wb);return je(`${n} ${r} ${o}`)},x0={prefix:` ${je("?")}`,style:{message:rf,answer:of,highlight:bb,keysHelpTip:e=>` ${e.map(([t,n])=>`${I(t)} ${I(n)}`).join(" ")}`},icon:{cursor:` ${je("\u23F5")}`}},C0={prefix:` ${je("?")}`,style:{message:rf,answer:of,highlight:S0,keysHelpTip:e=>` ${e.map(([t,n])=>`${I(t)} ${I(n)}`).join(" ")}`},icon:{cursor:` ${je("\u23F5")}`,checked:` ${J("\u25C9")}`,unchecked:` ${I("\u25EF")}`}},F0={prefix:` ${je("?")}`,style:{message:rf,answer:of,highlight:bb,searchTerm:e=>je(e)},icon:{cursor:` ${je("\u23F5")}`}},_0=/SIGINT/i});function Je(){return!1}var Vn=L(()=>{"use strict"});function Gn({apiToken:e,siteId:t,directory:n}){let r=ea.resolve(n?ea.join(n,".env"):ea.join(process.cwd(),".env"));n&&!ro.existsSync(n)&&ro.mkdirSync(n,{recursive:!0}),ro.existsSync(r)||ro.writeFileSync(r,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),ec.default.config({path:r,quiet:!0}),e&&ec.default.set("WEBFLOW_API_TOKEN",e,{path:r,encrypt:!1}),t&&ec.default.set("WEBFLOW_SITE_ID",t,{path:r,encrypt:!1})}var ro,ea,ec,Cb=L(()=>{"use strict";ro=w(require("fs")),ea=w(require("path")),ec=w(require("@dotenvx/dotenvx"))});function tc(){if(process.platform==="win32"){let n=process.env.APPDATA??ta.default.join(af.default.homedir(),"AppData","Roaming");return ta.default.join(n,Fb)}let t=process.env.XDG_CONFIG_HOME??ta.default.join(af.default.homedir(),".config");return ta.default.join(t,Fb)}function _b(){return Bs("webflow-cli").cache}var af,ta,Fb,nc=L(()=>{"use strict";af=w(require("os")),ta=w(require("path"));Ip();Fb="webflow"});function yr(){let e=tc();return lf.default.join(e,I0)}function na(){let e=yr();try{if(!hr.default.existsSync(e))return null;let t=hr.default.readFileSync(e,"utf8");return JSON.parse(t)}catch{return null}}function cf(e){let t=yr(),n=lf.default.dirname(t);hr.default.existsSync(n)||hr.default.mkdirSync(n,{recursive:!0,mode:448}),hr.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}function uf(){let e=yr();try{hr.default.existsSync(e)&&hr.default.unlinkSync(e)}catch{}}var hr,lf,I0,df=L(()=>{"use strict";hr=w(require("fs")),lf=w(require("path"));nc();I0="auth.json"});function ra(){return{serverUrl:En(),timeoutMs:300*1e3}}var pf=L(()=>{"use strict";De()});var Ab,Rb,Ib,Tb,T0,Pb,P0,$b,Ob=L(()=>{"use strict";Ab=require("crypto"),Rb=w(require("open"));pf();A();lt();Ib=e=>{let t=new Uint8Array(e);return Ab.webcrypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")},Tb=({pollId:e,clientId:t,scope:n})=>`${ra().serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(n.join(" "))}`,T0=e=>`${ra().serverUrl}/oauth/webflow/poll?pollId=${e}`,Pb=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(n=>setTimeout(n,3e3)),await(0,Rb.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},P0=async e=>{let t=T0(e),n=await G(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()},$b=(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 P0(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 Nb(){return[...$0,...Je()?O0:[]].sort()}function Rt(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=na();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!Lb&&(Lb=!0,u.warn(`${re} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${J("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=Rt();if(o)return o}if(V())throw new f(`No API token found. To authenticate in CI/CD environments:
25
+ `,answer:e=>` ${P(e)}`}},zb={prefix:` ${Ne("?")}`,style:{message:e=>`${se(e)}
26
+ `,answer:e=>P(e)}},da=2,qb=1,_f=(e,t)=>t==="done"?`${se(e)}
27
+ `:se(e),Af=e=>` ${P(bt(e).trim())}`,Yb=e=>{let t=bt(e),r=t.slice(0,da),n=t.slice(da+1+qb);return Ne(`${r} ${n}`)},II=e=>{let t=bt(e),r=t.slice(0,da),n=t[da+2],o=t.slice(da+3+qb);return Ne(`${r} ${n} ${o}`)},TI={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:Yb,keysHelpTip:e=>` ${e.map(([t,r])=>`${P(t)} ${P(r)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`}},PI={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:II,keysHelpTip:e=>` ${e.map(([t,r])=>`${P(t)} ${P(r)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`,checked:` ${z("\u25C9")}`,unchecked:` ${P("\u25EF")}`}},$I={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:Yb,searchTerm:e=>Ne(e)},icon:{cursor:` ${Ne("\u23F5")}`}},OI=/SIGINT/i});function Ke(){return!0}var qr=x(()=>{"use strict"});function Yr({apiToken:e,siteId:t,directory:r}){let n=fa.resolve(r?fa.join(r,".env"):fa.join(process.cwd(),".env"));r&&!co.existsSync(r)&&co.mkdirSync(r,{recursive:!0}),co.existsSync(n)||co.writeFileSync(n,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),fc.default.config({path:n,quiet:!0}),e&&fc.default.set("WEBFLOW_API_TOKEN",e,{path:n,encrypt:!1}),t&&fc.default.set("WEBFLOW_SITE_ID",t,{path:n,encrypt:!1})}var co,fa,fc,nk=x(()=>{"use strict";co=w(require("fs")),fa=w(require("path")),fc=w(require("@dotenvx/dotenvx"))});function If(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version===mc&&io.includes(t.region)&&typeof t.session=="object"&&t.session!==null&&typeof t.session.accessToken=="string"}function Sn(){let e=wi();return Tf.default.join(e,jI)}function ok(){let e=Sn();try{if(!vn.default.existsSync(e))return null;let t=vn.default.readFileSync(e,"utf8"),r=JSON.parse(t);if(If(r))return r;let n=r;if(n.version===2&&typeof n.sessions=="object"&&n.sessions){let i=ct(),s=n.sessions,a=s[i]!=null?i:Object.keys(s).find(p=>s[p]!=null);if(a==null)return null;let l=s[a];if(l==null)return null;let c={version:mc,region:a,session:l};return If(c)?c:null}let o=r;if(typeof o.accessToken=="string"){let i={version:mc,region:"us",session:o};return If(i)?i:null}return null}catch{return null}}function Ci(e=ct()){let t=ok();return!t||t.region!==e?null:t.session}function ma(){return ok()?.region??null}function Pf(e,t=ct()){let r=Sn(),n=Tf.default.dirname(r);vn.default.existsSync(n)||vn.default.mkdirSync(n,{recursive:!0,mode:448});let o={version:mc,region:t,session:e};vn.default.writeFileSync(r,JSON.stringify(o,null,2),{encoding:"utf8",mode:384})}function $f(){let e=Sn();try{if(!vn.default.existsSync(e))return;vn.default.unlinkSync(e)}catch{}}var vn,Tf,jI,mc,Of=x(()=>{"use strict";vn=w(require("fs")),Tf=w(require("path"));oa();Dn();jI="auth.json",mc=3});function Fi(){return{serverUrl:xr(),timeoutMs:300*1e3}}var Lf=x(()=>{"use strict";ke()});var ik,sk,ak,lk,MI,ck,BI,uk,dk=x(()=>{"use strict";ik=require("crypto"),sk=w(require("open"));Lf();R();lt();ak=e=>{let t=new Uint8Array(e);return ik.webcrypto.getRandomValues(t),Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")},lk=({pollId:e,clientId:t,scope:r})=>`${Fi().serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(r.join(" "))}`,MI=e=>`${Fi().serverUrl}/oauth/webflow/poll?pollId=${e}`,ck=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(r=>setTimeout(r,3e3)),await(0,sk.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},BI=async e=>{let t=MI(e),r=await K(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()},uk=(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 BI(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 fk(){return[...UI,...Ke()?WI:[]].sort()}function Vt(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=Ci();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!pk&&(pk=!0,u.warn(`${X} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${z("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 s=Vt();if(s)return s}if(V())throw new d(`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=Ib(16),n=L0(),r=Nb();try{let o=Tb({pollId:t,clientId:n,scope:r});await Pb(o);let i=await $b(t,ra().timeoutMs);return cf({accessToken:i,scopes:r,createdAt:new Date().toISOString()}),u.info(`${$} Credentials saved: ${yr()}`),i}catch(o){throw new f(o)}}function L0(){return"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}var $0,O0,Lb,ff=L(()=>{"use strict";be();A();M();C();df();pf();Ob();pe();Vn();$0=["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"],O0=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];Lb=!1});function oo(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function wr(e){try{let n=await new jb.WebflowClient({accessToken:e,environment:{base:`${P()}/v2`,dataApi:`${P()}/v2`,contentDeliveryApi:`${mi()}/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 bi(e){let t=e.map(r=>({name:`${r.displayName} (${r.shortName})`,value:r})),n=await Ql({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 jb,rc=L(()=>{"use strict";jb=require("webflow-api");Oe();A();De();De();C()});var io,br,mf=L(()=>{"use strict";C();io=class extends f{constructor(t){super(t),this.name="NoWebflowSitesError"}},br=class extends f{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function ze(e,t){let n=t?.site??oo(e);if(V()&&!n)throw new f(`No site ID configured for this project.
31
- Run ${J("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 wr(r);if(o.length===0)throw new io("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 bi(o):o[0];n=i.id;let s=xe({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 Mb=L(()=>{"use strict";Me();be();ff();rc();C();mf();M();pe();A()});async function gf(e){let t=new Bb.WebflowClient({accessToken:e,environment:{base:`${P()}/v2`,dataApi:`${P()}/v2`,contentDeliveryApi:`${mi()}/v2`}});try{return await t.token.authorizedBy()}catch{return null}}var Bb,Ub=L(()=>{"use strict";Bb=require("webflow-api");De()});var q=L(()=>{"use strict";Cb();ff();Mb();rc();rc();df();Ub();mf()});function q0(e,t){if(e.includes("..")||an.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let n=an.resolve(t,e),r=an.resolve(t);if(!n.startsWith(r+an.sep)&&n!==r)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function gc(e,t,n){let r=an.join(process.cwd(),t);n&&(0,kr.existsSync)(r)&&await(0,mc.rm)(r,{recursive:!0,force:!0}),(0,kr.existsSync)(r)||await(0,mc.mkdir)(r);for(let o of e){q0(o.path,r);let i=X0(r,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));Y0(r,s)}(0,kr.writeFileSync)(i,o.content,{flag:"w+"})}}function X0(e,t){return an.join(e,...t.split("/"))}function Y0(e,t){let n=t.split("/"),r=e;for(let o of n)r=an.join(r,o),(0,kr.existsSync)(r)||(0,kr.mkdirSync)(r)}var kr,mc,an,Cf=L(()=>{"use strict";kr=require("fs"),mc=require("fs/promises"),an=w(require("path"))});function yc(e){for(let t of e??[]){let n=u[t.status]??u.info,r=tR[t.status]??Ce;n(`
33
- ${r} ${t.content}`)}}var tR,Af=L(()=>{"use strict";A();M();tR={info:Ce,warn:re,success:$}});function If(e){let{manifestPath:t}=ee();return(0,SD.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var SD,xD=L(()=>{"use strict";SD=require("fs");Ws()});function wc(e,t,n){try{let r=Tf(n),o=Pf(Object.values(e)),i=t?.force;return o&&r&&!i}catch{return!1}}var CD,FD,Tf,Pf,bc=L(()=>{"use strict";CD=require("path"),FD=require("fs-extra");Tf=e=>{try{return(0,FD.existsSync)((0,CD.join)(e,"tsconfig.json"))}catch{return!1}},Pf=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function nR(e){let{export:t,...n}=e;return t?n["devlink-export"]!=null?(If(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},If(n),n):n}function RD(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 TD(e){e=nR(e);let t=e["devlink-export"]||{},n=!1,r=t.rootDir;r||(V()?r=_D:(n=!0,r=await Ke({message:"Enter the root directory for exported components:",default:_D,validate:p=>!p||p.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(iR()?o=!0:V()?o=!1:(n=!0,o=await $e({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(V()?i=AD:(n=!0,i=await $e({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:AD}))),t.components&&RD(t.components,"components"),t.componentGroups&&RD(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(V()?(s=Dc,a=kc):(n=!0,await $e({message:"Do you want to export all components?",default:!0})?(s=Dc,a=kc):(s=await Ke({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:Dc,validate:d=>{try{return new RegExp(d),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Ke({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:kc,validate:d=>{try{return new RegExp(d),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||Dc,a=a||kc;let l=t.relativeHrefRoot;l===void 0&&(l=rR);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)&&oR(c),{config:c,wasPrompted:n}}function oR(e){xe({"devlink-export":{...e}}),u.info(`${$} Devlink Export configuration updated in webflow.json`)}function iR(){try{let e=process.cwd();if(Tf(e))return!0;let t=["src","app","pages","components"];for(let n of t){let r=ID.join(e,n);if(Ec.existsSync(r)&&Pf(Ec.readdirSync(r)))return!0}}catch{}return!1}var Ec,ID,_D,Dc,kc,AD,rR,PD=L(()=>{"use strict";Ec=w(require("fs")),ID=w(require("path"));Oe();be();A();M();C();Np();xD();bc();_D="./webflow",Dc=".*",kc=".*",AD=!0,rR="/"});function ao(e){let t=e;for(let n=0;n<8&&t instanceof Error;n+=1){if(t.code===Of)return!0;t=t.cause}return!1}async function LD(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 sa(n||`Request failed (HTTP ${e.status}).`,{code:r})}async function Lf(e,t,n,r){let o=await sR(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 sR(e,t,n,r){let{taskId:o,polling:i}=await aR(e,t,n,r);return lR(e,t,n,o,i)}async function aR(e,t,n,r){let o=await(0,$f.default)(`${P()}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",[OD]:t},body:JSON.stringify(r),timeout:6e4});return o.ok||await LD(o),await o.json()}async function lR(e,t,n,r,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,p=i;do{let d=await(0,$f.default)(`${P()}/v2/devlink/${e}/export/${r}`,{headers:{Authorization:`Bearer ${n}`,[OD]:t},timeout:6e4});d.ok||await LD(d);let m=await d.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new sa("The export task failed. Please try again or report a bug.");await(0,$D.setTimeout)(p),p=Math.min(p*a,s)}while(Date.now()<c);throw new sa(`Export task timed out after ${l}ms. Please try again.`)}var $f,$D,OD,Of,sa,Nf=L(()=>{"use strict";$f=w(require("node-fetch")),$D=require("timers/promises");A();De();C();OD="X-WF-Sync-Id",Of="devlink_export_not_entitled",sa=class extends Error{code;constructor(t,n){super(t),this.code=n?.code}}});var ND,jD=L(()=>{"use strict";Oe();A();ND=async(e,t)=>{if(!t)return;await $e({message:`Ready to export components to ${e.rootDir}?`,default:!0})||(u.info("Export cancelled."),process.exit(0))}});function MD(e,t,n){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:n||`${t}s`;return`${e} ${i}`}var BD=L(()=>{"use strict"});async function vc(e){let t=Date.now(),n;try{let{manifest:r}=ee(),{siteId:o,accessToken:i}=await ze(r,e),s=(0,UD.randomUUID)();fb(s);let{config:a,wasPrompted:l}=await TD(r);u.info(`${$} Export configuration loaded!`),await ND(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:p,messages:d,metadata:m}=await Lf(a,i,o,s),h=m.exportCoverage==="full";await gc(p,a.rootDir,h),n.succeed(`${MD(m.componentCount,"component")} exported to ${a.rootDir}`),yc(d);let g=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:g,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let d=p instanceof Error?p.message:String(p);throw e?.silentNotEntitled&&ao(p)?n.stop():n.fail(`Components export failed: ${d}`),await c.sendError(p instanceof Error?p:new Error(String(p)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),p}}catch(r){if(!(e?.silentNotEntitled&&ao(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 UD,WD=L(()=>{"use strict";UD=require("crypto");PD();Nf();jD();X();q();Me();BD();A();C();Cf();M();Af()});var HD={};Py(HD,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>Of,exportComponents:()=>vc,isDevlinkNotEntitledError:()=>ao});var Sc=L(()=>{"use strict";WD();Nf()});var $y=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function eA(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 tA(e=process){if(e[$y])return;e[$y]=!0;let t=e.emit;e.emit=function(r,...o){return r==="warning"&&eA(o[0])?!1:t.call(this,r,...o)}}tA();var V_=w(require("fs")),G_=require("commander");var U_=require("commander");pe();A();var gb=require("child_process"),hb=require("fs"),tf=w(require("semver"));A();var nf="@webflow/webflow-cli",eo="@webflow/data-types",Zl="@webflow/react",E0=[nf,eo,Zl],to=class{getInstalledDependencies(){try{let t=(0,gb.execSync)(`npm ls ${E0.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,hb.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...n.dependencies,...n.devDependencies}}checkCLIAndDataTypes(t){let n=t[eo];if(!n)return;let o=this.getRequiredDependencies(nf)[eo];if(!tf.default.satisfies(n,o))throw new Error(`Version mismatch: ${nf} requires ${eo} v${o} but found v${n}`)}checkReactAndDataTypes(t){let n=t[eo],r=t[Zl];if(!(!n||!r)&&!tf.default.eq(n,r))throw new Error(`Version mismatch: ${Zl} and ${eo} must be on the same version. Found ${Zl}@${r} and ${eo}@${n}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var Sb=require("fs-extra");Oe();var xb=require("@dotenvx/dotenvx"),no=w(require("semver"));A();var kb=require("child_process"),Eb=require("util"),A0=(0,Eb.promisify)(kb.exec);async function gr(e,t){try{let{stdout:n,stderr:r}=await A0(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}}}be();var sf=w(zl());M();pe();(0,xb.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var vb={npm:{updateCommand:"npm install",update:async e=>await gr(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await gr(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await gr(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await gr(`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}},R0=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],Qs=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(vb))if((0,Sb.existsSync)(t.lockFile))return t;return vb.npm}async listOutdatedPackages(t="local",n=R0){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 vn({message:`New versions of the following ${je("@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(`${Ce} New versions of the following ${je("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(I(` ${ql} ${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(J(` ${n} ${o.join(" ")}`)),i.length>0&&u.info(J(` ${n} ${r} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=no.prerelease(sf.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 gr(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!r.trim()){n.succeed("Up to date");return}let i=r.trim(),s=sf.default.version;if(!no.valid(i)||!no.valid(s)){n.succeed("Up to date");return}if(!no.gt(i,s)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){u.info(`${Ce} A new version of @webflow/webflow-cli@${t} is available.`);let{code:d}=await gr("npm ls @webflow/webflow-cli --json"),h=(d===0?"local":"global")==="global"?" --global":"";u.info(`${at} To update, run: `+J(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`)+`
36
- `);return}let{code:l}=await gr("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await $e({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 d=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${d} @webflow/webflow-cli@${t}`),n.succeed("Updated successfully")}catch{let h=c==="global"?` ${this.packageManager.globalFlag}`:"";n.fail("Update failed. Manually run: "+J(`${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:p,updateCommand:d}=this.packageManager;try{a.length>0&&await c(`${a.map(m=>`${m}@latest`).join(" ")}`),l.length>0&&await c(`${p} ${l.map(m=>`${m}@latest`).join(" ")}`),n.succeed("Updated successfully")}catch{n.fail("Update failed. Manually run: "+J(`${d} ${s.map(h=>`${h}@latest`).join(" ")}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}};be();Xl();Vn();Xp();Jp();Oe();X();q();be();Me();A();C();M();pe();var Hb=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}=ee();if(!n.force&&Rt()){let i=oo(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});Gn({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=na(),r=n?.accessToken??Rt();if(!r){u.info(`${k} Not logged in. Run ${J("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let o=await gf(r);if(!o){u.info(`${k} Token is invalid or expired. Run ${J("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: ${yr()}`)}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()=>{uf(),u.info(`${$} Logged out. Session file removed.`),u.info(`${at} Run ${J("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=mr.getInstance();if(n.status){let s=await r.getTelemetryStatus();u.info(Wb(s.enabled));return}if(n.enable){await r.setGlobalPreference(!0),u.info(hf(!0));return}if(n.disable){await r.setGlobalPreference(!1),u.info(hf(!1));return}let o=await r.getTelemetryStatus();if(u.info(Wb(o.enabled)),V()){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 r.setGlobalPreference(s),u.info(hf(s))}})},hf=e=>`${$} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,Wb=e=>`${Ce} Telemetry status: ${e?`enabled ${$}`:`disabled ${k}`}`;var cD=w(require("http")),uD=w(require("node-fetch")),dD=w(require("serve-handler")),pD=require("fs"),fD=w(require("path")),mD=require("commander");var Gb=w(require("archiver")),wf=require("commander"),sc=require("fs");var Vb=require("cosmiconfig"),yf=require("commander"),oc=async(e,t)=>{let n=await N0(t),r=n.config.apiVersion;return r&&typeof r!="string"&&yf.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}}},N0=async e=>{let n=await(0,Vb.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return n||yf.program.error(`No ${e} file was found. Run this command within your extension folder.`),n};var Kb=w(require("mime-types")),ic=w(require("path")),j0=5*1024*1024,M0=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"]),Jb=async(e,t,n)=>{let{config:r,filepath:o}=await oc(e,t),i=ic.join(o,".."),s=!0,a=!1,l=p=>{let d=p.name,m=Kb.default.lookup(d);return d==="index.html"&&(a=!0),d&&d.endsWith(".DS_Store")||!m?!1:M0.has(m)?p:(console.log(`Invalid file type: ${m} for file: ${d}`),s=!1,!1)},c=p=>{(0,sc.unlink)(n,d=>{d&&console.error(`Failed to delete file: ${d}`),wf.program.error(p)})};return console.log(`Packaging the contents of the ${r.publicDir} folder into ${n}...`),new Promise(p=>{let d=(0,Gb.default)("zip",{zlib:{level:9}}),m=(0,sc.createWriteStream)(ic.join(i,n));m.on("close",()=>{p(void 0)}),d.directory(ic.join(i,r.publicDir),!1,l),d.file(o,{name:t}),d.pipe(m),d.finalize(),d.on("warning",h=>{console.log(h)}),d.on("error",h=>{wf.program.error(h.message)}),d.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(!d.pointer()||d.pointer()===0){c("Bundling failed with no output");return}if(d.pointer()>=j0){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${d.pointer()} total bytes written`),console.log(`Done! ${n} is ready for you to upload to your Webflow app.`)})})};var oa=w(require("path")),Sn=w(require("fs/promises")),cc=w(require("fs")),qb=require("url"),yB=require("dotenv/config"),Xb=["js","cjs","json"],kf=process.cwd(),Yb=".webflowrc",Jn=oa.extname(cc.readdirSync(kf).find(e=>e.includes(Yb))??"").replace(/\./g,""),Kn=oa.join(kf,`${Yb}${Jn&&`.${Jn}`}`),Zb=cc.existsSync(Kn),bf=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${Xb.join(", ")}`)}},ac=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${Jn}. The supported extensions are: ${Xb.join(", ")}`)}},lc=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)}},Df=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 B0(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,qb.pathToFileURL)(e).href:e)).default}function zb(e,t){let n=t.filter(r=>!e[r]);if(n.length)throw new Df(n.join(", "))}async function Di(e=[],t=!1){if(!Zb){if(t)return{};throw new lc(Kn)}if(!Jn)throw new bf;switch(Jn){case"js":case"cjs":{await Sn.access(Kn);let n=await B0(Kn);return zb(n,e),n}case"json":{let n=JSON.parse(await Sn.readFile(Kn,"utf8"));return zb(n,e),n}default:throw new ac}}function U0(e,t){if(Jn==="js"||Jn==="cjs"){let r=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(r)return r[1]}}function W0(e,t,n){let r=U0(t,n);if(r){let o=new RegExp(`${n}: ".*?",`,"g");return e.replace(o,`${n}: process.env.${r},`)}return e}async function H0(e){let t=["authToken","host","siteId"],n=await Sn.readFile(Kn,"utf-8");for(let r of t)e=W0(e,n,r);return e}async function V0(){try{let e=oa.join(kf,"package.json");return await Sn.access(e),JSON.parse(await Sn.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function Qb(e){if(!Zb)throw new lc(Kn);let t=JSON.stringify(e,null,2);switch(Jn){case"js":case"cjs":{let n=await H0(t.replace(/"([^"]+)":/g,"$1:")),r=await V0()&&Jn==="js"?"export default ":"module.exports = ";return Sn.writeFile(Kn,r+n)}case"json":return Sn.writeFile(Kn,t);default:throw new ac}}var Dr=w(require("fs")),Ht=w(require("path"));var ia="webflow.json",eD="index.html",tD="bundle.zip",Ef="public",vf="extension-scaffolds",uc="default";var nD="package.json",rD="wf-placeholder-name",Sf=e=>JSON.stringify(e,null,2),oD=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=ct(),r=ma();r&&r!==t&&u.warn(`${X} Switching region from ${r.toUpperCase()} to ${t.toUpperCase()} \u2014 the ${r.toUpperCase()} session will be replaced.`);let n=ak(16),o=VI(),i=fk();try{let s=lk({pollId:n,clientId:o,scope:i});u.debug(`OAuth login: region="${ct()}" buildEnv="${cc()}" apiHost="${O()}" oauthServer="${Fi().serverUrl}" clientId="${o}" authorizeUrl="${s}"`),await ck(s);let a=await uk(n,Fi().timeoutMs);return Pf({accessToken:a,scopes:i,createdAt:new Date().toISOString()}),u.info(`${$} Credentials saved: ${Sn()}`),a}catch(s){throw new d(s)}}function VI(){if(process.env.WEBFLOW_OAUTH_CLIENT_ID)return process.env.WEBFLOW_OAUTH_CLIENT_ID;let e=cc(),t=ct(),r=HI[e][t];if(r)return r;let n=t.toUpperCase();throw new d(`${n} login is not available for this environment yet. Set WEBFLOW_API_TOKEN to a token from your ${n} workspace, or set WEBFLOW_OAUTH_CLIENT_ID if you have a ${n} client ID.`,{isUserError:!0})}var UI,WI,pk,HI,Nf=x(()=>{"use strict";ke();we();R();j();C();Dn();Of();Lf();dk();me();qr();UI=["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"],WI=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];pk=!1;HI={development:{us:"db64c798d0a5adb3c9c43b10c80f93fece223acd072246f957d9700b1bf3cab0"},acceptance:{us:"32a6440eefa0b608b39c36164a9cf274c9c096cfe6541e9dab08ff4f372fe245"},sai:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074",eu:"6e2027b2c3a881e6d1f7a0933e7240e9ddf50df5afdde06740e30d56e3deed4b"},production:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}}});function uo(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function xn(e){try{let r=await new mk.WebflowClient({accessToken:e,environment:{base:`${O()}/v2`,dataApi:`${O()}/v2`,contentDeliveryApi:`${Di()}/v2`}}).sites.list();if(!r||typeof r!="object"||!r.sites||!Array.isArray(r.sites))throw new d("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,workspaceId:o.workspaceId??null}));return n.sort((o,i)=>o.displayName.localeCompare(i.displayName)),n}catch(t){throw new d(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
30
+ `})}}async function _i(e){let t=e.map(n=>({name:`${n.displayName} (${n.shortName})`,value:n})),r=await pc({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 d("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return r}var mk,gc=x(()=>{"use strict";mk=require("webflow-api");Oe();R();ke();ke();C()});var po,Cn,jf=x(()=>{"use strict";C();po=class extends d{constructor(t){super(t),this.name="NoWebflowSitesError"}},Cn=class extends d{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function Je(e,t){let r=t?.site??uo(e);if(V()&&!r)throw new d(`No site ID configured for this project.
31
+ Run ${z("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 xn(n);if(o.length===0)throw new po("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 _i(o):o[0];r=i.id;let s=Se({siteId:r});return e.siteId=s.siteId,u.info(`${$} Site ID updated in webflow.json`),{siteId:r,siteName:i.displayName,accessToken:n}}return{siteId:r,accessToken:n}}var gk=x(()=>{"use strict";Pe();we();Nf();gc();C();jf();j();me();R()});async function Mf(e){let t=O(),r=Di();u.debug(`getTokenInfo: region="${ct()}" apiHost="${t}" cdnApiHost="${r}"`);let n=new hk.WebflowClient({accessToken:e,environment:{base:`${t}/v2`,dataApi:`${t}/v2`,contentDeliveryApi:`${r}/v2`}});try{return await n.token.authorizedBy()}catch(o){return u.debug(`getTokenInfo failed: ${o}`),null}}var hk,yk=x(()=>{"use strict";hk=require("webflow-api");ke();R();Dn()});var Y=x(()=>{"use strict";nk();Nf();gk();gc();gc();Of();yk();jf()});function l0(e,t){if(e.includes("..")||dr.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let r=dr.resolve(t,e),n=dr.resolve(t);if(!r.startsWith(n+dr.sep)&&r!==n)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function Uc(e,t,r){let n=dr.join(process.cwd(),t);r&&(0,Rn.existsSync)(n)&&await(0,Bc.rm)(n,{recursive:!0,force:!0}),(0,Rn.existsSync)(n)||await(0,Bc.mkdir)(n);for(let o of e){l0(o.path,n);let i=c0(n,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));u0(n,s)}(0,Rn.writeFileSync)(i,o.content,{flag:"w+"})}}function c0(e,t){return dr.join(e,...t.split("/"))}function u0(e,t){let r=t.split("/"),n=e;for(let o of r)n=dr.join(n,o),(0,Rn.existsSync)(n)||(0,Rn.mkdirSync)(n)}var Rn,Bc,dr,om=x(()=>{"use strict";Rn=require("fs"),Bc=require("fs/promises"),dr=w(require("path"))});function Hc(e){for(let t of e??[]){let r=u[t.status]??u.info,n=m0[t.status]??xe;r(`
33
+ ${n} ${t.content}`)}}var m0,am=x(()=>{"use strict";R();j();m0={info:xe,warn:X,success:$}});function cm(e){let{manifestPath:t}=oe();return(0,hD.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var hD,yD=x(()=>{"use strict";hD=require("fs");Qs()});function Vc(e,t,r){try{let n=um(r),o=dm(Object.values(e)),i=t?.force;return o&&n&&!i}catch{return!1}}var wD,bD,um,dm,Gc=x(()=>{"use strict";wD=require("path"),bD=require("fs-extra");um=e=>{try{return(0,bD.existsSync)((0,wD.join)(e,"tsconfig.json"))}catch{return!1}},dm=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function g0(e){let{export:t,...r}=e;return t?r["devlink-export"]!=null?(cm(r),r):(u.warn(`${X} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),r["devlink-export"]={...t},cm(r),r):r}function ED(e,t){try{new RegExp(e)}catch{throw new d(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function SD(e){e=g0(e);let t=e["devlink-export"]||{},r=!1,n=t.rootDir;n||(V()?n=kD:(r=!0,n=await Ge({message:"Enter the root directory for exported components:",default:kD,validate:p=>!p||p.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(w0()?o=!0:V()?o=!1:(r=!0,o=await $e({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(V()?i=DD:(r=!0,i=await $e({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:DD}))),t.components&&ED(t.components,"components"),t.componentGroups&&ED(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(V()?(s=Kc,a=Jc):(r=!0,await $e({message:"Do you want to export all components?",default:!0})?(s=Kc,a=Jc):(s=await Ge({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:Kc,validate:f=>{try{return new RegExp(f),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Ge({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:Jc,validate:f=>{try{return new RegExp(f),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||Kc,a=a||Jc;let l=t.relativeHrefRoot;l===void 0&&(l=h0);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)&&y0(c),{config:c,wasPrompted:r}}function y0(e){Se({"devlink-export":{...e}}),u.info(`${$} Devlink Export configuration updated in webflow.json`)}function w0(){try{let e=process.cwd();if(um(e))return!0;let t=["src","app","pages","components"];for(let r of t){let n=vD.join(e,r);if(zc.existsSync(n)&&dm(zc.readdirSync(n)))return!0}}catch{}return!1}var zc,vD,kD,Kc,Jc,DD,h0,xD=x(()=>{"use strict";zc=w(require("fs")),vD=w(require("path"));Oe();we();R();j();C();rf();yD();Gc();kD="./webflow",Kc=".*",Jc=".*",DD=!0,h0="/"});function mo(e){let t=e;for(let r=0;r<8&&t instanceof Error;r+=1){if(t.code===fm)return!0;t=t.cause}return!1}async function _D(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 Fa(r||`Request failed (HTTP ${e.status}).`,{code:n})}async function mm(e,t,r,n){let o=await b0(r,n,t,e);if(!o.files||!Array.isArray(o.files))throw new d("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function b0(e,t,r,n){let{taskId:o,polling:i}=await k0(e,t,r,n);return D0(e,t,r,o,i)}async function k0(e,t,r,n){let o=await(0,pm.default)(`${O()}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",[FD]:t},body:JSON.stringify(n),timeout:6e4});return o.ok||await _D(o),await o.json()}async function D0(e,t,r,n,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,p=i;do{let f=await(0,pm.default)(`${O()}/v2/devlink/${e}/export/${n}`,{headers:{Authorization:`Bearer ${r}`,[FD]:t},timeout:6e4});f.ok||await _D(f);let m=await f.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new Fa("The export task failed. Please try again or report a bug.");await(0,CD.setTimeout)(p),p=Math.min(p*a,s)}while(Date.now()<c);throw new Fa(`Export task timed out after ${l}ms. Please try again.`)}var pm,CD,FD,fm,Fa,gm=x(()=>{"use strict";pm=w(require("node-fetch")),CD=require("timers/promises");R();ke();C();FD="X-WF-Sync-Id",fm="devlink_export_not_entitled",Fa=class extends Error{code;constructor(t,r){super(t),this.code=r?.code}}});var AD,RD=x(()=>{"use strict";Oe();R();AD=async(e,t)=>{if(!t)return;await $e({message:`Ready to export components to ${e.rootDir}?`,default:!0})||(u.info("Export cancelled."),process.exit(0))}});function ID(e,t,r){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:r||`${t}s`;return`${e} ${i}`}var TD=x(()=>{"use strict"});async function qc(e){let t=Date.now(),r;try{let{manifest:n}=oe(),{siteId:o,accessToken:i}=await Je(n,e),s=(0,PD.randomUUID)();Vb(s);let{config:a,wasPrompted:l}=await SD(n);u.info(`${$} Export configuration loaded!`),await AD(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:p,messages:f,metadata:m}=await mm(a,i,o,s),g=m.exportCoverage==="full";await Uc(p,a.rootDir,g),r.succeed(`${ID(m.componentCount,"component")} exported to ${a.rootDir}`),Hc(f);let h=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:h,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let f=p instanceof Error?p.message:String(p);throw e?.silentNotEntitled&&mo(p)?r.stop():r.fail(`Components export failed: ${f}`),await c.sendError(p instanceof Error?p:new Error(String(p)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),p}}catch(n){if(!(e?.silentNotEntitled&&mo(n))){let i="Export failed: "+(n instanceof Error?n.message:n);r?r.fail(i):u.error(i,{prefix:`
34
+ `+D})}throw new d(n,{skipLogging:!0})}}var PD,$D=x(()=>{"use strict";PD=require("crypto");xD();gm();RD();Z();Y();Pe();TD();R();C();om();j();am()});var OD={};hp(OD,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>fm,exportComponents:()=>qc,isDevlinkNotEntitledError:()=>mo});var Yc=x(()=>{"use strict";$D();gm()});var fe,qm,H,Rr,ja=x(()=>{"use strict";(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})(fe||(fe={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(qm||(qm={}));H=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rr=e=>{switch(typeof e){case"undefined":return H.undefined;case"string":return H.string;case"number":return Number.isNaN(e)?H.nan:H.number;case"boolean":return H.boolean;case"function":return H.function;case"bigint":return H.bigint;case"symbol":return H.symbol;case"object":return Array.isArray(e)?H.array:e===null?H.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?H.promise:typeof Map<"u"&&e instanceof Map?H.map:typeof Set<"u"&&e instanceof Set?H.set:typeof Date<"u"&&e instanceof Date?H.date:H.object;default:return H.unknown}}});var I,CT,kt,ku=x(()=>{"use strict";ja();I=fe.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"]),CT=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),kt=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,fe.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()}};kt.create=e=>new kt(e)});var FT,rn,Ym=x(()=>{"use strict";ku();ja();FT=(e,t)=>{let r;switch(e.code){case I.invalid_type:e.received===H.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,fe.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:r=`Unrecognized key(s) in object: ${fe.joinValues(e.keys,", ")}`;break;case I.invalid_union:r="Invalid input";break;case I.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${fe.joinValues(e.options)}`;break;case I.invalid_enum_value:r=`Invalid enum value. Expected ${fe.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:r="Invalid function arguments";break;case I.invalid_return_type:r="Invalid function return type";break;case I.invalid_date:r="Invalid date";break;case I.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}"`:fe.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case I.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 I.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 I.custom:r="Invalid input";break;case I.invalid_intersection_types:r="Intersection results could not be merged";break;case I.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:r="Number must be finite";break;default:r=t.defaultError,fe.assertNever(e)}return{message:r}},rn=FT});function _T(e){pv=e}function Vi(){return pv}var pv,Du=x(()=>{"use strict";Ym();pv=rn});function M(e,t){let r=Vi(),n=Ma({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===rn?void 0:rn].filter(o=>!!o)});e.common.issues.push(n)}var Ma,AT,nt,ee,wo,pt,Eu,vu,Nn,Gi,Xm=x(()=>{"use strict";Du();Ym();Ma=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}},AT=[];nt=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 ee;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 ee;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}}},ee=Object.freeze({status:"aborted"}),wo=e=>({status:"dirty",value:e}),pt=e=>({status:"valid",value:e}),Eu=e=>e.status==="aborted",vu=e=>e.status==="dirty",Nn=e=>e.status==="valid",Gi=e=>typeof Promise<"u"&&e instanceof Promise});var fv=x(()=>{"use strict"});var J,mv=x(()=>{"use strict";(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(J||(J={}))});function ae(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}}function wv(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 KT(e){return new RegExp(`^${wv(e)}$`)}function bv(e){let t=`${yv}T${wv(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 JT(e,t){return!!((t==="v4"||!t)&&MT.test(e)||(t==="v6"||!t)&&UT.test(e))}function zT(e,t){if(!OT.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 qT(e,t){return!!((t==="v4"||!t)&&BT.test(e)||(t==="v6"||!t)&&WT.test(e))}function YT(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}function Ki(e){if(e instanceof Dt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Yt.create(Ki(n))}return new Dt({...e._def,shape:()=>t})}else return e instanceof sn?new sn({...e._def,type:Ki(e.element)}):e instanceof Yt?Yt.create(Ki(e.unwrap())):e instanceof Tr?Tr.create(Ki(e.unwrap())):e instanceof Ir?Ir.create(e.items.map(t=>Ki(t))):e}function Qm(e,t){let r=Rr(e),n=Rr(t);if(e===t)return{valid:!0,data:e};if(r===H.object&&n===H.object){let o=fe.objectKeys(t),i=fe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=Qm(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===H.array&&n===H.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=Qm(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return r===H.date&&n===H.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function kv(e,t){return new Ao({values:e,typeName:ne.ZodEnum,...ae(t)})}function hv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Dv(e,t={},r){return e?Mn.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=hv(t,n),l=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=hv(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Mn.create()}var Xt,gv,le,RT,IT,TT,PT,$T,OT,LT,NT,jT,Zm,MT,BT,UT,WT,HT,VT,yv,GT,jn,bo,ko,Do,Eo,Ji,vo,So,Mn,on,pr,zi,sn,Dt,xo,nn,Su,Co,Ir,xu,qi,Yi,Cu,Fo,_o,Ao,Ro,Bn,Zt,Yt,Tr,Io,To,Xi,XT,Ba,Ua,Po,ZT,ne,QT,Ev,vv,eP,tP,Sv,rP,nP,oP,iP,sP,aP,lP,cP,uP,dP,pP,fP,mP,gP,hP,yP,wP,bP,kP,DP,EP,vP,SP,xP,CP,FP,_P,AP,RP,IP,TP,PP,$P,OP,xv=x(()=>{"use strict";ku();Du();mv();Xm();ja();Xt=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}},gv=(e,t)=>{if(Nn(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 kt(e.common.issues);return this._error=r,this._error}}};le=class{get description(){return this._def.description}_getType(t){return Rr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Rr(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:Rr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Gi(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:Rr(t)},o=this._parseSync({data:t,path:n.path,parent:n});return gv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rr(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Nn(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=>Nn(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:Rr(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Gi(o)?o:Promise.resolve(o));return gv(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:I.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 Zt({schema:this,typeName:ne.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 Yt.create(this,this._def)}nullable(){return Tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return Bn.create(this,this._def)}or(t){return xo.create([this,t],this._def)}and(t){return Co.create(this,t,this._def)}transform(t){return new Zt({...ae(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Io({...ae(this._def),innerType:this,defaultValue:r,typeName:ne.ZodDefault})}brand(){return new Ba({typeName:ne.ZodBranded,type:this,...ae(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new To({...ae(this._def),innerType:this,catchValue:r,typeName:ne.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ua.create(this,t)}readonly(){return Po.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},RT=/^c[^\s-]{8,}$/i,IT=/^[0-9a-z]+$/,TT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,PT=/^[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,$T=/^[a-z0-9_-]{21}$/i,OT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,LT=/^[-+]?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)?)??$/,NT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",MT=/^(?:(?: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])$/,BT=/^(?:(?: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])$/,UT=/^(([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]))$/,WT=/^(([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])$/,HT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,VT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yv="((\\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])))",GT=new RegExp(`^${yv}$`);jn=class e extends le{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==H.string){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.string,received:i.parsedType}),ee}let n=new nt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.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),M(o,{code:I.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?M(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&M(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")NT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"email",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Zm||(Zm=new RegExp(jT,"u")),Zm.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"emoji",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")PT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"uuid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")$T.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"nanoid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")RT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cuid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")IT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cuid2",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")TT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"ulid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),M(o,{validation:"url",code:I.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),M(o,{validation:"regex",code:I.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),M(o,{code:I.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),M(o,{code:I.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?bv(i).test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?GT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?KT(i).test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?LT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"duration",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?JT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"ip",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?zT(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"jwt",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?qT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cidr",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?HT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"base64",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?VT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"base64url",code:I.invalid_string,message:i.message}),n.dirty()):fe.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:I.invalid_string,...J.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...J.errToObj(t)})}url(t){return this._addCheck({kind:"url",...J.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...J.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...J.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...J.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...J.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...J.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...J.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...J.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...J.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...J.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...J.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...J.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,...J.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,...J.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...J.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...J.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...J.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...J.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...J.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...J.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...J.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...J.errToObj(r)})}nonempty(t){return this.min(1,J.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}};jn.create=e=>new jn({checks:[],typeName:ne.ZodString,coerce:e?.coerce??!1,...ae(e)});bo=class e extends le{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)!==H.number){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.number,received:i.parsedType}),ee}let n,o=new nt;for(let i of this._def.checks)i.kind==="int"?fe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),M(n,{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)&&(n=this._getOrReturnCtx(t,n),M(n,{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)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?YT(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_finite,message:i.message}),o.dirty()):fe.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,J.toString(r))}gt(t,r){return this.setLimit("min",t,!1,J.toString(r))}lte(t,r){return this.setLimit("max",t,!0,J.toString(r))}lt(t,r){return this.setLimit("max",t,!1,J.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:J.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:J.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:J.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.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"&&fe.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)}};bo.create=e=>new bo({checks:[],typeName:ne.ZodNumber,coerce:e?.coerce||!1,...ae(e)});ko=class e extends le{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)!==H.bigint)return this._getInvalidInput(t);let n,o=new nt;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),M(n,{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)&&(n=this._getOrReturnCtx(t,n),M(n,{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)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):fe.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return M(r,{code:I.invalid_type,expected:H.bigint,received:r.parsedType}),ee}gte(t,r){return this.setLimit("min",t,!0,J.toString(r))}gt(t,r){return this.setLimit("min",t,!1,J.toString(r))}lte(t,r){return this.setLimit("max",t,!0,J.toString(r))}lt(t,r){return this.setLimit("max",t,!1,J.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:J.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:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:J.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}};ko.create=e=>new ko({checks:[],typeName:ne.ZodBigInt,coerce:e?.coerce??!1,...ae(e)});Do=class extends le{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==H.boolean){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.boolean,received:n.parsedType}),ee}return pt(t.data)}};Do.create=e=>new Do({typeName:ne.ZodBoolean,coerce:e?.coerce||!1,...ae(e)});Eo=class e extends le{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==H.date){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.date,received:i.parsedType}),ee}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_date}),ee}let n=new nt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.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),M(o,{code:I.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):fe.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:J.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:J.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}};Eo.create=e=>new Eo({checks:[],coerce:e?.coerce||!1,typeName:ne.ZodDate,...ae(e)});Ji=class extends le{_parse(t){if(this._getType(t)!==H.symbol){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.symbol,received:n.parsedType}),ee}return pt(t.data)}};Ji.create=e=>new Ji({typeName:ne.ZodSymbol,...ae(e)});vo=class extends le{_parse(t){if(this._getType(t)!==H.undefined){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.undefined,received:n.parsedType}),ee}return pt(t.data)}};vo.create=e=>new vo({typeName:ne.ZodUndefined,...ae(e)});So=class extends le{_parse(t){if(this._getType(t)!==H.null){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.null,received:n.parsedType}),ee}return pt(t.data)}};So.create=e=>new So({typeName:ne.ZodNull,...ae(e)});Mn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(t){return pt(t.data)}};Mn.create=e=>new Mn({typeName:ne.ZodAny,...ae(e)});on=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pt(t.data)}};on.create=e=>new on({typeName:ne.ZodUnknown,...ae(e)});pr=class extends le{_parse(t){let r=this._getOrReturnCtx(t);return M(r,{code:I.invalid_type,expected:H.never,received:r.parsedType}),ee}};pr.create=e=>new pr({typeName:ne.ZodNever,...ae(e)});zi=class extends le{_parse(t){if(this._getType(t)!==H.undefined){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.void,received:n.parsedType}),ee}return pt(t.data)}};zi.create=e=>new zi({typeName:ne.ZodVoid,...ae(e)});sn=class e extends le{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==H.array)return M(r,{code:I.invalid_type,expected:H.array,received:r.parsedType}),ee;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(M(r,{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}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(M(r,{code:I.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&&(M(r,{code:I.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 Xt(r,s,r.path,a)))).then(s=>nt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Xt(r,s,r.path,a)));return nt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:J.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:J.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:J.toString(r)}})}nonempty(t){return this.min(1,t)}};sn.create=(e,t)=>new sn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ae(t)});Dt=class e extends le{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=fe.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==H.object){let c=this._getOrReturnCtx(t);return M(c,{code:I.invalid_type,expected:H.object,received:c.parsedType}),ee}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof pr&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let p=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:p._parse(new Xt(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof pr){let c=this._def.unknownKeys;if(c==="passthrough")for(let p of a)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(c==="strict")a.length>0&&(M(o,{code:I.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 p of a){let f=o.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new Xt(o,f,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of l){let f=await p.key,m=await p.value;c.push({key:f,value:m,alwaysSet:p.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(n,c)):nt.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return J.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:J.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:ne.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 fe.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 fe.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ki(this)}partial(t){let r={};for(let n of fe.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 fe.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Yt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return kv(fe.objectKeys(this.shape))}};Dt.create=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strip",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});Dt.strictCreate=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strict",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});Dt.lazycreate=(e,t)=>new Dt({shape:e,unknownKeys:"strip",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});xo=class extends le{_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 kt(a.ctx.common.issues));return M(r,{code:I.invalid_union,unionErrors:s}),ee}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},p=l._parseSync({data:r.data,path:r.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,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 kt(l));return M(r,{code:I.invalid_union,unionErrors:a}),ee}}get options(){return this._def.options}};xo.create=(e,t)=>new xo({options:e,typeName:ne.ZodUnion,...ae(t)});nn=e=>e instanceof Fo?nn(e.schema):e instanceof Zt?nn(e.innerType()):e instanceof _o?[e.value]:e instanceof Ao?e.options:e instanceof Ro?fe.objectValues(e.enum):e instanceof Io?nn(e._def.innerType):e instanceof vo?[void 0]:e instanceof So?[null]:e instanceof Yt?[void 0,...nn(e.unwrap())]:e instanceof Tr?[null,...nn(e.unwrap())]:e instanceof Ba||e instanceof Po?nn(e.unwrap()):e instanceof To?nn(e._def.innerType):[],Su=class e extends le{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.object)return M(r,{code:I.invalid_type,expected:H.object,received:r.parsedType}),ee;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}):(M(r,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ee)}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=nn(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:ne.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ae(n)})}};Co=class extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(Eu(i)||Eu(s))return ee;let a=Qm(i.value,s.value);return a.valid?((vu(i)||vu(s))&&r.dirty(),{status:r.value,value:a.data}):(M(n,{code:I.invalid_intersection_types}),ee)};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}))}};Co.create=(e,t,r)=>new Co({left:e,right:t,typeName:ne.ZodIntersection,...ae(r)});Ir=class e extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.array)return M(n,{code:I.invalid_type,expected:H.array,received:n.parsedType}),ee;if(n.data.length<this._def.items.length)return M(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee;!this._def.rest&&n.data.length>this._def.items.length&&(M(n,{code:I.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 Xt(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>nt.mergeArray(r,s)):nt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ir.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ir({items:e,typeName:ne.ZodTuple,rest:null,...ae(t)})};xu=class e extends le{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!==H.object)return M(n,{code:I.invalid_type,expected:H.object,received:n.parsedType}),ee;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Xt(n,a,n.path,a)),value:s._parse(new Xt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?nt.mergeObjectAsync(r,o):nt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof le?new e({keyType:t,valueType:r,typeName:ne.ZodRecord,...ae(n)}):new e({keyType:jn.create(),valueType:t,typeName:ne.ZodRecord,...ae(r)})}},qi=class extends le{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!==H.map)return M(n,{code:I.invalid_type,expected:H.map,received:n.parsedType}),ee;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:o._parse(new Xt(n,a,n.path,[c,"key"])),value:i._parse(new Xt(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,p=await l.value;if(c.status==="aborted"||p.status==="aborted")return ee;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(c.value,p.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,p=l.value;if(c.status==="aborted"||p.status==="aborted")return ee;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(c.value,p.value)}return{status:r.value,value:a}}}};qi.create=(e,t,r)=>new qi({valueType:t,keyType:e,typeName:ne.ZodMap,...ae(r)});Yi=class e extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.set)return M(n,{code:I.invalid_type,expected:H.set,received:n.parsedType}),ee;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(M(n,{code:I.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&&(M(n,{code:I.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 p of l){if(p.status==="aborted")return ee;p.status==="dirty"&&r.dirty(),c.add(p.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>i._parse(new Xt(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:J.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:J.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Yi.create=(e,t)=>new Yi({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...ae(t)});Cu=class e extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.function)return M(r,{code:I.invalid_type,expected:H.function,received:r.parsedType}),ee;function n(a,l){return Ma({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),rn].filter(c=>!!c),issueData:{code:I.invalid_arguments,argumentsError:l}})}function o(a,l){return Ma({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),rn].filter(c=>!!c),issueData:{code:I.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Bn){let a=this;return pt(async function(...l){let c=new kt([]),p=await a._def.args.parseAsync(l,i).catch(g=>{throw c.addIssue(n(l,g)),c}),f=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(f,i).catch(g=>{throw c.addIssue(o(f,g)),c})})}else{let a=this;return pt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new kt([n(l,c.error)]);let p=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(p,i);if(!f.success)throw new kt([o(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ir.create(t).rest(on.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||Ir.create([]).rest(on.create()),returns:r||on.create(),typeName:ne.ZodFunction,...ae(n)})}},Fo=class extends le{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})}};Fo.create=(e,t)=>new Fo({getter:e,typeName:ne.ZodLazy,...ae(t)});_o=class extends le{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return M(r,{received:r.data,code:I.invalid_literal,expected:this._def.value}),ee}return{status:"valid",value:t.data}}get value(){return this._def.value}};_o.create=(e,t)=>new _o({value:e,typeName:ne.ZodLiteral,...ae(t)});Ao=class e extends le{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return M(r,{expected:fe.joinValues(n),received:r.parsedType,code:I.invalid_type}),ee}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 M(r,{received:r.data,code:I.invalid_enum_value,options:n}),ee}return pt(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})}};Ao.create=kv;Ro=class extends le{_parse(t){let r=fe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==H.string&&n.parsedType!==H.number){let o=fe.objectValues(r);return M(n,{expected:fe.joinValues(o),received:n.parsedType,code:I.invalid_type}),ee}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=fe.objectValues(r);return M(n,{received:n.data,code:I.invalid_enum_value,options:o}),ee}return pt(t.data)}get enum(){return this._def.values}};Ro.create=(e,t)=>new Ro({values:e,typeName:ne.ZodNativeEnum,...ae(t)});Bn=class extends le{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.promise&&r.common.async===!1)return M(r,{code:I.invalid_type,expected:H.promise,received:r.parsedType}),ee;let n=r.parsedType===H.promise?r.data:Promise.resolve(r.data);return pt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Bn.create=(e,t)=>new Bn({type:e,typeName:ne.ZodPromise,...ae(t)});Zt=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.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=>{M(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 ee;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?ee:l.status==="dirty"?wo(l.value):r.value==="dirty"?wo(l.value):l});{if(r.value==="aborted")return ee;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ee:a.status==="dirty"?wo(a.value):r.value==="dirty"?wo(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"?ee:(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"?ee:(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(!Nn(s))return ee;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=>Nn(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):ee);fe.assertNever(o)}};Zt.create=(e,t,r)=>new Zt({schema:e,typeName:ne.ZodEffects,effect:t,...ae(r)});Zt.createWithPreprocess=(e,t,r)=>new Zt({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...ae(r)});Yt=class extends le{_parse(t){return this._getType(t)===H.undefined?pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Yt.create=(e,t)=>new Yt({innerType:e,typeName:ne.ZodOptional,...ae(t)});Tr=class extends le{_parse(t){return this._getType(t)===H.null?pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tr.create=(e,t)=>new Tr({innerType:e,typeName:ne.ZodNullable,...ae(t)});Io=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Io.create=(e,t)=>new Io({innerType:e,typeName:ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ae(t)});To=class extends le{_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 Gi(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new kt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new kt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};To.create=(e,t)=>new To({innerType:e,typeName:ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ae(t)});Xi=class extends le{_parse(t){if(this._getType(t)!==H.nan){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.nan,received:n.parsedType}),ee}return{status:"valid",value:t.data}}};Xi.create=e=>new Xi({typeName:ne.ZodNaN,...ae(e)});XT=Symbol("zod_brand"),Ba=class extends le{_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}},Ua=class e extends le{_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"?ee:i.status==="dirty"?(r.dirty(),wo(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"?ee: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:ne.ZodPipeline})}},Po=class extends le{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Nn(o)&&(o.value=Object.freeze(o.value)),o);return Gi(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Po.create=(e,t)=>new Po({innerType:e,typeName:ne.ZodReadonly,...ae(t)});ZT={object:Dt.lazycreate};(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"})(ne||(ne={}));QT=(e,t={message:`Input not instance of ${e.name}`})=>Dv(r=>r instanceof e,t),Ev=jn.create,vv=bo.create,eP=Xi.create,tP=ko.create,Sv=Do.create,rP=Eo.create,nP=Ji.create,oP=vo.create,iP=So.create,sP=Mn.create,aP=on.create,lP=pr.create,cP=zi.create,uP=sn.create,dP=Dt.create,pP=Dt.strictCreate,fP=xo.create,mP=Su.create,gP=Co.create,hP=Ir.create,yP=xu.create,wP=qi.create,bP=Yi.create,kP=Cu.create,DP=Fo.create,EP=_o.create,vP=Ao.create,SP=Ro.create,xP=Bn.create,CP=Zt.create,FP=Yt.create,_P=Tr.create,AP=Zt.createWithPreprocess,RP=Ua.create,IP=()=>Ev().optional(),TP=()=>vv().optional(),PP=()=>Sv().optional(),$P={string:(e=>jn.create({...e,coerce:!0})),number:(e=>bo.create({...e,coerce:!0})),boolean:(e=>Do.create({...e,coerce:!0})),bigint:(e=>ko.create({...e,coerce:!0})),date:(e=>Eo.create({...e,coerce:!0}))},OP=ee});var B={};hp(B,{BRAND:()=>XT,DIRTY:()=>wo,EMPTY_PATH:()=>AT,INVALID:()=>ee,NEVER:()=>OP,OK:()=>pt,ParseStatus:()=>nt,Schema:()=>le,ZodAny:()=>Mn,ZodArray:()=>sn,ZodBigInt:()=>ko,ZodBoolean:()=>Do,ZodBranded:()=>Ba,ZodCatch:()=>To,ZodDate:()=>Eo,ZodDefault:()=>Io,ZodDiscriminatedUnion:()=>Su,ZodEffects:()=>Zt,ZodEnum:()=>Ao,ZodError:()=>kt,ZodFirstPartyTypeKind:()=>ne,ZodFunction:()=>Cu,ZodIntersection:()=>Co,ZodIssueCode:()=>I,ZodLazy:()=>Fo,ZodLiteral:()=>_o,ZodMap:()=>qi,ZodNaN:()=>Xi,ZodNativeEnum:()=>Ro,ZodNever:()=>pr,ZodNull:()=>So,ZodNullable:()=>Tr,ZodNumber:()=>bo,ZodObject:()=>Dt,ZodOptional:()=>Yt,ZodParsedType:()=>H,ZodPipeline:()=>Ua,ZodPromise:()=>Bn,ZodReadonly:()=>Po,ZodRecord:()=>xu,ZodSchema:()=>le,ZodSet:()=>Yi,ZodString:()=>jn,ZodSymbol:()=>Ji,ZodTransformer:()=>Zt,ZodTuple:()=>Ir,ZodType:()=>le,ZodUndefined:()=>vo,ZodUnion:()=>xo,ZodUnknown:()=>on,ZodVoid:()=>zi,addIssueToContext:()=>M,any:()=>sP,array:()=>uP,bigint:()=>tP,boolean:()=>Sv,coerce:()=>$P,custom:()=>Dv,date:()=>rP,datetimeRegex:()=>bv,defaultErrorMap:()=>rn,discriminatedUnion:()=>mP,effect:()=>CP,enum:()=>vP,function:()=>kP,getErrorMap:()=>Vi,getParsedType:()=>Rr,instanceof:()=>QT,intersection:()=>gP,isAborted:()=>Eu,isAsync:()=>Gi,isDirty:()=>vu,isValid:()=>Nn,late:()=>ZT,lazy:()=>DP,literal:()=>EP,makeIssue:()=>Ma,map:()=>wP,nan:()=>eP,nativeEnum:()=>SP,never:()=>lP,null:()=>iP,nullable:()=>_P,number:()=>vv,object:()=>dP,objectUtil:()=>qm,oboolean:()=>PP,onumber:()=>TP,optional:()=>FP,ostring:()=>IP,pipeline:()=>RP,preprocess:()=>AP,promise:()=>xP,quotelessJson:()=>CT,record:()=>yP,set:()=>bP,setErrorMap:()=>_T,strictObject:()=>pP,string:()=>Ev,symbol:()=>nP,transformer:()=>CP,tuple:()=>hP,undefined:()=>oP,union:()=>fP,unknown:()=>aP,util:()=>fe,void:()=>cP});var eg=x(()=>{"use strict";Du();Xm();fv();ja();xv();ku()});var Zi=x(()=>{"use strict";eg();eg()});function Fu(e,t=!1){let r=e.length,n=0,o="",i=0,s=16,a=0,l=0,c=0,p=0,f=0;function m(E,S){let L=0,U=0;for(;L<E||!S;){let N=e.charCodeAt(n);if(N>=48&&N<=57)U=U*16+N-48;else if(N>=65&&N<=70)U=U*16+N-65+10;else if(N>=97&&N<=102)U=U*16+N-97+10;else break;n++,L++}return L<E&&(U=-1),U}function g(E){n=E,o="",i=0,s=16,f=0}function h(){let E=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&Qi(e.charCodeAt(n)))for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;else return f=3,e.substring(E,n);let S=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&&Qi(e.charCodeAt(n))){for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;S=n}else f=3;return e.substring(E,S)}function y(){let E="",S=n;for(;;){if(n>=r){E+=e.substring(S,n),f=2;break}let L=e.charCodeAt(n);if(L===34){E+=e.substring(S,n),n++;break}if(L===92){if(E+=e.substring(S,n),n++,n>=r){f=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+=`
35
+ `;break;case 114:E+="\r";break;case 116:E+=" ";break;case 117:let N=m(4,!0);N>=0?E+=String.fromCharCode(N):f=4;break;default:f=5}S=n;continue}if(L>=0&&L<=31)if(Wa(L)){E+=e.substring(S,n),f=2;break}else f=6;n++}return E}function k(){if(o="",f=0,i=n,l=a,p=c,n>=r)return i=r,s=17;let E=e.charCodeAt(n);if(tg(E)){do n++,o+=String.fromCharCode(E),E=e.charCodeAt(n);while(tg(E));return s=15}if(Wa(E))return n++,o+=String.fromCharCode(E),E===13&&e.charCodeAt(n)===10&&(n++,o+=`
36
+ `),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=y(),s=10;case 47:let S=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!Wa(e.charCodeAt(n));)n++;return o=e.substring(S,n),s=12}if(e.charCodeAt(n+1)===42){n+=2;let L=r-1,U=!1;for(;n<L;){let N=e.charCodeAt(n);if(N===42&&e.charCodeAt(n+1)===47){n+=2,U=!0;break}n++,Wa(N)&&(N===13&&e.charCodeAt(n)===10&&n++,a++,c=n)}return U||(n++,f=1),o=e.substring(S,n),s=13}return o+=String.fromCharCode(E),n++,s=16;case 45:if(o+=String.fromCharCode(E),n++,n===r||!Qi(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+=h(),s=11;default:for(;n<r&&v(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 v(E){if(tg(E)||Wa(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 F(){let E;do E=k();while(E>=12&&E<=15);return E}return{setPosition:g,getPosition:()=>n,scan:t?F:k,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>n-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-p,getTokenError:()=>f}}function tg(e){return e===32||e===9}function Wa(e){return e===10||e===13}function Qi(e){return e>=48&&e<=57}var Cv,_u=x(()=>{"use strict";(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"})(Cv||(Cv={}))});var NP,es,jP,Fv=x(()=>{"use strict";NP=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),es=200,jP={" ":{"\n":new Array(es).fill(0).map((e,t)=>`
37
+ `+" ".repeat(t)),"\r":new Array(es).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(es).fill(0).map((e,t)=>`\r
38
+ `+" ".repeat(t))}," ":{"\n":new Array(es).fill(0).map((e,t)=>`
39
+ `+" ".repeat(t)),"\r":new Array(es).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(es).fill(0).map((e,t)=>`\r
40
+ `+" ".repeat(t))}}});var rg=x(()=>{"use strict";_u();Fv()});function _v(e,t=[],r=Au.DEFAULT){let n=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):n!==null&&(o[n]=l)}return Av(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,p)=>{t.push({error:l,offset:c,length:p})}},r),o[0]}function Av(e,t,r=Au.DEFAULT){let n=Fu(e,!1),o=[],i=0;function s(W){return W?()=>i===0&&W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(W){return W?he=>i===0&&W(he,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(W){return W?he=>i===0&&W(he,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}function c(W){return W?()=>{i>0?i++:W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function p(W){return W?()=>{i>0&&i--,i===0&&W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let f=c(t.onObjectBegin),m=l(t.onObjectProperty),g=p(t.onObjectEnd),h=c(t.onArrayBegin),y=p(t.onArrayEnd),k=l(t.onLiteralValue),v=a(t.onSeparator),F=s(t.onComment),E=a(t.onError),S=r&&r.disallowComments,L=r&&r.allowTrailingComma;function U(){for(;;){let W=n.scan();switch(n.getTokenError()){case 4:N(14);break;case 5:N(15);break;case 3:N(13);break;case 1:S||N(11);break;case 2:N(12);break;case 6:N(16);break}switch(W){case 12:case 13:S?N(10):F();break;case 16:N(1);break;case 15:case 14:break;default:return W}}}function N(W,he=[],Vr=[]){if(E(W),he.length+Vr.length>0){let Gr=n.getToken();for(;Gr!==17;){if(he.indexOf(Gr)!==-1){U();break}else if(Vr.indexOf(Gr)!==-1)break;Gr=U()}}}function te(W){let he=n.getTokenValue();return W?k(he):(m(he),o.push(he)),U(),!0}function G(){switch(n.getToken()){case 11:let W=n.getTokenValue(),he=Number(W);isNaN(he)&&(N(2),he=0),k(he);break;case 7:k(null);break;case 8:k(!0);break;case 9:k(!1);break;default:return!1}return U(),!0}function ce(){return n.getToken()!==10?(N(3,[],[2,5]),!1):(te(!1),n.getToken()===6?(v(":"),U(),q()||N(4,[],[2,5])):N(5,[],[2,5]),o.pop(),!0)}function Be(){f(),U();let W=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(W||N(4,[],[]),v(","),U(),n.getToken()===2&&L)break}else W&&N(6,[],[]);ce()||N(4,[],[2,5]),W=!0}return g(),n.getToken()!==2?N(7,[2],[]):U(),!0}function A(){h(),U();let W=!0,he=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(he||N(4,[],[]),v(","),U(),n.getToken()===4&&L)break}else he&&N(6,[],[]);W?(o.push(0),W=!1):o[o.length-1]++,q()||N(4,[],[4,5]),he=!0}return y(),W||o.pop(),n.getToken()!==4?N(8,[4],[]):U(),!0}function q(){switch(n.getToken()){case 3:return A();case 1:return Be();case 10:return te(!0);default:return G()}}return U(),n.getToken()===17?r.allowEmptyContent?!0:(N(4,[],[]),!1):q()?(n.getToken()!==17&&N(9,[],[]),!0):(N(4,[],[]),!1)}var Au,ng=x(()=>{"use strict";_u();(function(e){e.DEFAULT={allowTrailingComma:!1}})(Au||(Au={}))});var Rv=x(()=>{"use strict";rg();ng()});var Iv,Tv,$o,Pv,Ru=x(()=>{"use strict";rg();Rv();_u();ng();(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"})(Iv||(Iv={}));(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"})(Tv||(Tv={}));$o=_v;(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"})(Pv||(Pv={}))});var ts,Ae,Oo,an,Tt=x(()=>{"use strict";ts=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+=`
41
+
42
+ How to fix: ${this.remediation}`),this.documentationUrl&&(t+=`
43
+
44
+ Documentation: ${this.documentationUrl}`),t}},Ae=class extends ts{constructor(t,r){super(t,r),this.name="FrameworkValidationError"}},Oo=class extends ts{configFile;constructor(t,r){super(t,r),this.name="FrameworkConfigError",this.configFile=r?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
45
+
46
+ Config file: ${this.configFile}`),t}},an=class extends ts{constructor(t,r){super(t,r),this.name="FrameworkDetectionError"}}});var $v,ft,ln=x(()=>{"use strict";$v=w(require("semver")),ft=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 $v.default.coerce(r)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}}});function GP(){return process.version.slice(1)}function KP(e){let t=Lo.coerce(e);return t?t.major:null}function JP(e,t){let r=Lo.coerce(e),n=Lo.coerce(t);return!r||!n?!1:Lo.gte(r,n)}function Un(e,t,r){let n=GP(),o=t.minimum;if(JP(n,o))e.debug(`Node.js version ${n} meets requirement ${o}`);else{let i=KP(o),s=`${r} requires Node.js ${o} or higher. Current version: ${n}`;if(t.severity==="error")throw new Ae(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
47
+
48
+ nvm install ${i}
49
+ nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var Lo,Ov=x(()=>{"use strict";Lo=w(require("semver"));Tt()});function Ha(e){let t=Lv.default.join(e,"package.json");if(!Iu.statSync(t,{throwIfNoEntry:!1}))return;let r=Iu.readFileSync(t).toString("utf8"),n;try{n=JSON.parse(r)}catch(o){throw new Ae("package.json was not valid JSON",{cause:o})}try{return Nv.parse(n)}catch(o){throw new Ae("package.json schema validation failed",{cause:o})}}var Iu,Lv,Nv,ig=x(()=>{"use strict";Iu=w(require("fs")),Lv=w(require("path"));Zi();Tt();Nv=B.object({name:B.string().optional(),version:B.string().optional(),dependencies:B.record(B.string()).optional(),devDependencies:B.record(B.string()).optional()})});function rs(e,t,r="webflow.json"){let n=jv.default.join(t,r);if(!Tu.statSync(n,{throwIfNoEntry:!1}))return r.endsWith(".json")?rs(e,t,r+"c"):void 0;let o=Tu.readFileSync(n).toString("utf8"),i;try{i=$o(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${n} ${JSON.stringify(o)}: ${s}`);return}try{let s=Pu.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 Tu,jv,Pu,sg=x(()=>{"use strict";Tu=w(require("fs")),jv=w(require("path"));Zi();Ru();Pu=B.object({cloud:B.object({contract_version:B.string().optional(),framework:B.string().optional(),framework_version:B.string().optional(),entrypoint_path:B.string().optional(),deployment_type:B.enum(["spa","ssg","ssr","ssr-spa-combo","static"]).optional(),skip_no_bundle:B.boolean().optional(),assets_path_prefix:B.string().optional(),assets_source_skip_mount_path:B.boolean().optional()}).passthrough().optional()}).passthrough()});function ag(e,t,r,n,o){if(!r||n!=="astro"&&n!=="nextjs")return t;let i=Mv.join(e,t);if(!ns.existsSync(i)||!ns.statSync(i).isDirectory())return t;let a=ns.readdirSync(i,{withFileTypes:!0}).find(l=>!(!l.isDirectory()||o&&l.name===o||n==="astro"&&(l.name==="_routes.json"||l.name==="_worker.js")));return a?`${t}/${a.name}`:t}var ns,Mv,Bv=x(()=>{"use strict";ns=w(require("fs")),Mv=w(require("path"))});async function Ze(e){let{log:t,cwd:r,args:n}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...Wv,...n];t.debug(`npm ${i.join(" ")} (in ${r})`),(0,Uv.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:r,env:o,stdio:"inherit"})}var Uv,Wv,Hv=x(()=>{"use strict";Uv=require("child_process"),Wv=["--no-update-notifier","--no-progress","--no-audit","--no-fund"]});function fr(e){if(!e)return null;let t=Vv.coerce(e);return t?t.major:null}function Wn(e,t,r,n){let o=n?.exclude?Array.isArray(n.exclude)?n.exclude:[n.exclude]:[],i=Pr.basename(t);if(o.some(c=>i===c))return e.trace(`Skipping excluded: ${t}`),0;if(n?.excludeFn?.(i))return e.trace(`Skipping excluded (predicate): ${t}`),0;let s=n?.followSymlinks!==!1,a=s?Le.statSync(t,{throwIfNoEntry:!1}):Le.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} -> ${r}`);let c=Le.readdirSync(t),p=0;for(let f of c)p+=Wn(e,Pr.join(t,f),Pr.join(r,f),n);return p}let l=Pr.dirname(r);return Le.existsSync(l)||Le.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${r}`),Le.copyFileSync(t,r),1}function Et(e){return Le.existsSync(e)}function wt(...e){for(let t of e)if(Le.existsSync(t))return t;return e[0]??""}async function $r(e,t,r,n){if(!Le.existsSync(t))throw new Oo(`Template not found: ${t}`,{configFile:t});let o=Le.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=Pr.dirname(r);Le.existsSync(a)||Le.mkdirSync(a,{recursive:!0}),Le.writeFileSync(r,s)}function Or(e,t,r,n){for(let o of n){let i=Pr.join(t,`${r}.${o}`);if(Le.existsSync(i)){let s=Pr.join(t,`clouduser.${r}.${o}`);return e.info(`Renaming user config: ${r}.${o} -> clouduser.${r}.${o}`),Le.renameSync(i,s),s}}return null}var Vv,Le,Pr,Lr=x(()=>{"use strict";Vv=w(require("semver")),Le=w(require("fs")),Pr=w(require("path"));Tt();Ov();ig();sg();Bv();Hv()});var vt,Va,lg,Gv,No,Kv=x(()=>{"use strict";vt=w(require("path")),Va=w(require("fs"));ln();Tt();Lr();lg=wt(vt.join(__dirname,"templates","astro","v5"),vt.join(__dirname,"templates","v5")),Gv=wt(vt.join(__dirname,"templates","astro"),vt.join(__dirname,"templates")),No=class extends ft{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=fr(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&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("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 Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=fr(o);if(i!==null&&i>=6)throw new Ae(`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 Ze({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 Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:vt.join(lg,"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(lg,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,vt.join(Gv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(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"),Va.writeFileSync(vt.join(r,"clouduser.astro.config.mjs"),`export default {};
50
+ `));let i=vt.join(Gv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Va.copyFileSync(i,vt.join(r,"astro.config.webflow.ts")));let s=vt.join(lg,"astro.config.mjs.template"),a=vt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Va.copyFileSync(l.templatePath,vt.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"}}}});async function $u(e){let{log:t,cwd:r,adapterName:n,installVersion:o,fixedFloor:i,declaredVersion:s}=e;if(!s){t.warn(`Installing ${n}@${o} (required for Cloudflare deployment)...`),await Ze({log:t,cwd:r,args:["install","--save",`${n}@${o}`]});return}let a=Ga.coerce(s);if(!a||!Ga.lt(a,i))return;let l=Ga.coerce(i)?.major;a.major===l?(t.warn(`Detected ${n}@${s}, which has a known base-path bug (withastro/astro#16276) that breaks static assets on mounted apps. Upgrading to ${o}.`),await Ze({log:t,cwd:r,args:["install","--save",`${n}@${o}`]})):t.warn(`${n}@${s} predates the base-path fix in ${i} and upgrading crosses a major version. Please upgrade to ${n}@${o} manually to avoid broken asset serving on mounted apps.`)}var Ga,cg=x(()=>{"use strict";Ga=w(require("semver"));Lr()});var St,Ka,ug,Jv,jo,zv=x(()=>{"use strict";St=w(require("path")),Ka=w(require("fs"));ln();Tt();Lr();cg();ug=wt(St.join(__dirname,"templates","astro","v6"),St.join(__dirname,"templates","v6")),Jv=wt(St.join(__dirname,"templates","astro"),St.join(__dirname,"templates")),jo=class extends ft{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=fr(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&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("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 Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=fr(o);if(i!==null&&i<6)throw new Ae(`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 Ae(`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.3.1",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(await $u({log:t,cwd:r,adapterName:n.name,installVersion:n.version,fixedFloor:"13.3.1",declaredVersion:this.getDependencyVersion(n.name)}),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await Ze({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 Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:St.join(ug,"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(ug,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,St.join(Jv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(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"),Ka.writeFileSync(St.join(r,"clouduser.astro.config.mjs"),`export default {};
51
+ `));let i=St.join(Jv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Ka.copyFileSync(i,St.join(r,"astro.config.webflow.ts")));let s=St.join(ug,"astro.config.mjs.template"),a=St.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ka.copyFileSync(l.templatePath,St.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 xt,Ja,dg,qv,os,Yv=x(()=>{"use strict";xt=w(require("path")),Ja=w(require("fs"));ln();Tt();Lr();cg();dg=wt(xt.join(__dirname,"templates","astro","v7"),xt.join(__dirname,"templates","v7")),qv=wt(xt.join(__dirname,"templates","astro"),xt.join(__dirname,"templates")),os=class extends ft{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=fr(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&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("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 Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=fr(o);if(i!==null&&i<7)throw new Ae(`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.7",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(await $u({log:t,cwd:r,adapterName:n.name,installVersion:n.version,fixedFloor:"14.0.0",declaredVersion:this.getDependencyVersion(n.name)}),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await Ze({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 Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:xt.join(dg,"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 xt.join(dg,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,xt.join(qv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(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"),Ja.writeFileSync(xt.join(r,"clouduser.astro.config.mjs"),`export default {};
52
+ `));let i=xt.join(qv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Ja.copyFileSync(i,xt.join(r,"astro.config.webflow.ts")));let s=xt.join(dg,"astro.config.mjs.template"),a=xt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ja.copyFileSync(l.templatePath,xt.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 Ou=x(()=>{"use strict";Kv();zv();Yv()});var He,Qt,is,ss,Lu=x(()=>{"use strict";He=w(require("path")),Qt=w(require("fs"));ln();Tt();Lr();is=wt(He.join(__dirname,"templates","nextjs"),He.join(__dirname,"templates")),ss=class extends ft{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 Ae("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 Ze({log:t,cwd:r,args:["install","--save",n.name]}))}getWebflowLoader(){return{templatePath:He.join(is,"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 He.join(is,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,He.join(is,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(Qt.existsSync(He.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..."),!Qt.existsSync(t))throw new Oo(`open-next.config.ts template not found at ${t}. This is a Webflow Cloud build system error.`,{configFile:t});let i=He.join(n,"open-next.config.ts");Qt.copyFileSync(t,i),r.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=Or(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"),Qt.writeFileSync(He.join(r,"clouduser.next.config.ts"),`export default {};
53
+ `)):He.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${He.basename(o)}`),Qt.writeFileSync(He.join(r,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
54
+ declare const config: UserNextConfig;
55
+ export default config;
56
+ `));let i=He.join(is,"next.config.webflow.ts");Et(i)&&(t.info("Copying next.config.webflow.ts..."),Qt.copyFileSync(i,He.join(r,"next.config.webflow.ts")));let s=He.join(is,"next.config.ts.template"),a=He.join(r,"next.config.ts");t.info("Generating next.config.ts from template..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Qt.copyFileSync(l.templatePath,He.join(r,l.destinationName)));let c=He.join(is,"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 Qt.statSync(He.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}}});var Pt,er,Nu,as,ju=x(()=>{"use strict";Pt=w(require("path")),er=w(require("fs"));Ru();ln();Tt();Lr();Nu=wt(Pt.join(__dirname,"templates","vite"),Pt.join(__dirname,"templates")),as=class extends ft{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 Ae("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=fr(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await Ze({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 Ze({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 Ze({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 Pt.join(Nu,"wrangler.json")}getAdditionalConfigFiles(){return[Pt.join(Nu,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:r}=this.ctx;for(let n of["wrangler.json","wrangler.jsonc"]){let o=Pt.join(r,n);if(er.existsSync(o)){try{let i=er.readFileSync(o,"utf8"),s=$o(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=Pt.join(r,"src","worker.ts");if(er.existsSync(n)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),er.mkdirSync(Pt.join(r,"src"),{recursive:!0}),er.writeFileSync(n,`/// <reference types="@cloudflare/workers-types" />
57
+
58
+ interface Env {
59
+ ASSETS: Fetcher;
60
+ }
61
+
62
+ export default {
63
+ async fetch(request: Request, env: Env): Promise<Response> {
64
+ return env.ASSETS.fetch(request);
65
+ },
66
+ } satisfies ExportedHandler<Env>;
67
+ `)}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=this.hasCustomWorkerEntry();Or(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"),er.writeFileSync(Pt.join(r,"clouduser.vite.config.ts"),`export default {};
68
+ `));let s=Pt.join(Nu,"vite.config.webflow.ts");Et(s)&&(t.info("Copying vite.config.webflow.ts..."),er.copyFileSync(s,Pt.join(r,"vite.config.webflow.ts")));let a=Pt.join(Nu,"vite.config.ts.template"),l=Pt.join(r,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await $r(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}}}});function qP(e,t){if(!t.includes("*"))return e===t;let r=t.split("*").map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${r}$`).test(e)}function Ya(e){return e===".well-known"?!1:e.startsWith(".")||qa.includes(e)?!0:pg.some(t=>qP(e,t))}function Xa(e){let t=[],r=(n,o)=>{let i;try{i=Xv.readdirSync(n,{withFileTypes:!0})}catch{return}for(let s of i){let a=o?`${o}/${s.name}`:s.name;if(s.isSymbolicLink())continue;if(s.isDirectory()){Ya(s.name)||r(za.join(n,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||ZP.has(s.name))&&t.push(a)}};return r(e,""),t}var Xv,za,zP,qa,pg,YP,XP,ZP,mr,Mu=x(()=>{"use strict";Xv=w(require("fs")),za=w(require("path"));ln();Lr();zP=wt(za.join(__dirname,"templates","static"),za.join(__dirname,"templates")),qa=["_headers","_redirects"],pg=["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"];YP=["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"],XP=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],ZP=new Set([...YP,...XP]);mr=class extends ft{static frameworkName="static";get info(){return{name:"static",version:"n/a",displayName:"Static (HTML/CSS/JS)"}}static detect(t,r){return r?.cloud?.framework==="static"?{detected:!0,reason:"Specified as static in webflow.json"}:{detected:!1}}async validate(){let t=Xa(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 za.join(zP,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}}});var Zv=x(()=>{"use strict"});function Bu(e,t){for(let r of tS){let n=r.detect(e,t);if(n.detected)return{Builder:r,result:n}}return null}function fg(e,t){let r=Bu(e.packageJson,t);if(!r)throw new an("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${Za.join(", ")})`});return e.log.info(`Detected framework: ${r.result.reason}`),new r.Builder(e)}function rS(e){let{hasPackageJson:t,specifiedFramework:r,hasRootIndexHtmlFile:n,hasRuntimeIndicators:o}=e;if(r==="static")return!0;let i=r!=null&&r!=="static";return!t&&!i&&n&&!o}function Qa(e,t,r){let n=r?.cloud?.framework,i=Qv.lstatSync(eS.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Xa(e),a=rS({hasPackageJson:t!=null,specifiedFramework:n,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&n==null)throw new an(`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}}var Qv,eS,tS,Za,mg=x(()=>{"use strict";Qv=w(require("fs")),eS=w(require("path"));Tt();Ou();Lu();ju();Mu();Ou();Lu();ju();Mu();ln();Zv();Tt();tS=[os,jo,No,ss,as,mr],Za=["astro","nextjs","vite","static"]});var nS=x(()=>{"use strict";mg();ln();Ou();Lu();ju();Mu();Tt()});function Uu(e,t,r,n){let o=oS.join(t,"webflow.json"),i={cloud:{}};if(ls.existsSync(o))try{let a=ls.readFileSync(o,"utf8"),l=JSON.parse(a),c=Pu.safeParse(l);if(c.success)i=c.data;else{let p=c.error.issues.map(f=>`${f.path.join(".")}: ${f.message}`).join(", ");e.warn(`webflow.json has schema issues (will be corrected): ${p}`),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,a.deploymentType!=="static"&&(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,iS.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${r}`),ls.writeFileSync(o,JSON.stringify(i,null,2))}function sS(e,t){let r=rs(e,t);if(r?.cloud?.framework)return r.cloud.framework;let n=Ha(t),{isStatic:o}=Qa(t,n,r);if(o)return e.info("Detected static app (no framework, no build)"),Uu(e,t,mr.frameworkName),mr.frameworkName;if(!n)throw new an("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=Bu(n,r);if(!i)throw new an("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}`),Uu(e,t,s),s}var ls,oS,iS,aS=x(()=>{"use strict";ls=w(require("fs")),oS=w(require("path")),iS=require("@webflow/cosmic-deploy-contract");mg();Tt();ig();sg();Lr();nS();Lr()});var el=x(()=>{"use strict";aS()});function cS(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
69
+ `)}function uS(e,t="wrangler.json"){let r=gr.join(e,t);if(!mt.existsSync(r)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),uS(e,t+"c");u.warn(`/${t} not found`);return}let n=mt.readFileSync(r,"utf8");u.info(`reading /${t}...`);let o;try{o=$o(n)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=lS.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
70
+ ${cS(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function dS(e,t){let r=null,n=null,o=gr.join(t,"wrangler.json"),i=gr.join(t,"wrangler.jsonc");mt.existsSync(o)?(r=o,n=".json"):mt.existsSync(i)&&(r=i,n=".jsonc"),r&&n&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${n}...`),mt.copyFileSync(r,gr.join(t,`clouduser.wrangler${n}`)));let s=r?uS(t,gr.basename(r)):null,a=e.getWranglerTemplatePath(),l=gr.join(t,"wrangler.json");if(!mt.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`),mt.copyFileSync(a,l),!s)return;let c=JSON.parse(mt.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`)),mt.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let p in s.d1_databases){let f=s.d1_databases[p];if(!f.migrations_dir){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir is not defined`);continue}let m=f.migrations_dir,g=gr.join(t,m);if(!mt.existsSync(g)){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let h=gr.join(t,"clouduser","migrations",m),y=Wn(u,g,h);y>0?u.info(`copied ${y} migrations to /clouduser/migrations/${m}`):u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) is empty`)}}function QP(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 pS(e){let t=null;for(let s of[".json",".jsonc"]){let a=gr.join(e,`clouduser.wrangler${s}`);if(mt.existsSync(a)){t=a;break}}if(!t)return;let r=mt.readFileSync(t,"utf8"),n;try{n=$o(r)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=lS.safeParse(n);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
71
+ ${cS(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)QP(s.bucket_name)}}var mt,gr,lS,fS=x(()=>{"use strict";mt=w(require("fs")),gr=w(require("path"));Zi();Ru();el();R();lS=B.object({name:B.string(),main:B.string().optional(),compatibility_date:B.string(),compatibility_flags:B.array(B.string()).optional(),placement:B.object({mode:B.string()}).passthrough().optional(),assets:B.object({directory:B.string(),binding:B.string().optional()}).passthrough().optional(),d1_databases:B.array(B.object({database_name:B.string(),database_id:B.string(),binding:B.string(),migrations_dir:B.string().optional()}).passthrough()).default([]),kv_namespaces:B.array(B.object({binding:B.string(),id:B.string()}).passthrough()).default([]),r2_buckets:B.array(B.object({binding:B.string(),bucket_name:B.string()}).passthrough()).default([])}).passthrough()});var cn,mS=x(()=>{"use strict";cn={LEGACY:"legacy",V2:"v2"}});function hS(e,t,r){if(!r)return t;let n=`${t}/${r}`,o=gS.join(e,n);return Wu.existsSync(o)&&Wu.statSync(o).isDirectory()?n:t}var Wu,gS,yS=x(()=>{"use strict";Wu=w(require("fs")),gS=w(require("path"))});var wS={};hp(wS,{detectBuilderV2:()=>e$});async function e$(e=process.cwd(),t,r,n){let o=(0,gt.loadPackageJson)(e),i=(0,gt.loadWebflowJson)(u,e),s={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:gg(r)}:{}},a={cwd:e,log:{debug:c=>u.debug(c),info:c=>u.info(c),warn:c=>u.warn(c),error:c=>u.error(c)},runCommand:gt.nodeCommandRunner,telemetry:gt.noopTelemetry,fs:gt.nodeFileSystem,packageJson:o??{},userEnv:s},{isStatic:l}=(0,gt.detectStaticApp)(e,o,i);if(l)return new gt.StaticBuilder(a);if(!o)throw new Error("No package.json file found");return(0,gt.detectAndCreateBuilder)(a,i)}var gt,bS=x(()=>{"use strict";gt=require("@webflow/app");R();hg()});function ES(e){let t=process.env.COSMIC_BUILD_ENGINE;return t===cn.V2||t===cn.LEGACY?t:e===cn.V2||e===cn.LEGACY?e:cn.LEGACY}function r$(e){return e===cn.V2?"@webflow/app@0.1.0-beta.6":cn.LEGACY}function un(e,t){let r=Math.min(Hu,process.stdout.columns??Hu),n=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,r-n.length));u.info(`
72
+ ${se(`${n}${o}`)}`)}function yg(e,t){let r=Math.min(Hu,process.stdout.columns??Hu),n=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,r-n.length));u.info(`
73
+ ${se(_t(`${n}${o}`))}`)}async function vS(e=process.cwd(),t,r,n,o){if(ES(o)===cn.V2){let{detectBuilderV2:p}=await Promise.resolve().then(()=>(bS(),wS));return p(e,t,r,n)}let i=Ha(e),s=rs(u,e),a={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:gg(r)}:{}},l={cwd:e,log:u,packageJson:i??{},userEnv:a},{isStatic:c}=Qa(e,i,s);if(c)return new mr(l);if(!i)throw new Error("No package.json file found");return fg(l,s)}async function SS(e,t={}){let r=t.projectPath||process.cwd(),n=Date.now(),o=pe.join(r,".tmp",`webflow-build-${n}`),i=t.outputDir||pe.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=wg(r),c=t.telemetry,p=e.getBuildCommand(),f=e.getOutputDeployMetadata(),m=f.deploymentType==="static",g=ES(t.serverBuildEngine);await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),ie.mkdirSync(o,{recursive:!0});try{u.info(`Build engine: ${se(r$(g))}`),un("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${f.deploymentType}`);let h=e.getNodeVersionRequirement();h&&Un(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),un("\u2699\uFE0F ","Configure wrangler"),await dS(e,r),u.info("Preparing framework configuration..."),await e.prepareConfig()),Uu(u,r,e.info.name,e),m||(un("\u{1F4E6}","Install dependencies"),await n$(r,e.info.name,t.telemetry),pS(r),un("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${p}...`),await o$(r,p,t.telemetry),await e.postBuild(),un("\u{1F9EA}","Wrangler dry-run"),await i$(r,i)),un("\u{1F4C1}","Copy assets"),await a$(r,i,e,s),un("\u{1F381}","Create tarball");let y=await l$(i),k=Date.now()-a;return u.info(`${$} Build completed in ${(k/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:k,framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),y}catch(h){let y=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:y,framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function wg(e){let t=pe.join(e,"wrangler.json");if(!ie.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let r=JSON.parse(ie.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 xS(e){try{let t=pe.dirname(e);t.includes(".tmp/webflow-build-")&&(un("\u{1F9F9}","Clean up build artifacts"),ie.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function CS(e,t){try{un("\u{1F9F9}","Revert framework configuration");let r=t.getUserConfigPatterns(),n=new Set;for(let s of r){let a=pe.extname(s).slice(1),l=pe.basename(s,`.${a}`);if(!n.has(l)){n.add(l);for(let c of["mjs","cjs","js","ts"]){let p=pe.join(e,`clouduser.${l}.${c}`),f=pe.join(e,`${l}.${c}`);if(ie.existsSync(p)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),ie.existsSync(f)&&ie.unlinkSync(f),ie.renameSync(p,f);break}}}}for(let s of[".jsonc",".json"]){let a=pe.join(e,`clouduser.wrangler${s}`);if(ie.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=pe.join(e,"wrangler.json");ie.existsSync(l)&&ie.unlinkSync(l);let c=pe.join(e,`wrangler${s}`);ie.renameSync(a,c);break}}let o=pe.join(e,"clouduser");ie.existsSync(o)&&(u.info("cleaning up clouduser directory..."),ie.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=pe.join(e,pe.basename(s));ie.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),ie.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=pe.join(e,i.destinationName);ie.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),ie.unlinkSync(s))}}catch(r){u.warn(`Warning: Failed to cleanup framework configuration: ${r}`)}}async function n$(e,t,r){let n=Date.now(),o=["--no-update-notifier","--no-progress"],i=pe.join(e,"package-lock.json");try{ie.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,tl.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,tl.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:ie.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:ie.existsSync(i)}),s}}function gg(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 o$(e,t,r){let n=Date.now();try{(0,tl.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 i$(e,t){ie.mkdirSync(t,{recursive:!0});let r=pe.join(e,"wrangler.json"),n=pe.join(e,"wrangler.jsonc");if(!ie.existsSync(r)&&!ie.existsSync(n))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,tl.execSync)(`npx wrangler@${t$} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function kS(e,t){let r=pe.join(e,"webflow.json");ie.existsSync(r)?(u.info("including webflow.json in output..."),ie.copyFileSync(r,pe.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function s$(e,t,r){let n=r.replace(/\/+$/,"").replace(/^\/+/,""),o=pe.join(t,"assets"),i=pe.join(o,n||"");ie.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${n}...`);for(let s of ie.readdirSync(e))Wn(u,pe.join(e,s),pe.join(i,s),{excludeFn:Ya,followSymlinks:!1});for(let s of qa){let a=pe.join(e,s);ie.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),ie.copyFileSync(a,pe.join(o,s)))}}async function a$(e,t,r,n){let o=r.getOutputDeployMetadata();if(o.deploymentType==="static"){s$(e,t,n),kS(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=n.replace(/\/+$/,"").replace(/^\/+/,"");a?i=hS(e,i,l):i=ag(e,i,l,r.info.name,s);let c=pe.join(t,"assets",l||"");ie.mkdirSync(c,{recursive:!0});let p=pe.join(e,i);if(ie.existsSync(p)&&ie.statSync(p).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),Wn(u,p,c,{exclude:s})):Wn(u,p,c)}catch(m){u.error(m,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");kS(e,t);let f=null;for(let m of[".json",".jsonc"]){let g=pe.join(e,`clouduser.wrangler${m}`);if(ie.existsSync(g)){f=g;break}}if(f){u.info("including user wrangler config in output..."),ie.copyFileSync(f,pe.join(t,"clouduser.wrangler.json"));let m=pe.join(e,"clouduser","migrations");if(ie.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let g=pe.join(t,"migrations");Wn(u,m,g)}}}async function l$(e){let t=`${e}.tar.gz`;try{return await DS.create({gzip:!0,file:t,cwd:pe.dirname(e)},[pe.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(r){throw new d(r,{prefix:"Failed to create tarball:"})}}var ie,pe,tl,DS,t$,Hu,hg=x(()=>{"use strict";ie=w(require("fs")),pe=w(require("path")),tl=require("child_process"),DS=w(require("tar"));fS();R();C();j();me();el();mS();yS();t$="4.82.1",Hu=60});var uw=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function aR(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 lR(e=process){if(e[uw])return;e[uw]=!0;let t=e.emit;e.emit=function(n,...o){return n==="warning"&&aR(o[0])?!1:t.call(this,n,...o)}}lR();var ZA=w(require("fs")),QA=require("commander");var qA=require("commander");me();R();var Kb=require("child_process"),Jb=require("fs"),Cf=w(require("semver"));R();var Ff="@webflow/webflow-cli",so="@webflow/data-types",dc="@webflow/react",AI=[Ff,so,dc],ao=class{getInstalledDependencies(){try{let t=(0,Kb.execSync)(`npm ls ${AI.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,Jb.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...r.dependencies,...r.devDependencies}}checkCLIAndDataTypes(t){let r=t[so];if(!r)return;let o=this.getRequiredDependencies(Ff)[so];if(!Cf.default.satisfies(r,o))throw new Error(`Version mismatch: ${Ff} requires ${so} v${o} but found v${r}`)}checkReactAndDataTypes(t){let r=t[so],n=t[dc];if(!(!r||!n)&&!Cf.default.eq(r,n))throw new Error(`Version mismatch: ${dc} and ${so} must be on the same version. Found ${dc}@${n} and ${so}@${r}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var tk=require("fs-extra");Oe();var rk=require("@dotenvx/dotenvx"),lo=w(require("semver"));R();var Zb=require("child_process"),Qb=require("util"),LI=(0,Qb.promisify)(Zb.exec);async function En(e,t){try{let{stdout:r,stderr:n}=await LI(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}}}we();var Rf=w(ac());j();me();(0,rk.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var ek={npm:{updateCommand:"npm install",update:async e=>await En(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await En(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await En(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await En(`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}},NI=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],pa=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(ek))if((0,tk.existsSync)(t.lockFile))return t;return ek.npm}async listOutdatedPackages(t="local",r=NI){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} ${rt} ${a})`,value:i})),o=await Cr({message:`New versions of the following ${Ne("@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(`${xe} New versions of the following ${Ne("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(P(` ${lc} ${s} (${a} ${rt} ${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(`
74
+ ${rt} To update, run:`),o.length>0&&u.info(z(` ${r} ${o.join(" ")}`)),i.length>0&&u.info(z(` ${r} ${n} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=lo.prerelease(Rf.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 En(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!n.trim()){r.succeed("Up to date");return}let i=n.trim(),s=Rf.default.version;if(!lo.valid(i)||!lo.valid(s)){r.succeed("Up to date");return}if(!lo.gt(i,s)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||V()){u.info(`${xe} A new version of @webflow/webflow-cli@${t} is available.`);let{code:f}=await En("npm ls @webflow/webflow-cli --json"),g=(f===0?"local":"global")==="global"?" --global":"";u.info(`${rt} To update, run: `+z(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`)+`
75
+ `);return}let{code:l}=await En("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await $e({message:`A new version of @webflow/webflow-cli@${t} is available.
76
+ Would you like to update it?`,default:!1})){r=u.spinner("Updating");let f=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${f} @webflow/webflow-cli@${t}`),r.succeed("Updated successfully")}catch{let g=c==="global"?` ${this.packageManager.globalFlag}`:"";r.fail("Update failed. Manually run: "+z(`${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||V()){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((m,g)=>(m[n[g].installationType==="global"?"global":"local"].push(g),m),{local:[],global:[]}),{update:c,globalFlag:p,updateCommand:f}=this.packageManager;try{a.length>0&&await c(`${a.map(m=>`${m}@latest`).join(" ")}`),l.length>0&&await c(`${p} ${l.map(m=>`${m}@latest`).join(" ")}`),r.succeed("Updated successfully")}catch{r.fail("Update failed. Manually run: "+z(`${f} ${s.map(g=>`${g}@latest`).join(" ")}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}};we();Dn();qr();Df();wf();Oe();Z();Y();we();Pe();R();C();j();me();Dn();var be=require("commander");C();R();function dt(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 Fe(e,t,r){let n=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(n);if(o.length===0)throw new d(`No valid fields specified. Available: ${r.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${r.join(", ")}`),o}me();R();var wk=(e,t)=>e+" ".repeat(Math.max(0,t-bt(e).length));function ze(e,t){let r=e.map((s,a)=>Math.max(bt(s).length,...t.map(l=>bt(String(l[a])).length))),n=r.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>wk(s,r[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>wk(String(a),r[l]+2)).join("")).join(`
77
+ `);return`${o}
78
+ ${n}
79
+ ${i}`}function Ai(e){return e?`
80
+
81
+ More: pass --cursor ${e}`:""}var bk=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],kk=["id","url","lastPublished","fullSiteCompiledAt"],Dk=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],hc="id,name,siteId,createdAt",Bf="id,name,description,siteId,appPath,createdAt",yc="id,url,lastPublished",wc="id,branch,deployUrl,latestDeploymentStatus,createdAt",GI=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function KI(e,t){return e==null||e===""?P("\u2014"):GI.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function ga(e,t,r){if(e.length===0)return P(r);let n=t.map(i=>se(i)),o=e.map(i=>t.map(s=>KI(i[s],s)));return ze(n,o)}var bc=dt(bk),Ek=dt(kk),vk=dt(Dk);function Fn(){return bk}function ha(){return kk}function ya(){return Dk}function kc(e,t=hc.split(",")){return ga(e,t,"No apps found.")}function Sk(e,t=yc.split(",")){return ga(e,t,"No domains found.")}function xk(e,t=wc.split(",")){return ga(e,t,"No environments found.")}function Ck(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 JI=["success","failed","canceled","unstaged"],Dc=5,Ec=600;function Fk(e){return JI.includes(e)}var _k=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],wa="id,status,sourceType,commitHash,buildStartedAt",vc=dt(_k);function _n(){return _k}function ba(e,t=wa.split(",")){return ga(e,t,"No deployments found.")}Dn();var Uf=()=>new be.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."),Wf=()=>new be.Option("--region <region>",`Webflow region to target: ${io.join(", ")}. US and EU are fully isolated stacks with separate accounts. Falls back to WEBFLOW_REGION, then webflow.json, then "us".`).choices(io),Ak=()=>new be.Option("--input","Force interactive mode, overriding the automatic no-input detection."),Hf=()=>new be.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),Vf=()=>new be.Option("--skip-update-check","Skip checking for @webflow packages updates"),Gf=()=>new be.Option("--verbose","Display more information for debugging purposes."),Xr=()=>new be.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),Rt=()=>new be.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Ri=e=>{if(e.trim()==="")throw new be.InvalidArgumentError("must be a non-empty value.");return e},Sc=(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.`,xc=e=>new be.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(Ri),re=()=>new be.Option("--json","Output as JSON"),ka=()=>new be.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),Da=()=>new be.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),Kf=()=>new be.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),_e=()=>new be.Option("--dry-run","Preview without executing"),Ii=()=>new be.Option("-y, --yes","Skip confirmation prompt"),Ti=()=>new be.Option("--order <dir>","Sort direction: asc or desc").default("asc"),Cc=()=>new be.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]),Ea=()=>new be.Option("-g, --global","Operate on the per-user (home directory) install"),va=()=>new be.Option("-p, --project","Operate on the current project's install"),We=e=>new be.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),Pi=e=>new be.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),Fc=()=>new be.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),_c=()=>new be.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),zI=100,Ac=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new be.InvalidArgumentError("must be a positive integer.");return t},Jf=()=>new be.Option("--limit <n>","Max log lines to return (default: 100)").default(zI).argParser(Ac),qI=20,Rk=()=>new be.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(qI).argParser(Ac),Ik=e=>{let t=Number(e);if(!Number.isInteger(t))throw new be.InvalidArgumentError("must be an integer number of seconds.");return t},Tk=()=>new be.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(Dc).argParser(Ik),Pk=()=>new be.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(Ec).argParser(Ik),Sa=e=>async(t,r)=>{let o={...r.parent?.opts()||{},...t};await e(o)};var Ok=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(V()){u.info(`${D} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:n}=oe();if(!r.force&&Ci()?.accessToken){let i=uo(n);u.info(`${$} Webflow credentials already exist (${ct().toUpperCase()}):`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
82
+ Use --force flag to reauthenticate anyway`);return}try{u.info(`${rt} Authenticating against the ${ct().toUpperCase()} region...`);let o=await T({force:!0});Yr({apiToken:o}),u.info(`
83
+ You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new d(o,{prefix:`${D} Authentication failed:`})}}),t.command("status").description("Show current authentication status").addOption(re()).action(async r=>{let n=ct(),o=Ci(),i=o?.accessToken?null:Vt(),s=o?.accessToken??i,a=!o?.accessToken&&!!i,l=a?process.env.WEBFLOW_API_TOKEN===i?"WEBFLOW_API_TOKEN":process.env.WEBFLOW_WORKSPACE_API_TOKEN===i?"WEBFLOW_WORKSPACE_API_TOKEN":"WEBFLOW_SITE_API_TOKEN":null;if(!s){r.json?u.info(JSON.stringify({loggedIn:!1,region:n},null,2)):u.info(`${D} Not logged in to the ${n.toUpperCase()} region. Run ${z("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let c=await Mf(s);if(!c){r.json?u.info(JSON.stringify({loggedIn:!1,region:n,error:"invalid_or_expired_token"},null,2)):u.info(`${D} Token is invalid or expired. Run ${z("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}if(r.json){u.info(JSON.stringify({loggedIn:!0,region:a?"unknown":n,user:{firstName:c.firstName,lastName:c.lastName,email:c.email},scopes:o?.scopes??[],...l?{tokenSource:l}:{}},null,2));return}u.info(`${$} Logged in as ${c.firstName} ${c.lastName} (${c.email})`),u.info(l?` Region: unknown (from ${l})`:` Region: ${n.toUpperCase()}`),o?.scopes?.length&&u.info(` Scopes: ${o.scopes.join(", ")}`),u.info(` Session: ${Sn()}`)}catch(c){throw new d(c,{prefix:`${D} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove the stored credentials").action(async()=>{let r=ma();if($f(),!r){u.info(`${$} No stored session to log out of.`);return}u.info(`${$} Logged out of the ${r.toUpperCase()} region.`),u.info(`${rt} Run ${z("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").option("--local","Write the preference to the current directory's webflow.json instead of the global config").action(async r=>{let n=kn.getInstance();if(r.status){let s=await n.getTelemetryStatus();u.info($k(s.enabled));return}if(r.enable){await n.setPreference(!0,{local:r.local}),u.info(zf(!0));return}if(r.disable){await n.setPreference(!1,{local:r.local}),u.info(zf(!1));return}let o=await n.getTelemetryStatus();if(u.info($k(o.enabled)),V()){u.info("\u{1F4A1} When --no-input mode is enabled please provide --enable or --disable option");return}let i=await je({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.setPreference(s,{local:r.local}),u.info(zf(s))}})},zf=e=>`${$} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,$k=e=>`${xe} Telemetry status: ${e?`enabled ${$}`:`disabled ${D}`}`;var tD=w(require("http")),rD=w(require("node-fetch")),nD=w(require("serve-handler")),oD=require("fs"),iD=w(require("path")),sD=require("commander");var Nk=w(require("archiver")),Yf=require("commander"),Tc=require("fs");var Lk=require("cosmiconfig"),qf=require("commander"),Rc=async(e,t)=>{let r=await YI(t),n=r.config.apiVersion;return n&&typeof n!="string"&&qf.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}}},YI=async e=>{let r=await(0,Lk.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return r||qf.program.error(`No ${e} file was found. Run this command within your extension folder.`),r};var jk=w(require("mime-types")),Ic=w(require("path")),XI=5*1024*1024,ZI=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"]),Mk=async(e,t,r)=>{let{config:n,filepath:o}=await Rc(e,t),i=Ic.join(o,".."),s=!0,a=!1,l=p=>{let f=p.name,m=jk.default.lookup(f);return f==="index.html"&&(a=!0),f&&f.endsWith(".DS_Store")||!m?!1:ZI.has(m)?p:(console.log(`Invalid file type: ${m} for file: ${f}`),s=!1,!1)},c=p=>{(0,Tc.unlink)(r,f=>{f&&console.error(`Failed to delete file: ${f}`),Yf.program.error(p)})};return console.log(`Packaging the contents of the ${n.publicDir} folder into ${r}...`),new Promise(p=>{let f=(0,Nk.default)("zip",{zlib:{level:9}}),m=(0,Tc.createWriteStream)(Ic.join(i,r));m.on("close",()=>{p(void 0)}),f.directory(Ic.join(i,n.publicDir),!1,l),f.file(o,{name:t}),f.pipe(m),f.finalize(),f.on("warning",g=>{console.log(g)}),f.on("error",g=>{Yf.program.error(g.message)}),f.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(!f.pointer()||f.pointer()===0){c("Bundling failed with no output");return}if(f.pointer()>=XI){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${f.pointer()} total bytes written`),console.log(`Done! ${r} is ready for you to upload to your Webflow app.`)})})};var xa=w(require("path")),Fr=w(require("fs/promises")),Oc=w(require("fs")),Uk=require("url"),wW=require("dotenv/config"),Wk=["js","cjs","json"],Qf=process.cwd(),Hk=".webflowrc",Qr=xa.extname(Oc.readdirSync(Qf).find(e=>e.includes(Hk))??"").replace(/\./g,""),Zr=xa.join(Qf,`${Hk}${Qr&&`.${Qr}`}`),Vk=Oc.existsSync(Zr),Xf=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${Wk.join(", ")}`)}},Pc=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${Qr}. The supported extensions are: ${Wk.join(", ")}`)}},$c=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)}},Zf=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 QI(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,Uk.pathToFileURL)(e).href:e)).default}function Bk(e,t){let r=t.filter(n=>!e[n]);if(r.length)throw new Zf(r.join(", "))}async function $i(e=[],t=!1){if(!Vk){if(t)return{};throw new $c(Zr)}if(!Qr)throw new Xf;switch(Qr){case"js":case"cjs":{await Fr.access(Zr);let r=await QI(Zr);return Bk(r,e),r}case"json":{let r=JSON.parse(await Fr.readFile(Zr,"utf8"));return Bk(r,e),r}default:throw new Pc}}function e0(e,t){if(Qr==="js"||Qr==="cjs"){let n=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(n)return n[1]}}function t0(e,t,r){let n=e0(t,r);if(n){let o=new RegExp(`${r}: ".*?",`,"g");return e.replace(o,`${r}: process.env.${n},`)}return e}async function r0(e){let t=["authToken","host","siteId"],r=await Fr.readFile(Zr,"utf-8");for(let n of t)e=t0(e,r,n);return e}async function n0(){try{let e=xa.join(Qf,"package.json");return await Fr.access(e),JSON.parse(await Fr.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function Gk(e){if(!Vk)throw new $c(Zr);let t=JSON.stringify(e,null,2);switch(Qr){case"js":case"cjs":{let r=await r0(t.replace(/"([^"]+)":/g,"$1:")),n=await n0()&&Qr==="js"?"export default ":"module.exports = ";return Fr.writeFile(Zr,n+r)}case"json":return Fr.writeFile(Zr,t);default:throw new Pc}}var An=w(require("fs")),Gt=w(require("path"));var Ca="webflow.json",Kk="index.html",Jk="bundle.zip",em="public",tm="extension-scaffolds",Lc="default";var zk="package.json",qk="wf-placeholder-name",rm=e=>JSON.stringify(e,null,2),Yk=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
40
84
  \u2502 `+e+` \u2502
41
- \u2570`+t+"\u256F"};var iD=async(e,t="./",n=uc,r)=>{let o=r[n];try{for(let i of o){let s=Ht.join(t,i),a=J0(s,n,e);if(i.includes(nD)||i.includes(ia))await K0(i,a,e);else{let l=await Dr.promises.readFile(i);await lD(a,l)}}}catch(i){console.error("Error writing file, ",i)}},sD=async()=>{let e={},t=Ht.resolve(__dirname),n=Ht.join(t,vf),r=await Dr.promises.readdir(n);for(let o of r){let i=Ht.join(n,o),s=await aD(i);e[o]=s}return e},aD=async e=>{let t=[];try{let n=await Dr.promises.readdir(e);for(let r of n){let o=Ht.join(e,r);if((await Dr.promises.stat(o)).isDirectory()){let s=await aD(o);t.push(...s)}else t.push(o)}}catch(n){console.error(`Error reading ${Ht}, `,n)}return t},lD=async(e,t)=>{try{await Dr.promises.mkdir(Ht.dirname(e),{recursive:!0}),await Dr.promises.writeFile(e,t)}catch(n){console.error("Error writing file ",n)}},K0=async(e,t,n)=>Dr.promises.readFile(e,"utf8").then(async r=>{let o=r.replace(rD,n);await lD(t,o)}),J0=(e,t,n)=>{let r=Ht.join(vf,t),o=e.indexOf(r);if(o!==-1){let i=e.substring(o+r.length+1);return Ht.join(n,i)}return""};var dc=async()=>await sD(),gD=async()=>{let e=await dc(),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"')},hD=async(e,t=uc)=>{let n=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let r=await dc();await iD(e,n,t,r),console.log(`Done! Check out ${n}/README.md for steps on how to develop your extension.`)},yD=()=>Jb(Ef,ia,tD),wD=async e=>{let{config:t,filepath:n}=await oc(Ef,ia),r=fD.join(n,"..",t.publicDir,eD),i=(await Di([],!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}`:"",p=await(await(0,uD.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),d=new cD.Server((h,g)=>{if(h.url==="/"){pD.promises.readFile(r,{encoding:"utf-8"}).catch(y=>{mD.program.error(y.message)}).then(y=>{let b=p.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(Sf(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),g.end(Sf(t));(0,dD.default)(h,g,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=z0(e);d.listen(m),console.log(oD(`Serving your extension at http://localhost:${m}`)+`
42
- `)},z0=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};Oe();C();var bD=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(gD),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 dc(),i=Object.keys(o),s=await Ke({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 Be({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:r||"default"});await hD(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(yD),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(wD)};var Rf=w(require("process"));A();De();Me();var kD=w(require("fs"));C();async function fc(e){let{authToken:t,siteId:n}=e||{},{path:r,isUserDefined:o}=Qr(),i=kD.existsSync(r),s=!1;try{let{manifest:a}=ee();s=!0,o&&u.info(`Using manifest file: ${r}`);try{let l=Hs(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.
85
+ \u2570`+t+"\u256F"};var Xk=async(e,t="./",r=Lc,n)=>{let o=n[r];try{for(let i of o){let s=Gt.join(t,i),a=s0(s,r,e);if(i.includes(zk)||i.includes(Ca))await i0(i,a,e);else{let l=await An.promises.readFile(i);await eD(a,l)}}}catch(i){console.error("Error writing file, ",i)}},Zk=async()=>{let e={},t=Gt.resolve(__dirname),r=Gt.join(t,tm),n=await An.promises.readdir(r);for(let o of n){let i=Gt.join(r,o),s=await Qk(i);e[o]=s}return e},Qk=async e=>{let t=[];try{let r=await An.promises.readdir(e);for(let n of r){let o=Gt.join(e,n);if((await An.promises.stat(o)).isDirectory()){let s=await Qk(o);t.push(...s)}else t.push(o)}}catch(r){console.error(`Error reading ${Gt}, `,r)}return t},eD=async(e,t)=>{try{await An.promises.mkdir(Gt.dirname(e),{recursive:!0}),await An.promises.writeFile(e,t)}catch(r){console.error("Error writing file ",r)}},i0=async(e,t,r)=>An.promises.readFile(e,"utf8").then(async n=>{let o=n.replace(qk,r);await eD(t,o)}),s0=(e,t,r)=>{let n=Gt.join(tm,t),o=e.indexOf(n);if(o!==-1){let i=e.substring(o+n.length+1);return Gt.join(r,i)}return""};var Nc=async()=>await Zk(),aD=async()=>{let e=await Nc(),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"')},lD=async(e,t=Lc)=>{let r=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let n=await Nc();await Xk(e,r,t,n),console.log(`Done! Check out ${r}/README.md for steps on how to develop your extension.`)},cD=()=>Mk(em,Ca,Jk),uD=async e=>{let{config:t,filepath:r}=await Rc(em,Ca),n=iD.join(r,"..",t.publicDir,Kk),i=(await $i([],!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}`:"",p=await(await(0,rD.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),f=new tD.Server((g,h)=>{if(g.url==="/"){oD.promises.readFile(n,{encoding:"utf-8"}).catch(y=>{sD.program.error(y.message)}).then(y=>{let k=p.replace("{{ui}}",y);return h.writeHead(200,{"Content-Length":Buffer.byteLength(k),"Content-Type":"text/html"}),h.end(k)});return}if(g.url==="/__webflow")return h.writeHead(200,{"Content-Length":Buffer.byteLength(rm(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),h.end(rm(t));(0,nD.default)(g,h,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=a0(e);f.listen(m),console.log(Yk(`Serving your extension at http://localhost:${m}`)+`
86
+ `)},a0=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};Oe();C();var dD=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(aD),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 Nc(),i=Object.keys(o),s=await Ge({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 d("When --no-input mode is enabled please provide the [projectName] argument.");let a=await je({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:n||"default"});await lD(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(cD),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(uD)};var lm=w(require("process"));R();ke();Pe();var fD=w(require("fs"));C();async function Mc(e){let{authToken:t,siteId:r}=e||{},{path:n,isUserDefined:o}=cr(),i=fD.existsSync(n),s=!1;try{let{manifest:a}=oe();s=!0,o&&u.info(`Using manifest file: ${n}`);try{let l=ea(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.
43
87
 
44
88
  To set up your credentials, run:
45
- webflow auth login`);return DD(l?.relativeHrefRoot),{...l,host:P(),authToken:t,siteId:n,cssModules:!!l?.cssModules,components:pc(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 Di(a);return DD(l?.relativeHrefRoot),{...l,host:l.host||P(),cssModules:!!l?.cssModules,components:pc(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:
89
+ webflow auth login`);return pD(l?.relativeHrefRoot),{...l,host:O(),authToken:t,siteId:r,cssModules:!!l?.cssModules,components:jc(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new d(l,{prefix:`Failed to read devlink config from manifest file: ${n}
90
+ `})}}catch(a){if(o||i||s){let l=o?`The manifest file specified via --manifest flag was not found or is invalid: ${n}
91
+ `:`Your manifest file exists but is invalid or missing required properties: ${n}
92
+ `;throw new d(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),r||a.push("siteId");let l=await $i(a);return pD(l?.relativeHrefRoot),{...l,host:l.host||O(),cssModules:!!l?.cssModules,components:jc(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
93
  - webflow.json with a "devlink" section, or
50
94
  - .webflowrc file
51
- in your project root.`),new f(a)}}function DD(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 pc(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}Cf();lt();C();var ki=class extends Error{};function Z0(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function Q0(e){switch(e.status){case 400:{let t=await e.text(),n=Z0(t);throw new ki(n||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new ki("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new ki("`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 ki(`Something went wrong (HTTP ${e.status}).`)}}async function eR(e){try{let{siteId:t,host:n,authToken:r,...o}=e,i=await G(`${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():Q0(i)}catch(t){throw new f(t,{skipLogging:!0})}}async function Ff(e){try{let t=await eR(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 gc(t.files,e.rootDir,n),{messages:t.messages}}catch(t){throw t instanceof f?t:new f(t,{skipLogging:!0})}}var so=w(require("process"));A();Me();lt();var _f=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;G(`${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:so.default.platform,node:so.default.version})})}async storeChoice(t){try{return xe({devlink:{allowTelemetry:t}})}catch{let r=await Di();await Qb({...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 hc(e){return async function(n){so.default.removeListener("uncaughtException",hc),so.default.removeListener("unhandledRejection",hc);let r=await fc(e);if(!r)return;await new _f(r,n).prompt()}}function ED(e){so.default.on("uncaughtException",hc(e)),so.default.on("unhandledRejection",hc(e))}X();A();q();Me();Af();async function vD(e,t){let n=Date.now(),{manifest:r}=ee(),{accessToken:o,siteId:i}=await ze(r,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:pc(e),overwriteModule:!1}:{overwriteModule:!0}};ED(s);let a=await fc(s);if(!a)return Rf.default.exit();let l;try{l=F.forDevlinkSync(a)}catch(p){u.debug(`Failed to initialize telemetry: ${p}`)}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:p}=await Ff(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),yc(p);let d=Date.now()-n;await l?.sendUsage("devlink_sync_success",{duration:d,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let d=p instanceof Error?p.message:String(p);c.fail(`Failed to export components: ${d}`);let m=Date.now()-n;throw await l?.sendError(p instanceof Error?p:new Error(String(p)),"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:Rf.default.argv.slice(2)}),p}}Sc();var Fr=require("commander");var co=require("path"),Ai=require("@webflow/data-types");De();var xc=require("fs"),jf=w(require("md5"));function aa(e,t){try{let n=(0,xc.statSync)(e),r=(0,xc.readFileSync)(e);return{value:r,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,jf.default)(r),size:n.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function la(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,jf.default)(o),size:r,...n}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var VD=w(require("node-fetch")),GD=w(require("form-data"));async function ca(e,t){let n={...t.fields,file:e.value},r=new GD.default;Object.entries(n).forEach(([i,s])=>{r.append(i,s)});let o=await(0,VD.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:r});cR(o)}function cR(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}`)}}A();Me();X();De();lt();pe();function uR({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 dR(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function pR(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 ${J("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 Er({endpoint:e,method:t="GET",body:n,options:r}){let{baseUrl:o,authToken:i}=uR(r),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await G(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:dR(n)});return await pR(a),a.json()}async function Mf({options:e}){return(await Er({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function Bf({name:e,description:t,slug:n,options:r}){return(await Er({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:n},options:r})).payload}async function Uf({resourceId:e,files:t,options:n}){return(await Er({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:n})).payload}async function Wf({resourceId:e,codeModule:t,components:n,options:r}){return(await Er({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:n},options:r})).payload}var xi=require("path"),Lk=w(require("webpack-merge")),lo=require("@webflow/data-types");De();A();var zD=require("memfs/lib/volume"),ua=require("@webflow/data-types");var xn="./tmp_entry",KD="components";function Cc(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 fR(e){let t=Cc(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function JD(e,t){let n=e.map(({name:l,path:c,isDefaultExport:p})=>p?`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}
95
+ in your project root.`),new d(a)}}function pD(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 jc(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}om();lt();C();var Oi=class extends Error{};function d0(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function p0(e){switch(e.status){case 400:{let t=await e.text(),r=d0(t);throw new Oi(r||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new Oi("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new Oi("`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 Oi(`Something went wrong (HTTP ${e.status}).`)}}async function f0(e){try{let{siteId:t,host:r,authToken:n,...o}=e,i=await K(`${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():p0(i)}catch(t){throw new d(t,{skipLogging:!0})}}async function im(e){try{let t=await f0(e);if(!t.files||!Array.isArray(t.files))throw new d("Invalid response format from V1 API: expected 'files' array");let r=t.metadata?.exportCoverage==="full";return await Uc(t.files,e.rootDir,r),{messages:t.messages}}catch(t){throw t instanceof d?t:new d(t,{skipLogging:!0})}}var fo=w(require("process"));R();Pe();lt();var sm=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;K(`${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:fo.default.platform,node:fo.default.version})})}async storeChoice(t){try{return Se({devlink:{allowTelemetry:t}})}catch{let n=await $i();await Gk({...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 Wc(e){return async function(r){fo.default.removeListener("uncaughtException",Wc),fo.default.removeListener("unhandledRejection",Wc);let n=await Mc(e);if(!n)return;await new sm(n,r).prompt()}}function mD(e){fo.default.on("uncaughtException",Wc(e)),fo.default.on("unhandledRejection",Wc(e))}Z();R();Y();Pe();am();async function gD(e,t){let r=Date.now(),{manifest:n}=oe(),{accessToken:o,siteId:i}=await Je(n,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:jc(e),overwriteModule:!1}:{overwriteModule:!0}};mD(s);let a=await Mc(s);if(!a)return lm.default.exit();let l;try{l=_.forDevlinkSync(a)}catch(p){u.debug(`Failed to initialize telemetry: ${p}`)}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:p}=await im(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),Hc(p);let f=Date.now()-r;await l?.sendUsage("devlink_sync_success",{duration:f,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let f=p instanceof Error?p.message:String(p);c.fail(`Failed to export components: ${f}`);let m=Date.now()-r;throw await l?.sendError(p instanceof Error?p:new Error(String(p)),"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:lm.default.argv.slice(2)}),p}}Yc();var $n=require("commander");var ho=require("path"),Hi=require("@webflow/data-types");ke();var Xc=require("fs"),hm=w(require("md5"));function _a(e,t){try{let r=(0,Xc.statSync)(e),n=(0,Xc.readFileSync)(e);return{value:n,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,hm.default)(n),size:r.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function Aa(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,hm.default)(o),size:n,...r}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var LD=w(require("node-fetch")),ND=w(require("form-data"));async function Ra(e,t){let r={...t.fields,file:e.value},n=new ND.default;Object.entries(r).forEach(([i,s])=>{n.append(i,s)});let o=await(0,LD.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:n});E0(o)}function E0(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}`)}}R();Pe();Z();ke();lt();me();function v0({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:`${O()}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${O()}/v2/workspaces`,authToken:e}}function S0(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function x0(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 ${z("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 In({endpoint:e,method:t="GET",body:r,options:n}){let{baseUrl:o,authToken:i}=v0(n),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await K(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:S0(r)});return await x0(a),a.json()}async function ym({options:e}){return(await In({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function wm({name:e,description:t,slug:r,options:n}){return(await In({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:r},options:n})).payload}async function bm({resourceId:e,files:t,options:r}){return(await In({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:r})).payload}async function km({resourceId:e,codeModule:t,components:r,options:n}){return(await In({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:r},options:n})).payload}var Mi=require("path"),_E=w(require("webpack-merge")),go=require("@webflow/data-types");ke();R();var BD=require("memfs/lib/volume"),Ia=require("@webflow/data-types");var _r="./tmp_entry",jD="components";function Zc(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 C0(e){let t=Zc(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function MD(e,t){let r=e.map(({name:l,path:c,isDefaultExport:p})=>p?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
96
+ `),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}
53
97
 
54
- export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function qD(e,t,n,r){let o={},i=`${xn}/Client.js`,s=`${xn}/Server.js`;o[i]=JD([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],ua.Environment.Client);let a={},l=p=>{let d=fR(p);return a[d]?(a[d]+=1,`${d}${a[d]}`):(a[d]=1,d)};o[s]=JD([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([p])=>n[p]?.ssr??!0).map(([p,d])=>{let m=l(p),h=d.startsWith(xn)?d.replace(`${xn}/`,"./"):d;return{name:m,path:h,exportKey:p,isDefaultExport:!0,type:"component"}})],ua.Environment.Server);let c={[ua.Environment.Client]:i,[ua.Environment.Server]:s};return{entryPointsVolume:zD.Volume.fromJSON(o,r),paths:c}}var Nk=require("memfs/lib/volume");var ek=w(require("archiver")),Ei=require("path");De();var da=require("@webflow/data-types");De();A();var vr=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var XD=2;function YD(e){let t={type:da.ModuleLoader.FEDERATION,version:XD,entry:Kp,renderer:zs,components:e};return{title:Js,content:JSON.stringify(t)}}function ZD(e){let t={type:da.ModuleLoader.SSR,version:XD,entry:gi,components:e};return{title:Js,content:JSON.stringify(t)}}function QD(e){let t=`/${da.Environment.Client}/${Kp}`;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===zs||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${vr(o)}${l}`)})),i},{})}}catch(n){u.error(n,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var Fc=require("@webflow/data-types"),mR=/\.css$/i;async function tk(e,t,n){let r=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${Fc.Environment.Server}/${qs}`,a=(0,ek.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",d=>(r=!0,i(d))),l.on("close",()=>{if(!r)try{let d={type:"asset",name:qs,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let h=(0,Ei.resolve)((0,Ei.join)(`/${Fc.Environment.Server}`,m.name));t.existsSync(h)&&t.rmSync(h)}),o([d])}catch(d){return i(d)}finally{r=!0}}),a.pipe(l);let{title:c,content:p}=ZD(n);a.append(p,{name:c}),e.forEach(d=>{if(!mR.test(d.name))try{let m=(0,Ei.resolve)((0,Ei.join)(`/${Fc.Environment.Server}`,d.name)),h=t.readFileSync(m,"utf8");a.append(h,{name:d.name})}catch(m){return r=!0,i(m)}}),await a.finalize()})}var nk=require("@webflow/data-types");async function rk(e,t,n){let{title:r,content:o}=YD(n);await t.promises.writeFile(`/${nk.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 Ak=require("@rspack/core"),Rk=w(require("fork-ts-checker-webpack-plugin")),Ik=require("ts-checker-rspack-plugin"),Tk=w(require("mini-css-extract-plugin")),Pk=require("@webflow/data-types");var ik=require("webpack"),Vf=w(require("mini-css-extract-plugin")),sk=w(require("tsconfig-paths-webpack-plugin")),ak=require("tsconfig-paths"),Gf=require("@webflow/data-types"),lk=require("path");De();var ok=w(require("postcss-selector-parser")),Hf=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,ok.default)(n=>{n.walkPseudos(r=>{r.value===":root"&&(r.value=":host")})}).processSync(t.selector)})}});Hf.postcss=!0;Hf.postcssPlugin="CSSinShadowDOM";var _c=Hf;function gR(e){let t=(0,ak.loadConfig)(e);return t.resultType==="success"?t.configFileAbsolutePath:void 0}function ck({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i,projectDir:s}){let a={mode:n,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Vf.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[_c]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Vf.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[(()=>{let l=gR(s);return l?new sk.default({context:s,configFile:l}):null})()].filter(Boolean)},performance:{hints:!1}};if(t===Gf.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,lk.join)(s,i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Gf.Environment.Server)return{...a,plugins:[...a.plugins||[],new ik.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:gi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var uk=require("@module-federation/enhanced"),Kf=require("@webflow/data-types");function dk({libraryName:e,env:t,exposes:n}){if(t===Kf.Environment.Client)return{plugins:[new uk.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Kf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function pk(){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 Ac(){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 Rc=require("@rspack/core"),fk=require("tsconfig-paths"),Jf=require("@webflow/data-types"),mk=require("path");De();function hR(e){let t=(0,fk.loadConfig)(e);if(t.resultType==="success")return t.configFileAbsolutePath}function gk({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i,projectDir:s}){let a={mode:n,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Rc.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:[_c]}}}],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 Rc.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let l=hR(s);return l?{tsConfig:{configFile:l}}:{}})(),performance:{hints:!1}};if(t===Jf.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,mk.join)(s,i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Jf.Environment.Server)return{...a,plugins:[...Array.isArray(a.plugins)?a.plugins:[],new Rc.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:gi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var hk=require("@module-federation/enhanced/rspack"),zf=require("@webflow/data-types");function yk({libraryName:e,env:t,exposes:n}){if(t===zf.Environment.Client)return{plugins:[new hk.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===zf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var wR=w(require("fs")),wk=require("unionfs"),bk=require("webpack");function yR(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function Ic(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:n=>e.toString(n),toJson:()=>({...t,assets:(t.assets??[]).map(yR)})}}async function Dk({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new wk.Union().use(wR));return new Promise((s,a)=>{let l=(0,bk.webpack)(e);l.inputFileSystem=i,n&&(l.outputFileSystem=n),r&&(l.outputPath=r),l.run((c,p)=>{l.close(d=>{c||d?a(c||d):p?p.hasErrors()||o&&p.hasWarnings()?a(new Error(p.toString("errors-warnings"))):s(Ic(p)):a(new Error("Webpack stats are undefined"))})})})}var bR=w(require("fs")),qf=w(require("webpack-merge")),kk=require("memfs"),Ek=require("unionfs"),vk=require("@rspack/core");async function Tc({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new Ek.Union().use(bR)),s=e;return t.length>0&&(s=(0,qf.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),n&&(s=(0,qf.default)(s,{output:{clean:!1,...r&&{path:r}}})),new Promise((a,l)=>{let c=(0,vk.rspack)(s);c.inputFileSystem=i,n&&(c.outputFileSystem=(0,kk.createFsFromVolume)(n)),r&&(c.outputPath=r),c.run((p,d)=>{c.close(m=>{p||m?l(p||m):d?d.hasErrors()||o&&d.hasWarnings()?l(new Error(d.toString("errors-warnings"))):a(Ic(d)):l(new Error("Rspack stats are undefined"))})})})}var xk=require("@module-federation/enhanced");var vi=w(require("webpack-merge"));A();function Sr(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function Sk(e,t){let n=Object.entries(e).filter(([r])=>!t.includes(r));return Object.fromEntries(n)}function DR(e,t){return e instanceof t||Sr(e)==="ModuleFederationPlugin"}function $c(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:n,getPluginOptions:r,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],p=kR(s),d=Array.isArray(l)?Pc(...l.map(p)):Pc(p(l));Object.keys(d).some(H=>c.includes(H))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let h={...Sk(d,[...c,"ModuleFederationPlugin","module","plugins"]),module:Sk(d.module??{},["rules"])},g=(0,vi.default)(a,h),y=d.plugins??[];o&&(y=y.filter(o));let b=a.plugins??[],_=(0,vi.mergeWithCustomize)({customizeArray:(0,vi.unique)("plugins",t,H=>Sr(H))})({plugins:y},{plugins:b}).plugins,v=d?.ModuleFederationPlugin?.shared,x=_?.map(H=>{if(DR(H,n)){let B=r(H);return new n({...B,...v?{shared:v}:{}})}return H});g.plugins=x;let O=d.module?.rules;if(O&&typeof O=="function"){let H=a.module?.rules??[];g.module={...g.module??{},rules:O(H)}}return g}}function Pc(...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=p=>{let d=c(p);return a(d)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function kR(e){return t=>typeof t=="function"?t(e):t}var ER=$c({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:xk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function Ck(e,t,n){return ER(e,t,n)}var Fk=require("@module-federation/enhanced/rspack");var vR=$c({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:Fk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Sr(e)!=="MiniCssExtractPlugin"});function _k(e,t,n){return vR(e,t,n)}var Xf={[Pk.Framework.React]:{generateWebpackBundlerConfig:pk,generateRspackBundlerConfig:Ac}},SR={webpack:{generateBaseConfig:ck,getFrameworkConfig:(e,t)=>Xf[e].generateWebpackBundlerConfig(t),generateFederationConfig:dk,mergeConfigs:(e,t,n)=>Ck(e,t,n),bundle:e=>Dk({...e,config:e.config}),typeCheckerPlugin:Rk.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Sr(t)==="MiniCssExtractPlugin"?new Tk.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:gk,getFrameworkConfig:(e,t)=>Xf[e].generateRspackBundlerConfig(t),generateFederationConfig:yk,mergeConfigs:(e,t,n)=>_k(e,t,n),bundle:e=>Tc({...e,config:e.config}),typeCheckerPlugin:Ik.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Sr(t)==="CssExtractRspackPlugin"?new Ak.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},Si=e=>SR[e],$k=e=>!!Xf[e];var Ok={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 Oc(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:n,paths:r}=qD(e.renderer,e.componentsFiles,e.componentsOptions,e.projectDir),o=Nk.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=Si(t),a=b=>{let S=xR({env:b,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:r,libraryName:e.libraryIdentifier,bundler:t,projectDir:e.projectDir}),_=s.mergeConfigs(b,S,i);return e?.debugBundler&&(u.info(`${t} config for env ${b}:`),u.dir(_)),_},l={sourceVolumes:[...e.sourceVolumes,n],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,p]=await Promise.all([s.bundle({...l,config:a(lo.Environment.Server),outputPath:`/${lo.Environment.Server}`}),s.bundle({...l,config:a(lo.Environment.Client),outputPath:`/${lo.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(Ok)}`),u.debug(`Client Bundler Stats: ${p.toString(Ok)}`));let d=QD(o);u.debug("Packaging server bundle...");let m=await tk(c.toJson().assets||[],o,d);u.debug("Packaging client bundle...");let h=await rk(p.toJson().assets||[],o,d),g=b=>S=>[S,b];return{outputFiles:[...m.map(g(lo.Environment.Server)),...h.map(g(lo.Environment.Client))],outputVolume:o}}function xR({env:e,mode:t="production",framework:n,publicPath:r,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack",projectDir:c}){if(!$k(n))throw new Error(`Unknown framework: ${n}`);let p=Object.entries({[zs]:i[e],...o}).reduce((y,[b,S])=>{let _=(0,xi.isAbsolute)(S)?S:(0,xi.join)(c,S);return{...y,[`./${b}`]:`./${(0,xi.relative)(c,_)}`}},{}),d=Si(l),m=d.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:r,outputPath:a,projectDir:c}),h=d.getFrameworkConfig(n,e),g=d.generateFederationConfig({exposes:p,env:e,libraryName:s});return(0,Lk.default)(m,h,g)}var Bk=w(require("path")),Zf=require("memfs/lib/volume"),Qf=w(require("webpack-merge")),Uk=w(require("webpack-node-externals")),Vt=require("@webflow/data-types");var CR=w(require("fs")),Ci=require("path"),Fi=require("webpack");function FR(e,t,n=CR){let r=(0,Ci.join)(t,"node_modules",e);for(;r!==(0,Ci.dirname)(r)&&r!=="node_modules";){let o=(0,Ci.join)(r,"package.json");if(n.existsSync(o))try{let{name:i,version:s}=JSON.parse(n.readFileSync(o,"utf8"));return`${i}@${s}`}catch{return null}r=(0,Ci.dirname)(r)}return null}var Lc=class{apply(t){let n=t.context;t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(r){r.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Fi.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let o=r.getAssets(),i={};Object.values(o).forEach(({name:s,source:a})=>{if(!s.endsWith(".map"))return;let[l,c,p]=s.split("."),d=i[l]?.sources??{},m=i[l]?.dependencies??new Set;JSON.parse(a.source().toString()).sources.forEach(g=>{if(g.startsWith("external")){let y=g.match(/^external \S+ "(.+)"$/)?.[1];if(!y)throw new Error(`Could not extract package name from ${g}`);let b=FR(y,n,r.inputFileSystem);if(!b)throw new Error(`Could not find package information for ${y}`);b&&m.add(b)}}),i[l]={sources:{...d,[`./${l}.${p}`]:c},dependencies:m},r.deleteAsset(s)}),Object.entries(i).forEach(([s,{sources:a,dependencies:l}])=>{r.emitAsset(`${s}.js.map`,new Fi.sources.RawSource(JSON.stringify({sources:a,dependencies:[...l]})))})}catch(o){r.errors.push(new Fi.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${o instanceof Error?o.stack:String(o)}`))}})})}};var jk=w(require("module")),Mk=require("jsdom"),Yf="__webflowCliImportModuleWindow__";function _R(e){let n=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),r=!!n,o=`module[${JSON.stringify(Yf)}]`,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(`
98
+ export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function UD(e,t,r,n){let o={},i=`${_r}/Client.js`,s=`${_r}/Server.js`;o[i]=MD([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],Ia.Environment.Client);let a={},l=p=>{let f=C0(p);return a[f]?(a[f]+=1,`${f}${a[f]}`):(a[f]=1,f)};o[s]=MD([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([p])=>r[p]?.ssr??!0).map(([p,f])=>{let m=l(p),g=f.startsWith(_r)?f.replace(`${_r}/`,"./"):f;return{name:m,path:g,exportKey:p,isDefaultExport:!0,type:"component"}})],Ia.Environment.Server);let c={[Ia.Environment.Client]:i,[Ia.Environment.Server]:s};return{entryPointsVolume:BD.Volume.fromJSON(o,n),paths:c}}var AE=require("memfs/lib/volume");var KD=w(require("archiver")),Li=require("path");ke();var Ta=require("@webflow/data-types");ke();R();var Tn=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var WD=2;function HD(e){let t={type:Ta.ModuleLoader.FEDERATION,version:WD,entry:yf,renderer:aa,components:e};return{title:sa,content:JSON.stringify(t)}}function VD(e){let t={type:Ta.ModuleLoader.SSR,version:WD,entry:Ei,components:e};return{title:sa,content:JSON.stringify(t)}}function GD(e){let t=`/${Ta.Environment.Client}/${yf}`;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===aa||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${Tn(o)}${l}`)})),i},{})}}catch(r){u.error(r,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var Qc=require("@webflow/data-types"),F0=/\.css$/i;async function JD(e,t,r){let n=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${Qc.Environment.Server}/${la}`,a=(0,KD.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",f=>(n=!0,i(f))),l.on("close",()=>{if(!n)try{let f={type:"asset",name:la,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let g=(0,Li.resolve)((0,Li.join)(`/${Qc.Environment.Server}`,m.name));t.existsSync(g)&&t.rmSync(g)}),o([f])}catch(f){return i(f)}finally{n=!0}}),a.pipe(l);let{title:c,content:p}=VD(r);a.append(p,{name:c}),e.forEach(f=>{if(!F0.test(f.name))try{let m=(0,Li.resolve)((0,Li.join)(`/${Qc.Environment.Server}`,f.name)),g=t.readFileSync(m,"utf8");a.append(g,{name:f.name})}catch(m){return n=!0,i(m)}}),await a.finalize()})}var zD=require("@webflow/data-types");async function qD(e,t,r){let{title:n,content:o}=HD(r);await t.promises.writeFile(`/${zD.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 DE=require("@rspack/core"),EE=w(require("fork-ts-checker-webpack-plugin")),vE=require("ts-checker-rspack-plugin"),SE=w(require("mini-css-extract-plugin")),xE=require("@webflow/data-types");var XD=require("webpack"),Em=w(require("mini-css-extract-plugin")),ZD=w(require("tsconfig-paths-webpack-plugin")),QD=require("tsconfig-paths"),vm=require("@webflow/data-types"),eE=require("path");ke();var YD=w(require("postcss-selector-parser")),Dm=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,YD.default)(r=>{r.walkPseudos(n=>{n.value===":root"&&(n.value=":host")})}).processSync(t.selector)})}});Dm.postcss=!0;Dm.postcssPlugin="CSSinShadowDOM";var eu=Dm;function _0(e){let t=(0,QD.loadConfig)(e);return t.resultType==="success"?t.configFileAbsolutePath:void 0}function tE({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i,projectDir:s}){let a={mode:r,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Em.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[eu]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Em.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[(()=>{let l=_0(s);return l?new ZD.default({context:s,configFile:l}):null})()].filter(Boolean)},performance:{hints:!1}};if(t===vm.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,eE.join)(s,i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===vm.Environment.Server)return{...a,plugins:[...a.plugins||[],new XD.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Ei,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var rE=require("@module-federation/enhanced"),Sm=require("@webflow/data-types");function nE({libraryName:e,env:t,exposes:r}){if(t===Sm.Environment.Client)return{plugins:[new rE.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Sm.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function oE(){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 tu(){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 ru=require("@rspack/core"),iE=require("tsconfig-paths"),xm=require("@webflow/data-types"),sE=require("path");ke();function A0(e){let t=(0,iE.loadConfig)(e);if(t.resultType==="success")return t.configFileAbsolutePath}function aE({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i,projectDir:s}){let a={mode:r,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:ru.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:[eu]}}}],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 ru.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let l=A0(s);return l?{tsConfig:{configFile:l}}:{}})(),performance:{hints:!1}};if(t===xm.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,sE.join)(s,i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===xm.Environment.Server)return{...a,plugins:[...Array.isArray(a.plugins)?a.plugins:[],new ru.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Ei,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var lE=require("@module-federation/enhanced/rspack"),Cm=require("@webflow/data-types");function cE({libraryName:e,env:t,exposes:r}){if(t===Cm.Environment.Client)return{plugins:[new lE.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Cm.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var I0=w(require("fs")),uE=require("unionfs"),dE=require("webpack");function R0(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function nu(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:r=>e.toString(r),toJson:()=>({...t,assets:(t.assets??[]).map(R0)})}}async function pE({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new uE.Union().use(I0));return new Promise((s,a)=>{let l=(0,dE.webpack)(e);l.inputFileSystem=i,r&&(l.outputFileSystem=r),n&&(l.outputPath=n),l.run((c,p)=>{l.close(f=>{c||f?a(c||f):p?p.hasErrors()||o&&p.hasWarnings()?a(new Error(p.toString("errors-warnings"))):s(nu(p)):a(new Error("Webpack stats are undefined"))})})})}var T0=w(require("fs")),Fm=w(require("webpack-merge")),fE=require("memfs"),mE=require("unionfs"),gE=require("@rspack/core");async function ou({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new mE.Union().use(T0)),s=e;return t.length>0&&(s=(0,Fm.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),r&&(s=(0,Fm.default)(s,{output:{clean:!1,...n&&{path:n}}})),new Promise((a,l)=>{let c=(0,gE.rspack)(s);c.inputFileSystem=i,r&&(c.outputFileSystem=(0,fE.createFsFromVolume)(r)),n&&(c.outputPath=n),c.run((p,f)=>{c.close(m=>{p||m?l(p||m):f?f.hasErrors()||o&&f.hasWarnings()?l(new Error(f.toString("errors-warnings"))):a(nu(f)):l(new Error("Rspack stats are undefined"))})})})}var yE=require("@module-federation/enhanced");var Ni=w(require("webpack-merge"));R();function Pn(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function hE(e,t){let r=Object.entries(e).filter(([n])=>!t.includes(n));return Object.fromEntries(r)}function P0(e,t){return e instanceof t||Pn(e)==="ModuleFederationPlugin"}function su(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:r,getPluginOptions:n,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],p=$0(s),f=Array.isArray(l)?iu(...l.map(p)):iu(p(l));Object.keys(f).some(U=>c.includes(U))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let g={...hE(f,[...c,"ModuleFederationPlugin","module","plugins"]),module:hE(f.module??{},["rules"])},h=(0,Ni.default)(a,g),y=f.plugins??[];o&&(y=y.filter(o));let k=a.plugins??[],F=(0,Ni.mergeWithCustomize)({customizeArray:(0,Ni.unique)("plugins",t,U=>Pn(U))})({plugins:y},{plugins:k}).plugins,E=f?.ModuleFederationPlugin?.shared,S=F?.map(U=>{if(P0(U,r)){let N=n(U);return new r({...N,...E?{shared:E}:{}})}return U});h.plugins=S;let L=f.module?.rules;if(L&&typeof L=="function"){let U=a.module?.rules??[];h.module={...h.module??{},rules:L(U)}}return h}}function iu(...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=p=>{let f=c(p);return a(f)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function $0(e){return t=>typeof t=="function"?t(e):t}var O0=su({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:yE.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function wE(e,t,r){return O0(e,t,r)}var bE=require("@module-federation/enhanced/rspack");var L0=su({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:bE.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Pn(e)!=="MiniCssExtractPlugin"});function kE(e,t,r){return L0(e,t,r)}var _m={[xE.Framework.React]:{generateWebpackBundlerConfig:oE,generateRspackBundlerConfig:tu}},N0={webpack:{generateBaseConfig:tE,getFrameworkConfig:(e,t)=>_m[e].generateWebpackBundlerConfig(t),generateFederationConfig:nE,mergeConfigs:(e,t,r)=>wE(e,t,r),bundle:e=>pE({...e,config:e.config}),typeCheckerPlugin:EE.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Pn(t)==="MiniCssExtractPlugin"?new SE.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:aE,getFrameworkConfig:(e,t)=>_m[e].generateRspackBundlerConfig(t),generateFederationConfig:cE,mergeConfigs:(e,t,r)=>kE(e,t,r),bundle:e=>ou({...e,config:e.config}),typeCheckerPlugin:vE.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Pn(t)==="CssExtractRspackPlugin"?new DE.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},ji=e=>N0[e],CE=e=>!!_m[e];var FE={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 au(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:r,paths:n}=UD(e.renderer,e.componentsFiles,e.componentsOptions,e.projectDir),o=AE.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=ji(t),a=k=>{let v=j0({env:k,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:n,libraryName:e.libraryIdentifier,bundler:t,projectDir:e.projectDir}),F=s.mergeConfigs(k,v,i);return e?.debugBundler&&(u.info(`${t} config for env ${k}:`),u.dir(F)),F},l={sourceVolumes:[...e.sourceVolumes,r],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,p]=await Promise.all([s.bundle({...l,config:a(go.Environment.Server),outputPath:`/${go.Environment.Server}`}),s.bundle({...l,config:a(go.Environment.Client),outputPath:`/${go.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(FE)}`),u.debug(`Client Bundler Stats: ${p.toString(FE)}`));let f=GD(o);u.debug("Packaging server bundle...");let m=await JD(c.toJson().assets||[],o,f);u.debug("Packaging client bundle...");let g=await qD(p.toJson().assets||[],o,f),h=k=>v=>[v,k];return{outputFiles:[...m.map(h(go.Environment.Server)),...g.map(h(go.Environment.Client))],outputVolume:o}}function j0({env:e,mode:t="production",framework:r,publicPath:n,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack",projectDir:c}){if(!CE(r))throw new Error(`Unknown framework: ${r}`);let p=Object.entries({[aa]:i[e],...o}).reduce((y,[k,v])=>{let F=(0,Mi.isAbsolute)(v)?v:(0,Mi.join)(c,v);return{...y,[`./${k}`]:`./${(0,Mi.relative)(c,F)}`}},{}),f=ji(l),m=f.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:n,outputPath:a,projectDir:c}),g=f.getFrameworkConfig(r,e),h=f.generateFederationConfig({exposes:p,env:e,libraryName:s});return(0,_E.default)(m,g,h)}var TE=w(require("path")),Rm=require("memfs/lib/volume"),Im=w(require("webpack-merge")),PE=w(require("webpack-node-externals")),Kt=require("@webflow/data-types");var M0=w(require("fs")),Bi=require("path"),Ui=require("webpack");function B0(e,t,r=M0){let n=(0,Bi.join)(t,"node_modules",e);for(;n!==(0,Bi.dirname)(n)&&n!=="node_modules";){let o=(0,Bi.join)(n,"package.json");if(r.existsSync(o))try{let{name:i,version:s}=JSON.parse(r.readFileSync(o,"utf8"));return`${i}@${s}`}catch{return null}n=(0,Bi.dirname)(n)}return null}var lu=class{apply(t){let r=t.context;t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(n){n.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Ui.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let o=n.getAssets(),i={};Object.values(o).forEach(({name:s,source:a})=>{if(!s.endsWith(".map"))return;let[l,c,p]=s.split("."),f=i[l]?.sources??{},m=i[l]?.dependencies??new Set;JSON.parse(a.source().toString()).sources.forEach(h=>{if(h.startsWith("external")){let y=h.match(/^external \S+ "(.+)"$/)?.[1];if(!y)throw new Error(`Could not extract package name from ${h}`);let k=B0(y,r,n.inputFileSystem);if(!k)throw new Error(`Could not find package information for ${y}`);k&&m.add(k)}}),i[l]={sources:{...f,[`./${l}.${p}`]:c},dependencies:m},n.deleteAsset(s)}),Object.entries(i).forEach(([s,{sources:a,dependencies:l}])=>{n.emitAsset(`${s}.js.map`,new Ui.sources.RawSource(JSON.stringify({sources:a,dependencies:[...l]})))})}catch(o){n.errors.push(new Ui.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${o instanceof Error?o.stack:String(o)}`))}})})}};var RE=w(require("module")),IE=require("jsdom"),Am="__webflowCliImportModuleWindow__";function U0(e){let r=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),n=!!r,o=`module[${JSON.stringify(Am)}]`,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(`
55
99
  `)+`
56
- `;return n?e.slice(0,n[0].length)+s+e.slice(n[0].length):s+e}function pa(e,t){let n=e.readFileSync(t,"utf-8"),o=new Mk.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=_R(n),s=new jk.default(t,module);Object.defineProperty(s,Yf,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,Yf),o.close()}}function AR(e,t){let n=`/${t}.js`,r=pa(e,n),o=r.exports.default||r.exports;if(o&&typeof o=="object")try{return(0,Vt.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 RR({declarations:e,sources:t,overrideConfig:n={},performTypeCheck:r,bundler:o="webpack",projectDir:i}){let s=new Zf.Volume,a=Si(o),l=(0,Qf.default)(a.generateBaseConfig({entry:e,env:Vt.Environment.Client,publicPath:"/",libraryName:"metadata",projectDir:i}),a.getFrameworkConfig(Vt.Framework.React,Vt.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:r?[new a.typeCheckerPlugin]:[]}),c=a.mergeConfigs(Vt.Environment.Client,l,n);return await a.bundle({outputPath:"/",config:c,sourceVolumes:t?[t]:[],outputVolume:s,failOnWarnings:!1}),s}async function IR({declarations:e,sources:t,overrideConfig:n={},bundler:r,projectDir:o}){let i=new Zf.Volume,s=Si(r),a=(0,Qf.default)(s.generateBaseConfig({entry:e,env:Vt.Environment.Client,publicPath:"/",libraryName:"source-maps",projectDir:o}),s.getFrameworkConfig(Vt.Framework.React,Vt.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:s.hashFunction},externalsPresets:{node:!0},devtool:"source-map",plugins:[new Lc],externals:[(0,Uk.default)()]}),l=s.mergeConfigs(Vt.Environment.Client,a,n);return l=s.replaceCssPlugin(l),await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}function TR(e){return Object.entries(e.toJSON()).reduce((t,[n,r])=>{if(n.endsWith(".map")&&r?.length){let o=Bk.default.basename(n).split(".")[0];t[o]=r}return t},{})}async function Nc({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r=!1,skipSourceMaps:o=!1,bundler:i="webpack",projectDir:s}){let[a,l]=await Promise.all([RR({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r,bundler:i,projectDir:s}),o||i==="rspack"?Promise.resolve(null):IR({declarations:e,sources:t,overrideConfig:n,bundler:i,projectDir:s})]),{metadata:c,options:p}=Object.keys(e).reduce((m,h)=>{let g=AR(a,h);return m.metadata[h]=g,m.options[h]=g.options||{},m},{metadata:{},options:{}});return{sourceMaps:l?TR(l):{},metadata:c,options:p}}function Wk(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]}]))}Oe();var Vk=w(require("md5"));be();pe();M();var em=" ",Gk=`${em}${ql} `;function PR(e){return e==="added"?` ${J("(Added)")}`:e==="removed"?` ${le("(Removed)")}`:e==="changed"?` ${je("(Changed)")}`:""}function Hk(e){if(!e)return"";let t=JSON.parse(e);return(0,Vk.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(n=>!n.includes("@webflow/data-types")&&!n.includes("@webflow/react"))].sort()))}function $R({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=Hk(n[s]),p=a.displayName&&l.displayName!==a.displayName,d=c&&a.hash&&c!==Hk(a.hash),m=p||d;o[s]={component:l,status:m?"changed":"unchanged",previousName:p?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",p=l?`${l} ${at} ${c}`:c;return`${I(`${Gk}${p}`)}${PR(a)}`}).sort().join(`
57
- `)}function OR({componentsMetadata:e}){return Object.values(e).map(n=>`${I(Gk+(n.displayName??"Unknown Component"))}`).sort().join(`
58
- `)}async function Kk({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:n,sourceMaps:r,workspaceInfo:o}){if(V())return Promise.resolve(!0);let i=e.id?n.find(({profile:p})=>p.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?$R({componentsMetadata:t,latestVersion:i,sourceMaps:r}):OR({componentsMetadata:t}),l=s?`Ready to update ${je(e.name)} on ${Zd(o.name)}?`:`Ready to share ${je(e.name)} with ${Zd(o.name)}?`;return await $e({message:`${l}
100
+ `;return r?e.slice(0,r[0].length)+s+e.slice(r[0].length):s+e}function Pa(e,t){let r=e.readFileSync(t,"utf-8"),o=new IE.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=U0(r),s=new RE.default(t,module);Object.defineProperty(s,Am,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,Am),o.close()}}function W0(e,t){let r=`/${t}.js`,n=Pa(e,r),o=n.exports.default||n.exports;if(o&&typeof o=="object")try{return(0,Kt.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 H0({declarations:e,sources:t,overrideConfig:r={},performTypeCheck:n,bundler:o="webpack",projectDir:i}){let s=new Rm.Volume,a=ji(o),l=(0,Im.default)(a.generateBaseConfig({entry:e,env:Kt.Environment.Client,publicPath:"/",libraryName:"metadata",projectDir:i}),a.getFrameworkConfig(Kt.Framework.React,Kt.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:n?[new a.typeCheckerPlugin]:[]}),c=a.mergeConfigs(Kt.Environment.Client,l,r);return await a.bundle({outputPath:"/",config:c,sourceVolumes:t?[t]:[],outputVolume:s,failOnWarnings:!1}),s}async function V0({declarations:e,sources:t,overrideConfig:r={},bundler:n,projectDir:o}){let i=new Rm.Volume,s=ji(n),a=(0,Im.default)(s.generateBaseConfig({entry:e,env:Kt.Environment.Client,publicPath:"/",libraryName:"source-maps",projectDir:o}),s.getFrameworkConfig(Kt.Framework.React,Kt.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:s.hashFunction},externalsPresets:{node:!0},devtool:"source-map",plugins:[new lu],externals:[(0,PE.default)()]}),l=s.mergeConfigs(Kt.Environment.Client,a,r);return l=s.replaceCssPlugin(l),await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}function G0(e){return Object.entries(e.toJSON()).reduce((t,[r,n])=>{if(r.endsWith(".map")&&n?.length){let o=TE.default.basename(r).split(".")[0];t[o]=n}return t},{})}async function cu({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n=!1,skipSourceMaps:o=!1,bundler:i="webpack",projectDir:s}){let[a,l]=await Promise.all([H0({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n,bundler:i,projectDir:s}),o||i==="rspack"?Promise.resolve(null):V0({declarations:e,sources:t,overrideConfig:r,bundler:i,projectDir:s})]),{metadata:c,options:p}=Object.keys(e).reduce((m,g)=>{let h=W0(a,g);return m.metadata[g]=h,m.options[g]=h.options||{},m},{metadata:{},options:{}});return{sourceMaps:l?G0(l):{},metadata:c,options:p}}function $E(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]}]))}Oe();var LE=w(require("md5"));we();me();j();var Tm=" ",NE=`${Tm}${lc} `;function K0(e){return e==="added"?` ${z("(Added)")}`:e==="removed"?` ${ue("(Removed)")}`:e==="changed"?` ${Ne("(Changed)")}`:""}function OE(e){if(!e)return"";let t=JSON.parse(e);return(0,LE.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(r=>!r.includes("@webflow/data-types")&&!r.includes("@webflow/react"))].sort()))}function J0({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=OE(r[s]),p=a.displayName&&l.displayName!==a.displayName,f=c&&a.hash&&c!==OE(a.hash),m=p||f;o[s]={component:l,status:m?"changed":"unchanged",previousName:p?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",p=l?`${l} ${rt} ${c}`:c;return`${P(`${NE}${p}`)}${K0(a)}`}).sort().join(`
101
+ `)}function z0({componentsMetadata:e}){return Object.values(e).map(r=>`${P(NE+(r.displayName??"Unknown Component"))}`).sort().join(`
102
+ `)}async function jE({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:r,sourceMaps:n,workspaceInfo:o}){if(V())return Promise.resolve(!0);let i=e.id?r.find(({profile:p})=>p.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?J0({componentsMetadata:t,latestVersion:i,sourceMaps:n}):z0({componentsMetadata:t}),l=s?`Ready to update ${Ne(e.name)} on ${yp(o.name)}?`:`Ready to share ${Ne(e.name)} with ${yp(o.name)}?`;return await $e({message:`${l}
59
103
 
60
- ${em}${I("Code components:")}
104
+ ${Tm}${P("Code components:")}
61
105
  ${a}
62
106
 
63
- ${em}Confirm to proceed`})}var jc=require("path"),qk=require("memfs/lib/volume");var Jk=w(require("fast-glob")),LR=e=>{let t=e.split("/");return t[t.length-1]},NR=e=>LR(e).split(".")[0];async function zk(e,t){return(await Jk.default.glob(e,{absolute:!0,...t||{}})).reduce((r,o)=>{let i=NR(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}},{})}function It(e){return e.replace(/\\/g,"/")}async function Mc(e,t){let n=await zk(e.components,{cwd:(0,jc.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(i=>i!=null)});if(!Object.keys(n).length)throw new Error("No declaration files found");let{componentsFiles:r,componentsVolume:o}=jR(n,e.renderer.client,e.globals,t);return{componentsFiles:r,componentsVolume:o}}function jR(e,t,n,r){let o={},i={};return Object.entries(e).forEach(([s,a])=>{let l=(0,jc.extname)(a),c=`${xn}/${KD}/${s}${l}`;o[s]=c,i[c]=MR(t,a,n)}),{componentsFiles:o,componentsVolume:qk.Volume.fromJSON(i,r)}}function MR(e,t,n){let r=JSON.stringify(It(t)),o=JSON.stringify(It(e));if(!n)return`
64
- import componentDefinition from ${r};
107
+ ${Tm}Confirm to proceed`})}var uu=require("path"),UE=require("memfs/lib/volume");var ME=w(require("fast-glob")),q0=e=>{let t=e.split("/");return t[t.length-1]},Y0=e=>q0(e).split(".")[0];async function BE(e,t){return(await ME.default.glob(e,{absolute:!0,...t||{}})).reduce((n,o)=>{let i=Y0(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}},{})}function It(e){return e.replace(/\\/g,"/")}async function du(e,t){let r=await BE(e.components,{cwd:(0,uu.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(i=>i!=null)});if(!Object.keys(r).length)throw new Error("No declaration files found");let{componentsFiles:n,componentsVolume:o}=X0(r,e.renderer.client,e.globals,t);return{componentsFiles:n,componentsVolume:o}}function X0(e,t,r,n){let o={},i={};return Object.entries(e).forEach(([s,a])=>{let l=(0,uu.extname)(a),c=`${_r}/${jD}/${s}${l}`;o[s]=c,i[c]=Z0(t,a,r)}),{componentsFiles:o,componentsVolume:UE.Volume.fromJSON(i,n)}}function Z0(e,t,r){let n=JSON.stringify(It(t)),o=JSON.stringify(It(e));if(!r)return`
108
+ import componentDefinition from ${n};
65
109
  export default {...componentDefinition};
66
- `.trim();let i=JSON.stringify(It(n));return`
110
+ `.trim();let i=JSON.stringify(It(r));return`
67
111
  import { applyDecorators } from ${o};
68
- import componentDefinition from ${r};
112
+ import componentDefinition from ${n};
69
113
  const globals = require(${i}) || {};
70
114
 
71
115
  const globalDecorators = globals?.decorators || [];
@@ -82,215 +126,173 @@ if (componentDefinition?.component) {
82
126
  }
83
127
 
84
128
  export default decoratedDefinition;
85
- `.trim()}q();bc();var Uc=require("path");var Xk=require("@webflow/data-types"),Bc={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:Xk.Framework.React};var zn=require("path"),_i=require("fs");Oe();A();Me();be();C();pe();M();function Yk(e,t){let n={...e};if(e.globals){let r=(0,zn.resolve)(t,e.globals);if(!(0,_i.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.`);n.globals=It(r)}if(e.bundleConfig){let r=(0,zn.resolve)(t,e.bundleConfig);if(!(0,_i.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.`);n.bundleConfig=It(r)}if(typeof e.renderer=="string"){let r=(0,zn.resolve)(t,e.renderer);(0,_i.existsSync)(r)&&(n.renderer=It(r))}else if(typeof e.renderer=="object"&&typeof n.renderer=="object"){if(typeof e.renderer.client=="string"){let r=(0,zn.resolve)(t,e.renderer.client);(0,_i.existsSync)(r)&&(n.renderer={...n.renderer,client:It(r)})}if(typeof e.renderer.server=="string"){let r=(0,zn.resolve)(t,e.renderer.server);(0,_i.existsSync)(r)&&(n.renderer={...n.renderer,server:It(r)})}}return n}async function BR({initialData:e}){let t=await Ke({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 Ke({message:"Enter a description for your code library",default:e?.description??""});if(!await $e({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 UR({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 Ql({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??"",p=l.value?.name??"",d=l.value?.description??"";return c.toLowerCase().includes(s)||p.toLowerCase().includes(s)||d.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function tm({initialData:e,existingCodeLibraries:t}){let n,r={components:Bc.components},o=t.length>0?await UR({existingCodeLibraries:t}):null;if(o)n={...r,...o,...e,id:o.id};else{let a=await BR({initialData:e});n={...r,...e,...a}}let{path:i}=Qr(),s=Yk(n,(0,zn.dirname)(i));return xe({library:s}),u.info(`${$} Library configuration updated in webflow.json`),{libraryManifest:s,manifestPath:i}}async function Zk({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:n,manifestPath:r}=ee(),o=Hs(n,"library");if(!o.id){if(sn())return t.succeed(),tm({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&&sn())return t.succeed(),tm({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=Yk({...o,name:i},(0,zn.dirname)(r));return Promise.resolve({libraryManifest:s,manifestPath:r})}catch(n){if(n instanceof Zr&&sn())return t.info(n.message),tm({existingCodeLibraries:e});throw t.fail(),n}}var nm=require("memfs/lib/volume"),tE=w(require("webpack-merge"));var nE="/client-renderer.js",rE="/server-renderer.js",Qk=`${xn}/test-renderers${nE}`,eE=`${xn}/test-renderers${rE}`,WR=new Set(["@webflow/react"]),HR=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function oE(e,t){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(WR.has(e.client)&&HR.has(e.server))return;let n=await KR(e,t);VR(e.client,n),GR(e.server,n)}function VR(e,t){let n=pa(t,nE);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 GR(e,t){let n=pa(t,rE);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 KR(e,t){let n=new nm.Volume,r=It(e.client),o=It(e.server),i={[Qk]:`
90
- export * from "${r}";
91
- `,[eE]:`
129
+ `.trim()}Y();Gc();var fu=require("path");var WE=require("@webflow/data-types"),pu={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:WE.Framework.React};var en=require("path"),Wi=require("fs");Oe();R();Pe();we();C();me();j();function HE(e,t){let r={...e};if(e.globals){let n=(0,en.resolve)(t,e.globals);if(!(0,Wi.existsSync)(n))throw new Error(`Globals file not found: ${e.globals}
130
+ Resolved path: ${n}
131
+ Please ensure the file exists or remove the 'globals' field from your manifest.`);r.globals=It(n)}if(e.bundleConfig){let n=(0,en.resolve)(t,e.bundleConfig);if(!(0,Wi.existsSync)(n))throw new Error(`Bundle config file not found: ${e.bundleConfig}
132
+ Resolved path: ${n}
133
+ Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);r.bundleConfig=It(n)}if(typeof e.renderer=="string"){let n=(0,en.resolve)(t,e.renderer);(0,Wi.existsSync)(n)&&(r.renderer=It(n))}else if(typeof e.renderer=="object"&&typeof r.renderer=="object"){if(typeof e.renderer.client=="string"){let n=(0,en.resolve)(t,e.renderer.client);(0,Wi.existsSync)(n)&&(r.renderer={...r.renderer,client:It(n)})}if(typeof e.renderer.server=="string"){let n=(0,en.resolve)(t,e.renderer.server);(0,Wi.existsSync)(n)&&(r.renderer={...r.renderer,server:It(n)})}}return r}async function Q0({initialData:e}){let t=await Ge({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 d("When --no-input mode is enabled please provide a name in your library manifest");let r=await Ge({message:"Enter a description for your code library",default:e?.description??""});if(!await $e({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 eT({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+=` ${ue("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await pc({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??"",p=l.value?.name??"",f=l.value?.description??"";return c.toLowerCase().includes(s)||p.toLowerCase().includes(s)||f.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function Pm({initialData:e,existingCodeLibraries:t}){let r,n={components:pu.components},o=t.length>0?await eT({existingCodeLibraries:t}):null;if(o)r={...n,...o,...e,id:o.id};else{let a=await Q0({initialData:e});r={...n,...e,...a}}let{path:i}=cr(),s=HE(r,(0,en.dirname)(i));return Se({library:s}),u.info(`${$} Library configuration updated in webflow.json`),{libraryManifest:s,manifestPath:i}}async function VE({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:r,manifestPath:n}=oe(),o=ea(r,"library");if(!o.id){if(lr())return t.succeed(),Pm({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&&lr())return t.succeed(),Pm({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=HE({...o,name:i},(0,en.dirname)(n));return Promise.resolve({libraryManifest:s,manifestPath:n})}catch(r){if(r instanceof oo&&lr())return t.info(r.message),Pm({existingCodeLibraries:e});throw t.fail(),r}}var $m=require("memfs/lib/volume"),JE=w(require("webpack-merge"));var zE="/client-renderer.js",qE="/server-renderer.js",GE=`${_r}/test-renderers${zE}`,KE=`${_r}/test-renderers${qE}`,tT=new Set(["@webflow/react"]),rT=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function YE(e,t){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(tT.has(e.client)&&rT.has(e.server))return;let r=await iT(e,t);nT(e.client,r),oT(e.server,r)}function nT(e,t){let r=Pa(t,zE);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 oT(e,t){let r=Pa(t,qE);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 iT(e,t){let r=new $m.Volume,n=It(e.client),o=It(e.server),i={[GE]:`
134
+ export * from "${n}";
135
+ `,[KE]:`
92
136
  export * from "${o}";
93
- `},s=(0,tE.default)(Ac(),{context:t,entry:{"client-renderer":Qk,"server-renderer":eE},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await Tc({config:s,sourceVolumes:[nm.Volume.fromJSON(i,t)],outputVolume:n,failOnWarnings:!1}),n}async function Wc({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:n}=await Zk({existingCodeLibraries:e}),r=(0,Uc.resolve)((0,Uc.dirname)(n)),{renderer:o,...i}=Bc,s=typeof t.renderer=="string"?{client:t.renderer,server:t.renderer}:{client:t.renderer?.client??o.client,server:t.renderer?.server??o.server};return s.server==="@webflow/react"&&(s.server="@webflow/react/server"),await oE(s,r),{...i,...t,renderer:s,manifestPath:n}}C();M();async function JR(e,t){let{trackPerformance:n,libraryConfig:r,projectDir:o}=e;return await n("collect_metadata",async()=>{let{componentsFiles:i,componentsVolume:s}=await Mc(r,o);u.debug(`Components: ${JSON.stringify(i,null,2)}`);let{sourceMaps:a,metadata:l,options:c}=await Nc({declarations:i,sources:s,overrideConfig:e.overrideConfig,performTypeCheck:wc(i,t,o),bundler:t?.bundler,projectDir:o});return u.debug(`Metadata: ${JSON.stringify(l,null,2)}`),u.debug(`Source Maps:
94
-
95
- ${Object.entries(a).reduce((p,[d,m])=>(p+=`${d}: ${JSON.stringify(JSON.parse(m),null,2)}
96
-
97
- `,p),"")}`),{componentsFiles:i,componentsVolume:s,componentsMetadata:l,componentsOptions:c,sourceMaps:a}})}async function zR(e,t,n,r,o,i,s){let{trackPerformance:a,libraryConfig:l,projectDir:c}=e;return await a("generate_library_bundle",async()=>await Oc({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:vr(i[Ai.Environment.Client]),sourceVolumes:[n],componentsFiles:t,componentsOptions:r,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler,projectDir:c}))}async function qR(e,t,n,r){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let p=(0,co.resolve)((0,co.join)(`/${c}`,`${l.name}`));return la(n.readFileSync(p,"utf8").toString(),p,{bundleEnvironment:c})}),{signatures:a}=await Uf({resourceId:r,files:s.map(({meta:l})=>l),options:i});await Promise.all(a.map(async l=>{let c=s.find(p=>p.meta.fileHash===l.hash);if(!c)throw new Error(`File not found: ${l.hash}`);await ca(c,l.value)}))})}async function XR(e,t,n,r,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:vr(o[Ai.Environment.Client])+Js,loaderType:Ai.ModuleLoader.FEDERATION},serverModule:{bundleUrl:vr(o[Ai.Environment.Server])+qs}},c=Wk(t,{framework:s.framework,sourceMaps:n}),{taskId:p}=await Wf({resourceId:r,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:p},null,2))})}async function rm(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=cb(o);try{u.debug("Checking dependencies versions..."),new to().run();let s={apiToken:r};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await Mf({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let p=await Wc({existingCodeLibraries:c}),d=p.bundleConfig?require(p.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:p,overrideConfig:d,projectDir:(0,co.resolve)((0,co.dirname)(p.manifestPath))};t=u.spinner("Collecting metadata");let{componentsFiles:h,componentsVolume:g,componentsMetadata:y,componentsOptions:b,sourceMaps:S}=await JR(m,e);if(t.succeed(),!await Kk({libraryConfig:p,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 Bf({name:p.name,slug:p.id,description:p.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:p.name,framework:p.framework,resourceId:v,profileSlug:x}),p.id||(xe({library:{id:x}}),u.info(`${$} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:we,outputVolume:Se}=await zR(m,h,g,b,v,B,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:p.name,componentCount:Object.keys(h).length,resourceId:v,profileSlug:x}),t=u.spinner("Uploading files"),await qR(m,we,Se,v),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:p.name,fileCount:we.length,resourceId:v,profileSlug:x}),t=u.spinner("Sharing library"),await XR(m,y,S,v,B),t.succeed(),u.success(`Code library shared successfully${O?.slug?`: ${En()}/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:p.name,framework:p.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 Hc=w(require("fs")),Cn=require("path");A();bc();C();var YR="CodeLibrary",ZR="dist",QR="http://localhost/";async function om(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new to().run(),u.debug("Looking for manifest...");let n=await Wc({existingCodeLibraries:[]}),r=Cc(n.name)||YR,o=`_${e.libraryId||r}`,i=(0,Cn.resolve)((0,Cn.dirname)(n.manifestPath));e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(n,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:s,componentsVolume:a}=await Mc(n,i);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(s,null,2)}`);let l=n.bundleConfig?require(n.bundleConfig):{},{sourceMaps:c,metadata:p,options:d}=await Nc({declarations:s,sources:a,overrideConfig:l,performTypeCheck:wc(s,e,i),skipSourceMaps:!e?.debugBundler,bundler:e.bundler,projectDir:i});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(p,null,2)}`),u.debug(`Source Maps:
98
-
99
- ${Object.entries(c).reduce((g,[y,b])=>(g+=`${y}: ${JSON.stringify(JSON.parse(b),null,2)}
137
+ `},s=(0,JE.default)(tu(),{context:t,entry:{"client-renderer":GE,"server-renderer":KE},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await ou({config:s,sourceVolumes:[$m.Volume.fromJSON(i,t)],outputVolume:r,failOnWarnings:!1}),r}async function mu({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:r}=await VE({existingCodeLibraries:e}),n=(0,fu.resolve)((0,fu.dirname)(r)),{renderer:o,...i}=pu,s=typeof t.renderer=="string"?{client:t.renderer,server:t.renderer}:{client:t.renderer?.client??o.client,server:t.renderer?.server??o.server};return s.server==="@webflow/react"&&(s.server="@webflow/react/server"),await YE(s,n),{...i,...t,renderer:s,manifestPath:r}}C();j();async function sT(e,t){let{trackPerformance:r,libraryConfig:n,projectDir:o}=e;return await r("collect_metadata",async()=>{let{componentsFiles:i,componentsVolume:s}=await du(n,o);u.debug(`Components: ${JSON.stringify(i,null,2)}`);let{sourceMaps:a,metadata:l,options:c}=await cu({declarations:i,sources:s,overrideConfig:e.overrideConfig,performTypeCheck:Vc(i,t,o),bundler:t?.bundler,projectDir:o});return u.debug(`Metadata: ${JSON.stringify(l,null,2)}`),u.debug(`Source Maps:
100
138
 
101
- `,g),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:m,outputVolume:h}=await Oc({libraryIdentifier:o,renderer:n.renderer,framework:n.framework,publicPath:vr(e.publicPath||QR),sourceVolumes:[a],componentsFiles:s,componentsOptions:d,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:l,failOnWarnings:!e.force,bundler:e.bundler,projectDir:i});t.succeed(),t=u.spinner("Writing to disk"),m.forEach(([g,y])=>{let b=(0,Cn.join)(`/${y}`,`${g.name}`),S=la(h.readFileSync(b,"utf8").toString(),b,{bundleEnvironment:y}),_=(0,Cn.join)(i,e.outputPath||ZR);Hc.default.existsSync((0,Cn.join)(_,`${y}`))||Hc.default.mkdirSync((0,Cn.join)(_,`${y}`),{recursive:!0}),Hc.default.writeFileSync((0,Cn.join)(_,y,g.name),S.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(n){throw t?.fail(),new f(n)}}A();M();var fa=w(require("fs-extra")),im=w(require("path"));A();M();function eI(){try{if(!fa.default.existsSync(At))return null;let e=fa.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:im.default.join(At,t),time:fa.default.statSync(im.default.join(At,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);if(e.length===0)return null;for(let t of e)try{let r=fa.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 sm(){let e=eI();e&&u.info(`${fi} Latest log: ${e}`),u.info(`${fi} All logs: ${At}`)}async function iE(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(sm)}var ye=require("commander");C();A();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 _e(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();A();var sE=(e,t)=>e+" ".repeat(Math.max(0,t-wt(e).length));function qe(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)=>sE(s,n[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>sE(String(a),n[l]+2)).join("")).join(`
102
- `);return`${o}
103
- ${r}
104
- ${i}`}function Ri(e){return e?`
105
-
106
- More: pass --cursor ${e}`:""}var aE=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],lE=["id","url","lastPublished","fullSiteCompiledAt"],cE=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],Vc="id,name,siteId,createdAt",am="id,name,description,siteId,appPath,createdAt",Gc="id,url,lastPublished",Kc="id,branch,deployUrl,latestDeploymentStatus,createdAt",tI=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function nI(e,t){return e==null||e===""?I("\u2014"):tI.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function ma(e,t,n){if(e.length===0)return I(n);let r=t.map(i=>se(i)),o=e.map(i=>t.map(s=>nI(i[s],s)));return qe(r,o)}var Jc=ut(aE),uE=ut(lE),dE=ut(cE);function xr(){return aE}function ga(){return lE}function ha(){return cE}function zc(e,t=Vc.split(",")){return ma(e,t,"No apps found.")}function pE(e,t=Gc.split(",")){return ma(e,t,"No domains found.")}function fE(e,t=Kc.split(",")){return ma(e,t,"No environments found.")}function mE(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 rI=["success","failed","canceled","unstaged"],qc=5,Xc=600;function gE(e){return rI.includes(e)}var hE=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],ya="id,status,sourceType,commitHash,buildStartedAt",Yc=ut(hE);function Cr(){return hE}function wa(e,t=ya.split(",")){return ma(e,t,"No deployments found.")}Xl();var lm=()=>new ye.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."),cm=()=>new ye.Option("--region <region>",`Webflow region to target: ${Ks.join(", ")}. US and EU are fully isolated stacks with separate accounts. Falls back to WEBFLOW_REGION, then webflow.json, then "us".`).choices(Ks),yE=()=>new ye.Option("--input","Force interactive mode, overriding the automatic no-input detection."),um=()=>new ye.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),dm=()=>new ye.Option("--skip-update-check","Skip checking for @webflow packages updates"),pm=()=>new ye.Option("--verbose","Display more information for debugging purposes."),qn=()=>new ye.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),Tt=()=>new ye.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Ii=e=>{if(e.trim()==="")throw new ye.InvalidArgumentError("must be a non-empty value.");return e},Zc=(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.`,Qc=e=>new ye.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(Ii),ne=()=>new ye.Option("--json","Output as JSON"),ba=()=>new ye.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),Da=()=>new ye.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),fm=()=>new ye.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),Ae=()=>new ye.Option("--dry-run","Preview without executing"),Ti=()=>new ye.Option("-y, --yes","Skip confirmation prompt"),Pi=()=>new ye.Option("--order <dir>","Sort direction: asc or desc").default("asc"),eu=()=>new ye.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]),ka=()=>new ye.Option("-g, --global","Operate on the per-user (home directory) install"),Ea=()=>new ye.Option("-p, --project","Operate on the current project's install"),He=e=>new ye.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),$i=e=>new ye.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),tu=()=>new ye.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),nu=()=>new ye.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),oI=100,ru=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new ye.InvalidArgumentError("must be a positive integer.");return t},mm=()=>new ye.Option("--limit <n>","Max log lines to return (default: 100)").default(oI).argParser(ru),iI=20,wE=()=>new ye.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(iI).argParser(ru),bE=e=>{let t=Number(e);if(!Number.isInteger(t))throw new ye.InvalidArgumentError("must be an integer number of seconds.");return t},DE=()=>new ye.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(qc).argParser(bE),kE=()=>new ye.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(Xc).argParser(bE),va=e=>async(t,n)=>{let o={...n.parent?.opts()||{},...t};await e(o)};pe();var sI=`${le("[Deprecated]")} The 'library' commands will be removed in the next major release.`,aI=()=>{u.warn(`${re} ${le("webflow library share")} is deprecated and will be removed in the next major release.
107
- Use ${J("webflow devlink import")} instead.
108
- `)},lI=()=>{u.warn(`${re} ${le("webflow library bundle")} is deprecated and will be removed in the next major release.
109
- Use ${J("webflow devlink bundle")} instead.
110
- `)},cI=()=>{u.warn(`${re} ${le("webflow library log")} is deprecated and will be removed in the next major release.
111
- Use ${J("webflow log")} instead.
112
- `)},uI="Import a library of Code Components into your Webflow Workspace.",dI="Bundle a library of Code Components for local development.",EE=()=>new Fr.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),vE=()=>new Fr.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),SE=()=>new Fr.Option("--dev","Bundle in development mode for debugging purposes."),xE=()=>new Fr.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),pI=()=>new Fr.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),fI=()=>new Fr.Option("--public-path <path>","Set the public path for the bundle."),mI=()=>new Fr.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function gm(e,t){return e.command(t).description(uI).addOption(qn()).addOption(EE()).addOption(vE()).addOption(SE()).addOption(xE()).action(va(rm))}function hm(e,t){return e.command(t).description(dI).addOption(pI()).addOption(fI()).addOption(mI()).addOption(EE()).addOption(vE()).addOption(SE()).addOption(xE()).action(va(om))}var CE=e=>{let t=e.command("library").description(sI);gm(t,"share").description(`${le("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",aI),hm(t,"bundle").description(`${le("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",lI),t.command("log").description(`${le("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",cI).action(sm)};pe();var FE=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(qn()).addOption(Tt()).action(vD),gm(t,"import"),hm(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(qn()).addOption(Tt()).action(va(vc))};var Zn=w(require("fs")),Gt=w(require("path"));A();q();var Fe={New:"new",Existing:"existing"},_E="cli",Xn=3,Yn=39,ou="astro",AE="cloud-scaffolds";var RE="package.json",uo="webflow.json",iu="wf-placeholder-name",IE="CLOUD_MOUNT_PATH",TE="gitignore";function ym(e){return!e.siteId}var Sa=async(e,t,n=ou,r,o,i)=>{try{let s,a;if("content"in r){let l=r.content;s=l.files,a=c=>Gt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=r[n];if(!c)throw new Error(`Scaffold "${n}" not found`);s=c;let p=Gt.join(AE,n);a=d=>d.split(p)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=Gt.join(e,a(l)),p=l.includes("next.config.ts"),d=l.includes("astro.config.mjs"),m=p||d;if(l.includes(uo)&&Zn.existsSync(c))continue;if(l.includes(RE)||l.includes(uo)){let g=(await Zn.promises.readFile(l,"utf8")).replace(iu,e);await su(c,g)}else if(m){let h=await Zn.promises.readFile(l,"utf8");await su(c,h.replace(IE,t))}else if(Gt.basename(c).toLowerCase()===TE){let h=await Zn.promises.readFile(l,"utf8"),g=Gt.join(Gt.dirname(c),".gitignore");await su(g,h)}else{let h=await Zn.promises.readFile(l);await su(c,h)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Gn({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 su=async(e,t)=>{try{await Zn.promises.mkdir(Gt.dirname(e),{recursive:!0}),await Zn.promises.writeFile(e,t)}catch(n){throw u.error(`Error writing file ${e}: ${n}`),n}};var _r=w(require("fs")),PE=w(require("fs-extra")),Ar=w(require("path")),Em=w(require("os")),$E=w(require("tar"));var tt=class extends Error{constructor(n,r,o){super(n);this.scaffoldId=r;this.supportedIds=o;this.name="ScaffoldError"}};var xa={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v3"}},"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:"v3"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function Ca(e){let t=xa[e];if(!t){let n=Object.keys(xa);throw new tt(`Unsupported framework: "${e}". Supported: ${n.join(", ")}`,e,n)}return t}function wm(){return Object.keys(xa)}function bm(){return[...new Set(wm().map(e=>e.replace(/-minimal$/,"")))]}function Dm(){return["astro","nextjs"]}function km(e){let n=`${e.replace(/-minimal$/,"")}-minimal`;if(!xa[n]){let r=wm();throw new tt(`No minimal scaffold for "${e}". Supported: ${r.join(", ")}`,n,r)}return n}A();Vn();var gI="https://github.com";async function vm(e){let t=e.endsWith("-minimal")?e:km(e);return au(t)}async function au(e){return Ca(e).source.type==="github"?hI(e):OE(e)}async function OE(e){let t=Ca(e);if(t.source.type!=="local")throw new tt(`Scaffold "${e}" does not have a local source`,e);let n=Ar.isAbsolute(t.source.path)?t.source.path:Ar.join(__dirname,t.source.path);if(!_r.existsSync(n))throw new tt(`Scaffold directory not found: ${n}`,e);let r=await Sm(n);return{scaffoldId:e,files:r,extractionRoot:n}}async function hI(e){let t=Ca(e);if(t.source.type!=="github")throw new tt(`Scaffold "${e}" does not have a GitHub source`,e);let n=(Je()?t.source.betaRef:void 0)??t.source.ref??"main",r=`${gI}/${t.source.repo}/archive/${n}.tar.gz`,o=await _r.promises.mkdtemp(Ar.join(Em.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 tt(`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 tt(`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 yI(a,o),l.succeed("Scaffold ready")}catch(h){throw l.fail("Unpack failed"),h}let c=await _r.promises.readdir(o),p=c[0];if(!p||c.length!==1)throw new tt(`Unexpected tarball structure for ${t.source.repo}`,e);let d=Ar.join(o,p),m=await Sm(d);return{scaffoldId:e,files:m,extractionRoot:d}}catch(s){try{PE.default.removeSync(o)}catch{}throw s instanceof tt?s:new tt(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function yI(e,t){let n=Ar.join(Em.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await _r.promises.writeFile(n,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await $E.extract({file:n,cwd:t})}finally{await _r.promises.unlink(n).catch(()=>{})}}async function Sm(e){let t=[],n=await _r.promises.readdir(e,{withFileTypes:!0});for(let r of n){let o=Ar.join(e,r.name);r.isDirectory()?t.push(...await Sm(o)):t.push(o)}return t}var Ym=w(require("fs-extra"));q();X();var oe=w(require("fs")),ue=w(require("path")),Wa=require("child_process"),Cv=w(require("tar"));var ft=w(require("fs")),dn=w(require("path"));var j={};Py(j,{BRAND:()=>HI,DIRTY:()=>po,EMPTY_PATH:()=>kI,INVALID:()=>Y,NEVER:()=>FT,OK:()=>dt,ParseStatus:()=>nt,Schema:()=>ae,ZodAny:()=>Tr,ZodArray:()=>nr,ZodBigInt:()=>mo,ZodBoolean:()=>go,ZodBranded:()=>_a,ZodCatch:()=>Co,ZodDate:()=>ho,ZodDefault:()=>xo,ZodDiscriminatedUnion:()=>uu,ZodEffects:()=>zt,ZodEnum:()=>vo,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>Q,ZodFunction:()=>pu,ZodIntersection:()=>Do,ZodIssueCode:()=>R,ZodLazy:()=>ko,ZodLiteral:()=>Eo,ZodMap:()=>Bi,ZodNaN:()=>Wi,ZodNativeEnum:()=>So,ZodNever:()=>ln,ZodNull:()=>wo,ZodNullable:()=>An,ZodNumber:()=>fo,ZodObject:()=>Dt,ZodOptional:()=>Kt,ZodParsedType:()=>W,ZodPipeline:()=>Aa,ZodPromise:()=>Pr,ZodReadonly:()=>Fo,ZodRecord:()=>du,ZodSchema:()=>ae,ZodSet:()=>Ui,ZodString:()=>Ir,ZodSymbol:()=>ji,ZodTransformer:()=>zt,ZodTuple:()=>_n,ZodType:()=>ae,ZodUndefined:()=>yo,ZodUnion:()=>bo,ZodUnknown:()=>tr,ZodVoid:()=>Mi,addIssueToContext:()=>N,any:()=>ZI,array:()=>nT,bigint:()=>JI,boolean:()=>KE,coerce:()=>CT,custom:()=>HE,date:()=>zI,datetimeRegex:()=>UE,defaultErrorMap:()=>Qn,discriminatedUnion:()=>sT,effect:()=>wT,enum:()=>gT,function:()=>pT,getErrorMap:()=>Oi,getParsedType:()=>Fn,instanceof:()=>GI,intersection:()=>aT,isAborted:()=>lu,isAsync:()=>Li,isDirty:()=>cu,isValid:()=>Rr,late:()=>VI,lazy:()=>fT,literal:()=>mT,makeIssue:()=>Fa,map:()=>uT,nan:()=>KI,nativeEnum:()=>hT,never:()=>eT,null:()=>YI,nullable:()=>DT,number:()=>GE,object:()=>rT,objectUtil:()=>xm,oboolean:()=>xT,onumber:()=>ST,optional:()=>bT,ostring:()=>vT,pipeline:()=>ET,preprocess:()=>kT,promise:()=>yT,quotelessJson:()=>wI,record:()=>cT,set:()=>dT,setErrorMap:()=>DI,strictObject:()=>oT,string:()=>VE,symbol:()=>qI,transformer:()=>wT,tuple:()=>lT,undefined:()=>XI,union:()=>iT,unknown:()=>QI,util:()=>de,void:()=>tT});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 xm;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(xm||(xm={}));var W=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fn=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 R=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"]),wI=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),bt=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()}};bt.create=e=>new bt(e);var bI=(e,t)=>{let n;switch(e.code){case R.invalid_type:e.received===W.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case R.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,de.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(e.keys,", ")}`;break;case R.invalid_union:n="Invalid input";break;case R.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(e.options)}`;break;case R.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(e.options)}, received '${e.received}'`;break;case R.invalid_arguments:n="Invalid function arguments";break;case R.invalid_return_type:n="Invalid function return type";break;case R.invalid_date:n="Invalid date";break;case R.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 R.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 R.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 R.custom:n="Invalid input";break;case R.invalid_intersection_types:n="Intersection results could not be merged";break;case R.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case R.not_finite:n="Number must be finite";break;default:n=t.defaultError,de.assertNever(e)}return{message:n}},Qn=bI;var LE=Qn;function DI(e){LE=e}function Oi(){return LE}var Fa=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}},kI=[];function N(e,t){let n=Oi(),r=Fa({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Qn?void 0:Qn].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"}),po=e=>({status:"dirty",value:e}),dt=e=>({status:"valid",value:e}),lu=e=>e.status==="aborted",cu=e=>e.status==="dirty",Rr=e=>e.status==="valid",Li=e=>typeof Promise<"u"&&e instanceof Promise;var K;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(K||(K={}));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}},NE=(e,t)=>{if(Rr(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 bt(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 Fn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Fn(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:Fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Li(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:Fn(t)},o=this._parseSync({data:t,path:r.path,parent:r});return NE(r,o)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Rr(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=>Rr(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:Fn(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Li(o)?o:Promise.resolve(o));return NE(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:R.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 zt({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 Kt.create(this,this._def)}nullable(){return An.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nr.create(this)}promise(){return Pr.create(this,this._def)}or(t){return bo.create([this,t],this._def)}and(t){return Do.create(this,t,this._def)}transform(t){return new zt({...ie(this._def),schema:this,typeName:Q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new xo({...ie(this._def),innerType:this,defaultValue:n,typeName:Q.ZodDefault})}brand(){return new _a({typeName:Q.ZodBranded,type:this,...ie(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Co({...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 Aa.create(this,t)}readonly(){return Fo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},EI=/^c[^\s-]{8,}$/i,vI=/^[0-9a-z]+$/,SI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xI=/^[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,CI=/^[a-z0-9_-]{21}$/i,FI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_I=/^[-+]?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)?)??$/,AI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cm,II=/^(?:(?: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])$/,TI=/^(?:(?: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])$/,PI=/^(([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]))$/,$I=/^(([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])$/,OI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,LI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ME="((\\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])))",NI=new RegExp(`^${ME}$`);function BE(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 jI(e){return new RegExp(`^${BE(e)}$`)}function UE(e){let t=`${ME}T${BE(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 MI(e,t){return!!((t==="v4"||!t)&&II.test(e)||(t==="v6"||!t)&&PI.test(e))}function BI(e,t){if(!FI.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 UI(e,t){return!!((t==="v4"||!t)&&TI.test(e)||(t==="v6"||!t)&&$I.test(e))}var Ir=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:R.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:R.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:R.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:R.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(o,{code:R.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")AI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"email",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Cm||(Cm=new RegExp(RI,"u")),Cm.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"emoji",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")xI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"uuid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")CI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"nanoid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")EI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")vI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid2",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")SI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ulid",code:R.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:R.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:R.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:R.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:R.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:R.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?UE(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?NI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?jI(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?_I.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"duration",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?MI(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ip",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?BI(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"jwt",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?UI(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cidr",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?OI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?LI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64url",code:R.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:R.invalid_string,...K.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...K.errToObj(t)})}url(t){return this._addCheck({kind:"url",...K.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...K.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...K.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...K.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...K.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...K.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...K.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...K.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...K.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...K.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...K.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...K.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,...K.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,...K.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...K.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...K.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...K.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...K.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...K.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...K.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...K.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...K.errToObj(n)})}nonempty(t){return this.min(1,K.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}};Ir.create=e=>new Ir({checks:[],typeName:Q.ZodString,coerce:e?.coerce??!1,...ie(e)});function WI(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 fo=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:R.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:R.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:R.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:R.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?WI(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.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:R.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,K.toString(n))}gt(t,n){return this.setLimit("min",t,!1,K.toString(n))}lte(t,n){return this.setLimit("max",t,!0,K.toString(n))}lt(t,n){return this.setLimit("max",t,!1,K.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:K.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:K.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:K.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.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)}};fo.create=e=>new fo({checks:[],typeName:Q.ZodNumber,coerce:e?.coerce||!1,...ie(e)});var mo=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:R.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:R.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:R.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:R.invalid_type,expected:W.bigint,received:n.parsedType}),Y}gte(t,n){return this.setLimit("min",t,!0,K.toString(n))}gt(t,n){return this.setLimit("min",t,!1,K.toString(n))}lte(t,n){return this.setLimit("max",t,!0,K.toString(n))}lt(t,n){return this.setLimit("max",t,!1,K.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.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:K.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:K.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}};mo.create=e=>new mo({checks:[],typeName:Q.ZodBigInt,coerce:e?.coerce??!1,...ie(e)});var go=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:R.invalid_type,expected:W.boolean,received:r.parsedType}),Y}return dt(t.data)}};go.create=e=>new go({typeName:Q.ZodBoolean,coerce:e?.coerce||!1,...ie(e)});var ho=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:R.invalid_type,expected:W.date,received:i.parsedType}),Y}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return N(i,{code:R.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:R.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:R.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:K.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:K.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}};ho.create=e=>new ho({checks:[],coerce:e?.coerce||!1,typeName:Q.ZodDate,...ie(e)});var ji=class extends ae{_parse(t){if(this._getType(t)!==W.symbol){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.symbol,received:r.parsedType}),Y}return dt(t.data)}};ji.create=e=>new ji({typeName:Q.ZodSymbol,...ie(e)});var yo=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.undefined,received:r.parsedType}),Y}return dt(t.data)}};yo.create=e=>new yo({typeName:Q.ZodUndefined,...ie(e)});var wo=class extends ae{_parse(t){if(this._getType(t)!==W.null){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.null,received:r.parsedType}),Y}return dt(t.data)}};wo.create=e=>new wo({typeName:Q.ZodNull,...ie(e)});var Tr=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(t){return dt(t.data)}};Tr.create=e=>new Tr({typeName:Q.ZodAny,...ie(e)});var tr=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dt(t.data)}};tr.create=e=>new tr({typeName:Q.ZodUnknown,...ie(e)});var ln=class extends ae{_parse(t){let n=this._getOrReturnCtx(t);return N(n,{code:R.invalid_type,expected:W.never,received:n.parsedType}),Y}};ln.create=e=>new ln({typeName:Q.ZodNever,...ie(e)});var Mi=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.void,received:r.parsedType}),Y}return dt(t.data)}};Mi.create=e=>new Mi({typeName:Q.ZodVoid,...ie(e)});var nr=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:R.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?R.too_big:R.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:R.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:R.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:K.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:K.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:K.toString(n)}})}nonempty(t){return this.min(1,t)}};nr.create=(e,t)=>new nr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Q.ZodArray,...ie(t)});function Ni(e){if(e instanceof Dt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Kt.create(Ni(r))}return new Dt({...e._def,shape:()=>t})}else return e instanceof nr?new nr({...e._def,type:Ni(e.element)}):e instanceof Kt?Kt.create(Ni(e.unwrap())):e instanceof An?An.create(Ni(e.unwrap())):e instanceof _n?_n.create(e.items.map(t=>Ni(t))):e}var Dt=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:R.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 ln&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let p=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:p._parse(new Jt(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof ln){let c=this._def.unknownKeys;if(c==="passthrough")for(let p of a)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(c==="strict")a.length>0&&(N(o,{code:R.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 p of a){let d=o.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new Jt(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of l){let d=await p.key,m=await p.value;c.push({key:d,value:m,alwaysSet:p.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(r,c)):nt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return K.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:K.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 Ni(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 Kt;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return WE(de.objectKeys(this.shape))}};Dt.create=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strip",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});Dt.strictCreate=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strict",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});Dt.lazycreate=(e,t)=>new Dt({shape:e,unknownKeys:"strip",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});var bo=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 bt(a.ctx.common.issues));return N(n,{code:R.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},p=l._parseSync({data:n.data,path:n.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,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 bt(l));return N(n,{code:R.invalid_union,unionErrors:a}),Y}}get options(){return this._def.options}};bo.create=(e,t)=>new bo({options:e,typeName:Q.ZodUnion,...ie(t)});var er=e=>e instanceof ko?er(e.schema):e instanceof zt?er(e.innerType()):e instanceof Eo?[e.value]:e instanceof vo?e.options:e instanceof So?de.objectValues(e.enum):e instanceof xo?er(e._def.innerType):e instanceof yo?[void 0]:e instanceof wo?[null]:e instanceof Kt?[void 0,...er(e.unwrap())]:e instanceof An?[null,...er(e.unwrap())]:e instanceof _a||e instanceof Fo?er(e.unwrap()):e instanceof Co?er(e._def.innerType):[],uu=class e extends ae{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.object)return N(n,{code:R.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:R.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=er(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 Fm(e,t){let n=Fn(e),r=Fn(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=Fm(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=Fm(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 Do=class extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(lu(i)||lu(s))return Y;let a=Fm(i.value,s.value);return a.valid?((cu(i)||cu(s))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:R.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}))}};Do.create=(e,t,n)=>new Do({left:e,right:t,typeName:Q.ZodIntersection,...ie(n)});var _n=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.array)return N(r,{code:R.invalid_type,expected:W.array,received:r.parsedType}),Y;if(r.data.length<this._def.items.length)return N(r,{code:R.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:R.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})}};_n.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _n({items:e,typeName:Q.ZodTuple,rest:null,...ie(t)})};var du=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:R.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:Ir.create(),valueType:t,typeName:Q.ZodRecord,...ie(n)})}},Bi=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:R.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,p=await l.value;if(c.status==="aborted"||p.status==="aborted")return Y;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(c.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,p=l.value;if(c.status==="aborted"||p.status==="aborted")return Y;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(c.value,p.value)}return{status:n.value,value:a}}}};Bi.create=(e,t,n)=>new Bi({valueType:t,keyType:e,typeName:Q.ZodMap,...ie(n)});var Ui=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.set)return N(r,{code:R.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:R.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:R.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 p of l){if(p.status==="aborted")return Y;p.status==="dirty"&&n.dirty(),c.add(p.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:K.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:K.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Ui.create=(e,t)=>new Ui({valueType:e,minSize:null,maxSize:null,typeName:Q.ZodSet,...ie(t)});var pu=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:R.invalid_type,expected:W.function,received:n.parsedType}),Y;function r(a,l){return Fa({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Oi(),Qn].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:l}})}function o(a,l){return Fa({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Oi(),Qn].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Pr){let a=this;return dt(async function(...l){let c=new bt([]),p=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),d=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(d,i).catch(h=>{throw c.addIssue(o(d,h)),c})})}else{let a=this;return dt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new bt([r(l,c.error)]);let p=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(p,i);if(!d.success)throw new bt([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:_n.create(t).rest(tr.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||_n.create([]).rest(tr.create()),returns:n||tr.create(),typeName:Q.ZodFunction,...ie(r)})}},ko=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})}};ko.create=(e,t)=>new ko({getter:e,typeName:Q.ZodLazy,...ie(t)});var Eo=class extends ae{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return N(n,{received:n.data,code:R.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:t.data}}get value(){return this._def.value}};Eo.create=(e,t)=>new Eo({value:e,typeName:Q.ZodLiteral,...ie(t)});function WE(e,t){return new vo({values:e,typeName:Q.ZodEnum,...ie(t)})}var vo=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:R.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:R.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})}};vo.create=WE;var So=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:R.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:R.invalid_enum_value,options:o}),Y}return dt(t.data)}get enum(){return this._def.values}};So.create=(e,t)=>new So({values:e,typeName:Q.ZodNativeEnum,...ie(t)});var Pr=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:R.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})))}};Pr.create=(e,t)=>new Pr({type:e,typeName:Q.ZodPromise,...ie(t)});var zt=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"?po(l.value):n.value==="dirty"?po(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"?po(a.value):n.value==="dirty"?po(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(!Rr(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=>Rr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):Y);de.assertNever(o)}};zt.create=(e,t,n)=>new zt({schema:e,typeName:Q.ZodEffects,effect:t,...ie(n)});zt.createWithPreprocess=(e,t,n)=>new zt({schema:t,effect:{type:"preprocess",transform:e},typeName:Q.ZodEffects,...ie(n)});var Kt=class extends ae{_parse(t){return this._getType(t)===W.undefined?dt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Kt.create=(e,t)=>new Kt({innerType:e,typeName:Q.ZodOptional,...ie(t)});var An=class extends ae{_parse(t){return this._getType(t)===W.null?dt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};An.create=(e,t)=>new An({innerType:e,typeName:Q.ZodNullable,...ie(t)});var xo=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}};xo.create=(e,t)=>new xo({innerType:e,typeName:Q.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ie(t)});var Co=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 Li(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Co.create=(e,t)=>new Co({innerType:e,typeName:Q.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ie(t)});var Wi=class extends ae{_parse(t){if(this._getType(t)!==W.nan){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.nan,received:r.parsedType}),Y}return{status:"valid",value:t.data}}};Wi.create=e=>new Wi({typeName:Q.ZodNaN,...ie(e)});var HI=Symbol("zod_brand"),_a=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}},Aa=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(),po(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})}},Fo=class extends ae{_parse(t){let n=this._def.innerType._parse(t),r=o=>(Rr(o)&&(o.value=Object.freeze(o.value)),o);return Li(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Fo.create=(e,t)=>new Fo({innerType:e,typeName:Q.ZodReadonly,...ie(t)});function jE(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function HE(e,t={},n){return e?Tr.create().superRefine((r,o)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=jE(t,r),l=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=jE(t,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Tr.create()}var VI={object:Dt.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 GI=(e,t={message:`Input not instance of ${e.name}`})=>HE(n=>n instanceof e,t),VE=Ir.create,GE=fo.create,KI=Wi.create,JI=mo.create,KE=go.create,zI=ho.create,qI=ji.create,XI=yo.create,YI=wo.create,ZI=Tr.create,QI=tr.create,eT=ln.create,tT=Mi.create,nT=nr.create,rT=Dt.create,oT=Dt.strictCreate,iT=bo.create,sT=uu.create,aT=Do.create,lT=_n.create,cT=du.create,uT=Bi.create,dT=Ui.create,pT=pu.create,fT=ko.create,mT=Eo.create,gT=vo.create,hT=So.create,yT=Pr.create,wT=zt.create,bT=Kt.create,DT=An.create,kT=zt.createWithPreprocess,ET=Aa.create,vT=()=>VE().optional(),ST=()=>GE().optional(),xT=()=>KE().optional(),CT={string:(e=>Ir.create({...e,coerce:!0})),number:(e=>fo.create({...e,coerce:!0})),boolean:(e=>go.create({...e,coerce:!0})),bigint:(e=>mo.create({...e,coerce:!0})),date:(e=>ho.create({...e,coerce:!0}))};var FT=Y;function fu(e,t=!1){let n=e.length,r=0,o="",i=0,s=16,a=0,l=0,c=0,p=0,d=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,d=0}function g(){let v=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Hi(e.charCodeAt(r)))for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;else return d=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&&Hi(e.charCodeAt(r))){for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;x=r}else d=3;return e.substring(v,x)}function y(){let v="",x=r;for(;;){if(r>=n){v+=e.substring(x,r),d=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){d=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):d=4;break;default:d=5}x=r;continue}if(O>=0&&O<=31)if(Ra(O)){v+=e.substring(x,r),d=2;break}else d=6;r++}return v}function b(){if(o="",d=0,i=r,l=a,p=c,r>=n)return i=n,s=17;let v=e.charCodeAt(r);if(_m(v)){do r++,o+=String.fromCharCode(v),v=e.charCodeAt(r);while(_m(v));return s=15}if(Ra(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&&!Ra(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++,Ra(B)&&(B===13&&e.charCodeAt(r)===10&&r++,a++,c=r)}return H||(r++,d=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||!Hi(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(_m(v)||Ra(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 _(){let v;do v=b();while(v>=12&&v<=15);return v}return{setPosition:h,getPosition:()=>r,scan:t?_:b,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-p,getTokenError:()=>d}}function _m(e){return e===32||e===9}function Ra(e){return e===10||e===13}function Hi(e){return e>=48&&e<=57}var JE;(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"})(JE||(JE={}));var AT=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),Vi=200,RT={" ":{"\n":new Array(Vi).fill(0).map((e,t)=>`
115
- `+" ".repeat(t)),"\r":new Array(Vi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Vi).fill(0).map((e,t)=>`\r
116
- `+" ".repeat(t))}," ":{"\n":new Array(Vi).fill(0).map((e,t)=>`
117
- `+" ".repeat(t)),"\r":new Array(Vi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Vi).fill(0).map((e,t)=>`\r
118
- `+" ".repeat(t))}};var mu;(function(e){e.DEFAULT={allowTrailingComma:!1}})(mu||(mu={}));function zE(e,t=[],n=mu.DEFAULT){let r=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):r!==null&&(o[r]=l)}return qE(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,p)=>{t.push({error:l,offset:c,length:p})}},n),o[0]}function qE(e,t,n=mu.DEFAULT){let r=fu(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 p(U){return U?()=>{i>0&&i--,i===0&&U(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=c(t.onObjectBegin),m=l(t.onObjectProperty),h=p(t.onObjectEnd),g=c(t.onArrayBegin),y=p(t.onArrayEnd),b=l(t.onLiteralValue),S=a(t.onSeparator),_=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):_();break;case 16:B(1);break;case 15:case 14:break;default:return U}}}function B(U,ge=[],ur=[]){if(v(U),ge.length+ur.length>0){let dr=r.getToken();for(;dr!==17;){if(ge.indexOf(dr)!==-1){H();break}else if(ur.indexOf(dr)!==-1)break;dr=H()}}}function we(U){let ge=r.getTokenValue();return U?b(ge):(m(ge),o.push(ge)),H(),!0}function Se(){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):(we(!1),r.getToken()===6?(S(":"),H(),z()||B(4,[],[2,5])):B(5,[],[2,5]),o.pop(),!0)}function Ne(){d(),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 Ne();case 10:return we(!0);default:return Se()}}return H(),r.getToken()===17?n.allowEmptyContent?!0:(B(4,[],[]),!1):z()?(r.getToken()!==17&&B(9,[],[]),!0):(B(4,[],[]),!1)}var XE;(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"})(XE||(XE={}));var YE;(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"})(YE||(YE={}));var _o=zE;var ZE;(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"})(ZE||(ZE={}));var Zi=w(require("fs")),gv=w(require("path")),hv=require("@webflow/cosmic-deploy-contract");var dv=w(require("fs")),pv=w(require("path"));var Gi=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
-
120
- How to fix: ${this.remediation}`),this.documentationUrl&&(t+=`
121
-
122
- Documentation: ${this.documentationUrl}`),t}},Re=class extends Gi{constructor(t,n){super(t,n),this.name="FrameworkValidationError"}};var Ao=class extends Gi{configFile;constructor(t,n){super(t,n),this.name="FrameworkConfigError",this.configFile=n?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
123
-
124
- Config file: ${this.configFile}`),t}},rr=class extends Gi{constructor(t,n){super(t,n),this.name="FrameworkDetectionError"}};var Et=w(require("path")),Ta=w(require("fs"));var QE=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 QE.default.coerce(n)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}};var sv=w(require("semver")),Le=w(require("fs")),Rn=w(require("path"));var Ro=w(require("semver"));function NT(){return process.version.slice(1)}function jT(e){let t=Ro.coerce(e);return t?t.major:null}function MT(e,t){let n=Ro.coerce(e),r=Ro.coerce(t);return!n||!r?!1:Ro.gte(n,r)}function $r(e,t,n){let r=NT(),o=t.minimum;if(MT(r,o))e.debug(`Node.js version ${r} meets requirement ${o}`);else{let i=jT(o),s=`${n} requires Node.js ${o} or higher. Current version: ${r}`;if(t.severity==="error")throw new Re(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
139
+ ${Object.entries(a).reduce((p,[f,m])=>(p+=`${f}: ${JSON.stringify(JSON.parse(m),null,2)}
125
140
 
126
- nvm install ${i}
127
- nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var gu=w(require("fs")),ev=w(require("path"));var tv=j.object({name:j.string().optional(),version:j.string().optional(),dependencies:j.record(j.string()).optional(),devDependencies:j.record(j.string()).optional()});function Ia(e){let t=ev.default.join(e,"package.json");if(!gu.statSync(t,{throwIfNoEntry:!1}))return;let n=gu.readFileSync(t).toString("utf8"),r;try{r=JSON.parse(n)}catch(o){throw new Re("package.json was not valid JSON",{cause:o})}try{return tv.parse(r)}catch(o){throw new Re("package.json schema validation failed",{cause:o})}}var hu=w(require("fs")),nv=w(require("path"));var yu=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 Ki(e,t,n="webflow.json"){let r=nv.default.join(t,n);if(!hu.statSync(r,{throwIfNoEntry:!1}))return n.endsWith(".json")?Ki(e,t,n+"c"):void 0;let o=hu.readFileSync(r).toString("utf8"),i;try{i=_o(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${r} ${JSON.stringify(o)}: ${s}`);return}try{let s=yu.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 Ji=w(require("fs")),rv=w(require("path"));function Rm(e,t,n,r,o){if(!n||r!=="astro"&&r!=="nextjs")return t;let i=rv.join(e,t);if(!Ji.existsSync(i)||!Ji.statSync(i).isDirectory())return t;let a=Ji.readdirSync(i,{withFileTypes:!0}).find(l=>!(!l.isDirectory()||o&&l.name===o||r==="astro"&&(l.name==="_routes.json"||l.name==="_worker.js")));return a?`${t}/${a.name}`:t}var ov=require("child_process"),iv=["--no-update-notifier","--no-progress","--no-audit","--no-fund"];async function Ze(e){let{log:t,cwd:n,args:r}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...iv,...r];t.debug(`npm ${i.join(" ")} (in ${n})`),(0,ov.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:n,env:o,stdio:"inherit"})}function cn(e){if(!e)return null;let t=sv.coerce(e);return t?t.major:null}function Or(e,t,n,r){let o=r?.exclude?Array.isArray(r.exclude)?r.exclude:[r.exclude]:[],i=Rn.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?Le.statSync(t,{throwIfNoEntry:!1}):Le.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=Le.readdirSync(t),p=0;for(let d of c)p+=Or(e,Rn.join(t,d),Rn.join(n,d),r);return p}let l=Rn.dirname(n);return Le.existsSync(l)||Le.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${n}`),Le.copyFileSync(t,n),1}function kt(e){return Le.existsSync(e)}function yt(...e){for(let t of e)if(Le.existsSync(t))return t;return e[0]??""}async function In(e,t,n,r){if(!Le.existsSync(t))throw new Ao(`Template not found: ${t}`,{configFile:t});let o=Le.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=Rn.dirname(n);Le.existsSync(a)||Le.mkdirSync(a,{recursive:!0}),Le.writeFileSync(n,s)}function Tn(e,t,n,r){for(let o of r){let i=Rn.join(t,`${n}.${o}`);if(Le.existsSync(i)){let s=Rn.join(t,`clouduser.${n}.${o}`);return e.info(`Renaming user config: ${n}.${o} -> clouduser.${n}.${o}`),Le.renameSync(i,s),s}}return null}var Im=yt(Et.join(__dirname,"templates","astro","v5"),Et.join(__dirname,"templates","v5")),av=yt(Et.join(__dirname,"templates","astro"),Et.join(__dirname,"templates")),Io=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=cn(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&&$r(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Re("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 Re('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=cn(o);if(i!==null&&i>=6)throw new Re(`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 Ze({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 Ze({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:Et.join(Im,"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(Im,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Et.join(av,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;Tn(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"),Ta.writeFileSync(Et.join(n,"clouduser.astro.config.mjs"),`export default {};
128
- `));let i=Et.join(av,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),Ta.copyFileSync(i,Et.join(n,"astro.config.webflow.ts")));let s=Et.join(Im,"astro.config.mjs.template"),a=Et.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await In(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ta.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 Pa=w(require("semver"));async function wu(e){let{log:t,cwd:n,adapterName:r,installVersion:o,fixedFloor:i,declaredVersion:s}=e;if(!s){t.warn(`Installing ${r}@${o} (required for Cloudflare deployment)...`),await Ze({log:t,cwd:n,args:["install","--save",`${r}@${o}`]});return}let a=Pa.coerce(s);if(!a||!Pa.lt(a,i))return;let l=Pa.coerce(i)?.major;a.major===l?(t.warn(`Detected ${r}@${s}, which has a known base-path bug (withastro/astro#16276) that breaks static assets on mounted apps. Upgrading to ${o}.`),await Ze({log:t,cwd:n,args:["install","--save",`${r}@${o}`]})):t.warn(`${r}@${s} predates the base-path fix in ${i} and upgrading crosses a major version. Please upgrade to ${r}@${o} manually to avoid broken asset serving on mounted apps.`)}var Tm=yt(vt.join(__dirname,"templates","astro","v6"),vt.join(__dirname,"templates","v6")),lv=yt(vt.join(__dirname,"templates","astro"),vt.join(__dirname,"templates")),To=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=cn(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&&$r(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Re("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 Re('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=cn(o);if(i!==null&&i<6)throw new Re(`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 Re(`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.3.1",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(await wu({log:t,cwd:n,adapterName:r.name,installVersion:r.version,fixedFloor:"13.3.1",declaredVersion:this.getDependencyVersion(r.name)}),r.peerDependencies)for(let o of r.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${r.name})...`),await Ze({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 Ze({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:vt.join(Tm,"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(Tm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,vt.join(lv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;Tn(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(lv,"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(Tm,"astro.config.mjs.template"),a=vt.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await In(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")),Oa=w(require("fs"));var Pm=yt(St.join(__dirname,"templates","astro","v7"),St.join(__dirname,"templates","v7")),cv=yt(St.join(__dirname,"templates","astro"),St.join(__dirname,"templates")),zi=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=cn(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&&$r(t,r,this.info.displayName);let o=n.dependencies?.astro||n.devDependencies?.astro;if(!o)throw new Re("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 Re('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=cn(o);if(i!==null&&i<7)throw new Re(`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.7",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(await wu({log:t,cwd:n,adapterName:r.name,installVersion:r.version,fixedFloor:"14.0.0",declaredVersion:this.getDependencyVersion(r.name)}),r.peerDependencies)for(let o of r.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${r.name})...`),await Ze({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 Ze({log:t,cwd:n,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:St.join(Pm,"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(Pm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,St.join(cv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;Tn(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"),Oa.writeFileSync(St.join(n,"clouduser.astro.config.mjs"),`export default {};
130
- `));let i=St.join(cv,"astro.config.webflow.ts");kt(i)&&(t.info("Copying astro.config.webflow.ts..."),Oa.copyFileSync(i,St.join(n,"astro.config.webflow.ts")));let s=St.join(Pm,"astro.config.mjs.template"),a=St.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await In(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Oa.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")),qt=w(require("fs"));var qi=yt(Ve.join(__dirname,"templates","nextjs"),Ve.join(__dirname,"templates")),Xi=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 Re("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 Ze({log:t,cwd:n,args:["install","--save",r.name]}))}getWebflowLoader(){return{templatePath:Ve.join(qi,"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(qi,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Ve.join(qi,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(qt.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..."),!qt.existsSync(t))throw new Ao(`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");qt.copyFileSync(t,i),n.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=Tn(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"),qt.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)}`),qt.writeFileSync(Ve.join(n,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
132
- declare const config: UserNextConfig;
133
- export default config;
134
- `));let i=Ve.join(qi,"next.config.webflow.ts");kt(i)&&(t.info("Copying next.config.webflow.ts..."),qt.copyFileSync(i,Ve.join(n,"next.config.webflow.ts")));let s=Ve.join(qi,"next.config.ts.template"),a=Ve.join(n,"next.config.ts");t.info("Generating next.config.ts from template..."),await In(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();kt(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),qt.copyFileSync(l.templatePath,Ve.join(n,l.destinationName)));let c=Ve.join(qi,"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 qt.statSync(Ve.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}};var Pt=w(require("path")),Xt=w(require("fs"));var bu=yt(Pt.join(__dirname,"templates","vite"),Pt.join(__dirname,"templates")),Yi=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 Re("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=cn(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await Ze({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 Ze({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 Ze({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 Pt.join(bu,"wrangler.json")}getAdditionalConfigFiles(){return[Pt.join(bu,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:n}=this.ctx;for(let r of["wrangler.json","wrangler.jsonc"]){let o=Pt.join(n,r);if(Xt.existsSync(o)){try{let i=Xt.readFileSync(o,"utf8"),s=_o(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=Pt.join(n,"src","worker.ts");if(Xt.existsSync(r)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),Xt.mkdirSync(Pt.join(n,"src"),{recursive:!0}),Xt.writeFileSync(r,`/// <reference types="@cloudflare/workers-types" />
141
+ `,p),"")}`),{componentsFiles:i,componentsVolume:s,componentsMetadata:l,componentsOptions:c,sourceMaps:a}})}async function aT(e,t,r,n,o,i,s){let{trackPerformance:a,libraryConfig:l,projectDir:c}=e;return await a("generate_library_bundle",async()=>await au({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:Tn(i[Hi.Environment.Client]),sourceVolumes:[r],componentsFiles:t,componentsOptions:n,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler,projectDir:c}))}async function lT(e,t,r,n){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let p=(0,ho.resolve)((0,ho.join)(`/${c}`,`${l.name}`));return Aa(r.readFileSync(p,"utf8").toString(),p,{bundleEnvironment:c})}),{signatures:a}=await bm({resourceId:n,files:s.map(({meta:l})=>l),options:i});await Promise.all(a.map(async l=>{let c=s.find(p=>p.meta.fileHash===l.hash);if(!c)throw new Error(`File not found: ${l.hash}`);await Ra(c,l.value)}))})}async function cT(e,t,r,n,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:Tn(o[Hi.Environment.Client])+sa,loaderType:Hi.ModuleLoader.FEDERATION},serverModule:{bundleUrl:Tn(o[Hi.Environment.Server])+la}},c=$E(t,{framework:s.framework,sourceMaps:r}),{taskId:p}=await km({resourceId:n,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:p},null,2))})}async function Om(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=Bb(o,"share_library");try{u.debug("Checking dependencies versions..."),new ao().run();let s={apiToken:n};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await ym({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let p=await mu({existingCodeLibraries:c}),f=p.bundleConfig?require(p.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:p,overrideConfig:f,projectDir:(0,ho.resolve)((0,ho.dirname)(p.manifestPath))};t=u.spinner("Collecting metadata");let{componentsFiles:g,componentsVolume:h,componentsMetadata:y,componentsOptions:k,sourceMaps:v}=await sT(m,e);if(t.succeed(),!await jE({libraryConfig:p,componentsMetadata:y,existingCodeLibraries:c,sourceMaps:v,workspaceInfo:l}))return;t=u.spinner("Creating code library");let{resourceId:E,profileSlug:S,workspace:L,s3Urls:U,cdnUrls:N}=await i("init_code_library",async()=>await wm({name:p.name,slug:p.id,description:p.description,options:s}));t.succeed(),u.debug(JSON.stringify({resourceId:E,profileSlug:S,s3Urls:U,cdnUrls:N},null,2)),await o.sendUsage("library_initialized",{libraryName:p.name,framework:p.framework,resourceId:E,profileSlug:S}),p.id||(Se({library:{id:S}}),u.info(`${$} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:te,outputVolume:G}=await aT(m,g,h,k,E,N,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:p.name,componentCount:Object.keys(g).length,resourceId:E,profileSlug:S}),t=u.spinner("Uploading files"),await lT(m,te,G,E),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:p.name,fileCount:te.length,resourceId:E,profileSlug:S}),t=u.spinner("Sharing library"),await cT(m,y,v,E,N),t.succeed(),u.success(`Code library shared successfully${L?.slug?`: ${xr()}/dashboard/workspace/${L?.slug}/shared-libraries-and-templates`:"!"}`);let ce=Date.now()-r;await o.sendUsage("share_library",{duration:ce,componentCount:Object.keys(g).length,libraryName:p.name,framework:p.framework,resourceId:E,profileSlug:S})}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 d(s)}}var gu=w(require("fs")),Ar=require("path");R();Gc();C();var uT="CodeLibrary",dT="dist",pT="http://localhost/";async function Lm(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new ao().run(),u.debug("Looking for manifest...");let r=await mu({existingCodeLibraries:[]}),n=Zc(r.name)||uT,o=`_${e.libraryId||n}`,i=(0,Ar.resolve)((0,Ar.dirname)(r.manifestPath));e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(r,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:s,componentsVolume:a}=await du(r,i);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(s,null,2)}`);let l=r.bundleConfig?require(r.bundleConfig):{},{sourceMaps:c,metadata:p,options:f}=await cu({declarations:s,sources:a,overrideConfig:l,performTypeCheck:Vc(s,e,i),skipSourceMaps:!e?.debugBundler,bundler:e.bundler,projectDir:i});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(p,null,2)}`),u.debug(`Source Maps:
135
142
 
136
- interface Env {
137
- ASSETS: Fetcher;
138
- }
143
+ ${Object.entries(c).reduce((h,[y,k])=>(h+=`${y}: ${JSON.stringify(JSON.parse(k),null,2)}
139
144
 
140
- export default {
141
- async fetch(request: Request, env: Env): Promise<Response> {
142
- return env.ASSETS.fetch(request);
143
- },
144
- } satisfies ExportedHandler<Env>;
145
- `)}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=this.hasCustomWorkerEntry();Tn(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"),Xt.writeFileSync(Pt.join(n,"clouduser.vite.config.ts"),`export default {};
146
- `));let s=Pt.join(bu,"vite.config.webflow.ts");kt(s)&&(t.info("Copying vite.config.webflow.ts..."),Xt.copyFileSync(s,Pt.join(n,"vite.config.webflow.ts")));let a=Pt.join(bu,"vite.config.ts.template"),l=Pt.join(n,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await In(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 uv=w(require("fs")),La=w(require("path"));var BT=yt(La.join(__dirname,"templates","static"),La.join(__dirname,"templates")),Na=["_headers","_redirects"],$m=["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 UT(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 ja(e){return e===".well-known"?!1:e.startsWith(".")||Na.includes(e)?!0:$m.some(t=>UT(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"],HT=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],VT=new Set([...WT,...HT]);function Ma(e){let t=[],n=(r,o)=>{let i;try{i=uv.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()){ja(s.name)||n(La.join(r,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||VT.has(s.name))&&t.push(a)}};return n(e,""),t}var un=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=Ma(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 La.join(BT,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}};var fv=[zi,To,Io,Xi,Yi,un],Ba=["astro","nextjs","vite","static"];function Du(e,t){for(let n of fv){let r=n.detect(e,t);if(r.detected)return{Builder:n,result:r}}return null}function Om(e,t){let n=Du(e.packageJson,t);if(!n)throw new rr("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${Ba.join(", ")})`});return e.log.info(`Detected framework: ${n.result.reason}`),new n.Builder(e)}function mv(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 Ua(e,t,n){let r=n?.cloud?.framework,i=dv.lstatSync(pv.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Ma(e),a=mv({hasPackageJson:t!=null,specifiedFramework:r,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&r==null)throw new rr(`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 ku(e,t,n,r){let o=gv.join(t,"webflow.json"),i={cloud:{}};if(Zi.existsSync(o))try{let a=Zi.readFileSync(o,"utf8"),l=JSON.parse(a),c=yu.safeParse(l);if(c.success)i=c.data;else{let p=c.error.issues.map(d=>`${d.path.join(".")}: ${d.message}`).join(", ");e.warn(`webflow.json has schema issues (will be corrected): ${p}`),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,hv.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${n}`),Zi.writeFileSync(o,JSON.stringify(i,null,2))}function yv(e,t){let n=Ki(e,t);if(n?.cloud?.framework)return n.cloud.framework;let r=Ia(t),{isStatic:o}=Ua(t,r,n);if(o)return e.info("Detected static app (no framework, no build)"),ku(e,t,un.frameworkName),un.frameworkName;if(!r)throw new rr("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=Du(r,n);if(!i)throw new rr("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}`),ku(e,t,s),s}A();var wv=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 bv(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
147
- `)}function Dv(e,t="wrangler.json"){let n=dn.join(e,t);if(!ft.existsSync(n)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),Dv(e,t+"c");u.warn(`/${t} not found`);return}let r=ft.readFileSync(n,"utf8");u.info(`reading /${t}...`);let o;try{o=_o(r)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=wv.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
148
- ${bv(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function kv(e,t){let n=null,r=null,o=dn.join(t,"wrangler.json"),i=dn.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,dn.join(t,`clouduser.wrangler${r}`)));let s=n?Dv(t,dn.basename(n)):null,a=e.getWranglerTemplatePath(),l=dn.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 p in s.d1_databases){let d=s.d1_databases[p];if(!d.migrations_dir){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir is not defined`);continue}let m=d.migrations_dir,h=dn.join(t,m);if(!ft.existsSync(h)){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let g=dn.join(t,"clouduser","migrations",m),y=Or(u,h,g);y>0?u.info(`copied ${y} migrations to /clouduser/migrations/${m}`):u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) is empty`)}}function GT(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 Ev(e){let t=null;for(let s of[".json",".jsonc"]){let a=dn.join(e,`clouduser.wrangler${s}`);if(ft.existsSync(a)){t=a;break}}if(!t)return;let n=ft.readFileSync(t,"utf8"),r;try{r=_o(n)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=wv.safeParse(r);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
149
- ${bv(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)GT(s.bucket_name)}}A();C();M();pe();var Eu=w(require("fs")),vv=w(require("path"));function Sv(e,t,n){if(!n)return t;let r=`${t}/${n}`,o=vv.join(e,r);return Eu.existsSync(o)&&Eu.statSync(o).isDirectory()?r:t}var KT="4.82.1",vu=60;function or(e,t){let n=Math.min(vu,process.stdout.columns??vu),r=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,n-r.length));u.info(`
150
- ${se(`${r}${o}`)}`)}function Lm(e,t){let n=Math.min(vu,process.stdout.columns??vu),r=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,n-r.length));u.info(`
151
- ${se(_t(`${r}${o}`))}`)}async function Fv(e=process.cwd(),t,n,r){let o=Ia(e),i=Ki(u,e),s={...r?{COSMIC_MOUNT_PATH:r}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...n&&!t?{COSMIC_DEPLOY_URL:zT(n)}:{}},a={cwd:e,log:u,packageJson:o??{},userEnv:s},{isStatic:l}=Ua(e,o,i);if(l)return new un(a);if(!o)throw new Error("No package.json file found");return Om(a,i)}async function _v(e,t={}){let n=t.projectPath||process.cwd(),r=Date.now(),o=ue.join(n,".tmp",`webflow-build-${r}`),i=t.outputDir||ue.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=Nm(n),c=t.telemetry,p=e.getBuildCommand(),d=e.getOutputDeployMetadata(),m=d.deploymentType==="static";await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildCommand:p,deploymentType:d.deploymentType,mountPath:s,cloudflareBindings:l}),oe.mkdirSync(o,{recursive:!0});try{or("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${d.deploymentType}`);let h=e.getNodeVersionRequirement();h&&$r(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),or("\u2699\uFE0F ","Configure wrangler"),await kv(e,n),u.info("Preparing framework configuration..."),await e.prepareConfig()),ku(u,n,e.info.name,e),m||(or("\u{1F4E6}","Install dependencies"),await JT(n,e.info.name,t.telemetry),Ev(n),or("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${p}...`),await qT(n,p,t.telemetry),await e.postBuild(),or("\u{1F9EA}","Wrangler dry-run"),await XT(n,i)),or("\u{1F4C1}","Copy assets"),await ZT(n,i,e,s),or("\u{1F381}","Create tarball");let g=await QT(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:p,deploymentType:d.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:p,deploymentType:d.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function Nm(e){let t=ue.join(e,"wrangler.json");if(!oe.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let n=JSON.parse(oe.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 Av(e){try{let t=ue.dirname(e);t.includes(".tmp/webflow-build-")&&(or("\u{1F9F9}","Clean up build artifacts"),oe.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function Rv(e,t){try{or("\u{1F9F9}","Revert framework configuration");let n=t.getUserConfigPatterns(),r=new Set;for(let s of n){let a=ue.extname(s).slice(1),l=ue.basename(s,`.${a}`);if(!r.has(l)){r.add(l);for(let c of["mjs","cjs","js","ts"]){let p=ue.join(e,`clouduser.${l}.${c}`),d=ue.join(e,`${l}.${c}`);if(oe.existsSync(p)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),oe.existsSync(d)&&oe.unlinkSync(d),oe.renameSync(p,d);break}}}}for(let s of[".jsonc",".json"]){let a=ue.join(e,`clouduser.wrangler${s}`);if(oe.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=ue.join(e,"wrangler.json");oe.existsSync(l)&&oe.unlinkSync(l);let c=ue.join(e,`wrangler${s}`);oe.renameSync(a,c);break}}let o=ue.join(e,"clouduser");oe.existsSync(o)&&(u.info("cleaning up clouduser directory..."),oe.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=ue.join(e,ue.basename(s));oe.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),oe.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=ue.join(e,i.destinationName);oe.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),oe.unlinkSync(s))}}catch(n){u.warn(`Warning: Failed to cleanup framework configuration: ${n}`)}}async function JT(e,t,n){let r=Date.now(),o=["--no-update-notifier","--no-progress"],i=ue.join(e,"package-lock.json");try{oe.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,Wa.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,Wa.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:oe.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:oe.existsSync(i)}),s}}function zT(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 qT(e,t,n){let r=Date.now();try{(0,Wa.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 XT(e,t){oe.mkdirSync(t,{recursive:!0});let n=ue.join(e,"wrangler.json"),r=ue.join(e,"wrangler.jsonc");if(!oe.existsSync(n)&&!oe.existsSync(r))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,Wa.execSync)(`npx wrangler@${KT} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function xv(e,t){let n=ue.join(e,"webflow.json");oe.existsSync(n)?(u.info("including webflow.json in output..."),oe.copyFileSync(n,ue.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function YT(e,t,n){let r=n.replace(/\/+$/,"").replace(/^\/+/,""),o=ue.join(t,"assets"),i=ue.join(o,r||"");oe.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${r}...`);for(let s of oe.readdirSync(e))Or(u,ue.join(e,s),ue.join(i,s),{excludeFn:ja,followSymlinks:!1});for(let s of Na){let a=ue.join(e,s);oe.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),oe.copyFileSync(a,ue.join(o,s)))}}async function ZT(e,t,n,r){let o=n.getOutputDeployMetadata();if(o.deploymentType==="static"){YT(e,t,r),xv(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=r.replace(/\/+$/,"").replace(/^\/+/,"");a?i=Sv(e,i,l):i=Rm(e,i,l,n.info.name,s);let c=ue.join(t,"assets",l||"");oe.mkdirSync(c,{recursive:!0});let p=ue.join(e,i);if(oe.existsSync(p)&&oe.statSync(p).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),Or(u,p,c,{exclude:s})):Or(u,p,c)}catch(m){u.error(m,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");xv(e,t);let d=null;for(let m of[".json",".jsonc"]){let h=ue.join(e,`clouduser.wrangler${m}`);if(oe.existsSync(h)){d=h;break}}if(d){u.info("including user wrangler config in output..."),oe.copyFileSync(d,ue.join(t,"clouduser.wrangler.json"));let m=ue.join(e,"clouduser","migrations");if(oe.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let h=ue.join(t,"migrations");Or(u,m,h)}}}async function QT(e){let t=`${e}.tar.gz`;try{return await Cv.create({gzip:!0,file:t,cwd:ue.dirname(e)},[ue.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(n){throw new f(n,{prefix:"Failed to create tarball:"})}}Me();De();A();var eP="DUPLICATE_ENVIRONMENT_MOUNT",tP="ENVIRONMENT_MOUNT_MISMATCH",nP="DUPLICATE_ENVIRONMENT_BRANCH",rP="INVALID_MOUNT_PATH_FORMAT",oP="INVALID_PROJECT_ID",iP="DUPLICATE_PROJECT_NAME",sP="MAX_PROJECTS_PER_SITE",Iv={[eP]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[tP]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[nP]:"An environment with this branch already exists for this app.",[rP]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[oP]:"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.",[iP]:"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.",[sP]:"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 Tv(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 Iv)if(n.includes(i))return Iv[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var es=w(require("fs")),Mm=require("child_process"),Ov=w(require("semver"));A();C();M();C();be();A();C();function Qi(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0})}var aP={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 jm(e){return typeof e=="string"&&e.trim()!==""}async function Po(e,t={}){let n=aP[e],{flagValue:r,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??et();if(jm(r))return Qi(r,e),r;let c=process.env[n.env];if(jm(c))return Qi(c,e),c;let p=n.manifest(o??{});if(jm(p))return l||u.info(`Using ${e} from webflow.json`),Qi(p,e),p;if(!a&&s){let m=await s();return Qi(m,e),m}let d=i??n.flagHint;throw new f(`Missing required ${e}. Pass ${d}, set ${n.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:n.missingFlag})}async function Lr(e,t={}){try{return await Po(e,t)}catch(n){if(n instanceof f&&n.missingFlag===e)return;throw n}}C();var lP=/[\x00-\x1f?#%/\\]/;function Nr(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0});if(lP.test(e)||e.includes(".."))throw new f(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function ve(e,t){Nr(e,t)}function cP(e){if(!e)return"unknown";let t=Ov.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var Pv=104857600;function $v(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 uP(){try{let e=(0,Mm.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,Mm.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 Bm(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=Tv(i);throw new Error(s)}return r.json()}async function Lv(e,t,n,r){let{manifest:o}=ee(),i=o.cloud||{},s=i.framework,a=await Lr("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=cP(i.framework_version),c=await dP({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:uP()});return!a&&c.project_id&&(xe({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function dP(e){let{siteId:t,framework:n,frameworkVersion:r,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:p}=e,d={framework:n,framework_version:r,mount_path:o,environment:i,version:s};a&&(d.project_id=a),l&&(d.project_name=l),c&&(d.description=c),p&&(d.app_path=p);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return Bm(e.apiToken,m,{method:"POST",body:d})}async function Nv(e,t){let{siteId:n,accessToken:r}=e,o=n?`/cosmic/${n}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Bm(r,o,{method:"GET"})}async function jv(e){let{siteId:t,accessToken:n}=e,r=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Bm(n,r,{method:"GET"})}async function Mv(e,t){if(!es.existsSync(e))throw new Error(`Tarball not found at ${e}`);let n=es.statSync(e);if(n.size>Pv)throw new Error(`Build output is too large (${$v(n.size)}). Maximum allowed size is ${$v(Pv)}.`);let r=es.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 Bv(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 Uv=require("webflow-api");De();De();C();function Um(e){return new Uv.WebflowClient({accessToken:e,environment:{base:`${P()}/v2`,dataApi:`${P()}/v2`,contentDeliveryApi:`${mi()}/v2`}})}async function Ha(e,t){try{let r=await Um(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 Wm(e,t){try{return{customDomains:(await Um(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 Hm(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 Vm(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 Wv(e,t,n){try{let r=Um(e),o=await Ha(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:"})}}Oe();A();async function Hv(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 Ha(o,r),a=await Wm(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 p=l.map(async g=>{try{let y=await Hm(g),b=Array.isArray(y.cosmic)?y.cosmic.map(_=>_.mountPath).filter(_=>typeof _=="string"):[],S=Vm(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})`)}}),d=await Promise.all(p),m=d.some(g=>!g.isValid),h=d.every(g=>g.isValid);return i.succeed("Mount path validation completed"),{isValid:h,domains:d,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function Vv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)return[];try{let i=await Ha(o,r),s=await Wm(o,r),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(p=>p.url)||[]].map(async p=>{try{let d=await Hm(p),m=Vm(d,t,n);return{domain:p,isValid:m}}catch(d){return u.debug(`Could not verify mount path for ${p}: ${d}`),{domain:p,isValid:!1}}});return(await Promise.all(l)).filter(p=>p.isValid).map(p=>p.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function Gv(e,t){return e.map(n=>`${n.startsWith("localhost")||n.startsWith("127.0.0.1")?"http":"https"}://${n}${t}`)}async function Kv(e){let t=e.map(r=>({name:r,value:r,checked:!0})),n=await vn({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 Jv(){return await $e({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 Gm(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 Ha(r,n)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await Wv(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")}}A();pe();var $o=w(require("path"));Me();De();be();var zv="apps";function Km(e){zv=e}function ts(){return zv}var xu=w(require("fs"));C();De();Oe();C();A();async function ns(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.
145
+ `,h),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:m,outputVolume:g}=await au({libraryIdentifier:o,renderer:r.renderer,framework:r.framework,publicPath:Tn(e.publicPath||pT),sourceVolumes:[a],componentsFiles:s,componentsOptions:f,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:l,failOnWarnings:!e.force,bundler:e.bundler,projectDir:i});t.succeed(),t=u.spinner("Writing to disk"),m.forEach(([h,y])=>{let k=(0,Ar.join)(`/${y}`,`${h.name}`),v=Aa(g.readFileSync(k,"utf8").toString(),k,{bundleEnvironment:y}),F=(0,Ar.join)(i,e.outputPath||dT);gu.default.existsSync((0,Ar.join)(F,`${y}`))||gu.default.mkdirSync((0,Ar.join)(F,`${y}`),{recursive:!0}),gu.default.writeFileSync((0,Ar.join)(F,y,h.name),v.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(r){throw t?.fail(),new d(r)}}R();j();var $a=w(require("fs-extra")),Nm=w(require("path"));R();j();function fT(){try{if(!$a.default.existsSync(At))return null;let e=$a.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:Nm.default.join(At,t),time:$a.default.statSync(Nm.default.join(At,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);if(e.length===0)return null;for(let t of e)try{let n=$a.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 jm(){let e=fT();e&&u.info(`${ki} Latest log: ${e}`),u.info(`${ki} All logs: ${At}`)}async function XE(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(jm)}me();var mT=`${ue("[Deprecated]")} The 'library' commands will be removed in the next major release.`,gT=()=>{u.warn(`${X} ${ue("webflow library share")} is deprecated and will be removed in the next major release.
146
+ Use ${z("webflow devlink import")} instead.
147
+ `)},hT=()=>{u.warn(`${X} ${ue("webflow library bundle")} is deprecated and will be removed in the next major release.
148
+ Use ${z("webflow devlink bundle")} instead.
149
+ `)},yT=()=>{u.warn(`${X} ${ue("webflow library log")} is deprecated and will be removed in the next major release.
150
+ Use ${z("webflow log")} instead.
151
+ `)},wT="Import a library of Code Components into your Webflow Workspace.",bT="Bundle a library of Code Components for local development.",ZE=()=>new $n.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),QE=()=>new $n.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),ev=()=>new $n.Option("--dev","Bundle in development mode for debugging purposes."),tv=()=>new $n.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),kT=()=>new $n.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),DT=()=>new $n.Option("--public-path <path>","Set the public path for the bundle."),ET=()=>new $n.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function Mm(e,t){return e.command(t).description(wT).addOption(Xr()).addOption(ZE()).addOption(QE()).addOption(ev()).addOption(tv()).action(Sa(Om))}function Bm(e,t){return e.command(t).description(bT).addOption(kT()).addOption(DT()).addOption(ET()).addOption(ZE()).addOption(QE()).addOption(ev()).addOption(tv()).action(Sa(Lm))}var rv=e=>{let t=e.command("library").description(mT);Mm(t,"share").description(`${ue("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",gT),Bm(t,"bundle").description(`${ue("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",hT),t.command("log").description(`${ue("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",yT).action(jm)};me();var nv=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${ue("[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(Xr()).addOption(Rt()).action(gD),Mm(t,"import"),Bm(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(Xr()).addOption(Rt()).action(Sa(qc))};var tn=w(require("fs")),qt=w(require("path"));R();Y();var Ce={New:"new",Existing:"existing"},ov="cli",Jt=3,zt=39,hu="astro",iv="cloud-scaffolds";var sv="package.json",yo="webflow.json",yu="wf-placeholder-name",av="CLOUD_MOUNT_PATH",lv="gitignore";function Um(e){return!e.siteId}var Oa=async(e,t,r=hu,n,o,i)=>{try{let s,a;if("content"in n){let l=n.content;s=l.files,a=c=>qt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=n[r];if(!c)throw new Error(`Scaffold "${r}" not found`);s=c;let p=qt.join(iv,r);a=f=>f.split(p)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=qt.join(e,a(l)),p=l.includes("next.config.ts"),f=l.includes("astro.config.mjs"),m=p||f;if(l.includes(yo)&&tn.existsSync(c))continue;if(l.includes(sv)||l.includes(yo)){let h=(await tn.promises.readFile(l,"utf8")).replace(yu,e);await wu(c,h)}else if(m){let g=await tn.promises.readFile(l,"utf8");await wu(c,g.replace(av,t))}else if(qt.basename(c).toLowerCase()===lv){let g=await tn.promises.readFile(l,"utf8"),h=qt.join(qt.dirname(c),".gitignore");await wu(h,g)}else{let g=await tn.promises.readFile(l);await wu(c,g)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Yr({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 wu=async(e,t)=>{try{await tn.promises.mkdir(qt.dirname(e),{recursive:!0}),await tn.promises.writeFile(e,t)}catch(r){throw u.error(`Error writing file ${e}: ${r}`),r}};var On=w(require("fs")),cv=w(require("fs-extra")),Ln=w(require("path")),Km=w(require("os")),uv=w(require("tar"));var et=class extends Error{constructor(r,n,o){super(r);this.scaffoldId=n;this.supportedIds=o;this.name="ScaffoldError"}};var La={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v3"}},"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:"v3"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function Na(e){let t=La[e];if(!t){let r=Object.keys(La);throw new et(`Unsupported framework: "${e}". Supported: ${r.join(", ")}`,e,r)}return t}function Wm(){return Object.keys(La)}function Hm(){return[...new Set(Wm().map(e=>e.replace(/-minimal$/,"")))]}function Vm(){return["astro","nextjs"]}function Gm(e){let r=`${e.replace(/-minimal$/,"")}-minimal`;if(!La[r]){let n=Wm();throw new et(`No minimal scaffold for "${e}". Supported: ${n.join(", ")}`,r,n)}return r}R();qr();var vT="https://github.com";async function Jm(e){let t=e.endsWith("-minimal")?e:Gm(e);return bu(t)}async function bu(e){return Na(e).source.type==="github"?ST(e):dv(e)}async function dv(e){let t=Na(e);if(t.source.type!=="local")throw new et(`Scaffold "${e}" does not have a local source`,e);let r=Ln.isAbsolute(t.source.path)?t.source.path:Ln.join(__dirname,t.source.path);if(!On.existsSync(r))throw new et(`Scaffold directory not found: ${r}`,e);let n=await zm(r);return{scaffoldId:e,files:n,extractionRoot:r}}async function ST(e){let t=Na(e);if(t.source.type!=="github")throw new et(`Scaffold "${e}" does not have a GitHub source`,e);let r=(Ke()?t.source.betaRef:void 0)??t.source.ref??"main",n=`${vT}/${t.source.repo}/archive/${r}.tar.gz`,o=await On.promises.mkdtemp(Ln.join(Km.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 et(`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 et(`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 xT(a,o),l.succeed("Scaffold ready")}catch(g){throw l.fail("Unpack failed"),g}let c=await On.promises.readdir(o),p=c[0];if(!p||c.length!==1)throw new et(`Unexpected tarball structure for ${t.source.repo}`,e);let f=Ln.join(o,p),m=await zm(f);return{scaffoldId:e,files:m,extractionRoot:f}}catch(s){try{cv.default.removeSync(o)}catch{}throw s instanceof et?s:new et(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function xT(e,t){let r=Ln.join(Km.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await On.promises.writeFile(r,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await uv.extract({file:r,cwd:t})}finally{await On.promises.unlink(r).catch(()=>{})}}async function zm(e){let t=[],r=await On.promises.readdir(e,{withFileTypes:!0});for(let n of r){let o=Ln.join(e,n.name);n.isDirectory()?t.push(...await zm(o)):t.push(o)}return t}var Tg=w(require("fs-extra"));Y();Z();hg();el();Pe();ke();R();var c$="DUPLICATE_ENVIRONMENT_MOUNT",u$="ENVIRONMENT_MOUNT_MISMATCH",d$="DUPLICATE_ENVIRONMENT_BRANCH",p$="INVALID_MOUNT_PATH_FORMAT",f$="INVALID_PROJECT_ID",m$="DUPLICATE_PROJECT_NAME",g$="MAX_PROJECTS_PER_SITE",FS={[c$]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[u$]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[d$]:"An environment with this branch already exists for this app.",[p$]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[f$]:"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.",[m$]:"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.",[g$]:"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 _S(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 FS)if(r.includes(i))return FS[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var us=w(require("fs")),kg=require("child_process"),IS=w(require("semver"));R();C();j();C();we();R();C();function cs(e,t){if(!e||e.trim()==="")throw new d(`Invalid ${t}: value is empty.`,{isUserError:!0})}var h$={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 bg(e){return typeof e=="string"&&e.trim()!==""}async function Mo(e,t={}){let r=h$[e],{flagValue:n,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??Xe();if(bg(n))return cs(n,e),n;let c=process.env[r.env];if(bg(c))return cs(c,e),c;let p=r.manifest(o??{});if(bg(p))return l||u.info(`Using ${e} from webflow.json`),cs(p,e),p;if(!a&&s){let m=await s();return cs(m,e),m}let f=i??r.flagHint;throw new d(`Missing required ${e}. Pass ${f}, set ${r.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:r.missingFlag})}async function Hn(e,t={}){try{return await Mo(e,t)}catch(r){if(r instanceof d&&r.missingFlag===e)return;throw r}}C();var y$=/[\x00-\x1f?#%/\\]/;function Vn(e,t){if(!e||e.trim()==="")throw new d(`Invalid ${t}: value is empty.`,{isUserError:!0});if(y$.test(e)||e.includes(".."))throw new d(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function ve(e,t){Vn(e,t)}function w$(e){if(!e)return"unknown";let t=IS.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var AS=104857600;function RS(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 b$(){try{let e=(0,kg.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,kg.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 Dg(e,t,r){let n=await fetch(`${O()}${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=_S(i);throw new Error(s)}return n.json()}async function TS(e,t,r,n){let{manifest:o}=oe(),i=o.cloud||{},s=i.framework,a=await Hn("appId",{flagValue:n?.appId,manifest:o});if(!s)throw new d("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=w$(i.framework_version),c=await k$({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:b$()});return!a&&c.project_id&&(Se({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function k$(e){let{siteId:t,framework:r,frameworkVersion:n,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:p}=e,f={framework:r,framework_version:n,mount_path:o,environment:i,version:s};a&&(f.project_id=a),l&&(f.project_name=l),c&&(f.description=c),p&&(f.app_path=p);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return Dg(e.apiToken,m,{method:"POST",body:f})}async function PS(e,t){let{siteId:r,accessToken:n}=e,o=r?`/cosmic/${r}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Dg(n,o,{method:"GET"})}async function $S(e){let{siteId:t,accessToken:r}=e,n=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Dg(r,n,{method:"GET"})}async function OS(e,t){if(!us.existsSync(e))throw new Error(`Tarball not found at ${e}`);let r=us.statSync(e);if(r.size>AS)throw new Error(`Build output is too large (${RS(r.size)}). Maximum allowed size is ${RS(AS)}.`);let n=us.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 d(l,{prefix:`${D} Upload failed with response:`})}}async function LS(e,t){if(!e||e==="undefined")throw new d("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 d(`Failed to trigger deployment: ${n.status} ${n.statusText}`)}var NS=require("webflow-api");ke();ke();C();function Eg(e){return new NS.WebflowClient({accessToken:e,environment:{base:`${O()}/v2`,dataApi:`${O()}/v2`,contentDeliveryApi:`${Di()}/v2`}})}async function rl(e,t){try{let n=await Eg(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 d(r,{prefix:"Error fetching site details:"})}}async function vg(e,t){try{return{customDomains:(await Eg(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new d(r,{prefix:"Error fetching custom domains:"})}}async function Sg(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 d(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function xg(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 jS(e,t,r){try{let n=Eg(e),o=await rl(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 d(n,{prefix:"Error publishing site:"})}}Oe();R();async function MS(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 rl(o,n),a=await vg(o,n),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(h=>h.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let p=l.map(async h=>{try{let y=await Sg(h),k=Array.isArray(y.cosmic)?y.cosmic.map(F=>F.mountPath).filter(F=>typeof F=="string"):[],v=xg(y,t,r);return{domain:h,mountPaths:k,isValid:v===!0}}catch(y){return{domain:h,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})`)}}),f=await Promise.all(p),m=f.some(h=>!h.isValid),g=f.every(h=>h.isValid);return i.succeed("Mount path validation completed"),{isValid:g,domains:f,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function BS(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)return[];try{let i=await rl(o,n),s=await vg(o,n),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(p=>p.url)||[]].map(async p=>{try{let f=await Sg(p),m=xg(f,t,r);return{domain:p,isValid:m}}catch(f){return u.debug(`Could not verify mount path for ${p}: ${f}`),{domain:p,isValid:!1}}});return(await Promise.all(l)).filter(p=>p.isValid).map(p=>p.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function US(e,t){return e.map(r=>`${r.startsWith("localhost")||r.startsWith("127.0.0.1")?"http":"https"}://${r}${t}`)}async function WS(e){let t=e.map(n=>({name:n,value:n,checked:!0})),r=await Cr({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 HS(){return await $e({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 Cg(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 rl(n,r)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await jS(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")}}R();me();var Uo=w(require("path"));Pe();ke();we();var VS="apps";function Fg(e){VS=e}function ds(){return VS}var Gu=w(require("fs"));C();ke();Oe();C();R();async function ps(e){let t=await fetch(`${O()}/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 d(`Missing required scopes for workspace access.
152
152
  ${o.message??""}
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 rs(e){if(e.length===1)return e[0];let t=await Be({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])}Sc();M();A();M();pe();async function Jm(e,t){u.warn(`${re} ${le("webflow cloud create")} is deprecated and will be removed in the next major release.
155
- Use ${J("webflow cloud init")} instead.
156
- `);let{framework:n}=t;if(!(await os()).find(i=>i===n)){u.error(`Framework ${n} not found`);return}await Su(e,"/app",n,void 0,Fe.Existing,void 0)}A();pe();M();Vn();async function zm(){let e=Je()?"webflow apps init":"webflow cloud init",t=Je()?`
157
- To list your Cloud apps, use ${J("webflow apps list")}.`:"";u.warn(`${re} ${le("webflow cloud list")} is deprecated and will be removed in the next major release.
153
+ Re-run 'webflow auth login' to grant the necessary permissions.`):new d(`Failed to fetch workspaces: ${t.status} ${t.statusText}`+(o.message?`
154
+ ${o.message}`:""))}return(await t.json()).workspaces}async function fs(e){if(e.length===1)return e[0];let t=await je({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])}Yc();j();R();j();me();async function _g(e,t){u.warn(`${X} ${ue("webflow cloud create")} is deprecated and will be removed in the next major release.
155
+ Use ${z("webflow cloud init")} instead.
156
+ `);let{framework:r}=t;if(!(await ms()).find(i=>i===r)){u.error(`Framework ${r} not found`);return}await Vu(e,"/app",r,void 0,Ce.Existing,void 0)}R();me();j();qr();async function Ag(){let e=Ke()?"webflow apps init":"webflow cloud init",t=Ke()?`
157
+ To list your Cloud apps, use ${z("webflow apps list")}.`:"";u.warn(`${X} ${ue("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 ${J(`${e} --framework`)} / ${J("--help")} for available templates.${t}
160
- `);let n=await os();u.info("Available app templates:"),n.length>0?n.forEach(r=>u.info(`- ${r}`)):u.info("No templates found.")}q();C();be();Oe();A();M();var qv=w(require("path"));function jr(e){if(!e||e.trim()==="")return"/";let t=qv.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 Va(e){return!(!e||e.trim()===""||!e.startsWith("/")||e.includes(".."))}pe();A();M();function Ga(e,t){u.warn(`${re} ${le(e)} is deprecated; use ${J(t)} instead.`)}async function qm(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&&Ga("--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&&sn()&&(r=await T());let o=!1;if(r&&!e.new&&!e.siteId)try{(await wr(r)).length===0&&(u.info(`${Ce} 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 os(),s={};if(n&&sn()){if(!e.new&&!o&&(s.initMode=await Be({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:Fe.New},{name:"Existing site",value:Fe.Existing}],default:Fe.New})),e?.framework||(s.scaffoldName=await Be({message:"Which framework would you like to use?",choices:i.map(g=>({name:g,value:g})),default:"astro"})),!t){let g=await Ke({message:"What would you like to name your app?",validate:y=>{let b=y.trim();return b===""?"App name cannot be empty":b.length<Xn||b.length>Yn?`App name must be between ${Xn} and ${Yn} 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===Fe.New;if(!e.mount&&!h){let g=await Ke({message:"What path do you want to use locally? (e.g., /app)",default:"/app"});s.mountPath=jr(g)}}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?Fe.New:s.initMode??(e.siteId?Fe.Existing:V()?Fe.New:Fe.Existing),p=c===Fe.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",d=e.siteId,m=jr(p);if(!a||typeof a!="string"||a.trim()==="")throw new f("--app-name cannot be empty");if(a.length<Xn||a.length>Yn)throw new f(`--app-name must be between ${Xn} and ${Yn} characters`);if(!l)throw new f("--framework is required");if(!i.includes(l)){let h=i.join(`
161
- - `);throw new f(`--framework "${l}" not found
159
+ Use ${z(`${e} --framework`)} / ${z("--help")} for available templates.${t}
160
+ `);let r=await ms();u.info("Available app templates:"),r.length>0?r.forEach(n=>u.info(`- ${n}`)):u.info("No templates found.")}Y();C();we();Oe();R();j();var GS=w(require("path"));function dn(e){if(!e||e.trim()==="")return"/";let t=GS.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}var D$=/^\/([a-zA-Z0-9_.~-]+(\/[a-zA-Z0-9_.~-]+)*)?$/;function Bo(e){return!e||e.trim()===""||!e.startsWith("/")||e.includes("..")?!1:D$.test(e)}me();R();j();function nl(e,t){u.warn(`${X} ${ue(e)} is deprecated; use ${z(t)} instead.`)}async function Rg(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new d("--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&&nl("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new d("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new d("--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&&lr()&&(n=await T());let o=!1;if(n&&!e.new&&!e.siteId)try{(await xn(n)).length===0&&(u.info(`${xe} 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 ms(),s={};if(r&&lr()){if(!e.new&&!o&&(s.initMode=await je({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:Ce.New},{name:"Existing site",value:Ce.Existing}],default:Ce.New})),e?.framework||(s.scaffoldName=await je({message:"Which framework would you like to use?",choices:i.map(h=>({name:h,value:h})),default:"astro"})),!t){let h=await Ge({message:"What would you like to name your app?",validate:y=>{let k=y.trim();return k===""?"App name cannot be empty":k.length<Jt||k.length>zt?`App name must be between ${Jt} and ${zt} characters`:!0}});if(h==null)throw new d("When --no-input mode is enabled please provide the --app-name option.");s.appName=h}let g=e.new||o||s.initMode===Ce.New;!e.mount&&!g&&(s.mountPath=await Ge({message:"What path do you want to use locally? (e.g., /app)",default:"/app"}))}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?Ce.New:s.initMode??(e.siteId?Ce.Existing:V()?Ce.New:Ce.Existing),p=c===Ce.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",f=e.siteId,m=dn(p);if(!a||typeof a!="string"||a.trim()==="")throw new d("--app-name cannot be empty");if(a.length<Jt||a.length>zt)throw new d(`--app-name must be between ${Jt} and ${zt} characters`);if(!l)throw new d("--framework is required");if(!i.includes(l)){let g=i.join(`
161
+ - `);throw new d(`--framework "${l}" not found
162
162
 
163
163
  Available frameworks:
164
- - ${h}`)}if(typeof m!="string"||!Va(m))throw new f("Invalid mount path: "+m);if(c===Fe.Existing&&!d&&(!n||V()))throw new f("--site-id is required when connecting to an existing site in non-interactive mode.");await Su(a,m,l,d,c,e.workspaceId)}var tS=w(require("path"));q();C();be();Oe();A();M();Me();X();var Xv=require("crypto");De();C();async function Yv(e){let{accessToken:t,workspaceId:n,displayName:r,description:o,appPath:i}=e,a={requestId:(0,Xv.randomUUID)(),cloudApp:{displayName:r,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:_E}}}},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 p=await c.text();throw pP(c.status,c.statusText,p)}return c.json()}function pP(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(fP(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 fP(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}Me();C();be();Oe();q();async function eS(e={}){mP(e);let t=await gP(e,ee().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:ee().manifest}}function mP(e){if(e.siteId&&e.workspaceId)throw new f("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function gP(e,t){if(e.siteId)return Zv(t,e.siteId);if(e.workspaceId)return Qv(e.workspaceId);let n=await Lr("siteId",{manifest:t});if(n)return Zv(t,n);let r=await Lr("workspaceId",{manifest:t});if(r)return Qv(r);if(V()||!sn())throw new f(`No identity configured for this app.
164
+ - ${g}`)}if(typeof m!="string"||!Bo(m))throw new d(`Invalid mount path: ${JSON.stringify(p)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`);if(c===Ce.Existing&&!f&&(!r||V()))throw new d("--site-id is required when connecting to an existing site in non-interactive mode.");await Vu(a,m,l,f,c,e.workspaceId)}var XS=w(require("path"));Y();C();we();Oe();R();j();Pe();Z();el();var KS=require("crypto");ke();C();async function JS(e){let{accessToken:t,workspaceId:r,displayName:n,description:o,appPath:i}=e,a={requestId:(0,KS.randomUUID)(),cloudApp:{displayName:n,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:ov}}}},l=`${O()}/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 p=await c.text();throw E$(c.status,c.statusText,p)}return c.json()}function E$(e,t,r){let n={};try{n=JSON.parse(r)}catch{}return e===403?n.publicErrorCode==="missing_scopes"?new d(`Missing required scopes to create a Cloud app.
165
+ ${n.msg??""}
166
+ Re-run 'webflow auth login' to grant the necessary permissions.`):new d(n.msg??"You don't have permission to create apps in this workspace."):e===404?new d("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 d(v$(n.planName,n.limit)):n.msg?.includes("No new sites can be created")?new d(`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 d(n.msg??"A Cloud app creation request is already being processed. Please wait and try again."):new d(`Failed to create app: ${e} ${t}`+(n.msg?`
168
+ ${n.msg}`:""))}function v$(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}Pe();C();we();Oe();Y();async function YS(e={}){S$(e);let t=await x$(e,oe().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:oe().manifest}}function S$(e){if(e.siteId&&e.workspaceId)throw new d("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function x$(e,t){if(e.siteId)return zS(t,e.siteId);if(e.workspaceId)return qS(e.workspaceId);let r=await Hn("siteId",{manifest:t});if(r)return zS(t,r);let n=await Hn("workspaceId",{manifest:t});if(n)return qS(n);if(V()||!lr())throw new d(`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 yP(t)}async function Zv(e,t){return{credentials:await ze(e,{site:t})}}async function Qv(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function hP(){let e=await T(),t=await ns(e);if(t.length===0)throw new br("No workspaces found in your account. Please make sure you have at least one workspace.");let n=await rs(t);return xe({cloud:{workspace_id:n.id}}),{workspaceId:n.id,credentials:{accessToken:e,siteId:""}}}async function yP(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"?hP():{credentials:await ze(e,{})}}async function Xm(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&&Ga("--project-name","--app-name"),e.projectId!==void 0&&Ga("--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(!Ba.includes(e.framework))throw new f(`Framework "${e.framework}" is not supported. Allowed: ${Ba.join(", ")}.`);xe({cloud:{framework:e.framework}})}let r=await eS({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=r,{credentials:i,manifest:s}=r,a=!!o;if(o){let g=tS.default.basename(process.cwd()).trim(),y=g.length>=Xn&&g.length<=Yn,b=t??(y?g:"Cloud App");if(b.length<Xn||b.length>Yn)throw new f(`App name must be between ${Xn} and ${Yn} characters (got ${b.length}).
177
- Use --app-name to provide a valid name.`);let S=u.spinner("Creating Cloud app...");try{let v=await Yv({accessToken:i.accessToken,workspaceId:o,displayName:b});S.succeed(`Cloud app created: ${v.cloudApp.displayName}`),xe({siteId:v.cloudApp.siteId,cloud:{...s.cloud,app_id:v.cloudApp.project.id,environment_id:v.cloudApp.environment.id}}),Gn({siteId:v.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=v.cloudApp.siteId,{manifest:s}=ee()}catch(v){throw S.fail("Failed to create app"),new f(v,{prefix:"Could not create app:"})}let _=s.siteId;if(!_)throw new f("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:_}}let l;try{l=F.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(g){u.debug(`Failed to initialize telemetry: ${g}`)}let c=await Lr("appId",{flagValue:n,manifest:s}),p,d,m=t,h=e.description;if(e.environment&&e.mount){if(p=e.environment,d=jr(e.mount),!Va(d))throw new f("Invalid mount path: "+d)}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 jv(i);if(b.projects.length>0){let S=await Be({message:"Select an app to deploy to:",choices:[...b.projects.map(_=>({name:`${_.name} (${_.description||"No description"})`,value:_.id})),{name:"Create new app",value:null}]});S?(c=S,xe({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 Ke({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 Nv(i,c)).environments.map(_=>({name:`${_.branch} (${_.mount})`,value:{branch:_.branch,mount:_.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 Be({message:"Select an environment to deploy to:",choices:g});if(y)p=y.branch,d=jr(y.mount);else if(e.environment?p=e.environment:p=await Ke({message:"What environment would you like to deploy to?",default:"main",validate:b=>b.trim()===""?"Environment cannot be empty":!0}),e.mount)d=jr(e.mount);else{let b=await Ke({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"});d=jr(b)}}if(!Va(d))throw new f("Invalid mount path: "+d);await nS(i,p,d,{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 Ka=null;process.once("exit",()=>Ka?.());var rS=(e,t,n)=>t instanceof io?"no-sites":t instanceof br?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&n===Fe.New?"no-workspaces":"unknown",os=async()=>{try{let e=bm(),t=Dm();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},wP=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(uo));if(!o)throw new Error(`No ${uo} found in scaffold "${t}"`);await xu.promises.mkdir(e,{recursive:!0});let s=(await xu.promises.readFile(o,"utf8")).replace(iu,e),a=$o.join(e,uo);await xu.promises.writeFile(a,s,"utf8")},Su=async(e,t,n=ou,r,o=Fe.Existing,i)=>{if(o===Fe.New){try{let s=await vm(n);await bP(e,t,s.scaffoldId,{content:s},n,i)}catch(s){if(s instanceof tt){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 au(n);await DP(e,t,n,{content:s},r)}catch(s){if(s instanceof tt){let a=s.message;throw s.supportedIds?.length&&(a+=`
180
- Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}},bP=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?$o.dirname(a.extractionRoot):null,c="auth",p=!1,d=!1,m=null;try{let h=Date.now(),g=await T();c="workspaces";let y;if(i)y={id:i};else{let _=await ns(g);if(_.length===0)throw new br("No workspaces found in your account. Please make sure you have at least one workspace.");y=await rs(_)}c="scaffold",await Sa(e,t,n,r,void 0,void 0),d=!0,process.chdir(s);let b=o??n;xe({cloud:{framework:b,workspace_id:y.id}}),Gn({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:Fe.New,workspaceId:y.id,totalDuration:S,mountPath:t,namespace:ts()})}catch{}p=!0}catch(h){if(m=h,h instanceof f||h instanceof Error&&h.message.includes("OAuth")){try{await Sa(e,t,n,r),process.chdir(s),xe({cloud:{framework:o??n}}),Gn({directory:"."}),d=!0}catch{}throw u.error(h),new f(h,{skipLogging:!0})}throw h}finally{if(l)try{Ym.default.removeSync(l)}catch{}if(p){let h=iS(e,Fe.New);Ka=()=>u.info(h)}else{let h=rS(c,m,Fe.New),g=sS(e,Fe.New,h,d);Ka=()=>u.info(g)}}},DP=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?$o.dirname(l.extractionRoot):null,p="auth",d=!1,m=!1,h=null;try{let g=Date.now();await wP(e,n,r),process.chdir(i);let{manifest:y}=ee(),b=await ze(y,{site:o}),S=b.accessToken,_=b.siteId;if(s=F.forCloud({authToken:S,siteId:_}),p="scaffold",await Sa(".",t,n,r,_,S),m=!0,p="devlink",_){u.info(`${Ce} Running devlink export to fetch your Webflow components`);try{await kP({site:_,apiToken:S}),a=!0}catch(x){ao(x)?u.info(`${Ce} 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:ts()}),d=!0}catch(g){h=g,u.error(g);try{await Sa(".",t,n,r),m=!0}catch{}throw new f(g,{skipLogging:!0})}finally{if(c)try{Ym.default.removeSync(c)}catch{}if(d){let g=iS(e,Fe.Existing);Ka=()=>u.info(g)}else{let g=rS(p,h,Fe.Existing),y=sS(e,Fe.Existing,g,m);Ka=()=>u.info(y)}}},kP=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(Sc(),HD));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},EP=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=ee();return ym(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},vP=async(e,t,n,r)=>{u.info(je("Validating mount path configuration..."));let o=await Hv(e,t,n);if(o.isValid)u.info(J("Mount path validation passed"));else if(u.info(I(`
181
- Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?$:re,a=i.isValid?J(`${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 Gm(e,i)}else if(await Jv()&&sn()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await Kv(s);await Gm(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},SP=async(e,t,n,r)=>{Lm("\u{1F3D7}\uFE0F ","Building app");let o=await _v(e,{mountPath:n,telemetry:r?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id});Lm("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await Mv(o,t.upload_url);let s=Date.now()-i;return u.info(`${$} Upload completed in ${(s/1e3).toFixed(1)}s`),o},xP=async(e,t,n,r)=>{u.success(`
182
- \u{1F310} Your cloud app will soon be available at:`);try{let o=r?.domainsOverride??await Vv(e,t,n),i=Gv(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}`)}},CP=e=>{e.site_slug?u.success(`Visit your deployment:
176
+ Or run 'webflow cloud init' to scaffold a new app.`);return F$(t)}async function zS(e,t){return{credentials:await Je(e,{site:t})}}async function qS(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function C$(){let e=await T(),t=await ps(e);if(t.length===0)throw new Cn("No workspaces found in your account. Please make sure you have at least one workspace.");let r=await fs(t);return Se({cloud:{workspace_id:r.id}}),{workspaceId:r.id,credentials:{accessToken:e,siteId:""}}}async function F$(e){let t=await je({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 d("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?C$():{credentials:await Je(e,{})}}async function Ig(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new d("--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 d("--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&&nl("--project-name","--app-name"),e.projectId!==void 0&&nl("--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(y){throw u.error(`Error: Could not change to directory ${e.directory}`),new d(y)}if(e.framework){if(!Za.includes(e.framework))throw new d(`Framework "${e.framework}" is not supported. Allowed: ${Za.join(", ")}.`);Se({cloud:{framework:e.framework}})}let n=await YS({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=n,{credentials:i,manifest:s}=n,a=!!o;if(o){let y=XS.default.basename(process.cwd()).trim(),k=y.length>=Jt&&y.length<=zt,v=t??(k?y:"Cloud App");if(v.length<Jt||v.length>zt)throw new d(`App name must be between ${Jt} and ${zt} characters (got ${v.length}).
177
+ Use --app-name to provide a valid name.`);let F=u.spinner("Creating Cloud app...");try{let S=await JS({accessToken:i.accessToken,workspaceId:o,displayName:v});F.succeed(`Cloud app created: ${S.cloudApp.displayName}`),Se({siteId:S.cloudApp.siteId,cloud:{...s.cloud,app_id:S.cloudApp.project.id,environment_id:S.cloudApp.environment.id}}),Yr({siteId:S.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=S.cloudApp.siteId,{manifest:s}=oe()}catch(S){throw F.fail("Failed to create app"),new d(S,{prefix:"Could not create app:"})}let E=s.siteId;if(!E)throw new d("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:E}}let l;try{l=_.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(y){u.debug(`Failed to initialize telemetry: ${y}`)}let c=await Hn("appId",{flagValue:r,manifest:s}),p,f,m,g=t,h=e.description;if(e.environment&&e.mount){if(p=e.environment,m=e.mount,f=dn(e.mount),!Bo(f))throw new d(`Invalid mount path: ${JSON.stringify(m)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`)}else{let y=[];if(!c){if(!g&&V())throw new d("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 v=await $S(i);if(v.projects.length>0){let F=await je({message:"Select an app to deploy to:",choices:[...v.projects.map(E=>({name:`${E.name} (${E.description||"No description"})`,value:E.id})),{name:"Create new app",value:null}]});F?(c=F,Se({cloud:{app_id:F}}),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(v){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(v instanceof Error?v.message:String(v))}}if(!c&&!g&&(g=await Ge({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:v=>v.trim()===""?"App name cannot be empty":!0})),c)try{let F=(await PS(i,c)).environments.map(E=>({name:`${E.branch} (${E.mount})`,value:{branch:E.branch,mount:E.mount}}));y.push(...F)}catch(v){throw new d(v,{prefix:"Error fetching app environments:"})}y.push({name:"Create new environment",value:null});let k=await je({message:"Select an environment to deploy to:",choices:y});k?(p=k.branch,m=k.mount,f=dn(k.mount)):(e.environment?p=e.environment:p=await Ge({message:"What environment would you like to deploy to?",default:"main",validate:v=>v.trim()===""?"Environment cannot be empty":!0}),e.mount?(m=e.mount,f=dn(e.mount)):(m=await Ge({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"}),f=dn(m)))}if(!Bo(f))throw new d(`Invalid mount path: ${JSON.stringify(m)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`);await ZS(i,p,f,{projectName:g,description:h,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new d(t,{prefix:"Error during deployment setup:"})}}var ol=null;process.once("exit",()=>ol?.());var QS=(e,t,r)=>t instanceof po?"no-sites":t instanceof Cn?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&r===Ce.New?"no-workspaces":"unknown",ms=async()=>{try{let e=Hm(),t=Vm();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},_$=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(yo));if(!o)throw new Error(`No ${yo} found in scaffold "${t}"`);await Gu.promises.mkdir(e,{recursive:!0});let s=(await Gu.promises.readFile(o,"utf8")).replace(yu,e),a=Uo.join(e,yo);await Gu.promises.writeFile(a,s,"utf8")},Vu=async(e,t,r=hu,n,o=Ce.Existing,i)=>{if(o===Ce.New){try{let s=await Jm(r);await A$(e,t,s.scaffoldId,{content:s},r,i)}catch(s){if(s instanceof et){let a=s.message;throw s.supportedIds?.length&&(a+=`
179
+ Available frameworks: ${s.supportedIds.join(", ")}`),new d(a)}throw s}return}try{let s=await bu(r);await R$(e,t,r,{content:s},n)}catch(s){if(s instanceof et){let a=s.message;throw s.supportedIds?.length&&(a+=`
180
+ Available frameworks: ${s.supportedIds.join(", ")}`),new d(a)}throw s}},A$=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?Uo.dirname(a.extractionRoot):null,c="auth",p=!1,f=!1,m=null;try{let g=Date.now(),h=await T();c="workspaces";let y;if(i)y={id:i};else{let F=await ps(h);if(F.length===0)throw new Cn("No workspaces found in your account. Please make sure you have at least one workspace.");y=await fs(F)}c="scaffold",await Oa(e,t,r,n,void 0,void 0),f=!0,process.chdir(s);let k=o??r;Se({cloud:{framework:k,workspace_id:y.id}}),Yr({apiToken:h,directory:"."}),process.env.WEBFLOW_API_TOKEN=h;let v=Date.now()-g;try{await _.forCloud({authToken:h}).sendUsage("project_init",{scaffold:k,scaffoldName:k,initMode:Ce.New,workspaceId:y.id,totalDuration:v,mountPath:t,namespace:ds()})}catch{}p=!0}catch(g){if(m=g,g instanceof d||g instanceof Error&&g.message.includes("OAuth")){try{await Oa(e,t,r,n),process.chdir(s),Se({cloud:{framework:o??r}}),Yr({directory:"."}),f=!0}catch{}throw u.error(g),new d(g,{skipLogging:!0})}throw g}finally{if(l)try{Tg.default.removeSync(l)}catch{}if(p){let g=tx(e,Ce.New);ol=()=>u.info(g)}else{let g=QS(c,m,Ce.New),h=rx(e,Ce.New,g,f);ol=()=>u.info(h)}}},R$=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?Uo.dirname(l.extractionRoot):null,p="auth",f=!1,m=!1,g=null;try{let h=Date.now();await _$(e,r,n),process.chdir(i);let{manifest:y}=oe(),k=await Je(y,{site:o}),v=k.accessToken,F=k.siteId;if(s=_.forCloud({authToken:v,siteId:F}),p="scaffold",await Oa(".",t,r,n,F,v),m=!0,p="devlink",F){u.info(`${xe} Running devlink export to fetch your Webflow components`);try{await I$({site:F,apiToken:v}),a=!0}catch(S){mo(S)?u.info(`${xe} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(S,{prefix:"Failed to run devlink export:"})}}let E=Date.now()-h;await s?.sendUsage("project_init",{scaffold:r,scaffoldName:r,devlinkSyncStatus:a,totalDuration:E,mountPath:t,namespace:ds()}),f=!0}catch(h){g=h,u.error(h);try{await Oa(".",t,r,n),m=!0}catch{}throw new d(h,{skipLogging:!0})}finally{if(c)try{Tg.default.removeSync(c)}catch{}if(f){let h=tx(e,Ce.Existing);ol=()=>u.info(h)}else{let h=QS(p,g,Ce.Existing),y=rx(e,Ce.Existing,h,m);ol=()=>u.info(y)}}},I$=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(Yc(),OD));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},T$=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=oe();return Um(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},P$=async(e,t,r,n)=>{u.info(Ne("Validating mount path configuration..."));let o=await MS(e,t,r);if(o.isValid)u.info(z("Mount path validation passed"));else if(u.info(P(`
181
+ Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?$:X,a=i.isValid?z(`${i.domain} (mountPath: ${i.mountPaths[0]})`):ue(`${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 Cg(e,i)}else if(await HS()&&lr()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await WS(s);await Cg(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},$$=async(e,t,r,n)=>{yg("\u{1F3D7}\uFE0F ","Building app");let o=await SS(e,{mountPath:r,telemetry:n?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id,serverBuildEngine:t.build_engine});yg("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await OS(o,t.upload_url);let s=Date.now()-i;return u.info(`${$} Upload completed in ${(s/1e3).toFixed(1)}s`),o},O$=async(e,t,r,n)=>{u.success(`
182
+ \u{1F310} Your cloud app will soon be available at:`);try{let o=n?.domainsOverride??await BS(e,t,r),i=US(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}`)}},L$=e=>{e.site_slug?u.success(`Visit your deployment:
183
+
184
+ ${xr()}/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`)},N$=async(e,t,r,n,o)=>{try{if(await LS(t.completion_url,!!n),n)u.error(`
186
+ ${D} Deployment failed due to build error.`);else{u.success(`
187
+ ${$} Deployment triggered successfully!`);let i;try{let{manifest:s}=oe();Um(s)&&(i=[`${o?.projectName??Uo.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 O$(e,r,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),L$(t)}}catch(i){throw new d(i,{prefix:"Failed to trigger deployment:"})}},j$=(e,t)=>{e&&CS(process.cwd(),e),t&&xS(t)},ZS=async(e,t,r,n)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=wg(process.cwd()),p=n?.telemetry;await p?.sendUsage("cloud_deploy_start",{environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,cloudflareBindings:c,namespace:ds()});try{sS(u,process.cwd()),o=await TS(e,t,r,n),u.info("\u{1F527} Detecting framework..."),a=await vS(process.cwd(),o.deploy_url,o.environment_id,r,o.build_engine),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),T$(n)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await P$(e,r,o.environment_id,n?.autoPublish),i=await $$(a,o,r,n),u.info(`Starting deployment process for environment: ${t} at mount path: ${r}`);let f=Date.now()-s;await p?.sendUsage("cloud_deploy_success",{duration:f,environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:ds()})}catch(f){l=f instanceof Error?f:new Error(String(f)),u.error(l,{prefix:"Error during deployment initialization:"});let m=Date.now()-s;await p?.sendError(l,"cloud_deploy_failure",{duration:m,environment:t,mountPath:r,projectName:n?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:ds()})}finally{if(j$(a,i),o&&await N$(e,o,r,l,{projectName:n?.projectName}),l)throw new d(l,{skipLogging:!0})}},ex=e=>{let t=Math.max(...e.map(i=>bt(i).length)),r=P(`\u250C${"\u2500".repeat(t+2)}\u2510`),n=P(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-bt(i).length);return`${P("\u2502")} ${i}${s} ${P("\u2502")}`});return[r,...o,n].join(`
188
+ `)},tx=(e,t)=>{let r=[_t(`${rt} Get started with the following commands:`),z(`cd ${e}`),z("npm install"),z("npm run dev"),z("webflow cloud deploy")];return t!==Ce.New&&(r.push(""),r.push(_t(`${rt} Run the following command to export Webflow components when they update:`)),r.push(z("webflow devlink export"))),ex(r)},rx=(e,t,r,n=!0)=>{let o=[],i=t===Ce.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?[z(`cd ${e}`)]:[];switch(r){case"auth":o.push(_t(`${rt} ${s("Webflow authentication did not complete.")}`),"",_t(n?"To finish setup:":"To retry:"),...a,z("webflow auth login"),z(i));break;case"no-sites":o.push(_t(`${rt} ${s("no Webflow sites were found in your account.")}`),"",_t(n?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,z("webflow cloud init"));break;case"no-workspaces":o.push(_t(`${rt} ${s("no Webflow workspaces were found in your account.")}`),"",_t(n?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,z("webflow cloud init --new"));break;default:o.push(_t(`${rt} ${s("setup did not complete.")}`),"",_t(n?"To retry setup:":"To retry:"),...a,z(i));break}return ex(o)};j();qr();var pn=require("commander");Y();C();R();j();Z();ke();C();lt();lt();C();async function il(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 K(a.toString(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!l.ok)throw new d(`${n}: ${l.status} ${l.statusText}`);let c=await l.json(),p=c[r]??[];o.push(...p);let f=c.pagination?.total??p.length;if(i+=p.length,i>=f||p.length<s)break}return o}function Gn(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 M$=100;async function gs(e,t){let r=[],n=t?.maxPages??M$,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(r.push(...a),s+=1,t?.stopWhen?.(r)||!l)break;if(o.has(l))throw new d("Pagination aborted: the server returned a repeated cursor, which would loop indefinitely.");if(o.add(l),s>=n)throw new d(`Pagination aborted after ${n} pages (safety cap). The result set is larger than expected.`);i=l}return r}C();var nx="GITHUB_APP_NOT_INSTALLED",ox="GITHUB_REPO_NOT_CONNECTED",hs=class extends d{code;installUrl;constructor(t,{code:r,installUrl:n}){super(t,{isUserError:!0}),this.name="GithubConnectionError",this.code=r,this.installUrl=n}};function B$(e){let t=e.meta,r=e.extras,n=t?.installUrl??e.installUrl??r?.installUrl;if(typeof n=="string")try{let o=new URL(n);return o.protocol==="https:"&&o.hostname==="github.com"?n:void 0}catch{return}}function ix(e,t){return new RegExp(`\\b${t}\\b`).test(e)}function sx(e){if(!e||typeof e!="object")return null;let t=e,r=t.message??t.msg;if(typeof r!="string")return null;let n=B$(t),o=n?`
183
189
 
184
- ${En()}/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`)},FP=async(e,t,n,r,o)=>{try{if(await Bv(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}=ee();ym(s)&&(i=[`${o?.projectName??$o.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 xP(e,n,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),CP(t)}}catch(i){throw new f(i,{prefix:"Failed to trigger deployment:"})}},_P=(e,t)=>{e&&Rv(process.cwd(),e),t&&Av(t)},nS=async(e,t,n,r)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=Nm(process.cwd()),p=r?.telemetry;await p?.sendUsage("cloud_deploy_start",{environment:t,mountPath:n,projectName:r?.projectName,hasDescription:!!r?.description,hasDirectory:!!r?.directory,cloudflareBindings:c,namespace:ts()});try{yv(u,process.cwd()),o=await Lv(e,t,n,r),u.info("\u{1F527} Detecting framework..."),a=await Fv(process.cwd(),o.deploy_url,o.environment_id,n),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),EP(r)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await vP(e,n,o.environment_id,r?.autoPublish),i=await SP(a,o,n,r),u.info(`Starting deployment process for environment: ${t} at mount path: ${n}`);let d=Date.now()-s;await p?.sendUsage("cloud_deploy_success",{duration:d,environment:t,mountPath:n,projectName:r?.projectName,hasDescription:!!r?.description,hasDirectory:!!r?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:ts()})}catch(d){l=d instanceof Error?d:new Error(String(d)),u.error(l,{prefix:"Error during deployment initialization:"});let m=Date.now()-s;await p?.sendError(l,"cloud_deploy_failure",{duration:m,environment:t,mountPath:n,projectName:r?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:ts()})}finally{if(_P(a,i),o&&await FP(e,o,n,l,{projectName:r?.projectName}),l)throw new f(l,{skipLogging:!0})}},oS=e=>{let t=Math.max(...e.map(i=>wt(i).length)),n=I(`\u250C${"\u2500".repeat(t+2)}\u2510`),r=I(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-wt(i).length);return`${I("\u2502")} ${i}${s} ${I("\u2502")}`});return[n,...o,r].join(`
188
- `)},iS=(e,t)=>{let n=[_t(`${at} Get started with the following commands:`),J(`cd ${e}`),J("npm install"),J("npm run dev"),J("webflow cloud deploy")];return t!==Fe.New&&(n.push(""),n.push(_t(`${at} Run the following command to export Webflow components when they update:`)),n.push(J("webflow devlink export"))),oS(n)},sS=(e,t,n,r=!0)=>{let o=[],i=t===Fe.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?[J(`cd ${e}`)]:[];switch(n){case"auth":o.push(_t(`${at} ${s("Webflow authentication did not complete.")}`),"",_t(r?"To finish setup:":"To retry:"),...a,J("webflow auth login"),J(i));break;case"no-sites":o.push(_t(`${at} ${s("no Webflow sites were found in your account.")}`),"",_t(r?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,J("webflow cloud init"));break;case"no-workspaces":o.push(_t(`${at} ${s("no Webflow workspaces were found in your account.")}`),"",_t(r?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,J("webflow cloud init --new"));break;default:o.push(_t(`${at} ${s("setup did not complete.")}`),"",_t(r?"To retry setup:":"To retry:"),...a,J(i));break}return oS(o)};M();Vn();var Oo=require("commander");pe();A();M();Vn();function aS(e,t,n){Je()&&e==="cloud"&&(n.json||u.warn(`${re} ${le(`webflow cloud ${t}`)} is deprecated \u2014 use ${le(`webflow apps ${t}`)} instead.`))}function Cu(e,{namespace:t}){e.command("init").description("Bootstrap a new Webflow Cloud app").addOption(new Oo.Option("-n, --app-name <name>","App name")).addOption(new Oo.Option("--project-name <name>",`${Un} 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)=>{Km(t),aS(t,"init",n),await AP(n,r)})}function Fu(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 Oo.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new Oo.Option("--project-name <name>",`${Un} 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 Oo.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new Oo.Option("--project-id <appId>",`${Un} 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)=>{Km(t),aS(t,"deploy",n),await RP(n,r)})}var AP=qm,RP=Xm;var lS=e=>{let t=Je(),n=e.command("cloud").description(t?`${Un} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");n.command("create").description(`${Un} 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(Jm),n.command("list").description(t?`${Un} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Un} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(zm),Cu(n,{namespace:"cloud"}),Fu(n,{namespace:"cloud"})};var AS=require("commander");q();C();A();M();X();De();C();lt();lt();C();async function Ja(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 G(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(),p=c[n]??[];o.push(...p);let d=c.pagination?.total??p.length;if(i+=p.length,i>=d||p.length<s)break}return o}function Lo(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 IP=100;async function za(e,t){let n=[],r=t?.maxPages??IP,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 _u=100;function is(e){return Object.values(e).some(t=>t!==void 0)}function ss(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 TP="1.0.0";function mt(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":TP}}async function xt(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}.
190
+ ${n}
191
+
192
+ The link is signed and expires; re-run this command to get a fresh one.`:"";return ix(r,nx)?new hs(`The Webflow GitHub App is not installed on the account that owns this repository. Install it, then re-run this command.${o}`,{code:nx,installUrl:n}):ix(r,ox)?new hs(`The Webflow GitHub App is installed on this repository, but that installation is not connected to your workspace yet. Authorize the connection, then re-run this command.${o}`,{code:ox,installUrl:n}):null}var sl=100;function ys(e){return Object.values(e).some(t=>t!==void 0)}function Wo(e,t={}){let r=[];if(t.limit!==void 0&&Number.isFinite(t.limit)&&r.push(`limit=${encodeURIComponent(String(t.limit))}`),t.cursor&&r.push(`cursor=${encodeURIComponent(t.cursor)}`),t.filters)for(let[n,o]of Object.entries(t.filters)){if(o===void 0)continue;let i=o.trim();if(i==="")throw new d(`List filter "${n}" must be a non-empty value.`,{isUserError:!0});r.push(`${n}=${encodeURIComponent(i)}`)}return r.length>0?`${e}?${r.join("&")}`:e}var U$="1.0.0";function tt(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":U$}}async function ht(e,t={}){let{scopeLabel:r="apps",fallbackPrefix:n,userErrorOn4xx:o=!1}=t,i={};try{let c=JSON.parse(await e.text());c!==null&&typeof c=="object"&&(i=c)}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new d(`Missing required scopes for ${r}.
189
193
  ${s??""}
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 PP(e,t,n={}){let r=await G(ss(`${P()}/cosmic/apps`,{limit:_u,cursor:t,filters:n}),{headers:mt(e)});if(!r.ok)throw await xt(r);return Lo(await r.json(),"apps")}async function Au(e,t={}){return za(n=>PP(e,n,t))}async function Ru(e,t){ve(t,"appId");let n=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}`,{headers:mt(e)});if(!n.ok)throw await xt(n);return await n.json()}async function cS(e,t,n){ve(t,"appId");let r=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...mt(e),"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await xt(r);return await r.json()}async function uS(e,t){ve(t,"appId");let n=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:mt(e)});if(!n.ok)throw await xt(n);return await n.json()}async function dS(e,t,n={}){ve(t,"appId");let r=ss(`${P()}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:n.limit,cursor:n.cursor}),o=await G(r,{headers:mt(e)});if(!o.ok)throw await xt(o);let{items:i,nextCursor:s}=Lo(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function $P(e,t,n,r={}){let o=await G(ss(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:_u,cursor:n,filters:r}),{headers:mt(e)});if(!o.ok)throw await xt(o);return Lo(await o.json(),"environments")}async function as(e,t,n={}){return ve(t,"appId"),za(r=>$P(e,t,r,n))}function pS(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 fS(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Nr(r,"deploymentId");let i=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/buildLogs${pS(o)}`,{headers:mt(e)});if(!i.ok)throw await xt(i);return await i.json()}async function mS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/logs${pS(r)}`,{headers:mt(e)});if(!o.ok)throw await xt(o);return await o.json()}async function gS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(ss(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments`,{limit:r.limit,cursor:r.cursor}),{headers:mt(e)});if(!o.ok)throw await xt(o);let{items:i,nextCursor:s}=Lo(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function Iu(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Nr(r,"deploymentId");let i=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}`,{headers:mt(e),signal:o.signal});if(!i.ok)throw await xt(i);return await i.json()}async function hS(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Nr(r,"deploymentId");let i=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/redeploy`,{method:"POST",headers:{...mt(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await xt(i);return await i.json()}async function yS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(`${P()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments`,{method:"POST",headers:{...mt(e),"Content-Type":"application/json",...r.idempotencyKey?{"Idempotency-Key":r.idempotencyKey}:{}},body:JSON.stringify({})});if(!o.ok)throw await xt(o);return await o.json()}async function Zm(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=is(o),s=await Au(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=_e(e.fields,Jc,xr());u.info(zc(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();A();M();X();Me();C();be();Oe();async function Tu(e,t={}){let n=await Au(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
- `);throw new f(`This workspace has multiple apps. Pass the app id to choose one:
193
- ${o}`,{isUserError:!0,missingFlag:"appId"})}let r=await Be({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 Pn(e,t,n){let{manifest:r}=ee();return Po("appId",{flagValue:t,manifest:r,isNoInput:!1,json:n.json,prompt:()=>Tu(e,{json:n.json})})}async function Qm(e,t){let n=await T(),r=await Pn(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await Ru(n,r);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=_e(t.fields,Jc,xr());u.info(zc([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();A();M();X();async function eg(e,t){let n=await T(),r=await Pn(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await dS(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=_e(t.fields,uE,ga());u.info(pE(s.customDomains,a)+Ri(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();A();M();X();async function tg(e,t){let n=await T(),r=await Pn(n,e,t),o=t.json?void 0:_e(t.fields,dE,ha()),i=F.forApps({authToken:n}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=is(a),c=await as(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(fE(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();A();M();X();pe();var ng=["timestamp","message","phase"],qa="timestamp,message",Pu=ut(ng);function Mr(){return ng}function OP(e,t){return e==null||e===""?I("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function LP(e,t=qa.split(",")){return e.map(n=>t.map(r=>OP(n[r],r)).join(" ")).join(`
194
- `)}function $u(e,t,n){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":LP(e.logs,n)+Ri(e.nextCursor)}Me();C();be();Oe();async function wS(e,t,n={}){let r=await as(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
- `);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: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 Xe(e,t){let{manifest:n}=ee(),r=await Po("appId",{flagValue:t.appId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>Tu(e,{json:t.json})}),o=await Po("environmentId",{flagValue:t.environmentId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>wS(e,r,{json:t.json})});return{appId:r,envId:o}}async function rg(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 Xe(n,{json:t.json}),i=t.json?void 0:_e(t.fields,Pu,Mr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await fS(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($u(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();A();M();X();async function og(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{environmentId:e,json:t.json}),i=t.json?void 0:_e(t.fields,Pu,Mr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await mS(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($u(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();A();M();X();async function ig(e){let t=await T(),{appId:n,envId:r}=await Xe(t,{json:e.json}),o=e.json?void 0:_e(e.fields,Yc,Cr()),i=F.forApps({authToken:t}),s=Date.now();try{let a=await gS(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(wa(a.deployments,o)+Ri(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();be();A();M();X();var NP=5,bS=1800;function jP(e){return new Promise(t=>setTimeout(t,e))}async function DS(e,t,n,r,o={}){let i=Math.min(bS,Math.max(NP,o.interval??qc)),s=Math.min(bS,Math.max(1,o.timeout??Xc)),a=Date.now()+s*1e3,l,c,p=!1;for(;;){let d=new AbortController,m=setTimeout(()=>d.abort(),Math.max(0,a-Date.now())),h;try{h=await Iu(e,t,n,r,{signal:d.signal})}catch(b){if(d.signal.aborted){p=!0;break}throw b}finally{clearTimeout(m)}c=h;let g=h.status;if(gE(g))break;let y=a-Date.now();if(y<=0){p=!0;break}if(g!==l&&o.onStatusChange?.(l,g),l=g,await jP(Math.min(i*1e3,y)),Date.now()>=a){p=!0;break}}return{deployment:c,timedOut:p,timeoutSeconds:s}}async function sg(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{json:t.json}),i=t.json?void 0:_e(t.fields,Yc,Cr()),s=F.forApps({authToken:n}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let p=!t.json&&!V(),{deployment:d,timedOut:m,timeoutSeconds:h}=await DS(n,r,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:p?(y,b)=>u.info(I(y===void 0?b:`${y} \u2192 ${b}`)):void 0}),g=m?"timeout":d?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:g}),process.exitCode=!m&&d?.status==="success"?0:1,t.json){u.info(JSON.stringify(d??null,null,2));return}d&&u.info(wa([d],i)),m&&u.warn(`Timed out after ${h}s waiting for a terminal status (last status: ${d?.status??"unknown"}).`);return}let c=await Iu(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(wa([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();A();M();X();async function ag(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{json:t.json});if(t.dryRun){ve(r,"appId"),ve(o,"environmentId"),Nr(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 hS(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(`${Ce} Redeploy in progress \u2014 commit ${l} ${I("(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();pe();C();var kS=require("child_process");function ES(){try{let e=(0,kS.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}A();M();X();function MP(e){let t=ES();e&&t&&e!==t&&u.warn(`This will rebuild \`${e}\`, you're currently on \`${t}\`.`)}async function BP(e,t,n){try{return(await as(e,t)).find(o=>o.id===n)}catch{return}}async function lg(e){let t=await T(),{appId:n,envId:r}=await Xe(t,{json:e.json}),o=await BP(t,n,r);if(MP(o?.branch),e.dryRun){ve(n,"appId"),ve(r,"environmentId"),e.json?u.info(JSON.stringify({appId:n,environmentId:r,branch:o?.branch??null,dryRun:!0},null,2)):(u.info(`Would trigger a build of ${o?.branch?`\`${o.branch}\` `:""}in app ${n}, environment ${r}.`),u.info("Dry run \u2014 no changes made."));return}let i=F.forApps({authToken:t,suppressCommand:!!e.idempotencyKey}),s=Date.now();try{let a=await yS(t,n,r,{idempotencyKey:e.idempotencyKey});if(await i.sendUsage("apps_deployments_trigger",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}a.status==="queued"?u.info(`${$} Trigger queued${o?.branch?` for \`${o.branch}\``:""}.`):a.status==="skipped"?u.info(`${Ce} Nothing to build \u2014 the branch has no commits yet. Push a commit and try again.`):u.info(`${Ce} Trigger in progress ${I("(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_trigger",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to trigger deployment:`}))}}q();C();A();M();X();async function cg(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 Pn(n,e,t);if(ve(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 cS(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();be();Oe();A();M();X();async function ug(e,t){let n=await T(),r=await Pn(n,e,t);if(ve(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 Ru(n,r),a=mE(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 $e({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=F.forApps({authToken:n}),i=Date.now();try{let s=await uS(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();A();M();X();De();C();lt();var ls=100;function dg(e,t){return`${P()}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function pg(e,t){return xt(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function UP(e,t,n,r,o={}){let i=ss(dg(t,n),{limit:_u,cursor:r,filters:o}),s=await G(i,{headers:mt(e)});if(!s.ok)throw await pg(s,"Failed to list environment variables");return Lo(await s.json(),"variables")}async function fg(e,t,n,r={}){return za(o=>UP(e,t,n,o,r))}async function mg(e,t,n,r){let o=await G(`${dg(t,n)}/${encodeURIComponent(r)}`,{method:"DELETE",headers:mt(e)});if(!o.ok)throw await pg(o,"Failed to delete environment variable")}async function Xa(e,t,n,r,o){let i=Object.keys(r).length;if(i>ls)throw new f(`Cannot import more than ${ls} variables at once (received ${i}).`,{isUserError:!0});let s=await G(`${dg(t,n)}/bulk`,{method:"POST",headers:{...mt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:r,overwriteExisting:o})});if(!s.ok)throw await pg(s,"Failed to import environment variables");return await s.json()}var vS=require("dotenv");pe();var SS=["key","isSecret","value","id","environmentId"],Ya=["key","isSecret"];function cs(){return SS}var gg=ut(SS);function WP(e,t){switch(t){case"value":return e.isSecret?I("(secret)"):e.value!==""?e.value:I("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):I("\u2014")}}function hg(e,t=Ya){if(e.length===0)return I("No environment variables found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>WP(o,i)));return qe(n,r)}function yg(e){let t=e.split(/\r?\n/).map(n=>n.replace(/^\s*export\s+/,"")).join(`
197
- `);return(0,vS.parse)(t)}async function wg(e){let t=await T(),n=F.forAppsEnvVars({authToken:t}),r=Date.now();try{let{appId:o,envId:i}=await Xe(t,e),s={key:e.key,q:e.q},a=is(s),l=await fg(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=_e(e.fields,gg,cs());u.info(hg(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();A();M();X();C();be();Oe();A();M();async function xS(){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 bg(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 CS(e,t){if(e!==void 0)return t.secret&&!t.json&&bg(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let n=await xS();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 Db({message:`Enter the value for ${t.key}:`}):await Ke({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 Dg(e,t,n){let r=n.secret?" (secret)":"",o=await T(),i=F.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await Xe(o,n);if(n.dryRun){t!==void 0&&n.secret&&!n.json&&bg(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:p}=await CS(t,{key:e,secret:n.secret,json:n.json}),d={[e]:{value:c,...n.secret?{isSecret:!0}:{}}},m=await Xa(o,a,l,d,!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:p}),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();A();M();X();async function kg(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await Xe(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 mg(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 FS=require("fs"),_S=require("path");q();C();A();M();X();function Eg(e){return e.map(({id:t,environmentId:n,key:r,isSecret:o})=>({id:t,environmentId:n,key:r,isSecret:o}))}async function vg(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await Xe(n,t),a;try{a=(0,FS.readFileSync)((0,_S.resolve)(e),"utf8")}catch{throw new f(`Could not read file: ${e}`,{isUserError:!0})}let l=yg(a),c=Object.keys(l);if(c.length===0)throw new f(`No variables found in ${e}.`,{isUserError:!0});if(c.length>ls)throw new f(`Cannot import more than ${ls} variables at once (${e} has ${c.length}).`,{isUserError:!0});let p={};for(let d of c)p[d]={value:l[d],...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 d of c)u.info(` ${d}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let d=await Xa(n,i,s,p,!0);if(await r.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:d.created.length,updatedCount:d.updated.length,skippedCount:d.skipped.length,errorCount:d.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:Eg(d.created),updated:Eg(d.updated),skipped:Eg(d.skipped),errors:d.errors},null,2));else{u.info(`${$} Imported: ${d.created.length} created, ${d.updated.length} updated, ${d.skipped.length} skipped, ${d.errors.length} failed`);for(let m of d.errors)u.warn(` ${m.key}: ${m.error}`)}if(d.errors.length>0)throw new f(`Import completed with ${d.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(d){throw d instanceof f&&d.isUserError?d:(await r.sendError(d instanceof Error?d:new Error(String(d)),"apps_env_vars_import",{duration:Date.now()-o}),new f(d,{prefix:`${k} Failed to import environment variables:`}))}}Vn();var RS=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");Cu(t,{namespace:"apps"}),Fu(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. ${Zc("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.",Ii).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",Ii).addOption(Qc("the app name")).addOption(ne()).addOption(He([...xr()]).default(Vc)).action(Zm),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(ne()).addOption(He([...xr()]).default(am)).action(Qm),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([...ga()]).default(Gc)).addOption(ne()).option("--limit <n>","Max number of domains to return (server caps at 100)",ru).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(eg),Je()&&(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(ne()).addOption(Ae()).action(cg),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(Ti()).addOption(ne()).addOption(Ae()).action(ug)),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). ${Zc("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.",Ii).addOption(Qc("the environment branch")).addOption(He([...ha()]).default(Kc)).addOption(ne()).action(tg);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(wE()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(ne()).addOption(He([...Cr()]).default(ya)).action(ig),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(DE()).addOption(kE()).addOption(ne()).addOption(He([...Cr()]).default(ya)).action(sg),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(ne()).addOption(Ae()).action(ag),r.command("trigger").description("Build a GitHub-connected environment's current HEAD on demand (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker; builds whatever branch that environment is configured for. Warns (without blocking) if that branch differs from your current local branch. Use --dry-run to preview.").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(ne()).addOption(Ae()).action(lg);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(ne()).addOption(He([...Mr()]).default(qa)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(mm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(rg),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(ne()).addOption(He([...Mr()]).default(qa)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(mm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(og);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). ${Zc("variable","--key")} Secret values are never returned.`).addOption(ba()).addOption(Da()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",Ii).addOption(Qc("the variable key")).addOption(ne()).addOption(He([...cs()]).default(Ya.join(","))).action(wg),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(ba()).addOption(Da()).addOption(fm()).addOption(Ae()).addOption(ne()).action(Dg),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ba()).addOption(Da()).addOption(Ae()).addOption(ne()).action(kg),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(ba()).addOption(Da()).addOption(fm()).addOption(Ae()).addOption(ne()).action(vg)};De();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 $n(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function IS(e,t){Z(t,"siteId");let n=await G(`${P()}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok){let o=await $n(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 TS(e,t){Z(t,"collectionId");let n=await G(`${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 $n(n)}`);let r=await n.json();return{...r,fields:r.fields??[]}}async function PS(e,t,n){Z(t,"siteId");let r={displayName:n.displayName,singularName:n.singularName};n.slug&&(r.slug=n.slug);let o=await G(`${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 $n(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 $S(e,t,n){Z(t,"collectionId");let r=await G(`${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 $n(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 Sg(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 G(`${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 $n(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 OS(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=r?`?cmsLocaleId=${encodeURIComponent(r)}`:"",i=await G(`${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 $n(i)}`);return await i.json()}async function xg(e,t,n,r=!1){Z(t,"collectionId");let o=await G(`${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 $n(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 Cg(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=await G(`${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 $n(o)}`);return await o.json()}async function LS(e,t,n){Z(t,"collectionId"),Z(n,"itemId");let r=await G(`${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 $n(r)}`)}async function NS(e,t,n){Z(t,"collectionId"),n.forEach(o=>Z(o,"itemId"));let r=await G(`${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 $n(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();Me();async function Ou(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=ee(),n=await ze(t);return{token:n.accessToken,siteId:n.siteId}}function jS(e,t=["id","displayName","slug"]){if(e.length===0)return I("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 Bt(`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:I("\u2014")}));return qe(i,s)}function MS(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(I(" 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(qe(n,r)),t.join(`
199
- `)}function BS(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return I("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"):J("live");if(i==="isArchived")return o.isArchived?I("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"}):I("\u2014")}let s=o[i];return s==null?I("\u2014"):String(s)}));return qe(n,r)}C();A();M();function Lu(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 Fg(e){let{token:t,siteId:n}=await Ou(e),r=F.forCms({authToken:t,siteId:n}),o=Date.now();try{let i=await IS(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=Lu(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(jS(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();A();M();X();async function _g(e,t){let n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await TS(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(MS(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();A();M();X();async function Ag(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 Ou(e),i=F.forCms({authToken:r,siteId:o}),s=Date.now();try{let a=await PS(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();A();M();X();async function Rg(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 $S(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();A();M();X();async function Ig(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 Sg(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(d=>d.trim());u.info(BS(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let d=s.total>0?` of ${s.total}`:"";u.info(`
201
- Showing ${l}\u2013${c}${d} 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();A();M();X();async function Tg(e){let t=await T(),n=F.forCms({authToken:t}),r=Date.now();try{let o=await OS(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();A();M();X();async function Pg(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 xg(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();A();M();X();async function $g(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 Cg(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();A();M();X();async function Og(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 LS(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();A();M();X();async function Lg(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 NS(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 US=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(Tt()).addOption(ne()).addOption(He(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption($i(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Pi()).action(Fg),n.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(ne()).action(_g),n.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(Tt()).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(Ae()).addOption(ne()).action(Ag),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(Ae()).addOption(ne()).action(Rg);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(tu()).addOption(nu()).addOption(ne()).addOption(He(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(Ig),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(ne()).action(Tg),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(Ae()).addOption(ne()).action(Pg),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(Ae()).addOption(ne()).action($g),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(Ae()).action(Og),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(Ae()).addOption(ne()).action(Lg)};q();pe();C();A();M();Me();X();De();lt();C();C();pe();var WS={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 Nu(e,t){let n=e.split(".").pop()?.toLowerCase()??"",r=WS[n];if(!r){let o=Object.keys(WS).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 Ng=["id","displayName","originalFileName","contentType","size","lastUpdated"];function HS(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return I("No assets found.");let n=Object.fromEntries(Ng.map(l=>[l.toLowerCase(),l])),r=t.map(l=>n[l.toLowerCase()]).filter(l=>l!=null);if(r.length===0)return Bt(`Invalid fields. Available: ${Ng.join(", ")}`);let o=t.filter(l=>n[l.toLowerCase()]==null),i=o.length>0?le(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${Ng.join(", ")}
202
- `):"",s=r.map(l=>se(l)),a=e.map(l=>r.map(c=>{let p=l[c];if(p==null||c==="size"&&p===0)return I("\u2014");if(c==="size")return HP(Number(p));if(c==="lastUpdated"){let m=new Date(String(p)),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 d=String(p);return c==="displayName"&&d.length>40?I("\u2026")+d.slice(-39):d}));return i+qe(s,a)}function HP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function VS(e){if(e.length===0)return I("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 qe(n,r)}async function GS(e,t,n={}){if(Z(t,"siteId"),n.folderId){Z(n.folderId,"folderId");let a=await VP(e,n.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],p=0,d=100;for(;;){let b=await G(`${P()}/v2/sites/${t}/assets?limit=${d}&offset=${p}`,{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(),_=S.assets??[];c.push(..._);let v=S.pagination?.total??0;if(p+=_.length,p>=v||_.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 G(`${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 KS(e,t,n,r,o){Z(t,"siteId"),o&&Z(o,"folderId");let i=aa(n);Nu(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 G(`${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(),p={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 ca(i,p)}catch(d){throw await G(`${P()}/v2/assets/${p._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),d}return{id:p._id,hostedUrl:p.s3Url,displayName:s,originalFileName:i.meta.title}}async function JS(e,t,n){Z(t,"assetId");let r=await G(`${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 VP(e,t){Z(t,"folderId");let n=await G(`${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 zS(e,t){Z(t,"siteId");let n=await G(`${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 qS(e,t,n,r){Z(t,"siteId"),r&&Z(r,"parentFolderId");let o={displayName:n};r&&(o.parentFolder=r);let i=await G(`${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 jg(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ee(),s=await ze(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 GS(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 p=Lu(i,l,c);if(e.json){u.info(JSON.stringify({assets:p,pagination:s},null,2));return}let d=e.fields.split(",").map(h=>h.trim());u.info(HS(p,d));let m=(e.offset??0)+i.length;m<s.total&&u.info(I(`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();A();M();Me();X();async function Mg(e,t){let n=aa(e);if(Nu(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}=ee(),l=await ze(a);r=l.accessToken,o=l.siteId}let i=F.forAssets({authToken:r,siteId:o}),s=Date.now();try{let a=await KS(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();A();M();X();async function Bg(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 JS(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();A();M();Me();X();async function Ug(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ee(),s=await ze(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let i=await zS(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(VS(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();A();M();Ws();X();async function Wg(e,t){let n,r;if(t.site)n=await T(),r=t.site;else{let{manifest:s}=ee(),a=await ze(s);n=a.accessToken,r=a.siteId}let o=F.forAssets({authToken:n,siteId:r}),i=Date.now();try{let s=await qS(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 XS=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(Tt()).option("--folder <folderId>","Filter by folder ID").addOption(ne()).addOption(He(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(tu()).addOption(nu()).addOption($i(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Pi()).action(jg),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(Tt()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(Ae()).addOption(ne()).action(Mg),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(Ae()).addOption(ne()).action(Bg);let n=t.command("folders").description("Manage asset folders");n.command("list").description("List all asset folders for a site").addOption(Tt()).addOption(ne()).action(Ug),n.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(Tt()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(ne()).action(Wg)};q();C();A();M();X();De();C();lt();async function YS(e,t){Z(t,"siteId");let n=await G(`${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 ZS(e){return Ja(`${P()}/v2/sites`,e,"sites","Failed to list sites")}async function QS(e,t){Z(t,"siteId");let n=await G(`${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 ex(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 G(`${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 Hg=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],tx=ut(Hg);function nx(){return Hg}function rx(e,t=["id","displayName","lastPublished"]){if(e.length===0)return I("No sites found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${Hg.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:I("\u2014")}));return qe(n,r)}function ox(e){if(e.length===0)return I("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"}):I("\u2014")]);return qe(t,n)}async function Vg(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await ZS(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=_e(e.fields,tx,nx());u.info(rx(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();A();M();X();async function Gg(e,t){let n=await T(),r=F.forSites({authToken:n}),o=Date.now();try{let i=await YS(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();A();M();X();async function Kg(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await QS(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(ox(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();A();M();X();async function Jg(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 ex(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();De();C();be();Oe();A();M();Me();X();De();lt();C();var ju="not_enterprise_plan_workspace";async function ix(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 G(`${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===ju?new f("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:ju}):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 GP(e){xe({siteId:e.id});let{manifestPath:t}=ee();u.info(`${$} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function KP(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 ns(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 rs(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 Be({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 JP(e,t){if(u.warn(`${k} ${t.message}
205
- Create the site in the Webflow dashboard: ${En()}/dashboard
206
- then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await $e({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let r=await wr(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 bi(r),created:!1}}async function zP(e,t,n){let r=await KP(e,t),o=n.name;if(o||(o=await Ke({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 ix(e,r,o)}catch(s){if(s instanceof f&&s.code===ju)return JP(e,s);throw s}return u.info(`${$} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function Mu(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 wr(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 Be({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 zP(t,i,e);s=l.site,o=l.created}else s=await bi(i)}GP(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();A();M();X();De();lt();C();function qP(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function XP(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}${qP(n)}`)}async function sx(e,t,n,r){let o=await G(`${En()}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});o.ok||await XP(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 Za(e,t,n){Z(t,"siteId");let r=await sx("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 ax(e,t,n,r){Z(t,"siteId");let o=await sx("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}Me();q();C();var Bu=require("path");function zg(e){return e.split(Bu.sep).join("/").replace(/\\/g,"/")}function No(e){if(e===""||e.includes("\0")||(0,Bu.isAbsolute)(e))return!1;let t=zg(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(n=>n==="..")}var YP={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},lx={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 ZP(e){return e.endsWith("/")?e.slice(0,-1):e}function cx(e,t,n){let r=e.trim();if(!No(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 ZP(o)}function QP(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 e$(e,t){let n=e?.layout;if(!n)return YP;let r=n.preset?lx[n.preset]:void 0;if(n.preset&&!r)throw new f(`Unknown "site.layout.preset" value "${n.preset}" in ${t}. Known presets: ${Object.keys(lx).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=cx(o,"pagesRoot",t),l=cx(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:QP(a,l,"theme")}}function us(e){let{manifest:t,manifestPath:n}=ee(),r=e?.trim();r&&Z(r,"site-id");let o=r||oo(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=e$(t.site,n);return{siteId:o,layout:i}}var ir=require("@babel/types");var ux=require("@babel/parser");function Yt(e){try{return(0,ux.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function*Br(e){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let t of e)yield*Br(t);return}if(typeof e.type=="string"){yield e;for(let[t,n]of Object.entries(e))t==="loc"||t==="leadingComments"||t==="trailingComments"||(yield*Br(n))}}}function Ur(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 dx(e){let t;for(let n of Br(e.program))if((0,ir.isCallExpression)(n)&&(0,ir.isIdentifier)(n.callee,{name:"component"})&&(0,ir.isObjectExpression)(n.arguments[0])){let r=n.arguments[0];(t===void 0||(r.start??0)<(t.start??0))&&(t=r)}return t}function px(e){return e.properties.some(t=>(0,ir.isObjectProperty)(t)&&!t.computed&&(0,ir.isIdentifier)(t.key,{name:"id"}))}function fx(e,t){let n=Yt(e),r=n&&dx(n);if(!r||r.start==null||px(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 p of l.slice(1))if(p.trim()!==""){c=p.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 mx(e,t){return fx(e,`"${t}"`)}function gx(e){return fx(e,"null")}function hx(e){let t=Yt(e),n=t&&dx(t);return n?px(n):!0}var wx=require("crypto"),te=require("@babel/types");function yx(e){return(0,wx.createHash)("sha256").update(e,"utf8").digest("hex").slice(0,16)}var pn=e=>e.join(",");function bx(e){let t=Yt(e),n=t&&Xg(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=Dx(s);r.push({path:a,kind:"element",...l?{tag:l}:{},hash:yx(o(s))});let c=0;for(let p of s.children){if(Yg(p))continue;let d=Zg(p)!==void 0,m=Ex(p)!==void 0;if(d||m){r.push({path:[...a,c++],kind:"string",hash:yx(o(p))});continue}(0,te.isJSXElement)(p)&&i(p,[...a,c++])}}return i(n,[]),r}function t$(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(pn(l.path),c)},s=new Map(t.map(l=>[pn(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(pn(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(pn(l.path)))continue;let c=(a.get(l.hash)??[]).find(p=>!r.has(p)&&o(p,l));c&&i(l,c)}for(let l of e){if(n.has(pn(l.path)))continue;let c=s.get(pn(l.path));c&&!r.has(c)&&o(c,l)&&i(l,c)}return n}function Xg(e){for(let t of Br(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 Dx(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 Yg(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 qg(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 n$(e){return e.replace(/^\s*\n\s*/,"").replace(/\s*\n\s*$/,"").replace(/\s*\n\s*/g," ")}function r$(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 n$(n.value);if((0,te.isJSXExpressionContainer)(n)&&(0,te.isStringLiteral)(n.expression))return n.expression.value}function Zg(e){if(!(!(0,te.isJSXExpressionContainer)(e)||!(0,te.isStringLiteral)(e.expression)))return e.expression.value}function kx(e){return(0,te.isIdentifier)(e)}function o$(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(kx(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(kx(t)&&!(t.start==null||t.end==null))return{start:t.start,end:t.end}}function i$(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 Uu(e){let t=Yt(e),n=t&&Xg(t);if(!n)return{sugared:e,entries:[]};let r=[],o=[];function i(l,c){let p=qg(l);if(p===void 0)return;let d=i$(e,l);if(!d)return;let m=Dx(l);r.push({path:c,uid:p,kind:"element",...m?{tag:m}:{}}),o.push({start:d.start,end:d.end,text:""})}function s(l,c){let p=0;for(let d of l.children){if(Yg(d)){let m=qg(d);if(m===void 0||d.start==null||d.end==null)continue;let h=r$(d),g=h===void 0?o$(d):void 0;if(h===void 0&&g===void 0)continue;r.push({path:[...c,p++],uid:m,kind:"string"}),o.push({start:d.start,end:d.end,text:h!==void 0?`{${JSON.stringify(h)}}`:`{${e.slice(g.start,g.end)}}`});continue}if(Zg(d)!==void 0){p++;continue}if((0,te.isJSXElement)(d)){let m=[...c,p++];i(d,m),s(d,m)}}}if(i(n,[]),s(n,[]),o.length===0)return{sugared:e,entries:[]};let a=Ur(e,o);return{sugared:a,entries:Qg(a,r)}}function Qg(e,t){if(t.length===0)return t;let n=new Map(bx(e).map(r=>[pn(r.path),r.hash]));return t.map(r=>{let o=n.get(pn(r.path));return o?{...r,hash:o}:r})}function vx(e,t){let n=Yt(e),r=n&&Xg(n);if(!r)return{desugared:e,hasNewNodes:!1};let o=t$(bx(e),t),i=[],s=!1;function a(c,p){if(qg(c)!==void 0)return;let d=o.get(pn(p));if(!d||d.kind!=="element"){s=!0;return}let m=c.openingElement.name.end;m!=null&&i.push({start:m,end:m,text:` uid=${JSON.stringify(d.uid)}`})}function l(c,p){let d=0;for(let m of c.children){if(Yg(m))continue;let h=Zg(m);if(h!==void 0){let y=[...p,d++];if(m.start==null||m.end==null)continue;let b=o.get(pn(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=[...p,d++];if(m.start==null||m.end==null)continue;let b=o.get(pn(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=[...p,d++];a(m,y),l(m,y)}}}return a(r,[]),l(r,[]),{desugared:Ur(e,i),hasNewNodes:s}}var gt=require("@babel/types");function s$(e){if(!(0,gt.isVariableDeclarator)(e)||!(0,gt.isIdentifier)(e.id)||!e.init)return;let{init:t}=e;if(!(!(0,gt.isCallExpression)(t)||!(0,gt.isIdentifier)(t.callee,{name:"style"})))return{ident:e.id.name,call:t}}function Sx(e){let t=e.arguments[2];return t&&(0,gt.isObjectExpression)(t)?t:void 0}function xx(e){for(let t of e.properties){if(!(0,gt.isObjectProperty)(t)||t.computed)continue;if(((0,gt.isIdentifier)(t.key,{name:"__wfId"})||(0,gt.isStringLiteral)(t.key)&&t.key.value==="__wfId")&&(0,gt.isStringLiteral)(t.value))return t}}function Cx(e){let t=[];for(let n of Br(e.program)){let r=s$(n);r&&t.push(r)}return t.sort((n,r)=>(n.call.start??0)-(r.call.start??0))}function Wu(e){let t=Yt(e);if(!t)return{sugared:e,entries:[]};let n=[],r=[];for(let{ident:o,call:i}of Cx(t)){let s=Sx(i);if(!s)continue;let a=xx(s);if(!a||!(0,gt.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:Ur(e,r),entries:n}}function Fx(e,t){let n=Yt(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 Cx(n)){let l=Sx(a);if(l&&xx(l))continue;let c=r.get(s);if(!c){i=!0;continue}let p=JSON.stringify(c.wfId);if(l){let d=l.properties[0];d?.start!=null?o.push({start:d.start,end:d.start,text:`__wfId: ${p}, `}):l.start!=null&&o.push({start:l.start+1,end:l.start+1,text:` __wfId: ${p} `})}else{let d=a.arguments[1];d?.end!=null&&o.push({start:d.end,end:d.end,text:`, { __wfId: ${p} }`})}}return{desugared:Ur(e,o),hasNewStyles:i}}var Hr=require("fs"),ds=require("path"),jx=w(require("fast-glob"));C();var _x=require("crypto"),ht=require("fs"),jo=require("path");C();var Wr=".webflow/wfs";function fn(e){return(0,_x.createHash)("sha256").update(e,"utf8").digest("hex")}function Ax(e){return(0,jo.join)(e,Wr,"index.json")}function eh(e,t){return No(t)?(0,jo.join)(e,Wr,`${t}.json`):void 0}function Rx(e){let t=Ax(e);if((0,ht.existsSync)(t))try{let n=JSON.parse((0,ht.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 Hu(e=process.cwd()){let t=Rx(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${Wr}/index.json could not be read`};let n={},r=[];for(let{wirePath:o}of t.files){let i=eh(e,o);if(!i){r.push(o);continue}if(!(0,ht.existsSync)(i)){r.push(o);continue}try{let s=JSON.parse((0,ht.readFileSync)(i,"utf8"));if(s.localPath!==void 0&&!No(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 Qa(e,t=process.cwd()){let n=Rx(t),r=new Set(n&&n!=="corrupt"?n.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=eh(t,s);if(!a)throw new f(`Refusing to write a lock entry outside ${Wr}: "${s}"`);(0,ht.mkdirSync)((0,jo.dirname)(a),{recursive:!0}),(0,ht.writeFileSync)(a,`${JSON.stringify(e.files[s],null,2)}
213
- `,"utf8")}for(let s of r){if(s in e.files)continue;let a=eh(t,s);a&&(0,ht.existsSync)(a)&&(0,ht.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,ht.mkdirSync)((0,jo.dirname)(i),{recursive:!0}),(0,ht.writeFileSync)(i,`${JSON.stringify(o,null,2)}
214
- `,"utf8")}function Ix(e=process.cwd()){(0,ht.rmSync)((0,jo.join)(e,Wr),{recursive:!0,force:!0})}C();function Tx(e){if(!No(e))throw new f(`Refusing to write unsafe path from server: "${e}"`)}var a$=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function el(e){return a$.exec(e)?.[1]}var Px=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function l$(e){return Px.exec(e)?.[2]}function c$(e){let t=Px.exec(e);return t?t[1]??"":void 0}function nh(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function rh(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function oh(e,t){let r=e.slice(t.length+1).split("/");if(r.length===1)return"";if(r.length===2)return r[0]}function $x(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 ih(e,t,n){if(n)return n;let r=l$(e);if(!r)return;let o=c$(e)??"";return o?`${t.componentsRoot}/${o}/${r}.tsw`:`${t.componentsRoot}/${r}.tsw`}function Ox(e,t){let n=rh(e,t);if(!n)return;let r=oh(e,t);if(r!==void 0)return nh(n,r)}var th="site/theme/";function Lx(e,t){if(e.startsWith(th))return`${t.themeRoot}/${e.slice(th.length)}`}function Vu(e,t){let n=`${t}/`;if(e.startsWith(n))return`${th}${e.slice(n.length)}`}async function Mx(e,t,n=process.cwd(),r=!1){let o=[],i=[],s=[],a=[],l=[],c=[],p={},d=new Map,m=new Map;for(let[y,b]of Object.entries(e.files)){let S=b.localPath??y;d.set(y,S),m.set(S,y)}let h=new Set((await(0,jx.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:n,onlyFiles:!0,dot:!1})).map(zg)),g=new Map;for(let y of Object.keys(e.files).sort()){let b=e.files[y],S=d.get(y);if(b.deletedUpstream){(0,Hr.existsSync)((0,ds.join)(n,S))&&c.push(S);continue}if(!(0,Hr.existsSync)((0,ds.join)(n,S))){i.push(S),g.set(b.contentSha256,S);continue}p[y]=S;let _=(0,Hr.readFileSync)((0,ds.join)(n,S),"utf8");(r||fn(_)!==b.contentSha256)&&o.push({path:y,content:_,baseHash:b.serverHash})}for(let y of[...h].sort()){if(m.has(y))continue;let b=(0,Hr.readFileSync)((0,ds.join)(n,y),"utf8"),S=g.get(fn(b));if(S!==void 0){s.push({oldPath:S,newPath:y});continue}let _=d$(y,t);if(_.kind==="unmappable"){a.push(y);continue}let{wirePath:v}=_,x=d.get(v);if(x!==void 0&&x!==y){l.push(y);continue}p[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:p}}function d$(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let r=rh(e,t.componentsRoot);if(!r)return{kind:"unmappable"};let o=oh(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:nh(r,o)}}let n=Vu(e,t.themeRoot);return n!==void 0?{kind:"theme",wirePath:n}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function Gu(e){let t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20));return t}function Bx(e){let t=e.filter(a=>!el(a.path)),n=new Map;for(let a of e){let l=el(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 Ku(e,t=process.cwd()){let n=(0,ds.join)(t,e);if((0,Hr.existsSync)(n))return(0,Hr.readFileSync)(n,"utf8")}var p$="site/current-page.tsw";function Ju(e){return el(e)!==void 0?p$:e}function f$(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 m$(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 zu(e,t,n,r){let o=Yt(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(f$(t,l));if(c===void 0)continue;let p=m$(n,c);if(p===l)continue;let d=e[a.start],m=d==="'"||d==='"'?`${d}${p}${d}`:JSON.stringify(p);i.push({start:a.start,end:a.end,text:m})}return Ur(e,i)}function g$(e,t){return n=>t[n]??e.files[n]?.localPath??n}function h$(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(I(` ${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(I(" 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(I(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${re} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
215
- `)}function y$(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=zu(i.content,s,Ju(i.path),l=>o.get(l)??Vu(l,r.themeRoot)??Ox(l,r.componentsRoot));return{...i,content:a}})}function w$(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}=vx(i.content,s);l&&n.add(i.path);let c=t.files[i.path]?.styleIds??[],{desugared:p,hasNewStyles:d}=Fx(a,c);return d&&r.add(i.path),{...i,content:p}}),pathsWithNewNodes:n,pathsWithNewStyles:r}}function b$(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=mx(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=gx(o.content);r.push(s===void 0?o:{...o,content:s})}return{pushChanges:r,spliceFailures:n}}function D$(e,t,n,r){let o=y$(e,t,n,r),{pushChanges:i,pathsWithNewNodes:s,pathsWithNewStyles:a}=w$(o,t),{pushChanges:l,spliceFailures:c}=b$(i,t);return{pushChanges:l,pathsWithNewNodes:s,pathsWithNewStyles:a,spliceFailures:c}}async function k$(e,t,n,r,o){let i=[],s=!1,a=!1;for(let[l,c]of n.entries()){let p;try{p=await ax(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=p.schemaHash,i.push(...p.results);let d=p.results.some(m=>m.outcome==="conflict"||m.outcome==="error"||m.outcome==="skipped"||(m.rejected?.length??0)>0);if(p.results.some(m=>m.outcome==="committed")&&(s=!0),d&&l<n.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function E$(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 v$(e,t,n,r,o,i){let s={...e.files};for(let l of i)if(l.outcome==="committed")for(let[c,p]of Object.entries(l.hashes??{})){let d=r.get(c);if(!d||d.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:p,contentSha256:fn(d.content),...m?{localPath:m}:{}}}let a=E$(i);for(let{path:l,componentId:c,hash:p}of a){let d=r.get(l)?.content;if(d===void 0||p===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:p,contentSha256:fn(d),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{siteId:e.siteId??t,schemaHash:n,files:s},created:a}}function S$(e,t){for(let{path:n,componentId:r}of e)u.info(`${$} Created component ${t(n)} (id ${r})`),u.info(I(" id tracked locally \u2014 it will be spliced into this file on future pushes without changing it on disk"))}async function x$(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(p=>s.has(p))).map(c=>c.pageId))];if(a.length===0)return i;let l={...i.files};for(let c of Gu(a)){let p=await Za(e,t,{pageIds:c});for(let d of p.files){let m=l[d.path];if(!m)continue;let h={};if(r.has(d.path)){let{entries:g}=Uu(d.content);g.length>0&&(h.nodeIds=g)}if(o.has(d.path)){let{entries:g}=Wu(d.content);g.length>0&&(h.styleIds=g)}Object.keys(h).length>0&&(l[d.path]={...m,...h})}}return{...i,files:l}}function C$({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 F$(e){let t=Hu();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 _$(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 A$(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&&!hx(a.content),c=t.files[a.path]?.componentId,p=n[a.path]??a.path,d=l?I(" (new component \u2014 the platform will assign an id, tracked locally without changing this file)"):c?I(` (previously assigned id ${c} will be spliced in on push)`):a.baseHash?"":I(" (new)");u.info(` ${p}${d}`)}u.info("Dry run \u2014 no changes made.")}async function qu(e={}){let t=us(),n=F$(t.siteId),r=await Mx(n,t.layout,void 0,e.force),{changes:o,localPaths:i}=r;if(C$(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=g$(n,i);try{let{pushChanges:p,pathsWithNewNodes:d,pathsWithNewStyles:m,spliceFailures:h}=D$(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(_$(t.siteId,o,i,h)):A$(o,n,i,h,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let g=Bx(p),{results:y,schemaHash:b,aborted:S}=await k$(s,t.siteId,g,e.force?"rebase":void 0,n.schemaHash),_=new Map(o.map(E=>[E.path,E])),{lockfile:v,created:x}=v$(n,t.siteId,b,_,i,y);Qa(v);let O=new Set(y.flatMap(E=>E.outcome==="committed"?Object.keys(E.hashes??{}):[])),H=new Set([...d].filter(E=>O.has(E))),B=new Set([...m].filter(E=>O.has(E)));if(H.size>0||B.size>0)try{Qa(await x$(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 we=y.filter(E=>E.outcome==="conflict"),Se=y.filter(E=>E.outcome==="error"),me=y.filter(E=>E.outcome==="skipped"),Ne=y.flatMap(E=>E.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:b,results:y},null,2));else{S$(x,c);for(let U of y)u.info(h$(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, ${we.length} conflicted, ${Se.length} failed, ${me.length} skipped.${z}`),S&&u.warn(`${re} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(we.length>0||Se.length>0||me.length>0||Ne.length>0||h.length>0)throw new f(`${re} Push finished with ${we.length} conflict(s), ${Se.length} error(s), ${me.length} skipped page(s), ${Ne.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(p){throw await a.sendError(p instanceof Error?p:new Error(String(p)),"site_push",{duration:Date.now()-l}),p instanceof f?p:new f(p,{prefix:`${k} Failed to push site files:`})}}var Bo=require("fs"),Ux=require("module"),Mo=require("path");q();pe();C();A();M();X();function R$(e,t,n,r){let o=n.get(e.path);if(o)return $x(o,t);let i=Lx(e.path,t);if(i)return i;let s=r?.files[e.path]?.localPath;return ih(e.path,t,s)??e.path}function I$(e,t,n){if(!Array.isArray(e)||e.length===0)return;let r=(0,Ux.createRequire)((0,Mo.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 T$(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 P$(e,t){if(t){Ix();return}let n=Hu();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 ${Wr}/ 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 ${Wr}/ 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 Xu(e={}){let t=us(e.siteId),n=P$(t.siteId,!!e.reset),r=await T({apiToken:e.apiToken}),o=F.forSites({authToken:r}),i=Date.now();try{let s=await Za(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,p={},d=[];for(let E of Gu(a)){let z=await Za(r,t.siteId,{pageIds:E});c=z.schemaHash,p=z.componentIds??p,z.warnings&&d.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=Ku(U),ur=ge!==void 0&&fn(ge)!==z.contentSha256,dr=E.hash!==z.serverHash;ur&&dr&&g.set(E.path,U)}let y=!e.force,b=[...g.values()],S=process.cwd(),_=new Map(m.map(E=>[E.path,R$(E,t.layout,h,n)])),v=new Map;for(let[E,z]of _)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(_.values()),B=[],we=[],Se=[],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=_.get(E.path);Tx(U);let ge=(0,Mo.join)(S,U);(0,Bo.mkdirSync)((0,Mo.dirname)(ge),{recursive:!0});let ur=U.endsWith(".tsw")?zu(E.content,Ju(E.path),U,li=>_.get(li)??ih(li,t.layout,n?.files[li]?.localPath)):E.content,{sugared:dr,entries:J_}=Uu(ur),{sugared:Ay,entries:Ry}=Wu(dr),qd=U.endsWith(".tsw")?await T$(Ay,ge):Ay;(0,Bo.writeFileSync)(ge,qd,"utf8");let Iy=Qg(qd,J_);B.push(E);let Xr=z?z.localPath??E.path:void 0;if(z&&Xr&&Xr!==U&&!H.has(Xr)){let li=Ku(Xr);li===void 0||(fn(li)===z.contentSha256?((0,Bo.rmSync)((0,Mo.join)(S,Xr),{force:!0}),we.push({from:Xr,to:U})):Se.push({from:Xr,to:U}))}let Ty=p[E.path],Tl=h.get(E.path);O.files[E.path]={serverHash:E.hash,contentSha256:fn(qd),localPath:U,...Ty?{componentId:Ty}:{},...Iy.length>0?{nodeIds:Iy}:{},...Ry.length>0?{styleIds:Ry}:{},...Tl?{slug:Tl.slug,isDefault:Tl.isDefault,folderSegments:Tl.folderSegments}:{}}}let Ne=new Set(m.map(E=>E.path));for(let[E,z]of Object.entries(n?.files??{})){if(Ne.has(E))continue;let U=z.localPath??E;if(H.has(U))continue;let ge=Ku(U);ge!==void 0&&(fn(ge)===z.contentSha256?((0,Bo.rmSync)((0,Mo.join)(S,U),{force:!0}),me.push(U)):(Se.push({from:U,to:"(no longer on the site)"}),O.files[E]={...z,deletedUpstream:!0}))}if(Qa(O),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:E,slug:z,title:U,path:ge,folderSegments:ur})=>({pageId:E,slug:z,title:U,path:ge,folderSegments:ur})),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}:{},...we.length>0?{relocated:we}:{},...Se.length>0?{orphaned:Se}:{}},null,2));else{for(let E of B){let z=h.get(E.path),U=O.files[E.path]?.localPath??E.path,ge=z?I(` (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(I(` removed ${E} (no longer on the site)`));for(let{from:E,to:z}of we)u.info(I(` 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 Se)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 d){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:`})}}Vn();var Wx=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(ne()).addOption(He(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Vg),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(ne()).action(Gg),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(ne()).action(Kg),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(Ae()).addOption(ne()).action(Jg),Je()&&(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(qn()).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(Mu),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(qn()).addOption(Ae()).addOption(ne()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(qu),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(qn()).addOption(ne()).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(Xu))};q();C();A();M();X();De();async function Hx(e,t){return Z(t,"siteId"),Ja(`${P()}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function Vx(e,t,n){return Z(t,"siteId"),Z(n,"formId"),Ja(`${P()}/v2/sites/${t}/forms/${n}/submissions`,e,"formSubmissions","Failed to list submissions")}C();pe();var ah=["id","displayName","name","slug","createdOn","lastUpdated"],Gx=ut(ah);function Kx(){return ah}function Jx(e,t=["id","displayName","slug"]){if(e.length===0)return I("No forms found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${ah.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:I("\u2014")}));return qe(n,r)}function zx(e){if(e.length===0)return I("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?I("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return qe(n,r)}function qx(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 lh(e){Z(e.site,"siteId");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await Hx(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=_e(e.fields,Gx,Kx());u.info(Jx(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 Xx=w(require("fs"));q();C();A();M();X();async function ch(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 Vx(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=qx(o);Xx.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(zx(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 Yx=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(Tt()).addOption(ne()).addOption(He(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(lh),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(ch)};var Fh=w(require("fs")),_h=w(require("path"));A();var Ho=w(require("fs")),Wo=w(require("path")),Qu=w(require("tar"));C();A();var dh=w(require("fs")),Vr=w(require("path"));C();var $$=[/\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],O$=/[\r\n\u2028\u2029]+/g;function uh(e){if(e==null)return"";let t=String(e);for(let n of $$)t=t.replace(n,"");return t}function D(e){return uh(e).replace(O$," ").trim()}var Zx={impl:Vr.default.posix,caseInsensitive:!1},ph={impl:Vr.default.win32,caseInsensitive:!0};function Uo(){let e=process.platform;return e==="win32"?ph:{impl:Vr.default.posix,caseInsensitive:e==="darwin"}}function Yu(e,t){let n=t.impl.resolve(e);return t.caseInsensitive?n.toLowerCase():n}function Gr(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function rt(e,t,n=Uo()){if(Gr(e)||Gr(t))return!1;let r=Yu(e,n),o=Yu(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 Zu(e,t,n=Uo()){if(Gr(e)||Gr(t))return!1;let[r,o]=await Promise.all([mn(e),mn(t)]);return rt(r,o,n)}function Ue(e,t,n,r=Uo()){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 ps(e,t,n,r=Uo()){if(!await Zu(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 L$(e,t,n=Uo()){return rt(e,t,n)||rt(t,e,n)}async function fh(e,t,n=Uo()){if(Gr(e)||Gr(t))return!1;let[r,o]=await Promise.all([mn(e),mn(t)]);return L$(r,o,n)}function Ye(e,t,n=Uo()){return typeof e!="string"||typeof t!="string"||Gr(e)||Gr(t)?!1:Yu(e,n)===Yu(t,n)}async function mn(e){let t=Vr.default.resolve(e);try{return await dh.default.promises.realpath(t)}catch{}try{let n=await dh.default.promises.realpath(Vr.default.dirname(t));return Vr.default.join(n,Vr.default.basename(t))}catch{return t}}var N$=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function fs(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(N$.test(t))return"Windows reserved device name in entry path"}return null}var hh=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),j$=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),M$=32,B$=512,mh=10,tC=100,Qx=100;function nC(){return{retained:[],fatal:[],fatalCount:0,count:0}}function rC(e,t,n){e.count+=1;let r={code:t,message:uh(n)};e.retained.length<Qx&&e.retained.push(r),j$.has(t)&&(e.fatalCount+=1,e.fatal.length<Qx&&e.fatal.push(r))}async function oC(e,t,n){let r=await U$(n.containmentRoot),o=await W$(r,t),i=await eC(e),s=await V$(e,n),a=await K$(e,o,n);if(a.warnings.fatal.length>0)throw uC(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 q$(a.refused,a.refusedCount);let l=await eC(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 J$(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 eC(e){try{let t=await Ho.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 U$(e){try{return await Ho.default.promises.realpath(Wo.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 W$(e,t){let n=Wo.default.resolve(t);Ue(e,n,"the extraction directory");let o=Wo.default.relative(e,n).split(Wo.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Wo.default.join(i,s);let a=await H$(i);if(a===null){await Ho.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 H$(e){try{return await Ho.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 V$(e,t){let n=iC(t.limits),r=lC(t.consumedSubtrees),o=[],i=[],s=nC(),a=0,l=0,c=0,p=!1,d=!1,m=(h,g)=>{c+=1,o.length<tC&&o.push({entryPath:h,reason:g})};try{await Qu.list({file:e,onReadEntry:h=>{let g=h.path,y=h.type;if(sC(y)||(a+=1,a>n.maxFiles&&!p&&(p=!0,m(g,`archive has more than ${n.maxFiles} files`))),!hh.has(y)){let _=`unsupported entry type ${y}`;r(g)?m(g,_):p||i.push({entryPath:g,reason:_});return}let b=fs(g)??aC(g,n);if(b){m(g,b);return}let S=h.size;S>n.maxEntryBytes&&m(g,`entry is ${ms(S)}, over the ${ms(n.maxEntryBytes)} per-file cap`),l+=S,l>n.maxUnpackedBytes&&!d&&(d=!0,m(g,`unpacked total passes the ${ms(n.maxUnpackedBytes)} cap`))},onwarn:(h,g)=>{rC(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 z$(o,c);if(s.fatal.length>0)throw uC(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 G$(e,t,n,r){if(!hh.has(t))return`unsupported entry type ${t}`;let o=fs(e)??aC(e,r);return o||(n>r.maxEntryBytes?`entry is ${ms(n)}, over the ${ms(r.maxEntryBytes)} per-file cap`:null)}async function K$(e,t,n){let r=iC(n.limits),o=lC(n.consumedSubtrees),i=nC(),s=[],a=0,l=0,c=0,p=(h,g)=>(a+=1,s.length<tC&&s.push({entryPath:h,reason:g}),!1),d=()=>!1,m=(h,g)=>{let y="type"in g?g.type:g.isDirectory()?"Directory":"File",b=g.size;if(!hh.has(y)&&!o(h))return d();let S=G$(h,y,b,r);if(S)return p(h,S);if(c+b>r.maxUnpackedBytes)return p(h,`unpacked total passes the ${ms(r.maxUnpackedBytes)} cap`);if(!sC(y)){if(l+1>r.maxFiles)return p(h,`archive has more than ${r.maxFiles} files`);l+=1}return c+=b,!0};try{await Qu.extract({file:e,cwd:t,strip:n.strip??0,preservePaths:!1,filter:m,onwarn:(h,g)=>{rC(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 J$(e,t){Ue(e,await Ho.default.promises.realpath(t),"the extracted directory");let n=[t];for(;n.length>0;){let r=n.pop(),o=await Ho.default.promises.readdir(r,{withFileTypes:!0});for(let i of o){let s=Wo.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.`);Ue(e,s,"an extracted archive entry"),i.isDirectory()&&n.push(s)}}}function iC(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??M$,maxPathLength:e.maxPathLength??B$}}function sC(e){return e==="Directory"||e==="GNUDumpDir"}function gh(e){return e.replace(/\/+$/,"")}function aC(e,t){let n=gh(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 lC(e){let t=e.map(gh);return n=>{let r=gh(n).split("/").slice(1).join("/");return t.some(o=>r===o||r.startsWith(`${o}/`))}}function ms(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 z$(e,t){return new f(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
224
- ${cC(e,t).join(`
194
+ 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 d(`${a}${e.status} ${e.statusText}`+(s?`
195
+ ${s}`:""),l?{isUserError:!0}:void 0)}async function ax(e,t){let r=await K(`${O()}/cosmic/apps`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let n=await r.text(),o;try{o=JSON.parse(n)}catch{}let i=sx(o);throw i||await ht({status:r.status,statusText:r.statusText,text:async()=>n},{fallbackPrefix:"Failed to create app",userErrorOn4xx:!0})}return await r.json()}async function W$(e,t){let r=await K(Wo(`${O()}/cosmic/github/repositories`,{limit:sl,cursor:t}),{headers:tt(e)});if(!r.ok)throw await ht(r);return Gn(await r.json(),"repositories")}async function lx(e,t){let r=t.toLowerCase(),n=i=>i.fullName.toLowerCase()===r;return(await gs(i=>W$(e,i),{stopWhen:i=>i.some(n)})).find(n)??null}async function H$(e,t,r={}){let n=await K(Wo(`${O()}/cosmic/apps`,{limit:sl,cursor:t,filters:r}),{headers:tt(e)});if(!n.ok)throw await ht(n);return Gn(await n.json(),"apps")}async function Ku(e,t={}){return gs(r=>H$(e,r,t))}async function Ju(e,t){ve(t,"appId");let r=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{headers:tt(e)});if(!r.ok)throw await ht(r);return await r.json()}async function cx(e,t,r){ve(t,"appId");let n=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw await ht(n);return await n.json()}async function ux(e,t){ve(t,"appId");let r=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:tt(e)});if(!r.ok)throw await ht(r);return await r.json()}async function dx(e,t,r={}){ve(t,"appId");let n=Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:r.limit,cursor:r.cursor}),o=await K(n,{headers:tt(e)});if(!o.ok)throw await ht(o);let{items:i,nextCursor:s}=Gn(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function V$(e,t,r,n={}){let o=await K(Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:sl,cursor:r,filters:n}),{headers:tt(e)});if(!o.ok)throw await ht(o);return Gn(await o.json(),"environments")}async function Kn(e,t,r={}){return ve(t,"appId"),gs(n=>V$(e,t,n,r))}function px(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 fx(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/buildLogs${px(o)}`,{headers:tt(e)});if(!i.ok)throw await ht(i);return await i.json()}async function mx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/logs${px(n)}`,{headers:tt(e)});if(!o.ok)throw await ht(o);return await o.json()}async function gx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{limit:n.limit,cursor:n.cursor}),{headers:tt(e)});if(!o.ok)throw await ht(o);let{items:i,nextCursor:s}=Gn(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function zu(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}`,{headers:tt(e),signal:o.signal});if(!i.ok)throw await ht(i);return await i.json()}async function hx(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/redeploy`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await ht(i);return await i.json()}async function yx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json",...n.idempotencyKey?{"Idempotency-Key":n.idempotencyKey}:{}},body:JSON.stringify({})});if(!o.ok)throw await ht(o);return await o.json()}async function Pg(e){let t=await T(),r=_.forApps({authToken:t}),n=Date.now();try{let o={siteId:e.site,name:e.name,q:e.q},i=ys(o),s=await Ku(t,o);if(await r.sendUsage("apps_list",{duration:Date.now()-n,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=Fe(e.fields,bc,Fn());u.info(kc(s,a))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list apps:`}))}}var Ax=require("crypto"),Rx=require("fs"),ws=w(require("path"));Y();C();R();j();we();Pe();var G$=[/\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],K$=/[\r\n\u2028\u2029]+/g;function al(e){if(e==null)return"";let t=String(e);for(let r of G$)t=t.replace(r,"");return t}function b(e){return al(e).replace(K$," ").trim()}Z();C();function Q(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new d(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}var wx=require("child_process"),bx=require("crypto"),qu=require("fs"),kx=require("os"),Dx=w(require("path")),Ex=require("util");C();var $g=(0,Ex.promisify)(wx.execFile);function J$(){return Dx.default.resolve((0,kx.tmpdir)(),`webflow-cli-disabled-askpass-${(0,bx.randomUUID)()}`)}function vx(e){return{...process.env,...e.nonInteractive&&{GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:J$()}}}async function Og(e){try{await $g("git",["check-ref-format","--branch",e],{})}catch(t){throw t?.code==="ENOENT"?new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0}):typeof t?.code!="number"?new d(`Could not validate the branch name with git: ${t instanceof Error?t.message:String(t)}`,{isUserError:!0}):new d("Invalid branch name.",{isUserError:!0,missingFlag:"--branch"})}}async function Lg(e,t,r={}){try{return await $g("git",["ls-remote","--exit-code","--heads","--",e,`refs/heads/${t}`],{env:vx(r)}),"exists"}catch(n){if(n?.code==="ENOENT")throw new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0});return n?.code===2?"missing":"unverifiable"}}async function Sx(e,t,r={}){let n=await Lg(e,t,r);if(n==="missing")throw new d("The repository does not contain the requested branch.",{isUserError:!0,missingFlag:"--branch"});if(n==="unverifiable")throw new d("Could not verify the requested branch before creating an app. Ensure git can access the repository, then retry.",{isUserError:!0,missingFlag:"--branch"})}function xx(e){let t;try{t=(0,qu.lstatSync)(e)}catch(n){if(n.code==="ENOENT")return;throw new d(`Cannot inspect the target directory ${e}: ${n instanceof Error?n.message:String(n)}`,{isUserError:!0})}if(t.isSymbolicLink())throw new d(`${e} already exists as a symbolic link. Move or remove it, or run this command from a different directory.`,{isUserError:!0});let r;try{r=(0,qu.readdirSync)(e)}catch(n){throw new d(`Cannot read the target directory ${e}: ${n instanceof Error?n.message:String(n)}`,{isUserError:!0})}if(r.length>0)throw new d(`${e} already exists and is not empty. Move or remove it, or run this command from a different directory.`,{isUserError:!0})}async function Cx(e,t,r,n={}){let o=["clone"];r&&o.push("--branch",r),o.push("--",e,t);try{await $g("git",o,{env:vx(n)})}catch(i){let s=typeof i?.stderr=="string"?al(i.stderr).trim():"";throw i?.code==="ENOENT"?new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0}):new d(`Failed to clone repository${s?`:
196
+ ${s}`:"."}`,{isUserError:!0})}}C();var Yu="github.com",z$=/^[A-Za-z0-9][A-Za-z0-9-]*$/,q$=/^[A-Za-z0-9._-]+$/,Y$=/[\x00-\x1f\x7f]/;function $t(e){throw new d(`Invalid --import repository URL: ${e}`,{isUserError:!0,missingFlag:"--import"})}function ll(e){return b(e)}function X$(e){let t=e.match(/^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#]*([^?#]*)/)?.[1];return t?t.split("/").some(r=>{try{let n=decodeURIComponent(r);return n==="."||n===".."}catch{return!1}}):!1}function Fx(e){let t=e.trim();t===""&&$t("value is empty."),Y$.test(t)&&$t("value contains control characters."),t.startsWith("-")&&$t("value must not start with '-'."),X$(t)&&$t("path must not contain '.' or '..' segments.");let r;try{r=new URL(t)}catch{$t(`value is not a URL. Expected https://${Yu}/<owner>/<repo>.`)}r.protocol!=="https:"&&$t(`only https:// URLs are supported (got "${ll(r.protocol)}").`),(r.username!==""||r.password!=="")&&$t("URLs must not embed credentials."),r.hostname.toLowerCase()!==Yu&&$t(`only ${Yu} repositories are supported.`),(r.search!==""||r.hash!=="")&&$t("URLs must not contain a query string or fragment.");let n=r.pathname.split("/").filter(s=>s!=="");n.length!==2&&$t(`expected exactly <owner>/<repo> in the path (got "${ll(r.pathname)}").`);let o=n[0],i=n[1].replace(/\.git$/i,"");return z$.test(o)||$t(`"${ll(o)}" is not a valid owner.`),(i===""||!q$.test(i))&&$t(`"${ll(n[1])}" is not a valid repository name.`),/^\.+$/.test(i)&&$t(`"${ll(n[1])}" is not a valid repository name.`),{url:`https://${Yu}/${o}/${i}`,owner:o,repo:i,fullName:`${o}/${i}`}}var Z$="main",Q$="CLONE_FAILED";function eO(e,t,r){let n=r?` and cloud.environment_id "${r}"`:"";return`write cloud.app_id "${e}"${n} to ${ws.default.join(t,"webflow.json")}, then deploy with git push to the tracked branch`}var tO=/[\x00-\x1f\x7f]/;function Ix(e){return tO.test(e)||b(e)!==e}function Tx(e){if(e.startsWith("-")||Ix(e))throw new d("Invalid branch name.",{isUserError:!0,missingFlag:"--branch"})}function rO(e,t){let r=t?.trim(),n=r&&r!==""?r:e,o=r?"--app-name":`repository name "${e}"`;if(Ix(n))throw new d("App name must not contain terminal control or formatting characters.",{isUserError:!0,missingFlag:"--app-name"});if(n.length<Jt||n.length>zt)throw new d(`App name must be between ${Jt} and ${zt} characters, but ${o} is ${n.length}. Pass --app-name with a name in that range.`,{isUserError:!0,missingFlag:"--app-name"});return n}async function nO(e,t,r){if(r)return{branch:r,source:"flag"};let n;try{n=await lx(e,t)}catch(o){throw new d(`Could not look up the default branch for ${t}: ${o instanceof Error?o.message:String(o)}
197
+ Pass --branch to skip the lookup.`,{isUserError:!0,missingFlag:"--branch"})}return n?.defaultBranch?(Tx(n.defaultBranch),await Og(n.defaultBranch),{branch:n.defaultBranch,source:"resolved"}):{branch:Z$,source:"fallback"}}function oO(e){try{Q(e,"siteId")}catch(t){throw t instanceof d?new d(b(t.message),{isUserError:!0,missingFlag:"--site-id"}):t}}function iO(e){if(e==="/")throw new d(`Mount path cannot be "/" when attaching to an existing site: the root is served by the site's own pages, so an app there would take the site over. Pick a path such as --mount /app, or pass --new to create a standalone app that owns its root.`,{isUserError:!0,missingFlag:"--mount"})}function sO(e){let t=e.siteId!==void 0;if(t&&e.newSite)throw new d("--new and --site-id are mutually exclusive. Use --site-id to attach the app to an existing site, or --new to create a standalone app.",{isUserError:!0,missingFlag:"--new"});if(!t&&!e.newSite)throw new d("--import requires exactly one target: pass --site-id <siteId> to attach to an existing site or --new to create a standalone app.",{isUserError:!0,missingFlag:"--site-id"});return t?{siteId:e.siteId,source:"flag"}:{source:"new"}}function aO(e){return e.siteId??"(a new site would be created)"}async function _x(e,t){try{let r=await Kn(e,t);return r.length===1?r[0].id:void 0}catch(r){u.debug(`Could not read environments for app ${t}: ${r}`);return}}function lO(e){let t=ws.default.join(e,"webflow.json"),r;try{r=(0,Rx.lstatSync)(t)}catch(n){if(n.code==="ENOENT")return;throw n}if(!r.isFile())throw new Error(`${t} is a symbolic link or another non-regular file, so reading or writing it could touch a file outside the clone`)}function cO(e,t){let r;try{return lO(e),r=process.cwd(),process.chdir(e),uO(t),{written:!0}}catch(n){return{written:!1,reason:n instanceof Error?n.message:String(n)}}finally{if(r!==void 0)try{process.chdir(r)}catch(n){u.warn(`${X} Could not return to ${r}: ${n instanceof Error?n.message:String(n)}`)}}}function uO(e){Se({...e.siteId?{siteId:e.siteId}:{},cloud:{app_id:e.appId,environment_id:e.environmentId,project_id:void 0,workspace_id:void 0}})}function dO(e,t){u.info(`${$} App created: ${e.id}`),u.info(` Name: ${e.name}`),u.info(` Branch: ${t.branch}`),u.info(` Directory: ${t.directory}`),t.mount!==void 0&&u.warn(`${X} Requested mount ${t.mount} is not honored by the server yet \u2014 this app is currently served at its default mount instead.`),t.linkage.written?t.environmentId||u.warn(`${X} Could not read this app's environment, so only app_id was written to webflow.json. Commands that need an environment will ask for --environment-id until the app is readable.`):u.warn(`${X} The app was created and cloned, but writing the linkage into ${t.directory}/webflow.json failed: ${b(t.linkage.reason)}. Nothing needs re-running \u2014 ${eO(e.id,t.directory,t.environmentId)}.`),e.deployStatus==="triggered"&&e.deployment?u.info(`${xe} Initial deploy queued: ${e.deployment.dashboardUrl}`):e.message&&u.warn(`${X} ${e.message}`)}async function Ng(e){let t=Fx(e.import),r=rO(t.repo,e.appName),n=e.branch?.trim()||void 0;n&&(Tx(n),await Og(n)),e.siteId!==void 0&&oO(e.siteId);let o=sO(e),i=e.mount!==void 0?dn(e.mount):void 0;if(i!==void 0){if(!Bo(i))throw new d(`Invalid mount path: ${JSON.stringify(e.mount)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`,{isUserError:!0,missingFlag:"--mount"});if(o.source==="new")throw new d("--mount cannot be combined with --new: a standalone app owns the root of its own domain, so it always mounts at /. Use --site-id <siteId> to attach the app to an existing site at a path.",{isUserError:!0,missingFlag:"--mount"});iO(i)}if(o.source==="flag"&&i===void 0)throw new d("--site-id requires --mount <path> for repository imports. Use a non-root path such as --mount /app.",{isUserError:!0,missingFlag:"--mount"});let s=ws.default.resolve(process.cwd(),t.repo);if(xx(s),ic())throw new d(`--manifest cannot be combined with --import: the linkage is written into the repository being cloned, at ${ws.default.join(s,"webflow.json")}. Re-run without --manifest.`,{isUserError:!0,missingFlag:"--manifest"});let a=e.idempotencyKey?.trim()||void 0;if(V()&&!a)throw new d("--idempotency-key is required for non-interactive --import creates so a retry can safely replay the same create.",{isUserError:!0,missingFlag:"--idempotency-key"});let l=await T();if(e.dryRun){let G={repoUrl:t.url,branch:n??null,appName:r,siteId:o.siteId??null,siteSource:o.source,mount:i??null,directory:s,dryRun:!0};e.json?u.info(JSON.stringify(G,null,2)):(u.info(`Dry run \u2014 would create app "${r}"`),u.info(` Repository: ${G.repoUrl}`),u.info(` Branch: ${G.branch??"(default branch of the repo)"}`),u.info(` Site: ${aO(e)}`),u.info(` Mount: ${G.mount===null?"(server default: /)":`${G.mount} (requested \u2014 the server does not honor this field yet, so the app will mount at its current default until that ships)`}`),u.info(` Clone into: ${s}`),u.info("Dry run complete \u2014 no changes made."));return}if(n){let G=e.json?void 0:u.spinner("Checking requested branch");try{await Sx(t.url,n,{nonInteractive:V()}),G?.succeed(`Using branch "${n}"`)}catch(ce){throw G?.fail("Requested branch is unavailable"),ce}}let c=_.forApps({authToken:l,suppressCommand:!0}),p=Date.now(),f=G=>e.json?void 0:u.spinner(G),m=n?void 0:f("Looking up repository"),g,h;try{({branch:g,source:h}=await nO(l,t.fullName,n)),m?.succeed(`Using branch "${g}"`)}catch(G){throw m?.fail("Could not look up repository"),G}let y;if(h!=="flag"){let G=e.json?void 0:u.spinner(`Confirming "${g}" still exists on the remote`);try{y=await Lg(t.url,g,{nonInteractive:V()})}catch(ce){throw G?.fail("Could not check the resolved branch"),ce}if(y==="missing")throw G?.fail("Resolved branch is unavailable"),new d(`${h==="fallback"?"No branch was given and the repository is not visible to discovery, so":"The repository's default branch resolved to"} "${g}", which does not exist on the remote. Pass --branch <name> with the branch to build.`,{isUserError:!0,missingFlag:"--branch"});y==="unverifiable"?G?.warn(`Could not confirm "${g}" exists on the remote \u2014 continuing`):G?.succeed(`Branch "${g}" exists on the remote`)}let k=y??"exists",v=a??(0,Ax.randomUUID)(),F,E=f("Creating app");try{F=await ax(l,{cloudApp:{displayName:r,siteId:o.siteId,...i!==void 0&&{mount:i},source:{type:"GITHUB",github:{sourceUrl:t.url,branch:g}}},requestId:v}),E?.succeed("App created")}catch(G){throw E?.fail("Could not create app"),G instanceof hs&&e.json?(u.info(JSON.stringify({error:{message:G.message,code:G.code,installUrl:G.installUrl??null}},null,2)),new d(G.message,{isUserError:!0,skipLogging:!0})):G instanceof d&&G.isUserError?G:(await c.sendError(G instanceof Error?G:new Error(String(G)),"apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,stage:"create"}),new d(`${G instanceof Error?G.message:String(G)}
198
+ The create may still have succeeded server-side with its response lost. Retry with --idempotency-key ${v} to replay this exact attempt instead of creating a second app.`,{prefix:"Failed to create app:"}))}let S=h==="fallback"&&y!=="exists"?void 0:g,L=f("Cloning repository");try{await Cx(t.url,s,S,{nonInteractive:V()}),L?.succeed("Repository cloned")}catch(G){L?.fail("Could not clone repository");let ce=await _x(l,F.id),Be={clone:{repositoryUrl:t.url,directory:s,branch:S??null},linkage:{manifestPath:ws.default.join(s,"webflow.json"),cloud:{app_id:F.id,environment_id:ce??null}},deploy:{command:"git push",description:"Push to the tracked branch after restoring the linkage."}},A=a?"Do not re-run --import unless you reuse the exact idempotency key supplied to this invocation.":"Do not re-run --import: this invocation used a generated idempotency key that cannot be reused, so a retry would create a second app.",q=`App ${F.id} was created, but cloning ${t.url} failed. ${A} Clone the repository, restore the linkage in webflow.json, then deploy with git push.`,W=G instanceof Error?G.message:String(G);throw await c.sendError(G instanceof Error?G:new Error(String(G)),"apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,stage:"clone"}),e.json?(u.info(JSON.stringify({error:{message:q,code:Q$,appId:F.id,recoveryInstructions:Be,branchVerification:k,mount:i??null,reason:W}},null,2)),new d(`${q}
199
+ ${W}`,{isUserError:!0,skipLogging:!0})):(u.warn(`${X} ${q}`),G)}let U=f("Linking app to repository"),N=await _x(l,F.id),te=cO(s,{siteId:F.siteId,appId:F.id,environmentId:N});if(te.written?U?.succeed(N?"Webflow linkage written":"Webflow linkage written (app_id only)"):U?.warn("Could not write Webflow linkage"),await c.sendUsage("apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,deployStatus:F.deployStatus,linkageWritten:te.written}),e.json){u.info(JSON.stringify({...F,deployStatus:F.deployStatus??null,message:F.message??null,siteSource:o.source,branch:g,branchVerification:k,mount:i??null,directory:s,environmentId:N??null,linkageWritten:te.written,linkageError:te.written?null:te.reason},null,2));return}dO(F,{directory:s,branch:g,mount:i,environmentId:N,linkage:te})}Y();C();R();j();Z();Pe();C();we();Oe();async function Xu(e,t={}){let r=await Ku(e);if(r.length===0)throw new d("No apps found in this workspace.",{isUserError:!0});if(r.length===1)return r[0].id;if(V()||t.json){let o=r.map(i=>` ${i.id} (${i.name})`).join(`
200
+ `);throw new d(`This workspace has multiple apps. Pass the app id to choose one:
201
+ ${o}`,{isUserError:!0,missingFlag:"appId"})}let n=await je({message:"Select an app:",choices:r.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!n)throw new d("No app selected.",{isUserError:!0});return n}async function Nr(e,t,r){let{manifest:n}=oe();return Mo("appId",{flagValue:t,manifest:n,isNoInput:!1,json:r.json,prompt:()=>Xu(e,{json:r.json})})}async function jg(e,t){let r=await T(),n=await Nr(r,e,t),o=_.forApps({authToken:r}),i=Date.now();try{let s=await Ju(r,n);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=Fe(t.fields,bc,Fn());u.info(kc([s],a))}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to get app:`}))}}Y();C();R();j();Z();async function Mg(e,t){let r=await T(),n=await Nr(r,e,t),o=_.forApps({authToken:r}),i=Date.now();try{let s=await dx(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=Fe(t.fields,Ek,ha());u.info(Sk(s.customDomains,a)+Ai(s.nextCursor))}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to get app domains:`}))}}Y();C();R();j();Z();async function Bg(e,t){let r=await T(),n=await Nr(r,e,t),o=t.json?void 0:Fe(t.fields,vk,ya()),i=_.forApps({authToken:r}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=ys(a),c=await Kn(r,n,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(xk(c,o))}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to list app environments:`}))}}Y();C();R();j();Z();me();var Ug=["timestamp","message","phase"],cl="timestamp,message",Zu=dt(Ug);function Jn(){return Ug}function pO(e,t){return e==null||e===""?P("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function fO(e,t=cl.split(",")){return e.map(r=>t.map(n=>pO(r[n],n)).join(" ")).join(`
202
+ `)}function Qu(e,t,r){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":fO(e.logs,r)+Ai(e.nextCursor)}Pe();C();we();Oe();async function Px(e,t,r={}){let n=await Kn(e,t);if(n.length===0)throw new d("No environments found for this app.",{isUserError:!0});if(n.length===1)return n[0].id;if(V()||r.json){let i=n.map(s=>` ${s.id} (${s.branch})`).join(`
203
+ `);throw new d(`This app has multiple environments. Pass the environment id to choose one:
204
+ ${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await je({message:"Select an environment:",choices:n.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new d("No environment selected.",{isUserError:!0});return o}async function qe(e,t){let{manifest:r}=oe(),n=await Mo("appId",{flagValue:t.appId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>Xu(e,{json:t.json})}),o=await Mo("environmentId",{flagValue:t.environmentId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>Px(e,n,{json:t.json})});return{appId:n,envId:o}}async function Wg(e,t){if(!e)throw new d("Missing deployment ID. Run 'webflow apps deployments list' to find one, then pass it as the argument.",{isUserError:!0,missingFlag:"depId"});let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json}),i=t.json?void 0:Fe(t.fields,Zu,Jn()),s=_.forApps({authToken:r}),a=Date.now();try{let l=await fx(r,n,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(Qu(l,t,i))}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to read build logs:`}))}}Y();C();R();j();Z();async function Hg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{environmentId:e,json:t.json}),i=t.json?void 0:Fe(t.fields,Zu,Jn()),s=_.forApps({authToken:r}),a=Date.now();try{let l=await mx(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(Qu(l,t,i))}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to read runtime logs:`}))}}Y();C();R();j();Z();async function Vg(e){let t=await T(),{appId:r,envId:n}=await qe(t,{json:e.json}),o=e.json?void 0:Fe(e.fields,vc,_n()),i=_.forApps({authToken:t}),s=Date.now();try{let a=await gx(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(ba(a.deployments,o)+Ai(a.nextCursor))}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to list deployments:`}))}}Y();me();C();we();R();j();Z();var mO=5,$x=1800;function gO(e){return new Promise(t=>setTimeout(t,e))}async function Ox(e,t,r,n,o={}){let i=Math.min($x,Math.max(mO,o.interval??Dc)),s=Math.min($x,Math.max(1,o.timeout??Ec)),a=Date.now()+s*1e3,l,c,p=!1;for(;;){let f=new AbortController,m=setTimeout(()=>f.abort(),Math.max(0,a-Date.now())),g;try{g=await zu(e,t,r,n,{signal:f.signal})}catch(k){if(f.signal.aborted){p=!0;break}throw k}finally{clearTimeout(m)}c=g;let h=g.status;if(Fk(h))break;let y=a-Date.now();if(y<=0){p=!0;break}if(h!==l&&o.onStatusChange?.(l,h),l=h,await gO(Math.min(i*1e3,y)),Date.now()>=a){p=!0;break}}return{deployment:c,timedOut:p,timeoutSeconds:s}}async function Gg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json}),i=t.json?void 0:Fe(t.fields,vc,_n()),s=_.forApps({authToken:r}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let p=!t.json&&!V(),{deployment:f,timedOut:m,timeoutSeconds:g}=await Ox(r,n,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:p?(y,k)=>u.info(P(y===void 0?k:`${y} \u2192 ${k}`)):void 0}),h=m?"timeout":f?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:h}),process.exitCode=!m&&f?.status==="success"?0:1,t.json){u.info(JSON.stringify(f??null,null,2));return}f&&u.info(ba([f],i)),m&&u.warn(`Timed out after ${g}s waiting for a terminal status (last status: ${f?.status??"unknown"}).`);return}let c=await zu(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(ba([c],i))}catch(c){throw c instanceof d&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new d(c,{prefix:`${D} Failed to ${t.wait?"watch":"get"} deployment:`}))}}Y();me();C();R();j();Z();async function Kg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json});if(t.dryRun){ve(n,"appId"),ve(o,"environmentId"),Vn(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 hx(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(`${$} Redeploy queued \u2014 commit ${l}`):u.info(`${xe} Redeploy in progress \u2014 commit ${l} ${P("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_redeploy",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to redeploy deployment:`}))}}Y();me();C();var Lx=require("child_process");function Nx(){try{let e=(0,Lx.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}R();j();Z();function hO(e){let t=Nx();e&&t&&e!==t&&u.warn(`This will rebuild \`${e}\`, you're currently on \`${t}\`.`)}async function yO(e,t,r){try{return(await Kn(e,t)).find(o=>o.id===r)}catch{return}}async function Jg(e){let t=await T(),{appId:r,envId:n}=await qe(t,{json:e.json}),o=await yO(t,r,n);if(hO(o?.branch),e.dryRun){ve(r,"appId"),ve(n,"environmentId"),e.json?u.info(JSON.stringify({appId:r,environmentId:n,branch:o?.branch??null,dryRun:!0},null,2)):(u.info(`Would trigger a build of ${o?.branch?`\`${o.branch}\` `:""}in app ${r}, environment ${n}.`),u.info("Dry run \u2014 no changes made."));return}let i=_.forApps({authToken:t,suppressCommand:!!e.idempotencyKey}),s=Date.now();try{let a=await yx(t,r,n,{idempotencyKey:e.idempotencyKey});if(await i.sendUsage("apps_deployments_trigger",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}a.status==="queued"?u.info(`${$} Trigger queued${o?.branch?` for \`${o.branch}\``:""}.`):a.status==="skipped"?u.info(`${xe} Nothing to build \u2014 the branch has no commits yet. Push a commit and try again.`):u.info(`${xe} Trigger in progress ${P("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_trigger",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to trigger deployment:`}))}}Y();C();R();j();Z();async function zg(e,t){if(t.name===void 0&&t.description===void 0)throw new d("Provide --name or --description",{isUserError:!0});let r=await T(),n=await Nr(r,e,t);if(ve(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 cx(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(`${$} App updated: ${s.id}`),s.name&&u.info(` Name: ${s.name}`),s.description!=null&&u.info(` Description: ${s.description}`)}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to update app:`}))}}Y();C();we();Oe();R();j();Z();async function qg(e,t){let r=await T(),n=await Nr(r,e,t);if(ve(n,"appId"),!t.dryRun&&!t.yes&&(V()||t.json))throw new d("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await Ju(r,n),a=Ck(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 $e({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=_.forApps({authToken:r}),i=Date.now();try{let s=await ux(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 d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to delete app:`}))}}Y();C();R();j();Z();ke();C();lt();var bs=100;function Yg(e,t){return`${O()}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function Xg(e,t){return ht(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function wO(e,t,r,n,o={}){let i=Wo(Yg(t,r),{limit:sl,cursor:n,filters:o}),s=await K(i,{headers:tt(e)});if(!s.ok)throw await Xg(s,"Failed to list environment variables");return Gn(await s.json(),"variables")}async function Zg(e,t,r,n={}){return gs(o=>wO(e,t,r,o,n))}async function Qg(e,t,r,n){let o=await K(`${Yg(t,r)}/${encodeURIComponent(n)}`,{method:"DELETE",headers:tt(e)});if(!o.ok)throw await Xg(o,"Failed to delete environment variable")}async function ul(e,t,r,n,o){let i=Object.keys(n).length;if(i>bs)throw new d(`Cannot import more than ${bs} variables at once (received ${i}).`,{isUserError:!0});let s=await K(`${Yg(t,r)}/bulk`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:n,overwriteExisting:o})});if(!s.ok)throw await Xg(s,"Failed to import environment variables");return await s.json()}var jx=require("dotenv");me();var Mx=["key","isSecret","value","id","environmentId"],dl=["key","isSecret"];function ks(){return Mx}var eh=dt(Mx);function bO(e,t){switch(t){case"value":return e.isSecret?P("(secret)"):e.value!==""?e.value:P("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):P("\u2014")}}function th(e,t=dl){if(e.length===0)return P("No environment variables found.");let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>bO(o,i)));return ze(r,n)}function rh(e){let t=e.split(/\r?\n/).map(r=>r.replace(/^\s*export\s+/,"")).join(`
205
+ `);return(0,jx.parse)(t)}async function nh(e){let t=await T(),r=_.forAppsEnvVars({authToken:t}),n=Date.now();try{let{appId:o,envId:i}=await qe(t,e),s={key:e.key,q:e.q},a=ys(s),l=await Zg(t,o,i,s);if(await r.sendUsage("apps_env_vars_list",{duration:Date.now()-n,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=Fe(e.fields,eh,ks());u.info(th(l,c))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list environment variables:`}))}}Y();C();R();j();Z();C();we();Oe();R();j();async function Bx(){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 oh(e){u.warn(`${X} 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 Ux(e,t){if(e!==void 0)return t.secret&&!t.json&&oh(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let r=await Bx();if(r==="")throw new d(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:r,source:"stdin"}}if(!V()){let r=t.secret?await Xb({message:`Enter the value for ${t.key}:`}):await Ge({message:`Enter the value for ${t.key}:`});if(r===null||r==="")throw new d(`No value provided for ${t.key}.`,{isUserError:!0});return{value:r,source:"prompt"}}throw new d(`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 ih(e,t,r){let n=r.secret?" (secret)":"",o=await T(),i=_.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await qe(o,r);if(r.dryRun){t!==void 0&&r.secret&&!r.json&&oh(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:p}=await Ux(t,{key:e,secret:r.secret,json:r.json}),f={[e]:{value:c,...r.secret?{isSecret:!0}:{}}},m=await ul(o,a,l,f,!0),g=[...m.created,...m.updated,...m.skipped].find(y=>y.key===e);if(!g){let y=m.errors.find(k=>k.key===e);throw new d(y?`Failed to set ${e}: ${y.error}`:`Set did not apply to ${e}.`,{isUserError:!!y})}let h=g.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:r.secret?"secret":"plain",valueSource:p}),r.json){u.info(JSON.stringify({key:e,isSecret:h,status:"set"},null,2));return}u.info(`${$} Set ${e}${h?" (secret)":""}`)}catch(c){throw c instanceof d&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new d(c,{prefix:`${D} Failed to set environment variable:`}))}}Y();C();R();j();Z();async function sh(e,t){let r=await T(),n=_.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await qe(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 Qg(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(`${$} Deleted ${e}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await n.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new d(a,{prefix:`${D} Failed to delete environment variable:`}))}}var Wx=require("fs"),Hx=require("path");Y();C();R();j();Z();function ah(e){return e.map(({id:t,environmentId:r,key:n,isSecret:o})=>({id:t,environmentId:r,key:n,isSecret:o}))}async function lh(e,t){let r=await T(),n=_.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await qe(r,t),a;try{a=(0,Wx.readFileSync)((0,Hx.resolve)(e),"utf8")}catch{throw new d(`Could not read file: ${e}`,{isUserError:!0})}let l=rh(a),c=Object.keys(l);if(c.length===0)throw new d(`No variables found in ${e}.`,{isUserError:!0});if(c.length>bs)throw new d(`Cannot import more than ${bs} variables at once (${e} has ${c.length}).`,{isUserError:!0});let p={};for(let f of c)p[f]={value:l[f],...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 f of c)u.info(` ${f}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let f=await ul(r,i,s,p,!0);if(await n.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:f.created.length,updatedCount:f.updated.length,skippedCount:f.skipped.length,errorCount:f.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:ah(f.created),updated:ah(f.updated),skipped:ah(f.skipped),errors:f.errors},null,2));else{u.info(`${$} Imported: ${f.created.length} created, ${f.updated.length} updated, ${f.skipped.length} skipped, ${f.errors.length} failed`);for(let m of f.errors)u.warn(` ${m.key}: ${m.error}`)}if(f.errors.length>0)throw new d(`Import completed with ${f.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(f){throw f instanceof d&&f.isUserError?f:(await n.sendError(f instanceof Error?f:new Error(String(f)),"apps_env_vars_import",{duration:Date.now()-o}),new d(f,{prefix:`${D} Failed to import environment variables:`}))}}me();C();R();j();qr();function Jx(e,t,r){Ke()&&e==="cloud"&&(r.json||u.warn(`${X} ${ue(`webflow cloud ${t}`)} is deprecated \u2014 use ${ue(`webflow apps ${t}`)} instead.`))}var Vx={branch:"--branch selects which branch of the repository to build",idempotencyKey:"--idempotency-key dedupes a retried create from a repository",json:"--json describes the app created from a repository",dryRun:"--dry-run previews the app that would be created from a repository"},Gx={framework:"--framework selects a starter template",workspaceId:"--workspace-id is derived from your token when using --import",projectName:"--project-name is deprecated \u2014 use --app-name"};function kO(e){if(e.import===void 0){for(let t of Object.keys(Vx))if(e[t]!==void 0){let r=Kx(t);throw new d(`${r} is only supported together with --import <repo-url> (${Vx[t]}).`,{isUserError:!0,missingFlag:"--import"})}return}if(e.import.trim()==="")throw new d("--import requires a repository URL.",{isUserError:!0,missingFlag:"--import"});for(let t of Object.keys(Gx))if(e[t]!==void 0){let r=Kx(t);throw new d(`${r} cannot be combined with --import (${Gx[t]}).`,{isUserError:!0,missingFlag:r})}if(e.new&&e.siteId)throw new d("--new and --site-id are mutually exclusive. Use --site-id to attach the app to an existing site, or --new to create a standalone app.",{isUserError:!0,missingFlag:"--new"});if(!e.new&&!e.siteId)throw new d("--import requires either --site-id <siteId> to attach to an existing site or --new to create a standalone app. A siteId from the repository is not used to choose the mutation target.",{isUserError:!0,missingFlag:"--site-id"});if(e.new&&e.mount!==void 0)throw new d("--mount cannot be combined with --new: a standalone app owns the root of its own domain, so it always mounts at /. Use --site-id <siteId> to attach the app to an existing site at a path.",{isUserError:!0,missingFlag:"--mount"});if(e.siteId&&e.mount===void 0)throw new d("--site-id requires --mount <path> for repository imports. Use a non-root path such as --mount /app.",{isUserError:!0,missingFlag:"--mount"})}function Kx(e){return`--${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function ed(e,{namespace:t}){let r=t==="apps",n=e.command("init").description(r?"Bootstrap a new Webflow Cloud app, from a starter template or from an existing GitHub repository (--import)":"Bootstrap a new Webflow Cloud app from a starter template").addOption(new pn.Option("-n, --app-name <name>","App name")).addOption(new pn.Option("--project-name <name>",`${Kr} 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). With --import: required (non-root) when attaching to a site with --site-id, not allowed with --new").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)");r&&n.option("--import <repo-url>","Create the app from an existing GitHub repository (https://github.com/<owner>/<repo>) and clone it locally. Requires --site-id to attach to an existing site or --new to create a standalone app. The Webflow GitHub App must be installed on the repository and connected to your workspace.").option("--branch <branch>","Branch to build when using --import. Defaults to the repository's default branch.").option("--idempotency-key <key>","Required for non-interactive runs (CI, --no-input). Reuse a retry-stable key unique to this repository and target (for example, $GITHUB_RUN_ID-$REPOSITORY-$SITE_ID) so a retry replays the original app instead of creating a second one").addOption(new pn.Option("--json","Output as JSON when using --import")).addOption(new pn.Option("--dry-run","Preview the repository import without executing")),n.action(async(o,i)=>{if(Fg(t),Jx(t,"init",o),kO(o),r&&o.import!==void 0){await Ng({import:o.import,branch:o.branch,appName:o.appName,siteId:o.siteId,newSite:o.new,mount:o.mount,idempotencyKey:o.idempotencyKey,json:o.json,dryRun:o.dryRun});return}await DO(o,i)})}function td(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 pn.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new pn.Option("--project-name <name>",`${Kr} 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 pn.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new pn.Option("--project-id <appId>",`${Kr} 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)=>{Fg(t),Jx(t,"deploy",r),await EO(r,n)})}var DO=Rg,EO=Ig;var zx=e=>{let t=Ke(),r=e.command("cloud").description(t?`${Kr} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");r.command("create").description(`${Kr} 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(_g),r.command("list").description(t?`${Kr} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Kr} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(Ag),ed(r,{namespace:"cloud"}),td(r,{namespace:"cloud"})};var qx=require("commander");qr();var Yx=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");ed(t,{namespace:"apps"}),td(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. ${Sc("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.",Ri).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",Ri).addOption(xc("the app name")).addOption(re()).addOption(We([...Fn()]).default(hc)).action(Pg),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(re()).addOption(We([...Fn()]).default(Bf)).action(jg),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(We([...ha()]).default(yc)).addOption(re()).option("--limit <n>","Max number of domains to return (server caps at 100)",Ac).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Mg),Ke()&&(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(re()).addOption(_e()).action(zg),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(re()).addOption(_e()).action(qg)),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). ${Sc("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.",Ri).addOption(xc("the environment branch")).addOption(We([...ya()]).default(wc)).addOption(re()).action(Bg);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(Rk()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(re()).addOption(We([..._n()]).default(wa)).action(Vg),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 qx.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(Tk()).addOption(Pk()).addOption(re()).addOption(We([..._n()]).default(wa)).action(Gg),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(re()).addOption(_e()).action(Kg),n.command("trigger").description("Build a GitHub-connected environment's current HEAD on demand (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker; builds whatever branch that environment is configured for. Warns (without blocking) if that branch differs from your current local branch. Use --dry-run to preview.").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(re()).addOption(_e()).action(Jg);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(re()).addOption(We([...Jn()]).default(cl)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(Jf()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Wg),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(re()).addOption(We([...Jn()]).default(cl)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(Jf()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Hg);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). ${Sc("variable","--key")} Secret values are never returned.`).addOption(ka()).addOption(Da()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",Ri).addOption(xc("the variable key")).addOption(re()).addOption(We([...ks()]).default(dl.join(","))).action(nh),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(ka()).addOption(Da()).addOption(Kf()).addOption(_e()).addOption(re()).action(ih),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ka()).addOption(Da()).addOption(_e()).addOption(re()).action(sh),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(ka()).addOption(Da()).addOption(Kf()).addOption(_e()).addOption(re()).action(lh)};ke();C();lt();async function jr(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function Xx(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok){let o=await jr(r);throw r.status>=400&&r.status<500?new d(o,{isUserError:!0}):new d(`Failed to list collections: ${o}`)}return(await r.json()).collections??[]}async function Zx(e,t){Q(t,"collectionId");let r=await K(`${O()}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new d(`Collection "${t}" not found`,{isUserError:!0});if(!r.ok)throw new d(`Failed to get collection: ${await jr(r)}`);let n=await r.json();return{...n,fields:n.fields??[]}}async function Qx(e,t,r){Q(t,"siteId");let n={displayName:r.displayName,singularName:r.singularName};r.slug&&(n.slug=r.slug);let o=await K(`${O()}/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 jr(o);throw o.status>=400&&o.status<500?new d(i,{isUserError:!0}):new d(`Failed to create collection: ${i}`)}return await o.json()}async function eC(e,t,r){Q(t,"collectionId");let n=await K(`${O()}/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 jr(n);throw n.status===404?new d(`Collection "${t}" not found`,{isUserError:!0}):n.status>=400&&n.status<500?new d(o,{isUserError:!0}):new d(`Failed to create field: ${o}`)}return await n.json()}async function ch(e,t,r={}){Q(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 K(`${O()}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new d(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new d(`Failed to list items: ${await jr(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 tC(e,t,r,n){Q(t,"collectionId"),Q(r,"itemId");let o=n?`?cmsLocaleId=${encodeURIComponent(n)}`:"",i=await K(`${O()}/v2/collections/${t}/items/${r}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!i.ok)throw new d(`Failed to get item: ${await jr(i)}`);return await i.json()}async function uh(e,t,r,n=!1){Q(t,"collectionId");let o=await K(`${O()}/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 jr(o);throw o.status>=400&&o.status<500?new d(i,{isUserError:!0}):new d(`Failed to create item: ${i}`)}return await o.json()}async function dh(e,t,r,n){Q(t,"collectionId"),Q(r,"itemId");let o=await K(`${O()}/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 d(`Item "${r}" not found`,{isUserError:!0});if(!o.ok)throw new d(`Failed to update item: ${await jr(o)}`);return await o.json()}async function rC(e,t,r){Q(t,"collectionId"),Q(r,"itemId");let n=await K(`${O()}/v2/collections/${t}/items/${r}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!n.ok)throw new d(`Failed to delete item: ${await jr(n)}`)}async function nC(e,t,r){Q(t,"collectionId"),r.forEach(o=>Q(o,"itemId"));let n=await K(`${O()}/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 jr(n);throw n.status>=400&&n.status<500?new d(o,{isUserError:!0}):new d(`Failed to publish items: ${o}`)}return await n.json()}me();Y();Pe();async function rd(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=oe(),r=await Je(t);return{token:r.accessToken,siteId:r.siteId}}function oC(e,t=["id","displayName","slug"]){if(e.length===0)return P("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 Ut(`Invalid fields. Available: ${r.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:P("\u2014")}));return ze(i,s)}function iC(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(P(" No fields defined.")),t.join(`
206
+ `);let r=["NAME","SLUG","TYPE","REQUIRED"].map(o=>se(o)),n=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(ze(r,n)),t.join(`
207
+ `)}function sC(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return P("No items found.");let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?ue("draft"):z("live");if(i==="isArchived")return o.isArchived?P("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"}):P("\u2014")}let s=o[i];return s==null?P("\u2014"):String(s)}));return ze(r,n)}C();R();j();function nd(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 ph(e){let{token:t,siteId:r}=await rd(e),n=_.forCms({authToken:t,siteId:r}),o=Date.now();try{let i=await Xx(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 d(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=nd(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(oC(a,l))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${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 d(i,{prefix:`${D} Failed to list collections:`})}}Y();C();R();j();Z();async function fh(e,t){let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await Zx(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(iC(i))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${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 d(i,{prefix:`${D} Failed to get collection:`})}}C();R();j();Z();async function mh(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 rd(e),i=_.forCms({authToken:n,siteId:o}),s=Date.now();try{let a=await Qx(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(`${$} Collection created: ${a.id}`),u.info(` Name: ${a.displayName}`),u.info(` Slug: ${a.slug}`),u.info(`
208
+ Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof d&&a.isUserError){u.info(`${D} ${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 d(a,{prefix:`${D} Failed to create collection:`})}}Y();C();R();j();Z();async function gh(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 eC(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(`${$} Field created: ${o.id}`),u.info(` Name: ${o.displayName}`),u.info(` Type: ${o.type}`),u.info(` Slug: ${o.slug}`)}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${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 d(o,{prefix:`${D} Failed to create field:`})}}Y();C();R();j();Z();async function hh(e){let t=await T(),r=_.forCms({authToken:t}),n=Date.now(),o=e.limit??100,i=e.offset??0;try{let s=await ch(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(f=>f.trim());u.info(sC(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let f=s.total>0?` of ${s.total}`:"";u.info(`
209
+ Showing ${l}\u2013${c}${f} items. Use --offset ${c} to load next page.`)}}catch(s){if(s instanceof d&&s.isUserError){u.info(`${D} ${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 d(s,{prefix:`${D} Failed to list items:`})}}Y();C();R();j();Z();async function yh(e){let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{let o=await tC(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 d&&o.isUserError){u.info(`${D} ${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 d(o,{prefix:`${D} Failed to get item:`})}}Y();C();R();j();Z();async function wh(e){let t;try{t=JSON.parse(e.data)}catch{throw new d(`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 uh(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(`${$} Item created: ${i.id}`)}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${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 d(i,{prefix:`${D} Failed to create item:`})}}Y();C();R();j();Z();async function bh(e){let t;try{t=JSON.parse(e.data)}catch{throw new d(`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 dh(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(`${$} Item updated: ${i.id}`)}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${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 d(i,{prefix:`${D} Failed to update item:`})}}Y();C();R();j();Z();async function kh(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 rC(t,e.collection,e.item),await r.sendUsage("cms_items_delete",{duration:Date.now()-n,dryRun:!1}),u.info(`${$} Item deleted: ${e.item}`)}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${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 d(o,{prefix:`${D} Failed to delete item:`})}}Y();C();R();j();Z();async function Dh(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 nC(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(`${$} Published ${s} item(s)`),i.errors?.length&&i.errors.forEach(a=>u.warn(` ${a.itemId}: ${a.message}`))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${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 d(i,{prefix:`${D} Failed to publish items:`})}}var aC=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(Rt()).addOption(re()).addOption(We(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption(Pi(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Ti()).action(ph),r.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(re()).action(fh),r.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(Rt()).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(_e()).addOption(re()).action(mh),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(_e()).addOption(re()).action(gh);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(Fc()).addOption(_c()).addOption(re()).addOption(We(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(hh),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(re()).action(yh),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(_e()).addOption(re()).action(wh),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(_e()).addOption(re()).action(bh),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(_e()).action(kh),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(_e()).addOption(re()).action(Dh)};Y();me();C();R();j();Pe();Z();ke();lt();C();C();me();var lC={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 od(e,t){let r=e.split(".").pop()?.toLowerCase()??"",n=lC[r];if(!n){let o=Object.keys(lC).join(", ");throw new d(`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 d(`File too large: ${i} MB exceeds the ${o} MB limit for ${n.category} files.`,{isUserError:!0})}}var Eh=["id","displayName","originalFileName","contentType","size","lastUpdated"];function cC(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return P("No assets found.");let r=Object.fromEntries(Eh.map(l=>[l.toLowerCase(),l])),n=t.map(l=>r[l.toLowerCase()]).filter(l=>l!=null);if(n.length===0)return Ut(`Invalid fields. Available: ${Eh.join(", ")}`);let o=t.filter(l=>r[l.toLowerCase()]==null),i=o.length>0?ue(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${Eh.join(", ")}
210
+ `):"",s=n.map(l=>se(l)),a=e.map(l=>n.map(c=>{let p=l[c];if(p==null||c==="size"&&p===0)return P("\u2014");if(c==="size")return vO(Number(p));if(c==="lastUpdated"){let m=new Date(String(p)),g=String(m.getMonth()+1).padStart(2,"0"),h=String(m.getDate()).padStart(2,"0"),y=String(m.getFullYear()).slice(-2),k=String(m.getHours()).padStart(2,"0"),v=String(m.getMinutes()).padStart(2,"0");return`${g}/${h}/${y} ${k}:${v}`}let f=String(p);return c==="displayName"&&f.length>40?P("\u2026")+f.slice(-39):f}));return i+ze(s,a)}function vO(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function uC(e){if(e.length===0)return P("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),r=["id","displayName","assets","lastUpdated"].map(o=>se(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 ze(r,n)}async function dC(e,t,r={}){if(Q(t,"siteId"),r.folderId){Q(r.folderId,"folderId");let a=await SO(e,r.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],p=0,f=100;for(;;){let k=await K(`${O()}/v2/sites/${t}/assets?limit=${f}&offset=${p}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!k.ok)throw new d(`Failed to list assets: ${k.status} ${k.statusText}`);let v=await k.json(),F=v.assets??[];c.push(...F);let E=v.pagination?.total??0;if(p+=F.length,p>=E||F.length===0)break}let m=c.filter(k=>l.has(k.id)),g=r.offset??0,h=r.limit??m.length,y=m.slice(g,g+h);return{assets:y,pagination:{total:m.length,limit:y.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 K(`${O()}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new d(`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 pC(e,t,r,n,o){Q(t,"siteId"),o&&Q(o,"folderId");let i=_a(r);od(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 K(`${O()}/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 d(`Failed to initiate asset upload: ${l.status} ${l.statusText}`);let c=await l.json(),p={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 Ra(i,p)}catch(f){throw await K(`${O()}/v2/assets/${p._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),f}return{id:p._id,hostedUrl:p.s3Url,displayName:s,originalFileName:i.meta.title}}async function fC(e,t,r){Q(t,"assetId");let n=await K(`${O()}/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 d(`Failed to update asset: ${n.status} ${n.statusText}`);return await n.json()}async function SO(e,t){Q(t,"folderId");let r=await K(`${O()}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get folder: ${r.status} ${r.statusText}`);return await r.json()}async function mC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to list folders: ${r.status} ${r.statusText}`);return(await r.json()).assetFolders??[]}async function gC(e,t,r,n){Q(t,"siteId"),n&&Q(n,"parentFolderId");let o={displayName:r};n&&(o.parentFolder=n);let i=await K(`${O()}/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 d(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function vh(e){let t,r;if(e.site)t=await T(),r=e.site;else{let{manifest:i}=oe(),s=await Je(i);t=s.accessToken,r=s.siteId}let n=_.forAssets({authToken:t,siteId:r}),o=Date.now();try{let{assets:i,pagination:s}=await dC(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 p=nd(i,l,c);if(e.json){u.info(JSON.stringify({assets:p,pagination:s},null,2));return}let f=e.fields.split(",").map(g=>g.trim());u.info(cC(p,f));let m=(e.offset??0)+i.length;m<s.total&&u.info(P(`Showing ${m} of ${s.total} assets. Use --offset ${m} to see more.`))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list assets:`})}}Y();C();R();j();Pe();Z();async function Sh(e,t){let r=_a(e);if(od(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}=oe(),l=await Je(a);n=l.accessToken,o=l.siteId}let i=_.forAssets({authToken:n,siteId:o}),s=Date.now();try{let a=await pC(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(`${$} 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 d(a,{prefix:`${D} Failed to upload asset:`})}}Y();C();R();j();Z();async function xh(e,t){if(!t.altText&&!t.displayName)throw new d("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 fC(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(`${$} 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 d(i,{prefix:`${D} Failed to update asset:`})}}Y();C();R();j();Pe();Z();async function Ch(e){let t,r;if(e.site)t=await T(),r=e.site;else{let{manifest:i}=oe(),s=await Je(i);t=s.accessToken,r=s.siteId}let n=_.forAssets({authToken:t,siteId:r}),o=Date.now();try{let i=await mC(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(uC(i))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list folders:`})}}Y();C();R();j();Qs();Z();async function Fh(e,t){let r,n;if(t.site)r=await T(),n=t.site;else{let{manifest:s}=oe(),a=await Je(s);r=a.accessToken,n=a.siteId}let o=_.forAssets({authToken:r,siteId:n}),i=Date.now();try{let s=await gC(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(`${$} 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 d(s,{prefix:`${D} Failed to create folder:`})}}var hC=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(Rt()).option("--folder <folderId>","Filter by folder ID").addOption(re()).addOption(We(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(Fc()).addOption(_c()).addOption(Pi(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Ti()).action(vh),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
211
+ 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(Rt()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(_e()).addOption(re()).action(Sh),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(_e()).addOption(re()).action(xh);let r=t.command("folders").description("Manage asset folders");r.command("list").description("List all asset folders for a site").addOption(Rt()).addOption(re()).action(Ch),r.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(Rt()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(re()).action(Fh)};Y();C();R();j();Z();ke();C();lt();async function yC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get site: ${r.status} ${r.statusText}`);return await r.json()}async function wC(e){return il(`${O()}/v2/sites`,e,"sites","Failed to list sites")}async function bC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get custom domains: ${r.status} ${r.statusText}`);return(await r.json()).customDomains??[]}async function kC(e,t,r=[],n){Q(t,"siteId"),n&&Q(n,"pageId");let o=r.length>0?{customDomains:r}:{publishToWebflowSubdomain:!0};n&&(o.pageId=n);let i=await K(`${O()}/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 d(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}C();me();var _h=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],DC=dt(_h);function EC(){return _h}function vC(e,t=["id","displayName","lastPublished"]){if(e.length===0)return P("No sites found.");if(t.length===0)throw new d(`No valid fields specified. Available: ${_h.join(", ")}`,{isUserError:!0});let r=t.map(o=>se(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:P("\u2014")}));return ze(r,n)}function SC(e){if(e.length===0)return P("No custom domains configured.");let t=[se("id"),se("url"),se("lastPublished")],r=e.map(n=>[n.id,n.url,n.lastPublished?new Date(n.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):P("\u2014")]);return ze(t,r)}async function Ah(e){let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=await wC(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=Fe(e.fields,DC,EC());u.info(vC(o,i))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list sites:`}))}}Y();C();R();j();Z();async function Rh(e,t){let r=await T(),n=_.forSites({authToken:r}),o=Date.now();try{let i=await yC(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 d&&i.isUserError?i:(await n.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to get site:`}))}}Y();C();R();j();Z();async function Ih(e){let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=await bC(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(SC(o))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to get custom domains:`}))}}Y();C();R();j();Z();async function Th(e){if(Q(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 kC(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(`${$} ${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 d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to publish site:`}))}}Y();Y();ke();C();we();Oe();R();j();Pe();Z();ke();lt();C();var id="not_enterprise_plan_workspace";async function xC(e,t,r){Q(t,"workspaceId");let n=r.trim();if(!n)throw new d("Site name cannot be empty.",{isUserError:!0});let o=await K(`${O()}/v2/workspaces/${t}/sites`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({name:n})});if(!o.ok){let s=await o.text().catch(()=>""),a;try{a=JSON.parse(s).code}catch{}throw a===id?new d("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:id}):a==="missing_scopes"?new d(`Your token is missing the 'workspace:write' scope.
212
+ Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new d(`Failed to create site "${n}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new d("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??n,shortName:i.shortName??""}}function xO(e){Se({siteId:e.id});let{manifestPath:t}=oe();u.info(`${$} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function CO(e,t){let r=new Map;for(let i of t)i.workspaceId&&r.set(i.workspaceId,(r.get(i.workspaceId)??0)+1);let n=[...r.keys()];if(n.length===1)return n[0];if(n.length===0){let i=await ps(e);if(i.length===0)throw new d("Could not determine a workspace for this token.",{isUserError:!0});if(i.length===1)return i[0].id;if(V())throw new d(`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 fs(i)).id}if(V())throw new d(`This token's sites span ${n.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 je({message:"Which workspace should the new site be created in?",choices:n.map(i=>({name:`${i} (${r.get(i)} site${r.get(i)===1?"":"s"})`,value:i}))});if(!o)throw new d("No workspace selected.",{isUserError:!0});return o}async function FO(e,t){if(u.warn(`${D} ${t.message}
213
+ Create the site in the Webflow dashboard: ${xr()}/dashboard
214
+ then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await $e({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let n=await xn(e);if(n.length===0)throw new d("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 _i(n),created:!1}}async function _O(e,t,r){let n=await CO(e,t),o=r.name;if(o||(o=await Ge({message:"Name for the new site:",validate:s=>s.trim().length>0||"Site name cannot be empty."})??void 0),!o||!o.trim())throw new d("A site name is required. Pass --name <name> to skip the prompt.",{isUserError:!0});let i;try{i=await xC(e,n,o)}catch(s){if(s instanceof d&&s.code===id)return FO(e,s);throw s}return u.info(`${$} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function sd(e={}){let t=await T({apiToken:e.apiToken}),r=_.forSites({authToken:t}),n=Date.now(),o=!1;try{if(e.siteId&&(e.create||e.name))throw new d("--site-id and --create/--name are mutually exclusive. Bind to an existing site OR create a new one.",{isUserError:!0});let i=await xn(t),s;if(e.siteId){Q(e.siteId,"siteId");let a=i.find(l=>l.id===e.siteId);if(!a)throw new d(`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 d("`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 je({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 _O(t,i,e);s=l.site,o=l.created}else s=await _i(i)}xO(s),await r.sendUsage("site_init",{duration:Date.now()-n,created:o})}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"site_init",{duration:Date.now()-n}),i instanceof d?i:new d(i,{prefix:`${D} Failed to initialize site:`})}}Y();me();C();R();j();Z();ke();lt();C();function AO(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function RO(e,t){let r=await t.text(),n;try{n=JSON.parse(r)}catch{}throw t.status===404&&n?.error==="Not found"&&!n.code?new d(`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}):n?.code==="SCHEMA_STALE"?new d(`Failed to ${e}: the site's filesystem schema changed since the last pull. Run \`webflow sites pull\` and re-apply your changes.`,{isUserError:!0}):n?.code&&n.error?new d(`Failed to ${e}: ${n.error} (${n.code})`,{isUserError:t.status<500}):new d(`Failed to ${e}: ${t.status} ${t.statusText}${AO(r)}`)}async function CC(e,t,r,n){let o=await K(`${xr()}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});o.ok||await RO(e,o);let i=await o.json();if(!i||i.status!=="ok"||i.result==null)throw new d(`Invalid response from the WFS Sync API: expected an ok envelope${i?.error?` (${i.error})`:""}.`);return i.result}async function Ph(e,t,r){Q(t,"siteId");let n=await CC("pull the site files","pull",e,{siteId:t,identityMode:"clean",...r?.pageIds&&r.pageIds.length>0?{pageIds:r.pageIds}:{},...r?.manifestOnly?{manifestOnly:!0}:{}});if(n.identityMode!=="clean")throw new d("This version of the CLI requires clean identity mode support from the Webflow API \u2014 the environment you're targeting doesn't support it yet. Use an older CLI or target a newer environment.",{isUserError:!0});return{...n,pages:n.pages.map(o=>({...o,folderSegments:Array.isArray(o.folderSegments)?o.folderSegments:[]}))}}async function FC(e,t,r,n){Q(t,"siteId");let o=await CC("push the site files","push",e,{siteId:t,identityMode:"clean",changes:r,...n?.conflictPolicy?{conflictPolicy:n.conflictPolicy}:{},...n?.schemaHash?{schemaHash:n.schemaHash}:{}});if(o.identityMode!=="clean")throw new d("This version of the CLI requires clean identity mode support from the Webflow API \u2014 the environment you're targeting doesn't support it yet. Use an older CLI or target a newer environment.",{isUserError:!0});if(!Array.isArray(o.results))throw new d("Invalid response from the WFS Sync API: expected a `results` array.");return o}Pe();Y();C();var ad=require("path");function $h(e){return e.split(ad.sep).join("/").replace(/\\/g,"/")}function fn(e){if(e===""||e.includes("\0")||(0,ad.isAbsolute)(e))return!1;let t=$h(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(r=>r==="..")}var IO={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},_C={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 TO(e){return e.endsWith("/")?e.slice(0,-1):e}function AC(e,t,r){let n=e.trim();if(!fn(n))throw new d(`"site.layout.${t}" in ${r} must be a path inside the project ("src/components"), not "${e}".`,{isUserError:!0});let o=n.split("/").filter(i=>i!==""&&i!==".").join("/");if(o==="")throw new d(`"site.layout.${t}" in ${r} must name a directory inside the project, not "${e}".`,{isUserError:!0});return TO(o)}function PO(e,t,r){let n=e.split("/"),o=t.split("/"),i=[];for(let s=0;s<Math.min(n.length,o.length)-1&&n[s]===o[s];s++)i.push(n[s]);return i.length>0?`${i.join("/")}/${r}`:r}function $O(e,t){let r=e?.layout;if(!r)return IO;let n=r.preset?_C[r.preset]:void 0;if(r.preset&&!n)throw new d(`Unknown "site.layout.preset" value "${r.preset}" in ${t}. Known presets: ${Object.keys(_C).join(", ")}.`,{isUserError:!0});let o=r.pagesRoot??n?.pagesRoot,i=r.componentsRoot??n?.componentsRoot;if(!o||!i)throw new d(`"site.layout" in ${t} must specify both "pagesRoot" and "componentsRoot" (directly, or via a "preset" that provides them).`,{isUserError:!0});let s=r.pagesShape??n?.pagesShape??"flat",a=AC(o,"pagesRoot",t),l=AC(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:PO(a,l,"theme")}}function Ds(e){let{manifest:t,manifestPath:r}=oe(),n=e?.trim();n&&Q(n,"site-id");let o=n||uo(t);if(!o||o.trim()==="")throw new d(`Missing "siteId" in ${r}. Run \`webflow sites init\` to select a site, set WEBFLOW_SITE_ID, or pass --site-id.`,{isUserError:!0});let i=$O(t.site,r);return{siteId:o,layout:i}}var qn=require("fs"),Es=require("path"),WC=w(require("fast-glob"));C();var RC=require("crypto"),yt=require("fs"),Ho=require("path");C();var zn=".webflow/wfs";function hr(e){return(0,RC.createHash)("sha256").update(e,"utf8").digest("hex")}function IC(e){let{nodeIds:t,styleIds:r,...n}=e;return n}function TC(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function OO(e){return TC(e)&&typeof e.wirePath=="string"&&fn(e.wirePath)&&typeof e.localPath=="string"&&fn(e.localPath)}function LO(e){return TC(e)?typeof e.serverHash=="string"&&typeof e.contentSha256=="string"&&(e.componentId===void 0||typeof e.componentId=="string"&&e.componentId.length>0)&&(e.localPath===void 0||typeof e.localPath=="string"&&fn(e.localPath)):!1}function PC(e){return(0,Ho.join)(e,zn,"index.json")}function Oh(e,t){return fn(t)?(0,Ho.join)(e,zn,`${t}.json`):void 0}function $C(e){let t=PC(e);if((0,yt.existsSync)(t))try{let r=JSON.parse((0,yt.readFileSync)(t,"utf8"));return!r||typeof r.schemaHash!="string"||!Array.isArray(r.files)||!r.files.every(OO)?"corrupt":{...typeof r.siteId=="string"?{siteId:r.siteId}:{},...r.identityMode==="clean"?{identityMode:"clean"}:{},schemaHash:r.schemaHash,files:r.files}}catch{return"corrupt"}}function ld(e=process.cwd()){let t=$C(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${zn}/index.json could not be read`};let r={},n=[];for(let{wirePath:o}of t.files){let i=Oh(e,o);if(!i){n.push(o);continue}if(!(0,yt.existsSync)(i)){n.push(o);continue}try{let s=JSON.parse((0,yt.readFileSync)(i,"utf8"));if(!LO(s)){n.push(o);continue}r[o]=IC(s)}catch{n.push(o)}}return{kind:"ok",lockfile:{...t.siteId?{siteId:t.siteId}:{},...t.identityMode?{identityMode:t.identityMode}:{},schemaHash:t.schemaHash,files:r},corruptPaths:n}}function cd(e,t=process.cwd()){let r=$C(t),n=new Set(r&&r!=="corrupt"?r.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=Oh(t,s);if(!a)throw new d(`Refusing to write a lock entry outside ${zn}: "${s}"`);(0,yt.mkdirSync)((0,Ho.dirname)(a),{recursive:!0}),(0,yt.writeFileSync)(a,`${JSON.stringify(IC(e.files[s]),null,2)}
215
+ `,"utf8")}for(let s of n){if(s in e.files)continue;let a=Oh(t,s);a&&(0,yt.existsSync)(a)&&(0,yt.rmSync)(a)}let o={...e.siteId?{siteId:e.siteId}:{},...e.identityMode?{identityMode:e.identityMode}:{},schemaHash:e.schemaHash,files:Object.keys(e.files).sort().map(s=>({wirePath:s,localPath:e.files[s].localPath??s}))},i=PC(t);(0,yt.mkdirSync)((0,Ho.dirname)(i),{recursive:!0}),(0,yt.writeFileSync)(i,`${JSON.stringify(o,null,2)}
216
+ `,"utf8")}function OC(e=process.cwd()){(0,yt.rmSync)((0,Ho.join)(e,zn),{recursive:!0,force:!0})}C();function LC(e){if(!fn(e))throw new d(`Refusing to write unsafe path from server: "${e}"`)}var NO=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function pl(e){return NO.exec(e)?.[1]}var NC=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function jO(e){return NC.exec(e)?.[2]}function MO(e){let t=NC.exec(e);return t?t[1]??"":void 0}function Nh(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function jh(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function Mh(e,t){let n=e.slice(t.length+1).split("/");if(n.length===1)return"";if(n.length===2)return n[0]}function jC(e,t){if(t.pagesShape==="nested"){let n=e.isDefault?[]:[...e.folderSegments,e.slug];return n.length>0?`${t.pagesRoot}/${n.join("/")}/page.tsw`:`${t.pagesRoot}/page.tsw`}let r=e.isDefault?["index"]:[...e.folderSegments,e.slug];return`${t.pagesRoot}/${r.join("/")}.tsw`}function Bh(e,t,r){if(r)return r;let n=jO(e);if(!n)return;let o=MO(e)??"";return o?`${t.componentsRoot}/${o}/${n}.tsw`:`${t.componentsRoot}/${n}.tsw`}function MC(e,t){let r=jh(e,t);if(!r)return;let n=Mh(e,t);if(n!==void 0)return Nh(r,n)}var Lh="site/theme/";function BC(e,t){if(e.startsWith(Lh))return`${t.themeRoot}/${e.slice(Lh.length)}`}function ud(e,t){let r=`${t}/`;if(e.startsWith(r))return`${Lh}${e.slice(r.length)}`}async function HC(e,t,r=process.cwd(),n=!1){let o=[],i=[],s=[],a=[],l=[],c=[],p={},f=new Map,m=new Map;for(let[y,k]of Object.entries(e.files)){let v=k.localPath??y;f.set(y,v),m.set(v,y)}let g=new Set((await(0,WC.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:r,onlyFiles:!0,dot:!1})).map($h)),h=new Map;for(let y of Object.keys(e.files).sort()){let k=e.files[y],v=f.get(y);if(k.deletedUpstream){(0,qn.existsSync)((0,Es.join)(r,v))&&c.push(v);continue}if(!(0,qn.existsSync)((0,Es.join)(r,v))){i.push(v),h.set(k.contentSha256,v);continue}p[y]=v;let F=(0,qn.readFileSync)((0,Es.join)(r,v),"utf8");(n||hr(F)!==k.contentSha256)&&o.push({path:y,content:F,baseHash:k.serverHash})}for(let y of[...g].sort()){if(m.has(y))continue;let k=(0,qn.readFileSync)((0,Es.join)(r,y),"utf8"),v=h.get(hr(k));if(v!==void 0){s.push({oldPath:v,newPath:y});continue}let F=UO(y,t);if(F.kind==="unmappable"){a.push(y);continue}let{wirePath:E}=F,S=f.get(E);if(S!==void 0&&S!==y){l.push(y);continue}p[E]=y;let L=e.files[E];o.push(L?{path:E,content:k,baseHash:L.serverHash}:{path:E,content:k})}return{changes:o,missing:i,renameCandidates:s,unmappable:a,stale:l,orphanedUpstream:c,localPaths:p}}function UO(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let n=jh(e,t.componentsRoot);if(!n)return{kind:"unmappable"};let o=Mh(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:Nh(n,o)}}let r=ud(e,t.themeRoot);return r!==void 0?{kind:"theme",wirePath:r}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function VC(e){let t=[];for(let r=0;r<e.length;r+=20)t.push(e.slice(r,r+20));return t}function GC(e){let t=e.filter(a=>!pl(a.path)),r=new Map;for(let a of e){let l=pl(a.path);if(!l)continue;let c=r.get(l)??[];c.push(a),r.set(l,c)}let n=r.size>0?199:200;if(t.length>n)throw new d(`Too many changed site-global files to push in one request (${t.length} > ${n}). 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 r)!(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 dd(e,t=process.cwd()){let r=(0,Es.join)(t,e);if((0,qn.existsSync)(r))return(0,qn.readFileSync)(r,"utf8")}var KC=require("@babel/parser");function JC(e){try{return(0,KC.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function zC(e,t){if(t.length===0)return e;let r=e;for(let{start:n,end:o,text:i}of[...t].sort((s,a)=>a.start-s.start))r=r.slice(0,n)+i+r.slice(o);return r}var WO="site/current-page.tsw";function pd(e){return pl(e)!==void 0?WO:e}function HO(e,t){let r=e.split("/").slice(0,-1);for(let n of t.split("/"))if(!(n===""||n===".")){if(n===".."){r.length>0&&r.pop();continue}r.push(n)}return r.join("/")}function VO(e,t){let r=e.split("/").slice(0,-1),n=t.split("/"),o=0;for(;o<r.length&&o<n.length-1&&r[o]===n[o];)o++;let i=r.length-o,s=n.slice(o).join("/");return i>0?`${"../".repeat(i)}${s}`:`./${s}`}function fd(e,t,r,n){let o=JC(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=n(HO(t,l));if(c===void 0)continue;let p=VO(r,c);if(p===l)continue;let f=e[a.start],m=f==="'"||f==='"'?`${f}${p}${f}`:JSON.stringify(p);i.push({start:a.start,end:a.end,text:m})}return zC(e,i)}function GO(e,t){return r=>t[r]??e.files[r]?.localPath??r}function KO(e,t){let r=e.outcome==="committed"||e.outcome==="noop"?$:D,i=Object.keys(e.hashes??e.currentHashes??{}).map(t).find(a=>a.endsWith(".tsw"))??`page ${e.pageId}`,s=[`${r} ${i}: ${e.outcome}`];if(e.outcome==="conflict")for(let a of Object.keys(e.currentHashes??{}))s.push(P(` ${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(P(" 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(P(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${X} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
217
+ `)}function JO(e,t,r,n){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(r[i.path]??i.path,i.path);return e.map(i=>{let s=r[i.path]??i.path;if(i.content===void 0||!s.endsWith(".tsw"))return i;let a=fd(i.content,s,pd(i.path),l=>o.get(l)??ud(l,n.themeRoot)??MC(l,n.componentsRoot));return{...i,content:a}})}function zO(e,t){return e.map(r=>{if(!r.path.startsWith("site/components/")||!r.path.endsWith(".tsw")||r.content===void 0)return r;let n=t.files[r.path]?.componentId;if(n)return{...r,componentId:n};if(r.baseHash===void 0)return{...r,create:!0};throw new d(`Tracked component ${r.path} has no component id in sync state. Run \`webflow sites pull\` before pushing it.`,{isUserError:!0})})}function qO(e,t,r,n){return zO(JO(e,t,r,n),t)}async function YO(e,t,r,n,o){let i=[],s=!1,a=!1;for(let[l,c]of r.entries()){let p;try{p=await FC(e,t,c,{conflictPolicy:n,schemaHash:o})}catch(m){return s&&u.warn(`${X} The push failed after ${l} of ${r.length} batches committed. Local sync state may be stale \u2014 run \`webflow sites pull\` before pushing again.`),{results:i,schemaHash:o,aborted:!0,failed:!0,failure:m}}o=p.schemaHash,i.push(...p.results);let f=p.results.some(m=>m.outcome==="conflict"||m.outcome==="error"||m.outcome==="skipped"||(m.rejected?.length??0)>0);if(p.results.some(m=>m.outcome==="committed")&&(s=!0),f&&l<r.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function XO(e){let t=[];for(let r of e)if(r.outcome==="committed")for(let[n,o]of Object.entries(r.createdComponents??{}))t.push({path:n,componentId:o,hash:r.hashes?.[n]});return t}function ZO(e,t,r,n,o,i){let s={...e.files};for(let l of i)if(l.outcome==="committed")for(let[c,p]of Object.entries(l.hashes??{})){let f=n.get(c);if(!f||f.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:p,contentSha256:hr(f.content),...m?{localPath:m}:{}}}let a=XO(i);for(let{path:l,componentId:c,hash:p}of a){let f=n.get(l)?.content;if(f===void 0||p===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:p,contentSha256:hr(f),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{...e,siteId:e.siteId??t,schemaHash:r,files:s},created:a}}function QO(e,t){for(let{path:r,componentId:n}of e)u.info(`${$} Created component ${t(r)} (id ${n})`),u.info(P(" id tracked locally \u2014 it will be sent as metadata on future pushes without changing this file"))}function eL({missing:e,renameCandidates:t,unmappable:r,stale:n,orphanedUpstream:o},i){for(let s of e)u.warn(`${X} ${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(`${X} ${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(`${X} ${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 n)u.warn(`${X} ${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 r){let a=s.startsWith(`${i.pagesRoot}/`);u.warn(a?`${X} ${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\`.`:`${X} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function tL(e){let t=ld();if(t.kind==="missing")throw new d("No WFS sync state found (.webflow/wfs/). Run `webflow sites pull` first.",{isUserError:!0});if(t.kind==="corrupt")throw new d(`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 d(`${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 r=t.lockfile;if(r.siteId!==void 0&&r.siteId!==e)throw new d(`This project's sync state was pulled from site ${r.siteId}, but push targets ${e}. Run \`webflow sites pull\` to sync against ${e} first (add --reset to discard the existing state).`,{isUserError:!0});return r}function rL(e,t,r){return JSON.stringify({dryRun:!0,siteId:e,changes:t.map(n=>({path:n.path,localPath:r[n.path]??n.path,isNew:n.baseHash===void 0}))},null,2)}function nL(e,t,r){u.info(`Would push ${e.length} file(s) to site ${r}:`);for(let n of e){let o=t[n.path]??n.path,i=n.create?P(" (new component)"):n.baseHash?"":P(" (new)");u.info(` ${o}${i}`)}u.info("Dry run \u2014 no changes made.")}async function md(e={}){let t=Ds(),r=tL(t.siteId),n=await HC(r,t.layout,void 0,e.force),{changes:o,localPaths:i}=n;if(eL(n,t.layout),o.length===0){u.info(e.json?JSON.stringify({schemaHash:r.schemaHash,results:[]},null,2):"No local changes to push.");return}let s=await T({apiToken:e.apiToken}),a=_.forSites({authToken:s}),l=Date.now(),c=GO(r,i);try{let p=qO(o,r,i,t.layout);if(e.dryRun){e.json?u.info(rL(t.siteId,o,i)):nL(p,i,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let f=GC(p),{results:m,schemaHash:g,aborted:h,failed:y,failure:k}=await YO(s,t.siteId,f,e.force?"rebase":void 0,r.schemaHash),v=new Map(o.map(te=>[te.path,te])),{lockfile:F,created:E}=ZO(r,t.siteId,g,v,i,m);if(m.some(te=>te.outcome==="committed")&&cd(F),y)throw k;let S=m.filter(te=>te.outcome==="conflict"),L=m.filter(te=>te.outcome==="error"),U=m.filter(te=>te.outcome==="skipped"),N=m.flatMap(te=>te.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:g,results:m},null,2));else{QO(E,c);for(let ce of m)u.info(KO(ce,c));let te=m.filter(ce=>ce.outcome==="committed").length,G=E.length>0?` Created ${E.length} component(s) (ids tracked locally, not written to source).`:"";u.info(`Pushed ${o.length} file(s) across ${m.length} page group(s): ${te} committed, ${S.length} conflicted, ${L.length} failed, ${U.length} skipped.${G}`),h&&u.warn(`${X} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(S.length>0||L.length>0||U.length>0||N.length>0)throw new d(`${X} Push finished with ${S.length} conflict(s), ${L.length} error(s), ${U.length} skipped page(s), ${N.length} rejected file(s). 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:E.length,dryRun:!1})}catch(p){throw await a.sendError(p instanceof Error?p:new Error(String(p)),"site_push",{duration:Date.now()-l}),p instanceof d?p:new d(p,{prefix:`${D} Failed to push site files:`})}}var Go=require("fs"),qC=require("module"),Vo=require("path");Y();me();C();R();j();Z();function oL(e,t,r,n){let o=r.get(e.path);if(o)return jC(o,t);let i=BC(e.path,t);if(i)return i;let s=n?.files[e.path]?.localPath;return Bh(e.path,t,s)??e.path}function iL(e,t,r){if(!Array.isArray(e)||e.length===0)return;let n=(0,qC.createRequire)((0,Vo.join)(t,"package.json")),o=[];for(let i of e){if(typeof i!="string"){o.push(i);continue}try{o.push(n.resolve(i))}catch{u.debug(`Prettier plugin "${i}" from this project's config could not be resolved; formatting ${r} without it.`)}}return o}async function sL(e,t){try{let{format:r,resolveConfig:n}=await import("prettier"),o=await n(t,{editorconfig:!0}),i=iL(o?.plugins,process.cwd(),t);return await r(e,{...o,...i?{plugins:i}:{},filepath:t,parser:"babel-ts"})}catch(r){return u.debug(`Prettier could not format ${t}, writing it unformatted: ${r instanceof Error?r.message:String(r)}`),e}}function aL(e,t){if(t){OC();return}let r=ld();if(r.kind==="missing")return;if(r.kind==="corrupt")throw new d(`This project's sync state is unreadable (${r.reason}), so a pull can't tell which local files have changed since the last sync. Restore ${zn}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});if(r.corruptPaths.length>0)throw new d(`${r.corruptPaths.length} tracked file(s) have unreadable sync state (${r.corruptPaths.slice(0,3).join(", ")}${r.corruptPaths.length>3?", \u2026":""}), so a pull can't tell whether their local copies changed. Restore ${zn}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});let n=r.lockfile;if(n?.siteId!==void 0&&n.siteId!==e&&Object.keys(n.files).length>0)throw new d(`This project's sync state was pulled from site ${n.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 n}async function gd(e={}){let t=Ds(e.siteId),r=aL(t.siteId,!!e.reset),n=await T({apiToken:e.apiToken}),o=_.forSites({authToken:n}),i=Date.now();try{let s=await Ph(n,t.siteId,{manifestOnly:!0});if(s.useTsw===!1)throw new d("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(A=>A.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,p={},f=[];for(let A of VC(a)){let q=await Ph(n,t.siteId,{pageIds:A});c=q.schemaHash,p=q.componentIds??p,q.warnings&&f.push(...q.warnings);for(let W of q.files)l.set(W.path,W)}let m=[...l.values()].sort((A,q)=>A.path.localeCompare(q.path)),g=new Map(s.pages.map(A=>[A.path,A])),h=new Map;for(let A of m){let q=r?.files[A.path];if(!q)continue;let W=q.localPath??A.path,he=dd(W),Vr=he!==void 0&&hr(he)!==q.contentSha256,Gr=A.hash!==q.serverHash;Vr&&Gr&&h.set(A.path,W)}let y=!e.force,k=[...h.values()],v=process.cwd(),F=new Map(m.map(A=>[A.path,oL(A,t.layout,g,r)])),E=new Map;for(let[A,q]of F)E.set(q,[...E.get(q)??[],A]);let S=[...E.entries()].filter(([,A])=>A.length>1);if(S.length>0){let A=S.map(([q,W])=>`${q} \u2190 ${W.join(", ")}`).join("; ");throw new d(`Two or more files resolve to the same local path, so pulling would overwrite one with the other: ${A}. This usually means pages share a slug across Designer Page Folders without distinct folder segments. No files were written.`,{isUserError:!0})}let L={siteId:t.siteId,identityMode:"clean",schemaHash:c,files:{}},U=new Set(F.values()),N=[],te=[],G=[],ce=[];for(let A of m){let q=r?.files[A.path];if(y&&h.has(A.path)){q&&(L.files[A.path]=q);continue}let W=F.get(A.path);LC(W);let he=(0,Vo.join)(v,W);(0,Go.mkdirSync)((0,Vo.dirname)(he),{recursive:!0});let Vr=W.endsWith(".tsw")?fd(A.content,pd(A.path),W,fi=>F.get(fi)??Bh(fi,t.layout,r?.files[fi]?.localPath)):A.content,Gr=W.endsWith(".tsw")?await sL(Vr,he):Vr;(0,Go.writeFileSync)(he,Gr,"utf8"),N.push(A);let ro=q?q.localPath??A.path:void 0;if(q&&ro&&ro!==W&&!U.has(ro)){let fi=dd(ro);fi===void 0||(hr(fi)===q.contentSha256?((0,Go.rmSync)((0,Vo.join)(v,ro),{force:!0}),te.push({from:ro,to:W})):G.push({from:ro,to:W}))}let cw=p[A.path],Vl=g.get(A.path);L.files[A.path]={serverHash:A.hash,contentSha256:hr(Gr),localPath:W,...cw?{componentId:cw}:{},...Vl?{slug:Vl.slug,isDefault:Vl.isDefault,folderSegments:Vl.folderSegments}:{}}}let Be=new Set(m.map(A=>A.path));for(let[A,q]of Object.entries(r?.files??{})){if(Be.has(A))continue;let W=q.localPath??A;if(U.has(W))continue;let he=dd(W);he!==void 0&&(hr(he)===q.contentSha256?((0,Go.rmSync)((0,Vo.join)(v,W),{force:!0}),ce.push(W)):(G.push({from:W,to:"(no longer on the site)"}),L.files[A]={...q,deletedUpstream:!0}))}if(cd(L),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:A,slug:q,title:W,path:he,folderSegments:Vr})=>({pageId:A,slug:q,title:W,path:he,folderSegments:Vr})),files:N.map(A=>({path:A.path,hash:A.hash,size:A.size,localPath:L.files[A.path]?.localPath})),...y&&k.length>0?{skipped:k}:{},...ce.length>0?{removed:ce}:{},...te.length>0?{relocated:te}:{},...G.length>0?{orphaned:G}:{}},null,2));else{for(let A of N){let q=g.get(A.path),W=L.files[A.path]?.localPath??A.path,he=q?P(` (page, slug: "${q.slug}")`):"";u.info(`${$} ${W}${he}`)}u.info(`Pulled ${N.length} file(s) across ${a.length} page(s).`);for(let A of ce)u.info(P(` removed ${A} (no longer on the site)`));for(let{from:A,to:q}of te)u.info(P(` moved ${A} \u2192 ${q}`))}for(let A of k)u.warn(y?`${X} ${A} 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).`:`${X} ${A} 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:A,to:q}of G)u.warn(`${X} ${A} is now at ${q}, 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 ${q} and delete ${A}, since while it's there the two copies disagree.`);for(let{path:A,reason:q}of f){let W=L.files[A]?.localPath??A;u.warn(`${X} ${W}: ${q}`)}await o.sendUsage("site_pull",{duration:Date.now()-i,count:N.length,skipped:y?k.length:0})}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"site_pull",{duration:Date.now()-i}),s instanceof d?s:new d(s,{prefix:`${D} Failed to pull site files:`})}}qr();var YC=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(re()).addOption(We(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Ah),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(re()).action(Rh),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(re()).action(Ih),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(_e()).addOption(re()).action(Th),Ke()&&(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(Xr()).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(sd),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(Xr()).addOption(_e()).addOption(re()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(md),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(Xr()).addOption(re()).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(gd))};Y();C();R();j();Z();ke();async function XC(e,t){return Q(t,"siteId"),il(`${O()}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function ZC(e,t,r){return Q(t,"siteId"),Q(r,"formId"),il(`${O()}/v2/sites/${t}/forms/${r}/submissions`,e,"formSubmissions","Failed to list submissions")}C();me();var Wh=["id","displayName","name","slug","createdOn","lastUpdated"],QC=dt(Wh);function eF(){return Wh}function tF(e,t=["id","displayName","slug"]){if(e.length===0)return P("No forms found.");if(t.length===0)throw new d(`No valid fields specified. Available: ${Wh.join(", ")}`,{isUserError:!0});let r=t.map(o=>se(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:P("\u2014")}));return ze(r,n)}function rF(e){if(e.length===0)return P("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),r=["id","dateSubmitted",...t].map(o=>se(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?P("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return ze(r,n)}function nF(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(`
218
+ `)?`"${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(`
219
+ `)}async function Hh(e){Q(e.site,"siteId");let t=await T(),r=_.forForms({authToken:t}),n=Date.now();try{let o=await XC(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=Fe(e.fields,QC,eF());u.info(tF(o,i))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list forms:`}))}}var oF=w(require("fs"));Y();C();R();j();Z();async function Vh(e){Q(e.site,"siteId"),Q(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 ZC(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=nF(o);oF.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(rF(o))}catch(o){throw await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to fetch submissions:`})}}var iF=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(Rt()).addOption(re()).addOption(We(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(Hh),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(Vh)};var ay=w(require("fs")),ly=w(require("path"));R();var zo=w(require("fs")),Jo=w(require("path")),wd=w(require("tar"));C();R();var Gh=w(require("fs")),Yn=w(require("path"));C();var sF={impl:Yn.default.posix,caseInsensitive:!1},Kh={impl:Yn.default.win32,caseInsensitive:!0};function Ko(){let e=process.platform;return e==="win32"?Kh:{impl:Yn.default.posix,caseInsensitive:e==="darwin"}}function hd(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 ot(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let n=hd(e,r),o=hd(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 yd(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let[n,o]=await Promise.all([yr(e),yr(t)]);return ot(n,o,r)}function Me(e,t,r,n=Ko()){if(!ot(e,t,n))throw new d(`Refusing to continue: ${r} resolves outside the directory it must stay inside.
220
+ expected inside: ${b(e)}
221
+ resolved to: ${b(t)}
222
+ Please report this.`)}async function vs(e,t,r,n=Ko()){if(!await yd(e,t,n))throw new d(`Refusing to continue: ${r} resolves outside the directory it must stay inside once symlinks are followed.
223
+ expected inside: ${b(e)}
224
+ resolved to: ${b(t)}
225
+ Please report this.`)}function lL(e,t,r=Ko()){return ot(e,t,r)||ot(t,e,r)}async function Jh(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let[n,o]=await Promise.all([yr(e),yr(t)]);return lL(n,o,r)}function Ye(e,t,r=Ko()){return typeof e!="string"||typeof t!="string"||Xn(e)||Xn(t)?!1:hd(e,r)===hd(t,r)}async function yr(e){let t=Yn.default.resolve(e);try{return await Gh.default.promises.realpath(t)}catch{}try{let r=await Gh.default.promises.realpath(Yn.default.dirname(t));return Yn.default.join(r,Yn.default.basename(t))}catch{return t}}var cL=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function Ss(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(cL.test(t))return"Windows reserved device name in entry path"}return null}var Yh=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),uL=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),dL=32,pL=512,zh=10,cF=100,aF=100;function uF(){return{retained:[],fatal:[],fatalCount:0,count:0}}function dF(e,t,r){e.count+=1;let n={code:t,message:al(r)};e.retained.length<aF&&e.retained.push(n),uL.has(t)&&(e.fatalCount+=1,e.fatal.length<aF&&e.fatal.push(n))}async function pF(e,t,r){let n=await fL(r.containmentRoot),o=await mL(n,t),i=await lF(e),s=await hL(e,r),a=await wL(e,o,r);if(a.warnings.fatal.length>0)throw wF(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 DL(a.refused,a.refusedCount);let l=await lF(e);if(i!==l)throw new d("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 bL(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 lF(e){try{let t=await zo.default.promises.stat(e);return[t.dev,t.ino,t.size,t.mtimeMs,t.ctimeMs].join(":")}catch(t){throw new d(`Could not read the downloaded archive: ${t instanceof Error?t.message:String(t)}`)}}async function fL(e){try{return await zo.default.promises.realpath(Jo.default.resolve(e))}catch(t){throw new d(`Refusing to extract: the directory the extraction must stay inside ("${b(e)}") could not be resolved: ${t instanceof Error?t.message:String(t)}`)}}async function mL(e,t){let r=Jo.default.resolve(t);Me(e,r,"the extraction directory");let o=Jo.default.relative(e,r).split(Jo.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Jo.default.join(i,s);let a=await gL(i);if(a===null){await zo.default.promises.mkdir(i);continue}if(a.isSymbolicLink())throw new d(`Refusing to extract: "${b(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 d(`Refusing to extract: "${b(i)}" exists and is not a directory.`)}return r}async function gL(e){try{return await zo.default.promises.lstat(e)}catch(t){if(t.code==="ENOENT")return null;throw new d(`Could not inspect "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function hL(e,t){let r=fF(t.limits),n=hF(t.consumedSubtrees),o=[],i=[],s=uF(),a=0,l=0,c=0,p=!1,f=!1,m=(g,h)=>{c+=1,o.length<cF&&o.push({entryPath:g,reason:h})};try{await wd.list({file:e,onReadEntry:g=>{let h=g.path,y=g.type;if(mF(y)||(a+=1,a>r.maxFiles&&!p&&(p=!0,m(h,`archive has more than ${r.maxFiles} files`))),!Yh.has(y)){let F=`unsupported entry type ${y}`;n(h)?m(h,F):p||i.push({entryPath:h,reason:F});return}let k=Ss(h)??gF(h,r);if(k){m(h,k);return}let v=g.size;v>r.maxEntryBytes&&m(h,`entry is ${xs(v)}, over the ${xs(r.maxEntryBytes)} per-file cap`),l+=v,l>r.maxUnpackedBytes&&!f&&(f=!0,m(h,`unpacked total passes the ${xs(r.maxUnpackedBytes)} cap`))},onwarn:(g,h)=>{dF(s,g,h)}})}catch(g){throw g instanceof d?g:new d(`Could not read the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}if(o.length>0)throw kL(o,c);if(s.fatal.length>0)throw wF(s.fatal,s.fatalCount);for(let g of i)u.debug(`Skipped archive entry "${b(g.entryPath)}": ${g.reason}`);return{skipped:i,warnings:s}}function yL(e,t,r,n){if(!Yh.has(t))return`unsupported entry type ${t}`;let o=Ss(e)??gF(e,n);return o||(r>n.maxEntryBytes?`entry is ${xs(r)}, over the ${xs(n.maxEntryBytes)} per-file cap`:null)}async function wL(e,t,r){let n=fF(r.limits),o=hF(r.consumedSubtrees),i=uF(),s=[],a=0,l=0,c=0,p=(g,h)=>(a+=1,s.length<cF&&s.push({entryPath:g,reason:h}),!1),f=()=>!1,m=(g,h)=>{let y="type"in h?h.type:h.isDirectory()?"Directory":"File",k=h.size;if(!Yh.has(y)&&!o(g))return f();let v=yL(g,y,k,n);if(v)return p(g,v);if(c+k>n.maxUnpackedBytes)return p(g,`unpacked total passes the ${xs(n.maxUnpackedBytes)} cap`);if(!mF(y)){if(l+1>n.maxFiles)return p(g,`archive has more than ${n.maxFiles} files`);l+=1}return c+=k,!0};try{await wd.extract({file:e,cwd:t,strip:r.strip??0,preservePaths:!1,filter:m,onwarn:(g,h)=>{dF(i,g,h)}})}catch(g){throw g instanceof d?g:new d(`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 bL(e,t){Me(e,await zo.default.promises.realpath(t),"the extracted directory");let r=[t];for(;r.length>0;){let n=r.pop(),o=await zo.default.promises.readdir(n,{withFileTypes:!0});for(let i of o){let s=Jo.default.join(n,i.name);if(!i.isFile()&&!i.isDirectory())throw new d(`Refusing to continue: extraction produced a non-regular entry at "${b(s)}". Please report this.`);Me(e,s,"an extracted archive entry"),i.isDirectory()&&r.push(s)}}}function fF(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??dL,maxPathLength:e.maxPathLength??pL}}function mF(e){return e==="Directory"||e==="GNUDumpDir"}function qh(e){return e.replace(/\/+$/,"")}function gF(e,t){let r=qh(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 hF(e){let t=e.map(qh);return r=>{let n=qh(r).split("/").slice(1).join("/");return t.some(o=>n===o||n.startsWith(`${o}/`))}}function xs(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 kL(e,t){return new d(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
226
+ ${yF(e,t).join(`
225
227
  `)}
226
- Nothing was extracted. Please report this.`)}function q$(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
- ${cC(e,t).join(`
228
+ Nothing was extracted. Please report this.`)}function DL(e,t){return new d(`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.
229
+ ${yF(e,t).join(`
228
230
  `)}
229
- The extracted directory cannot be trusted. Please retry.`)}function cC(e,t){let n=e.slice(0,mh),r=n.map(i=>` - "${D(i.entryPath)}": ${i.reason}`),o=t-n.length;return o>0&&r.push(` \u2026 and ${o} more.`),r}function uC(e,t){let n=e.slice(0,mh).map(o=>` - ${o.code}: ${o.message}`),r=t-Math.min(e.length,mh);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(`
231
+ The extracted directory cannot be trusted. Please retry.`)}function yF(e,t){let r=e.slice(0,zh),n=r.map(i=>` - "${b(i.entryPath)}": ${i.reason}`),o=t-r.length;return o>0&&n.push(` \u2026 and ${o} more.`),n}function wF(e,t){let r=e.slice(0,zh).map(o=>` - ${o.code}: ${o.message}`),n=t-Math.min(e.length,zh);return n>0&&r.push(` \u2026 and ${n} more.`),new d(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
232
+ ${r.join(`
231
233
  `)}
232
- This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var X$="webflow",yh="webflow-skills",he=`${X$}/${yh}`,Ge="main",ed=`plugins/${yh}`,sr=`${ed}/.claude-plugin/plugin.json`,wh=[`${ed}/skills`,"skills"],dC=[`${ed}/skills`,`${ed}/.claude-plugin`];function pC(e){return`${yh}-${e}`}var Zt=/^[0-9a-f]{40}$/,td=/^[A-Za-z0-9._/-]{1,255}$/,Y$=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function fC(e){let t=e.split(":",1)[0];return Y$.includes(t)}var $t="https://api.github.com",Vo="https://codeload.github.com";var mC="skills",nd="download-",rd="extract-";var lr=w(require("fs")),sd=w(require("path"));nc();C();A();C();function hC(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 gn(e){try{return new URL(e).hostname}catch{return e}}function Z$(e){return new f(`Could not find ref "${D(e)}" in ${he}.
233
- \u2022 The default branch is "${Ge}".
234
+ This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var EL="webflow",Xh="webflow-skills",ye=`${EL}/${Xh}`,Ve="main",bd=`plugins/${Xh}`,mn=`${bd}/.claude-plugin/plugin.json`,Zh=[`${bd}/skills`,"skills"],bF=[`${bd}/skills`,`${bd}/.claude-plugin`];function kF(e){return`${Xh}-${e}`}var tr=/^[0-9a-f]{40}$/,kd=/^[A-Za-z0-9._/-]{1,255}$/,vL=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function DF(e){let t=e.split(":",1)[0];return vL.includes(t)}var Ot="https://api.github.com",qo="https://codeload.github.com";var EF="skills",Dd="download-",Ed="extract-";var hn=w(require("fs")),xd=w(require("path"));oa();C();R();C();function SF(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 wr(e){try{return new URL(e).hostname}catch{return e}}function SL(e){return new d(`Could not find ref "${b(e)}" in ${ye}.
235
+ \u2022 The default branch is "${Ve}".
234
236
  \u2022 This repo has no tags or releases yet, so "--ref v1.0.7" will not resolve.
235
- \u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function Q$(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 eO(e){return new f(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
236
- \u2022 Retry after ${Q$(e)}.
237
+ \u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function xL(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 CL(e){return new d(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
238
+ \u2022 Retry after ${xL(e)}.
237
239
  \u2022 Or set GITHUB_TOKEN / GH_TOKEN in your environment to raise the limit to 5,000/hour.
238
- \u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function tO(){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 ${gn($t)}, set HTTPS_PROXY.
240
- \u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function nO(e,t){return new f(`${gn(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function rO(e,t,n){return new f(`${gn(e)} returned an unexpected ${t} ${D(n)} response. Please report this if it persists.`)}function gs(e,t,n){let{status:r}=t;if(r===404)return Z$(n??Ge);let o=t.headers.get("x-ratelimit-remaining");return r===429||r===403&&o==="0"?eO(t.headers.get("x-ratelimit-reset")):r===403?tO():r>=500?nO(e,r):rO(e,r,t.statusText)}function yC(e){let t=e?gn(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 ${gn($t)} is genuinely redirecting.`,{isUserError:!0})}function gC(e,t){return new f(`Could not reach ${gn(e)}${t?` (${t})`:""}.
240
+ \u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function FL(){return new d(`GitHub refused the request (403). This is a permission error, not a rate limit.
241
+ \u2022 If you are behind a proxy that filters ${wr(Ot)}, set HTTPS_PROXY.
242
+ \u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function _L(e,t){return new d(`${wr(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function AL(e,t,r){return new d(`${wr(e)} returned an unexpected ${t} ${b(r)} response. Please report this if it persists.`)}function Cs(e,t,r){let{status:n}=t;if(n===404)return SL(r??Ve);let o=t.headers.get("x-ratelimit-remaining");return n===429||n===403&&o==="0"?CL(t.headers.get("x-ratelimit-reset")):n===403?FL():n>=500?_L(e,n):AL(e,n,t.statusText)}function xF(e){let t=e?wr(e):"an unnamed host";return new d(`Refusing to follow a redirect to ${b(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 ${wr(Ot)} is genuinely redirecting.`,{isUserError:!0})}function vF(e,t){return new d(`Could not reach ${wr(e)}${t?` (${t})`:""}.
241
243
  \u2022 Check your network connection.
242
244
  \u2022 Behind a corporate proxy, set HTTPS_PROXY. Note that the CLI's HTTP client does not read proxy environment variables automatically.
243
- \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function od(e,t){return new f(`Timed out after ${Math.round(t/1e3)}s waiting for ${gn(e)}.
245
+ \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function vd(e,t){return new d(`Timed out after ${Math.round(t/1e3)}s waiting for ${wr(e)}.
244
246
  \u2022 Check your network connection, then retry.
245
247
  \u2022 Behind a corporate proxy, set HTTPS_PROXY.
246
- \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function id(){return new f(`The skills catalog download exceeded ${hC(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function wC(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 bC(){return new f("The skills catalog download returned no response body. Please retry.")}function tl(e){return new f(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function DC(){return new f(`${gn($t)} 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 kC(){return new f(`${gn($t)} answered the ref lookup with more than ${hC(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 ${gn($t)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function hs(e){return new f(`Expected a full 40-character commit SHA but got "${D(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function ar(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 oO=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function iO(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 rl(e,t,n){if(n instanceof f)return n;let r=iO(n);if(r==="ENOSPC"||r==="EDQUOT"||r==="EFBIG")return tl("writing the skills catalog");if(r&&oO.has(r))return gC(e,r);let o=n?.type;if(o==="request-timeout")return od(e,t);if(o==="max-size")return id();let i=n instanceof Error?n.message:String(n);return/network timeout|timed? ?out/i.test(i)?od(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?gC(e,""):new f(`Could not fetch the skills catalog from ${gn(e)}: ${D(i)}`)}function ys(){return sd.default.join(_b(),mC)}function Dh(e){if(!Zt.test(e))throw hs(e);return sd.default.join(ys(),e)}async function ol(){let e=ys();try{return await lr.default.promises.mkdir(e,{recursive:!0,mode:448}),await lr.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?tl("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 kh(e){let t=Dh(e),n;try{n=await lr.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 aO=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function lO(e){try{return(await lr.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function Eh(e,t){let n=Dh(e),r=ys();await ps(r,n,"the skills cache entry"),await ps(r,t,"the extracted skills catalog being published");try{return await lr.default.promises.rename(t,n),{dir:n,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw tl("publishing the skills catalog to the cache");if(i!==void 0&&aO.has(i)&&await lO(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 Go(e){await ps(ys(),e,"the skills cache path being removed");try{await lr.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 cO(e){return Zt.test(e)||e.startsWith(nd)||e.startsWith(rd)}async function ad(e){let t=ys(),n;try{n=await lr.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||!cO(o.name))continue;let i=sd.default.join(t,o.name);try{if((await lr.default.promises.lstat(i)).mtimeMs>=r)continue;await Go(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 xh=w(require("fs")),vh=w(require("path")),xC=require("stream"),CC=require("stream/promises");lt();A();var uO="catalog.tar.gz",il=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},ld=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},Sh=class extends xC.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 ld);return}o(null,i)}};async function Ch(e){if(!Zt.test(e))throw hs(e);let t=await ol(),n=await xh.default.promises.mkdtemp(vh.default.join(t,nd)),r=vh.default.join(n,uO),o=`${Vo}/${he}/tar.gz/${e}`;try{let i=await dO(o,e),s=await pO(i,r);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:r,downloadDir:n,bytes:s}}catch(i){throw await Go(n),rl(Vo,6e4,i)}}async function dO(e,t){let n=0;for(let r=0;r<2;r+=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 id();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?wC(t):gs(Vo,o)}throw gs(Vo,{status:n||500,statusText:"Server Error",headers:{get:()=>null}})}async function pO(e,t){let n=e.body;if(!n)throw bC();let r=new Sh(33554432),o=setTimeout(()=>{n.destroy?.(new il),r.destroy(new il)},6e4);o.unref?.();try{await(0,CC.pipeline)(n,r,xh.default.createWriteStream(t,{mode:384}))}catch(i){throw SC(i,ld)?id():SC(i,il)?od(Vo,6e4):i}finally{clearTimeout(o)}return r.bytes}function SC(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();A();var fO=["GITHUB_TOKEN","GH_TOKEN"];function mO(){for(let e of fO){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function gO(e){if(e==="")throw ar(e,"it is empty");if(!td.test(e))throw ar(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw ar(e,"it starts with '-'");if(e.includes(".."))throw ar(e,"it contains '..'");if(e.endsWith(".lock"))throw ar(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw ar(e,"it starts or ends with '/'");if(e.includes("//"))throw ar(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw ar(e,"a path component ends with '.'")}function hO(e){return e.split("/").map(encodeURIComponent).join("/")}function yO(e){return new Promise(t=>{setTimeout(t,e)})}async function ll(e=Ge){if(Zt.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};gO(e);let t=mO(),n=`${$t}/repos/${he}/commits/${hO(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let r=await wO(n,e,t),o=await DO(r);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function wO(e,t,n){let r=null;for(let o=0;o<2;o+=1){let i;try{i=await G(e,{headers:{Accept:"application/vnd.github.sha",...n?{Authorization:`Bearer ${n}`}:{}},timeout:1e4,...n?{redirect:"manual"}:{}})}catch(s){throw rl($t,1e4,s)}if(n&&i.status>=300&&i.status<400)throw yC(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 yO(1e3);continue}throw gs($t,i,t)}throw gs($t,{status:r??500,statusText:"Server Error",headers:{get:()=>null}},t)}var ud=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function bO(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 ud;n.push(i)}return Buffer.concat(n).toString("utf8")}async function DO(e){let t;try{t=await bO(e)}catch(r){throw r instanceof ud?kC():rl($t,1e4,r)}let n=t.trim();if(!Zt.test(n))throw DC();return n}async function ws(e={}){let t=await kO(e),{commit:n,ref:r}=t,o=await kh(n);if(o)return u.debug(`Using cached skills catalog for ${n}.`),await ad(n),{ref:r,commit:n,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await EO(n);return await ad(n),{ref:r,commit:n,...i}}async function kO(e){if(e.commit!==void 0){if(!Zt.test(e.commit))throw hs(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return ll(e.ref)}async function EO(e){let t=await ol(),n=await Ch(e),r=await Fh.default.promises.mkdtemp(_h.default.join(t,rd));try{let o=await oC(n.tarPath,r,{strip:0,containmentRoot:t,consumedSubtrees:dC,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await vO(r,e),{dir:s,published:a}=await Eh(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 Go(r),await Go(n.downloadDir)}}async function vO(e,t){let n=pC(t),r=await Fh.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 _h.default.join(e,n)}var Ko=`https://github.com/${he}/issues`,Ot="SKILL.md",cl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Jo=new Set([".git","node_modules","__pycache__"]),zo=new Set([".DS_Store","Thumbs.db"]),qo=8,dd=512,pd=128,RC=1024,IC=32,TC=256,PC=64,$C=64,Ah=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,OC=256,LC=4;var Rh=w(require("fs")),bs=w(require("path"));C();async function Ds(e){let t=bs.default.join(e,...sr.split("/"));Ue(e,t,"the catalog plugin manifest");let n;try{n=await Rh.default.promises.readFile(t,"utf8")}catch(i){if(!CO(i))throw new f(`Failed to read the catalog manifest at ${sr}: ${i instanceof Error?i.message:String(i)}`)}if(n===void 0)return{...await NC(e),version:"",source:"fallback"};let r=xO(n);if(r.skills===void 0)return{...await NC(e),version:r.version,source:"fallback"};let o=await SO(t,r.skills,e);if(!o)throw new f(`The catalog manifest at ${sr} 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 SO(e,t,n){let r=bs.default.dirname(e),o=[{base:bs.default.dirname(r),relativeTo:"plugin root"},{base:r,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=bs.default.resolve(s.base,t);if(Ue(n,a,"the catalog skills directory"),!!await jC(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${sr} declares "skills": "${D(t)}", which only resolves relative to the ${s.relativeTo}. This means ${he} changed its layout; please report it at ${Ko}.`]}}}function xO(e){let t;try{t=JSON.parse(e)}catch(o){throw new f(`The catalog manifest at ${sr} 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 ${sr} 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 ${sr} declares "skills" as ${FO(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 NC(e){for(let t of wh){let n=bs.default.join(e,...t.split("/"));if(Ue(e,n,"the catalog skills directory"),!!await jC(n))return{skillsDir:n,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${he} changed its layout; please report it at ${Ko}.`]}}throw new f(`The downloaded catalog has no skills directory: ${sr} is absent and none of ${wh.join(", ")} exists. This is a bug in ${he}. Please report it.`)}async function jC(e){try{return(await Rh.default.promises.stat(e)).isDirectory()}catch{return!1}}function CO(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function FO(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 MC=require("yaml");var Lt=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},_O=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,AO=/^\uFEFF/,RO="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",BC="\u2014 wrap the value in double quotes",IO={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},TO=100,PO=j.object({name:j.string().trim().min(1).max(pd),description:j.string().trim().min(1).max(RC),"mcp-version":j.string().max(IC).optional(),compatibility:j.string().max(TC).optional(),license:j.string().max(PC).optional(),metadata:j.record(j.unknown()).optional()}).passthrough(),Ih=["name","description"];function Xo(e){let t=e.replace(AO,""),n=_O.exec(t);if(!n){if(t.trimStart().startsWith("---"))throw new Lt(RO);return{frontmatter:Th({}),body:t,raw:e}}let r=n[1]??"",o=n[2]??"",i=$O(r,1);return{frontmatter:Th(i),body:o,raw:e}}function $O(e,t){let n=(0,MC.parseDocument)(e,IO),[r]=n.errors;if(r)throw new Lt(OO(r,e,t));let o;try{o=n.toJS({maxAliasCount:TO})}catch(i){throw new Lt(`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 Lt(`frontmatter is not a YAML mapping (parsed as ${Ph(o)})`);return o}function OO(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(": ")?` ${BC}`:"";return`YAML parse error: ${e.message}${o}${s}`}function Th(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new Lt(`frontmatter is not a YAML mapping (parsed as ${Ph(e)})`);let t={...e},n=Ih.filter(i=>!(i in t)||t[i]===void 0);if(n.length>0)throw new Lt(`missing required frontmatter field(s): ${n.join(", ")}`);let r=Ih.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(r.length>0){let i=Ih.map(a=>Ph(t[a])).join(" and "),s=r.some(a=>NO(t[a]));throw new Lt(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${BC}`:""}`)}t.metadata=LO(t.metadata),t.metadata===void 0&&delete t.metadata;let o=PO.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new Lt(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function LO(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function NO(e){return!(e==null||typeof e=="string")}function Ph(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 $h(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function Oh(e){let t=e.metadata?.category;if(typeof t!="string")return;let n=t.trim();return n===""?void 0:n}var fd=w(require("path"));C();var jO=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),Lh="/webflow-skills-store";function ks(e){if(typeof e!="string")return;let t=UC(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,$C),n=UC(t);if(n&&!jO.has(n)&&MO(n))return n}function UC(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function MO(e){return[Zx,ph].every(n=>{let r=n.impl.join(Lh,e);return!rt(Lh,r,n)||n.impl.basename(r)!==e?!1:n.impl.dirname(r)===n.impl.normalize(Lh)})}function Nh(e){return Ah.test(e)}var Kr=e=>fd.default.posix.basename(fd.default.posix.dirname(e.split(fd.default.win32.sep).join("/")));function cr(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=ks(n);i!==void 0&&o.push(s=>s.dir===i||ks(s.name)===i||ks(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 WC(e){return HC(e,t=>t.dir)}function jh(e){let[t]=WC(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(`
248
+ \u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Sd(){return new d(`The skills catalog download exceeded ${SF(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function CF(e){return new d(`Commit ${b(e)} of ${ye} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
249
+ \u2022 Retry without --ref to take the current "${Ve}".`,{isUserError:!0})}function FF(){return new d("The skills catalog download returned no response body. Please retry.")}function fl(e){return new d(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function _F(){return new d(`${wr(Ot)} 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 AF(){return new d(`${wr(Ot)} answered the ref lookup with more than ${SF(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
250
+ \u2022 If a proxy is intercepting ${wr(Ot)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function Fs(e){return new d(`Expected a full 40-character commit SHA but got "${b(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function gn(e,t){return new d(`Invalid --ref "${b(e)}": ${t}.
251
+ \u2022 Pass a branch name (e.g. "${Ve}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function RF(e,t){let r=t.length===0?"nothing":t.map(n=>`"${b(n)}"`).join(", ");return new d(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${r}. Please report this.`)}var RL=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function IL(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 gl(e,t,r){if(r instanceof d)return r;let n=IL(r);if(n==="ENOSPC"||n==="EDQUOT"||n==="EFBIG")return fl("writing the skills catalog");if(n&&RL.has(n))return vF(e,n);let o=r?.type;if(o==="request-timeout")return vd(e,t);if(o==="max-size")return Sd();let i=r instanceof Error?r.message:String(r);return/network timeout|timed? ?out/i.test(i)?vd(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?vF(e,""):new d(`Could not fetch the skills catalog from ${wr(e)}: ${b(i)}`)}function _s(){return xd.default.join(Rb(),EF)}function ey(e){if(!tr.test(e))throw Fs(e);return xd.default.join(_s(),e)}async function hl(){let e=_s();try{return await hn.default.promises.mkdir(e,{recursive:!0,mode:448}),await hn.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?fl("creating the skills cache directory"):new d(`Could not create the skills cache directory "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function ty(e){let t=ey(e),r;try{r=await hn.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 d(`Refusing to use the skills cache: "${b(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 PL=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function $L(e){try{return(await hn.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function ry(e,t){let r=ey(e),n=_s();await vs(n,r,"the skills cache entry"),await vs(n,t,"the extracted skills catalog being published");try{return await hn.default.promises.rename(t,r),{dir:r,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw fl("publishing the skills catalog to the cache");if(i!==void 0&&PL.has(i)&&await $L(r))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:r,published:!1};throw new d(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function Yo(e){await vs(_s(),e,"the skills cache path being removed");try{await hn.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}function OL(e){return tr.test(e)||e.startsWith(Dd)||e.startsWith(Ed)}async function Cd(e){let t=_s(),r;try{r=await hn.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||!OL(o.name))continue;let i=xd.default.join(t,o.name);try{if((await hn.default.promises.lstat(i)).mtimeMs>=n)continue;await Yo(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 iy=w(require("fs")),ny=w(require("path")),PF=require("stream"),$F=require("stream/promises");lt();R();var LL="catalog.tar.gz",yl=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},Fd=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},oy=class extends PF.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 Fd);return}o(null,i)}};async function sy(e){if(!tr.test(e))throw Fs(e);let t=await hl(),r=await iy.default.promises.mkdtemp(ny.default.join(t,Dd)),n=ny.default.join(r,LL),o=`${qo}/${ye}/tar.gz/${e}`;try{let i=await NL(o,e),s=await jL(i,n);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:n,downloadDir:r,bytes:s}}catch(i){throw await Yo(r),gl(qo,6e4,i)}}async function NL(e,t){let r=0;for(let n=0;n<2;n+=1){let o=await K(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 Sd();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?CF(t):Cs(qo,o)}throw Cs(qo,{status:r||500,statusText:"Server Error",headers:{get:()=>null}})}async function jL(e,t){let r=e.body;if(!r)throw FF();let n=new oy(33554432),o=setTimeout(()=>{r.destroy?.(new yl),n.destroy(new yl)},6e4);o.unref?.();try{await(0,$F.pipeline)(r,n,iy.default.createWriteStream(t,{mode:384}))}catch(i){throw TF(i,Fd)?Sd():TF(i,yl)?vd(qo,6e4):i}finally{clearTimeout(o)}return n.bytes}function TF(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}lt();R();var ML=["GITHUB_TOKEN","GH_TOKEN"];function BL(){for(let e of ML){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function UL(e){if(e==="")throw gn(e,"it is empty");if(!kd.test(e))throw gn(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw gn(e,"it starts with '-'");if(e.includes(".."))throw gn(e,"it contains '..'");if(e.endsWith(".lock"))throw gn(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw gn(e,"it starts or ends with '/'");if(e.includes("//"))throw gn(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw gn(e,"a path component ends with '.'")}function WL(e){return e.split("/").map(encodeURIComponent).join("/")}function HL(e){return new Promise(t=>{setTimeout(t,e)})}async function kl(e=Ve){if(tr.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};UL(e);let t=BL(),r=`${Ot}/repos/${ye}/commits/${WL(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let n=await VL(r,e,t),o=await KL(n);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function VL(e,t,r){let n=null;for(let o=0;o<2;o+=1){let i;try{i=await K(e,{headers:{Accept:"application/vnd.github.sha",...r?{Authorization:`Bearer ${r}`}:{}},timeout:1e4,...r?{redirect:"manual"}:{}})}catch(s){throw gl(Ot,1e4,s)}if(r&&i.status>=300&&i.status<400)throw xF(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 HL(1e3);continue}throw Cs(Ot,i,t)}throw Cs(Ot,{status:n??500,statusText:"Server Error",headers:{get:()=>null}},t)}var Ad=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function GL(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 Ad;r.push(i)}return Buffer.concat(r).toString("utf8")}async function KL(e){let t;try{t=await GL(e)}catch(n){throw n instanceof Ad?AF():gl(Ot,1e4,n)}let r=t.trim();if(!tr.test(r))throw _F();return r}async function As(e={}){let t=await JL(e),{commit:r,ref:n}=t,o=await ty(r);if(o)return u.debug(`Using cached skills catalog for ${r}.`),await Cd(r),{ref:n,commit:r,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await zL(r);return await Cd(r),{ref:n,commit:r,...i}}async function JL(e){if(e.commit!==void 0){if(!tr.test(e.commit))throw Fs(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return kl(e.ref)}async function zL(e){let t=await hl(),r=await sy(e),n=await ay.default.promises.mkdtemp(ly.default.join(t,Ed));try{let o=await pF(r.tarPath,n,{strip:0,containmentRoot:t,consumedSubtrees:bF,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await qL(n,e),{dir:s,published:a}=await ry(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 Yo(n),await Yo(r.downloadDir)}}async function qL(e,t){let r=kF(t),n=await ay.default.promises.readdir(e,{withFileTypes:!0}),o=n.filter(i=>i.isDirectory());if(n.length!==1||o.length!==1||o[0].name!==r)throw RF(r,n.map(i=>i.name));return ly.default.join(e,r)}var Xo=`https://github.com/${ye}/issues`,Lt="SKILL.md",Dl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Zo=new Set([".git","node_modules","__pycache__"]),Qo=new Set([".DS_Store","Thumbs.db"]),ei=8,Rd=512,Id=128,jF=1024,MF=32,BF=256,UF=64,WF=64,cy=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,HF=256,VF=4;var uy=w(require("fs")),Rs=w(require("path"));C();async function Is(e){let t=Rs.default.join(e,...mn.split("/"));Me(e,t,"the catalog plugin manifest");let r;try{r=await uy.default.promises.readFile(t,"utf8")}catch(i){if(!ZL(i))throw new d(`Failed to read the catalog manifest at ${mn}: ${i instanceof Error?i.message:String(i)}`)}if(r===void 0)return{...await GF(e),version:"",source:"fallback"};let n=XL(r);if(n.skills===void 0)return{...await GF(e),version:n.version,source:"fallback"};let o=await YL(t,n.skills,e);if(!o)throw new d(`The catalog manifest at ${mn} declares its skills directory as "${b(n.skills)}", which does not exist in the downloaded catalog. This is a bug in ${ye}. Please report it.`);return{version:n.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function YL(e,t,r){let n=Rs.default.dirname(e),o=[{base:Rs.default.dirname(n),relativeTo:"plugin root"},{base:n,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=Rs.default.resolve(s.base,t);if(Me(r,a,"the catalog skills directory"),!!await KF(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${mn} declares "skills": "${b(t)}", which only resolves relative to the ${s.relativeTo}. This means ${ye} changed its layout; please report it at ${Xo}.`]}}}function XL(e){let t;try{t=JSON.parse(e)}catch(o){throw new d(`The catalog manifest at ${mn} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${ye}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new d(`The catalog manifest at ${mn} is not a JSON object. This is a bug in ${ye}. Please report it.`);let r=t,n=r.skills;if(n!==void 0&&(typeof n!="string"||n.trim()===""))throw new d(`The catalog manifest at ${mn} declares "skills" as ${QL(n)}, but it must be a non-empty string. This is a bug in ${ye}. Please report it.`);return{version:typeof r.version=="string"?r.version.trim():"",skills:typeof n=="string"?n:void 0}}async function GF(e){for(let t of Zh){let r=Rs.default.join(e,...t.split("/"));if(Me(e,r,"the catalog skills directory"),!!await KF(r))return{skillsDir:r,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${ye} changed its layout; please report it at ${Xo}.`]}}throw new d(`The downloaded catalog has no skills directory: ${mn} is absent and none of ${Zh.join(", ")} exists. This is a bug in ${ye}. Please report it.`)}async function KF(e){try{return(await uy.default.promises.stat(e)).isDirectory()}catch{return!1}}function ZL(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function QL(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 JF=require("yaml");Zi();var Nt=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},eN=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,tN=/^\uFEFF/,rN="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",zF="\u2014 wrap the value in double quotes",nN={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},oN=100,iN=B.object({name:B.string().trim().min(1).max(Id),description:B.string().trim().min(1).max(jF),"mcp-version":B.string().max(MF).optional(),compatibility:B.string().max(BF).optional(),license:B.string().max(UF).optional(),metadata:B.record(B.unknown()).optional()}).passthrough(),dy=["name","description"];function ti(e){let t=e.replace(tN,""),r=eN.exec(t);if(!r){if(t.trimStart().startsWith("---"))throw new Nt(rN);return{frontmatter:py({}),body:t,raw:e}}let n=r[1]??"",o=r[2]??"",i=sN(n,1);return{frontmatter:py(i),body:o,raw:e}}function sN(e,t){let r=(0,JF.parseDocument)(e,nN),[n]=r.errors;if(n)throw new Nt(aN(n,e,t));let o;try{o=r.toJS({maxAliasCount:oN})}catch(i){throw new Nt(`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 Nt(`frontmatter is not a YAML mapping (parsed as ${fy(o)})`);return o}function aN(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(`
252
+ `).length,c=n-(a.lastIndexOf(`
253
+ `)+1)+1;o=` at line ${l+r}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${zF}`:"";return`YAML parse error: ${e.message}${o}${s}`}function py(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new Nt(`frontmatter is not a YAML mapping (parsed as ${fy(e)})`);let t={...e},r=dy.filter(i=>!(i in t)||t[i]===void 0);if(r.length>0)throw new Nt(`missing required frontmatter field(s): ${r.join(", ")}`);let n=dy.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(n.length>0){let i=dy.map(a=>fy(t[a])).join(" and "),s=n.some(a=>cN(t[a]));throw new Nt(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${zF}`:""}`)}t.metadata=lN(t.metadata),t.metadata===void 0&&delete t.metadata;let o=iN.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new Nt(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function lN(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function cN(e){return!(e==null||typeof e=="string")}function fy(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 my(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function gy(e){let t=e.metadata?.category;if(typeof t!="string")return;let r=t.trim();return r===""?void 0:r}var Td=w(require("path"));C();var uN=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),hy="/webflow-skills-store";function Ts(e){if(typeof e!="string")return;let t=qF(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,WF),r=qF(t);if(r&&!uN.has(r)&&dN(r))return r}function qF(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function dN(e){return[sF,Kh].every(r=>{let n=r.impl.join(hy,e);return!ot(hy,n,r)||r.impl.basename(n)!==e?!1:r.impl.dirname(n)===r.impl.normalize(hy)})}function yy(e){return cy.test(e)}var Zn=e=>Td.default.posix.basename(Td.default.posix.dirname(e.split(Td.default.win32.sep).join("/")));function yn(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=Ts(r);i!==void 0&&o.push(s=>s.dir===i||Ts(s.name)===i||Ts(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 YF(e){return XF(e,t=>t.dir)}function wy(e){let[t]=YF(e);if(!t)return;let r=t.skills.length,n=t.skills.map(o=>` "${b(o.name)}" (${b(o.skillPath)})`);throw new d(`${r===2?"Two":String(r)} skills resolve to the same install directory "${b(t.value)}":
254
+ ${n.join(`
253
255
  `)}
254
- This is a bug in ${he}. Please report it.`)}function Mh(e){return HC(e,t=>t.name)}function Bh(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 HC(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 Es=w(require("fs")),Qt=w(require("path"));C();async function vs(e,t){Ue(t,e,"the catalog skills directory");let n=[],r=[],o=[],i=new Set,s=d=>(o.push(...d.warnings),d.kind==="skipped"?(r.push({skillPath:d.skillPath,reason:d.reason}),!1):(n.push(d.skill),!d.skill.internal));for(let d of await ul(e,"the catalog skills directory")){if(cl.has(d.name))continue;let m=Qt.default.join(e,d.name);if(!await Uh(m,d))continue;let h=await GC(m);if(h.kind!=="none"&&i.add(h.path),!(h.kind!=="none"&&s(await VC({skillDir:m,manifest:h,extractRoot:t}))))for(let g of await ul(m)){if(cl.has(g.name))continue;let y=Qt.default.join(m,g.name);if(!await Uh(y,g))continue;let b=await GC(y);b.kind!=="none"&&(i.add(b.path),s(await VC({skillDir:y,manifest:b,extractRoot:t,parentCategory:d.name})))}}let a=await UO(n),l=Mh(a),c=new Set;for(let d of l){o.push(Bh(d));for(let m of d.skills.slice(1))c.add(m.skillPath)}let p=a.filter(d=>!c.has(d.skillPath));jh(p),o.push(...await WO(e,t,i));for(let d of r)o.push(`Skipped ${d.skillPath} \u2014 ${d.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 ${Ko}.`),{skills:p,skipped:r,warnings:o}}async function VC(e){let{skillDir:t,manifest:n,extractRoot:r,parentCategory:o}=e,i=zC(r,n.path),s=[],a=g=>({kind:"skipped",skillPath:i,reason:D(g),warnings:s});if(n.kind==="symlink")return a(`${Ot} is a symbolic link; skill files must be regular files`);let l;try{l=await Es.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=Xo(l).frontmatter}catch(g){if(g instanceof Lt)return a(g.reason);throw g}let p=D(c.name),d=D(c.description);if(p==="")return a(`frontmatter name "${D(c.name)}" cannot be used as a directory name`);let m=ks(p);if(m===void 0)return a(`frontmatter name "${p}" cannot be used as a directory name`);Nh(p)||s.push(`${i} declares a non-standard skill name "${p}"; it installs as "${m}". This is a bug in ${he}.`);let h=await BO(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 ${dd} files; only the first ${dd} are listed.`),{kind:"skill",warnings:s,skill:{name:p,dir:m,folderName:Kr(i),description:d,category:Oh(c)??o,internal:$h(c),path:t,skillPath:i,supplementaryFiles:h.files}})}async function GC(e){let t=Qt.default.join(e,Ot),n=await KC(t);if(n)return n;let r=Ot.toLowerCase();for(let o of await ul(e)){if(o.name===Ot||o.name.toLowerCase()!==r)continue;let i=await KC(Qt.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function KC(e){try{let t=await Es.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function Uh(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await Es.default.promises.stat(e)).isDirectory()}catch{return!1}}async function ul(e,t){try{return(await Es.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 BO(e,t){let n=[],r,o=!1,i=async(s,a)=>{if(!(a>qo||r!==void 0))for(let l of await ul(s)){if(r!==void 0)return;let c=Qt.default.join(s,l.name);if(l.isSymbolicLink()){r=JC(e,c);return}if(l.isDirectory()){if(Jo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!zo.has(l.name)&&c!==t){if(n.length>=dd){o=!0;return}n.push(JC(e,c))}}};return await i(e,1),{files:n.sort(),symlink:r,truncated:o}}async function UO(e){let t=new Set,n=[];for(let r of e){let o;try{o=await Es.default.promises.realpath(r.path)}catch{o=Qt.default.resolve(r.path)}t.has(o)||(t.add(o),n.push(r))}return n}async function WO(e,t,n){let r=[],o=OC,i=async(s,a)=>{if(!(a>LC||o<=0)){o-=1;for(let l of await ul(s)){if(cl.has(l.name))continue;let c=Qt.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Ot.toLowerCase()){n.has(c)||r.push(zC(t,c));continue}await Uh(c,l)&&await i(c,a+1)}}};return await i(e,1),r.length===0?[]:[`${r.length} ${Ot} 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 ${Ko}.`]}function zC(e,t){return Qt.default.relative(e,t).split(Qt.default.sep).join("/")}function JC(e,t){return Qt.default.relative(e,t).split(Qt.default.sep).join("/")}var hn=w(require("os")),On=w(require("path"));function Yo(e,t){let n=process.env[e]?.trim();return n||t}function qC(e){let t=process.env[e]?.trim();return t||void 0}var ce={home:()=>hn.default.homedir(),configHome:()=>Yo("XDG_CONFIG_HOME",On.default.join(hn.default.homedir(),".config")),hardcodedConfigHome:()=>On.default.join(hn.default.homedir(),".config"),claudeHome:()=>Yo("CLAUDE_CONFIG_DIR",On.default.join(hn.default.homedir(),".claude")),codexHome:()=>Yo("CODEX_HOME",On.default.join(hn.default.homedir(),".codex")),vibeHome:()=>Yo("VIBE_HOME",On.default.join(hn.default.homedir(),".vibe")),hermesHome:()=>Yo("HERMES_HOME",On.default.join(hn.default.homedir(),".hermes")),autohandHome:()=>Yo("AUTOHAND_HOME",On.default.join(hn.default.homedir(),".autohand")),grokHome:()=>Yo("GROK_HOME",On.default.join(hn.default.homedir(),".grok")),appData:()=>qC("APPDATA"),flatpakConfigHome:()=>qC("FLATPAK_XDG_CONFIG_HOME")};function yn(...e){return On.default.join(hn.default.homedir(),...e)}var sF=w(require("fs")),ke=w(require("path"));C();M();var Ct=w(require("path"));var Wh=[".openclaw",".clawdbot",".moltbot"];function XC(e,t){let n=Wh.find(r=>t(Ct.default.join(e,r)));return Ct.default.join(e,n??Wh[0],"skills")}function YC(e,t){return Wh.some(n=>t(Ct.default.join(e,n)))}function ZC(e,t,n=ce.appData(),r=ce.flatpakConfigHome()){return!!(t(Ct.default.join(e,"zed"))||n&&t(Ct.default.join(n,"Zed"))||r&&t(Ct.default.join(r,"zed")))}var VO="/Applications/ZCode.app";function QC(e,t){return t(Ct.default.join(e,".zcode"))||t(VO)}function eF(e,t){return t(Ct.default.join(e,"kimchi"))}var GO="/etc/codex";function tF(e,t){return t(e)||t(GO)}function nF(e,t){return t(Ct.default.join(e,".replit"))}function rF(e,t){return t(Ct.default.join(e,".promptscript"))||t(Ct.default.join(e,"promptscript.yaml"))}function oF(e,t,n){return n(Ct.default.join(t,"data","skills"))||n(Ct.default.join(e,".astrbot"))}function iF(){return!1}function KO(e){try{return sF.default.existsSync(e)}catch{return!1}}function fe(e,t,n){return{id:e,displayName:t,skillsDir:`${n}/skills`,globalSkillsDir:()=>yn(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:()=>yn(...e.global),detect:t=>t.pathExists(ke.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Qe=".agents/skills",dl=[fe("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"amp")),sharedStore:!0},ot({id:"antigravity",displayName:"Antigravity",project:Qe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),ot({id:"antigravity-cli",displayName:"Antigravity CLI",project:Qe,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>yn(".astrbot","data","skills"),detect:e=>oF(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>ke.default.join(ce.autohandHome(),"skills"),detect:e=>e.pathExists(ce.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(ce.claudeHome(),"skills"),detect:e=>e.pathExists(ce.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>XC(ce.home(),KO),detect:e=>YC(e.homeDir,e.pathExists),sharedStore:!1},ot({id:"cline",displayName:"Cline",project:Qe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),fe("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>yn(".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:Qe,globalSkillsDir:()=>ke.default.join(ce.codexHome(),"skills"),detect:e=>tF(ce.codexHome(),e.pathExists),sharedStore:!0},fe("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>yn(".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(ce.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(ke.default.join(ce.hardcodedConfigHome(),"crush")),sharedStore:!1},ot({id:"cursor",displayName:"Cursor",project:Qe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),ot({id:"deepagents",displayName:"Deep Agents",project:Qe,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>ke.default.join(ce.configHome(),"devin","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"devin")),sharedStore:!1},ot({id:"dexto",displayName:"Dexto",project:Qe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),fe("droid","Droid",".factory"),ot({id:"firebender",displayName:"Firebender",project:Qe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),fe("forgecode","ForgeCode",".forge"),ot({id:"gemini-cli",displayName:"Gemini CLI",project:Qe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),ot({id:"github-copilot",displayName:"GitHub Copilot",project:Qe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>ke.default.join(ce.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(ce.grokHome(),"skills"),detect:e=>e.pathExists(ce.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>ke.default.join(ce.hermesHome(),"skills"),detect:e=>e.pathExists(ce.hermesHome()),sharedStore:!1},fe("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>yn(".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(ce.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>eF(ce.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Qe,globalSkillsDir:()=>yn(".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:Qe,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(ce.vibeHome(),"skills"),detect:e=>e.pathExists(ce.vibeHome()),sharedStore:!1},fe("moxby","Moxby",".moxby"),fe("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.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:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:e=>nF(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:Qe,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:Qe,globalSkillsDir:()=>yn(".agents","skills"),detect:e=>ZC(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>yn(".zcode","skills"),detect:e=>QC(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:Qe,globalSkillsDir:()=>{},detect:e=>rF(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},fe("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:iF,sharedStore:!0,showInSharedList:!1}],Hh=new Map(dl.map(e=>[e.id,e])),Zo=dl.map(e=>e.id);function pl(e){return Hh.has(e)}function Ln(e){return Hh.get(e)}function md(e){let t=Hh.get(e);if(t)return t;throw new f(`${k} Unknown agent: ${D(e)}
255
- ${Zo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function gd(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function Nn(e){return dl.filter(t=>gd(t,e))}var Vh=w(require("path"));C();M();var hd=".agents",yd="skills";function it(e,t){let n=e==="global"?ce.home():t;return Vh.default.join(n,hd,yd)}function Nt(e,t,n){if(t==="global")return e.globalSkillsDir()??null;let r=Vh.default.resolve(n,...e.skillsDir.split("/"));return Ue(n,r,`${e.id} project skills directory`),r}function Gh(e,t,n){return Ye(Nt(e,t,n),it(t,n))}var Kh=w(require("fs")),aF=w(require("path"));function JO(e){try{return Kh.default.existsSync(e)}catch{return!1}}function zO(e){try{let t=JSON.parse(Kh.default.readFileSync(aF.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function lF(e){return{homeDir:ce.home(),configHome:ce.configHome(),cwd:e,pathExists:JO,readPackageJson:zO}}async function fl(e,t,n=lF(t)){return cF(Nn(e),n).map(r=>r.id)}function cF(e,t){return e.filter(n=>{try{return n.detect(t)}catch{return!1}})}var uF=w(require("fs")),dF=w(require("path"));C();be();Oe();A();M();var ml=[".git","package.json","webflow.json"];function gl(e){for(let t of ml)try{if(uF.default.existsSync(dF.default.join(e,t)))return t}catch{}return null}function hl(e){return gl(e)===null?"global":"project"}function pF(e){let t=gl(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${ml.join(", ")} found in this directory.`}async function wd(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=hl(t);return e.yes||V()?(u.info(pF(t)),n):Be({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();be();Oe();A();M();var yl="all",en="universal",qO=6,XO=20,YO=80;function Ss(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function ZO(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 gF(e){let t=e.toLowerCase(),n=Math.max(1,Math.floor(t.length/3)),r=null,o=Number.POSITIVE_INFINITY;for(let i of Zo){let s=ZO(t,i);s<o&&(o=s,r=i)}return o<=n?r:null}function xs(e){let t=e.filter(n=>!pl(n));if(t.length>0){let n=Array.from(new Set(t.map(o=>gF(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+` ${Zo.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(n=>Ln(n))}function Dd(e,t){return Nn(e).filter(n=>Gh(n,e,t))}function hF(e,t){return Dd(e,t).filter(n=>n.showInSharedList!==!1)}function yF(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 wF(e,t,n=qO){return yF(hF(e,t),n)}function fF(e,t){let n=process.stdout.columns??YO,r=Math.max(20,n-t);return e.length<=r?e:`${e.slice(0,r-1)}\u2026`}function QO(e,t,n){return t==="project"?e.skillsDir:Nt(e,t,n)??""}function bd(e,...t){let n=new Set(t.flat());return Nn(e).filter(r=>n.has(r.id))}async function mF(e,t,n){let r=Dd(e,t),o=new Set(r.map(d=>d.id)),i=Nn(e).filter(d=>!o.has(d.id)),s=new Set(n),a=wF(e,t),l=it(e,t),c=[];r.length>0&&c.push({value:"",name:fF(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let d of i){let m=QO(d,e,t),h=s.has(d.id)?" (detected)":"";c.push({value:d.id,name:fF(`${d.displayName} ${m}${h}`,8),checked:s.has(d.id)})}let p=await vn({message:r.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(XO,Math.max(4,c.length)),validate:d=>d.length>0||r.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return bd(e,r.map(d=>d.id),(p??[]).filter(Boolean))}async function wl(e){let{scope:t,cwd:n,options:r}=e,o=Ss(r.agent),i=r.allAgents===!0||o.includes(yl),s=o.filter(c=>c!==yl),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(p=>pl(p));return{agents:bd(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(p=>!pl(p))}}if(s.length>0&&!i){let c=xs(s),p=c.filter(d=>!gd(d,t));if(p.length>0){let d=p.map(m=>m.displayName).join(", ");throw new f(`${k} ${d} 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:bd(t,c.map(d=>d.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...Nn(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await fl(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=Ln(en);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await mF(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}return r.yes||V()?{agents:bd(t,Dd(t,n).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await mF(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}var EF=w(require("os")),Jr=w(require("path"));pe();M();var zr=1,eL=24,tL=100,vF=8,nL=5;function Qo(e,t={}){if(e==="")return"";let n=Jr.default.resolve(e),r=Jr.default.resolve(t.cwd??process.cwd()),o=Jr.default.resolve(t.home??EF.default.homedir()),i=bF(r,n);if(i!==null)return D(i===""?".":`.${Jr.default.sep}${i}`);let s=bF(o,n);return s!==null?D(s===""?"~":`~${Jr.default.sep}${s}`):D(n)}function kd(e={}){return t=>Qo(t,e)}function bF(e,t){let n=Jr.default.relative(e,t);return n===""?"":n.startsWith("..")||Jr.default.isAbsolute(n)?null:n}var DF={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function zh(e){let{plan:t,materialized:n,dryRun:r}=e,o=[],i=[];for(let h of t.skills){let g=DF[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=DF[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,p=0,d=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"&&(p+=1),g.symlinkFailed===!0&&(d+=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:p,symlinkFallbacks:d}}}function qh(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 ${rL(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(...oL(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 rL(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${SF(e.commit)}${t}`}function SF(e){return e.slice(0,vF)}function oL(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 ${bl(r)}`),o.length>0&&n.push(` symlink \u2192 ${kF(o,t)}`),i.length>0&&n.push(` copy \u2192 ${kF(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&n.push(` ${I("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&n.push(` overwrites ${s.label} ${I(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return n}function kF(e,t){if(e.length===1){let n=e[0];return`${n.label} (${t(n.path)})`}return bl(e)}function bl(e,t=nL){let n=e.map(r=>D(r.label));return n.length<=t?n.join(", "):`${n.slice(0,t).join(", ")} +${n.length-t} more`}function xF(e,t={}){let n=t.display??(i=>i),r=[],{summary:o}=e;r.push(J(`Installed ${o.installed} ${Jh(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: ${bl(s)}`),a.length>0&&r.push(` symlinked: ${bl(a)}`),l.length>0&&r.push(` copied: ${bl(l)}`),i.detail!==void 0&&r.push(` ${I(i.detail)}`)}if(o.symlinkFallbacks>0){let i=iL(e.materialized);r.push(`${le("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${Jh(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(...sL(e.blocked)),r.push(...aL(e.failures)),r.push(...Ed(e.plan.warnings)),r.join(`
260
- `)}function iL(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 sL(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 aL(e){if(e.length===0)return[];let t=["",Bt(`${e.length} ${Jh(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 Ed(e){return e.length===0?[]:["",...e.map(t=>`${le("\u26A0")} ${t}`)]}function Jh(e,t){return e===1?t:`${t}s`}function vd(e){let{plan:t}=e,n=new Map(e.materialized.map(r=>[r.name,r]));return{kind:"skills.install",schemaVersion:zr,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=>lL(r,n.get(r.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function lL(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=>cL(r,n.get(r.path)))}}function cL(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 ei=["name","dir","description","status","mode","agents","scope"],Dl="name,status,agents",Cs=["name","dir","status","scope"],uL={"up-to-date":J,modified:le,missing:Bt,unmanaged:I};function CF(e,t,n={}){let r=n.columns??process.stdout.columns??tL,o=e.map(l=>t.map(c=>dL(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((p,d,m)=>{if(m===i)return p;let h=Math.max(d.length,...o.map(g=>g[m].length),0);return p+h+2},0),c=Math.max(eL,r-l-2);for(let p of o)p[i]=fL(p[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((p,d)=>t[d]==="status"?uL[e[c].status](p):p));return qe(s,a)}function dL(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 pL(e);case"scope":return e.scope}}var FF="shared";function pL(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?[FF,...t].join(", "):t.join(", ")}function _F(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 I(`${FF}${i}, read directly by ${r.size} agent${r.size===1?"":"s"}:
261
- ${o}`)}function fL(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 ${SF(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${r} skills \u2014 ${n(a)}${s}`)}function Xh(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 RF(e){return{kind:"skills.list",schemaVersion:zr,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:Xh(e.inventories),warnings:[...e.warnings]}}var Yh="No skills installed. Run `webflow skills install` to get started.";function IF(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 TF(e){let t=[],{summary:n}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return Yh;if(e.source.upToDate)t.push(`${$} ${D(e.source.repo)}@${D(e.source.ref)} is still ${mL(e.source.resolvedCommit)} \u2014 all ${n.checked} skill${n.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${Ce} ${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("",qe(["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 mL(e){return e===null?"unknown":e.slice(0,vF)}function Zh(e,t,n={}){let r=i=>D((n.display??Qo)(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 PF(e,t={}){let n=o=>D((t.display??Qo)(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(`${Ce} ${n(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&r.push(`${Ce} ${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();be();Oe();A();M();X();be();A();function gL(e){let t=gl(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${ml.join(", ")} found in this directory.`}async function Sd(e,t,n){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(n||u.info(gL(t)),hl(t)):wd(e,t)}function Fs(e){return e==="locally-modified"||e==="unmanaged"}var ni=w(require("fs")),wn=w(require("path"));C();var ey=require("crypto"),_d=w(require("fs"));C();var ti=w(require("fs")),jn=w(require("path"));C();var Qh=2e3,OF=8;async function xd(e){let t=jn.default.resolve(e),n=[],r=[],o=async(i,s)=>{if(s>qo)throw new f(`Skill directory ${D(t)} nests deeper than ${qo} levels at ${D(i)}. Refusing to copy or hash a tree this deep.`);let a=await ti.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=jn.default.join(i,l.name);if(Ue(t,c,"a skill file"),l.isSymbolicLink()){r.push($F(t,c));continue}if(l.isDirectory()){if(Jo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||zo.has(l.name))continue;let p=await ti.default.promises.lstat(c);if(n.length>=Qh)throw new f(`Skill directory ${D(t)} contains more than ${Qh} files. Refusing to copy or hash it.`);let d=$F(t,c);n.push({rel:d,key:d.normalize("NFC"),abs:c,mode:p.mode&511,size:p.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 Cd(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 Fd(e,t){let n=jn.default.resolve(e),r=jn.default.resolve(t),o=await xd(n);Cd(n,o),await ti.default.promises.mkdir(r,{recursive:!0});let i=new Set;for(let a of o.files){let l=jn.default.dirname(jn.default.join(r,...a.rel.split("/")));l!==r&&i.add(l)}for(let a of[...i].sort())Ue(r,a,"a skill destination directory"),await ti.default.promises.mkdir(a,{recursive:!0});let s=0;return await hL(o.files,OF,async a=>{let l=jn.default.join(r,...a.rel.split("/"));Ue(r,l,"a skill destination file"),await ti.default.promises.copyFile(a.abs,l),await ti.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function $F(e,t){return jn.default.relative(e,t).split(jn.default.sep).join("/")}async function hL(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 NF=1024*1024,jF=4294967295,ty=Buffer.from([0]);async function Ad(e){let t=await xd(e);Cd(e,t);let n=(0,ey.createHash)("sha256"),r=(0,ey.createHash)("sha256"),o=0;for(let i of t.files)await yL(n,i),wL(r,i),o+=i.size;return{contentHash:`sha256:${n.digest("hex")}`,modeHash:`sha256:${r.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function tn(e){try{return await Ad(e)}catch(t){if(kL(t))return null;throw t}}function jt(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 yL(e,t){if(t.size<=NF){let o=await _d.default.promises.readFile(t.abs);return LF(e,t,o.length),e.update(o),o.length}let n=await bL(t.abs);LF(e,t,n);let r=await DL(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 LF(e,t,n){if(n>jF)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(ty);let r=Buffer.alloc(4);r.writeUInt32BE(n,0),e.update(r)}function wL(e,t){e.update(t.key,"utf8"),e.update(ty),e.update((t.mode&73)!==0?"x":"-"),e.update(ty)}async function bL(e){let t=0;for await(let n of _d.default.createReadStream(e))t+=n.length;return t}async function DL(e,t,n){let r=0;for await(let o of _d.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 kL(e){return qr(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:qr(e.cause)==="ENOENT"}function qr(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var UF=require("crypto"),Ie=w(require("fs")),Ee=w(require("path"));C();A();var EL=/\.[0-9a-f]{6}\.tmp$/,WF=3600*1e3;async function ry(e,t=n=>n){let n=Ee.default.join(e,hd);for(let r of[n,Ee.default.join(n,yd)]){if(await HF(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 Rd(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 Rd(e,t){if(!rt(e,t)||await oy(e,t)!==void 0)return!0;try{await Ie.default.promises.lstat(t)}catch{return!1}return!await Zu(e,t)}async function oy(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 Ie.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await Zu(n,i))return i}}async function Id(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 HF(i);if(a==="absent")return;if(a==="other")return i}}async function kl(e,t={}){if(t.dryRun)return[];let n=t.maxAgeMs??WF,r=t.now??Date.now(),o=[],i;try{i=await Ie.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!EL.test(s.name))continue;let a=Ee.default.join(e,s.name);try{Ue(e,a,"a stale staging directory");let l=await Ie.default.promises.lstat(a);if(r-l.mtimeMs<n)continue;await Ie.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 Td(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},p=y=>({...c,success:!1,link:o,error:y});if(Ee.default.basename(l)!==n)return p(`Refusing to write ${D(l)}: its final component is not "${D(n)}".`);let d=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 d(`it resolves outside ${D(r)}.`);let m=await oy(r,l);if(m!==void 0)return d(`${D(m)} is a symbolic link that leaves ${D(r)}.`);let h=await Id(r,l);if(h!==void 0)return p(`${D(h)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(Ye(t,l))return{...c,success:!0,link:"canonical"};let g=await xL(l,t);if(g&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!g){let[y,b]=await Promise.all([mn(t),mn(l)]);if(Ye(y,b))return{...c,success:!0,link:"canonical"};if(Ye(await BF(t),await BF(l)))return{...c,success:!0,link:"canonical"};if(await fh(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await MF(t,l,n),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:qr(y),error:ny(y)}}try{if(await CL(l,n),await Ie.default.promises.mkdir(Ee.default.dirname(l),{recursive:!0}),a==="win32")await Ie.default.promises.symlink(Ee.default.resolve(t),l,"junction");else{let y=await mn(Ee.default.dirname(l));await Ie.default.promises.symlink(Ee.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let b=qr(y);try{return await MF(t,l,n),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:b}}catch(S){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:qr(S)??b,error:ny(S)}}}}async function El(e,t,n={}){if(Ue(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(Fs(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 fh(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 vL(t),i="written")}catch(l){return{...r,storeAction:"failed",hashes:null,targets:[],success:!1,error:ny(l)}}let a=[];for(let l of t.targets)a.push(await SL(e,t,l,n));return{...r,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function vL(e){await Ie.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=sy(e.storePath);try{await Fd(e.sourceDir,t),await iy(e.storePath,e.dir),await Ie.default.promises.rename(t,e.storePath)}finally{await Ie.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return Ad(e.storePath)}async function SL(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}:Td({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 MF(e,t,n){await Ie.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let r=sy(t);try{await Fd(e,r),await iy(t,n),await Ie.default.promises.rename(r,t)}finally{await Ie.default.promises.rm(r,{recursive:!0,force:!0}).catch(()=>{})}}async function xL(e,t){let n;try{n=await Ie.default.promises.lstat(e)}catch{return!1}if(!n.isSymbolicLink())return!1;let r=await Ie.default.promises.readlink(e).catch(()=>null);if(r===null)return!1;let o=Ee.default.resolve(Ee.default.dirname(e),r);if(Ye(o,t))return!0;let[i,s]=await Promise.all([mn(o),mn(t)]);return Ye(i,s)}async function CL(e,t){let n;try{n=await Ie.default.promises.lstat(e)}catch(r){qr(r)==="ELOOP"&&await Ie.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(n.isSymbolicLink()){await Ie.default.promises.rm(e,{force:!0});return}await iy(e,t)}async function iy(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 Ie.default.promises.lstat(e)}catch{return}if(n.isSymbolicLink()){await Ie.default.promises.rm(e,{force:!0});return}await Ie.default.promises.rm(e,{recursive:!0,force:!0})}function sy(e){return`${e}.${(0,UF.randomBytes)(3).toString("hex")}.tmp`}async function BF(e){let t=Ee.default.resolve(e),n=await mn(Ee.default.dirname(t));return Ee.default.join(n,Ee.default.basename(t))}async function HF(e){let t;try{t=await Ie.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await Ie.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function ny(e){let t=e instanceof Error?e.message:String(e);return D(t)}var FL=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],_L=64;async function vl(e){let t=e.platform??process.platform,n=e.display??(c=>c),r=wn.default.resolve(e.root),o=it(e.scope,r),i=e.recorded??{},s=new Set(e.warnings??[]);await ry(r,n);let a=await AL({targets:e.targets,scope:e.scope,root:r,storeBase:o,display:n,warn:c=>s.add(c)});for(let c of await PL({groups:a,skills:e.skills,display:n}))s.add(c);let l=[];for(let c of e.skills)l.push(await TL({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 AL(e){let{targets:t,scope:n,root:r,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let p=Nt(c.agent,n,r);if(p===null){s(`${D(c.agent.displayName)} does not support ${n} installation and was skipped.`);continue}let d=a.get(p);d?(d.agents.push(c.agent),d.explicit=d.explicit||c.explicit):a.set(p,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,p]of a){let d=p.agents.slice().sort((g,y)=>g.id<y.id?-1:g.id>y.id?1:0);if(Ye(c,o)){l.push({dir:c,agents:d,canonical:!0});continue}if(await Rd(r,c)){let g=Pd(c),y=`${D(i(c))} resolves outside ${D(i(r))}`+(g?` (check $${g})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:d,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await Id(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:d,canonical:!1,skipReason:"path-conflict",detail:g});continue}if(!(p.explicit||await IL(p.agents,n,r,c))){l.push({dir:c,agents:d,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:d,canonical:!1})}return l}function RL(e,t,n,r){if(t==="global")return wn.default.dirname(r);let[o]=e.skillsDir.split(/[\\/]/);return wn.default.join(n,o??e.skillsDir)}async function IL(e,t,n,r){for(let o of e)if(await $L(RL(o,t,n,r)))return!0;return!1}async function TL(e){let{discovered:t,groups:n,storeBase:r,mode:o,force:i,platform:s,display:a}=e,l=wn.default.join(r,t.dir),c=await OL(t.path),p=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,d=e.recorded!==null&&p===null,m=await GF({dest:l,storePath:l,recorded:p,recordedUnverifiable:d,upstream:c,platform:s}),h=[];for(let S of n){let _=S.canonical?l:wn.default.join(S.dir,t.dir),v=S.canonical?"canonical":o;if(S.canonical||S.skipReason!==void 0){h.push({agent:KF(S),agents:S.agents.map(H=>H.id),label:JF(S),path:_,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 GF({dest:_,storePath:l,recorded:p,recordedUnverifiable:d,upstream:c,platform:s}),O=Fs(x.overwrite)&&!i;h.push({agent:KF(S),agents:S.agents.map(H=>H.id),label:JF(S),path:_,link:v,overwrite:x.overwrite,blocked:O,skipped:!1,...O?{detail:VF(x,_,a)}:{}})}let g=Fs(m.overwrite)&&!i,y=h.find(S=>S.blocked),b=g?VF(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:p,blocked:g||y!==void 0,...b!==void 0?{detail:b}:{}}}function VF(e,t,n){return e.problem===void 0?qF(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 GF(e){let{dest:t,storePath:n,recorded:r,upstream:o,platform:i}=e,s=(c,p,d)=>({overwrite:c,upToDate:p,onDisk:d,blocked:!1}),a;try{a=await ni.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await ni.default.promises.readlink(t).catch(()=>null),p=c===null?null:wn.default.resolve(wn.default.dirname(t),c);return p!==null&&Ye(p,n)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await tn(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 jt(l,r,i)?s("managed-update",jt(l,o,i),l):s("locally-modified",!1,l);if(jt(l,o,i)){let c=await zF(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 zF(e,t="",n=0){if(n>qo)return;let r;try{r=await ni.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(Jo.has(o.name))return i;let s=await zF(wn.default.join(e,o.name),i,n+1);if(s!==void 0)return s;continue}if(!o.isFile()||zo.has(o.name))return i}}function qF(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 PL(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 ni.default.promises.readdir(s.dir,{withFileTypes:!0})}catch{continue}a.sort((c,p)=>c.name<p.name?-1:c.name>p.name?1:0);let l=_L;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let p=wn.default.join(s.dir,c.name,Ot),d;try{d=Xo(await ni.default.promises.readFile(p,"utf8")).frontmatter.name}catch{continue}let m=o.get(d);m===void 0||m===c.name||i.push(`${D(r(s.dir))} already contains "${D(c.name)}", whose ${Ot} declares the name "${D(d)}" \u2014 the same skill this install writes to "${D(m)}". Your agent would load it twice; remove one of them.`)}}return i}function Pd(e){let t=wn.default.resolve(e);for(let n of FL){let r=process.env[n]?.trim();if(r&&rt(r,t))return n}}function KF(e){return e.agents[0]?.id??""}function JF(e){let t=e.agents.map(n=>n.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function $L(e){try{return await ni.default.promises.lstat(e),!0}catch{return!1}}async function OL(e){let t=await tn(e);if(t!==null)return t;throw new f(`The extracted skill directory ${D(e)} is no longer present. Re-run the command.`)}var Mt=1,e_=/^sha256:[0-9a-f]{64}$/,ay=128,ly=1024,XF=256,LL=/[\x00-\x1f\x7f]/;function t_(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>ay?`must be at most ${ay} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":fs(e)}function $d(e){return e.trim()===""?"must not be empty":e.length>ly?`must be at most ${ly} characters`:fs(e)}function YF(e){return(t,n)=>{let r=e(t);r!==null&&n.addIssue({code:j.ZodIssueCode.custom,message:r})}}var n_=j.string().regex(Zt,"must be a 40-character lowercase commit SHA"),r_=j.string().regex(td,"is not a usable git ref for this repository"),ZF=j.string().regex(e_,'must look like "sha256:<64 lowercase hex>"'),NL=j.string().min(1,"must not be empty").max(pd).refine(e=>e.trim()!=="","must not be blank").refine(e=>!LL.test(e),"must not contain control characters"),QF=j.string().datetime({offset:!0}),o_=j.object({commit:n_,dir:j.string().superRefine(YF(t_)),skillPath:j.string().superRefine(YF($d)).optional(),contentHash:ZF.optional(),modeHash:ZF.optional(),ref:r_.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:QF.optional(),updatedAt:QF.optional()}).passthrough(),i_=j.object({repo:j.string().min(1).max(XF).default(he),ref:r_.default(Ge),commit:n_.optional(),pluginVersion:j.string().min(1).max(XF).optional()}).passthrough(),s_=j.object({lockfileVersion:j.number().int().min(0),source:i_.default({}),skills:j.record(NL,o_).default({})}).passthrough();function a_(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 cy(e){let[t]=e.issues;return t?`${a_([...t.path])} ${t.message}`:"did not match the expected shape"}function Od(e){return s_.safeParse(e)}var Ld=w(require("path"));nc();C();var l_="webflow-skills-lock.json",c_="skills-lock.json";function ri(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 Ld.default.join(Ld.default.resolve(e),l_)}function oi(){return Ld.default.join(tc(),c_)}function Sl(e,t){return e==="global"?oi():ri(t??"")}var d_=w(require("fs"));var jL=/^<{7}/m,ML=/^\uFEFF/;async function Mn(e){let t;try{t=await d_.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:BL(c)}}let n=t.replace(ML,"");if(jL.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:UL(c,n)}}if(r===null||typeof r!="object"||Array.isArray(r))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${u_(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 ${u_(i)})`};let s=typeof i=="number"?i:0;if(s>Mt){let c=Od(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<Mt?{...o,lockfileVersion:Mt}:o,l=Od(a);return l.success?s<Mt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:cy(l.error)}}function BL(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 UL(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(`
256
+ This is a bug in ${ye}. Please report it.`)}function by(e){return XF(e,t=>t.name)}function ky(e){let[t,...r]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${b(e.value)}": ${e.skills.map(n=>b(n.skillPath)).join(", ")}. Using ${b(t?.skillPath??"")} and ignoring ${r.length===1?"the other":"the others"}. This is a bug in ${ye}. Please report it.`}function XF(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 Ps=w(require("fs")),rr=w(require("path"));C();async function $s(e,t){Me(t,e,"the catalog skills directory");let r=[],n=[],o=[],i=new Set,s=f=>(o.push(...f.warnings),f.kind==="skipped"?(n.push({skillPath:f.skillPath,reason:f.reason}),!1):(r.push(f.skill),!f.skill.internal));for(let f of await El(e,"the catalog skills directory")){if(Dl.has(f.name))continue;let m=rr.default.join(e,f.name);if(!await Dy(m,f))continue;let g=await QF(m);if(g.kind!=="none"&&i.add(g.path),!(g.kind!=="none"&&s(await ZF({skillDir:m,manifest:g,extractRoot:t}))))for(let h of await El(m)){if(Dl.has(h.name))continue;let y=rr.default.join(m,h.name);if(!await Dy(y,h))continue;let k=await QF(y);k.kind!=="none"&&(i.add(k.path),s(await ZF({skillDir:y,manifest:k,extractRoot:t,parentCategory:f.name})))}}let a=await fN(r),l=by(a),c=new Set;for(let f of l){o.push(ky(f));for(let m of f.skills.slice(1))c.add(m.skillPath)}let p=a.filter(f=>!c.has(f.skillPath));wy(p),o.push(...await mN(e,t,i));for(let f of n)o.push(`Skipped ${f.skillPath} \u2014 ${f.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 ${ye} \u2014 please report ${n.length===1?"it":"them"} at ${Xo}.`),{skills:p,skipped:n,warnings:o}}async function ZF(e){let{skillDir:t,manifest:r,extractRoot:n,parentCategory:o}=e,i=r_(n,r.path),s=[],a=h=>({kind:"skipped",skillPath:i,reason:b(h),warnings:s});if(r.kind==="symlink")return a(`${Lt} is a symbolic link; skill files must be regular files`);let l;try{l=await Ps.default.promises.readFile(r.path,"utf8")}catch(h){return a(`failed to read file: ${h instanceof Error?h.message:String(h)}`)}let c;try{c=ti(l).frontmatter}catch(h){if(h instanceof Nt)return a(h.reason);throw h}let p=b(c.name),f=b(c.description);if(p==="")return a(`frontmatter name "${b(c.name)}" cannot be used as a directory name`);let m=Ts(p);if(m===void 0)return a(`frontmatter name "${p}" cannot be used as a directory name`);yy(p)||s.push(`${i} declares a non-standard skill name "${p}"; it installs as "${m}". This is a bug in ${ye}.`);let g=await pN(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 ${Rd} files; only the first ${Rd} are listed.`),{kind:"skill",warnings:s,skill:{name:p,dir:m,folderName:Zn(i),description:f,category:gy(c)??o,internal:my(c),path:t,skillPath:i,supplementaryFiles:g.files}})}async function QF(e){let t=rr.default.join(e,Lt),r=await e_(t);if(r)return r;let n=Lt.toLowerCase();for(let o of await El(e)){if(o.name===Lt||o.name.toLowerCase()!==n)continue;let i=await e_(rr.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function e_(e){try{let t=await Ps.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function Dy(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await Ps.default.promises.stat(e)).isDirectory()}catch{return!1}}async function El(e,t){try{return(await Ps.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 d(`Failed to read ${t} (${b(e)}): ${r instanceof Error?r.message:String(r)}`)}}async function pN(e,t){let r=[],n,o=!1,i=async(s,a)=>{if(!(a>ei||n!==void 0))for(let l of await El(s)){if(n!==void 0)return;let c=rr.default.join(s,l.name);if(l.isSymbolicLink()){n=t_(e,c);return}if(l.isDirectory()){if(Zo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!Qo.has(l.name)&&c!==t){if(r.length>=Rd){o=!0;return}r.push(t_(e,c))}}};return await i(e,1),{files:r.sort(),symlink:n,truncated:o}}async function fN(e){let t=new Set,r=[];for(let n of e){let o;try{o=await Ps.default.promises.realpath(n.path)}catch{o=rr.default.resolve(n.path)}t.has(o)||(t.add(o),r.push(n))}return r}async function mN(e,t,r){let n=[],o=HF,i=async(s,a)=>{if(!(a>VF||o<=0)){o-=1;for(let l of await El(s)){if(Dl.has(l.name))continue;let c=rr.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Lt.toLowerCase()){r.has(c)||n.push(r_(t,c));continue}await Dy(c,l)&&await i(c,a+1)}}};return await i(e,1),n.length===0?[]:[`${n.length} ${Lt} file(s) in the catalog sit outside the layout this CLI reads (for example ${n[0]}) and were ignored. ${ye} may have changed its layout; please report it at ${Xo}.`]}function r_(e,t){return rr.default.relative(e,t).split(rr.default.sep).join("/")}function t_(e,t){return rr.default.relative(e,t).split(rr.default.sep).join("/")}var br=w(require("os")),Mr=w(require("path"));function ri(e,t){let r=process.env[e]?.trim();return r||t}function n_(e){let t=process.env[e]?.trim();return t||void 0}var de={home:()=>br.default.homedir(),configHome:()=>ri("XDG_CONFIG_HOME",Mr.default.join(br.default.homedir(),".config")),hardcodedConfigHome:()=>Mr.default.join(br.default.homedir(),".config"),claudeHome:()=>ri("CLAUDE_CONFIG_DIR",Mr.default.join(br.default.homedir(),".claude")),codexHome:()=>ri("CODEX_HOME",Mr.default.join(br.default.homedir(),".codex")),vibeHome:()=>ri("VIBE_HOME",Mr.default.join(br.default.homedir(),".vibe")),hermesHome:()=>ri("HERMES_HOME",Mr.default.join(br.default.homedir(),".hermes")),autohandHome:()=>ri("AUTOHAND_HOME",Mr.default.join(br.default.homedir(),".autohand")),grokHome:()=>ri("GROK_HOME",Mr.default.join(br.default.homedir(),".grok")),appData:()=>n_("APPDATA"),flatpakConfigHome:()=>n_("FLATPAK_XDG_CONFIG_HOME")};function kr(...e){return Mr.default.join(br.default.homedir(),...e)}var m_=w(require("fs")),De=w(require("path"));C();j();var Ct=w(require("path"));var Ey=[".openclaw",".clawdbot",".moltbot"];function o_(e,t){let r=Ey.find(n=>t(Ct.default.join(e,n)));return Ct.default.join(e,r??Ey[0],"skills")}function i_(e,t){return Ey.some(r=>t(Ct.default.join(e,r)))}function s_(e,t,r=de.appData(),n=de.flatpakConfigHome()){return!!(t(Ct.default.join(e,"zed"))||r&&t(Ct.default.join(r,"Zed"))||n&&t(Ct.default.join(n,"zed")))}var hN="/Applications/ZCode.app";function a_(e,t){return t(Ct.default.join(e,".zcode"))||t(hN)}function l_(e,t){return t(Ct.default.join(e,"kimchi"))}var yN="/etc/codex";function c_(e,t){return t(e)||t(yN)}function u_(e,t){return t(Ct.default.join(e,".replit"))}function d_(e,t){return t(Ct.default.join(e,".promptscript"))||t(Ct.default.join(e,"promptscript.yaml"))}function p_(e,t,r){return r(Ct.default.join(t,"data","skills"))||r(Ct.default.join(e,".astrbot"))}function f_(){return!1}function wN(e){try{return m_.default.existsSync(e)}catch{return!1}}function ge(e,t,r){return{id:e,displayName:t,skillsDir:`${r}/skills`,globalSkillsDir:()=>kr(r,"skills"),detect:n=>n.pathExists(De.default.join(n.homeDir,r)),sharedStore:!1}}function it(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>kr(...e.global),detect:t=>t.pathExists(De.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Qe=".agents/skills",vl=[ge("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"amp")),sharedStore:!0},it({id:"antigravity",displayName:"Antigravity",project:Qe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),it({id:"antigravity-cli",displayName:"Antigravity CLI",project:Qe,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>kr(".astrbot","data","skills"),detect:e=>p_(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>De.default.join(de.autohandHome(),"skills"),detect:e=>e.pathExists(de.autohandHome()),sharedStore:!1},ge("augment","Augment",".augment"),ge("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>De.default.join(de.claudeHome(),"skills"),detect:e=>e.pathExists(de.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>o_(de.home(),wN),detect:e=>i_(e.homeDir,e.pathExists),sharedStore:!1},it({id:"cline",displayName:"Cline",project:Qe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),ge("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>kr(".codebuddy","skills"),detect:e=>e.pathExists(De.default.join(e.cwd,".codebuddy"))||e.pathExists(De.default.join(e.homeDir,".codebuddy")),sharedStore:!1},ge("codemaker","Codemaker",".codemaker"),ge("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.codexHome(),"skills"),detect:e=>c_(de.codexHome(),e.pathExists),sharedStore:!0},ge("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>kr(".continue","skills"),detect:e=>e.pathExists(De.default.join(e.cwd,".continue"))||e.pathExists(De.default.join(e.homeDir,".continue")),sharedStore:!1},it({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>De.default.join(de.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(De.default.join(de.hardcodedConfigHome(),"crush")),sharedStore:!1},it({id:"cursor",displayName:"Cursor",project:Qe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),it({id:"deepagents",displayName:"Deep Agents",project:Qe,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>De.default.join(de.configHome(),"devin","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"devin")),sharedStore:!1},it({id:"dexto",displayName:"Dexto",project:Qe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),ge("droid","Droid",".factory"),it({id:"firebender",displayName:"Firebender",project:Qe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),ge("forgecode","ForgeCode",".forge"),it({id:"gemini-cli",displayName:"Gemini CLI",project:Qe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),it({id:"github-copilot",displayName:"GitHub Copilot",project:Qe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>De.default.join(de.configHome(),"goose","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>De.default.join(de.grokHome(),"skills"),detect:e=>e.pathExists(de.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>De.default.join(de.hermesHome(),"skills"),detect:e=>e.pathExists(de.hermesHome()),sharedStore:!1},ge("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>kr(".jazz","skills"),detect:e=>e.pathExists(De.default.join(e.homeDir,".jazz"))||e.pathExists(De.default.join(e.cwd,".jazz")),sharedStore:!1},ge("junie","Junie",".junie"),ge("iflow-cli","iFlow CLI",".iflow"),ge("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>De.default.join(de.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>l_(de.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Qe,globalSkillsDir:()=>kr(".agents","skills"),detect:e=>e.pathExists(De.default.join(e.homeDir,".kimi-code"))||e.pathExists(De.default.join(e.homeDir,".kimi")),sharedStore:!0},ge("kiro-cli","Kiro CLI",".kiro"),ge("kode","Kode",".kode"),ge("lingma","Lingma",".lingma"),it({id:"loaf",displayName:"Loaf",project:Qe,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),ge("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>De.default.join(de.vibeHome(),"skills"),detect:e=>e.pathExists(de.vibeHome()),sharedStore:!1},ge("moxby","Moxby",".moxby"),ge("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"opencode","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"opencode")),sharedStore:!0},ge("openhands","OpenHands",".openhands"),ge("ona","Ona",".ona"),it({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),ge("qoder","Qoder",".qoder"),it({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),ge("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:e=>u_(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},ge("reasonix","Reasonix",".reasonix"),ge("rovodev","Rovo Dev",".rovodev"),ge("roo","Roo Code",".roo"),it({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),ge("terramind","Terramind",".terramind"),ge("tinycloud","Tinycloud",".tinycloud"),ge("trae","Trae",".trae"),it({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),it({id:"warp",displayName:"Warp",project:Qe,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),it({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Qe,globalSkillsDir:()=>kr(".agents","skills"),detect:e=>s_(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>kr(".zcode","skills"),detect:e=>a_(e.homeDir,e.pathExists),sharedStore:!1},ge("zencoder","Zencoder",".zencoder"),ge("zenflow","Zenflow",".zencoder"),ge("neovate","Neovate",".neovate"),ge("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Qe,globalSkillsDir:()=>{},detect:e=>d_(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},ge("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:f_,sharedStore:!0,showInSharedList:!1}],vy=new Map(vl.map(e=>[e.id,e])),ni=vl.map(e=>e.id);function Sl(e){return vy.has(e)}function Br(e){return vy.get(e)}function Pd(e){let t=vy.get(e);if(t)return t;throw new d(`${D} Unknown agent: ${b(e)}
257
+ ${ni.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function $d(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function Ur(e){return vl.filter(t=>$d(t,e))}var Sy=w(require("path"));C();j();var Od=".agents",Ld="skills";function st(e,t){let r=e==="global"?de.home():t;return Sy.default.join(r,Od,Ld)}function jt(e,t,r){if(t==="global")return e.globalSkillsDir()??null;let n=Sy.default.resolve(r,...e.skillsDir.split("/"));return Me(r,n,`${e.id} project skills directory`),n}function xy(e,t,r){return Ye(jt(e,t,r),st(t,r))}var Cy=w(require("fs")),g_=w(require("path"));function bN(e){try{return Cy.default.existsSync(e)}catch{return!1}}function kN(e){try{let t=JSON.parse(Cy.default.readFileSync(g_.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function h_(e){return{homeDir:de.home(),configHome:de.configHome(),cwd:e,pathExists:bN,readPackageJson:kN}}async function xl(e,t,r=h_(t)){return y_(Ur(e),r).map(n=>n.id)}function y_(e,t){return e.filter(r=>{try{return r.detect(t)}catch{return!1}})}var w_=w(require("fs")),b_=w(require("path"));C();we();Oe();R();j();var Cl=[".git","package.json","webflow.json"];function Fl(e){for(let t of Cl)try{if(w_.default.existsSync(b_.default.join(e,t)))return t}catch{}return null}function _l(e){return Fl(e)===null?"global":"project"}function k_(e){let t=Fl(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${Cl.join(", ")} found in this directory.`}async function Nd(e,t){if(e.global&&e.project)throw new d(`${D} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let r=_l(t);return e.yes||V()?(u.info(k_(t)),r):je({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"}]})}C();we();Oe();R();j();var Al="all",nr="universal",DN=6,EN=20,vN=80;function Os(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function SN(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 v_(e){let t=e.toLowerCase(),r=Math.max(1,Math.floor(t.length/3)),n=null,o=Number.POSITIVE_INFINITY;for(let i of ni){let s=SN(t,i);s<o&&(o=s,n=i)}return o<=r?n:null}function Ls(e){let t=e.filter(r=>!Sl(r));if(t.length>0){let r=Array.from(new Set(t.map(o=>v_(o)).filter(o=>o!==null))),n=r.length>0?` Did you mean: ${r.join(", ")}?
258
+ `:"";throw new d(`${D} Unknown agent(s): ${t.map(o=>b(o)).join(", ")}
259
+ `+n+` ${ni.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(r=>Br(r))}function Md(e,t){return Ur(e).filter(r=>xy(r,e,t))}function S_(e,t){return Md(e,t).filter(r=>r.showInSharedList!==!1)}function x_(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 C_(e,t,r=DN){return x_(S_(e,t),r)}function D_(e,t){let r=process.stdout.columns??vN,n=Math.max(20,r-t);return e.length<=n?e:`${e.slice(0,n-1)}\u2026`}function xN(e,t,r){return t==="project"?e.skillsDir:jt(e,t,r)??""}function jd(e,...t){let r=new Set(t.flat());return Ur(e).filter(n=>r.has(n.id))}async function E_(e,t,r){let n=Md(e,t),o=new Set(n.map(f=>f.id)),i=Ur(e).filter(f=>!o.has(f.id)),s=new Set(r),a=C_(e,t),l=st(e,t),c=[];n.length>0&&c.push({value:"",name:D_(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let f of i){let m=xN(f,e,t),g=s.has(f.id)?" (detected)":"";c.push({value:f.id,name:D_(`${f.displayName} ${m}${g}`,8),checked:s.has(f.id)})}let p=await Cr({message:n.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(EN,Math.max(4,c.length)),validate:f=>f.length>0||n.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return jd(e,n.map(f=>f.id),(p??[]).filter(Boolean))}async function Rl(e){let{scope:t,cwd:r,options:n}=e,o=Os(n.agent),i=n.allAgents===!0||o.includes(Al),s=o.filter(c=>c!==Al),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(p=>Sl(p));return{agents:jd(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(p=>!Sl(p))}}if(s.length>0&&!i){let c=Ls(s),p=c.filter(f=>!$d(f,t));if(p.length>0){let f=p.map(m=>m.displayName).join(", ");throw new d(`${D} ${f} does not support global skill installation \u2014 its skills live inside a project.
260
+ Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:jd(t,c.map(f=>f.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...Ur(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await xl(t,r);if(l.length===0){if(V()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${st(t,r)}).`);let c=Br(nr);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await E_(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}return n.yes||V()?{agents:jd(t,Md(t,r).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await E_(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}var R_=w(require("os")),Qn=w(require("path"));me();j();var eo=1,CN=24,FN=100,I_=8,_N=5;function oi(e,t={}){if(e==="")return"";let r=Qn.default.resolve(e),n=Qn.default.resolve(t.cwd??process.cwd()),o=Qn.default.resolve(t.home??R_.default.homedir()),i=F_(n,r);if(i!==null)return b(i===""?".":`.${Qn.default.sep}${i}`);let s=F_(o,r);return s!==null?b(s===""?"~":`~${Qn.default.sep}${s}`):b(r)}function Bd(e={}){return t=>oi(t,e)}function F_(e,t){let r=Qn.default.relative(e,t);return r===""?"":r.startsWith("..")||Qn.default.isAbsolute(r)?null:r}var __={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function _y(e){let{plan:t,materialized:r,dryRun:n}=e,o=[],i=[];for(let g of t.skills){let h=__[g.storeOverwrite];h!==void 0&&!t.force&&o.push({name:g.name,dir:g.dir,overwrite:g.storeOverwrite,reason:h,requiredFlag:"--force",...g.detail!==void 0?{detail:g.detail}:{}});for(let y of g.targets){if(!y.blocked)continue;let k=__[y.overwrite];k!==void 0&&o.push({name:g.name,dir:g.dir,agent:y.agent,overwrite:y.overwrite,reason:k,requiredFlag:"--force",...y.detail!==void 0?{detail:y.detail}:{}})}}let s=new Map;for(let g of t.skills)for(let h of g.targets){if(!h.blocked)continue;let y=s.get(g.name)??new Set;y.add(h.path),s.set(g.name,y)}let a=0,l=0,c=0,p=0,f=0,m=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 h of g.targets){if(h.skipped===!0){m+=1;continue}if(!h.success){if(s.get(g.name)?.has(h.path))continue;i.push({name:g.name,agent:h.agent,...h.errno!==void 0?{errno:h.errno}:{},message:h.error??"the destination could not be written"});continue}h.link==="symlink"&&(c+=1),h.link==="copy"&&h.requestedMode==="copy"&&(p+=1),h.symlinkFailed===!0&&(f+=1)}}}return n&&(m=t.skills.reduce((g,h)=>g+h.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:p,symlinkFallbacks:f}}}function Ay(e,t){let r=t.display??(o=>o),n=[];n.push(se(t.dryRun?"Installation plan (dry run)":"Installation plan")),n.push(` scope ${e.scope} (${r(e.root)})`),n.push(` source ${AN(e.source)}`),n.push(` store ${r(e.storeBase)}`),n.push(` mode ${e.mode}`);for(let o of e.skills)n.push(""),n.push(` ${b(o.dir)}`),n.push(` store ${r(o.storePath)}`),n.push(...RN(o,r)),o.blocked&&o.detail!==void 0&&n.push(` ${ue("blocked")} ${o.detail}`);if(e.warnings.length>0){n.push("");for(let o of e.warnings)n.push(` ${ue("\u26A0")} ${o}`)}return n.join(`
261
+ `)}function AN(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${T_(e.commit)}${t}`}function T_(e){return e.slice(0,I_)}function RN(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 ${Il(n)}`),o.length>0&&r.push(` symlink \u2192 ${A_(o,t)}`),i.length>0&&r.push(` copy \u2192 ${A_(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&r.push(` ${P("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&r.push(` overwrites ${s.label} ${P(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return r}function A_(e,t){if(e.length===1){let r=e[0];return`${r.label} (${t(r.path)})`}return Il(e)}function Il(e,t=_N){let r=e.map(n=>b(n.label));return r.length<=t?r.join(", "):`${r.slice(0,t).join(", ")} +${r.length-t} more`}function P_(e,t={}){let r=t.display??(i=>i),n=[],{summary:o}=e;n.push(z(`Installed ${o.installed} ${Fy(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;n.push(` ${b(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: ${Il(s)}`),a.length>0&&n.push(` symlinked: ${Il(a)}`),l.length>0&&n.push(` copied: ${Il(l)}`),i.detail!==void 0&&n.push(` ${P(i.detail)}`)}if(o.symlinkFallbacks>0){let i=IN(e.materialized);n.push(`${ue("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${Fy(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(...TN(e.blocked)),n.push(...PN(e.failures)),n.push(...Ud(e.plan.warnings)),n.join(`
262
+ `)}function IN(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 TN(e){if(e.length===0)return[];let t=["",ue(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":b(r.agent);t.push(` \u2022 ${b(r.name)} (${n})`),r.detail!==void 0&&t.push(` ${r.detail}`)}return t}function PN(e){if(e.length===0)return[];let t=["",Ut(`${e.length} ${Fy(e.length,"failure")}:`)];for(let r of e){let n=r.agent===void 0?"":` (${b(r.agent)})`;t.push(` \u2022 ${b(r.name)}${n}: ${b(r.message)}`)}return t}function Ud(e){return e.length===0?[]:["",...e.map(t=>`${ue("\u26A0")} ${t}`)]}function Fy(e,t){return e===1?t:`${t}s`}function Wd(e){let{plan:t}=e,r=new Map(e.materialized.map(n=>[n.name,n]));return{kind:"skills.install",schemaVersion:eo,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=>$N(n,r.get(n.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function $N(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=>ON(n,r.get(n.path)))}}function ON(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 ii=["name","dir","description","status","mode","agents","scope"],Tl="name,status,agents",Ns=["name","dir","status","scope"],LN={"up-to-date":z,modified:ue,missing:Ut,unmanaged:P};function $_(e,t,r={}){let n=r.columns??process.stdout.columns??FN,o=e.map(l=>t.map(c=>NN(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((p,f,m)=>{if(m===i)return p;let g=Math.max(f.length,...o.map(h=>h[m].length),0);return p+g+2},0),c=Math.max(CN,n-l-2);for(let p of o)p[i]=MN(p[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((p,f)=>t[f]==="status"?LN[e[c].status](p):p));return ze(s,a)}function NN(e,t){switch(t){case"name":return b(e.name);case"dir":return b(e.dir);case"description":return b(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return jN(e);case"scope":return e.scope}}var O_="shared";function jN(e){let t=[],r=0;for(let n of e.agents){let o=b(n.id);if(!n.present){t.push(`${o} (missing)`);continue}if(n.link==="canonical"){r+=1;continue}t.push(o)}return r>0?[O_,...t].join(", "):t.join(", ")}function L_(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 P(`${O_}${i}, read directly by ${n.size} agent${n.size===1?"":"s"}:
263
+ ${o}`)}function MN(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function N_(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 ${T_(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${n} skills \u2014 ${r(a)}${s}`)}function Ry(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 j_(e){return{kind:"skills.list",schemaVersion:eo,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:Ry(e.inventories),warnings:[...e.warnings]}}var Iy="No skills installed. Run `webflow skills install` to get started.";function M_(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 B_(e){let t=[],{summary:r}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return Iy;if(e.source.upToDate)t.push(`${$} ${b(e.source.repo)}@${b(e.source.ref)} is still ${BN(e.source.resolvedCommit)} \u2014 all ${r.checked} skill${r.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${xe} ${r.outdated+r.conflicts} of ${r.checked} skills would change.`:`${$} 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=>[b(o.dir),o.action,o.detail?b(o.detail):""]);n.length>0&&t.push("",ze(["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"} ${b(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${b(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${D} ${b(o.name)}: ${b(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
264
+ `)}function BN(e){return e===null?"unknown":e.slice(0,I_)}function Ty(e,t,r={}){let n=i=>b((r.display??oi)(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(` ${b(i.name)} \u2192 ${b(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=>b(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${n(s.path)} ${b(s.label)} (unlink)`)}return r.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
265
+ `)}function U_(e,t={}){let r=o=>b((t.display??oi)(o));if(e.skills.length===0)return"No skills removed.";let n=[];n.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=>b(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";n.push(` ${b(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(`${D} ${b(o.name)}: ${b(o.message)}`);return e.lockfileDeleted?n.push(`${xe} ${r(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&n.push(`${xe} ${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(`
266
+ `)}Y();C();we();Oe();R();j();Z();we();R();function UN(e){let t=Fl(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${Cl.join(", ")} found in this directory.`}async function Hd(e,t,r){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(r||u.info(UN(t)),_l(t)):Nd(e,t)}function js(e){return e==="locally-modified"||e==="unmanaged"}var ai=w(require("fs")),Dr=w(require("path"));C();var $y=require("crypto"),Jd=w(require("fs"));C();var si=w(require("fs")),Wr=w(require("path"));C();var Py=2e3,H_=8;async function Vd(e){let t=Wr.default.resolve(e),r=[],n=[],o=async(i,s)=>{if(s>ei)throw new d(`Skill directory ${b(t)} nests deeper than ${ei} levels at ${b(i)}. Refusing to copy or hash a tree this deep.`);let a=await si.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=Wr.default.join(i,l.name);if(Me(t,c,"a skill file"),l.isSymbolicLink()){n.push(W_(t,c));continue}if(l.isDirectory()){if(Zo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||Qo.has(l.name))continue;let p=await si.default.promises.lstat(c);if(r.length>=Py)throw new d(`Skill directory ${b(t)} contains more than ${Py} files. Refusing to copy or hash it.`);let f=W_(t,c);r.push({rel:f,key:f.normalize("NFC"),abs:c,mode:p.mode&511,size:p.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 Gd(e,t){let[r]=t.symlinks;if(r!==void 0)throw new d(`Skill directory ${b(e)} contains a symbolic link ("${b(r)}"); skill files must be regular files. If this came from ${ye}, please report it.`)}async function Kd(e,t){let r=Wr.default.resolve(e),n=Wr.default.resolve(t),o=await Vd(r);Gd(r,o),await si.default.promises.mkdir(n,{recursive:!0});let i=new Set;for(let a of o.files){let l=Wr.default.dirname(Wr.default.join(n,...a.rel.split("/")));l!==n&&i.add(l)}for(let a of[...i].sort())Me(n,a,"a skill destination directory"),await si.default.promises.mkdir(a,{recursive:!0});let s=0;return await WN(o.files,H_,async a=>{let l=Wr.default.join(n,...a.rel.split("/"));Me(n,l,"a skill destination file"),await si.default.promises.copyFile(a.abs,l),await si.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function W_(e,t){return Wr.default.relative(e,t).split(Wr.default.sep).join("/")}async function WN(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 G_=1024*1024,K_=4294967295,Oy=Buffer.from([0]);async function zd(e){let t=await Vd(e);Gd(e,t);let r=(0,$y.createHash)("sha256"),n=(0,$y.createHash)("sha256"),o=0;for(let i of t.files)await HN(r,i),VN(n,i),o+=i.size;return{contentHash:`sha256:${r.digest("hex")}`,modeHash:`sha256:${n.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function or(e){try{return await zd(e)}catch(t){if(JN(t))return null;throw t}}function Mt(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 HN(e,t){if(t.size<=G_){let o=await Jd.default.promises.readFile(t.abs);return V_(e,t,o.length),e.update(o),o.length}let r=await GN(t.abs);V_(e,t,r);let n=await KN(e,t.abs,r);if(n!==r)throw new d(`${b(t.abs)} changed while it was being hashed (${r} bytes, then ${n}). Re-run the command.`);return n}function V_(e,t,r){if(r>K_)throw new d(`${b(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(Oy);let n=Buffer.alloc(4);n.writeUInt32BE(r,0),e.update(n)}function VN(e,t){e.update(t.key,"utf8"),e.update(Oy),e.update((t.mode&73)!==0?"x":"-"),e.update(Oy)}async function GN(e){let t=0;for await(let r of Jd.default.createReadStream(e))t+=r.length;return t}async function KN(e,t,r){let n=0;for await(let o of Jd.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 JN(e){return to(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:to(e.cause)==="ENOENT"}function to(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var q_=require("crypto"),Re=w(require("fs")),Ee=w(require("path"));C();R();var zN=/\.[0-9a-f]{6}\.tmp$/,Y_=3600*1e3;async function Ny(e,t=r=>r){let r=Ee.default.join(e,Od);for(let n of[r,Ee.default.join(r,Ld)]){if(await X_(n)==="other")throw new d(`${b(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 qd(e,n))throw new d(`${b(t(n))} resolves outside ${b(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 qd(e,t){if(!ot(e,t)||await jy(e,t)!==void 0)return!0;try{await Re.default.promises.lstat(t)}catch{return!1}return!await yd(e,t)}async function jy(e,t){let r=Ee.default.resolve(e),n=Ee.default.relative(r,Ee.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(Ee.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a;try{a=await Re.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await yd(r,i))return i}}async function Yd(e,t){let r=Ee.default.resolve(e),n=Ee.default.relative(r,Ee.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(Ee.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a=await X_(i);if(a==="absent")return;if(a==="other")return i}}async function Pl(e,t={}){if(t.dryRun)return[];let r=t.maxAgeMs??Y_,n=t.now??Date.now(),o=[],i;try{i=await Re.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!zN.test(s.name))continue;let a=Ee.default.join(e,s.name);try{Me(e,a,"a stale staging directory");let l=await Re.default.promises.lstat(a);if(n-l.mtimeMs<r)continue;await Re.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 Xd(e){let{storeDir:t,slug:r,root:n,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},p=y=>({...c,success:!1,link:o,error:y});if(Ee.default.basename(l)!==r)return p(`Refusing to write ${b(l)}: its final component is not "${b(r)}".`);let f=y=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${b(l)} for ${b(s)}: ${y}`});if(!ot(n,l))return f(`it resolves outside ${b(n)}.`);let m=await jy(n,l);if(m!==void 0)return f(`${b(m)} is a symbolic link that leaves ${b(n)}.`);let g=await Yd(n,l);if(g!==void 0)return p(`${b(g)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(Ye(t,l))return{...c,success:!0,link:"canonical"};let h=await XN(l,t);if(h&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!h){let[y,k]=await Promise.all([yr(t),yr(l)]);if(Ye(y,k))return{...c,success:!0,link:"canonical"};if(Ye(await z_(t),await z_(l)))return{...c,success:!0,link:"canonical"};if(await Jh(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await J_(t,l,r),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:to(y),error:Ly(y)}}try{if(await ZN(l,r),await Re.default.promises.mkdir(Ee.default.dirname(l),{recursive:!0}),a==="win32")await Re.default.promises.symlink(Ee.default.resolve(t),l,"junction");else{let y=await yr(Ee.default.dirname(l));await Re.default.promises.symlink(Ee.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let k=to(y);try{return await J_(t,l,r),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:k}}catch(v){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:to(v)??k,error:Ly(v)}}}}async function $l(e,t,r={}){if(Me(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),Ee.default.basename(t.storePath)!==t.dir)throw new d(`Refusing to write ${b(t.storePath)}: its final component is not "${b(t.dir)}". Please report this.`);let n={name:t.name,dir:t.dir,storePath:t.storePath};if(js(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 Jh(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 qN(t),i="written")}catch(l){return{...n,storeAction:"failed",hashes:null,targets:[],success:!1,error:Ly(l)}}let a=[];for(let l of t.targets)a.push(await YN(e,t,l,r));return{...n,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function qN(e){await Re.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=By(e.storePath);try{await Kd(e.sourceDir,t),await My(e.storePath,e.dir),await Re.default.promises.rename(t,e.storePath)}finally{await Re.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return zd(e.storePath)}async function YN(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}:Xd({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 J_(e,t,r){await Re.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let n=By(t);try{await Kd(e,n),await My(t,r),await Re.default.promises.rename(n,t)}finally{await Re.default.promises.rm(n,{recursive:!0,force:!0}).catch(()=>{})}}async function XN(e,t){let r;try{r=await Re.default.promises.lstat(e)}catch{return!1}if(!r.isSymbolicLink())return!1;let n=await Re.default.promises.readlink(e).catch(()=>null);if(n===null)return!1;let o=Ee.default.resolve(Ee.default.dirname(e),n);if(Ye(o,t))return!0;let[i,s]=await Promise.all([yr(o),yr(t)]);return Ye(i,s)}async function ZN(e,t){let r;try{r=await Re.default.promises.lstat(e)}catch(n){to(n)==="ELOOP"&&await Re.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(r.isSymbolicLink()){await Re.default.promises.rm(e,{force:!0});return}await My(e,t)}async function My(e,t){if(Ee.default.basename(e)!==t)throw new d(`Refusing to delete ${b(e)}: its final component is not "${b(t)}". Please report this.`);let r;try{r=await Re.default.promises.lstat(e)}catch{return}if(r.isSymbolicLink()){await Re.default.promises.rm(e,{force:!0});return}await Re.default.promises.rm(e,{recursive:!0,force:!0})}function By(e){return`${e}.${(0,q_.randomBytes)(3).toString("hex")}.tmp`}async function z_(e){let t=Ee.default.resolve(e),r=await yr(Ee.default.dirname(t));return Ee.default.join(r,Ee.default.basename(t))}async function X_(e){let t;try{t=await Re.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await Re.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function Ly(e){let t=e instanceof Error?e.message:String(e);return b(t)}var QN=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],ej=64;async function Ol(e){let t=e.platform??process.platform,r=e.display??(c=>c),n=Dr.default.resolve(e.root),o=st(e.scope,n),i=e.recorded??{},s=new Set(e.warnings??[]);await Ny(n,r);let a=await tj({targets:e.targets,scope:e.scope,root:n,storeBase:o,display:r,warn:c=>s.add(c)});for(let c of await ij({groups:a,skills:e.skills,display:r}))s.add(c);let l=[];for(let c of e.skills)l.push(await oj({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 tj(e){let{targets:t,scope:r,root:n,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let p=jt(c.agent,r,n);if(p===null){s(`${b(c.agent.displayName)} does not support ${r} installation and was skipped.`);continue}let f=a.get(p);f?(f.agents.push(c.agent),f.explicit=f.explicit||c.explicit):a.set(p,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,p]of a){let f=p.agents.slice().sort((h,y)=>h.id<y.id?-1:h.id>y.id?1:0);if(Ye(c,o)){l.push({dir:c,agents:f,canonical:!0});continue}if(await qd(n,c)){let h=Zd(c),y=`${b(i(c))} resolves outside ${b(i(n))}`+(h?` (check $${h})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:f,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await Yd(n,c);if(m!==void 0){let h=`${b(i(m))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(h),l.push({dir:c,agents:f,canonical:!1,skipReason:"path-conflict",detail:h});continue}if(!(p.explicit||await nj(p.agents,r,n,c))){l.push({dir:c,agents:f,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${b(i(o))}`});continue}l.push({dir:c,agents:f,canonical:!1})}return l}function rj(e,t,r,n){if(t==="global")return Dr.default.dirname(n);let[o]=e.skillsDir.split(/[\\/]/);return Dr.default.join(r,o??e.skillsDir)}async function nj(e,t,r,n){for(let o of e)if(await sj(rj(o,t,r,n)))return!0;return!1}async function oj(e){let{discovered:t,groups:r,storeBase:n,mode:o,force:i,platform:s,display:a}=e,l=Dr.default.join(n,t.dir),c=await aj(t.path),p=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,f=e.recorded!==null&&p===null,m=await Q_({dest:l,storePath:l,recorded:p,recordedUnverifiable:f,upstream:c,platform:s}),g=[];for(let v of r){let F=v.canonical?l:Dr.default.join(v.dir,t.dir),E=v.canonical?"canonical":o;if(v.canonical||v.skipReason!==void 0){g.push({agent:eA(v),agents:v.agents.map(U=>U.id),label:tA(v),path:F,link:E,overwrite:v.canonical?m.overwrite:"fresh",blocked:v.canonical?m.blocked:!1,skipped:!v.canonical,...v.skipReason!==void 0?{skipReason:v.skipReason}:{},...v.detail!==void 0?{detail:v.detail}:{}});continue}let S=await Q_({dest:F,storePath:l,recorded:p,recordedUnverifiable:f,upstream:c,platform:s}),L=js(S.overwrite)&&!i;g.push({agent:eA(v),agents:v.agents.map(U=>U.id),label:tA(v),path:F,link:E,overwrite:S.overwrite,blocked:L,skipped:!1,...L?{detail:Z_(S,F,a)}:{}})}let h=js(m.overwrite)&&!i,y=g.find(v=>v.blocked),k=h?Z_(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:g,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:m.onDisk,recorded:p,blocked:h||y!==void 0,...k!==void 0?{detail:k}:{}}}function Z_(e,t,r){return e.problem===void 0?nA(e.overwrite,t,r):`${b(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 Q_(e){let{dest:t,storePath:r,recorded:n,upstream:o,platform:i}=e,s=(c,p,f)=>({overwrite:c,upToDate:p,onDisk:f,blocked:!1}),a;try{a=await ai.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await ai.default.promises.readlink(t).catch(()=>null),p=c===null?null:Dr.default.resolve(Dr.default.dirname(t),c);return p!==null&&Ye(p,r)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await or(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:b(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 Mt(l,n,i)?s("managed-update",Mt(l,o,i),l):s("locally-modified",!1,l);if(Mt(l,o,i)){let c=await rA(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 "${b(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function rA(e,t="",r=0){if(r>ei)return;let n;try{n=await ai.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(Zo.has(o.name))return i;let s=await rA(Dr.default.join(e,o.name),i,r+1);if(s!==void 0)return s;continue}if(!o.isFile()||Qo.has(o.name))return i}}function nA(e,t,r=n=>n){let n=b(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 ij(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 ai.default.promises.readdir(s.dir,{withFileTypes:!0})}catch{continue}a.sort((c,p)=>c.name<p.name?-1:c.name>p.name?1:0);let l=ej;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let p=Dr.default.join(s.dir,c.name,Lt),f;try{f=ti(await ai.default.promises.readFile(p,"utf8")).frontmatter.name}catch{continue}let m=o.get(f);m===void 0||m===c.name||i.push(`${b(n(s.dir))} already contains "${b(c.name)}", whose ${Lt} declares the name "${b(f)}" \u2014 the same skill this install writes to "${b(m)}". Your agent would load it twice; remove one of them.`)}}return i}function Zd(e){let t=Dr.default.resolve(e);for(let r of QN){let n=process.env[r]?.trim();if(n&&ot(n,t))return r}}function eA(e){return e.agents[0]?.id??""}function tA(e){let t=e.agents.map(r=>r.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function sj(e){try{return await ai.default.promises.lstat(e),!0}catch{return!1}}async function aj(e){let t=await or(e);if(t!==null)return t;throw new d(`The extracted skill directory ${b(e)} is no longer present. Re-run the command.`)}Zi();var Bt=1,lA=/^sha256:[0-9a-f]{64}$/,Uy=128,Wy=1024,oA=256,lj=/[\x00-\x1f\x7f]/;function cA(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>Uy?`must be at most ${Uy} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":Ss(e)}function Qd(e){return e.trim()===""?"must not be empty":e.length>Wy?`must be at most ${Wy} characters`:Ss(e)}function iA(e){return(t,r)=>{let n=e(t);n!==null&&r.addIssue({code:B.ZodIssueCode.custom,message:n})}}var uA=B.string().regex(tr,"must be a 40-character lowercase commit SHA"),dA=B.string().regex(kd,"is not a usable git ref for this repository"),sA=B.string().regex(lA,'must look like "sha256:<64 lowercase hex>"'),cj=B.string().min(1,"must not be empty").max(Id).refine(e=>e.trim()!=="","must not be blank").refine(e=>!lj.test(e),"must not contain control characters"),aA=B.string().datetime({offset:!0}),pA=B.object({commit:uA,dir:B.string().superRefine(iA(cA)),skillPath:B.string().superRefine(iA(Qd)).optional(),contentHash:sA.optional(),modeHash:sA.optional(),ref:dA.optional(),agents:B.array(B.string().min(1).max(64)).default([]),mode:B.enum(["symlink","copy"]).default("symlink"),category:B.string().min(1).max(64).optional(),installedAt:aA.optional(),updatedAt:aA.optional()}).passthrough(),fA=B.object({repo:B.string().min(1).max(oA).default(ye),ref:dA.default(Ve),commit:uA.optional(),pluginVersion:B.string().min(1).max(oA).optional()}).passthrough(),mA=B.object({lockfileVersion:B.number().int().min(0),source:fA.default({}),skills:B.record(cj,pA).default({})}).passthrough();function gA(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 Hy(e){let[t]=e.issues;return t?`${gA([...t.path])} ${t.message}`:"did not match the expected shape"}function ep(e){return mA.safeParse(e)}var tp=w(require("path"));oa();C();var hA="webflow-skills-lock.json",yA="skills-lock.json";function li(e){if(typeof e!="string"||e.trim()==="")throw new d("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return tp.default.join(tp.default.resolve(e),hA)}function ci(){return tp.default.join(wi(),yA)}function Ll(e,t){return e==="global"?ci():li(t??"")}var bA=w(require("fs"));var uj=/^<{7}/m,dj=/^\uFEFF/;async function Hr(e){let t;try{t=await bA.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:pj(c)}}let r=t.replace(dj,"");if(uj.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:fj(c,r)}}if(n===null||typeof n!="object"||Array.isArray(n))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${wA(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 ${wA(i)})`};let s=typeof i=="number"?i:0;if(s>Bt){let c=ep(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<Bt?{...o,lockfileVersion:Bt}:o,l=ep(a);return l.success?s<Bt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:Hy(l.error)}}function pj(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 fj(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(`
265
267
  `).length,a=o-(i.lastIndexOf(`
266
- `)+1)+1;return`${n.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function u_(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 xl(e,t){return e<t?-1:e>t?1:0}function _s(e){return[...new Set(e)].sort(xl)}function As(e){return{lockfileVersion:Mt,source:{repo:he,ref:Ge,...e},skills:{}}}function bn(e){return Object.keys(e.skills).sort(xl)}function Nd(e){return Object.keys(e.skills).length===0}function Cl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function uy(e,t){return{...e,skills:{...e.skills,...t}}}function dy(e,t){return{...e,source:{...e.source,...t}}}function py(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 Fl(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function fy(e){let{installedAt:t,updatedAt:n,...r}=e;return r}var f_=require("crypto"),Rs=w(require("fs")),yy=w(require("path"));A();var p_=w(require("path"));C();function jd(e){return D(p_.default.basename(e))}function my(e){return D(e)}function ii(e){let t=jd(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
- ${my(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
- ${my(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 si(e){return new f(`Your ${jd(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${Mt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function gy(e,t){return new f(`Refusing to write ${jd(e)}: it is at lockfile version ${t} and this CLI supports ${Mt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function hy(e,t){let n=D(t instanceof Error?t.message:String(t));return new f(`Could not write ${jd(e)}: ${n}.
270
- ${my(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 m_=420,g_=448,h_=8;function Md(e){if(Array.isArray(e))return e.map(Md);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(xl).map(n=>[n,Md(t[n])]))}return e}function WL(e,t){let n={};for(let[r,o]of Object.entries(e.skills)){let i={...o,agents:_s(o.agents??[])};n[r]=t==="project"?fy(i):i}return{...e,skills:n}}function y_(e,t){let n=WL(e,t.kind);return`${JSON.stringify(Md(n),null,2)}
272
- `}async function w_(e,t,n){if(t.lockfileVersion>Mt)throw gy(e,t.lockfileVersion);let r=yy.default.resolve(e),o=yy.default.dirname(r),i=y_(t,n),s=`${r}.${(0,f_.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await Rs.default.promises.mkdir(o,{recursive:!0,mode:g_});let l=await Rs.default.promises.open(s,"wx",m_);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await Rs.default.promises.rename(s,r),a=!0}catch(l){throw hy(e,l)}finally{a||await Rs.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function wy(e){try{return await Rs.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 ai(e){let t=e.batchSize??h_,n=e.lock,r=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await w_(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=uy(n,{[l]:c}),await a()},async forget(l){let c=py(n,[l]);return n=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){n=dy(n,l),i=!0},flush:s}}var b_="skills_install";async function Ud(e,t){let n=Date.now(),r=Rt(),o=r?F.forSkills({authToken:r}):null;try{let i=await HL(e??[],t);await o?.sendUsage(b_,{duration:Date.now()-n,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),b_,{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 HL(e,t){let n=t.json===!0||et(),r=t.dryRun===!0,o=process.cwd(),i=await Sd({global:t.global,project:t.project,yes:t.yes},o,n),s=t.global!==!0&&t.project!==!0,a=i==="global"?ce.home():o,l=kd({cwd:o,home:ce.home()}),c=i==="global"?"global":"project",p=Sl(c,a),d=await Mn(p);if(d.kind==="corrupt")throw ii(d);if(d.kind==="too-new")throw si(d);let m=d.kind==="ok"?d.lock:As({ref:t.ref??Ge}),h=bn(m),g=e.length===0&&t.allSkills!==!0&&h.length>0&&(V()||t.yes===!0);await kl(it(i,a),{dryRun:r});let y=g?JL(m,h,t.ref):[null],b=[],S=[],_=!1,v=[],x=0,O=0;for(let me of y){let Ne=await VL({group:me,names:e,options:t,scope:i,root:a,lock:m,display:l,json:n});Ne!==null&&(b.push(Ne.plan),_=_||Ne.cacheHit,v=Ne.agents,x=Math.max(x,Ne.detectedCount),O+=Ne.duplicateNameWarnings)}if(b.length===0||b.every(me=>me.skills.length===0))return n?u.info(JSON.stringify(vd(eN({plan:b[0]??null,scope:i,root:a,lockPath:p,dryRun:r,restore:g,cacheHit:_,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),Bd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,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:_,lockPath:p});if(n)u.info(JSON.stringify(vd(me),null,2));else{for(let Ne of b)u.info(qh(Ne,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return Bd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,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 Ne of b)u.info(qh(Ne,{dryRun:!1,display:l}));if(!await $e({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),Bd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O,cancelled:!0})}let B=ai({path:p,kind:c,lock:m}),we=new Date().toISOString();for(let me of b)for(let Ne of me.skills){let E=await El(me,Ne);S.push(E);let z=QL({plan:me,skill:E,skillPath:Ne.skillPath,existing:Cl(B.lock,E.name),previousAgents:Cl(m,E.name)?.agents??[],restore:g,kind:c,now:we});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 Se=E_({plans:b,materialized:S,dryRun:!1,restore:g,cacheHit:_,lockPath:p});return n?u.info(JSON.stringify(vd(Se),null,2)):(u.info(xF(Se,{display:l})),u.info(`Wrote ${l(p)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(Se.failures.length>0||Se.summary.blocked>0&&Se.summary.installed===0)&&(process.exitCode=1),Bd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:S,agents:v,detectedCount:x,duplicateNameWarnings:O})}async function VL(e){let{group:t,names:n,options:r,scope:o,root:i,lock:s,display:a}=e,l=await ws(t===null||t.commit===void 0?{ref:t?.ref??r.ref}:{commit:t.commit,ref:t.ref}),c=await Ds(l.root),p=await vs(c.skillsDir,l.root),d=[...c.warnings,...p.warnings],m=await zL({discovered:p.skills,names:n,allSkills:r.allSkills===!0,restoreNames:t?.names,recordedNames:bn(s),warn:v=>d.push(v)});if(m.length===0)return null;let h=t===null?void 0:_s(t.names.flatMap(v=>Cl(s,v)?.agents??[])),g=await GL({scope:o,root:i,options:r,json:e.json,...h!==void 0&&h.length>0?{recordedAgents:h}:{}});for(let v of g.unknownRecorded)d.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},_=await vl({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:d,display:a});return{plan:_,cacheHit:l.fromCache,agents:g.agents,detectedCount:g.detected.length,duplicateNameWarnings:KL(_.warnings)}}async function GL(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 fl(t,n);if(a.length===0){let l=md(en);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return wl({...i,detected:a})}return wl(i)}function KL(e){return e.filter(t=>t.includes("would load it twice")).length}function JL(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 zL(e){let{discovered:t,names:n,allSkills:r,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let p of o){let d=t.find(m=>m.name===p);if(d===void 0){s(`${D(p)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(d)}return c}let a=t.filter(c=>!c.internal);if(r)return a;if(n.length>0)return n.map(c=>qL(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 YL(a,l)}function qL(e,t){let n=cr(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 XL=20,D_=60;async function YL(e,t){let n=new Set(t.map(s=>s.name)),r=[...e].sort((s,a)=>k_(s.category??"",a.category??"")||k_(s.name,a.name)),o=await vn({message:"Select skills to install",pageSize:Math.min(XL,Math.max(4,r.length)),choices:r.map(s=>({value:s.name,name:`${D(s.name)} ${ZL(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 k_(e,t){return e<t?-1:e>t?1:0}function ZL(e){return e.length<=D_?e:`${e.slice(0,D_-1)}\u2026`}function QL(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(d=>d.name===n.name)?.targets.map(d=>[d.path,d.agents])??[]),c=[];for(let d of n.targets)d.skipped===!0||!d.success||c.push(...l.get(d.path)??[d.agent]);o&&c.push(...e.previousAgents);let p={agents:_s(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"?Fl(p,{...r?{existing:r}:{},now:s}):p}function E_(e){let{plans:t,materialized:n,dryRun:r,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(p=>p.skills),warnings:[...new Set(t.flatMap(p=>p.warnings))],blocked:t.flatMap(p=>p.blocked)},c=zh({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(p=>p.source)}:{}}}function eN(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 Bd(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?zh({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:tN(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 tN(e){return e===void 0||e===Ge?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}q();C();be();A();M();X();var Wd=w(require("fs")),Is=w(require("path"));var nN=256;async function v_(e){let{scope:t,lock:n}=e,r=Is.default.resolve(e.root),o=it(t,r),i=e.display??(p=>p),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let p of Object.keys(n.skills).sort()){let d=n.skills[p];c.add(d.dir),l.push(await rN({name:p,entry:d,scope:t,root:r,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await aN({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 rN(e){let{name:t,entry:n,scope:r,root:o,store:i,platform:s,display:a,warn:l}=e,c=Is.default.join(i,n.dir),p=iN(n),d=await tn(c),m={name:t,dir:n.dir,description:await lN(c),scope:r,status:"up-to-date",mode:n.mode,storePath:c,recordedHash:n.contentHash??null,onDiskHash:d?.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=Ln(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=Nt(b,r,o);if(S===null){h.push({id:y,label:b.displayName,path:null,link:"missing",present:!1});continue}let _=Is.default.join(S,n.dir);if(Ye(_,c)){h.push({id:y,label:b.displayName,path:_,link:"canonical",present:d!==null});continue}let v=await sN(_);if(v==="missing"){h.push({id:y,label:b.displayName,path:_,link:"missing",present:!1}),l(`${D(t)} is recorded for ${D(b.displayName)} but ${D(a(_))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let x=!1;if(n.mode==="copy"&&v==="copy"&&p!==null){let O=await tn(_);x=O===null||!jt(O,p,s),x&&g===void 0&&(g=b.displayName)}h.push({id:y,label:b.displayName,path:_,link:v,present:!0,...x?{diverged:!0}:{}})}return{...m,agents:h,...oN({onDisk:d,recorded:p,platform:s,divergedLabel:g})}}function oN(e){let{onDisk:t,recorded:n,platform:r,divergedLabel:o}=e;return t===null?{status:"missing"}:n!==null&&!jt(t,n,r)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${D(o)} copy diverges`}:{status:"up-to-date"}}function iN(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function sN(e){try{let t=await Wd.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function aN(e){let{scope:t,store:n,recordedDirs:r}=e,o;try{o=await Wd.default.promises.readdir(n,{withFileTypes:!0})}catch{return[]}let i=[],s=nN;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=Is.default.join(n,a.name),c=await tn(l);if(c===null)continue;let p=await S_(l);p!==null&&fC(p.name)&&i.push({name:p.name,dir:a.name,description:p.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function lN(e){return(await S_(e))?.description??""}async function S_(e){try{let t=await Wd.default.promises.readFile(Is.default.join(e,Ot),"utf8"),n=Xo(t);return{name:n.frontmatter.name,description:n.frontmatter.description}}catch{return null}}var x_="skills_list",cN="name",uN=ut(ei);async function Hd(e){let t=Date.now(),n=Rt(),r=n?F.forSkills({authToken:n}):null;try{let o=await dN(e);await r?.sendUsage(x_,{duration:Date.now()-t,...o})}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),x_,{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 dN(e){let t=e.json===!0||et(),n=process.cwd(),r=kd({cwd:n,home:ce.home()}),o=[],i=fN(e.fields,o),s=mN(e.sortBy),a=gN(e.order),l=hN(e.agent),c=pN(e),p=[],d=0;for(let g of c){let y=g==="global"?ce.home():n,b=Sl(g==="global"?"global":"project",y),S=await Mn(b),_;if(S.kind==="ok")_=S.lock;else if(S.kind==="too-new")_=S.lock??As(),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 _=As();let v=await v_({scope:g,root:y,lockfile:b,lock:_,display:r});o.push(...v.warnings),d+=v.skills.length,l!==null&&(v.skills=v.skills.filter(x=>x.agents.some(O=>l.has(O.id)))),v.skills.sort(IF(s,a)),p.push(v)}let m=Xh(p);if(t)return u.info(JSON.stringify(RF({inventories:p,warnings:o}),null,2)),by({inventories:p,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&d>0?`No skills are linked into ${[...l].sort().join(", ")}. ${d} ${d===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${d===1?"it":"them"}.`:Yh);for(let g of Ed(o))u.info(g);return by({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}let h=[];for(let g of p){if(g.skills.length===0)continue;let y=_F(g.skills,{store:g.store,display:r});h.push([AF(g,{display:r}),"",CF(g.skills,i),...y===""?[]:["",y]].join(`
275
- `))}u.info(h.join(`
268
+ `)+1)+1;return`${r.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function wA(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 Nl(e,t){return e<t?-1:e>t?1:0}function Ms(e){return[...new Set(e)].sort(Nl)}function Bs(e){return{lockfileVersion:Bt,source:{repo:ye,ref:Ve,...e},skills:{}}}function Er(e){return Object.keys(e.skills).sort(Nl)}function rp(e){return Object.keys(e.skills).length===0}function jl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function Vy(e,t){return{...e,skills:{...e.skills,...t}}}function Gy(e,t){return{...e,source:{...e.source,...t}}}function Ky(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 Ml(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function Jy(e){let{installedAt:t,updatedAt:r,...n}=e;return n}var DA=require("crypto"),Us=w(require("fs")),Xy=w(require("path"));R();var kA=w(require("path"));C();function np(e){return b(kA.default.basename(e))}function zy(e){return b(e)}function ui(e){let t=np(e.path),r=b(e.detail);if(e.reason==="merge-conflict")return new d(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new d(`Could not read ${t}: ${r}.
269
+ ${zy(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 d(`${n}.
270
+ ${zy(e.path)}
271
+ 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 di(e){return new d(`Your ${np(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${Bt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function qy(e,t){return new d(`Refusing to write ${np(e)}: it is at lockfile version ${t} and this CLI supports ${Bt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function Yy(e,t){let r=b(t instanceof Error?t.message:String(t));return new d(`Could not write ${np(e)}: ${r}.
272
+ ${zy(e)}
273
+ 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 EA=420,vA=448,SA=8;function op(e){if(Array.isArray(e))return e.map(op);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(Nl).map(r=>[r,op(t[r])]))}return e}function mj(e,t){let r={};for(let[n,o]of Object.entries(e.skills)){let i={...o,agents:Ms(o.agents??[])};r[n]=t==="project"?Jy(i):i}return{...e,skills:r}}function xA(e,t){let r=mj(e,t.kind);return`${JSON.stringify(op(r),null,2)}
274
+ `}async function CA(e,t,r){if(t.lockfileVersion>Bt)throw qy(e,t.lockfileVersion);let n=Xy.default.resolve(e),o=Xy.default.dirname(n),i=xA(t,r),s=`${n}.${(0,DA.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await Us.default.promises.mkdir(o,{recursive:!0,mode:vA});let l=await Us.default.promises.open(s,"wx",EA);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await Us.default.promises.rename(s,n),a=!0}catch(l){throw Yy(e,l)}finally{a||await Us.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function Zy(e){try{return await Us.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 pi(e){let t=e.batchSize??SA,r=e.lock,n=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await CA(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=Vy(r,{[l]:c}),await a()},async forget(l){let c=Ky(r,[l]);return r=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){r=Gy(r,l),i=!0},flush:s}}var FA="skills_install";async function sp(e,t){let r=Date.now(),n=Vt(),o=n?_.forSkills({authToken:n}):null;try{let i=await gj(e??[],t);await o?.sendUsage(FA,{duration:Date.now()-r,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),FA,{duration:Date.now()-r}),new d(i,{prefix:`${D} Failed to install skills:`,...i instanceof d&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function gj(e,t){let r=t.json===!0||Xe(),n=t.dryRun===!0,o=process.cwd(),i=await Hd({global:t.global,project:t.project,yes:t.yes},o,r),s=t.global!==!0&&t.project!==!0,a=i==="global"?de.home():o,l=Bd({cwd:o,home:de.home()}),c=i==="global"?"global":"project",p=Ll(c,a),f=await Hr(p);if(f.kind==="corrupt")throw ui(f);if(f.kind==="too-new")throw di(f);let m=f.kind==="ok"?f.lock:Bs({ref:t.ref??Ve}),g=Er(m),h=e.length===0&&t.allSkills!==!0&&g.length>0&&(V()||t.yes===!0);await Pl(st(i,a),{dryRun:n});let y=h?bj(m,g,t.ref):[null],k=[],v=[],F=!1,E=[],S=0,L=0;for(let ce of y){let Be=await hj({group:ce,names:e,options:t,scope:i,root:a,lock:m,display:l,json:r});Be!==null&&(k.push(Be.plan),F=F||Be.cacheHit,E=Be.agents,S=Math.max(S,Be.detectedCount),L+=Be.duplicateNameWarnings)}if(k.length===0||k.every(ce=>ce.skills.length===0))return r?u.info(JSON.stringify(Wd(Cj({plan:k[0]??null,scope:i,root:a,lockPath:p,dryRun:n,restore:h,cacheHit:F,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L});let U=k[0];if(n){let ce=RA({plans:k,materialized:[],dryRun:!0,restore:h,cacheHit:F,lockPath:p});if(r)u.info(JSON.stringify(Wd(ce),null,2));else{for(let Be of k)u.info(Ay(Be,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L})}if(t.yes!==!0&&!V()&&r)throw new d(`Installation requires confirmation, and --json cannot prompt.
275
+ Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!V()){for(let Be of k)u.info(Ay(Be,{dryRun:!1,display:l}));if(!await $e({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L,cancelled:!0})}let N=pi({path:p,kind:c,lock:m}),te=new Date().toISOString();for(let ce of k)for(let Be of ce.skills){let A=await $l(ce,Be);v.push(A);let q=xj({plan:ce,skill:A,skillPath:Be.skillPath,existing:jl(N.lock,A.name),previousAgents:jl(m,A.name)?.agents??[],restore:h,kind:c,now:te});q!==null&&await N.record(A.name,q)}N.updateSource({repo:U.source.repo,ref:U.source.ref,commit:U.source.commit,pluginVersion:U.source.pluginVersion}),await N.flush({force:!0});let G=RA({plans:k,materialized:v,dryRun:!1,restore:h,cacheHit:F,lockPath:p});return r?u.info(JSON.stringify(Wd(G),null,2)):(u.info(P_(G,{display:l})),u.info(`Wrote ${l(p)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(G.failures.length>0||G.summary.blocked>0&&G.summary.installed===0)&&(process.exitCode=1),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:v,agents:E,detectedCount:S,duplicateNameWarnings:L})}async function hj(e){let{group:t,names:r,options:n,scope:o,root:i,lock:s,display:a}=e,l=await As(t===null||t.commit===void 0?{ref:t?.ref??n.ref}:{commit:t.commit,ref:t.ref}),c=await Is(l.root),p=await $s(c.skillsDir,l.root),f=[...c.warnings,...p.warnings],m=await kj({discovered:p.skills,names:r,allSkills:n.allSkills===!0,restoreNames:t?.names,recordedNames:Er(s),warn:E=>f.push(E)});if(m.length===0)return null;let g=t===null?void 0:Ms(t.names.flatMap(E=>jl(s,E)?.agents??[])),h=await yj({scope:o,root:i,options:n,json:e.json,...g!==void 0&&g.length>0?{recordedAgents:g}:{}});for(let E of h.unknownRecorded)f.push(`The lockfile records the agent "${b(E)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let y=h.source==="explicit"||h.source==="prompt",k=h.agents.map(E=>({agent:E,explicit:y})),v={repo:ye,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},F=await Ol({scope:o,root:i,mode:t?.mode??(n.copy===!0?"copy":"symlink"),force:n.force===!0,source:v,skills:m,targets:k,recorded:s.skills,warnings:f,display:a});return{plan:F,cacheHit:l.fromCache,agents:h.agents,detectedCount:h.detected.length,duplicateNameWarnings:wj(F.warnings)}}async function yj(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 xl(t,r);if(a.length===0){let l=Pd(nr);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return Rl({...i,detected:a})}return Rl(i)}function wj(e){return e.filter(t=>t.includes("would load it twice")).length}function bj(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 kj(e){let{discovered:t,names:r,allSkills:n,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let p of o){let f=t.find(m=>m.name===p);if(f===void 0){s(`${b(p)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(f)}return c}let a=t.filter(c=>!c.internal);if(n)return a;if(r.length>0)return r.map(c=>Dj(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(V())throw new d(`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 vj(a,l)}function Dj(e,t){let r=yn(e,[...t]);if(r.kind==="match")return r.skill;throw r.kind==="ambiguous"?new d(`"${b(e)}" matches more than one skill: ${r.matches.map(n=>b(n.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new d(`No skill matches "${b(e)}".`+(r.candidates.length>0?`
276
+ Available: ${r.candidates.map(n=>b(n)).join(", ")}`:""),{isUserError:!0})}var Ej=20,_A=60;async function vj(e,t){let r=new Set(t.map(s=>s.name)),n=[...e].sort((s,a)=>AA(s.category??"",a.category??"")||AA(s.name,a.name)),o=await Cr({message:"Select skills to install",pageSize:Math.min(Ej,Math.max(4,n.length)),choices:n.map(s=>({value:s.name,name:`${b(s.name)} ${Sj(b(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 AA(e,t){return e<t?-1:e>t?1:0}function Sj(e){return e.length<=_A?e:`${e.slice(0,_A-1)}\u2026`}function xj(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(f=>f.name===r.name)?.targets.map(f=>[f.path,f.agents])??[]),c=[];for(let f of r.targets)f.skipped===!0||!f.success||c.push(...l.get(f.path)??[f.agent]);o&&c.push(...e.previousAgents);let p={agents:Ms(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"?Ml(p,{...n?{existing:n}:{},now:s}):p}function RA(e){let{plans:t,materialized:r,dryRun:n,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(p=>p.skills),warnings:[...new Set(t.flatMap(p=>p.warnings))],blocked:t.flatMap(p=>p.blocked)},c=_y({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(p=>p.source)}:{}}}function Cj(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:ye,ref:e.options.ref??Ve,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 ip(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?_y({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:Fj(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 Fj(e){return e===void 0||e===Ve?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}Y();C();we();R();j();Z();var ap=w(require("fs")),Ws=w(require("path"));var _j=256;async function IA(e){let{scope:t,lock:r}=e,n=Ws.default.resolve(e.root),o=st(t,n),i=e.display??(p=>p),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let p of Object.keys(r.skills).sort()){let f=r.skills[p];c.add(f.dir),l.push(await Aj({name:p,entry:f,scope:t,root:n,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await Pj({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 Aj(e){let{name:t,entry:r,scope:n,root:o,store:i,platform:s,display:a,warn:l}=e,c=Ws.default.join(i,r.dir),p=Ij(r),f=await or(c),m={name:t,dir:r.dir,description:await $j(c),scope:n,status:"up-to-date",mode:r.mode,storePath:c,recordedHash:r.contentHash??null,onDiskHash:f?.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=[],h;for(let y of r.agents){let k=Br(y);if(k===void 0){g.push({id:y,label:y,path:null,link:"missing",present:!1}),l(`${b(t)} records the agent "${b(y)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let v=jt(k,n,o);if(v===null){g.push({id:y,label:k.displayName,path:null,link:"missing",present:!1});continue}let F=Ws.default.join(v,r.dir);if(Ye(F,c)){g.push({id:y,label:k.displayName,path:F,link:"canonical",present:f!==null});continue}let E=await Tj(F);if(E==="missing"){g.push({id:y,label:k.displayName,path:F,link:"missing",present:!1}),l(`${b(t)} is recorded for ${b(k.displayName)} but ${b(a(F))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let S=!1;if(r.mode==="copy"&&E==="copy"&&p!==null){let L=await or(F);S=L===null||!Mt(L,p,s),S&&h===void 0&&(h=k.displayName)}g.push({id:y,label:k.displayName,path:F,link:E,present:!0,...S?{diverged:!0}:{}})}return{...m,agents:g,...Rj({onDisk:f,recorded:p,platform:s,divergedLabel:h})}}function Rj(e){let{onDisk:t,recorded:r,platform:n,divergedLabel:o}=e;return t===null?{status:"missing"}:r!==null&&!Mt(t,r,n)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${b(o)} copy diverges`}:{status:"up-to-date"}}function Ij(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function Tj(e){try{let t=await ap.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function Pj(e){let{scope:t,store:r,recordedDirs:n}=e,o;try{o=await ap.default.promises.readdir(r,{withFileTypes:!0})}catch{return[]}let i=[],s=_j;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=Ws.default.join(r,a.name),c=await or(l);if(c===null)continue;let p=await TA(l);p!==null&&DF(p.name)&&i.push({name:p.name,dir:a.name,description:p.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function $j(e){return(await TA(e))?.description??""}async function TA(e){try{let t=await ap.default.promises.readFile(Ws.default.join(e,Lt),"utf8"),r=ti(t);return{name:r.frontmatter.name,description:r.frontmatter.description}}catch{return null}}var PA="skills_list",Oj="name",Lj=dt(ii);async function lp(e){let t=Date.now(),r=Vt(),n=r?_.forSkills({authToken:r}):null;try{let o=await Nj(e);await n?.sendUsage(PA,{duration:Date.now()-t,...o})}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),PA,{duration:Date.now()-t}),new d(o,{prefix:`${D} Failed to list skills:`,...o instanceof d&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function Nj(e){let t=e.json===!0||Xe(),r=process.cwd(),n=Bd({cwd:r,home:de.home()}),o=[],i=Mj(e.fields,o),s=Bj(e.sortBy),a=Uj(e.order),l=Wj(e.agent),c=jj(e),p=[],f=0;for(let h of c){let y=h==="global"?de.home():r,k=Ll(h==="global"?"global":"project",y),v=await Hr(k),F;if(v.kind==="ok")F=v.lock;else if(v.kind==="too-new")F=v.lock??Bs(),o.push(`${n(k)} was written by a newer Webflow CLI (lockfile version ${v.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(v.kind==="corrupt"){o.push(`Skipped ${n(k)} \u2014 ${v.detail}. Fix the file and re-run.`);continue}else F=Bs();let E=await IA({scope:h,root:y,lockfile:k,lock:F,display:n});o.push(...E.warnings),f+=E.skills.length,l!==null&&(E.skills=E.skills.filter(S=>S.agents.some(L=>l.has(L.id)))),E.skills.sort(M_(s,a)),p.push(E)}let m=Ry(p);if(t)return u.info(JSON.stringify(j_({inventories:p,warnings:o}),null,2)),Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&f>0?`No skills are linked into ${[...l].sort().join(", ")}. ${f} ${f===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${f===1?"it":"them"}.`:Iy);for(let h of Ud(o))u.info(h);return Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}let g=[];for(let h of p){if(h.skills.length===0)continue;let y=L_(h.skills,{store:h.store,display:n});g.push([N_(h,{display:n}),"",$_(h.skills,i),...y===""?[]:["",y]].join(`
277
+ `))}u.info(g.join(`
276
278
 
277
- `));for(let g of Ed(o))u.info(g);return by({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}function pN(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 fN(e,t){let n=(e??Dl).split(",").map(i=>i.trim()).filter(Boolean),{valid:r,invalid:o}=uN(n);if(r.length===0)throw new f(`No valid fields specified. Available: ${ei.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${ei.join(", ")}`),r}function mN(e){if(e===void 0||e==="")return cN;let t=Cs.find(n=>n===e.trim().toLowerCase());if(t===void 0)throw new f(`Cannot sort by "${e}". Available: ${Cs.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function gN(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 hN(e){let t=Ss(e);return t.length===0?null:new Set(xs(t).map(n=>n.id))}function by(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 Ft=w(require("fs")),_l=w(require("os")),st=w(require("path"));q();C();be();Oe();A();M();X();async function Jd(e,t){let n=Date.now(),r=$N();try{let o=t.json===!0||et(),i=await yN(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}),AN(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 yN(e,t,n){let r=process.cwd(),o=[],i=t.dryRun===!0,s=await Sd(t,r,n),a=s==="global"?_l.default.homedir():r,l=it(s,a),c=s==="global"?oi():ri(a),p=await Mn(c);if(p.kind==="corrupt")throw ii(p);if(p.kind==="too-new")throw si(p);let d=p.kind==="ok"?p.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=Ss(t.agent),g=m.length===0||m.includes(yl)?null:xs(m).map(E=>E.id),y=Nn(s),b=await wN({agents:y,scope:s,root:a,storeBase:l,warnings:o}),S=R_(b.dirNames,d),_=await DN({names:e,options:t,identities:S,scope:s,cwd:r,json:n,warnings:o});if(_.length===0)return A_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:d});let v=new Set(g??[...Zo,en]);if(g?.includes(en))for(let E of _){let z=(E.entry?.agents??[]).filter(U=>U!==en&&!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 _)x.push(await EN({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{...Dy({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:d,plans:x}),skills:x.map(E=>TN(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(d,x),lockfileDeleted:!1};if(!await _N(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:d});let O=new Set(b.skillDirs),H=ai({path:c,kind:s,lock:d}),B=[],we=[],Se=[];for(let E of x){let z=_.find(U=>U.dir===E.dir);we.push(await SN({plan:E,identity:z,scope:s,root:a,storeBase:l,knownDirs:O,writer:H,failures:B,removedDirectories:Se}))}await H.flush({force:!0});let me=Nd(H.lock),Ne=!1;return me&&s==="global"&&(Ne=await wy(c)),{...Dy({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:d,plans:x}),skills:we,removedDirectories:Se,failures:B,summary:{requested:x.length,removed:we.filter(E=>E.success).length,storeDeleted:we.filter(E=>E.storeAction==="deleted").length,storeKept:we.filter(E=>E.storeAction==="kept").length,staleLockEntriesRemoved:we.filter(E=>E.storeAction==="absent"&&E.lockEntry==="removed").length,failed:B.length},lockfileEmpty:me,lockfileDeleted:Ne}}async function wN(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,...Ey(t,n,r,l)]){if(await PN(c)){i.push(`${Al(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 p;try{p=await Ft.default.promises.readdir(c,{withFileTypes:!0})}catch(d){let m=d.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${Al(c)}: ${ky(d)}`);continue}for(let d of p)(d.isDirectory()||d.isSymbolicLink())&&s.add(d.name)}return{dirNames:s,skillDirs:a}}function Ey(e,t,n,r){let o=new Set;for(let i of e){try{let a=Nt(i,t,n);if(a!==null){if(rt(n,a))o.add(a);else if(r){let l=Pd(a);r(`${Al(a)} resolves outside ${Al(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 R_(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 bn(t)){let o=t.skills[r];n.set(o.dir,{name:r,dir:o.dir,folderName:o.skillPath?Kr(o.skillPath):o.dir,entry:o})}return[...n.values()]}function Vd(e){return e.entry===null}function bN(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 DN(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=>!Vd(h)),p=r.filter(Vd);if(t.length>0){let h=[];for(let g of t){let y=cr(g,r);if(y.kind==="match"){if(!l&&Vd(y.skill))throw bN(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 kN(g,y.candidates,o,i)}return h}if(n.all)return l?r:(C_(p,a),c);if(V()||s)throw new f("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${k} Nothing to remove:`});let d=l?r:c;return l||C_(p,a),d.length===0?[]:await vn({message:`Which skills should be removed (${o} scope)?`,choices:d.map(h=>({value:h,name:`${D(h.dir)}${Vd(h)?" (not in the lockfile)":""}`})),validate:h=>h.length>0?!0:"Select at least one skill."})??[]}function C_(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 kN(e,t,n,r){let o=n==="project"?"global":"project",i=o==="global"?_l.default.homedir():r,s=o==="global"?oi():ri(i),a=await Mn(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await Ft.default.promises.readdir(it(o,i)).catch(()=>[]);if(cr(e,R_(c,l)).kind!=="none")return new f(`"${D(e)}" is not installed at ${n} scope (${Al(n==="global"?_l.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 EN(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 Ey([m],r,o)){let g=st.default.join(h,t.dir);if(Ye(g,a))continue;let y=l.get(g);if(y){y.agents.push(m.id);continue}await Kd(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:p,keptBecause:d}=await vN({identity:t,allAgents:e.allAgents,scope:r,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await Kd(a),targets:c,storeWillBeDeleted:p,keptBecause:d}}async function vN(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 Ey([i],e.scope,e.root)){let a=st.default.join(s,t.dir);if(!Ye(a,st.default.join(e.storeBase,t.dir))&&await Kd(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function SN(e){let{plan:t,identity:n,scope:r,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let d of t.targets){let m=await Kd(d.path);try{await F_({target:d.path,slug:t.dir,knownDirs:o,root:e.root}),await __(d.path),a.push({...d,action:m?"unlinked":"absent",error:null})}catch(h){l=!0;let g=ky(h);s.push({name:n.name,agent:d.agent,...Gd(h)!==void 0?{errno:Gd(h)}:{},message:g}),a.push({...d,action:"failed",error:g})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await F_({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await __(t.storePath),c="deleted"}catch(d){l=!0,c="failed",s.push({name:n.name,...Gd(d)!==void 0?{errno:Gd(d)}:{},message:ky(d)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let p="absent";return!l&&n.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(n.name,{...n.entry,agents:t.keptBecause}),p="updated"):p=await i.forget(n.name)?"removed":"absent"),l||e.removedDirectories.push(...await CN({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:p,targets:a,success:!l,error:null}}async function F_(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 Ft.default.promises.realpath(i)}catch{throw new f(`Refusing to delete ${D(t)}: its parent directory ${D(i)} could not be resolved.`)}if(!await xN(r,s))throw new f(`Refusing to delete ${D(t)}: ${D(i)} is not a known skills directory.`);let l=await Ft.default.promises.realpath(o).catch(()=>o);if(Ye(s,l))throw new f(`Refusing to delete ${D(t)}: ${D(i)} resolves to the scope root itself, not to a skills directory.`);Ue(l,st.default.join(s,st.default.basename(t)),"a skill directory being removed")}async function xN(e,t){for(let n of e){if(Ye(n,t))return!0;let r=await Ft.default.promises.realpath(n).catch(()=>null);if(r!==null&&Ye(r,t))return!0}return!1}async function __(e){let t=null;try{t=await Ft.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await Ft.default.promises.rm(e,{force:!0});return}await Ft.default.promises.rm(e,{recursive:!0,force:!0})}async function CN(e){let t=[],n=new Set([e.root,_l.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 Ft.default.promises.realpath(i);if(n.has(s)||!await FN(e.root,s))continue;await Ft.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function FN(e,t){let n=await Ft.default.promises.realpath(e).catch(()=>e);return rt(n,t)&&!Ye(n,t)}async function _N(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(Zh(e,t)),$e({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function AN(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(Zh(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(PF(e))}function RN(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 Dy(e){return{kind:"skills.remove",schemaVersion:zr,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:RN(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{...Dy(e),lockfileEmpty:Nd(e.lock)}}function IN(e,t){let n=new Set(t.filter(r=>r.keptBecause.length===0).map(r=>r.name));return bn(e).every(r=>n.has(r))}function TN(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 PN(e){try{return(await Ft.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function Kd(e){try{return await Ft.default.promises.lstat(e),!0}catch{return!1}}function Gd(e){let t=e?.code;return typeof t=="string"?t:void 0}function ky(e){return D(e instanceof Error?e.message:String(e))}function $N(){let e=Rt();return e?F.forSkills({authToken:e}):null}function Al(e){return Qo(e)}var Ts=w(require("fs")),P_=w(require("os")),Dn=w(require("path"));q();C();be();Oe();A();M();X();function $_(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 zd(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=oj(),s=t.json===!0||et();try{let a=await ON({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}),nj(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 ON(e){let{names:t,options:n,checkOnly:r,force:o,json:i}=e,s=[],a=process.cwd(),l=await LN(n,a,r,s);if(l.length===0)return Sy({checkOnly:r,force:o,warnings:s});let c=NN(l,t,n);if(c.length===0)return Sy({checkOnly:r,force:o,warnings:s,scopes:l.map(x=>x.scope)});let p=new Map;for(let{state:x,key:O}of c){let H=vy(n,x.lock,O);p.has(H)||p.set(H,(await ll(H)).commit)}let d=new Map;for(let{state:x,key:O}of c){let H=x.lock.skills[O];d.set(`${x.scope}\0${O}`,await UN(x,H))}let m=c.every(({state:x,key:O})=>{let H=x.lock.skills[O];return p.get(vy(n,x.lock,O))===H.commit}),h=c.every(({state:x,key:O})=>d.get(`${x.scope}\0${O}`)!==null);if(m&&h&&n.ref===void 0&&!o)return tj({selected:c,states:l,localDigests:d,refs:p,options:n,checkOnly:r,force:o,warnings:s});let g=new Map;for(let x of new Set(p.values()))g.set(x,await BN(x,s));let y=[],b=[];for(let{state:x,key:O}of c){let H=x.lock.skills[O],B=vy(n,x.lock,O),we=p.get(B),Se=g.get(we);try{y.push(await WN({state:x,key:O,entry:H,ref:B,commit:we,catalog:Se,force:o,checkOnly:r,localDigest:d.get(`${x.scope}\0${O}`)??null,warnings:s}))}catch(me){b.push({name:O,errno:T_(me),message:xy(me)})}}let S=y.filter(x=>x.localDrift==="differs"&&x.outcome.willWrite);if(!r&&S.length>0&&!await YN(S,n,i))return Sy({checkOnly:r,force:o,warnings:s,scopes:l.map(O=>O.scope),cancelled:!0});let _=new Map,v=[];if(!r)for(let x of l)x.readOnly||await kl(x.storeBase,{dryRun:!1});for(let x of y)try{v.push(await GN({candidate:x,checkOnly:r,force:o,options:n,writers:_,failures:b,warnings:s}))}catch(O){b.push({name:x.key,errno:T_(O),message:xy(O)}),v.push(ZN(x,xy(O)))}if(n.ref!==void 0&&!r)for(let x of l)x.readOnly||O_(x,_);for(let[x,O]of _){let H=l.find(me=>me.scope===x),B=n.ref??H.lock.source.ref??Ge,we=p.get(B)??y.find(me=>me.scopeState.scope===x)?.commit,Se=M_(g);O.updateSource({ref:B,...we!==void 0?{commit:we}:{},...Se!==void 0?{pluginVersion:Se}:{}}),await O.flush({force:!0})}return ej({reports:v,candidates:y,failures:b,states:l,refs:p,catalogs:g,options:n,checkOnly:r,force:o,warnings:s})}async function LN(e,t,n,r){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?P_.default.homedir():t,l=s==="global"?oi():ri(a),c=await Mn(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw ii(c);if(c.kind==="too-new"){if(!n||c.lock===null)throw si(c);r.push(`${Il(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(`${Il(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 NN(e,t,n){if(t.length===0)return e.flatMap(s=>bn(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=cr(s,MN(l.lock));if(c.kind==="ambiguous")throw new f(`"${D(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(p=>D(p.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 jN(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}: ${Il(l.state.lockPath)}`).join(`
279
+ `));for(let h of Ud(o))u.info(h);return Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}function jj(e){if(e.global===!0&&e.project===!0)throw new d("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function Mj(e,t){let r=(e??Tl).split(",").map(i=>i.trim()).filter(Boolean),{valid:n,invalid:o}=Lj(r);if(n.length===0)throw new d(`No valid fields specified. Available: ${ii.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${ii.join(", ")}`),n}function Bj(e){if(e===void 0||e==="")return Oj;let t=Ns.find(r=>r===e.trim().toLowerCase());if(t===void 0)throw new d(`Cannot sort by "${e}". Available: ${Ns.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function Uj(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new d(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function Wj(e){let t=Os(e);return t.length===0?null:new Set(Ls(t).map(r=>r.id))}function Qy(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 Ft=w(require("fs")),Bl=w(require("os")),at=w(require("path"));Y();C();we();Oe();R();j();Z();async function pp(e,t){let r=Date.now(),n=s1();try{let o=t.json===!0||Xe(),i=await Hj(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}),t1(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 d?o:new d(o,{prefix:`${D} Failed to remove skills:`})}}async function Hj(e,t,r){let n=process.cwd(),o=[],i=t.dryRun===!0,s=await Hd(t,n,r),a=s==="global"?Bl.default.homedir():n,l=st(s,a),c=s==="global"?ci():li(a),p=await Hr(c);if(p.kind==="corrupt")throw ui(p);if(p.kind==="too-new")throw di(p);let f=p.kind==="ok"?p.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=Os(t.agent),h=m.length===0||m.includes(Al)?null:Ls(m).map(A=>A.id),y=Ur(s),k=await Vj({agents:y,scope:s,root:a,storeBase:l,warnings:o}),v=jA(k.dirNames,f),F=await Kj({names:e,options:t,identities:v,scope:s,cwd:n,json:r,warnings:o});if(F.length===0)return NA({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f});let E=new Set(h??[...ni,nr]);if(h?.includes(nr))for(let A of F){let q=(A.entry?.agents??[]).filter(W=>W!==nr&&!E.has(W));if(q.length>0)throw new d(`Cannot remove the shared store for "${b(A.name)}" while ${q.map(W=>b(W)).join(", ")} still link to it.
280
+ Remove those first, or run \`webflow skills remove ${b(A.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${D} Cannot remove skills:`})}let S=[];for(let A of F)S.push(await zj({identity:A,agents:h===null?y:y.filter(q=>h.includes(q.id)),allAgents:y,scope:s,root:a,storeBase:l,removalTargets:E}));if(i)return{...ew({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f,plans:S}),skills:S.map(A=>o1(A,s)),summary:{requested:S.length,removed:0,storeDeleted:S.filter(A=>A.storeWillBeDeleted).length,storeKept:S.filter(A=>A.onDisk&&!A.storeWillBeDeleted).length,staleLockEntriesRemoved:S.filter(A=>!A.onDisk).length,failed:0},lockfileEmpty:n1(f,S),lockfileDeleted:!1};if(!await e1(S,s,t,r))return r||u.info("Removal cancelled \u2014 no changes made."),NA({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f});let L=new Set(k.skillDirs),U=pi({path:c,kind:s,lock:f}),N=[],te=[],G=[];for(let A of S){let q=F.find(W=>W.dir===A.dir);te.push(await Yj({plan:A,identity:q,scope:s,root:a,storeBase:l,knownDirs:L,writer:U,failures:N,removedDirectories:G}))}await U.flush({force:!0});let ce=rp(U.lock),Be=!1;return ce&&s==="global"&&(Be=await Zy(c)),{...ew({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f,plans:S}),skills:te,removedDirectories:G,failures:N,summary:{requested:S.length,removed:te.filter(A=>A.success).length,storeDeleted:te.filter(A=>A.storeAction==="deleted").length,storeKept:te.filter(A=>A.storeAction==="kept").length,staleLockEntriesRemoved:te.filter(A=>A.storeAction==="absent"&&A.lockEntry==="removed").length,failed:N.length},lockfileEmpty:ce,lockfileDeleted:Be}}async function Vj(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,...rw(t,r,n,l)]){if(await i1(c)){i.push(`${Ul(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 p;try{p=await Ft.default.promises.readdir(c,{withFileTypes:!0})}catch(f){let m=f.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${Ul(c)}: ${tw(f)}`);continue}for(let f of p)(f.isDirectory()||f.isSymbolicLink())&&s.add(f.name)}return{dirNames:s,skillDirs:a}}function rw(e,t,r,n){let o=new Set;for(let i of e){try{let a=jt(i,t,r);if(a!==null){if(ot(r,a))o.add(a);else if(n){let l=Zd(a);n(`${Ul(a)} resolves outside ${Ul(r)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=at.default.resolve(r,...i.skillsDir.split("/"));s.startsWith(at.default.resolve(r)+at.default.sep)&&o.add(s)}return[...o]}function jA(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 Er(t)){let o=t.skills[n];r.set(o.dir,{name:n,dir:o.dir,folderName:o.skillPath?Zn(o.skillPath):o.dir,entry:o})}return[...r.values()]}function cp(e){return e.entry===null}function Gj(e){return new d(`"${b(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
281
+ It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${D} Refusing to remove an unmanaged skill directory:`})}async function Kj(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=>!cp(g)),p=n.filter(cp);if(t.length>0){let g=[];for(let h of t){let y=yn(h,n);if(y.kind==="match"){if(!l&&cp(y.skill))throw Gj(y.skill);g.includes(y.skill)||g.push(y.skill);continue}throw y.kind==="ambiguous"?new d(`"${b(h)}" matches ${y.matches.length} installed skills: ${y.matches.map(k=>b(k.dir)).join(", ")}.
282
+ Name one of them exactly.`,{isUserError:!0,prefix:`${D} Cannot remove skills:`}):await Jj(h,y.candidates,o,i)}return g}if(r.all)return l?n:($A(p,a),c);if(V()||s)throw new d("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${D} Nothing to remove:`});let f=l?n:c;return l||$A(p,a),f.length===0?[]:await Cr({message:`Which skills should be removed (${o} scope)?`,choices:f.map(g=>({value:g,name:`${b(g.dir)}${cp(g)?" (not in the lockfile)":""}`})),validate:g=>g.length>0?!0:"Select at least one skill."})??[]}function $A(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=>b(r.dir)).join(", ")}. Pass --force to remove them too.`)}async function Jj(e,t,r,n){let o=r==="project"?"global":"project",i=o==="global"?Bl.default.homedir():n,s=o==="global"?ci():li(i),a=await Hr(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await Ft.default.promises.readdir(st(o,i)).catch(()=>[]);if(yn(e,jA(c,l)).kind!=="none")return new d(`"${b(e)}" is not installed at ${r} scope (${Ul(r==="global"?Bl.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:`${D} Cannot remove skills:`})}}return new d(`"${b(e)}" is not installed at ${r} scope.
283
+ `+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>b(l)).join(", ")}`),{isUserError:!0,prefix:`${D} Cannot remove skills:`})}async function zj(e){let{identity:t,agents:r,scope:n,root:o,storeBase:i,removalTargets:s}=e,a=at.default.join(i,t.dir),l=new Map;for(let m of r)for(let g of rw([m],n,o)){let h=at.default.join(g,t.dir);if(Ye(h,a))continue;let y=l.get(h);if(y){y.agents.push(m.id);continue}await dp(h)&&l.set(h,{agent:m.id,agents:[m.id],label:m.displayName,path:h})}let c=[...l.values()].sort((m,g)=>m.path<g.path?-1:m.path>g.path?1:0),{deleted:p,keptBecause:f}=await qj({identity:t,allAgents:e.allAgents,scope:n,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await dp(a),targets:c,storeWillBeDeleted:p,keptBecause:f}}async function qj(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 rw([i],e.scope,e.root)){let a=at.default.join(s,t.dir);if(!Ye(a,at.default.join(e.storeBase,t.dir))&&await dp(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function Yj(e){let{plan:t,identity:r,scope:n,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let f of t.targets){let m=await dp(f.path);try{await OA({target:f.path,slug:t.dir,knownDirs:o,root:e.root}),await LA(f.path),a.push({...f,action:m?"unlinked":"absent",error:null})}catch(g){l=!0;let h=tw(g);s.push({name:r.name,agent:f.agent,...up(g)!==void 0?{errno:up(g)}:{},message:h}),a.push({...f,action:"failed",error:h})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await OA({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await LA(t.storePath),c="deleted"}catch(f){l=!0,c="failed",s.push({name:r.name,...up(f)!==void 0?{errno:up(f)}:{},message:tw(f)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let p="absent";return!l&&r.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(r.name,{...r.entry,agents:t.keptBecause}),p="updated"):p=await i.forget(r.name)?"removed":"absent"),l||e.removedDirectories.push(...await Zj({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:p,targets:a,success:!l,error:null}}async function OA(e){let{target:t,slug:r,knownDirs:n,root:o}=e;if(at.default.basename(t)!==r)throw new d(`Refusing to delete ${b(t)}: its final component is not "${b(r)}".`);let i=at.default.dirname(t),s;try{s=await Ft.default.promises.realpath(i)}catch{throw new d(`Refusing to delete ${b(t)}: its parent directory ${b(i)} could not be resolved.`)}if(!await Xj(n,s))throw new d(`Refusing to delete ${b(t)}: ${b(i)} is not a known skills directory.`);let l=await Ft.default.promises.realpath(o).catch(()=>o);if(Ye(s,l))throw new d(`Refusing to delete ${b(t)}: ${b(i)} resolves to the scope root itself, not to a skills directory.`);Me(l,at.default.join(s,at.default.basename(t)),"a skill directory being removed")}async function Xj(e,t){for(let r of e){if(Ye(r,t))return!0;let n=await Ft.default.promises.realpath(r).catch(()=>null);if(n!==null&&Ye(n,t))return!0}return!1}async function LA(e){let t=null;try{t=await Ft.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await Ft.default.promises.rm(e,{force:!0});return}await Ft.default.promises.rm(e,{recursive:!0,force:!0})}async function Zj(e){let t=[],r=new Set([e.root,Bl.default.homedir(),at.default.dirname(e.root)].map(o=>at.default.resolve(o))),n=[];for(let o of e.targets)n.push(at.default.dirname(o.path));e.storeDeleted&&n.push(e.storeBase,at.default.dirname(e.storeBase));for(let o of n){let i=at.default.resolve(o);if(!r.has(i)&&ot(e.root,i))try{let s=await Ft.default.promises.realpath(i);if(r.has(s)||!await Qj(e.root,s))continue;await Ft.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function Qj(e,t){let r=await Ft.default.promises.realpath(e).catch(()=>e);return ot(r,t)&&!Ye(r,t)}async function e1(e,t,r,n){if(r.yes)return!0;if(V()||n)throw new d(`Removal requires confirmation in non-interactive mode.
284
+ Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${D} Cannot remove skills:`});return u.info(Ty(e,t)),$e({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function t1(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${X} ${b(r)}`);if(e.dryRun){u.info(Ty(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(U_(e))}function r1(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 ew(e){return{kind:"skills.remove",schemaVersion:eo,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:r1(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 NA(e){return{...ew(e),lockfileEmpty:rp(e.lock)}}function n1(e,t){let r=new Set(t.filter(n=>n.keptBecause.length===0).map(n=>n.name));return Er(e).every(n=>r.has(n))}function o1(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 i1(e){try{return(await Ft.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function dp(e){try{return await Ft.default.promises.lstat(e),!0}catch{return!1}}function up(e){let t=e?.code;return typeof t=="string"?t:void 0}function tw(e){return b(e instanceof Error?e.message:String(e))}function s1(){let e=Vt();return e?_.forSkills({authToken:e}):null}function Ul(e){return oi(e)}var Hs=w(require("fs")),UA=w(require("os")),vr=w(require("path"));Y();C();we();Oe();R();j();Z();function WA(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 fp(e,t){let r=Date.now(),n=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new d("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${D} Cannot update skills:`});let i=R1(),s=t.json===!0||Xe();try{let a=await a1({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}),_1(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 d?a:new d(a,{prefix:`${D} Failed to update skills:`})}}async function a1(e){let{names:t,options:r,checkOnly:n,force:o,json:i}=e,s=[],a=process.cwd(),l=await l1(r,a,n,s);if(l.length===0)return ow({checkOnly:n,force:o,warnings:s});let c=c1(l,t,r);if(c.length===0)return ow({checkOnly:n,force:o,warnings:s,scopes:l.map(S=>S.scope)});let p=new Map;for(let{state:S,key:L}of c){let U=nw(r,S.lock,L);p.has(U)||p.set(U,(await kl(U)).commit)}let f=new Map;for(let{state:S,key:L}of c){let U=S.lock.skills[L];f.set(`${S.scope}\0${L}`,await f1(S,U))}let m=c.every(({state:S,key:L})=>{let U=S.lock.skills[L];return p.get(nw(r,S.lock,L))===U.commit}),g=c.every(({state:S,key:L})=>f.get(`${S.scope}\0${L}`)!==null);if(m&&g&&r.ref===void 0&&!o)return F1({selected:c,states:l,localDigests:f,refs:p,options:r,checkOnly:n,force:o,warnings:s});let h=new Map;for(let S of new Set(p.values()))h.set(S,await p1(S,s));let y=[],k=[];for(let{state:S,key:L}of c){let U=S.lock.skills[L],N=nw(r,S.lock,L),te=p.get(N),G=h.get(te);try{y.push(await m1({state:S,key:L,entry:U,ref:N,commit:te,catalog:G,force:o,checkOnly:n,localDigest:f.get(`${S.scope}\0${L}`)??null,warnings:s}))}catch(ce){k.push({name:L,errno:BA(ce),message:iw(ce)})}}let v=y.filter(S=>S.localDrift==="differs"&&S.outcome.willWrite);if(!n&&v.length>0&&!await v1(v,r,i))return ow({checkOnly:n,force:o,warnings:s,scopes:l.map(L=>L.scope),cancelled:!0});let F=new Map,E=[];if(!n)for(let S of l)S.readOnly||await Pl(S.storeBase,{dryRun:!1});for(let S of y)try{E.push(await y1({candidate:S,checkOnly:n,force:o,options:r,writers:F,failures:k,warnings:s}))}catch(L){k.push({name:S.key,errno:BA(L),message:iw(L)}),E.push(S1(S,iw(L)))}if(r.ref!==void 0&&!n)for(let S of l)S.readOnly||HA(S,F);for(let[S,L]of F){let U=l.find(ce=>ce.scope===S),N=r.ref??U.lock.source.ref??Ve,te=p.get(N)??y.find(ce=>ce.scopeState.scope===S)?.commit,G=JA(h);L.updateSource({ref:N,...te!==void 0?{commit:te}:{},...G!==void 0?{pluginVersion:G}:{}}),await L.flush({force:!0})}return C1({reports:E,candidates:y,failures:k,states:l,refs:p,catalogs:h,options:r,checkOnly:n,force:o,warnings:s})}async function l1(e,t,r,n){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?UA.default.homedir():t,l=s==="global"?ci():li(a),c=await Hr(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw ui(c);if(c.kind==="too-new"){if(!r||c.lock===null)throw di(c);n.push(`${Hl(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:st(s,a),readOnly:!0});continue}c.migratedFrom!==void 0&&n.push(`${Hl(l)} uses lockfile version ${c.migratedFrom}; the next write upgrades it.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:st(s,a),readOnly:r})}}return i}function c1(e,t,r){if(t.length===0)return e.flatMap(s=>Er(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=yn(s,d1(l.lock));if(c.kind==="ambiguous")throw new d(`"${b(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(p=>b(p.name)).join(", ")}.
285
+ Name one of them exactly.`,{isUserError:!0,prefix:`${D} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw u1(s,e);if(a.length>1&&!n)throw new d(`"${b(s)}" is installed at more than one scope:
286
+ `+a.map(l=>` ${l.state.scope}: ${Hl(l.state.lockPath)}`).join(`
285
287
  `)+`
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 jN(e,t){let n=t.flatMap(r=>bn(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 MN(e){return bn(e).map(t=>{let n=e.skills[t];return{name:t,dir:n.dir,folderName:n.skillPath?Kr(n.skillPath):n.dir}})}function vy(e,t,n){return e.ref??t.skills[n]?.ref??t.source.ref??Ge}async function BN(e,t){let n=await ws({commit:e}),r=await Ds(n.root),o=await vs(r.skillsDir,n.root);return t.push(...r.warnings,...o.warnings),{commit:e,root:n.root,pluginVersion:r.version,skills:o.skills}}async function UN(e,t){let n=Dn.default.join(e.storeBase,t.dir),r=await tn(n);if(r===null)return null;if(t.mode!=="copy")return r;let o=Fy(t);if(o===null)return r;for(let i of rj(t)){let s=Nt(i,e.scope,e.root);if(s===null)continue;let a=await tn(Dn.default.join(s,t.dir));if(a!==null&&!jt(a,o))return a}return r}async function WN(e){let{state:t,key:n,entry:r,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=Fy(r),p=Dn.default.join(t.storeBase,r.dir),d=HN(r,s,l,n),m=s.skills.find(we=>we.name===n)??null,h=d!==null?"exists":m!==null?"moved":"missing",g=h==="exists"?d:h==="moved"?m.path:null,y=g===null?null:await tn(g),b=e.localDigest===null?"absent":c===null||jt(e.localDigest,c)?"same":"differs",S=jt(y,c)?"same":"differs",_=$_({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}=VN(t,r,l),B=g===null||x===null?null:{name:n,dir:v,folderName:Kr(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:p,mode:r.mode,agents:O,droppedAgents:H,presence:h,upstreamDrift:S,localDrift:b,outcome:_,recorded:c,onDisk:e.localDigest,upstream:y,discovered:B,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:QN(_,{key:n,storeDir:p,recordedSkillPath:r.skillPath??null,newSkillPath:x,checkOnly:e.checkOnly})}}function HN(e,t,n,r){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=$d(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 Ue(t.root,s,"the recorded skill path"),Ts.default.existsSync(s)?Dn.default.dirname(s):null}function VN(e,t,n){let r=[],o=[];for(let i of t.agents??[]){if(i===en){r.push(i);continue}let s=Ln(i);if(s===void 0){r.push(i);continue}if(Nt(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 GN(e){let{candidate:t,checkOnly:n,force:r,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Rl(t,n,[]);let l=await KN(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 p=t.agents.filter(g=>!c.has(g));if(p.length===0&&p.push(en),n)return Rl(t,!0,l.targets.map(g=>Cy(g)),[...c]);let d,m=t.onDisk;if(a.willWrite){let g=await El(l.plan,l.skill);if(d=g.targets.map((y,b)=>L_(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{...Rl(t,!1,d,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await zN(t,l.targets)}else{d=[];for(let g of l.targets)d.push(await JN(t,g))}let h=p.length!==(t.entry.agents??[]).length||p.some((g,y)=>(t.entry.agents??[])[y]!==g);return qN(t,a,h,o)&&!t.scopeState.readOnly&&await O_(t.scopeState,i).record(t.key,XN(t,m,a,o,p)),Rl(t,!1,d,[...c])}async function KN(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===en)continue;let a=Ln(s);a!==void 0&&r.push({agent:a,explicit:!1})}let o=await vl({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:Il}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function JN(e,t){if(t.skipped||t.link==="canonical")return Cy(t);if(t.overwrite!=="fresh")return{...Cy(t),action:"unchanged"};let n=await Td({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...L_(n,t),action:n.success?"relinked":"failed"}}async function zN(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 Ts.default.promises.realpath(i);if(!rt(r,a))continue;await ps(r,Dn.default.join(a,n),"a renamed skill directory"),(await Ts.default.promises.lstat(s)).isSymbolicLink()?await Ts.default.promises.rm(s,{force:!0}):await Ts.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function qN(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 XN(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"?Fl(s,{existing:e.entry,now:new Date().toISOString()}):s}function O_(e,t){let n=t.get(e.scope);if(n)return n;let r=ai({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,r),r}async function YN(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(`
288
+ Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${D} 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 u1(e,t){let r=t.flatMap(n=>Er(n.lock).map(o=>n.lock.skills[o]?.dir??o));return new d(`"${b(e)}" is not installed.
289
+ `+(r.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(r)].sort().map(n=>b(n)).join(", ")}`),{isUserError:!0,prefix:`${D} Cannot update skills:`})}function d1(e){return Er(e).map(t=>{let r=e.skills[t];return{name:t,dir:r.dir,folderName:r.skillPath?Zn(r.skillPath):r.dir}})}function nw(e,t,r){return e.ref??t.skills[r]?.ref??t.source.ref??Ve}async function p1(e,t){let r=await As({commit:e}),n=await Is(r.root),o=await $s(n.skillsDir,r.root);return t.push(...n.warnings,...o.warnings),{commit:e,root:r.root,pluginVersion:n.version,skills:o.skills}}async function f1(e,t){let r=vr.default.join(e.storeBase,t.dir),n=await or(r);if(n===null)return null;if(t.mode!=="copy")return n;let o=aw(t);if(o===null)return n;for(let i of A1(t)){let s=jt(i,e.scope,e.root);if(s===null)continue;let a=await or(vr.default.join(s,t.dir));if(a!==null&&!Mt(a,o))return a}return n}async function m1(e){let{state:t,key:r,entry:n,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=aw(n),p=vr.default.join(t.storeBase,n.dir),f=g1(n,s,l,r),m=s.skills.find(te=>te.name===r)??null,g=f!==null?"exists":m!==null?"moved":"missing",h=g==="exists"?f:g==="moved"?m.path:null,y=h===null?null:await or(h),k=e.localDigest===null?"absent":c===null||Mt(e.localDigest,c)?"same":"differs",v=Mt(y,c)?"same":"differs",F=WA({hasSkillPath:typeof n.skillPath=="string"&&n.skillPath!=="",foundByName:m!==null,presence:g,upstream:v,local:k,force:a}),E=g==="moved"&&m!==null?m.dir:n.dir,S=g==="exists"?n.skillPath:g==="moved"?m.skillPath:n.skillPath??null,{agents:L,dropped:U}=h1(t,n,l),N=h===null||S===null?null:{name:r,dir:E,folderName:Zn(S),description:m?.description??"",...m?.category!==void 0?{category:m.category}:{},internal:m?.internal??!1,path:h,skillPath:S,supplementaryFiles:m?.supplementaryFiles??[]};return{scopeState:t,key:r,entry:n,dir:n.dir,newDir:E,storeDir:p,mode:n.mode,agents:L,droppedAgents:U,presence:g,upstreamDrift:v,localDrift:k,outcome:F,recorded:c,onDisk:e.localDigest,upstream:y,discovered:N,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:x1(F,{key:r,storeDir:p,recordedSkillPath:n.skillPath??null,newSkillPath:S,checkOnly:e.checkOnly})}}function g1(e,t,r,n){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=Qd(o);if(i!==null)return r.push(`The recorded path for "${b(n)}" ${i}; locating it by name instead.`),null;let s=vr.default.resolve(t.root,...o.split("/"));return Me(t.root,s,"the recorded skill path"),Hs.default.existsSync(s)?vr.default.dirname(s):null}function h1(e,t,r){let n=[],o=[];for(let i of t.agents??[]){if(i===nr){n.push(i);continue}let s=Br(i);if(s===void 0){n.push(i);continue}if(jt(s,e.scope,e.root)===null){o.push(i),r.push(`${b(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 y1(e){let{candidate:t,checkOnly:r,force:n,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Wl(t,r,[]);let l=await w1(t,n),c=new Set(t.droppedAgents);for(let h of l.targets)if(h.skipReason==="agent-dir-absent")for(let y of h.agents)c.add(y);e.warnings.push(...l.warnings);let p=t.agents.filter(h=>!c.has(h));if(p.length===0&&p.push(nr),r)return Wl(t,!0,l.targets.map(h=>sw(h)),[...c]);let f,m=t.onDisk;if(a.willWrite){let h=await $l(l.plan,l.skill);if(f=h.targets.map((y,k)=>VA(y,l.targets[k])),m=h.hashes,!h.success||h.storeAction==="failed"){let y=h.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:y});for(let k of h.targets)!k.success&&k.error&&s.push({name:t.key,agent:k.agent,...k.errno!==void 0?{errno:k.errno}:{},message:k.error});return{...Wl(t,!1,f,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await k1(t,l.targets)}else{f=[];for(let h of l.targets)f.push(await b1(t,h))}let g=p.length!==(t.entry.agents??[]).length||p.some((h,y)=>(t.entry.agents??[])[y]!==h);return D1(t,a,g,o)&&!t.scopeState.readOnly&&await HA(t.scopeState,i).record(t.key,E1(t,m,a,o,p)),Wl(t,!1,f,[...c])}async function w1(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===nr)continue;let a=Br(s);a!==void 0&&n.push({agent:a,explicit:!1})}let o=await Ol({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:Hl}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function b1(e,t){if(t.skipped||t.link==="canonical")return sw(t);if(t.overwrite!=="fresh")return{...sw(t),action:"unchanged"};let r=await Xd({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...VA(r,t),action:r.success?"relinked":"failed"}}async function k1(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=>vr.default.dirname(i.path))];for(let i of new Set(o)){let s=vr.default.join(i,r);if(vr.default.basename(s)===r&&s!==vr.default.join(i,e.newDir))try{let a=await Hs.default.promises.realpath(i);if(!ot(n,a))continue;await vs(n,vr.default.join(a,r),"a renamed skill directory"),(await Hs.default.promises.lstat(s)).isSymbolicLink()?await Hs.default.promises.rm(s,{force:!0}):await Hs.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function D1(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 E1(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"?Ml(s,{existing:e.entry,now:new Date().toISOString()}):s}function HA(e,t){let r=t.get(e.scope);if(r)return r;let n=pi({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,n),n}async function v1(e,t,r){if(t.yes)return!0;if(V()||r)throw new d(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
290
+ `+e.map(n=>` ${b(n.key)}`).join(`
289
291
  `)+`
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 $e({message:"Discard local changes and replace with upstream?",default:!1})}function Rl(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:N_(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 ZN(e,t){return{...Rl(e,!1,[]),state:"failed",action:"failed",detail:t}}function Cy(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 L_(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 N_(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 QN(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?I_(r):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?I_(r):`updating would discard your edits. Review ${Il(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 I_(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function ej(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:zr,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:M_(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:j_(t,r,e.checkOnly),warnings:[...new Set(e.warnings)]}}function j_(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 tj(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:p})=>{let d=c.lock.skills[p],m=Fy(d),h=r.get(`${c.scope}\0${p}`)??null,g=m!==null&&!jt(h,m);return{name:p,dir:d.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:d.agents??[],droppedAgents:[],reason:g?"locally-modified":null,detail:g?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:d.commit,toCommit:null,skillPath:d.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:zr,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:j_(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function Sy(e){return{kind:"skills.update",schemaVersion:zr,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 nj(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(TF(e))}function Fy(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function rj(e){let t=[];for(let n of e.agents??[]){let r=Ln(n);r!==void 0&&t.push(r)}return t}function M_(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function T_(e){let t=e?.code;return typeof t=="string"?t:void 0}function xy(e){return D(e instanceof Error?e.message:String(e))}function oj(){let e=Rt();return e?F.forSkills({authToken:e}):null}function Il(e){return Qo(e)}var B_=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(eu()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(ka()).addOption(Ea()).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(Ti()).addOption(Ae()).addOption(ne()).action(Ud),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(ka()).addOption(Ea()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(Ti()).addOption(Ae()).addOption(ne()).action(zd),t.command("list").description("List installed skills and the agents they are linked into").addOption(ka()).addOption(Ea()).addOption(eu()).addOption(He([...ei]).default(Dl)).addOption($i([...Cs]).default("name")).addOption(Pi()).addOption(ne()).action(Hd),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(eu()).option("--all","Remove every installed skill for the scope").addOption(ka()).addOption(Ea()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(Ti()).addOption(Ae()).addOption(ne()).action(Jd)};var W_=w(zl());function _y(e,t){t.forEach(n=>{e.addOption(n())}),e.commands.forEach(n=>_y(n,t))}function H_(e){let t=W_.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(n,r){return U_.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)?[Oy(o)]:o.trim()===""?[o]:[I(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
292
+ Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${D} 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(` ${b(n.key)}`);return $e({message:"Discard local changes and replace with upstream?",default:!1})}function Wl(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:GA(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 S1(e,t){return{...Wl(e,!1,[]),state:"failed",action:"failed",detail:t}}function sw(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 VA(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 GA(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 x1(e,t){let r=b(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?MA(n):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?MA(n):`updating would discard your edits. Review ${Hl(t.storeDir)}, then run \`webflow skills update ${r} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${b(t.recordedSkillPath)} \u2192 ${b(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 MA(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function C1(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??Ve;return{kind:"skills.update",schemaVersion:eo,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:JA(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:KA(t,n,e.checkOnly),warnings:[...new Set(e.warnings)]}}function KA(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 F1(e){let{selected:t,states:r,localDigests:n,refs:o,options:i}=e,s=r[0],a=i.ref??s?.lock.source.ref??Ve,l=t.map(({state:c,key:p})=>{let f=c.lock.skills[p],m=aw(f),g=n.get(`${c.scope}\0${p}`)??null,h=m!==null&&!Mt(g,m);return{name:p,dir:f.dir,scope:c.scope,guard:"grid",state:h?"locally-modified":"unchanged",action:h?"skipped":"unchanged",recordedHash:m?.contentHash??null,upstreamHash:m?.contentHash??null,onDiskHash:g?.contentHash??null,agents:f.agents??[],droppedAgents:[],reason:h?"locally-modified":null,detail:h?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:f.commit,toCommit:null,skillPath:f.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:eo,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:KA(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function ow(e){return{kind:"skills.update",schemaVersion:eo,checkOnly:e.checkOnly,force:e.force,...e.cancelled===!0?{cancelled:!0}:{},scopes:e.scopes??[],source:{repo:"",ref:Ve,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 _1(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${X} ${b(r)}`);u.info(B_(e))}function aw(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function A1(e){let t=[];for(let r of e.agents??[]){let n=Br(r);n!==void 0&&t.push(n)}return t}function JA(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function BA(e){let t=e?.code;return typeof t=="string"?t:void 0}function iw(e){return b(e instanceof Error?e.message:String(e))}function R1(){let e=Vt();return e?_.forSkills({authToken:e}):null}function Hl(e){return oi(e)}var zA=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.
293
+ With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(Cc()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(Ea()).addOption(va()).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(_e()).addOption(re()).action(sp),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(Ea()).addOption(va()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(Ii()).addOption(_e()).addOption(re()).action(fp),t.command("list").description("List installed skills and the agents they are linked into").addOption(Ea()).addOption(va()).addOption(Cc()).addOption(We([...ii]).default(Tl)).addOption(Pi([...Ns]).default("name")).addOption(Ti()).addOption(re()).action(lp),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(Cc()).option("--all","Remove every installed skill for the scope").addOption(Ea()).addOption(va()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(Ii()).addOption(_e()).addOption(re()).action(pp)};var YA=w(ac());function lw(e,t){t.forEach(r=>{e.addOption(r())}),e.commands.forEach(r=>lw(r,t))}function XA(e){let t=YA.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(r,n){return qA.Help.prototype.formatHelp.call(this,r,n).split(`
294
+ `).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[dw(o)]:o.trim()===""?[o]:[P(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
293
295
  `)+`
294
- `}}).addOption(lm()).addOption(yE()).addOption(um()).addOption(dm()).addOption(pm()).showHelpAfterError(),Je()&&e.addOption(cm()),e.hook("preAction",async(n,r)=>{let o=n.opts();o.input?n.getOptionValueSource("input")==="cli"&&Uw(!0):Bw(!0),r.opts().json&&Hw(!0),Wn.start(),o.manifest&&Vw(o.manifest),Je()&&nb(ob(o.region));try{await F.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!et()&&await new Qs().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Wn.displayGrouped(),Wn.stop()}),Hb(e),US(e),bD(e),FE(e),lS(e),Je()&&RS(e),CE(e),XS(e),Wx(e),Yx(e),B_(e),iE(e),e.commands.forEach(n=>{_y(n,[lm,um,...Je()?[cm]:[],dm,pm])})}A();C();be();var K_=new G_.Command;H_(K_);function ij(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;mb(e,{prefix:r});let i=JSON.stringify({error:{message:t,context:o,missingFlag:n}});V_.default.writeSync(1,`${i}
295
- `)}K_.parseAsync().catch(e=>{if(!(e instanceof f&&e.skipLogging))if(et())ij(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)});
296
+ `}}).addOption(Uf()).addOption(Ak()).addOption(Hf()).addOption(Vf()).addOption(Gf()).showHelpAfterError(),Ke()&&e.addOption(Wf()),e.hook("preAction",async(r,n)=>{let o=r.opts();if(o.input?r.getOptionValueSource("input")==="cli"&&yb(!0):hb(!0),n.opts().json&&bb(!0),Jr.start(),o.manifest&&kb(o.manifest),Ke()){let i=Ob(o.region);$b(i),u.debug(`Region resolved to "${i}" (--region=${o.region??"unset"}, WEBFLOW_REGION=${process.env.WEBFLOW_REGION??"unset"})`)}else u.debug("Region targeting is beta-gated; not resolved on this build.");try{await _.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!Xe()&&await new pa().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Jr.displayGrouped(),Jr.stop()}),Ok(e),aC(e),dD(e),nv(e),zx(e),Ke()&&Yx(e),rv(e),hC(e),YC(e),iF(e),zA(e),XE(e),e.commands.forEach(r=>{lw(r,[Uf,Hf,...Ke()?[Wf]:[],Vf,Gf])})}R();C();we();var eR=new QA.Command;XA(eR);function I1(e){let t=e instanceof Error?e.message:String(e),r=e instanceof d?e.missingFlag:void 0,n=e instanceof d?e.prefix:void 0,o=n?bt(n).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;Gb(e,{prefix:n});let i=JSON.stringify({error:{message:t,context:o,missingFlag:r}});ZA.default.writeSync(1,`${i}
297
+ `)}eR.parseAsync().catch(e=>{if(!(e instanceof d&&e.skipLogging))if(Xe())I1(e);else if(e instanceof d)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)});
296
298
  //# sourceMappingURL=index.js.map