var f=Object.defineProperty;var p=(s,e,t)=>e in s?f(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var n=(s,e,t)=>(p(s,typeof e!="symbol"?e+"":e,t),t);import{a as l}from"./asyncComputed.5cff1726.js";import"./outputWidgets.91c9f730.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="9e72c3e6-4dac-42c2-a8b1-897adfc046b5",s._sentryDebugIdIdentifier="sentry-dbid-9e72c3e6-4dac-42c2-a8b1-897adfc046b5")}catch{}})();class h{async check(){return(await fetch("/_editor/api/linters/check")).json()}async fix(e,t){const a=await fetch(`/_editor/api/linters/fix/${e}/${t}`,{method:"POST"});if(!a.ok)throw new Error("Failed to fix");return i.refetch(),a.json()}}const u=new h,i=l(async()=>(await u.check()).map(e=>new w(e)));class y{constructor(e,t){n(this,"name");n(this,"label");n(this,"ruleName");this.name=e.name,this.label=e.label,this.ruleName=t}async fix(){await u.fix(this.ruleName,this.name)}}class m{constructor(e,t){n(this,"label");n(this,"fixes");this.ruleName=t,this.label=e.label,this.fixes=e.fixes.map(a=>new y(a,t))}}class w{constructor(e){n(this,"name");n(this,"label");n(this,"type");n(this,"issues");this.name=e.name,this.label=e.label,this.type=e.type,this.issues=e.issues.map(t=>new m(t,this.name))}static get asyncComputed(){return i}static fromName(e){var a;const t=(a=i.result.value)==null?void 0:a.find(d=>d.name===e);if(!t)throw new Error(`Rule ${e} not found`);return t}}class b{async list(){const e=await fetch("/_editor/api/env-vars");if(!e.ok)throw new Error("Failed to list env vars");return e.json()}async create(e,t){const a=await fetch("/_editor/api/env-vars",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})});return c.refetch(),a.json()}async delete(e){if(!(await fetch(`/_editor/api/env-vars/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to delete env vars");c.refetch()}}const o=new b,c=l(async()=>(await o.list()).map(e=>r.fromDto(e.key,e.value)));class r{constructor(e,t){this._key=e,this._value=t}static get listComputed(){return c}static fromDto(e,t){return new r(e,t)}get key(){return this._key}get value(){return this._value}static async create(e,t){const a=await o.create(e,t);return new r(a.key,a.value)}async delete(){await o.delete(this._key)}}export{r as E,w as L};
//# sourceMappingURL=envVars.bfc20846.js.map
