@frontfriend/sdk 1.2.0 → 1.2.2

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.
@@ -1 +1 @@
1
- var j=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var S=j((q,F)=>{F.exports={name:"@frontfriend/sdk",version:"1.2.0"}});var C=j(($,b)=>{var{name:w}=S();b.exports={PACKAGE_NAME:w}});var{PACKAGE_NAME:m}=C(),u=require("fs"),E=require("http"),O=require("https"),i=require("path"),g=["contracts","tokens","components"],T=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],k={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},x=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],I=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function A(n){try{return JSON.parse(u.readFileSync(n,"utf8"))}catch{return{}}}function h(n){if(n===void 0)return null;if(!Array.isArray(n)){let t=new Error("`adopt` in frontfriend.config.js must be an array.");throw t.code="FRONTFRIEND_CONFIG_VALIDATION",t}let e=n.filter(t=>!g.includes(t));if(e.length>0){let t=new Error(`Unknown Frontfriend adoption level: ${e.join(", ")}.`);throw t.code="FRONTFRIEND_CONFIG_VALIDATION",t}let o=n.includes("components")?2:n.includes("tokens")?1:0;return g.slice(0,o+1)}function _(n){for(let[e,o]of Object.entries(k)){let t=o.find(s=>u.existsSync(i.join(n,s)));if(!t)continue;let r=u.readFileSync(i.join(n,t),"utf8");return{buildTool:e,present:r.includes(`${m}/${e}`)}}return{buildTool:null,present:!1}}function v(n){let e=[i.join(n,"components","ui"),i.join(n,"src","components","ui"),i.join(n,"app","components","ui")].filter(r=>u.existsSync(r)),o=new Set;function t(r){for(let s of u.readdirSync(r,{withFileTypes:!0})){let c=i.join(r,s.name);if(s.isDirectory())t(c);else if(/\.(js|jsx|ts|tsx|vue)$/.test(s.name)){if(!u.readFileSync(c,"utf8").includes(m))continue;let a=i.basename(s.name,i.extname(s.name));o.add(a.toLowerCase()==="index"?i.basename(r):a.toLowerCase())}}}return e.forEach(t),[...o].sort()}function P(n){let e=A(i.join(n,"package.json")),o={...e.dependencies||{},...e.devDependencies||{}},t=o.tailwindcss||null,s=[A(i.join(n,"components.json"))?.tailwind?.css,...T].filter(Boolean).find(a=>u.existsSync(i.join(n,a))),c=s?u.readFileSync(i.join(n,s),"utf8"):"",l=I.filter(a=>o[a]);return!l.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(c)&&!c.includes(`${m}/theme.css`)&&l.push("css-custom-properties"),{nativeTokens:{present:c.includes("/* Frontfriend managed native tokens: start */"),file:s||null},tailwind:{present:!!t,version:t,major:t&&Number((String(t).match(/\d+/)||[])[0])||null},componentsJson:u.existsSync(i.join(n,"components.json")),themeImport:{present:c.includes(`${m}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(c),file:s||null},plugin:_(n),frontfriendComponents:v(n),foreignComponentLibraries:x.filter(a=>o[a]),foreignTokenSystems:l}}function D(n,e){let o=h(n)||g,t=o.includes("tokens"),r=o.includes("components"),s=[];return t&&!e.themeImport.present&&!e.nativeTokens?.present&&s.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!t&&e.themeImport.present&&s.push("Frontfriend tokens are present in CSS but are not adopted in config."),r&&!e.componentsJson&&s.push("Config adopts components, but components.json was not observed."),!r&&e.frontfriendComponents.length>0&&s.push("Frontfriend components are installed but are not adopted in config."),s}function L({apiUrl:n,token:e,ffId:o,name:t,adopt:r,observed:s,framework:c,primitive:l}){if(!n||!e||!o||!t||!c||l===void 0)return Promise.resolve({reported:!1,unavailable:!0});let a=new URL("/api/apps/sync",n),y=JSON.stringify({ffId:o,name:t,adopt:h(r),observed:s,runtime:"sdk",framework:c,primitive:l}),N=a.protocol==="https:"?O:E;return new Promise(d=>{let f=N.request(a,{method:"POST",headers:{authorization:`Bearer ${e}`,"content-type":"application/json","content-length":Buffer.byteLength(y)}},p=>{p.resume(),p.on("end",()=>{p.statusCode>=200&&p.statusCode<300?d({reported:!0,unavailable:!1}):d({reported:!1,unavailable:!0})})});f.on("error",()=>d({reported:!1,unavailable:!0})),f.setTimeout(1500,()=>{f.destroy(),d({reported:!1,unavailable:!0})}),f.end(y)})}module.exports={ADOPTION_LEVELS:g,normalizeAdopt:h,probeAdoption:P,adoptionWarnings:D,reportAdoption:L};
1
+ var j=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var S=j((q,F)=>{F.exports={name:"@frontfriend/sdk",version:"1.2.2"}});var C=j(($,b)=>{var{name:w}=S();b.exports={PACKAGE_NAME:w}});var{PACKAGE_NAME:m}=C(),u=require("fs"),E=require("http"),O=require("https"),i=require("path"),g=["contracts","tokens","components"],T=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],k={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},x=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],I=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function A(n){try{return JSON.parse(u.readFileSync(n,"utf8"))}catch{return{}}}function h(n){if(n===void 0)return null;if(!Array.isArray(n)){let t=new Error("`adopt` in frontfriend.config.js must be an array.");throw t.code="FRONTFRIEND_CONFIG_VALIDATION",t}let e=n.filter(t=>!g.includes(t));if(e.length>0){let t=new Error(`Unknown Frontfriend adoption level: ${e.join(", ")}.`);throw t.code="FRONTFRIEND_CONFIG_VALIDATION",t}let o=n.includes("components")?2:n.includes("tokens")?1:0;return g.slice(0,o+1)}function _(n){for(let[e,o]of Object.entries(k)){let t=o.find(s=>u.existsSync(i.join(n,s)));if(!t)continue;let r=u.readFileSync(i.join(n,t),"utf8");return{buildTool:e,present:r.includes(`${m}/${e}`)}}return{buildTool:null,present:!1}}function v(n){let e=[i.join(n,"components","ui"),i.join(n,"src","components","ui"),i.join(n,"app","components","ui")].filter(r=>u.existsSync(r)),o=new Set;function t(r){for(let s of u.readdirSync(r,{withFileTypes:!0})){let c=i.join(r,s.name);if(s.isDirectory())t(c);else if(/\.(js|jsx|ts|tsx|vue)$/.test(s.name)){if(!u.readFileSync(c,"utf8").includes(m))continue;let a=i.basename(s.name,i.extname(s.name));o.add(a.toLowerCase()==="index"?i.basename(r):a.toLowerCase())}}}return e.forEach(t),[...o].sort()}function P(n){let e=A(i.join(n,"package.json")),o={...e.dependencies||{},...e.devDependencies||{}},t=o.tailwindcss||null,s=[A(i.join(n,"components.json"))?.tailwind?.css,...T].filter(Boolean).find(a=>u.existsSync(i.join(n,a))),c=s?u.readFileSync(i.join(n,s),"utf8"):"",l=I.filter(a=>o[a]);return!l.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(c)&&!c.includes(`${m}/theme.css`)&&l.push("css-custom-properties"),{nativeTokens:{present:c.includes("/* Frontfriend managed native tokens: start */"),file:s||null},tailwind:{present:!!t,version:t,major:t&&Number((String(t).match(/\d+/)||[])[0])||null},componentsJson:u.existsSync(i.join(n,"components.json")),themeImport:{present:c.includes(`${m}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(c),file:s||null},plugin:_(n),frontfriendComponents:v(n),foreignComponentLibraries:x.filter(a=>o[a]),foreignTokenSystems:l}}function D(n,e){let o=h(n)||g,t=o.includes("tokens"),r=o.includes("components"),s=[];return t&&!e.themeImport.present&&!e.nativeTokens?.present&&s.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!t&&e.themeImport.present&&s.push("Frontfriend tokens are present in CSS but are not adopted in config."),r&&!e.componentsJson&&s.push("Config adopts components, but components.json was not observed."),!r&&e.frontfriendComponents.length>0&&s.push("Frontfriend components are installed but are not adopted in config."),s}function L({apiUrl:n,token:e,ffId:o,name:t,adopt:r,observed:s,framework:c,primitive:l}){if(!n||!e||!o||!t||!c||l===void 0)return Promise.resolve({reported:!1,unavailable:!0});let a=new URL("/api/apps/sync",n),y=JSON.stringify({ffId:o,name:t,adopt:h(r),observed:s,runtime:"sdk",framework:c,primitive:l}),N=a.protocol==="https:"?O:E;return new Promise(d=>{let f=N.request(a,{method:"POST",headers:{authorization:`Bearer ${e}`,"content-type":"application/json","content-length":Buffer.byteLength(y)}},p=>{p.resume(),p.on("end",()=>{p.statusCode>=200&&p.statusCode<300?d({reported:!0,unavailable:!1}):d({reported:!1,unavailable:!0})})});f.on("error",()=>d({reported:!1,unavailable:!0})),f.setTimeout(1500,()=>{f.destroy(),d({reported:!1,unavailable:!0})}),f.end(y)})}module.exports={ADOPTION_LEVELS:g,normalizeAdopt:h,probeAdoption:P,adoptionWarnings:D,reportAdoption:L};
@@ -1,10 +1,10 @@
1
- var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var W=m((Ha,st)=>{var pn="https://app.frontfriend.dev",mn=".cache/frontfriend",En={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","keyframes.js","animations.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","iconLibrary.json","version.json","versionMetadata.json","metadata.json","base.json","nativeTokens.json"]},gn={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN",FF_MACHINE_TOKEN:"FRONTFRIEND_MACHINE_TOKEN"};function $n(t){if(!t)return null;try{let e=new URL(t);return e.hostname.startsWith("app.")?`${e.protocol}//${e.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}st.exports={DEFAULT_API_URL:pn,CACHE_DIR_NAME:mn,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:En,ENV_VARS:gn,deriveRegistryFromApiUrl:$n}});var we=m((Va,nt)=>{var me=class extends Error{constructor(e,r,s){super(e),this.name="APIError",this.statusCode=r,this.url=s,this.code=`API_${r}`}},Ee=class extends Error{constructor(e,r){super(e),this.name="CacheError",this.operation=r,this.code=`CACHE_${r.toUpperCase()}`}},ge=class extends Error{constructor(e,r){super(e),this.name="ConfigError",this.field=r,this.code=r?`CONFIG_${String(r).toUpperCase()}`:"CONFIG_ERROR"}},$e=class extends Error{constructor(e,r){super(e),this.name="ProcessingError",this.token=r,this.code="PROCESSING_ERROR"}};nt.exports={APIError:me,CacheError:Ee,ConfigError:ge,ProcessingError:$e}});var ot=m((Xa,it)=>{var R=require("fs");function wn(t){try{let e=R.readFileSync(t,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function Rn(t){try{return R.readFileSync(t,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function In(t,e,r=2){let s=JSON.stringify(e,null,r);R.writeFileSync(t,s,"utf8")}function Sn(t,e){R.writeFileSync(t,e,"utf8")}function yn(t,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let s=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;R.writeFileSync(t,s,"utf8")}else{let r=`module.exports = ${JSON.stringify(e,null,2)};`;R.writeFileSync(t,r,"utf8")}}function Tn(t){return R.existsSync(t)}function Nn(t){R.mkdirSync(t,{recursive:!0})}function An(t){R.rmSync(t,{recursive:!0,force:!0})}function Ln(t){R.rmSync(t,{force:!0})}function On(t,e){R.mkdirSync(require("path").dirname(t),{recursive:!0,mode:448});let r=`${t}.${process.pid}.${Date.now()}.tmp`;try{R.writeFileSync(r,`${JSON.stringify(e,null,2)}
2
- `,{mode:384}),R.renameSync(r,t);try{R.chmodSync(t,384)}catch{}}finally{R.rmSync(r,{force:!0})}}async function Cn(t,e,r){R.mkdirSync(require("path").dirname(t),{recursive:!0,mode:448});let s=`${t}.lock`,n=Date.now()+2e4,i;for(;i===void 0;)try{i=R.openSync(s,"wx",384),R.writeFileSync(i,String(process.pid))}catch(o){if(o.code!=="EEXIST")throw o;try{let a=Number(R.readFileSync(s,"utf8"));if(Number.isInteger(a)&&a>0)try{process.kill(a,0)}catch(c){if(c.code==="ESRCH"){R.unlinkSync(s);continue}}}catch(a){if(a.code==="ENOENT")continue}if(Date.now()>=n)throw r();await new Promise(a=>setTimeout(a,50))}try{return await e()}finally{R.closeSync(i),R.unlinkSync(s)}}it.exports={writePrivateJsonFileAtomic:On,withPrivateFileLock:Cn,readJsonFileSafe:wn,readFileSafe:Rn,writeJsonFile:In,writeTextFile:Sn,writeModuleExportsFile:yn,fileExists:Tn,ensureDirectoryExists:Nn,removeDirectory:An,removeFile:Ln}});var dt=m((Ja,ht)=>{var{fileExists:vn,readJsonFileSafe:qn,removeFile:xn,writePrivateJsonFileAtomic:Pn,withPrivateFileLock:Fn}=ot(),ct=require("path"),kn=require("os"),Dn=require("https"),_n=require("http"),{URL:F}=require("url"),{DEFAULT_API_URL:D}=W(),Un=ct.join(kn.homedir(),".frontfriend"),_=ct.join(Un,"credentials");function bn(){return _}function z(){try{return qn(_)}catch{return null}}function at(t){try{let e=JSON.parse(Buffer.from(String(t).split(".")[1],"base64url").toString("utf8"));return typeof e.email=="string"?e.email:null}catch{return null}}function jn(){let t=z();if(!t||!t.accessToken)return null;let e=Number(t.refreshExpiresAt)||0;return{email:at(t.accessToken),apiUrl:t.ffApiUrl||null,expired:e>0&&e<Date.now()}}function ut(t){Pn(_,t)}function Gn(){return vn(_)?(xn(_),!0):!1}function Re(t,e=60*1e3){return!t?.accessToken||!t.expiresAt||Date.now()+e>=t.expiresAt}function P(t){let e=new Error(`${t}. Run \`frontfriend login\` to re-authenticate.`);return e.code="FF_AUTH_REFRESH_FAILED",e}function lt(t,e,r){return new Promise((s,n)=>{let i=new F(t);if(i.protocol!=="https:"&&!(i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))){n(new Error("Frontfriend API URLs require HTTPS except on localhost"));return}let o=i.protocol==="https:"?Dn:_n,a=JSON.stringify(e||{}),c=o.request({hostname:i.hostname,port:i.port,path:`${i.pathname}${i.search}`,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(a),...r?{authorization:`Bearer ${r}`}:{}}},u=>{let l="";u.on("data",h=>{l+=h}),u.on("end",()=>{if(u.statusCode>=300&&u.statusCode<400){let E=u.headers.location?` to ${u.headers.location}`:"",f=new Error(`HTTP ${u.statusCode}: redirected${E}`);f.statusCode=u.statusCode,f.body=l,n(f);return}let h=null;try{h=l?JSON.parse(l):null}catch{let f=u.headers["content-type"]||"unknown content-type",I=new Error(`Expected JSON from FrontFriend API at ${t}, but received ${f} (HTTP ${u.statusCode}). Check FF_API_URL or pass --api-url with the FrontFriend app URL.`);if(I.statusCode=u.statusCode,I.body=l,u.statusCode>=400){n(I);return}n(I);return}if(u.statusCode>=400){let E=new Error(h?.error_description||h?.error||`HTTP ${u.statusCode}`);E.statusCode=u.statusCode,E.body=h,n(E);return}s(h)})});c.setTimeout(15e3,()=>c.destroy(Object.assign(new Error("Frontfriend API request timed out"),{code:"ETIMEDOUT"}))),c.on("error",n),c.write(a),c.end()})}async function Mn(t){return Fn(_,t,()=>P("Another process is refreshing the session"))}async function ft(t,e=D){return Mn(async()=>{let r=z();if(r&&new F(r.ffApiUrl||D).origin===new F(e).origin){if(!Re(r))return r;t=r}return Hn(t,e)})}async function Hn(t,e=D){if(new F(e).origin!==new F(t.ffApiUrl||D).origin)throw P("The stored session belongs to a different API origin");if(!t?.refreshToken||!t?.deviceId)throw P("FrontFriend session expired");let r;try{r=await lt(`${e}/api/plugin/token`,{grant_type:"refresh_token",refresh_token:t.refreshToken,device_id:t.deviceId})}catch(n){throw Object.assign(P(n?.message||"Could not refresh FrontFriend session"),{cause:n})}if(!r?.access_token||!r?.refresh_token)throw P("Could not refresh FrontFriend session");let s={accessToken:r.access_token,refreshToken:r.refresh_token,deviceId:r.device_id||t.deviceId,expiresAt:Date.now()+(r.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(r.refresh_expires_in||604800)*1e3,ffApiUrl:e};return ut(s),s}async function Vn(t={}){if(t.envToken)return t.envToken;if(!t.skipCredentials){let e=z();if(e?.accessToken||e?.refreshToken){let r=t.baseURL||e.ffApiUrl||D;if(new F(r).origin!==new F(e.ffApiUrl||D).origin)throw P("The stored session belongs to a different API origin");return e.accessToken&&!Re(e)?e.accessToken:(await ft(e,r)).accessToken}}return t.configuredToken?(t.silent||console.warn("\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run `frontfriend login` to store credentials outside the repo."),t.configuredToken):null}ht.exports={accountEmail:at,signedInAccount:jn,getCredentialsPath:bn,readCredentials:z,writeCredentials:ut,deleteCredentials:Gn,isExpired:Re,postJson:lt,refreshCredentials:ft,resolveAuthToken:Vn,createAuthRefreshError:P}});var Rt=m((Ba,wt)=>{var{ConfigError:Xn}=we(),{DEFAULT_API_URL:Jn}=W(),pt="DESIGN_SYSTEM_REQUIRED",Ie="DESIGN_SYSTEM_NOT_FOUND",mt="DESIGN_SYSTEM_FORBIDDEN",Et="DESIGN_SYSTEM_OPERATION_DENIED",Bn=new Set(["TENANT_MISMATCH","RESOURCE_MISMATCH","UNAUTHENTICATED"]);function gt(t){return String(t||Jn).replace(/\/+$/,"")}function Yn({apiUrl:t,flagHint:e}){return[` 1. Create a Design System at ${gt(t)} (or open an existing one) and copy its ff-id.`," 2. Connect it to this project:"," npx frontfriend login"," npx frontfriend setup --ff-id <ff-id>",` or add "ff-id": "<ff-id>" to frontfriend.config.js${e?`, ${e}`:""}.`]}function $t({command:t,apiUrl:e,flagHint:r,reportOnly:s=!1}={}){return["\u{1F517} No Design System connected to this project.",` ${t?`\`frontfriend ${t}\` works`:"Frontfriend works"} on a Design System (ff-id), and frontfriend.config.js has none yet.`," Connect one first:",...Yn({apiUrl:e,flagHint:r}),...s?[]:[" Nothing in this project was changed."]]}var K=class extends Xn{constructor({command:e,apiUrl:r,flagHint:s}={}){let n=$t({command:e,apiUrl:r,flagHint:s});super(n.join(`
3
- `),"ff-id"),this.name="DesignSystemRequiredError",this.code=pt,this.command=e,this.lines=n}};function Wn(t,{command:e,apiUrl:r,flagHint:s}={}){if(t&&typeof t.ffId=="string"&&t.ffId.trim())return t.ffId;throw new K({command:e,apiUrl:r,flagHint:s})}function zn(t){if(!t)return null;try{let e=new URL(t),r=e.pathname.match(/\/design-systems\/([^/]+)/);return r?decodeURIComponent(r[1]):e.searchParams.get("ffId")}catch{return null}}function Kn(t){try{return new URL(t).origin}catch{return null}}function Qn(t,{ffId:e,apiUrl:r}={}){if(!t||typeof t!="object")return null;let s=t.statusCode,n=`${t.message||""} ${t.serverMessage||""}`,i=e||zn(t.url),o=i?`"${i}"`:"configured in frontfriend.config.js",a=gt(r||Kn(t.url));if(s===404&&(t.serverCode===Ie||/design system not found/i.test(n)))return{code:Ie,lines:[`\u{1F517} Design System ${o} was not found on ${a}.`," The ff-id in frontfriend.config.js does not match any Design System there."," Copy the ff-id again from the Design System in Frontfriend, or connect another one:"," npx frontfriend setup --ff-id <ff-id>"]};let c=/\/design-systems\/|[?&]ffId=/.test(t.url||"");return s===403&&c&&t.serverCode&&!Bn.has(t.serverCode)?{code:Et,lines:[`\u{1F512} Frontfriend denied this operation on Design System ${o}.`,` ${t.serverMessage||"The operation is not allowed."} (${t.serverCode})`," Your login reaches this Design System: check your workspace role and plan, or ask a workspace admin."]}:s===403&&c?{code:mt,lines:[`\u{1F512} Design System ${o} is not accessible with your current Frontfriend login or permissions.`," Sign in with an account that belongs to its workspace (npx frontfriend login),"," or ask the workspace administrator to invite your sign-in email. For help, contact support@frontfriend.dev."," or connect a Design System you can access:"," npx frontfriend setup --ff-id <ff-id>"]}:null}wt.exports={DESIGN_SYSTEM_REQUIRED:pt,DESIGN_SYSTEM_NOT_FOUND:Ie,DESIGN_SYSTEM_FORBIDDEN:mt,DESIGN_SYSTEM_OPERATION_DENIED:Et,DesignSystemRequiredError:K,missingDesignSystemLines:$t,requireDesignSystem:Wn,describeDesignSystemAccessError:Qn}});var Nt=m((Ya,Tt)=>{Tt.exports=yt;yt.sync=ei;var It=require("fs");function Zn(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var s=0;s<r.length;s++){var n=r[s].toLowerCase();if(n&&t.substr(-n.length).toLowerCase()===n)return!0}return!1}function St(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Zn(e,r)}function yt(t,e,r){It.stat(t,function(s,n){r(s,s?!1:St(n,t,e))})}function ei(t,e){return St(It.statSync(t),t,e)}});var vt=m((Wa,Ct)=>{Ct.exports=Lt;Lt.sync=ti;var At=require("fs");function Lt(t,e,r){At.stat(t,function(s,n){r(s,s?!1:Ot(n,e))})}function ti(t,e){return Ot(At.statSync(t),e)}function Ot(t,e){return t.isFile()&&ri(t,e)}function ri(t,e){var r=t.mode,s=t.uid,n=t.gid,i=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,h=r&u||r&c&&n===o||r&a&&s===i||r&l&&i===0;return h}});var xt=m((Ka,qt)=>{var za=require("fs"),Q;process.platform==="win32"||global.TESTING_WINDOWS?Q=Nt():Q=vt();qt.exports=Se;Se.sync=si;function Se(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,n){Se(t,e||{},function(i,o){i?n(i):s(o)})})}Q(t,e||{},function(s,n){s&&(s.code==="EACCES"||e&&e.ignoreErrors)&&(s=null,n=!1),r(s,n)})}function si(t,e){try{return Q.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var bt=m((Qa,Ut)=>{var U=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Pt=require("path"),ni=U?";":":",Ft=xt(),kt=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Dt=(t,e)=>{let r=e.colon||ni,s=t.match(/\//)||U&&t.match(/\\/)?[""]:[...U?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],n=U?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=U?n.split(r):[""];return U&&t.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:s,pathExt:i,pathExtExe:n}},_t=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:s,pathExt:n,pathExtExe:i}=Dt(t,e),o=[],a=u=>new Promise((l,h)=>{if(u===s.length)return e.all&&o.length?l(o):h(kt(t));let E=s[u],f=/^".*"$/.test(E)?E.slice(1,-1):E,I=Pt.join(f,t),v=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+I:I;l(c(v,u,0))}),c=(u,l,h)=>new Promise((E,f)=>{if(h===n.length)return E(a(l+1));let I=n[h];Ft(u+I,{pathExt:i},(v,dn)=>{if(!v&&dn)if(e.all)o.push(u+I);else return E(u+I);return E(c(u,l,h+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},ii=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:s,pathExtExe:n}=Dt(t,e),i=[];for(let o=0;o<r.length;o++){let a=r[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=Pt.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let h=0;h<s.length;h++){let E=l+s[h];try{if(Ft.sync(E,{pathExt:n}))if(e.all)i.push(E);else return E}catch{}}}if(e.all&&i.length)return i;if(e.nothrow)return null;throw kt(t)};Ut.exports=_t;_t.sync=ii});var Gt=m((Za,ye)=>{"use strict";var jt=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};ye.exports=jt;ye.exports.default=jt});var Xt=m((eu,Vt)=>{"use strict";var Mt=require("path"),oi=bt(),ci=Gt();function Ht(t,e){let r=t.options.env||process.env,s=process.cwd(),n=t.options.cwd!=null,i=n&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(t.options.cwd)}catch{}let o;try{o=oi.sync(t.command,{path:r[ci({env:r})],pathExt:e?Mt.delimiter:void 0})}catch{}finally{i&&process.chdir(s)}return o&&(o=Mt.resolve(n?t.options.cwd:"",o)),o}function ai(t){return Ht(t)||Ht(t,!0)}Vt.exports=ai});var Jt=m((tu,Ne)=>{"use strict";var Te=/([()\][%!^"`<>&|;, *?])/g;function ui(t){return t=t.replace(Te,"^$1"),t}function li(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Te,"^$1"),e&&(t=t.replace(Te,"^$1")),t}Ne.exports.command=ui;Ne.exports.argument=li});var Yt=m((ru,Bt)=>{"use strict";Bt.exports=/^#!(.*)/});var zt=m((su,Wt)=>{"use strict";var fi=Yt();Wt.exports=(t="")=>{let e=t.match(fi);if(!e)return null;let[r,s]=e[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?s:s?`${n} ${s}`:n}});var Qt=m((nu,Kt)=>{"use strict";var Ae=require("fs"),hi=zt();function di(t){let r=Buffer.alloc(150),s;try{s=Ae.openSync(t,"r"),Ae.readSync(s,r,0,150,0),Ae.closeSync(s)}catch{}return hi(r.toString())}Kt.exports=di});var rr=m((iu,tr)=>{"use strict";var pi=require("path"),Zt=Xt(),er=Jt(),mi=Qt(),Ei=process.platform==="win32",gi=/\.(?:com|exe)$/i,$i=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function wi(t){t.file=Zt(t);let e=t.file&&mi(t.file);return e?(t.args.unshift(t.file),t.command=e,Zt(t)):t.file}function Ri(t){if(!Ei)return t;let e=wi(t),r=!gi.test(e);if(t.options.forceShell||r){let s=$i.test(e);t.command=pi.normalize(t.command),t.command=er.command(t.command),t.args=t.args.map(i=>er.argument(i,s));let n=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${n}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Ii(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let s={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?s:Ri(s)}tr.exports=Ii});var ir=m((ou,nr)=>{"use strict";var Le=process.platform==="win32";function Oe(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Si(t,e){if(!Le)return;let r=t.emit;t.emit=function(s,n){if(s==="exit"){let i=sr(n,e);if(i)return r.call(t,"error",i)}return r.apply(t,arguments)}}function sr(t,e){return Le&&t===1&&!e.file?Oe(e.original,"spawn"):null}function yi(t,e){return Le&&t===1&&!e.file?Oe(e.original,"spawnSync"):null}nr.exports={hookChildProcess:Si,verifyENOENT:sr,verifyENOENTSync:yi,notFoundError:Oe}});var ar=m((cu,b)=>{"use strict";var or=require("child_process"),Ce=rr(),ve=ir();function cr(t,e,r){let s=Ce(t,e,r),n=or.spawn(s.command,s.args,s.options);return ve.hookChildProcess(n,s),n}function Ti(t,e,r){let s=Ce(t,e,r),n=or.spawnSync(s.command,s.args,s.options);return n.error=n.error||ve.verifyENOENTSync(n.status,s),n}b.exports=cr;b.exports.spawn=cr;b.exports.sync=Ti;b.exports._parse=Ce;b.exports._enoent=ve});var j=m((au,ur)=>{"use strict";var Ni="2.0.0",Ai=Number.MAX_SAFE_INTEGER||9007199254740991,Li=16,Oi=250,Ci=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ur.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Li,MAX_SAFE_BUILD_LENGTH:Oi,MAX_SAFE_INTEGER:Ai,RELEASE_TYPES:Ci,SEMVER_SPEC_VERSION:Ni,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var V=m((uu,lr)=>{"use strict";var vi=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};lr.exports=vi});var G=m((C,fr)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:qe,MAX_SAFE_BUILD_LENGTH:qi,MAX_LENGTH:xi}=j(),Pi=V();C=fr.exports={};var Fi=C.re=[],ki=C.safeRe=[],d=C.src=[],Di=C.safeSrc=[],p=C.t={},_i=0,xe="[a-zA-Z0-9-]",Ui=[["\\s",1],["\\d",xi],[xe,qi]],bi=t=>{for(let[e,r]of Ui)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},g=(t,e,r)=>{let s=bi(e),n=_i++;Pi(t,n,e),p[t]=n,d[n]=e,Di[n]=s,Fi[n]=new RegExp(e,r?"g":void 0),ki[n]=new RegExp(s,r?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*");g("NUMERICIDENTIFIERLOOSE","\\d+");g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${xe}*`);g("MAINVERSION",`(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})`);g("MAINVERSIONLOOSE",`(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})`);g("PRERELEASEIDENTIFIER",`(?:${d[p.NONNUMERICIDENTIFIER]}|${d[p.NUMERICIDENTIFIER]})`);g("PRERELEASEIDENTIFIERLOOSE",`(?:${d[p.NONNUMERICIDENTIFIER]}|${d[p.NUMERICIDENTIFIERLOOSE]})`);g("PRERELEASE",`(?:-(${d[p.PRERELEASEIDENTIFIER]}(?:\\.${d[p.PRERELEASEIDENTIFIER]})*))`);g("PRERELEASELOOSE",`(?:-?(${d[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[p.PRERELEASEIDENTIFIERLOOSE]})*))`);g("BUILDIDENTIFIER",`${xe}+`);g("BUILD",`(?:\\+(${d[p.BUILDIDENTIFIER]}(?:\\.${d[p.BUILDIDENTIFIER]})*))`);g("FULLPLAIN",`v?${d[p.MAINVERSION]}${d[p.PRERELEASE]}?${d[p.BUILD]}?`);g("FULL",`^${d[p.FULLPLAIN]}$`);g("LOOSEPLAIN",`[v=\\s]*${d[p.MAINVERSIONLOOSE]}${d[p.PRERELEASELOOSE]}?${d[p.BUILD]}?`);g("LOOSE",`^${d[p.LOOSEPLAIN]}$`);g("GTLT","((?:<|>)?=?)");g("XRANGEIDENTIFIERLOOSE",`${d[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);g("XRANGEIDENTIFIER",`${d[p.NUMERICIDENTIFIER]}|x|X|\\*`);g("XRANGEPLAIN",`[v=\\s]*(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:${d[p.PRERELEASE]})?${d[p.BUILD]}?)?)?`);g("XRANGEPLAINLOOSE",`[v=\\s]*(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:${d[p.PRERELEASELOOSE]})?${d[p.BUILD]}?)?)?`);g("XRANGE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAIN]}$`);g("XRANGELOOSE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAINLOOSE]}$`);g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${qe}})(?:\\.(\\d{1,${qe}}))?(?:\\.(\\d{1,${qe}}))?`);g("COERCE",`${d[p.COERCEPLAIN]}(?:$|[^\\d])`);g("COERCEFULL",d[p.COERCEPLAIN]+`(?:${d[p.PRERELEASE]})?(?:${d[p.BUILD]})?(?:$|[^\\d])`);g("COERCERTL",d[p.COERCE],!0);g("COERCERTLFULL",d[p.COERCEFULL],!0);g("LONETILDE","(?:~>?)");g("TILDETRIM",`(\\s*)${d[p.LONETILDE]}\\s+`,!0);C.tildeTrimReplace="$1~";g("TILDE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAIN]}$`);g("TILDELOOSE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAINLOOSE]}$`);g("LONECARET","(?:\\^)");g("CARETTRIM",`(\\s*)${d[p.LONECARET]}\\s+`,!0);C.caretTrimReplace="$1^";g("CARET",`^${d[p.LONECARET]}${d[p.XRANGEPLAIN]}$`);g("CARETLOOSE",`^${d[p.LONECARET]}${d[p.XRANGEPLAINLOOSE]}$`);g("COMPARATORLOOSE",`^${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]})$|^$`);g("COMPARATOR",`^${d[p.GTLT]}\\s*(${d[p.FULLPLAIN]})$|^$`);g("COMPARATORTRIM",`(\\s*)${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]}|${d[p.XRANGEPLAIN]})`,!0);C.comparatorTrimReplace="$1$2$3";g("HYPHENRANGE",`^\\s*(${d[p.XRANGEPLAIN]})\\s+-\\s+(${d[p.XRANGEPLAIN]})\\s*$`);g("HYPHENRANGELOOSE",`^\\s*(${d[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[p.XRANGEPLAINLOOSE]})\\s*$`);g("STAR","(<|>)?=?\\s*\\*");g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Z=m((lu,hr)=>{"use strict";var ji=Object.freeze({loose:!0}),Gi=Object.freeze({}),Mi=t=>t?typeof t!="object"?ji:t:Gi;hr.exports=Mi});var Pe=m((fu,mr)=>{"use strict";var dr=/^[0-9]+$/,pr=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=dr.test(t),s=dr.test(e);return r&&s&&(t=+t,e=+e),t===e?0:r&&!s?-1:s&&!r?1:t<e?-1:1},Hi=(t,e)=>pr(e,t);mr.exports={compareIdentifiers:pr,rcompareIdentifiers:Hi}});var y=m((hu,gr)=>{"use strict";var ee=V(),{MAX_LENGTH:Er,MAX_SAFE_INTEGER:te}=j(),{safeRe:re,t:se}=G(),Vi=Z(),{compareIdentifiers:Fe}=Pe(),Xi=(t,e)=>{let r=e.split(".");if(r.length>t.length)return!1;for(let s=0;s<r.length;s++)if(Fe(t[s],r[s])!==0)return!1;return!0},ke=class t{constructor(e,r){if(r=Vi(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Er)throw new TypeError(`version is longer than ${Er} characters`);ee("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=e.trim().match(r.loose?re[se.LOOSE]:re[se.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>te||this.major<0)throw new TypeError("Invalid major version");if(this.minor>te||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>te||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<te)return i}return n}):this.prerelease=[],this.build=s[5]?s[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(ee("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let s=this.prerelease[r],n=e.prerelease[r];if(ee("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return Fe(s,n)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let s=this.build[r],n=e.build[r];if(ee("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return Fe(s,n)}while(++r)}inc(e,r,s){if(e.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?re[se.PRERELEASELOOSE]:re[se.PRERELEASE]);if(!n||n[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];if(s===!1&&(i=[r]),Xi(this.prerelease,r)){let o=this.prerelease[r.split(".").length];isNaN(o)&&(this.prerelease=i)}else this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};gr.exports=ke});var q=m((du,wr)=>{"use strict";var $r=y(),Ji=(t,e,r=!1)=>{if(t instanceof $r)return t;try{return new $r(t,e)}catch(s){if(!r)return null;throw s}};wr.exports=Ji});var Ir=m((pu,Rr)=>{"use strict";var Bi=q(),Yi=(t,e)=>{let r=Bi(t,e);return r?r.version:null};Rr.exports=Yi});var yr=m((mu,Sr)=>{"use strict";var Wi=q(),zi=(t,e)=>{let r=Wi(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Sr.exports=zi});var Ar=m((Eu,Nr)=>{"use strict";var Tr=y(),Ki=(t,e,r,s,n)=>{typeof r=="string"&&(n=s,s=r,r=void 0);try{return new Tr(t instanceof Tr?t.version:t,r).inc(e,s,n).version}catch{return null}};Nr.exports=Ki});var Cr=m((gu,Or)=>{"use strict";var Lr=q(),Qi=(t,e)=>{let r=Lr(t,null,!0),s=Lr(e,null,!0),n=r.compare(s);if(n===0)return null;let i=n>0,o=i?r:s,a=i?s:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==s.major?l+"major":r.minor!==s.minor?l+"minor":r.patch!==s.patch?l+"patch":"prerelease"};Or.exports=Qi});var qr=m(($u,vr)=>{"use strict";var Zi=y(),eo=(t,e)=>new Zi(t,e).major;vr.exports=eo});var Pr=m((wu,xr)=>{"use strict";var to=y(),ro=(t,e)=>new to(t,e).minor;xr.exports=ro});var kr=m((Ru,Fr)=>{"use strict";var so=y(),no=(t,e)=>new so(t,e).patch;Fr.exports=no});var _r=m((Iu,Dr)=>{"use strict";var io=q(),oo=(t,e)=>{let r=io(t,e);return r&&r.prerelease.length?r.prerelease:null};Dr.exports=oo});var A=m((Su,br)=>{"use strict";var Ur=y(),co=(t,e,r)=>new Ur(t,r).compare(new Ur(e,r));br.exports=co});var Gr=m((yu,jr)=>{"use strict";var ao=A(),uo=(t,e,r)=>ao(e,t,r);jr.exports=uo});var Hr=m((Tu,Mr)=>{"use strict";var lo=A(),fo=(t,e)=>lo(t,e,!0);Mr.exports=fo});var ne=m((Nu,Xr)=>{"use strict";var Vr=y(),ho=(t,e,r)=>{let s=new Vr(t,r),n=new Vr(e,r);return s.compare(n)||s.compareBuild(n)};Xr.exports=ho});var Br=m((Au,Jr)=>{"use strict";var po=ne(),mo=(t,e)=>t.sort((r,s)=>po(r,s,e));Jr.exports=mo});var Wr=m((Lu,Yr)=>{"use strict";var Eo=ne(),go=(t,e)=>t.sort((r,s)=>Eo(s,r,e));Yr.exports=go});var X=m((Ou,zr)=>{"use strict";var $o=A(),wo=(t,e,r)=>$o(t,e,r)>0;zr.exports=wo});var ie=m((Cu,Kr)=>{"use strict";var Ro=A(),Io=(t,e,r)=>Ro(t,e,r)<0;Kr.exports=Io});var De=m((vu,Qr)=>{"use strict";var So=A(),yo=(t,e,r)=>So(t,e,r)===0;Qr.exports=yo});var _e=m((qu,Zr)=>{"use strict";var To=A(),No=(t,e,r)=>To(t,e,r)!==0;Zr.exports=No});var oe=m((xu,es)=>{"use strict";var Ao=A(),Lo=(t,e,r)=>Ao(t,e,r)>=0;es.exports=Lo});var ce=m((Pu,ts)=>{"use strict";var Oo=A(),Co=(t,e,r)=>Oo(t,e,r)<=0;ts.exports=Co});var Ue=m((Fu,rs)=>{"use strict";var vo=De(),qo=_e(),xo=X(),Po=oe(),Fo=ie(),ko=ce(),Do=(t,e,r,s)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return vo(t,r,s);case"!=":return qo(t,r,s);case">":return xo(t,r,s);case">=":return Po(t,r,s);case"<":return Fo(t,r,s);case"<=":return ko(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};rs.exports=Do});var ns=m((ku,ss)=>{"use strict";var _o=y(),Uo=q(),{safeRe:ae,t:ue}=G(),bo=(t,e)=>{if(t instanceof _o)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?ae[ue.COERCEFULL]:ae[ue.COERCE]);else{let c=e.includePrerelease?ae[ue.COERCERTLFULL]:ae[ue.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Uo(`${s}.${n}.${i}${o}${a}`,e)};ss.exports=bo});var os=m((Du,is)=>{"use strict";var jo=q(),Go=j(),Mo=y(),Ho=(t,e,r)=>{if(!Go.RELEASE_TYPES.includes(e))return null;let s=Vo(t,r);return s&&Xo(s,e)},Vo=(t,e)=>{let r=t instanceof Mo?t.version:t;return jo(r,e)},Xo=(t,e)=>{if(Jo(e))return t.version;switch(t.prerelease=[],e){case"major":t.minor=0,t.patch=0;break;case"minor":t.patch=0;break}return t.format()},Jo=t=>t.startsWith("pre");is.exports=Ho});var as=m((_u,cs)=>{"use strict";var be=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,r)}return this}};cs.exports=be});var L=m((Uu,hs)=>{"use strict";var Bo=/\s+/g,je=class t{constructor(e,r){if(r=Wo(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Ge)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Bo," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!ls(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&nc(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(sc,"");let s=((this.options.includePrerelease&&tc)|(this.options.loose&&rc))+":"+e,n=us.get(s);if(n)return n;let i=this.options.loose,o=i?N[T.HYPHENRANGELOOSE]:N[T.HYPHENRANGE];e=e.replace(o,mc(this.options.includePrerelease)),w("hyphen replace",e),e=e.replace(N[T.COMPARATORTRIM],Qo),w("comparator trim",e),e=e.replace(N[T.TILDETRIM],Zo),w("tilde trim",e),e=e.replace(N[T.CARETTRIM],ec),w("caret trim",e);let a=e.split(" ").map(h=>ic(h,this.options)).join(" ").split(/\s+/).map(h=>pc(h,this.options));i&&(a=a.filter(h=>(w("loose invalid filter",h,this.options),!!h.match(N[T.COMPARATORLOOSE])))),w("range list",a);let c=new Map,u=a.map(h=>new Ge(h,this.options));for(let h of u){if(ls(h))return[h];c.set(h.value,h)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return us.set(s,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>fs(s,r)&&e.set.some(n=>fs(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new zo(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Ec(this.set[r],e,this.options))return!0;return!1}};hs.exports=je;var Yo=as(),us=new Yo,Wo=Z(),Ge=J(),w=V(),zo=y(),{safeRe:N,src:Ko,t:T,comparatorTrimReplace:Qo,tildeTrimReplace:Zo,caretTrimReplace:ec}=G(),{FLAG_INCLUDE_PRERELEASE:tc,FLAG_LOOSE:rc}=j(),sc=new RegExp(Ko[T.BUILD],"g"),ls=t=>t.value==="<0.0.0-0",nc=t=>t.value==="",fs=(t,e)=>{let r=!0,s=t.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,e)),n=s.pop();return r},ic=(t,e)=>(t=t.replace(N[T.BUILD],""),w("comp",t,e),t=uc(t,e),w("caret",t),t=cc(t,e),w("tildes",t),t=fc(t,e),w("xrange",t),t=dc(t,e),w("stars",t),t),S=t=>!t||t.toLowerCase()==="x"||t==="*",oc=(t,e,r)=>S(t)&&!S(e)||S(e)&&r&&!S(r),cc=(t,e)=>t.trim().split(/\s+/).map(r=>ac(r,e)).join(" "),ac=(t,e)=>{let r=e.loose?N[T.TILDELOOSE]:N[T.TILDE],s=e.includePrerelease?"-0":"";return t.replace(r,(n,i,o,a,c)=>{w("tilde",t,n,i,o,a,c);let u;return S(i)?u="":S(o)?u=`>=${i}.0.0${s} <${+i+1}.0.0-0`:S(a)?u=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:c?(w("replaceTilde pr",c),u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`):u=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`,w("tilde return",u),u})},uc=(t,e)=>t.trim().split(/\s+/).map(r=>lc(r,e)).join(" "),lc=(t,e)=>{w("caret",t,e);let r=e.loose?N[T.CARETLOOSE]:N[T.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(n,i,o,a,c)=>{w("caret",t,n,i,o,a,c);let u;return S(i)?u="":S(o)?u=`>=${i}.0.0${s} <${+i+1}.0.0-0`:S(a)?i==="0"?u=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:c?(w("replaceCaret pr",c),i==="0"?o==="0"?u=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(w("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),w("caret return",u),u})},fc=(t,e)=>(w("replaceXRanges",t,e),t.split(/\s+/).map(r=>hc(r,e)).join(" ")),hc=(t,e)=>{t=t.trim();let r=e.loose?N[T.XRANGELOOSE]:N[T.XRANGE];return t.replace(r,(s,n,i,o,a,c)=>{if(w("xRange",t,s,n,i,o,a,c),oc(i,o,a))return t;let u=S(i),l=u||S(o),h=l||S(a),E=h;return n==="="&&E&&(n=""),c=e.includePrerelease?"-0":"",u?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&E?(l&&(o=0),a=0,n===">"?(n=">=",l?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",l?i=+i+1:o=+o+1),n==="<"&&(c="-0"),s=`${n+i}.${o}.${a}${c}`):l?s=`>=${i}.0.0${c} <${+i+1}.0.0-0`:h&&(s=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),w("xRange return",s),s})},dc=(t,e)=>(w("replaceStars",t,e),t.trim().replace(N[T.STAR],"")),pc=(t,e)=>(w("replaceGTE0",t,e),t.trim().replace(N[e.includePrerelease?T.GTE0PRE:T.GTE0],"")),mc=t=>(e,r,s,n,i,o,a,c,u,l,h,E)=>(S(s)?r="":S(n)?r=`>=${s}.0.0${t?"-0":""}`:S(i)?r=`>=${s}.${n}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,S(u)?c="":S(l)?c=`<${+u+1}.0.0-0`:S(h)?c=`<${u}.${+l+1}.0-0`:E?c=`<=${u}.${l}.${h}-${E}`:t?c=`<${u}.${l}.${+h+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Ec=(t,e,r)=>{for(let s=0;s<t.length;s++)if(!t[s].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let s=0;s<t.length;s++)if(w(t[s].semver),t[s].semver!==Ge.ANY&&t[s].semver.prerelease.length>0){let n=t[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var J=m((bu,$s)=>{"use strict";var B=Symbol("SemVer ANY"),Ve=class t{static get ANY(){return B}constructor(e,r){if(r=ds(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),He("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===B?this.value="":this.value=this.operator+this.semver.version,He("comp",this)}parse(e){let r=this.options.loose?ps[ms.COMPARATORLOOSE]:ps[ms.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new Es(s[2],this.options.loose):this.semver=B}toString(){return this.value}test(e){if(He("Comparator.test",e,this.options.loose),this.semver===B||e===B)return!0;if(typeof e=="string")try{e=new Es(e,this.options)}catch{return!1}return Me(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new gs(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new gs(this.value,r).test(e.semver):(r=ds(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Me(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Me(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};$s.exports=Ve;var ds=Z(),{safeRe:ps,t:ms}=G(),Me=Ue(),He=V(),Es=y(),gs=L()});var Y=m((ju,ws)=>{"use strict";var gc=L(),$c=(t,e,r)=>{try{e=new gc(e,r)}catch{return!1}return e.test(t)};ws.exports=$c});var Is=m((Gu,Rs)=>{"use strict";var wc=L(),Rc=(t,e)=>new wc(t,e).set.map(r=>r.map(s=>s.value).join(" ").trim().split(" "));Rs.exports=Rc});var ys=m((Mu,Ss)=>{"use strict";var Ic=y(),Sc=L(),yc=(t,e,r)=>{let s=null,n=null,i=null;try{i=new Sc(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===-1)&&(s=o,n=new Ic(s,r))}),s};Ss.exports=yc});var Ns=m((Hu,Ts)=>{"use strict";var Tc=y(),Nc=L(),Ac=(t,e,r)=>{let s=null,n=null,i=null;try{i=new Nc(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===1)&&(s=o,n=new Tc(s,r))}),s};Ts.exports=Ac});var Os=m((Vu,Ls)=>{"use strict";var Xe=y(),Lc=L(),As=X(),Oc=(t,e)=>{t=new Lc(t,e);let r=new Xe("0.0.0");if(t.test(r)||(r=new Xe("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s<t.set.length;++s){let n=t.set[s],i=null;n.forEach(o=>{let a=new Xe(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||As(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||As(r,i))&&(r=i)}return r&&t.test(r)?r:null};Ls.exports=Oc});var vs=m((Xu,Cs)=>{"use strict";var Cc=L(),vc=(t,e)=>{try{return new Cc(t,e).range||"*"}catch{return null}};Cs.exports=vc});var le=m((Ju,Fs)=>{"use strict";var qc=y(),Ps=J(),{ANY:xc}=Ps,Pc=L(),Fc=Y(),qs=X(),xs=ie(),kc=ce(),Dc=oe(),_c=(t,e,r,s)=>{t=new qc(t,s),e=new Pc(e,s);let n,i,o,a,c;switch(r){case">":n=qs,i=kc,o=xs,a=">",c=">=";break;case"<":n=xs,i=Dc,o=qs,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Fc(t,e,s))return!1;for(let u=0;u<e.set.length;++u){let l=e.set[u],h=null,E=null;if(l.forEach(f=>{f.semver===xc&&(f=new Ps(">=0.0.0")),h=h||f,E=E||f,n(f.semver,h.semver,s)?h=f:o(f.semver,E.semver,s)&&(E=f)}),h.operator===a||h.operator===c||(!E.operator||E.operator===a)&&i(t,E.semver))return!1;if(E.operator===c&&o(t,E.semver))return!1}return!0};Fs.exports=_c});var Ds=m((Bu,ks)=>{"use strict";var Uc=le(),bc=(t,e,r)=>Uc(t,e,">",r);ks.exports=bc});var Us=m((Yu,_s)=>{"use strict";var jc=le(),Gc=(t,e,r)=>jc(t,e,"<",r);_s.exports=Gc});var Gs=m((Wu,js)=>{"use strict";var bs=L(),Mc=(t,e,r)=>(t=new bs(t,r),e=new bs(e,r),t.intersects(e,r));js.exports=Mc});var Hs=m((zu,Ms)=>{"use strict";var Hc=Y(),Vc=A();Ms.exports=(t,e,r)=>{let s=[],n=null,i=null,o=t.sort((l,h)=>Vc(l,h,r));for(let l of o)Hc(l,e,r)?(i=l,n||(n=l)):(i&&s.push([n,i]),i=null,n=null);n&&s.push([n,null]);let a=[];for(let[l,h]of s)l===h?a.push(l):!h&&l===o[0]?a.push("*"):h?l===o[0]?a.push(`<=${h}`):a.push(`${l} - ${h}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length<u.length?c:e}});var Ws=m((Ku,Ys)=>{"use strict";var Vs=L(),Ye=J(),{ANY:Je}=Ye,Be=Y(),We=A(),Xc=(t,e,r={})=>{if(t===e)return!0;t=new Vs(t,r),e=new Vs(e,r);let s=!1;e:for(let n of t.set){for(let i of e.set){let o=Bc(n,i,r);if(s=s||o!==null,o)continue e}if(s)return!1}return!0},Jc=[new Ye(">=0.0.0-0")],Xs=[new Ye(">=0.0.0")],Bc=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Je){if(e.length===1&&e[0].semver===Je)return!0;r.includePrerelease?t=Jc:t=Xs}if(e.length===1&&e[0].semver===Je){if(r.includePrerelease)return!0;e=Xs}let s=new Set,n,i;for(let f of t)f.operator===">"||f.operator===">="?n=Js(n,f,r):f.operator==="<"||f.operator==="<="?i=Bs(i,f,r):s.add(f.semver);if(s.size>1)return null;let o;if(n&&i){if(o=We(n.semver,i.semver,r),o>0)return null;if(o===0&&(n.operator!==">="||i.operator!=="<="))return null}for(let f of s){if(n&&!Be(f,String(n),r)||i&&!Be(f,String(i),r))return null;for(let I of e)if(!Be(f,String(I),r))return!1;return!0}let a,c,u,l,h=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,E=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1;h&&h.prerelease.length===1&&i.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(l=l||f.operator===">"||f.operator===">=",u=u||f.operator==="<"||f.operator==="<=",n){if(E&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===E.major&&f.semver.minor===E.minor&&f.semver.patch===E.patch&&(E=!1),f.operator===">"||f.operator===">="){if(a=Js(n,f,r),a===f&&a!==n)return!1}else if(n.operator===">="&&!f.test(n.semver))return!1}if(i){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(c=Bs(i,f,r),c===f&&c!==i)return!1}else if(i.operator==="<="&&!f.test(i.semver))return!1}if(!f.operator&&(i||n)&&o!==0)return!1}return!(n&&u&&!i&&o!==0||i&&l&&!n&&o!==0||E||h)},Js=(t,e,r)=>{if(!t)return e;let s=We(t.semver,e.semver,r);return s>0?t:s<0||e.operator===">"&&t.operator===">="?e:t},Bs=(t,e,r)=>{if(!t)return e;let s=We(t.semver,e.semver,r);return s<0?t:s>0||e.operator==="<"&&t.operator==="<="?e:t};Ys.exports=Xc});var Zs=m((Qu,Qs)=>{"use strict";var ze=G(),zs=j(),Yc=y(),Ks=Pe(),Wc=q(),zc=Ir(),Kc=yr(),Qc=Ar(),Zc=Cr(),ea=qr(),ta=Pr(),ra=kr(),sa=_r(),na=A(),ia=Gr(),oa=Hr(),ca=ne(),aa=Br(),ua=Wr(),la=X(),fa=ie(),ha=De(),da=_e(),pa=oe(),ma=ce(),Ea=Ue(),ga=ns(),$a=os(),wa=J(),Ra=L(),Ia=Y(),Sa=Is(),ya=ys(),Ta=Ns(),Na=Os(),Aa=vs(),La=le(),Oa=Ds(),Ca=Us(),va=Gs(),qa=Hs(),xa=Ws();Qs.exports={parse:Wc,valid:zc,clean:Kc,inc:Qc,diff:Zc,major:ea,minor:ta,patch:ra,prerelease:sa,compare:na,rcompare:ia,compareLoose:oa,compareBuild:ca,sort:aa,rsort:ua,gt:la,lt:fa,eq:ha,neq:da,gte:pa,lte:ma,cmp:Ea,coerce:ga,truncate:$a,Comparator:wa,Range:Ra,satisfies:Ia,toComparators:Sa,maxSatisfying:ya,minSatisfying:Ta,minVersion:Na,validRange:Aa,outside:La,gtr:Oa,ltr:Ca,intersects:va,simplifyRange:qa,subset:xa,SemVer:Yc,re:ze.re,src:ze.src,tokens:ze.t,SEMVER_SPEC_VERSION:zs.SEMVER_SPEC_VERSION,RELEASE_TYPES:zs.RELEASE_TYPES,compareIdentifiers:Ks.compareIdentifiers,rcompareIdentifiers:Ks.rcompareIdentifiers}});var ln=m((Zu,un)=>{var x=require("fs"),O=require("path"),tn=ar(),k=Zs(),Ke=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function rn(t){let e=new Map;for(let r of t){let s=typeof r=="string"&&r.match(/^((?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*)(?:@([^\r\n]+))?$/);if(!s)throw new Error(`Invalid npm dependency: ${String(r)}`);let[,n,i]=s,o=e.get(n);e.set(n,o&&i?Pa(n,o,i):i||o)}return e}function Pa(t,e,r){if(e===r)return e;let s=k.validRange(e),n=k.validRange(r);if(s&&n)try{if(k.subset(n,s))return r;if(k.subset(s,n))return e}catch{}throw new Error(`Conflicting registry versions for ${t}: ${e} and ${r}`)}function sn(t,e){let r=typeof t=="string"&&k.validRange(t),s=k.validRange(e);if(!r||!s)return!1;try{return k.subset(r,s)}catch{return!1}}function nn(t,e){let r=rn(e);if(r.size===0)return;let s=O.join(t,"package.json"),n=JSON.parse(x.readFileSync(s,"utf8"));for(let[i,o]of r){let a=Ke.find(u=>Object.hasOwn(n[u]||{},i))||"dependencies";n[a]||={};let c=n[a][i];n[a][i]=o?sn(c,o)?c:o:c||"latest"}x.writeFileSync(s,`${JSON.stringify(n,null,2)}
4
- `)}function fe(t){let e=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["bun.lock","bun"],["bun.lockb","bun"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"]];for(let r=O.resolve(t);;r=O.dirname(r)){let s=O.join(r,"package.json");if(x.existsSync(s)){let n=JSON.parse(x.readFileSync(s,"utf8")),i=String(n.packageManager||"").split("@")[0];if(["npm","pnpm","yarn","bun"].includes(i))return i}for(let[n,i]of e)if(x.existsSync(O.join(r,n)))return i;if(O.dirname(r)===r)return"npm"}}var en={npm:"npx",pnpm:"pnpm exec",yarn:"yarn",bun:"bunx"};function Fa(t,e=process.cwd()){let r;try{r=fe(e)}catch{r="npm"}return`${en[r]||en.npm} frontfriend ${t}`}function Qe(t,e){let r=rn(e);if(r.size===0)return[];let s=JSON.parse(x.readFileSync(O.join(t,"package.json"),"utf8")),n=[];for(let[i,o]of r){let a=Ke.find(c=>Object.hasOwn(s[c]||{},i));a&&(!o||sn(s[a][i],o))||n.push(o?`${i}@${o}`:i)}return n}function on(t,e){return[t==="npm"?"install":"add",...e]}function ka(t){return/^[\w@/.:^~=+-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function cn(t,e){let r=fe(t);return[r,...on(r,e)].map(ka).join(" ")}function an(t,e,{stdio:r="inherit"}={}){let s=Qe(t,e);if(s.length===0)return;let n=fe(t),i=tn.sync(n,on(n,s),{cwd:t,stdio:r});if(i.error||i.status!==0)throw nn(t,e),i.error||new Error(`${n} dependency installation failed with status ${i.status}. Dependencies were saved; run ${n} install.`)}function Da(t,e,{install:r=!0,stdio:s="inherit",log:n=console.log}={}){let i=Qe(t,e);if(i.length===0)return{missing:i,command:null,installed:!1};let o=cn(t,i);if(!r)return n(`\u{1F4E6} Component dependencies missing from package.json. Install them with:
5
- ${o}`),{missing:i,command:o,installed:!1};n(`\u{1F4E6} Installing component dependencies: ${o}`);try{return an(t,i,{stdio:s}),{missing:i,command:o,installed:!0}}catch(a){return n(`\u26A0\uFE0F Component dependencies were not installed: ${a.message}
1
+ var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var V=m((Qa,it)=>{var $s="https://app.frontfriend.dev",ws=".cache/frontfriend",Rs={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","keyframes.js","animations.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","iconLibrary.json","version.json","versionMetadata.json","metadata.json","base.json","nativeTokens.json"]},Is={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN",FF_MACHINE_TOKEN:"FRONTFRIEND_MACHINE_TOKEN"};function ys(t){if(!t)return null;try{let e=new URL(t);return e.hostname.startsWith("app.")?`${e.protocol}//${e.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}it.exports={DEFAULT_API_URL:$s,CACHE_DIR_NAME:ws,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:Rs,ENV_VARS:Is,deriveRegistryFromApiUrl:ys}});var Re=m((Za,ot)=>{var Ee=class extends Error{constructor(e,r,n){super(e),this.name="APIError",this.statusCode=r,this.url=n,this.code=`API_${r}`}},ge=class extends Error{constructor(e,r){super(e),this.name="CacheError",this.operation=r,this.code=`CACHE_${r.toUpperCase()}`}},$e=class extends Error{constructor(e,r){super(e),this.name="ConfigError",this.field=r,this.code=r?`CONFIG_${String(r).toUpperCase()}`:"CONFIG_ERROR"}},we=class extends Error{constructor(e,r){super(e),this.name="ProcessingError",this.token=r,this.code="PROCESSING_ERROR"}};ot.exports={APIError:Ee,CacheError:ge,ConfigError:$e,ProcessingError:we}});var at=m((eu,ct)=>{var R=require("fs");function Ss(t){try{let e=R.readFileSync(t,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function Ts(t){try{return R.readFileSync(t,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function Ns(t,e,r=2){let n=JSON.stringify(e,null,r);R.writeFileSync(t,n,"utf8")}function As(t,e){R.writeFileSync(t,e,"utf8")}function Ls(t,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let n=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;R.writeFileSync(t,n,"utf8")}else{let r=`module.exports = ${JSON.stringify(e,null,2)};`;R.writeFileSync(t,r,"utf8")}}function Cs(t){return R.existsSync(t)}function Os(t){R.mkdirSync(t,{recursive:!0})}function vs(t){R.rmSync(t,{recursive:!0,force:!0})}function qs(t){R.rmSync(t,{force:!0})}function xs(t,e){R.mkdirSync(require("path").dirname(t),{recursive:!0,mode:448});let r=`${t}.${process.pid}.${Date.now()}.tmp`;try{R.writeFileSync(r,`${JSON.stringify(e,null,2)}
2
+ `,{mode:384}),R.renameSync(r,t);try{R.chmodSync(t,384)}catch{}}finally{R.rmSync(r,{force:!0})}}async function Ps(t,e,r){R.mkdirSync(require("path").dirname(t),{recursive:!0,mode:448});let n=`${t}.lock`,s=Date.now()+2e4,i;for(;i===void 0;)try{i=R.openSync(n,"wx",384),R.writeFileSync(i,String(process.pid))}catch(o){if(o.code!=="EEXIST")throw o;try{let a=Number(R.readFileSync(n,"utf8"));if(Number.isInteger(a)&&a>0)try{process.kill(a,0)}catch(c){if(c.code==="ESRCH"){R.unlinkSync(n);continue}}}catch(a){if(a.code==="ENOENT")continue}if(Date.now()>=s)throw r();await new Promise(a=>setTimeout(a,50))}try{return await e()}finally{R.closeSync(i),R.unlinkSync(n)}}ct.exports={writePrivateJsonFileAtomic:xs,withPrivateFileLock:Ps,readJsonFileSafe:Ss,readFileSafe:Ts,writeJsonFile:Ns,writeTextFile:As,writeModuleExportsFile:Ls,fileExists:Cs,ensureDirectoryExists:Os,removeDirectory:vs,removeFile:qs}});var dt=m((tu,ht)=>{ht.exports=ft;ft.sync=ks;var ut=require("fs");function Fs(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var s=r[n].toLowerCase();if(s&&t.substr(-s.length).toLowerCase()===s)return!0}return!1}function lt(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Fs(e,r)}function ft(t,e,r){ut.stat(t,function(n,s){r(n,n?!1:lt(s,t,e))})}function ks(t,e){return lt(ut.statSync(t),t,e)}});var $t=m((ru,gt)=>{gt.exports=mt;mt.sync=Ds;var pt=require("fs");function mt(t,e,r){pt.stat(t,function(n,s){r(n,n?!1:Et(s,e))})}function Ds(t,e){return Et(pt.statSync(t),e)}function Et(t,e){return t.isFile()&&Us(t,e)}function Us(t,e){var r=t.mode,n=t.uid,s=t.gid,i=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,h=r&u||r&c&&s===o||r&a&&n===i||r&l&&i===0;return h}});var Rt=m((su,wt)=>{var nu=require("fs"),z;process.platform==="win32"||global.TESTING_WINDOWS?z=dt():z=$t();wt.exports=Ie;Ie.sync=_s;function Ie(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,s){Ie(t,e||{},function(i,o){i?s(i):n(o)})})}z(t,e||{},function(n,s){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,s=!1),r(n,s)})}function _s(t,e){try{return z.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Lt=m((iu,At)=>{var D=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",It=require("path"),bs=D?";":":",yt=Rt(),St=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Tt=(t,e)=>{let r=e.colon||bs,n=t.match(/\//)||D&&t.match(/\\/)?[""]:[...D?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],s=D?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=D?s.split(r):[""];return D&&t.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:s}},Nt=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:s,pathExtExe:i}=Tt(t,e),o=[],a=u=>new Promise((l,h)=>{if(u===n.length)return e.all&&o.length?l(o):h(St(t));let E=n[u],f=/^".*"$/.test(E)?E.slice(1,-1):E,I=It.join(f,t),v=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+I:I;l(c(v,u,0))}),c=(u,l,h)=>new Promise((E,f)=>{if(h===s.length)return E(a(l+1));let I=s[h];yt(u+I,{pathExt:i},(v,gs)=>{if(!v&&gs)if(e.all)o.push(u+I);else return E(u+I);return E(c(u,l,h+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},js=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:s}=Tt(t,e),i=[];for(let o=0;o<r.length;o++){let a=r[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=It.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let h=0;h<n.length;h++){let E=l+n[h];try{if(yt.sync(E,{pathExt:s}))if(e.all)i.push(E);else return E}catch{}}}if(e.all&&i.length)return i;if(e.nothrow)return null;throw St(t)};At.exports=Nt;Nt.sync=js});var Ot=m((ou,ye)=>{"use strict";var Ct=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};ye.exports=Ct;ye.exports.default=Ct});var Pt=m((cu,xt)=>{"use strict";var vt=require("path"),Gs=Lt(),Ms=Ot();function qt(t,e){let r=t.options.env||process.env,n=process.cwd(),s=t.options.cwd!=null,i=s&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(t.options.cwd)}catch{}let o;try{o=Gs.sync(t.command,{path:r[Ms({env:r})],pathExt:e?vt.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return o&&(o=vt.resolve(s?t.options.cwd:"",o)),o}function Hs(t){return qt(t)||qt(t,!0)}xt.exports=Hs});var Ft=m((au,Te)=>{"use strict";var Se=/([()\][%!^"`<>&|;, *?])/g;function Vs(t){return t=t.replace(Se,"^$1"),t}function Xs(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Se,"^$1"),e&&(t=t.replace(Se,"^$1")),t}Te.exports.command=Vs;Te.exports.argument=Xs});var Dt=m((uu,kt)=>{"use strict";kt.exports=/^#!(.*)/});var _t=m((lu,Ut)=>{"use strict";var Js=Dt();Ut.exports=(t="")=>{let e=t.match(Js);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?n:n?`${s} ${n}`:s}});var jt=m((fu,bt)=>{"use strict";var Ne=require("fs"),Ys=_t();function Bs(t){let r=Buffer.alloc(150),n;try{n=Ne.openSync(t,"r"),Ne.readSync(n,r,0,150,0),Ne.closeSync(n)}catch{}return Ys(r.toString())}bt.exports=Bs});var Vt=m((hu,Ht)=>{"use strict";var Ws=require("path"),Gt=Pt(),Mt=Ft(),zs=jt(),Ks=process.platform==="win32",Qs=/\.(?:com|exe)$/i,Zs=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ei(t){t.file=Gt(t);let e=t.file&&zs(t.file);return e?(t.args.unshift(t.file),t.command=e,Gt(t)):t.file}function ti(t){if(!Ks)return t;let e=ei(t),r=!Qs.test(e);if(t.options.forceShell||r){let n=Zs.test(e);t.command=Ws.normalize(t.command),t.command=Mt.command(t.command),t.args=t.args.map(i=>Mt.argument(i,n));let s=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${s}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function ri(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:ti(n)}Ht.exports=ri});var Yt=m((du,Jt)=>{"use strict";var Ae=process.platform==="win32";function Le(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function ni(t,e){if(!Ae)return;let r=t.emit;t.emit=function(n,s){if(n==="exit"){let i=Xt(s,e);if(i)return r.call(t,"error",i)}return r.apply(t,arguments)}}function Xt(t,e){return Ae&&t===1&&!e.file?Le(e.original,"spawn"):null}function si(t,e){return Ae&&t===1&&!e.file?Le(e.original,"spawnSync"):null}Jt.exports={hookChildProcess:ni,verifyENOENT:Xt,verifyENOENTSync:si,notFoundError:Le}});var zt=m((pu,U)=>{"use strict";var Bt=require("child_process"),Ce=Vt(),Oe=Yt();function Wt(t,e,r){let n=Ce(t,e,r),s=Bt.spawn(n.command,n.args,n.options);return Oe.hookChildProcess(s,n),s}function ii(t,e,r){let n=Ce(t,e,r),s=Bt.spawnSync(n.command,n.args,n.options);return s.error=s.error||Oe.verifyENOENTSync(s.status,n),s}U.exports=Wt;U.exports.spawn=Wt;U.exports.sync=ii;U.exports._parse=Ce;U.exports._enoent=Oe});var _=m((mu,Kt)=>{"use strict";var oi="2.0.0",ci=Number.MAX_SAFE_INTEGER||9007199254740991,ai=16,ui=250,li=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Kt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:ai,MAX_SAFE_BUILD_LENGTH:ui,MAX_SAFE_INTEGER:ci,RELEASE_TYPES:li,SEMVER_SPEC_VERSION:oi,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var X=m((Eu,Qt)=>{"use strict";var fi=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Qt.exports=fi});var b=m((O,Zt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:ve,MAX_SAFE_BUILD_LENGTH:hi,MAX_LENGTH:di}=_(),pi=X();O=Zt.exports={};var mi=O.re=[],Ei=O.safeRe=[],d=O.src=[],gi=O.safeSrc=[],p=O.t={},$i=0,qe="[a-zA-Z0-9-]",wi=[["\\s",1],["\\d",di],[qe,hi]],Ri=t=>{for(let[e,r]of wi)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},g=(t,e,r)=>{let n=Ri(e),s=$i++;pi(t,s,e),p[t]=s,d[s]=e,gi[s]=n,mi[s]=new RegExp(e,r?"g":void 0),Ei[s]=new RegExp(n,r?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*");g("NUMERICIDENTIFIERLOOSE","\\d+");g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${qe}*`);g("MAINVERSION",`(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})`);g("MAINVERSIONLOOSE",`(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})`);g("PRERELEASEIDENTIFIER",`(?:${d[p.NONNUMERICIDENTIFIER]}|${d[p.NUMERICIDENTIFIER]})`);g("PRERELEASEIDENTIFIERLOOSE",`(?:${d[p.NONNUMERICIDENTIFIER]}|${d[p.NUMERICIDENTIFIERLOOSE]})`);g("PRERELEASE",`(?:-(${d[p.PRERELEASEIDENTIFIER]}(?:\\.${d[p.PRERELEASEIDENTIFIER]})*))`);g("PRERELEASELOOSE",`(?:-?(${d[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[p.PRERELEASEIDENTIFIERLOOSE]})*))`);g("BUILDIDENTIFIER",`${qe}+`);g("BUILD",`(?:\\+(${d[p.BUILDIDENTIFIER]}(?:\\.${d[p.BUILDIDENTIFIER]})*))`);g("FULLPLAIN",`v?${d[p.MAINVERSION]}${d[p.PRERELEASE]}?${d[p.BUILD]}?`);g("FULL",`^${d[p.FULLPLAIN]}$`);g("LOOSEPLAIN",`[v=\\s]*${d[p.MAINVERSIONLOOSE]}${d[p.PRERELEASELOOSE]}?${d[p.BUILD]}?`);g("LOOSE",`^${d[p.LOOSEPLAIN]}$`);g("GTLT","((?:<|>)?=?)");g("XRANGEIDENTIFIERLOOSE",`${d[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);g("XRANGEIDENTIFIER",`${d[p.NUMERICIDENTIFIER]}|x|X|\\*`);g("XRANGEPLAIN",`[v=\\s]*(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:${d[p.PRERELEASE]})?${d[p.BUILD]}?)?)?`);g("XRANGEPLAINLOOSE",`[v=\\s]*(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:${d[p.PRERELEASELOOSE]})?${d[p.BUILD]}?)?)?`);g("XRANGE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAIN]}$`);g("XRANGELOOSE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAINLOOSE]}$`);g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ve}})(?:\\.(\\d{1,${ve}}))?(?:\\.(\\d{1,${ve}}))?`);g("COERCE",`${d[p.COERCEPLAIN]}(?:$|[^\\d])`);g("COERCEFULL",d[p.COERCEPLAIN]+`(?:${d[p.PRERELEASE]})?(?:${d[p.BUILD]})?(?:$|[^\\d])`);g("COERCERTL",d[p.COERCE],!0);g("COERCERTLFULL",d[p.COERCEFULL],!0);g("LONETILDE","(?:~>?)");g("TILDETRIM",`(\\s*)${d[p.LONETILDE]}\\s+`,!0);O.tildeTrimReplace="$1~";g("TILDE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAIN]}$`);g("TILDELOOSE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAINLOOSE]}$`);g("LONECARET","(?:\\^)");g("CARETTRIM",`(\\s*)${d[p.LONECARET]}\\s+`,!0);O.caretTrimReplace="$1^";g("CARET",`^${d[p.LONECARET]}${d[p.XRANGEPLAIN]}$`);g("CARETLOOSE",`^${d[p.LONECARET]}${d[p.XRANGEPLAINLOOSE]}$`);g("COMPARATORLOOSE",`^${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]})$|^$`);g("COMPARATOR",`^${d[p.GTLT]}\\s*(${d[p.FULLPLAIN]})$|^$`);g("COMPARATORTRIM",`(\\s*)${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]}|${d[p.XRANGEPLAIN]})`,!0);O.comparatorTrimReplace="$1$2$3";g("HYPHENRANGE",`^\\s*(${d[p.XRANGEPLAIN]})\\s+-\\s+(${d[p.XRANGEPLAIN]})\\s*$`);g("HYPHENRANGELOOSE",`^\\s*(${d[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[p.XRANGEPLAINLOOSE]})\\s*$`);g("STAR","(<|>)?=?\\s*\\*");g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var K=m((gu,er)=>{"use strict";var Ii=Object.freeze({loose:!0}),yi=Object.freeze({}),Si=t=>t?typeof t!="object"?Ii:t:yi;er.exports=Si});var xe=m(($u,nr)=>{"use strict";var tr=/^[0-9]+$/,rr=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=tr.test(t),n=tr.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Ti=(t,e)=>rr(e,t);nr.exports={compareIdentifiers:rr,rcompareIdentifiers:Ti}});var S=m((wu,ir)=>{"use strict";var Q=X(),{MAX_LENGTH:sr,MAX_SAFE_INTEGER:Z}=_(),{safeRe:ee,t:te}=b(),Ni=K(),{compareIdentifiers:Pe}=xe(),Ai=(t,e)=>{let r=e.split(".");if(r.length>t.length)return!1;for(let n=0;n<r.length;n++)if(Pe(t[n],r[n])!==0)return!1;return!0},Fe=class t{constructor(e,r){if(r=Ni(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>sr)throw new TypeError(`version is longer than ${sr} characters`);Q("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?ee[te.LOOSE]:ee[te.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Z||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Z||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Z||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&i<Z)return i}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Q("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],s=e.prerelease[r];if(Q("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Pe(n,s)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],s=e.build[r];if(Q("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Pe(n,s)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let s=`-${r}`.match(this.options.loose?ee[te.PRERELEASELOOSE]:ee[te.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];if(n===!1&&(i=[r]),Ai(this.prerelease,r)){let o=this.prerelease[r.split(".").length];isNaN(o)&&(this.prerelease=i)}else this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};ir.exports=Fe});var x=m((Ru,cr)=>{"use strict";var or=S(),Li=(t,e,r=!1)=>{if(t instanceof or)return t;try{return new or(t,e)}catch(n){if(!r)return null;throw n}};cr.exports=Li});var ur=m((Iu,ar)=>{"use strict";var Ci=x(),Oi=(t,e)=>{let r=Ci(t,e);return r?r.version:null};ar.exports=Oi});var fr=m((yu,lr)=>{"use strict";var vi=x(),qi=(t,e)=>{let r=vi(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};lr.exports=qi});var pr=m((Su,dr)=>{"use strict";var hr=S(),xi=(t,e,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new hr(t instanceof hr?t.version:t,r).inc(e,n,s).version}catch{return null}};dr.exports=xi});var gr=m((Tu,Er)=>{"use strict";var mr=x(),Pi=(t,e)=>{let r=mr(t,null,!0),n=mr(e,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};Er.exports=Pi});var wr=m((Nu,$r)=>{"use strict";var Fi=S(),ki=(t,e)=>new Fi(t,e).major;$r.exports=ki});var Ir=m((Au,Rr)=>{"use strict";var Di=S(),Ui=(t,e)=>new Di(t,e).minor;Rr.exports=Ui});var Sr=m((Lu,yr)=>{"use strict";var _i=S(),bi=(t,e)=>new _i(t,e).patch;yr.exports=bi});var Nr=m((Cu,Tr)=>{"use strict";var ji=x(),Gi=(t,e)=>{let r=ji(t,e);return r&&r.prerelease.length?r.prerelease:null};Tr.exports=Gi});var A=m((Ou,Lr)=>{"use strict";var Ar=S(),Mi=(t,e,r)=>new Ar(t,r).compare(new Ar(e,r));Lr.exports=Mi});var Or=m((vu,Cr)=>{"use strict";var Hi=A(),Vi=(t,e,r)=>Hi(e,t,r);Cr.exports=Vi});var qr=m((qu,vr)=>{"use strict";var Xi=A(),Ji=(t,e)=>Xi(t,e,!0);vr.exports=Ji});var re=m((xu,Pr)=>{"use strict";var xr=S(),Yi=(t,e,r)=>{let n=new xr(t,r),s=new xr(e,r);return n.compare(s)||n.compareBuild(s)};Pr.exports=Yi});var kr=m((Pu,Fr)=>{"use strict";var Bi=re(),Wi=(t,e)=>t.sort((r,n)=>Bi(r,n,e));Fr.exports=Wi});var Ur=m((Fu,Dr)=>{"use strict";var zi=re(),Ki=(t,e)=>t.sort((r,n)=>zi(n,r,e));Dr.exports=Ki});var J=m((ku,_r)=>{"use strict";var Qi=A(),Zi=(t,e,r)=>Qi(t,e,r)>0;_r.exports=Zi});var ne=m((Du,br)=>{"use strict";var eo=A(),to=(t,e,r)=>eo(t,e,r)<0;br.exports=to});var ke=m((Uu,jr)=>{"use strict";var ro=A(),no=(t,e,r)=>ro(t,e,r)===0;jr.exports=no});var De=m((_u,Gr)=>{"use strict";var so=A(),io=(t,e,r)=>so(t,e,r)!==0;Gr.exports=io});var se=m((bu,Mr)=>{"use strict";var oo=A(),co=(t,e,r)=>oo(t,e,r)>=0;Mr.exports=co});var ie=m((ju,Hr)=>{"use strict";var ao=A(),uo=(t,e,r)=>ao(t,e,r)<=0;Hr.exports=uo});var Ue=m((Gu,Vr)=>{"use strict";var lo=ke(),fo=De(),ho=J(),po=se(),mo=ne(),Eo=ie(),go=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return lo(t,r,n);case"!=":return fo(t,r,n);case">":return ho(t,r,n);case">=":return po(t,r,n);case"<":return mo(t,r,n);case"<=":return Eo(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};Vr.exports=go});var Jr=m((Mu,Xr)=>{"use strict";var $o=S(),wo=x(),{safeRe:oe,t:ce}=b(),Ro=(t,e)=>{if(t instanceof $o)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?oe[ce.COERCEFULL]:oe[ce.COERCE]);else{let c=e.includePrerelease?oe[ce.COERCERTLFULL]:oe[ce.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return wo(`${n}.${s}.${i}${o}${a}`,e)};Xr.exports=Ro});var Br=m((Hu,Yr)=>{"use strict";var Io=x(),yo=_(),So=S(),To=(t,e,r)=>{if(!yo.RELEASE_TYPES.includes(e))return null;let n=No(t,r);return n&&Ao(n,e)},No=(t,e)=>{let r=t instanceof So?t.version:t;return Io(r,e)},Ao=(t,e)=>{if(Lo(e))return t.version;switch(t.prerelease=[],e){case"major":t.minor=0,t.patch=0;break;case"minor":t.patch=0;break}return t.format()},Lo=t=>t.startsWith("pre");Yr.exports=To});var zr=m((Vu,Wr)=>{"use strict";var _e=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(e,r)}return this}};Wr.exports=_e});var L=m((Xu,en)=>{"use strict";var Co=/\s+/g,be=class t{constructor(e,r){if(r=vo(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof je)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Co," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Qr(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&bo(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(_o,"");let n=((this.options.includePrerelease&&Do)|(this.options.loose&&Uo))+":"+e,s=Kr.get(n);if(s)return s;let i=this.options.loose,o=i?N[T.HYPHENRANGELOOSE]:N[T.HYPHENRANGE];e=e.replace(o,zo(this.options.includePrerelease)),w("hyphen replace",e),e=e.replace(N[T.COMPARATORTRIM],Po),w("comparator trim",e),e=e.replace(N[T.TILDETRIM],Fo),w("tilde trim",e),e=e.replace(N[T.CARETTRIM],ko),w("caret trim",e);let a=e.split(" ").map(h=>jo(h,this.options)).join(" ").split(/\s+/).map(h=>Wo(h,this.options));i&&(a=a.filter(h=>(w("loose invalid filter",h,this.options),!!h.match(N[T.COMPARATORLOOSE])))),w("range list",a);let c=new Map,u=a.map(h=>new je(h,this.options));for(let h of u){if(Qr(h))return[h];c.set(h.value,h)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return Kr.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Zr(n,r)&&e.set.some(s=>Zr(s,r)&&n.every(i=>s.every(o=>i.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new qo(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Ko(this.set[r],e,this.options))return!0;return!1}};en.exports=be;var Oo=zr(),Kr=new Oo,vo=K(),je=Y(),w=X(),qo=S(),{safeRe:N,src:xo,t:T,comparatorTrimReplace:Po,tildeTrimReplace:Fo,caretTrimReplace:ko}=b(),{FLAG_INCLUDE_PRERELEASE:Do,FLAG_LOOSE:Uo}=_(),_o=new RegExp(xo[T.BUILD],"g"),Qr=t=>t.value==="<0.0.0-0",bo=t=>t.value==="",Zr=(t,e)=>{let r=!0,n=t.slice(),s=n.pop();for(;r&&n.length;)r=n.every(i=>s.intersects(i,e)),s=n.pop();return r},jo=(t,e)=>(t=t.replace(N[T.BUILD],""),w("comp",t,e),t=Vo(t,e),w("caret",t),t=Mo(t,e),w("tildes",t),t=Jo(t,e),w("xrange",t),t=Bo(t,e),w("stars",t),t),y=t=>!t||t.toLowerCase()==="x"||t==="*",Go=(t,e,r)=>y(t)&&!y(e)||y(e)&&r&&!y(r),Mo=(t,e)=>t.trim().split(/\s+/).map(r=>Ho(r,e)).join(" "),Ho=(t,e)=>{let r=e.loose?N[T.TILDELOOSE]:N[T.TILDE],n=e.includePrerelease?"-0":"";return t.replace(r,(s,i,o,a,c)=>{w("tilde",t,s,i,o,a,c);let u;return y(i)?u="":y(o)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:y(a)?u=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:c?(w("replaceTilde pr",c),u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`):u=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`,w("tilde return",u),u})},Vo=(t,e)=>t.trim().split(/\s+/).map(r=>Xo(r,e)).join(" "),Xo=(t,e)=>{w("caret",t,e);let r=e.loose?N[T.CARETLOOSE]:N[T.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(s,i,o,a,c)=>{w("caret",t,s,i,o,a,c);let u;return y(i)?u="":y(o)?u=`>=${i}.0.0${n} <${+i+1}.0.0-0`:y(a)?i==="0"?u=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?(w("replaceCaret pr",c),i==="0"?o==="0"?u=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(w("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),w("caret return",u),u})},Jo=(t,e)=>(w("replaceXRanges",t,e),t.split(/\s+/).map(r=>Yo(r,e)).join(" ")),Yo=(t,e)=>{t=t.trim();let r=e.loose?N[T.XRANGELOOSE]:N[T.XRANGE];return t.replace(r,(n,s,i,o,a,c)=>{if(w("xRange",t,n,s,i,o,a,c),Go(i,o,a))return t;let u=y(i),l=u||y(o),h=l||y(a),E=h;return s==="="&&E&&(s=""),c=e.includePrerelease?"-0":"",u?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&E?(l&&(o=0),a=0,s===">"?(s=">=",l?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",l?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):l?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:h&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),w("xRange return",n),n})},Bo=(t,e)=>(w("replaceStars",t,e),t.trim().replace(N[T.STAR],"")),Wo=(t,e)=>(w("replaceGTE0",t,e),t.trim().replace(N[e.includePrerelease?T.GTE0PRE:T.GTE0],"")),zo=t=>(e,r,n,s,i,o,a,c,u,l,h,E)=>(y(n)?r="":y(s)?r=`>=${n}.0.0${t?"-0":""}`:y(i)?r=`>=${n}.${s}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,y(u)?c="":y(l)?c=`<${+u+1}.0.0-0`:y(h)?c=`<${u}.${+l+1}.0-0`:E?c=`<=${u}.${l}.${h}-${E}`:t?c=`<${u}.${l}.${+h+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Ko=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(w(t[n].semver),t[n].semver!==je.ANY&&t[n].semver.prerelease.length>0){let s=t[n].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var Y=m((Ju,cn)=>{"use strict";var B=Symbol("SemVer ANY"),He=class t{static get ANY(){return B}constructor(e,r){if(r=tn(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Me("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===B?this.value="":this.value=this.operator+this.semver.version,Me("comp",this)}parse(e){let r=this.options.loose?rn[nn.COMPARATORLOOSE]:rn[nn.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new sn(n[2],this.options.loose):this.semver=B}toString(){return this.value}test(e){if(Me("Comparator.test",e,this.options.loose),this.semver===B||e===B)return!0;if(typeof e=="string")try{e=new sn(e,this.options)}catch{return!1}return Ge(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new on(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new on(this.value,r).test(e.semver):(r=tn(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Ge(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Ge(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};cn.exports=He;var tn=K(),{safeRe:rn,t:nn}=b(),Ge=Ue(),Me=X(),sn=S(),on=L()});var W=m((Yu,an)=>{"use strict";var Qo=L(),Zo=(t,e,r)=>{try{e=new Qo(e,r)}catch{return!1}return e.test(t)};an.exports=Zo});var ln=m((Bu,un)=>{"use strict";var ec=L(),tc=(t,e)=>new ec(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));un.exports=tc});var hn=m((Wu,fn)=>{"use strict";var rc=S(),nc=L(),sc=(t,e,r)=>{let n=null,s=null,i=null;try{i=new nc(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new rc(n,r))}),n};fn.exports=sc});var pn=m((zu,dn)=>{"use strict";var ic=S(),oc=L(),cc=(t,e,r)=>{let n=null,s=null,i=null;try{i=new oc(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new ic(n,r))}),n};dn.exports=cc});var gn=m((Ku,En)=>{"use strict";var Ve=S(),ac=L(),mn=J(),uc=(t,e)=>{t=new ac(t,e);let r=new Ve("0.0.0");if(t.test(r)||(r=new Ve("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let s=t.set[n],i=null;s.forEach(o=>{let a=new Ve(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||mn(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||mn(r,i))&&(r=i)}return r&&t.test(r)?r:null};En.exports=uc});var wn=m((Qu,$n)=>{"use strict";var lc=L(),fc=(t,e)=>{try{return new lc(t,e).range||"*"}catch{return null}};$n.exports=fc});var ae=m((Zu,Sn)=>{"use strict";var hc=S(),yn=Y(),{ANY:dc}=yn,pc=L(),mc=W(),Rn=J(),In=ne(),Ec=ie(),gc=se(),$c=(t,e,r,n)=>{t=new hc(t,n),e=new pc(e,n);let s,i,o,a,c;switch(r){case">":s=Rn,i=Ec,o=In,a=">",c=">=";break;case"<":s=In,i=gc,o=Rn,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(mc(t,e,n))return!1;for(let u=0;u<e.set.length;++u){let l=e.set[u],h=null,E=null;if(l.forEach(f=>{f.semver===dc&&(f=new yn(">=0.0.0")),h=h||f,E=E||f,s(f.semver,h.semver,n)?h=f:o(f.semver,E.semver,n)&&(E=f)}),h.operator===a||h.operator===c||(!E.operator||E.operator===a)&&i(t,E.semver))return!1;if(E.operator===c&&o(t,E.semver))return!1}return!0};Sn.exports=$c});var Nn=m((el,Tn)=>{"use strict";var wc=ae(),Rc=(t,e,r)=>wc(t,e,">",r);Tn.exports=Rc});var Ln=m((tl,An)=>{"use strict";var Ic=ae(),yc=(t,e,r)=>Ic(t,e,"<",r);An.exports=yc});var vn=m((rl,On)=>{"use strict";var Cn=L(),Sc=(t,e,r)=>(t=new Cn(t,r),e=new Cn(e,r),t.intersects(e,r));On.exports=Sc});var xn=m((nl,qn)=>{"use strict";var Tc=W(),Nc=A();qn.exports=(t,e,r)=>{let n=[],s=null,i=null,o=t.sort((l,h)=>Nc(l,h,r));for(let l of o)Tc(l,e,r)?(i=l,s||(s=l)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[l,h]of n)l===h?a.push(l):!h&&l===o[0]?a.push("*"):h?l===o[0]?a.push(`<=${h}`):a.push(`${l} - ${h}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length<u.length?c:e}});var _n=m((sl,Un)=>{"use strict";var Pn=L(),Ye=Y(),{ANY:Xe}=Ye,Je=W(),Be=A(),Ac=(t,e,r={})=>{if(t===e)return!0;t=new Pn(t,r),e=new Pn(e,r);let n=!1;e:for(let s of t.set){for(let i of e.set){let o=Cc(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Lc=[new Ye(">=0.0.0-0")],Fn=[new Ye(">=0.0.0")],Cc=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Xe){if(e.length===1&&e[0].semver===Xe)return!0;r.includePrerelease?t=Lc:t=Fn}if(e.length===1&&e[0].semver===Xe){if(r.includePrerelease)return!0;e=Fn}let n=new Set,s,i;for(let f of t)f.operator===">"||f.operator===">="?s=kn(s,f,r):f.operator==="<"||f.operator==="<="?i=Dn(i,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(s&&i){if(o=Be(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let f of n){if(s&&!Je(f,String(s),r)||i&&!Je(f,String(i),r))return null;for(let I of e)if(!Je(f,String(I),r))return!1;return!0}let a,c,u,l,h=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,E=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;h&&h.prerelease.length===1&&i.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(l=l||f.operator===">"||f.operator===">=",u=u||f.operator==="<"||f.operator==="<=",s){if(E&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===E.major&&f.semver.minor===E.minor&&f.semver.patch===E.patch&&(E=!1),f.operator===">"||f.operator===">="){if(a=kn(s,f,r),a===f&&a!==s)return!1}else if(s.operator===">="&&!f.test(s.semver))return!1}if(i){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(c=Dn(i,f,r),c===f&&c!==i)return!1}else if(i.operator==="<="&&!f.test(i.semver))return!1}if(!f.operator&&(i||s)&&o!==0)return!1}return!(s&&u&&!i&&o!==0||i&&l&&!s&&o!==0||E||h)},kn=(t,e,r)=>{if(!t)return e;let n=Be(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Dn=(t,e,r)=>{if(!t)return e;let n=Be(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Un.exports=Ac});var Mn=m((il,Gn)=>{"use strict";var We=b(),bn=_(),Oc=S(),jn=xe(),vc=x(),qc=ur(),xc=fr(),Pc=pr(),Fc=gr(),kc=wr(),Dc=Ir(),Uc=Sr(),_c=Nr(),bc=A(),jc=Or(),Gc=qr(),Mc=re(),Hc=kr(),Vc=Ur(),Xc=J(),Jc=ne(),Yc=ke(),Bc=De(),Wc=se(),zc=ie(),Kc=Ue(),Qc=Jr(),Zc=Br(),ea=Y(),ta=L(),ra=W(),na=ln(),sa=hn(),ia=pn(),oa=gn(),ca=wn(),aa=ae(),ua=Nn(),la=Ln(),fa=vn(),ha=xn(),da=_n();Gn.exports={parse:vc,valid:qc,clean:xc,inc:Pc,diff:Fc,major:kc,minor:Dc,patch:Uc,prerelease:_c,compare:bc,rcompare:jc,compareLoose:Gc,compareBuild:Mc,sort:Hc,rsort:Vc,gt:Xc,lt:Jc,eq:Yc,neq:Bc,gte:Wc,lte:zc,cmp:Kc,coerce:Qc,truncate:Zc,Comparator:ea,Range:ta,satisfies:ra,toComparators:na,maxSatisfying:sa,minSatisfying:ia,minVersion:oa,validRange:ca,outside:aa,gtr:ua,ltr:la,intersects:fa,simplifyRange:ha,subset:da,SemVer:Oc,re:We.re,src:We.src,tokens:We.t,SEMVER_SPEC_VERSION:bn.SEMVER_SPEC_VERSION,RELEASE_TYPES:bn.RELEASE_TYPES,compareIdentifiers:jn.compareIdentifiers,rcompareIdentifiers:jn.rcompareIdentifiers}});var le=m((ol,Qn)=>{var P=require("fs"),C=require("path"),Vn=zt(),F=Mn(),{DEFAULT_API_URL:pa}=V(),ze=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function Xn(t){let e=new Map;for(let r of t){let n=typeof r=="string"&&r.match(/^((?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*)(?:@([^\r\n]+))?$/);if(!n)throw new Error(`Invalid npm dependency: ${String(r)}`);let[,s,i]=n,o=e.get(s);e.set(s,o&&i?ma(s,o,i):i||o)}return e}function ma(t,e,r){if(e===r)return e;let n=F.validRange(e),s=F.validRange(r);if(n&&s)try{if(F.subset(s,n))return r;if(F.subset(n,s))return e}catch{}throw new Error(`Conflicting registry versions for ${t}: ${e} and ${r}`)}function Jn(t,e){let r=typeof t=="string"&&F.validRange(t),n=F.validRange(e);if(!r||!n)return!1;try{return F.subset(r,n)}catch{return!1}}function Yn(t,e){let r=Xn(e);if(r.size===0)return;let n=C.join(t,"package.json"),s=JSON.parse(P.readFileSync(n,"utf8"));for(let[i,o]of r){let a=ze.find(u=>Object.hasOwn(s[u]||{},i))||"dependencies";s[a]||={};let c=s[a][i];s[a][i]=o?Jn(c,o)?c:o:c||"latest"}P.writeFileSync(n,`${JSON.stringify(s,null,2)}
3
+ `)}function ue(t){let e=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["bun.lock","bun"],["bun.lockb","bun"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"]];for(let r=C.resolve(t);;r=C.dirname(r)){let n=C.join(r,"package.json");if(P.existsSync(n)){let s=JSON.parse(P.readFileSync(n,"utf8")),i=String(s.packageManager||"").split("@")[0];if(["npm","pnpm","yarn","bun"].includes(i))return i}for(let[s,i]of e)if(P.existsSync(C.join(r,s)))return i;if(C.dirname(r)===r)return"npm"}}var Hn={npm:"npx",pnpm:"pnpm exec",yarn:"yarn",bun:"bunx"};function Bn(t,e=process.cwd()){let r;try{r=ue(e)}catch{r="npm"}return`${Hn[r]||Hn.npm} frontfriend ${t}`}function Ea(t,e=process.cwd()){let r=null;try{r=t?new URL(t).origin:null}catch{r=null}return Bn(r&&r!==new URL(pa).origin?`login --api-url ${r}`:"login",e)}function Ke(t,e){let r=Xn(e);if(r.size===0)return[];let n=JSON.parse(P.readFileSync(C.join(t,"package.json"),"utf8")),s=[];for(let[i,o]of r){let a=ze.find(c=>Object.hasOwn(n[c]||{},i));a&&(!o||Jn(n[a][i],o))||s.push(o?`${i}@${o}`:i)}return s}function Wn(t,e){return[t==="npm"?"install":"add",...e]}function ga(t){return/^[\w@/.:^~=+-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function zn(t,e){let r=ue(t);return[r,...Wn(r,e)].map(ga).join(" ")}function Kn(t,e,{stdio:r="inherit"}={}){let n=Ke(t,e);if(n.length===0)return;let s=ue(t),i=Vn.sync(s,Wn(s,n),{cwd:t,stdio:r});if(i.error||i.status!==0)throw Yn(t,e),i.error||new Error(`${s} dependency installation failed with status ${i.status}. Dependencies were saved; run ${s} install.`)}function $a(t,e,{install:r=!0,stdio:n="inherit",log:s=console.log}={}){let i=Ke(t,e);if(i.length===0)return{missing:i,command:null,installed:!1};let o=zn(t,i);if(!r)return s(`\u{1F4E6} Component dependencies missing from package.json. Install them with:
4
+ ${o}`),{missing:i,command:o,installed:!1};s(`\u{1F4E6} Installing component dependencies: ${o}`);try{return Kn(t,i,{stdio:n}),{missing:i,command:o,installed:!0}}catch(a){return s(`\u26A0\uFE0F Component dependencies were not installed: ${a.message}
6
5
  Install them with:
7
- ${o}`),{missing:i,command:o,installed:!1,error:a.message}}}function _a(t,e){for(let r=O.resolve(t);;r=O.dirname(r)){if(x.existsSync(O.join(r,"node_modules",e,"package.json")))return!0;if(O.dirname(r)===r)return!1}}function Ua(t,e,{install:r=!0,stdio:s="inherit",log:n=console.log}={}){let i=JSON.parse(x.readFileSync(O.join(t,"package.json"),"utf8"));if(!Ke.some(h=>Object.hasOwn(i[h]||{},e))||_a(t,e))return{installed:!1,command:null};let a=fe(t),c=`${a} install`;if(!r)return n(`\u{1F4E6} ${e} is in package.json but not installed. Install it with:
8
- ${c}`),{installed:!1,command:c};n(`\u{1F4E6} Installing ${e}: ${c}`);let u=tn.sync(a,["install"],{cwd:t,stdio:s});if(!u.error&&u.status===0)return{installed:!0,command:c};let l=u.error?u.error.message:`${a} install failed with status ${u.status}`;return n(`\u26A0\uFE0F ${e} was not installed: ${l}
6
+ ${o}`),{missing:i,command:o,installed:!1,error:a.message}}}function wa(t,e){for(let r=C.resolve(t);;r=C.dirname(r)){if(P.existsSync(C.join(r,"node_modules",e,"package.json")))return!0;if(C.dirname(r)===r)return!1}}function Ra(t,e,{install:r=!0,stdio:n="inherit",log:s=console.log}={}){let i=JSON.parse(P.readFileSync(C.join(t,"package.json"),"utf8"));if(!ze.some(h=>Object.hasOwn(i[h]||{},e))||wa(t,e))return{installed:!1,command:null};let a=ue(t),c=`${a} install`;if(!r)return s(`\u{1F4E6} ${e} is in package.json but not installed. Install it with:
7
+ ${c}`),{installed:!1,command:c};s(`\u{1F4E6} Installing ${e}: ${c}`);let u=Vn.sync(a,["install"],{cwd:t,stdio:n});if(!u.error&&u.status===0)return{installed:!0,command:c};let l=u.error?u.error.message:`${a} install failed with status ${u.status}`;return s(`\u26A0\uFE0F ${e} was not installed: ${l}
9
8
  Install it with:
10
- ${c}`),{installed:!1,command:c,error:l}}un.exports={cliCommand:Fa,installDeclaredPackage:Ua,saveNpmDependencies:nn,installNpmDependencies:an,installMissingNpmDependencies:Da,missingNpmDependencies:Qe,npmInstallCommand:cn}});var Ze=require("https"),et=require("http"),{URL:H}=require("url"),{DEFAULT_API_URL:ba,ENV_VARS:he}=W(),{APIError:$}=we(),{postJson:fn,resolveAuthToken:ja}=dt(),{describeDesignSystemAccessError:el}=Rt(),{cliCommand:Ga}=ln(),M=()=>`Authentication required. Run \`${Ga("login")}\` to sign in.`;function de(t){let e=new H(t);if(e.username||e.password||e.protocol!=="https:"&&!(e.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(e.hostname)))throw new Error("Frontfriend API URLs require HTTPS except on localhost, without URL credentials");return e}function hn(t,e,r,s,n,i){let o,a=setTimeout(()=>{let l=new $("Frontfriend API request timed out",408,e);i(l),o?.destroy(l)},n);a.unref?.();let c=()=>clearTimeout(a),u=l=>{l.once("end",c),l.once("error",c),l.once("aborted",()=>{c(),i(new $("Frontfriend API response was interrupted",0,e))}),s(l)};try{return o=r?t.get(new H(e),{headers:{authorization:`Bearer ${r}`}},u):t.get(e,u),o.once("error",c),o}catch(l){throw c(),l}}function tt(t,e=""){let r=t.headers?.location||"";return t.statusCode===401||t.statusCode===403||t.statusCode>=300&&t.statusCode<400&&r.includes("/sign-in")||String(e).trim().startsWith("/sign-in")}function pe(t,e,r=""){if(tt(t,r)){let c=new $(M(),t.statusCode,e);if(t.statusCode===403)try{let u=r?JSON.parse(r):null;typeof u?.code=="string"&&(c.serverCode=u.code);let l=u?.error||u?.message;typeof l=="string"&&(c.serverMessage=l)}catch{}return c}let s=t.statusMessage,n,i,o;try{let c=r?JSON.parse(r):null;n=c?.code||c?.error?.code,i=c?.currentVersion,typeof c?.message=="string"&&(o=c.message),typeof c?.error=="string"?s=c.error:typeof c?.error?.message=="string"&&(s=c.error.message);let u=[...Array.isArray(c?.cssErrors||c?.error?.details?.cssErrors)?(c.cssErrors||c.error.details.cssErrors).slice(0,5).map(l=>`${l.property}: ${l.className}`):[],...Array.isArray(c?.schemaErrors||c?.error?.details?.schemaErrors)?(c.schemaErrors||c.error.details.schemaErrors).slice(0,5):[]];u.length>0&&(s=`${s} (${u.join("; ")})`)}catch{}let a=new $(`HTTP ${t.statusCode}: ${s}`,t.statusCode,e);return n&&(a.code=n),i&&(a.currentVersion=i),o&&(a.serverMessage=o),a}var rt=class{constructor(e,r={}){if(this.ffId=e,this.baseURL=r.baseURL||process.env[he.FF_API_URL]||ba,de(this.baseURL),this.timeoutMs=r.timeoutMs??3e4,this.writeTimeoutMs=r.timeoutMs??18e4,!Number.isFinite(this.timeoutMs)||this.timeoutMs<=0)throw new Error("API timeout must be positive");this.configuredAuthToken=r.authToken||null,this.authToken=null,this.skipCredentials=r.skipCredentials}async getAuthToken(){return process.env[he.FF_MACHINE_TOKEN]?(this.authToken=process.env[he.FF_MACHINE_TOKEN],this.authToken):(this.authToken=await ja({baseURL:this.baseURL,envToken:process.env[he.FF_AUTH_TOKEN],configuredToken:this.configuredAuthToken,skipCredentials:this.skipCredentials}),this.authToken)}async fetchJson(e,r={}){let s=de(e),n=await this.getAuthToken();if(n&&s.origin!==new H(this.baseURL).origin)throw new Error("Refusing to send Frontfriend credentials to another API origin");return new Promise((i,o)=>{let a=e.startsWith("https")?Ze:et;hn(a,e,n,c=>{let u="";if(c.statusCode>=300&&(c.statusCode<400||r.readErrorBody===!1)){c.resume?.(),o(pe(c,e));return}c.on("data",l=>{u+=l}),c.on("end",()=>{if(c.statusCode>=300){o(pe(c,e,u));return}try{let l=JSON.parse(u);r.returnHeaders?i({data:l,headers:c.headers}):i(l)}catch(l){if(tt(c,u)){o(new $(M(),c.statusCode,e));return}o(new $(`Invalid JSON response: ${l.message}`,c.statusCode,e))}}),c.on("error",l=>{o(new $(`Response error: ${l.message}`,c.statusCode,e))})},this.timeoutMs,o).on("error",c=>{o(new $(`Network error: ${c.message}`,0,e))})})}async fetchRaw(e){let r=de(e),s=await this.getAuthToken();if(s&&r.origin!==new H(this.baseURL).origin)throw new Error("Refusing to send Frontfriend credentials to another API origin");return new Promise((n,i)=>{let o=e.startsWith("https")?Ze:et;hn(o,e,s,a=>{let c="";if(a.statusCode>=300){a.resume?.(),i(pe(a,e));return}a.on("data",u=>{c+=u}),a.on("end",()=>{n(c)}),a.on("error",u=>{i(new $(`Response error: ${u.message}`,a.statusCode,e))})},this.timeoutMs,i).on("error",a=>{i(new $(`Network error: ${a.message}`,0,e))})})}async fetchProcessedTokens(e={}){let r=new H(`${this.baseURL}/api/design-systems/${this.ffId}/processed-tokens`);e.tag&&r.searchParams.append("tag",e.tag),e.release&&r.searchParams.append("release",e.release),e.version&&r.searchParams.append("version",e.version),r.searchParams.set("colorFormat","oklch");let s=r.toString(),n=await this.fetchJson(s,{returnHeaders:!0,readErrorBody:!0});return n.headers&&(n.data.versionMetadata={version:n.headers["x-frontfriend-version"],versionId:n.headers["x-frontfriend-version-id"],releaseId:n.headers["x-frontfriend-release-id"],tag:n.headers["x-frontfriend-tag"],cached:n.headers["x-frontfriend-cached"]==="true"}),n.data}async sendJson(e,r,s){let n=de(e),i=await this.getAuthToken();if(!i)throw new $(M(),401,e);if(n.origin!==new H(this.baseURL).origin)throw new Error("Refusing to send Frontfriend credentials to another API origin");return new Promise((o,a)=>{let c,u=()=>clearTimeout(c),l=e.startsWith("https")?Ze:et,h=s===void 0?"":JSON.stringify(s||{}),E=l.request({hostname:n.hostname,port:n.port,path:`${n.pathname}${n.search}`,method:r,headers:{"content-type":"application/json","content-length":Buffer.byteLength(h),...i?{authorization:`Bearer ${i}`}:{}}},f=>{f.once("end",u),f.once("error",v=>{u(),a(new $(`Response error: ${v.message}`,0,e))}),f.once("aborted",()=>{u(),a(new $("Frontfriend API response was interrupted",0,e))});let I="";f.on("data",v=>{I+=v}),f.on("end",()=>{if(f.statusCode>=300){a(pe(f,e,I));return}if(!I){o(null);return}try{o(JSON.parse(I))}catch(v){if(tt(f,I)){a(new $(M(),f.statusCode,e));return}a(new $(`Invalid JSON response: ${v.message}`,f.statusCode,e))}})});c=setTimeout(()=>{let f=new $("Frontfriend API request timed out",408,e);a(f),E.destroy(f)},this.writeTimeoutMs),c.unref?.(),E.on("error",f=>{u(),a(new $(`Network error: ${f.message}`,0,e))}),E.write(h),E.end()})}async pushComponentsConfig(e,r,s,n={}){let i=`${this.baseURL}/api/design-systems/${this.ffId}/components-config`;if(!n.expectedVersionId)throw new $("expectedVersionId is required",0,i);let o={authoredComponentsConfig:e,expectedVersionId:n.expectedVersionId};return typeof r=="string"&&r.length>0&&(o.customCss=r),typeof s=="string"&&s.length>0&&(o.iconLibrary=s),n.themeStudioRecipe&&typeof n.themeStudioRecipe=="object"&&(o.themeStudioRecipe=n.themeStudioRecipe),this.sendJson(i,"PUT",o)}async migrateComponents(e){let r=`${this.baseURL}/api/design-systems/${this.ffId}/migrate`;return this.sendJson(r,"POST",e)}async importShadcn(e){return this.sendJson(`${this.baseURL}/api/design-systems/${this.ffId}/shadcn/import`,"POST",e)}async fetchCurrentVersionId(e={}){let r=typeof e=="string"?{tag:e}:e,s=r.version?`version=${encodeURIComponent(r.version)}`:r.tag?`tag=${encodeURIComponent(r.tag)}`:"root=true",n=`${this.baseURL}/api/design-systems/${this.ffId}/processed-tokens?${s}`,i=await this.fetchJson(n,{returnHeaders:!0,readErrorBody:!0});this.currentBaseLibrary=i?.data?.baseLibrary||i?.data?.base;let o=i?.headers||{};return o["x-frontfriend-version-id"]||o["X-Frontfriend-Version-Id"]}async listMigrationSnapshots(){let e=`${this.baseURL}/api/design-systems/${this.ffId}/migrate/snapshots`;return this.fetchJson(e)}async getMigrationSnapshot(e){let r=`${this.baseURL}/api/design-systems/${this.ffId}/migrate/snapshots/${e}`;return this.fetchJson(r)}async fetchPlanMetadata(e={}){if(!e.framework||!e.primitive)throw new $("Entitlement lookup requires an explicit Project target.",400);let r=`${this.baseURL}/api/design-systems/${this.ffId}/entitlements?framework=${encodeURIComponent(e.framework)}&primitive=${encodeURIComponent(e.primitive)}`,s=await this.fetchJson(r);if(s?.schemaVersion!==1||!s.canonicalCatalogue)throw new $("Unsupported entitlement response.",502,r);if(s.canonicalCatalogue.unavailable)throw new $("Entitlement policy unavailable.",503,r);return{access:"granted",subscriptionPlan:s.workspace.subscriptionPlan,freshPrivateSelection:s.capabilities?.freshPrivateSelection===!0||s.capabilities?.privateConsumption===!0,canonicalComponents:s.canonicalCatalogue.components,enforceCatalogue:!0,revisionId:s.canonicalCatalogue.revisionId}}async fetchReleaseChannels(){return this.fetchJson(`${this.baseURL}/api/design-systems/${this.ffId}/releases`)}async resolveReleaseTag({reference:e,appName:r,fallback:s}={}){let n=new URLSearchParams(e?{reference:e}:{app:r});return!e&&s&&n.set("fallback",s),this.sendJson(`${this.baseURL}/api/design-systems/${this.ffId}/workflow?${n}`,"GET")}async resolveContractRelease(e){let r=await this.fetchJson(`${this.baseURL}/api/design-systems/${this.ffId}/releases/${encodeURIComponent(e)}/resolve?runtime=sdk&contracts_only=true`);if(r.contractsOnly!==!0||r.runtime!=="sdk")throw new $("Upgrade the server before adopting contracts without a Project target.",400);return r}async resolveRelease(e,r){if(!r?.framework||!r?.primitive)throw new $("Release resolution requires an explicit Project target.",400);let s=`${this.baseURL}/api/design-systems/${this.ffId}/releases/${encodeURIComponent(e)}/resolve?runtime=sdk&framework=${encodeURIComponent(r.framework)}&primitive=${encodeURIComponent(r.primitive)}`,n=await this.fetchJson(s);if(n.runtime!=="sdk")throw new $("Upgrade the Frontfriend platform before adopting SDK Releases.",400,s);return n}async syncApplicationTarget(e,r={}){let s=await this.getAuthToken();if(!s)throw new $(M(),401);return fn(`${this.baseURL}/api/apps/sync`,{ffId:this.ffId,name:e.name,adopt:e.adopt,runtime:"sdk",releaseTagId:e.releaseTagId,expectedReleaseTagId:e.expectedReleaseTagId,framework:e.framework,primitive:e.primitive,dryRun:!!r.dryRun,contractsOnly:!!e.contractsOnly},s)}async publishPrivateComponent(e){let r=await this.getAuthToken();if(!r)throw new $(M(),401);try{return await fn(`${this.baseURL}/api/design-systems/${this.ffId}/components`,e,r)}catch(s){throw typeof s.body?.code=="string"&&(s.code=s.body.code),typeof s.body?.correlationId=="string"&&(s.correlationId=s.body.correlationId),s}}async authorizeEject(e={}){return this.sendJson(`${this.baseURL}/api/design-systems/${this.ffId}/eject`,"POST",e)}};module.exports={APIClient:rt};
9
+ ${c}`),{installed:!1,command:c,error:l}}Qn.exports={cliCommand:Bn,loginCommand:Ea,installDeclaredPackage:Ra,saveNpmDependencies:Yn,installNpmDependencies:Kn,installMissingNpmDependencies:$a,missingNpmDependencies:Ke,npmInstallCommand:zn}});var Ze=m((cl,os)=>{var{fileExists:Ia,readJsonFileSafe:ya,removeFile:Sa,writePrivateJsonFileAtomic:Ta,withPrivateFileLock:Na}=at(),Zn=require("path"),Aa=require("os"),La=require("https"),Ca=require("http"),{URL:q}=require("url"),{DEFAULT_API_URL:k}=V(),{cliCommand:es,loginCommand:Oa}=le(),va=Zn.join(Aa.homedir(),".frontfriend"),G=Zn.join(va,"credentials");function qa(){return G}function fe(){try{return ya(G)}catch{return null}}function ts(t){try{let e=JSON.parse(Buffer.from(String(t).split(".")[1],"base64url").toString("utf8"));return typeof e.email=="string"?e.email:null}catch{return null}}function xa(){let t=fe();if(!t||!t.accessToken)return null;let e=Number(t.refreshExpiresAt)||0;return{email:ts(t.accessToken),apiUrl:t.ffApiUrl||null,expired:e>0&&e<Date.now()}}function rs(t){Ta(G,t)}function Pa(){return Ia(G)?(Sa(G),!0):!1}function Qe(t,e=60*1e3){return!t?.accessToken||!t.expiresAt||Date.now()+e>=t.expiresAt}function j(t,{apiUrl:e,login:r,next:n}={}){let s=n||`Run \`${r||Oa(e)}\` to sign in, then run the command again.`,i=new Error(`${t}. ${s}`);return i.code="FF_AUTH_REFRESH_FAILED",i}function ns(t,e,r){return new Promise((n,s)=>{let i=new q(t);if(i.protocol!=="https:"&&!(i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))){s(new Error("Frontfriend API URLs require HTTPS except on localhost"));return}let o=i.protocol==="https:"?La:Ca,a=JSON.stringify(e||{}),c=o.request({hostname:i.hostname,port:i.port,path:`${i.pathname}${i.search}`,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(a),...r?{authorization:`Bearer ${r}`}:{}}},u=>{let l="";u.on("data",h=>{l+=h}),u.on("end",()=>{if(u.statusCode>=300&&u.statusCode<400){let E=u.headers.location?` to ${u.headers.location}`:"",f=new Error(`HTTP ${u.statusCode}: redirected${E}`);f.statusCode=u.statusCode,f.body=l,s(f);return}let h=null;try{h=l?JSON.parse(l):null}catch{let f=u.headers["content-type"]||"unknown content-type",I=new Error(`Expected JSON from FrontFriend API at ${t}, but received ${f} (HTTP ${u.statusCode}). Check FF_API_URL or pass --api-url with the FrontFriend app URL.`);if(I.statusCode=u.statusCode,I.body=l,u.statusCode>=400){s(I);return}s(I);return}if(u.statusCode>=400){let E=new Error(h?.error_description||h?.error||`HTTP ${u.statusCode}`);E.statusCode=u.statusCode,E.body=h,s(E);return}n(h)})});c.setTimeout(15e3,()=>c.destroy(Object.assign(new Error("Frontfriend API request timed out"),{code:"ETIMEDOUT"}))),c.on("error",s),c.write(a),c.end()})}function ss(t,e){let r=new q(t?.ffApiUrl||k).origin,n=new q(e).origin;return j(`You are signed in to ${r}, but this command uses ${n}`,{login:es(`login --api-url ${n}`)})}async function Fa(t){return Na(G,t,()=>j("Another Frontfriend command is renewing your sign-in",{next:"Wait for it to finish, then run the command again."}))}async function is(t,e=k){return Fa(async()=>{let r=fe();if(r&&new q(r.ffApiUrl||k).origin===new q(e).origin){if(!Qe(r))return r;t=r}return ka(t,e)})}async function ka(t,e=k){if(new q(e).origin!==new q(t.ffApiUrl||k).origin)throw ss(t,e);if(!t?.refreshToken||!t?.deviceId)throw j("Your Frontfriend sign-in has expired",{apiUrl:e});let r;try{r=await ns(`${e}/api/plugin/token`,{grant_type:"refresh_token",refresh_token:t.refreshToken,device_id:t.deviceId})}catch(s){throw Object.assign(j(s?.message?`Could not renew your Frontfriend sign-in (${s.message})`:"Could not renew your Frontfriend sign-in",{apiUrl:e}),{cause:s})}if(!r?.access_token||!r?.refresh_token)throw j("Could not renew your Frontfriend sign-in",{apiUrl:e});let n={accessToken:r.access_token,refreshToken:r.refresh_token,deviceId:r.device_id||t.deviceId,expiresAt:Date.now()+(r.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(r.refresh_expires_in||604800)*1e3,ffApiUrl:e};return rs(n),n}async function Da(t={}){if(t.envToken)return t.envToken;if(!t.skipCredentials){let e=fe();if(e?.accessToken||e?.refreshToken){let r=t.baseURL||e.ffApiUrl||k;if(new q(r).origin!==new q(e.ffApiUrl||k).origin)throw ss(e,r);return e.accessToken&&!Qe(e)?e.accessToken:(await is(e,r)).accessToken}}return t.configuredToken?(t.silent||console.warn(`\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run \`${es("login")}\` to keep your sign-in outside the repository.`),t.configuredToken):null}os.exports={accountEmail:ts,signedInAccount:xa,getCredentialsPath:qa,readCredentials:fe,writeCredentials:rs,deleteCredentials:Pa,isExpired:Qe,postJson:ns,refreshCredentials:is,resolveAuthToken:Da,createAuthRefreshError:j}});var ps=m((al,ds)=>{var{ConfigError:Ua}=Re(),{DEFAULT_API_URL:_a}=V(),{cliCommand:ba,loginCommand:ja}=le(),cs="DESIGN_SYSTEM_REQUIRED",et="DESIGN_SYSTEM_NOT_FOUND",as="DESIGN_SYSTEM_FORBIDDEN",us="DESIGN_SYSTEM_OPERATION_DENIED",Ga=new Set(["TENANT_MISMATCH","RESOURCE_MISMATCH","UNAUTHENTICATED"]);function ls(t){return String(t||_a).replace(/\/+$/,"")}function Ma({apiUrl:t,flagHint:e}){return[` 1. Create a Design System at ${ls(t)} (or open an existing one) and copy its ff-id.`," 2. Connect it to this project:"," npx frontfriend login"," npx frontfriend setup --ff-id <ff-id>",` or add "ff-id": "<ff-id>" to frontfriend.config.js${e?`, ${e}`:""}.`]}function fs({command:t,apiUrl:e,flagHint:r,reportOnly:n=!1}={}){return["\u{1F517} No Design System connected to this project.",` ${t?`\`frontfriend ${t}\` works`:"Frontfriend works"} on a Design System (ff-id), and frontfriend.config.js has none yet.`," Connect one first:",...Ma({apiUrl:e,flagHint:r}),...n?[]:[" Nothing in this project was changed."]]}var he=class extends Ua{constructor({command:e,apiUrl:r,flagHint:n}={}){let s=fs({command:e,apiUrl:r,flagHint:n});super(s.join(`
10
+ `),"ff-id"),this.name="DesignSystemRequiredError",this.code=cs,this.command=e,this.lines=s}};function Ha(t,{command:e,apiUrl:r,flagHint:n}={}){if(t&&typeof t.ffId=="string"&&t.ffId.trim())return t.ffId;throw new he({command:e,apiUrl:r,flagHint:n})}function Va(t){if(!t)return null;try{let e=new URL(t),r=e.pathname.match(/\/design-systems\/([^/]+)/);return r?decodeURIComponent(r[1]):e.searchParams.get("ffId")}catch{return null}}function Xa(t){try{return new URL(t).origin}catch{return null}}function Ja(){try{return Ze().signedInAccount()?.email||null}catch{return null}}function hs({ffId:t,apiUrl:e,email:r=Ja()}={}){return["\u{1F512} You don't have access to this design system yet.",` 1. Ask a workspace admin to invite ${r||"the email you sign in with"}.`," 2. Accept the invitation from the email you receive.",` 3. Run \`${ba("init")}\` again.`,` Signed in with another account? Run \`${ja(e)}\` to switch.`,...t?[` Reference for support: ${t}`]:[]]}function Ya(t,{ffId:e,apiUrl:r,email:n}={}){if(!t||typeof t!="object")return null;let s=t.statusCode,i=`${t.message||""} ${t.serverMessage||""}`,o=e||Va(t.url),a=o?`"${o}"`:"configured in frontfriend.config.js",c=ls(r||Xa(t.url));if(s===404&&(t.serverCode===et||/design system not found/i.test(i)))return{code:et,lines:[`\u{1F517} Design System ${a} was not found on ${c}.`," The ff-id in frontfriend.config.js does not match any Design System there."," Copy the ff-id again from the Design System in Frontfriend, or connect another one:"," npx frontfriend setup --ff-id <ff-id>"]};let u=/\/design-systems\/|[?&]ffId=/.test(t.url||"");return s===403&&u&&t.serverCode&&!Ga.has(t.serverCode)?{code:us,lines:[`\u{1F512} Frontfriend denied this operation on Design System ${a}.`,` ${t.serverMessage||"The operation is not allowed."} (${t.serverCode})`," Your login reaches this Design System: check your workspace role and plan, or ask a workspace admin."]}:s===403&&u?{code:as,lines:hs({ffId:o,apiUrl:c,email:n})}:null}ds.exports={DESIGN_SYSTEM_REQUIRED:cs,DESIGN_SYSTEM_NOT_FOUND:et,DESIGN_SYSTEM_FORBIDDEN:as,DESIGN_SYSTEM_OPERATION_DENIED:us,DesignSystemRequiredError:he,missingDesignSystemLines:fs,requireDesignSystem:Ha,describeDesignSystemAccessError:Ya,accessRefusalLines:hs}});var tt=require("https"),rt=require("http"),{URL:H}=require("url"),{DEFAULT_API_URL:Ba,ENV_VARS:de}=V(),{APIError:$}=Re(),{postJson:ms,resolveAuthToken:Wa}=Ze(),{describeDesignSystemAccessError:ul}=ps(),{loginCommand:za}=le(),M=t=>`Authentication required. Run \`${za(t)}\` to sign in, then run the command again.`;function pe(t){let e=new H(t);if(e.username||e.password||e.protocol!=="https:"&&!(e.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(e.hostname)))throw new Error("Frontfriend API URLs require HTTPS except on localhost, without URL credentials");return e}function Es(t,e,r,n,s,i){let o,a=setTimeout(()=>{let l=new $("Frontfriend API request timed out",408,e);i(l),o?.destroy(l)},s);a.unref?.();let c=()=>clearTimeout(a),u=l=>{l.once("end",c),l.once("error",c),l.once("aborted",()=>{c(),i(new $("Frontfriend API response was interrupted",0,e))}),n(l)};try{return o=r?t.get(new H(e),{headers:{authorization:`Bearer ${r}`}},u):t.get(e,u),o.once("error",c),o}catch(l){throw c(),l}}function nt(t,e=""){let r=t.headers?.location||"";return t.statusCode===401||t.statusCode===403||t.statusCode>=300&&t.statusCode<400&&r.includes("/sign-in")||String(e).trim().startsWith("/sign-in")}function me(t,e,r=""){if(nt(t,r)){let c=new $(M(e),t.statusCode,e);if(t.statusCode===403)try{let u=r?JSON.parse(r):null;typeof u?.code=="string"&&(c.serverCode=u.code);let l=u?.error||u?.message;typeof l=="string"&&(c.serverMessage=l)}catch{}return c}let n=t.statusMessage,s,i,o;try{let c=r?JSON.parse(r):null;s=c?.code||c?.error?.code,i=c?.currentVersion,typeof c?.message=="string"&&(o=c.message),typeof c?.error=="string"?n=c.error:typeof c?.error?.message=="string"&&(n=c.error.message);let u=[...Array.isArray(c?.cssErrors||c?.error?.details?.cssErrors)?(c.cssErrors||c.error.details.cssErrors).slice(0,5).map(l=>`${l.property}: ${l.className}`):[],...Array.isArray(c?.schemaErrors||c?.error?.details?.schemaErrors)?(c.schemaErrors||c.error.details.schemaErrors).slice(0,5):[]];u.length>0&&(n=`${n} (${u.join("; ")})`)}catch{}let a=new $(`HTTP ${t.statusCode}: ${n}`,t.statusCode,e);return s&&(a.code=s),i&&(a.currentVersion=i),o&&(a.serverMessage=o),a}var st=class{constructor(e,r={}){if(this.ffId=e,this.baseURL=r.baseURL||process.env[de.FF_API_URL]||Ba,pe(this.baseURL),this.timeoutMs=r.timeoutMs??3e4,this.writeTimeoutMs=r.timeoutMs??18e4,!Number.isFinite(this.timeoutMs)||this.timeoutMs<=0)throw new Error("API timeout must be positive");this.configuredAuthToken=r.authToken||null,this.authToken=null,this.skipCredentials=r.skipCredentials}async getAuthToken(){return process.env[de.FF_MACHINE_TOKEN]?(this.authToken=process.env[de.FF_MACHINE_TOKEN],this.authToken):(this.authToken=await Wa({baseURL:this.baseURL,envToken:process.env[de.FF_AUTH_TOKEN],configuredToken:this.configuredAuthToken,skipCredentials:this.skipCredentials}),this.authToken)}async fetchJson(e,r={}){let n=pe(e),s=await this.getAuthToken();if(s&&n.origin!==new H(this.baseURL).origin)throw new Error("Refusing to send Frontfriend credentials to another API origin");return new Promise((i,o)=>{let a=e.startsWith("https")?tt:rt;Es(a,e,s,c=>{let u="";if(c.statusCode>=300&&(c.statusCode<400||r.readErrorBody===!1)){c.resume?.(),o(me(c,e));return}c.on("data",l=>{u+=l}),c.on("end",()=>{if(c.statusCode>=300){o(me(c,e,u));return}try{let l=JSON.parse(u);r.returnHeaders?i({data:l,headers:c.headers}):i(l)}catch(l){if(nt(c,u)){o(new $(M(e),c.statusCode,e));return}o(new $(`Invalid JSON response: ${l.message}`,c.statusCode,e))}}),c.on("error",l=>{o(new $(`Response error: ${l.message}`,c.statusCode,e))})},this.timeoutMs,o).on("error",c=>{o(new $(`Network error: ${c.message}`,0,e))})})}async fetchRaw(e){let r=pe(e),n=await this.getAuthToken();if(n&&r.origin!==new H(this.baseURL).origin)throw new Error("Refusing to send Frontfriend credentials to another API origin");return new Promise((s,i)=>{let o=e.startsWith("https")?tt:rt;Es(o,e,n,a=>{let c="";if(a.statusCode>=300){a.resume?.(),i(me(a,e));return}a.on("data",u=>{c+=u}),a.on("end",()=>{s(c)}),a.on("error",u=>{i(new $(`Response error: ${u.message}`,a.statusCode,e))})},this.timeoutMs,i).on("error",a=>{i(new $(`Network error: ${a.message}`,0,e))})})}async fetchProcessedTokens(e={}){let r=new H(`${this.baseURL}/api/design-systems/${this.ffId}/processed-tokens`);e.tag&&r.searchParams.append("tag",e.tag),e.release&&r.searchParams.append("release",e.release),e.version&&r.searchParams.append("version",e.version),r.searchParams.set("colorFormat","oklch");let n=r.toString(),s=await this.fetchJson(n,{returnHeaders:!0,readErrorBody:!0});return s.headers&&(s.data.versionMetadata={version:s.headers["x-frontfriend-version"],versionId:s.headers["x-frontfriend-version-id"],releaseId:s.headers["x-frontfriend-release-id"],tag:s.headers["x-frontfriend-tag"],cached:s.headers["x-frontfriend-cached"]==="true"}),s.data}async sendJson(e,r,n){let s=pe(e),i=await this.getAuthToken();if(!i)throw new $(M(e),401,e);if(s.origin!==new H(this.baseURL).origin)throw new Error("Refusing to send Frontfriend credentials to another API origin");return new Promise((o,a)=>{let c,u=()=>clearTimeout(c),l=e.startsWith("https")?tt:rt,h=n===void 0?"":JSON.stringify(n||{}),E=l.request({hostname:s.hostname,port:s.port,path:`${s.pathname}${s.search}`,method:r,headers:{"content-type":"application/json","content-length":Buffer.byteLength(h),...i?{authorization:`Bearer ${i}`}:{}}},f=>{f.once("end",u),f.once("error",v=>{u(),a(new $(`Response error: ${v.message}`,0,e))}),f.once("aborted",()=>{u(),a(new $("Frontfriend API response was interrupted",0,e))});let I="";f.on("data",v=>{I+=v}),f.on("end",()=>{if(f.statusCode>=300){a(me(f,e,I));return}if(!I){o(null);return}try{o(JSON.parse(I))}catch(v){if(nt(f,I)){a(new $(M(e),f.statusCode,e));return}a(new $(`Invalid JSON response: ${v.message}`,f.statusCode,e))}})});c=setTimeout(()=>{let f=new $("Frontfriend API request timed out",408,e);a(f),E.destroy(f)},this.writeTimeoutMs),c.unref?.(),E.on("error",f=>{u(),a(new $(`Network error: ${f.message}`,0,e))}),E.write(h),E.end()})}async pushComponentsConfig(e,r,n,s={}){let i=`${this.baseURL}/api/design-systems/${this.ffId}/components-config`;if(!s.expectedVersionId)throw new $("expectedVersionId is required",0,i);let o={authoredComponentsConfig:e,expectedVersionId:s.expectedVersionId};return typeof r=="string"&&r.length>0&&(o.customCss=r),typeof n=="string"&&n.length>0&&(o.iconLibrary=n),s.themeStudioRecipe&&typeof s.themeStudioRecipe=="object"&&(o.themeStudioRecipe=s.themeStudioRecipe),this.sendJson(i,"PUT",o)}async migrateComponents(e){let r=`${this.baseURL}/api/design-systems/${this.ffId}/migrate`;return this.sendJson(r,"POST",e)}async importShadcn(e){return this.sendJson(`${this.baseURL}/api/design-systems/${this.ffId}/shadcn/import`,"POST",e)}async fetchCurrentVersionId(e={}){let r=typeof e=="string"?{tag:e}:e,n=r.version?`version=${encodeURIComponent(r.version)}`:r.tag?`tag=${encodeURIComponent(r.tag)}`:"root=true",s=`${this.baseURL}/api/design-systems/${this.ffId}/processed-tokens?${n}`,i=await this.fetchJson(s,{returnHeaders:!0,readErrorBody:!0});this.currentBaseLibrary=i?.data?.baseLibrary||i?.data?.base;let o=i?.headers||{};return o["x-frontfriend-version-id"]||o["X-Frontfriend-Version-Id"]}async listMigrationSnapshots(){let e=`${this.baseURL}/api/design-systems/${this.ffId}/migrate/snapshots`;return this.fetchJson(e)}async getMigrationSnapshot(e){let r=`${this.baseURL}/api/design-systems/${this.ffId}/migrate/snapshots/${e}`;return this.fetchJson(r)}async fetchPlanMetadata(e={}){if(!e.framework||!e.primitive)throw new $("Entitlement lookup requires an explicit Project target.",400);let r=`${this.baseURL}/api/design-systems/${this.ffId}/entitlements?framework=${encodeURIComponent(e.framework)}&primitive=${encodeURIComponent(e.primitive)}`,n=await this.fetchJson(r);if(n?.schemaVersion!==1||!n.canonicalCatalogue)throw new $("Unsupported entitlement response.",502,r);if(n.canonicalCatalogue.unavailable)throw new $("Entitlement policy unavailable.",503,r);return{access:"granted",subscriptionPlan:n.workspace.subscriptionPlan,freshPrivateSelection:n.capabilities?.freshPrivateSelection===!0||n.capabilities?.privateConsumption===!0,canonicalComponents:n.canonicalCatalogue.components,enforceCatalogue:!0,revisionId:n.canonicalCatalogue.revisionId}}async fetchReleaseChannels(){return this.fetchJson(`${this.baseURL}/api/design-systems/${this.ffId}/releases`)}async resolveReleaseTag({reference:e,appName:r,fallback:n}={}){let s=new URLSearchParams(e?{reference:e}:{app:r});return!e&&n&&s.set("fallback",n),this.sendJson(`${this.baseURL}/api/design-systems/${this.ffId}/workflow?${s}`,"GET")}async resolveContractRelease(e){let r=await this.fetchJson(`${this.baseURL}/api/design-systems/${this.ffId}/releases/${encodeURIComponent(e)}/resolve?runtime=sdk&contracts_only=true`);if(r.contractsOnly!==!0||r.runtime!=="sdk")throw new $("Upgrade the server before adopting contracts without a Project target.",400);return r}async resolveRelease(e,r){if(!r?.framework||!r?.primitive)throw new $("Release resolution requires an explicit Project target.",400);let n=`${this.baseURL}/api/design-systems/${this.ffId}/releases/${encodeURIComponent(e)}/resolve?runtime=sdk&framework=${encodeURIComponent(r.framework)}&primitive=${encodeURIComponent(r.primitive)}`,s=await this.fetchJson(n);if(s.runtime!=="sdk")throw new $("Upgrade the Frontfriend platform before adopting SDK Releases.",400,n);return s}async syncApplicationTarget(e,r={}){let n=await this.getAuthToken();if(!n)throw new $(M(this.baseURL),401);return ms(`${this.baseURL}/api/apps/sync`,{ffId:this.ffId,name:e.name,adopt:e.adopt,runtime:"sdk",releaseTagId:e.releaseTagId,expectedReleaseTagId:e.expectedReleaseTagId,framework:e.framework,primitive:e.primitive,dryRun:!!r.dryRun,contractsOnly:!!e.contractsOnly},n)}async publishPrivateComponent(e){let r=await this.getAuthToken();if(!r)throw new $(M(this.baseURL),401);try{return await ms(`${this.baseURL}/api/design-systems/${this.ffId}/components`,e,r)}catch(n){throw typeof n.body?.code=="string"&&(n.code=n.body.code),typeof n.body?.correlationId=="string"&&(n.correlationId=n.body.correlationId),n}}async authorizeEject(e={}){return this.sendJson(`${this.baseURL}/api/design-systems/${this.ffId}/eject`,"POST",e)}};module.exports={APIClient:st};