"use strict";exports.id=4447,exports.ids=[4447],exports.modules={61013:(a,b,c)=>{c.d(b,{EZ:()=>m,LK:()=>l,lp:()=>k});var d=c(73024),e=c.n(d),f=c(48161),g=c.n(f),h=c(76760),i=c.n(h);function j(){return i().join(g().homedir(),".atomar","config.json")}function k(){try{let a=e().readFileSync(j(),"utf-8"),b=JSON.parse(a),c=b?.anthropicApiKey;if("string"!=typeof c||""===c.trim())return null;return c.trim()}catch{return null}}function l(){try{let a=e().readFileSync(j(),"utf-8"),b=JSON.parse(a),c=b?.license;if(!c||"object"!=typeof c||Array.isArray(c))return null;let d=c.tier;if("string"!=typeof d||!d.trim())return null;return c}catch{return null}}function m(a){let b,c=i().dirname(j());e().mkdirSync(c,{recursive:!0});let d={};try{let a=e().readFileSync(j(),"utf-8"),b=JSON.parse(a);b&&"object"==typeof b&&!Array.isArray(b)&&(d=b)}catch{}let f=(a.tier??"free").trim()||"free";if("free"===f)b={tier:"free"};else for(let c of Object.keys(b={tier:f,licenseKey:a.licenseKey,instanceId:a.instanceId,productName:a.productName,subscriptionStatus:a.subscriptionStatus,validatedAt:a.validatedAt,expiresAt:a.expiresAt}))void 0===b[c]&&delete b[c];let g={...d,license:b,updatedAt:new Date().toISOString(),updatedBy:"forge0x2b"},h=`${j()}.tmp.${Date.now()}`;e().writeFileSync(h,JSON.stringify(g,null,2),{encoding:"utf-8",mode:384}),e().renameSync(h,j());try{e().chmodSync(j(),384)}catch{}}j()},84447:(a,b,c)=>{c.d(b,{f:()=>i,loadConfig:()=>j,q:()=>k});var d=c(51455),e=c.n(d),f=c(76760),g=c.n(f),h=c(61013);function i(a){return g().join(a,".forge/config.json")}async function j(a){let b={};try{let c=await e().readFile(i(a),"utf-8");b=JSON.parse(c)}catch{}if(!b.apiKey){let a=(0,h.lp)();a&&(b.apiKey=a)}return{version:1,...b}}async function k(a,b){let c=i(a),d=g().dirname(c);await e().mkdir(d,{recursive:!0});let f=c+".tmp."+Date.now();await e().writeFile(f,JSON.stringify(b,null,2),{encoding:"utf-8",mode:384}),await e().rename(f,c),await e().chmod(c,384)}}};