home-hosted 0.8.2 → 0.8.3

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.
@@ -36,11 +36,11 @@ Right: ${t}`,Xw=(e,t)=>`The intersection of two ordered unions is indeterminate:
36
36
  Left: ${e}
37
37
  Right: ${t}`,Zw={implementation:vS({kind:`unit`,hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:e=>e instanceof Date?e.toISOString():gS(e)}},normalize:e=>e,defaults:{description:e=>Ox(e.unit),problem:({expected:e,actual:t})=>`${e===t?`must be reference equal to ${e} (serialized to the same value)`:`must be ${e} (was ${t})`}`},intersections:{unit:(e,t)=>HS.init(`unit`,e,t),...gw(`unit`,(e,t)=>{if(t.allows(e.unit))return e;let n=t.hasKind(`intersection`)?t.basis:t;if(n){let t=n.hasKind(`domain`)?n:q.intrinsic.object;if(e.domain!==t.domain){let n=e.domain===`undefined`||e.domain===`null`||e.domain===`boolean`?e.domain:q.intrinsic[e.domain];return HS.init(`domain`,n,t)}}return HS.init(`assignability`,e,t.hasKind(`intersection`)?t.children.find(t=>!t.allows(e.unit)):t)})}}),Node:class extends Cw{compiledValue=this.json.unit;serializedValue=typeof this.unit==`string`||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Qw(this.unit,this.serializedValue);compiledNegation=Qw(this.unit,this.serializedValue,`negated`);expression=Ox(this.unit);domain=Qy(this.unit);get defaultShortDescription(){return this.domain===`object`?$y.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:`null`}:q.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:e.fallback.unit({code:`unit`,base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?e=>e instanceof Date&&e.toISOString()===this.compiledValue:Number.isNaN(this.unit)?e=>Number.isNaN(e):e=>e===this.unit}},Qw=(e,t,n)=>{if(e instanceof Date){let e=`data instanceof Date && data.toISOString() === ${t}`;return n?`!(${e})`:e}return Number.isNaN(e)?`${n?`!`:``}Number.isNaN(data)`:`data ${n?`!`:`=`}== ${t}`},$w={implementation:vS({kind:`index`,hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(e,t)=>{let n=t.$.parseSchema(e);if(!n.extends(q.intrinsic.key))return K(tT(n.expression));let r=n.branches.filter(e=>e.hasKind(`unit`));return r.length?K(eT(r.map(e=>Ox(e.unit)))):n}},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)}},normalize:e=>e,defaults:{description:e=>`[${e.signature.expression}]: ${e.value.description}`},intersections:{index:(e,t,n)=>{if(e.signature.equals(t.signature)){let r=YS(e.value,t.value,n),i=r instanceof HS?q.intrinsic.never.internal:r;return n.$.node(`index`,{signature:e.signature,value:i})}return e.signature.extends(t.signature)&&e.value.subsumes(t.value)?t:t.signature.extends(e.signature)&&t.value.subsumes(e.value)?e:null}}}),Node:class extends eC{impliedBasis=q.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Gy(this.value.flatRefs.map(e=>RS([this.signature,...e.path],e.node)),RS([this.signature],this.value));traverseAllows=(e,t)=>gb(e).every(e=>!this.signature.traverseAllows(e[0],t)||jS(e[0],()=>this.value.traverseAllows(e[1],t),t));traverseApply=(e,t)=>{for(let n of gb(e))this.signature.traverseAllows(n[0],t)&&jS(n[0],()=>this.value.traverseApply(n[1],t),t)};_transform(e,t){t.path.push(this.signature);let n=super._transform(e,t);return t.path.pop(),n}compile(){}}},eT=e=>`Index keys ${e.join(`, `)} should be specified as named props.`,tT=e=>`Indexed key definition '${e}' must be a string or symbol`,nT={implementation:vS({kind:`required`,hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)}},normalize:e=>e,defaults:{description:e=>`${e.compiledKey}: ${e.value.description}`,expected:e=>e.missingValueDescription,actual:()=>`missing`},intersections:{required:ZC,optional:ZC}}),Node:class extends QC{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:`required`,missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=_S(this.errorContext)}},rT=vS({kind:`sequence`,hasAssociatedError:!1,collapsibleKey:`variadic`,keys:{prefix:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}},optionals:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}},defaultables:{child:e=>e.map(e=>e[0]),parse:(e,t)=>{if(e.length!==0)return e.map(e=>{let n=t.$.parseSchema(e[0]);return iw(n,e[1],null),[n,e[1]]})},serialize:e=>e.map(e=>[e[0].collapsibleJson,gS(e[1])]),reduceIo:(e,t,n)=>{if(e===`in`){t.optionals=n.map(e=>e[0].rawIn);return}t.prefix=n.map(e=>e[0].rawOut)}},variadic:{child:!0,parse:(e,t)=>t.$.parseSchema(e,t)},minVariadicLength:{parse:e=>e===0?void 0:e},postfix:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}}},normalize:e=>{if(typeof e==`string`)return{variadic:e};if(`variadic`in e||`prefix`in e||`defaultables`in e||`optionals`in e||`postfix`in e||`minVariadicLength`in e){if(e.postfix?.length){if(!e.variadic)return K(dT);if(e.optionals?.length||e.defaultables?.length)return K(uT)}return e.minVariadicLength&&!e.variadic?K(`minVariadicLength may not be specified without a variadic element`):e}return{variadic:e}},reduce:(e,t)=>{let n=e.minVariadicLength??0,r=e.prefix?.slice()??[],i=e.defaultables?.slice()??[],a=e.optionals?.slice()??[],o=e.postfix?.slice()??[];if(e.variadic){for(;a[a.length-1]?.equals(e.variadic);)a.pop();if(a.length===0&&i.length===0)for(;r[r.length-1]?.equals(e.variadic);)r.pop(),n++;for(;o[0]?.equals(e.variadic);)o.shift(),n++}else a.length===0&&i.length===0&&r.push(...o.splice(0));if(n!==e.minVariadicLength||e.prefix&&e.prefix.length!==r.length)return t.node(`sequence`,{...e,prefix:r,defaultables:i,optionals:a,postfix:o,minVariadicLength:n},{prereduced:!0})},defaults:{description:e=>e.isVariadicOnly?`${e.variadic.nestableExpression}[]`:`[${e.tuple.map(e=>e.kind===`defaultables`?`${e.node.nestableExpression} = ${Ox(e.default)}`:e.kind===`optionals`?`${e.node.nestableExpression}?`:e.kind===`variadic`?`...${e.node.nestableExpression}[]`:e.node.expression).join(`, `)}]`},intersections:{sequence:(e,t,n)=>{let r=fT({l:e.tuple,r:t.tuple,disjoint:new HS,result:[],fixedVariants:[],ctx:n}),i=r.disjoint.length===0?[r,...r.fixedVariants]:r.fixedVariants;return i.length===0?r.disjoint:i.length===1?n.$.node(`sequence`,lT(i[0].result)):n.$.node(`union`,i.map(e=>({proto:Array,sequence:lT(e.result)})))}}}),iT=class extends eC{impliedBasis=q.intrinsic.Array.internal;tuple=cT(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter(e=>e.kind===`defaultables`||e.kind===`optionals`?(this.defaultablesAndOptionals.push(e.node),!0):e.kind===`prefix`);variadicOrPostfix=Ky(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return BS(this.flatRefs,this.prevariadic.flatMap((e,t)=>Gy(e.node.flatRefs.map(e=>RS([`${t}`,...e.path],e.node)),RS([`${t}`],e.node)))),BS(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Gy(e.flatRefs.map(e=>RS([q.intrinsic.nonNegativeIntegerString.internal,...e.path],e.node)),RS([q.intrinsic.nonNegativeIntegerString.internal],e)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node(`minLength`,this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node(`maxLength`,this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=oT(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Kx(this.defaultValueMorphs):void 0;elementAtIndex(e,t){if(t<this.prevariadic.length)return this.tuple[t];let n=e.length-this.postfixLength;return t>=n?{kind:`postfix`,node:this.postfix[t-n]}:{kind:`variadic`,node:this.variadic??nb(`Unexpected attempt to access index ${t} on ${this}`)}}traverseAllows=(e,t)=>{for(let n=0;n<e.length;n++)if(!this.elementAtIndex(e,n).node.traverseAllows(e[n],t))return!1;return!0};traverseApply=(e,t)=>{let n=0;for(;n<e.length;n++)jS(n,()=>this.elementAtIndex(e,n).node.traverseApply(e[n],t),t)};get element(){return this.cacheGetter(`element`,this.$.node(`union`,this.children))}compile(e){if(this.prefix)for(let[t,n]of this.prefix.entries())e.traverseKey(`${t}`,`data[${t}]`,n);for(let[t,n]of this.defaultablesAndOptionals.entries()){let r=`${t+this.prefixLength}`;e.if(`${r} >= data.length`,()=>e.traversalKind===`Allows`?e.return(!0):e.return()),e.traverseKey(r,`data[${r}]`,n)}if(this.variadic&&(this.postfix&&e.const(`firstPostfixIndex`,`data.length${this.postfix?`- ${this.postfix.length}`:``}`),e.for(`i < ${this.postfix?`firstPostfixIndex`:`data.length`}`,()=>e.traverseKey(`i`,`data[i]`,this.variadic),this.prevariadic.length),this.postfix))for(let[t,n]of this.postfix.entries()){let r=`firstPostfixIndex + ${t}`;e.traverseKey(r,`data[${r}]`,n)}e.traversalKind===`Allows`&&e.return(!0)}_transform(e,t){t.path.push(q.intrinsic.nonNegativeIntegerString.internal);let n=super._transform(e,t);return t.path.pop(),n}expression=this.description;reduceJsonSchema(e,t){let n=t.target===`draft-07`;if(this.prevariadic.length){let r=this.prevariadic.map(e=>{let n=e.node.toJsonSchemaRecurse(t);if(e.kind===`defaultables`){let r=typeof e.default==`function`?e.default():e.default;n.default=q.intrinsic.jsonData.allows(r)?r:t.fallback.defaultValue({code:`defaultValue`,base:n,value:r})}return n});n?e.items=r:e.prefixItems=r}if(this.minLength&&(e.minItems=this.minLength),this.variadic){let r=this.variadic.toJsonSchemaRecurse(t);if(n&&this.prevariadic.length?e.additionalItems=r:e.items=r,this.maxLength&&(e.maxItems=this.maxLength),this.postfix){let n=this.postfix.map(e=>e.toJsonSchemaRecurse(t));e=t.fallback.arrayPostfix({code:`arrayPostfix`,base:e,elements:n})}}else n?e.additionalItems=!1:e.items=!1,delete e.maxItems;return e}},aT={},oT=e=>{if(!e.defaultables)return[];let t=[],n=`[`,r=e.prefixLength+e.defaultablesLength-1;for(let i=e.prefixLength;i<=r;i++){let[r,a]=e.defaultables[i-e.prefixLength];t.push(rw(i,r,a)),n+=`${i}: ${r.id} = ${gS(a)}, `}return n+=`]`,aT[n]??=t},sT={implementation:rT,Node:iT},cT=e=>{let t=[];if(e.prefix)for(let n of e.prefix)t.push({kind:`prefix`,node:n});if(e.defaultables)for(let[n,r]of e.defaultables)t.push({kind:`defaultables`,node:n,default:r});if(e.optionals)for(let n of e.optionals)t.push({kind:`optionals`,node:n});if(e.variadic&&t.push({kind:`variadic`,node:e.variadic}),e.postfix)for(let n of e.postfix)t.push({kind:`postfix`,node:n});return t},lT=e=>e.reduce((e,t)=>(t.kind===`variadic`?e.variadic=t.node:t.kind===`defaultables`?e.defaultables=Gy(e.defaultables,[[t.node,t.default]]):e[t.kind]=Gy(e[t.kind],t.node),e),{}),uT=`A postfix required element cannot follow an optional or defaultable element`,dT=`A postfix element requires a variadic element`,fT=e=>{let[t,...n]=e.l,[r,...i]=e.r;if(!t||!r)return e;let a=n[n.length-1]?.kind===`postfix`,o=i[i.length-1]?.kind===`postfix`,s=t.kind===`prefix`||r.kind===`prefix`?`prefix`:t.kind===`postfix`||r.kind===`postfix`?`postfix`:t.kind===`variadic`&&r.kind===`variadic`?`variadic`:a||o?`prefix`:t.kind===`defaultables`||r.kind===`defaultables`?`defaultables`:`optionals`;if(t.kind===`prefix`&&r.kind===`variadic`&&o){let t=fT({...e,fixedVariants:[],r:i.map(e=>({...e,kind:`prefix`}))});t.disjoint.length===0&&e.fixedVariants.push(t)}else if(r.kind===`prefix`&&t.kind===`variadic`&&a){let t=fT({...e,fixedVariants:[],l:n.map(e=>({...e,kind:`prefix`}))});t.disjoint.length===0&&e.fixedVariants.push(t)}let c=YS(t.node,r.node,e.ctx);if(c instanceof HS){if(s===`prefix`||s===`postfix`)e.disjoint.push(...c.withPrefixKey(s===`prefix`?e.result.length:`-${n.length+1}`,pT(t)&&pT(r)?`required`:`optional`)),e.result=[...e.result,{kind:s,node:q.intrinsic.never.internal}];else if(s===`optionals`||s===`defaultables`)return e;else return fT({...e,fixedVariants:[],l:n.map(e=>({...e,kind:`prefix`})),r:n.map(e=>({...e,kind:`prefix`}))})}else s===`defaultables`?(t.kind===`defaultables`&&r.kind===`defaultables`&&t.default!==r.default&&K($C(t.default,r.default)),e.result=[...e.result,{kind:s,node:c,default:t.kind===`defaultables`?t.default:r.kind===`defaultables`?r.default:nb(`Unexpected defaultable intersection from ${t.kind} and ${r.kind} elements.`)}]):e.result=[...e.result,{kind:s,node:c}];let l=e.l.length,u=e.r.length;return(t.kind!==`variadic`||l>=u&&(r.kind===`variadic`||u===1))&&(e.l=n),(r.kind!==`variadic`||u>=l&&(t.kind===`variadic`||l===1))&&(e.r=i),fT(e)},pT=e=>e.kind===`prefix`||e.kind===`postfix`,mT=e=>t=>{if(t.props.length||t.index){let n=t.index?.map(t=>t[e])??[];for(let r of t.props)n.push(r[e]);t.undeclared&&n.push(`+ (undeclared): ${t.undeclared}`);let r=`{ ${n.join(`, `)} }`;return t.sequence?`${r} & ${t.sequence.description}`:r}return t.sequence?.description??`{}`},hT=mT(`description`),gT=mT(`expression`),_T=(e,t,n)=>{let r=e.required?`required`:`optional`;if(!t.signature.allows(e.key))return null;let i=qS(e.value,t.value,n);return i instanceof HS?r===`optional`?n.node(`optional`,{key:e.key,value:q.intrinsic.never.internal}):i.withPrefixKey(e.key,e.kind):null},vT=vS({kind:`structure`,hasAssociatedError:!1,normalize:e=>e,applyConfig:(e,t)=>!e.undeclared&&t.onUndeclaredKey!==`ignore`?{...e,undeclared:t.onUndeclaredKey}:e,keys:{required:{child:!0,parse:nC(`required`),reduceIo:(e,t,n)=>{t.required=Gy(t.required,n.map(t=>e===`in`?t.rawIn:t.rawOut))}},optional:{child:!0,parse:nC(`optional`),reduceIo:(e,t,n)=>{if(e===`in`){t.optional=n.map(e=>e.rawIn);return}for(let e of n)t[e.outProp.kind]=Gy(t[e.outProp.kind],e.outProp.rawOut)}},index:{child:!0,parse:nC(`index`)},sequence:{child:!0,parse:nC(`sequence`)},undeclared:{parse:e=>e===`ignore`?void 0:e,reduceIo:(e,t,n)=>{if(n===`reject`){t.undeclared=`reject`;return}e===`in`?delete t.undeclared:t.undeclared=`reject`}}},defaults:{description:hT},intersections:{structure:(e,t,n)=>{let r={...e.inner},i={...t.inner},a=new HS;if(e.undeclared){let r=e.keyof();for(let e of t.requiredKeys)r.allows(e)||a.add(`presence`,q.intrinsic.never.internal,t.propsByKey[e].value,{path:[e]});i.optional&&=i.optional.filter(e=>r.allows(e.key)),i.index&&=i.index.flatMap(e=>{if(e.signature.extends(r))return e;let t=qS(r,e.signature,n.$);if(t instanceof HS)return[];let a=DT(t,e.value,n.$);return a.required&&(i.required=Ky(i.required,a.required)),a.optional&&(i.optional=Ky(i.optional,a.optional)),a.index??[]})}if(t.undeclared){let i=t.keyof();for(let t of e.requiredKeys)i.allows(t)||a.add(`presence`,e.propsByKey[t].value,q.intrinsic.never.internal,{path:[t]});r.optional&&=r.optional.filter(e=>i.allows(e.key)),r.index&&=r.index.flatMap(e=>{if(e.signature.extends(i))return e;let t=qS(i,e.signature,n.$);if(t instanceof HS)return[];let a=DT(t,e.value,n.$);return a.required&&(r.required=Ky(r.required,a.required)),a.optional&&(r.optional=Ky(r.optional,a.optional)),a.index??[]})}let o={};(e.undeclared||t.undeclared)&&(o.undeclared=e.undeclared===`reject`||t.undeclared===`reject`?`reject`:`delete`);let s=rC({kind:`structure`,baseInner:o,l:iC(r),r:iC(i),roots:[],ctx:n});return s instanceof HS&&a.push(...s),a.length?a:s}},reduce:(e,t)=>{if(!e.required&&!e.optional)return;let n=Object.create(null),r=!1,i=e.optional?[...e.optional]:[];if(e.required)for(let r=0;r<e.required.length;r++){let i=e.required[r];if(i.key in n&&K(AT(i.key)),n[i.key]=!0,e.index)for(let n of e.index){let e=_T(i,n,t);if(e instanceof HS)return e}}if(e.optional)for(let a=0;a<e.optional.length;a++){let o=e.optional[a];if(o.key in n&&K(AT(o.key)),n[o.key]=!0,e.index)for(let n of e.index){let e=_T(o,n,t);if(e instanceof HS)return e;e!==null&&(i[a]=e,r=!0)}}if(r)return t.node(`structure`,{...e,optional:i},{prereduced:!0})}}),yT=class extends eC{impliedBasis=q.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=Ky(this.required,this.optional);propsByKey=ob(this.props,(e,t)=>[t.key,t]);propsByKeyReference=Kx(this.propsByKey);expression=gT(this);requiredKeys=this.required?.map(e=>e.key)??[];optionalKeys=this.optional?.map(e=>e.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let e=this.$.units(this.literalKeys).branches;if(this.index)for(let{signature:t}of this.index)e=e.concat(t.branches);return this._keyof=this.$.node(`union`,e)}map(e){return this.$.node(`structure`,this.props.flatMap(e).reduce((e,t)=>{let n=this.propsByKey[t.key];if(nS(t))return t.kind!==`required`&&t.kind!==`optional`?K(`Map result must have kind "required" or "optional" (was ${t.kind})`):(e[t.kind]=Gy(e[t.kind],t),e);let r=t.kind??n?.kind??`required`,i=ob(t,(e,t)=>e in ew.implementation.keys?[e,t]:[]);return e[r]=Gy(e[r],this.$.node(r,i)),e},{}))}assertHasKeys(e){let t=e.filter(e=>!fw(e,this.keyof()));if(t.length)return K(kT(this.expression,t))}get(e,...t){let n,r=!1,i=TT(e);if((typeof i==`string`||typeof i==`symbol`)&&this.propsByKey[i]&&(n=this.propsByKey[i].value,r=this.propsByKey[i].required),this.index)for(let e of this.index)fw(i,e.signature)&&(n=n?.and(e.value)??e.value);if(this.sequence&&fw(i,q.intrinsic.nonNegativeIntegerString)){if(tS(i,`root`))this.sequence.variadic&&(n=n?.and(this.sequence.element)??this.sequence.element);else{let e=Number.parseInt(i);if(e<this.sequence.prevariadic.length){let t=this.sequence.prevariadic[e].node;n=n?.and(t)??t,r||=e<this.sequence.prefixLength}else if(this.sequence.variadic){let e=this.$.node(`union`,this.sequence.variadicOrPostfix);n=n?.and(e)??e}}}if(!n)return this.sequence?.variadic&&tS(i,`root`)&&i.extends(q.intrinsic.number)?K(ET(i.expression,this.sequence.expression)):K(kT(this.expression,[i]));let a=n.get(...t);return r?a:a.or(q.intrinsic.undefined)}pick(...e){return this.assertHasKeys(e),this.$.node(`structure`,this.filterKeys(`pick`,e))}omit(...e){return this.assertHasKeys(e),this.$.node(`structure`,this.filterKeys(`omit`,e))}optionalize(){let{required:e,...t}=this.inner;return this.$.node(`structure`,{...t,optional:this.props.map(e=>e.hasKind(`required`)?this.$.node(`optional`,e.inner):e)})}require(){let{optional:e,...t}=this.inner;return this.$.node(`structure`,{...t,required:this.props.map(e=>e.hasKind(`optional`)?{key:e.key,value:e.value}:e)})}merge(e){let t=this.filterKeys(`omit`,[e.keyof()]);return e.required&&(t.required=Gy(t.required,e.required)),e.optional&&(t.optional=Gy(t.optional,e.optional)),e.index&&(t.index=Gy(t.index,e.index)),e.sequence&&(t.sequence=e.sequence),e.undeclared?t.undeclared=e.undeclared:delete t.undeclared,this.$.node(`structure`,t)}filterKeys(e,t){let n=$x(this.inner),r=n=>{let r=t.some(e=>fw(n,e));return e===`pick`?r:!r};return n.required&&=n.required.filter(e=>r(e.key)),n.optional&&=n.optional.filter(e=>r(e.key)),n.index&&=n.index.filter(e=>r(e.signature)),n}traverseAllows=(e,t)=>this._traverse(`Allows`,e,t);traverseApply=(e,t)=>this._traverse(`Apply`,e,t);_traverse=(e,t,n)=>{let r=n?.currentErrorCount??0;for(let i=0;i<this.props.length;i++)if(e===`Allows`){if(!this.props[i].traverseAllows(t,n))return!1}else if(this.props[i].traverseApply(t,n),n.failFast&&n.currentErrorCount>r)return!1;if(this.sequence){if(e===`Allows`){if(!this.sequence.traverseAllows(t,n))return!1}else if(this.sequence.traverseApply(t,n),n.failFast&&n.currentErrorCount>r)return!1}if(this.index||this.undeclared===`reject`){let i=Object.keys(t);i.push(...Object.getOwnPropertySymbols(t));for(let a=0;a<i.length;a++){let o=i[a];if(this.index){for(let i of this.index)if(i.signature.traverseAllows(o,n)){if(e===`Allows`){if(!jS(o,()=>i.value.traverseAllows(t[o],n),n))return!1}else if(jS(o,()=>i.value.traverseApply(t[o],n),n),n.failFast&&n.currentErrorCount>r)return!1}}if(this.undeclared===`reject`&&!this.declaresKey(o)&&(e===`Allows`||(n.errorFromNodeContext({code:`predicate`,expected:`removed`,actual:``,relativePath:[o],meta:this.meta}),n.failFast)))return!1}}return this.structuralMorph&&n&&!n.hasError()&&n.queueMorphs([this.structuralMorph]),!0};get defaultable(){return this.cacheGetter(`defaultable`,this.optional?.filter(e=>e.hasDefault())??[])}declaresKey=e=>e in this.propsByKey||this.index?.some(t=>t.signature.allows(e))||this.sequence!==void 0&&q.intrinsic.nonNegativeIntegerString.allows(e);_compileDeclaresKey(e){let t=[];if(this.props.length&&t.push(`k in ${this.propsByKeyReference}`),this.index)for(let n of this.index)t.push(e.invoke(n.signature,{kind:`Allows`,arg:`k`}));return this.sequence&&t.push(`$ark.intrinsic.nonNegativeIntegerString.allows(k)`),t.join(` || `)||`false`}get structuralMorph(){return this.cacheGetter(`structuralMorph`,ST(this))}structuralMorphRef=this.structuralMorph&&Kx(this.structuralMorph);compile(e){e.traversalKind===`Apply`&&e.initializeErrorCount();for(let t of this.props)e.check(t),e.traversalKind===`Apply`&&e.returnIfFailFast();if(this.sequence&&(e.check(this.sequence),e.traversalKind===`Apply`&&e.returnIfFailFast()),(this.index||this.undeclared===`reject`)&&(e.const(`keys`,`Object.keys(data)`),e.line(`keys.push(...Object.getOwnPropertySymbols(data))`),e.for(`i < keys.length`,()=>this.compileExhaustiveEntry(e))),e.traversalKind===`Allows`)return e.return(!0);this.structuralMorphRef&&e.if(`ctx && !ctx.hasError()`,()=>(e.line(`ctx.queueMorphs([`),CT(e,this),e.line(`])`)))}compileExhaustiveEntry(e){if(e.const(`k`,`keys[i]`),this.index)for(let t of this.index)e.if(`${e.invoke(t.signature,{arg:`k`,kind:`Allows`})}`,()=>e.traverseKey(`k`,`data[k]`,t.value));return this.undeclared===`reject`&&e.if(`!(${this._compileDeclaresKey(e)})`,()=>e.traversalKind===`Allows`?e.return(!1):e.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if(`ctx.failFast`,()=>e.return())),e}reduceJsonSchema(e,t){switch(e.type){case`object`:return this.reduceObjectJsonSchema(e,t);case`array`:let n=this.sequence?.reduceJsonSchema(e,t)??e;return this.props.length||this.index?t.fallback.arrayObject({code:`arrayObject`,base:n,object:this.reduceObjectJsonSchema({type:`object`},t)}):n;default:return yS.throwInternalOperandError(`structure`,e)}}reduceObjectJsonSchema(e,t){if(this.props.length){e.properties={};for(let n of this.props){let r=n.value.toJsonSchemaRecurse(t);if(typeof n.key==`symbol`){t.fallback.symbolKey({code:`symbolKey`,base:e,key:n.key,value:r,optional:n.optional});continue}if(n.hasDefault()){let e=typeof n.default==`function`?n.default():n.default;r.default=q.intrinsic.jsonData.allows(e)?e:t.fallback.defaultValue({code:`defaultValue`,base:r,value:e})}e.properties[n.key]=r}this.requiredKeys.length&&e.properties&&(e.required=this.requiredKeys.filter(t=>typeof t==`string`&&t in e.properties))}if(this.index)for(let n of this.index){let r=n.value.toJsonSchemaRecurse(t);if(n.signature.equals(q.intrinsic.string)){e.additionalProperties=r;continue}for(let i of n.signature.branches){if(!i.extends(q.intrinsic.string)){e=t.fallback.symbolKey({code:`symbolKey`,base:e,key:null,value:r,optional:!1});continue}let n={type:`string`};if(i.hasKind(`morph`)&&(n=t.fallback.morph({code:`morph`,base:i.rawIn.toJsonSchemaRecurse(t),out:i.rawOut.toJsonSchemaRecurse(t)})),!i.hasKind(`intersection`))return nb(`Unexpected index branch kind ${i.kind}.`);let{pattern:a}=i.inner;if(a){let i=Object.assign(n,{pattern:a[0].rule});for(let e=1;e<a.length;e++)n=t.fallback.patternIntersection({code:`patternIntersection`,base:i,pattern:a[e].rule});e.patternProperties??={},e.patternProperties[i.pattern]=r}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}},bT={},xT=e=>{let t=``;for(let n=0;n<e.defaultable.length;n++)t+=e.defaultable[n].defaultValueMorphRef;if(e.sequence?.defaultValueMorphsReference&&(t+=e.sequence?.defaultValueMorphsReference),e.undeclared===`delete`){if(t+=`delete !(`,e.required)for(let n of e.required)t+=n.compiledKey+` | `;if(e.optional)for(let n of e.optional)t+=n.compiledKey+` | `;if(e.index)for(let n of e.index)t+=n.signature.id+` | `;if(e.sequence){if(e.sequence.maxLength===null)t+=cE.nonNegativeIntegerString.id;else for(let n=0;n<e.sequence.tuple.length;n++)t+=n+` | `}t+=`)`}return t},ST=e=>{let t=xT(e);return t?bT[t]?bT[t]:bT[t]=(t,n)=>{for(let r=0;r<e.defaultable.length;r++)e.defaultable[r].key in t||e.defaultable[r].defaultValueMorph(t,n);if(e.sequence?.defaultables)for(let r=t.length-e.sequence.prefixLength;r<e.sequence.defaultables.length;r++)e.sequence.defaultValueMorphs[r](t,n);if(e.undeclared===`delete`)for(let n in t)e.declaresKey(n)||delete t[n];return t}:void 0},CT=(e,t)=>{let n=`(data${t.defaultable.some(e=>e.defaultValueMorph.length===2)||t.sequence?.defaultValueMorphs.some(e=>e.length===2)?`, ctx`:``})`;return e.block(`${n} => `,e=>{for(let r=0;r<t.defaultable.length;r++){let{serializedKey:i,defaultValueMorphRef:a}=t.defaultable[r];e.if(`!(${i} in data)`,e=>e.line(`${a}${n}`))}return t.sequence?.defaultables&&e.for(`i < ${t.sequence.defaultables.length}`,e=>e.line(`${t.sequence.defaultValueMorphsReference}[i]${n}`),`data.length - ${t.sequence.prefixLength}`),t.undeclared===`delete`&&e.forIn(`data`,e=>e.if(`!(${t._compileDeclaresKey(e)})`,e=>e.line(`delete data[k]`))),e.return(`data`)})},wT={implementation:vT,Node:yT},TT=e=>(tS(e,`root`)&&e.hasKind(`unit`)&&(e=e.unit),typeof e==`number`&&(e=`${e}`),e),ET=(e,t)=>`${e} is not allowed as an array index on ${t}. Use the 'nonNegativeIntegerString' keyword instead.`,DT=(e,t,n)=>{let[r,i]=Vy(e.branches,e=>e.hasKind(`unit`));if(!r.length)return{index:n.node(`index`,{signature:e,value:t})};let a={};for(let e of r){let r=n.node(`required`,{key:e.unit,value:t});a[r.kind]=Gy(a[r.kind],r)}return i.length&&(a.index=n.node(`index`,{signature:i,value:t})),a},OT=e=>tS(e,`root`)?e.expression:Ox(e),kT=(e,t)=>`Key${t.length===1?``:`s`} ${t.map(OT).join(`, `)} ${t.length===1?`does`:`do`} not exist on ${e}`,AT=e=>`Duplicate key ${Jx(e)}`,jT={...IC,alias:Sw.implementation,domain:ww.implementation,unit:Zw.implementation,proto:Aw.implementation,union:Bw.implementation,morph:Ow.implementation,intersection:Tw.implementation,divisor:pC.implementation,pattern:RC.implementation,predicate:fC.implementation,required:nT.implementation,optional:ew.implementation,index:$w.implementation,sequence:sT.implementation,structure:wT.implementation};q.defaultConfig=vb(Object.assign(ob(jT,(e,t)=>[e,t.defaults]),{jitless:Vb(),clone:Fb,onUndeclaredKey:`ignore`,exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:yS.defaultConfig})),q.resolvedConfig=bS(q.defaultConfig,q.config);var MT={...LC,alias:Sw.Node,domain:ww.Node,unit:Zw.Node,proto:Aw.Node,union:Bw.Node,morph:Ow.Node,intersection:Tw.Node,divisor:pC.Node,pattern:RC.Node,predicate:fC.Node,required:nT.Node,optional:ew.Node,index:$w.Node,sequence:sT.Node,structure:wT.Node},NT=class extends ub{get[eS](){return`module`}},PT=(e,t)=>new NT(ob(e,(e,n)=>[e,tS(n,`module`)?PT(n,t):t.bindReference(n)])),FT=e=>Ob(e)?e:`branches`in e&&Ob(e.branches)?e.branches:void 0,IT=(e,t)=>K(`Node of kind ${t} is not valid as a ${e} definition`),LT=e=>`#${e} duplicates public alias ${e}`,RT={};q.ambient??={};var zT,BT=`function $`,VT=e=>HT(e,UT(e)),HT=(e,t,n)=>{let r=t.write(BT,4),i=t.compile()();for(let t of e)(!t.precompilation||n&&t.$===n)&&(t.traverseAllows=i[`${t.id}Allows`].bind(i),t.isRoot()&&!t.allowsRequiresContext&&(t.allows=t.traverseAllows),t.traverseApply=i[`${t.id}Apply`].bind(i),i[`${t.id}Optimistic`]&&(t.traverseOptimistic=i[`${t.id}Optimistic`].bind(i)),t.precompilation=r)},UT=e=>new qx().return(e.reduce((e,t)=>{let n=new Qx({kind:`Allows`}).indent();t.compile(n);let r=n.write(`${t.id}Allows`),i=new Qx({kind:`Apply`}).indent();t.compile(i);let a=`${e}${r},\n${i.write(`${t.id}Apply`)},\n`;if(!t.hasKind(`union`))return a;let o=new Qx({kind:`Allows`,optimistic:!0}).indent();return t.compile(o),`${a}${o.write(`${t.id}Optimistic`)},\n`},`{
38
38
  `)+`}`),WT=class{config;resolvedConfig;name;get[eS](){return`scope`}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,t){this.config=bS(q.config,t),this.resolvedConfig=bS(q.resolvedConfig,t),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(RT).length}`,this.name in RT&&K(`A Scope already named ${this.name} already exists`),RT[this.name]=this;let n=Object.entries(e).map(e=>this.preparseOwnAliasEntry(...e));for(let[e,t]of n){let n=e;if(e[0]===`#`?(n=e.slice(1),n in this.aliases&&K(LT(n)),this.aliases[n]=t):(n in this.aliases&&K(LT(e)),this.aliases[n]=t,this.exportedNames.push(n)),!tS(t,`module`)&&!tS(t,`generic`)&&!Rb(t)){let e=this.preparseOwnDefinitionFormat(t,{alias:n});this.resolutions[n]=tS(e,`root`)?this.bindReference(e):this.createParseContext(e).id}}zT??=this.node(`union`,{branches:[`string`,`number`,`object`,`bigint`,`symbol`,{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[zT.hash]=this.node(`intersection`,{},{prereduced:!0}),this.intrinsic=q.intrinsic?ob(q.intrinsic,(e,t)=>e.startsWith(`json`)?[]:[e,this.bindReference(t)]):{}}cacheGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}get internal(){return this}_json;get json(){return this._json||this.export(),this._json}defineSchema(e){return e}generic=(...e)=>{let t=this;return(n,r)=>new uC(e,r?new lC(n):n,t,t,r??null)};units=(e,t)=>{let n=[];for(let t of e)n.includes(t)||n.push(t);let r=n.map(e=>this.node(`unit`,{unit:e},t));return this.node(`union`,r,{...t,prereduced:!0})};lazyResolutions=[];lazilyResolve(e,t){let n=this.node(`alias`,{reference:t??`synthetic`,resolve:e},{prereduced:!0});return this.resolved||this.lazyResolutions.push(n),n}schema=(e,t)=>this.finalize(this.parseSchema(e,t));parseSchema=(e,t)=>this.node(zC(e),e,t);preparseNode(e,t,n){let r=typeof e==`string`?e:zC(t,e);if(nS(t)&&t.kind===r)return t;if(r===`alias`&&!n?.prereduced){let{reference:e}=Sw.implementation.normalize(t,this);if(e.startsWith(`$`)){let n=this.resolveRoot(e.slice(1));t=n,r=n.kind}}else if(r===`union`&&Zy(t,`object`)){let e=FT(t);e?.length===1&&(t=e[0],r=zC(t))}if(nS(t)&&t.kind===r)return t;let i=jT[r].normalize?.(t,this)??t;return nS(i)?i.kind===r?i:IT(r,i.kind):{...n,$:this,kind:r,def:i,prefix:n.alias??r}}bindReference(e){let t;return t=nS(e)?e.$===this?e:new e.constructor(e.attachments,this):e.$===this?e:new uC(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,t.referencesById),t}resolveRoot(e){return this.maybeResolveRoot(e)??K(QT(e))}maybeResolveRoot(e){let t=this.maybeResolve(e);if(!tS(t,`generic`))return t}maybeResolveSubalias(e){return JT(this.aliases,e)??JT(this.ambient,e)}get ambient(){return q.ambient}maybeResolve(e){let t=this.resolutions[e];if(t){if(typeof t!=`string`)return this.bindReference(t);let n=WC[t];if(tS(n,`root`))return this.resolutions[e]=n;if(tS(n,`context`)){if(n.phase===`resolving`)return this.node(`alias`,{reference:`$${e}`},{prereduced:!0});if(n.phase===`resolved`)return nb(`Unexpected resolved context for was uncached by its scope: ${Ox(n)}`);n.phase=`resolving`;let t=this.bindReference(this.parseOwnDefinitionFormat(n.def,n));return n.phase=`resolved`,WC[t.id]=t,WC[n.id]=t,this.resolutions[e]=t}return nb(`Unexpected nodesById entry for ${t}: ${Ox(n)}`)}let n=this.aliases[e]??this.ambient?.[e];return n?(n=this.normalizeRootScopeValue(n),tS(n,`generic`)?this.resolutions[e]=this.bindReference(n):tS(n,`module`)?(n.root||K(eE(e)),this.resolutions[e]=this.bindReference(n.root)):this.resolutions[e]=this.parse(n,{alias:e})):this.maybeResolveSubalias(e)}createParseContext(e){let t=e.id??GC(e.prefix);return WC[t]=Object.assign(e,{[eS]:`context`,$:this,id:t,phase:`unresolved`})}traversal(e){return new AS(e,this.resolvedConfig)}import(...e){return new NT(ob(this.export(...e),(e,t)=>[`#${e}`,t]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(let e of this.exportedNames){let t=this.aliases[e];this._exports[e]=tS(t,`module`)?PT(t,this):KT(this.maybeResolve(e))}for(let e of this.lazyResolutions)e.resolution;if(this._exportedResolutions=ZT(this,this._exports),this._json=qT(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let e=UT(this.references);this.precompilation=e.write(BT,4),HT(this.references,e,this)}this.resolved=!0}return new NT(ob(e.length?e:this.exportedNames,(e,t)=>[t,this._exports[t]]))}resolve(e){return this.export()[e]}node=(e,t,n={})=>{let r=this.preparseNode(e,t,n);if(nS(r))return this.bindReference(r);let i=this.createParseContext(r),a=KC(i),o=this.bindReference(a);return WC[i.id]=o};parse=(e,t={})=>this.finalize(this.parseDefinition(e,t));parseDefinition(e,t={}){if(tS(e,`root`))return this.bindReference(e);let n=this.preparseOwnDefinitionFormat(e,t);if(tS(n,`root`))return this.bindReference(n);let r=this.createParseContext(n);WC[r.id]=r;let i=this.bindReference(this.parseOwnDefinitionFormat(e,r));return i.isCyclic&&(i=JC(i,r.id)),WC[r.id]=i,i}finalize(e){return KT(e),!e.precompilation&&!this.resolvedConfig.jitless&&VT(e.references),e}},GT=class extends WT{parseOwnDefinitionFormat(e,t){return KC(t)}preparseOwnDefinitionFormat(e,t){return this.preparseNode(zC(e),e,t)}preparseOwnAliasEntry(e,t){return[e,t]}normalizeRootScopeValue(e){return e}},KT=e=>{let t=e.references.filter(e=>e.hasKind(`alias`));for(let n of t){Object.assign(n.referencesById,n.resolution.referencesById);for(let t of e.references)n.id in t.referencesById&&Object.assign(t.referencesById,n.referencesById)}return e},qT=e=>ob(e,(e,t)=>[e,tS(t,`root`)||tS(t,`generic`)?t.json:tS(t,`module`)?qT(t):nb(`Unexpected resolution ${Ox(t)}`)]),JT=(e,t)=>{let n=t.indexOf(`.`);if(n===-1)return;let r=t.slice(0,n),i=e[r];if(i===void 0)return;if(!tS(i,`module`))return K($T(r));let a=t.slice(n+1),o=i[a];if(o===void 0)return JT(i,a);if(tS(o,`root`)||tS(o,`generic`))return o;if(tS(o,`module`))return o.root??K(eE(t));nb(`Unexpected resolution for alias '${t}': ${Ox(o)}`)},YT=(e,t)=>new GT(e,t),XT=new GT({}),ZT=(e,t)=>{let n={};for(let r in t){let i=t[r];if(tS(i,`module`)){let t=ob(ZT(e,i),(e,t)=>[`${r}.${e}`,t]);Object.assign(n,t)}else tS(i,`root`)||tS(i,`generic`)?n[r]=i:nb(`Unexpected scope resolution ${Ox(i)}`)}return n},QT=e=>`'${e}' is unresolvable`,$T=e=>`'${e}' must reference a module to be accessed using dot syntax`,eE=e=>`Reference to submodule '${e}' must specify an alias`;XT.export();var tE=XT.schema,nE=XT.node;XT.defineSchema;var rE=XT.generic,iE=`^(?:0|[1-9]\\d*)$`;Kx(new RegExp(iE));var aE=YT({bigint:`bigint`,boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:`number`,object:`object`,string:`string`,symbol:`symbol`,true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();q.intrinsic={...aE};var oE=YT({integer:{domain:`number`,divisor:1},lengthBoundable:[`string`,Array],key:[`string`,`symbol`],nonNegativeIntegerString:{domain:`string`,pattern:iE}},{prereducedAliases:!0}).export();Object.assign(q.intrinsic,oE);var sE=YT({jsonPrimitive:[`string`,`number`,{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:`object`,index:{signature:`string`,value:`$jsonData`}},jsonData:[`$jsonPrimitive`,`$jsonObject`]},{prereducedAliases:!0}).export(),cE={...aE,...oE,...sE,emptyStructure:nE(`structure`,{},{prereduced:!0})};q.intrinsic={...cE};var lE=((e,t)=>new RegExp(e,t));Object.assign(lE,{as:lE});var uE=e=>typeof e==`string`&&e[0]===`d`&&(e[1]===`'`||e[1]===`"`)&&e[e.length-1]===e[1],dE=e=>e.toString()!==`Invalid Date`,fE=e=>e.slice(2,-1),pE=e=>`'${e}' could not be parsed by the Date constructor`,mE=(e,t)=>hE(e,t),hE=(e,t)=>{let n=new Date(e);if(dE(n))return n;let r=hx(e);if(r!==void 0){let e=new Date(r);if(dE(e))return e}return t?K(t===!0?pE(e):t):void 0},gE=tE({proto:`Array`,sequence:`string`,required:{key:`groups`,value:[`object`,{unit:void 0}]}}),_E=(e,t)=>{let n=e.scanner.shiftUntilEscapable(CE[SE[t]]);if(e.scanner.lookahead===``)return e.error(TE(n,t));if(e.scanner.shift(),t in xE){let r;try{r=new RegExp(n)}catch(e){K(String(e))}e.root=e.ctx.$.node(`intersection`,{domain:`string`,pattern:n},{prereduced:!0}),t===`x/`&&(e.root=e.ctx.$.node(`morph`,{in:e.root,morphs:e=>r.exec(e),declaredOut:gE}))}else if(cb(t,vE))e.root=e.ctx.$.node(`unit`,{unit:n});else{let t=mE(n,pE(n));e.root=e.ctx.$.node(`unit`,{meta:n,unit:t})}},vE={"'":1,'"':1},yE={"/":1,"'":1,'"':1},bE={"d'":`'`,'d"':`"`,"'":`'`,'"':`"`},xE={"/":`/`,"x/":`/`},SE={...bE,...xE},CE={"'":e=>e.lookahead===`'`,'"':e=>e.lookahead===`"`,"/":e=>e.lookahead===`/`},wE={'"':`double-quote`,"'":`single-quote`,"/":`forward slash`},TE=(e,t)=>`${t}${e} requires a closing ${wE[SE[t]]}`,EE=e=>`Private type references should not include '#'. Use '${e}' instead.`,DE=`Optional definitions like 'string?' are only valid as properties in an object or tuple`,OE=`Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple`,kE={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...Yb},AE=(e,t)=>e===`>`?t[0]===`=`?t[1]===`=`:t.trimStart()===``||cb(t.trimStart()[0],kE):e===`=`?t[0]!==`=`:e===`,`||e===`?`,jE=(e,t,n)=>ME(e,t,n,[]),ME=(e,t,n,r)=>{let i=n.parseUntilFinalizer();return r.push(i.root),i.finalizer===`>`?r.length===t.params.length?r:n.error(NE(e,t.names,r.map(e=>e.expression))):i.finalizer===`,`?ME(e,t,n,r):i.error(Vx(`>`))},NE=(e,t,n)=>`${e}<${t.join(`, `)}> requires exactly ${t.length} args (got ${n.length}${n.length===0?``:`: ${n.join(`, `)}`})`,PE=e=>{let t=e.scanner.shiftUntilLookahead(kE);t===`keyof`?e.addPrefix(`keyof`):e.root=IE(e,t)},FE=(e,t,n)=>(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()===`<`?t(...jE(e,t,n)):n.error(NE(e,t.names,[]))),IE=(e,t)=>LE(e,t)??RE(e,t)??e.error(t===``?e.scanner.lookahead===`#`?EE(e.shiftedBy(1).scanner.shiftUntilLookahead(kE)):zE(e):QT(t)),LE=(e,t)=>{if(e.ctx.args?.[t]){let n=e.ctx.args[t];return typeof n==`string`?e.ctx.$.node(`alias`,{reference:n},{prereduced:!0}):n}let n=e.ctx.$.maybeResolve(t);if(tS(n,`root`))return n;if(n!==void 0)return tS(n,`generic`)?FE(t,n,e):K(`Unexpected resolution ${Ox(n)}`)},RE=(e,t)=>{let n=gx(t);if(n!==void 0)return e.ctx.$.node(`unit`,{unit:n});let r=yx(t);if(r!==void 0)return e.ctx.$.node(`unit`,{unit:r})},zE=e=>{let t=e.previousOperator();return t?BE(t,e.scanner.unscanned):VE(e.scanner.unscanned)},BE=(e,t=``)=>`Token '${e}' requires a right operand${t?` before '${t}'`:``}`,VE=e=>`Expected an expression${e?` before '${e}'`:``}`,HE=e=>e.scanner.lookahead===``?e.error(zE(e)):e.scanner.lookahead===`(`?e.shiftedBy(1).reduceGroupOpen():e.scanner.lookaheadIsIn(yE)?_E(e,e.scanner.shift()):e.scanner.lookaheadIsIn(Yb)?HE(e.shiftedBy(1)):e.scanner.lookahead===`d`?e.scanner.nextLookahead in vE?_E(e,`${e.scanner.shift()}${e.scanner.shift()}`):PE(e):e.scanner.lookahead===`x`&&e.scanner.nextLookahead===`/`?e.shiftedBy(2)&&_E(e,`x/`):PE(e),UE={">":!0,">=":!0},WE={"<":!0,"<=":!0},GE={"<":`>`,">":`<`,"<=":`>=`,">=":`<=`,"==":`==`},KE=(e,t)=>`Left bounds are only valid when paired with right bounds (try ...${t}${e})`,qE=e=>`Left-bounded expressions must specify their limits using < or <= (was ${e})`,JE=(e,t,n,r)=>`An expression may have at most one left bound (parsed ${e}${GE[t]}, ${n}${GE[r]})`,YE=(e,t)=>{let n=ZE(e,t);if(e.root.hasKind(`unit`)){if(typeof e.root.unit==`number`){e.reduceLeftBound(e.root.unit,n),e.unsetRoot();return}if(e.root.unit instanceof Date){let t=`d'${e.root.description??e.root.unit.toISOString()}'`;e.unsetRoot(),e.reduceLeftBound(t,n);return}}return eD(e,n)},XE={"<":1,">":1,"=":1},ZE=(e,t)=>e.scanner.lookaheadIs(`=`)?`${t}${e.scanner.shift()}`:t,QE=(e,t,n,r)=>n.extends(q.intrinsic.number)?typeof t==`number`?e===`==`?[`min`,`max`]:e[0]===`>`?[`min`]:[`max`]:K(tD(e,t,r)):n.extends(q.intrinsic.lengthBoundable)?typeof t==`number`?e===`==`?[`exactLength`]:e[0]===`>`?[`minLength`]:[`maxLength`]:K(tD(e,t,r)):n.extends(q.intrinsic.Date)?e===`==`?[`after`,`before`]:e[0]===`>`?[`after`]:[`before`]:K(OC(n.expression)),$E=e=>({rule:uE(e.limit)?fE(e.limit):e.limit,exclusive:e.comparator.length===1}),eD=(e,t)=>{let n=e.unsetRoot(),r=e.scanner.location;e.parseOperand();let i=e.unsetRoot(),a=e.scanner.sliceChars(r,e.scanner.location);if(e.root=n,!i.hasKind(`unit`)||typeof i.unit!=`number`&&!(i.unit instanceof Date))return e.error(tD(t,a,`right`));let o=i.unit,s=t.length===1,c=QE(t,typeof o==`number`?o:a,n,`right`);for(let n of c)e.constrainRoot(n,t===`==`?{rule:o}:{rule:o,exclusive:s});if(!e.branches.leftBound)return;if(!cb(t,WE))return e.error(qE(t));let l=QE(e.branches.leftBound.comparator,e.branches.leftBound.limit,n,`left`);e.constrainRoot(l[0],$E(e.branches.leftBound)),e.branches.leftBound=null},tD=(e,t,n)=>`Comparator ${n===`left`?GE[e]:e} must be ${n===`left`?`preceded`:`followed`} by a corresponding literal (was ${t})`,nD=e=>{e.scanner.shiftUntilNonWhitespace();let t=e.scanner.shiftUntilLookahead(kE);e.root=e.root.brand(t)},rD=e=>{e.scanner.shiftUntilNonWhitespace();let t=e.scanner.shiftUntilLookahead(kE),n=_x(t,{errorOnFail:iD(t)});n===0&&e.error(iD(0)),e.root=e.root.constrain(`divisor`,n)},iD=e=>`% operator must be followed by a non-zero integer literal (was ${e})`,aD=e=>{let t=e.scanner.shift();return t===``?e.finalize(``):t===`[`?e.scanner.shift()===`]`?e.setRoot(e.root.array()):e.error(sD):t===`|`?e.scanner.lookahead===`>`?e.shiftedBy(1).pushRootToBranch(`|>`):e.pushRootToBranch(t):t===`&`?e.pushRootToBranch(t):t===`)`?e.finalizeGroup():AE(t,e.scanner.unscanned)?e.finalize(t):cb(t,XE)?YE(e,t):t===`%`?rD(e):t===`#`?nD(e):t in Yb?aD(e):e.error(oD(t))},oD=(e,t=``)=>`'${e}' is not allowed here${t&&` (should be ${t})`}`,sD=`Missing expected ']'`,cD=e=>{let t=e.unsetRoot();e.parseOperand();let n=e.unsetRoot();return n.hasKind(`unit`)?[t,`=`,n.unit instanceof Date?()=>new Date(n.unit):n.unit]:e.error(lD(n.expression))},lD=e=>`Default value '${e}' must be a literal value`,uD=(e,t)=>{let n=t.$.maybeResolveRoot(e);if(n)return n;if(e.endsWith(`[]`)){let n=t.$.maybeResolveRoot(e.slice(0,-2));if(n)return n.array()}let r=new mD(new zx(e),t),i=dD(r);return r.finalizer===`>`&&K(oD(`>`)),i},dD=e=>{e.parseOperand();let t=fD(e).root;return t?(e.finalizer===`=`?t=cD(e):e.finalizer===`?`&&(t=[t,`?`]),e.scanner.shiftUntilNonWhitespace(),e.scanner.lookahead&&K(oD(e.scanner.lookahead)),t):nb(`Root was unexpectedly unset after parsing string '${e.scanner.scanned}'`)},fD=e=>{for(;e.finalizer===void 0;)pD(e);return e},pD=e=>e.hasRoot()?e.parseOperator():e.parseOperand(),mD=class e{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(e,t){this.scanner=e,this.ctx=t}error(e){return K(e)}hasRoot(){return this.root!==void 0}setRoot(e){this.root=e}unsetRoot(){let e=this.root;return this.root=void 0,e}constrainRoot(...e){this.root=this.root.constrain(e[0],e[1])}finalize(e){if(this.groups.length)return this.error(Vx(`)`));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,t){let n=GE[t];if(!cb(n,UE))return this.error(qE(t));if(this.branches.leftBound)return this.error(JE(this.branches.leftBound.limit,this.branches.leftBound.comparator,e,n));this.branches.leftBound={comparator:n,limit:e}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch(`|>`),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch(`|`),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch(`&`),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();let e=this.groups.pop();if(!e)return this.error(Bx(`)`,this.scanner.unscanned));this.branches=e}addPrefix(e){this.branches.prefixes.push(e)}applyPrefixes(){for(;this.branches.prefixes.length;){let e=this.branches.prefixes.pop();this.root=e===`keyof`?this.root.keyof():nb(`Unexpected prefix '${e}'`)}}pushRootToBranch(e){this.assertRangeUnset(),this.applyPrefixes();let t=this.root;this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(t)??t,e!==`&`&&(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,e!==`|`&&(this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return fD(new e(this.scanner,this.ctx))}parseOperator(){return aD(this)}parseOperand(){return HE(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(KE(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes[this.branches.prefixes.length-1]??(this.branches.intersection?`&`:this.branches.union?`|`:this.branches.pipe?`|>`:void 0)}shiftedBy(e){return this.scanner.jumpForward(e),this}},hD=`An empty string is not a valid generic parameter name`,gD=(e,t,n)=>{e.shiftUntilNonWhitespace();let r=e.shiftUntilLookahead(kE);return r===``?e.lookahead===``&&t.length?t:K(hD):(e.shiftUntilNonWhitespace(),vD(e,r,t,n))},_D=`extends `,vD=(e,t,n,r)=>{if(e.shiftUntilNonWhitespace(),e.unscanned.startsWith(_D))e.jumpForward(8);else return e.lookahead===`,`&&e.shift(),n.push(t),gD(e,n,r);let i=fD(new mD(e,r));return n.push([t,i.root]),gD(e,n,r)},yD=class extends Bb{constructor(e){let t=(...t)=>{let n=t.indexOf(`:`),r=n===-1?t.length-1:n-1,i=t.slice(0,r+1),a=e.parse(i).assertHasKind(`intersection`),o=e.intrinsic.unknown;if(n!==-1){if(n!==t.length-2)return K(xD);o=e.parse(t[n+1])}return e=>new bD(e,a,o)};super(t,{attach:{$:e,raw:t}})}},bD=class extends Bb{raw;params;returns;expression;constructor(e,t,n){let r=`typed ${e.name}`,i={[r]:(...r)=>{let i=e(...t.assert(r));return n.assert(i)}}[r];super(i),this.raw=e,this.params=t,this.returns=n;let a=t.expression;a[0]===`[`&&a[a.length-1]===`]`?a=a.slice(1,-1):a.endsWith(`[]`)&&(a=`...${a}`),this.expression=`(${a}) => ${n?.expression??`unknown`}`}},xD=`":" must be followed by exactly one return type e.g:
39
- fn("string", ":", "number")(s => s.length)`,SD=class extends Bb{$;constructor(e){super((...t)=>new CD(e)(...t),{bind:e}),this.$=e}in(e){return new CD(this.$,e===void 0?void 0:this.$.parse(e))}at(e,t){return new CD(this.$).at(e,t)}case(e,t){return new CD(this.$).case(e,t)}},CD=class extends Bb{$;in;key;branches=[];constructor(e,t){super(e=>this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.parse(e),t]))),this.$=e,this.in=t}at(e,t){return this.key&&K(ED),this.branches.length&&K(TD),this.key=e,t?this.match(t):this}case(e,t){return this.caseEntry(this.$.parse(e),t)}caseEntry(e,t){let n=(this.key?this.$.parse({[this.key]:e}):e).pipe(t);return this.branches.push(n),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.node(`unit`,{unit:e}),t]))}caseEntries(e){for(let t=0;t<e.length;t++){let[n,r]=e[t];if(n==="default")return t!==e.length-1&&K(`default may only be specified as the last key of a switch definition`),this.default(r);if(typeof r!=`function`)return K(`Value for case "${n}" must be a function (was ${Qy(r)})`);this.caseEntry(n,r)}return this}default(e){typeof e==`function`&&this.case(cE.unknown,e);let t={branches:this.branches,ordered:!0};(e===`never`||e===`assert`)&&(t.meta={onFail:wD});let n=this.$.node(`union`,t);if(!this.in)return this.$.finalize(n);let r=this.in.pipe(n);return(e===`never`||e===`assert`)&&(r=r.configureReferences({onFail:wD},`self`)),this.$.finalize(r)}},wD=e=>e.throw(),TD=`A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')`,ED=`At most one key matcher may be specified per expression`,DD=(e,t)=>{if(Ob(e)){if(e[1]===`=`)return[t.$.parseOwnDefinitionFormat(e[0],t),`=`,e[2]];if(e[1]===`?`)return[t.$.parseOwnDefinitionFormat(e[0],t),`?`]}return uO(e,t)},OD=`Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }`,kD=`Only required keys may specify default values, e.g. { value: 'number = 0' }`,AD=(e,t)=>{let n,r={},i=gb(e);for(let[e,a]of i){let i=PD(e);if(i.kind===`spread`){if(!hb(r))return K(ND);let e=t.$.parseOwnDefinitionFormat(a,t);if(e.equals(cE.object))continue;if(!e.hasKind(`intersection`)||!e.basis?.equals(cE.object))return K(FD(e.expression));n=e.structure;continue}if(i.kind===`undeclared`){a!==`reject`&&a!==`delete`&&a!==`ignore`&&K(MD(a)),r.undeclared=a;continue}let o=DD(a,t),s=i;if(i.kind===`required`){Ob(o)?jD(r,`optional`,o[1]===`=`?{key:i.normalized,value:o[0],default:o[2]}:{key:i.normalized,value:o[0]},t):jD(r,`required`,{key:i.normalized,value:o},t);continue}if(Ob(o)&&(o[1]===`?`&&K(OD),o[1]===`=`&&K(kD)),i.kind===`optional`){jD(r,`optional`,{key:i.normalized,value:o},t);continue}let c=DT(t.$.parseOwnDefinitionFormat(s.normalized,t),o,t.$);c.index&&(r.index=Gy(r.index,c.index)),c.required&&(r.required=Gy(r.required,c.required))}let a=t.$.node(`structure`,r);return t.$.parseSchema({domain:`object`,structure:n?.merge(a)??a})},jD=(e,t,n,r)=>{e[t]=Gy(e[t],r.$.node(t,n))},MD=e=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Ox(e)})`,ND=`Spread operator may only be used as the first key in an object`,PD=e=>typeof e==`symbol`?{kind:`required`,normalized:e}:e[e.length-1]===`?`?e[e.length-2]===`\\`?{kind:`required`,normalized:`${e.slice(0,-2)}?`}:{kind:`optional`,normalized:e.slice(0,-1)}:e[0]===`[`&&e[e.length-1]===`]`?{kind:`index`,normalized:e.slice(1,-1)}:e[0]===`\\`&&e[1]===`[`&&e[e.length-1]===`]`?{kind:`required`,normalized:e.slice(1)}:e===`...`?{kind:`spread`}:e===`+`?{kind:`undeclared`}:{kind:`required`,normalized:e===`\\...`?`...`:e===`\\+`?`+`:e},FD=e=>`Spread operand must resolve to an object literal type (was ${e})`,ID=(e,t)=>XD(e)?YD[e[0]](e,t):JD(e)?qD[e[1]](e,t):null,LD=(e,t)=>t.$.parseOwnDefinitionFormat(e[1],t).keyof(),RD=(e,t)=>{if(e[2]===void 0)return K(BE(e[1],``));let n=t.$.parseOwnDefinitionFormat(e[0],t),r=t.$.parseOwnDefinitionFormat(e[2],t);if(e[1]===`|`)return t.$.node(`union`,{branches:[n,r]});let i=e[1]===`&`?qS(n,r,t.$):JS(n,r,t.$);return i instanceof HS?i.throw():i},zD=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).array(),BD=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).pipe(e[2]):K(VD(`=>`,e[2])),VD=(e,t)=>`${e===`:`?`Narrow`:`Morph`} expression requires a function following '${e}' (was ${typeof t})`,HD=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).constrain(`predicate`,e[2]):K(VD(`:`,e[2])),UD=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).configure(e[2],e[3]),WD=e=>e,GD=WD({"[]":zD,"?":()=>K(DE)}),KD=WD({"|":RD,"&":RD,":":HD,"=>":BD,"|>":RD,"@":UD,"=":()=>K(OE)}),qD={...GD,...KD},JD=e=>qD[e[1]]!==void 0,YD=(e=>e)({keyof:LD,instanceof:(e,t)=>{if(typeof e[1]!=`function`)return K(ZD(Db(e[1])));let n=e.slice(1).map(e=>typeof e==`function`?t.$.node(`proto`,{proto:e}):K(ZD(Db(e))));return n.length===1?n[0]:t.$.node(`union`,{branches:n})},"===":(e,t)=>t.$.units(e.slice(1))}),XD=e=>YD[e[0]]!==void 0,ZD=e=>`Expected a constructor following 'instanceof' operator (was ${e})`,QD=(e,t)=>{let n=[{}],r=0;for(;r<e.length;){let i=!1;e[r]===`...`&&r<e.length-1&&(i=!0,r++);let a=DD(e[r],t),[o,s,c]=Ob(a)?a:[a];if(r++,i){if(!o.extends(q.intrinsic.Array))return K(iO(o.expression));n=n.flatMap(e=>o.distribute(t=>rO($x(e),t)))}else n=n.map(e=>s===`?`?eO(e,o):s===`=`?tO(e,o,c):$D(e,o))}return t.$.parseSchema(n.map(e=>hb(e)?{proto:Array,exactLength:0}:{proto:Array,sequence:e}))},$D=(e,t)=>e.defaultables||e.optionals?K(e.variadic?uT:oO):(e.variadic?e.postfix=Gy(e.postfix,t):e.prefix=Gy(e.prefix,t),e),eO=(e,t)=>e.variadic?K(sO):(e.optionals=Gy(e.optionals,t),e),tO=(e,t,n)=>e.variadic?K(sO):e.optionals?K(cO):(e.defaultables=Gy(e.defaultables,[[t,n]]),e),nO=(e,t)=>(e.postfix&&K(aO),e.variadic?e.variadic.equals(t)||K(aO):e.variadic=t.internal,e),rO=(e,t)=>{let n=t.select({method:`find`,kind:`sequence`});if(!n)return nO(e,q.intrinsic.unknown);if(n.prefix)for(let t of n.prefix)$D(e,t);if(n.optionals)for(let t of n.optionals)eO(e,t);if(n.variadic&&nO(e,n.variadic),n.postfix)for(let t of n.postfix)$D(e,t);return e},iO=e=>`Spread element must be an array (was ${e})`,aO=`A tuple may have at most one variadic element`,oO=`A required element may not follow an optional element`,sO=`An optional element may not follow a variadic element`,cO=`A defaultable element may not follow an optional element without a default`,lO={},uO=(e,t)=>{if(typeof e==`string`){if(t.args&&Object.keys(t.args).some(t=>e.includes(t)))return uD(e,t);let n=lO[t.$.name]??={};return n[e]??=uD(e,t)}return Zy(e,`object`)?dO(e,t):K(mO(Qy(e)))},dO=(e,t)=>{let n=Eb(e);switch(n){case void 0:return tS(e,`root`)?e:`~standard`in e?fO(e,t):AD(e,t);case`Array`:return pO(e,t);case`RegExp`:return t.$.node(`intersection`,{domain:`string`,pattern:e},{prereduced:!0});case`Function`:{let t=Rb(e)?e():e;return tS(t,`root`)?t:K(mO(`Function`))}default:return K(mO(n??Ox(e)))}},fO=(e,t)=>t.$.intrinsic.unknown.pipe((t,n)=>{let r=e[`~standard`].validate(t);if(!r.issues)return r.value;for(let{message:e,path:t}of r.issues)t&&t.length?n.error({problem:Gb(e),relativePath:t.map(e=>typeof e==`object`?e.key:e)}):n.error({message:e})}),pO=(e,t)=>ID(e,t)??QD(e,t),mO=e=>`Type definitions must be strings or objects (was ${e})`,hO=class extends Bb{constructor(e){let t=Object.assign({errors:DS,hkt:Hb,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...t)=>{if(t.length===1)return e.parse(t[0]);if(t.length===2&&typeof t[0]==`string`&&t[0][0]===`<`&&t[0][t[0].length-1]===`>`){let n=t[0].slice(1,-1);return new uC(e.parseGenericParams(n,{}),t[1],e,e,null)}return e.parse(t)},{attach:t})}},gO=q,_O=class e extends WT{get ambientAttachments(){if(gO.typeAttachments)return this.cacheGetter(`ambientAttachments`,ob(gO.typeAttachments,(e,t)=>[e,this.bindReference(t)]))}preparseOwnAliasEntry(e,t){let n=e.indexOf(`<`);if(n===-1){if(tS(t,`module`)||tS(t,`generic`))return[e,t];let n=this.name===`ark`?e:e===`root`?this.name:`${this.name}.${e}`,r=this.resolvedConfig.keywords?.[n];return r&&(t=[t,`@`,r]),[e,t]}e[e.length-1]!==`>`&&K(`'>' must be the last character of a generic declaration in a scope`);let r=e.slice(0,n),i=e.slice(n+1,-1);return[r,()=>cC(this.parseGenericParams(i,{alias:r}),t,this)]}parseGenericParams(e,t){return gD(new zx(e),[],this.createParseContext({...t,def:e,prefix:`generic`}))}normalizeRootScopeValue(e){return Rb(e)&&!tS(e,`generic`)?e():e}preparseOwnDefinitionFormat(e,t){return{...t,def:e,prefix:t.alias??`type`}}parseOwnDefinitionFormat(e,t){!(t.alias&&t.alias in this.aliases)&&!t.args&&(t.args={this:t.id});let n=uO(e,t);if(Ob(n)){if(n[1]===`=`)return K(OE);if(n[1]===`?`)return K(DE)}return n}unit=e=>this.units([e]);valueOf=e=>this.units(bb(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node(`proto`,{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(e=>this.parse(e)));and=(...e)=>e.reduce((e,t)=>e.and(this.parse(t)),this.intrinsic.unknown);merge=(...e)=>e.reduce((e,t)=>e.merge(this.parse(t)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new yD(this);match=new SD(this);declare=()=>({type:this.type});define(e){return e}type=new hO(this);static scope=((t,n={})=>new e(t,n));static module=((e,t={})=>this.scope(e,t).export())},vO=Object.assign(_O.scope,{define:e=>e}),yO=_O,bO=class extends Hb{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'},xO=rE([`base`,cE.object],[`props`,cE.object])(e=>e.base.merge(e.props),bO),SO=yO.module({Key:cE.key,Merge:xO}),CO=class extends Hb{},wO=rE(`element`)(e=>{let t=e.element.exclude(cE.Array),n=t.array();return t.rawOr(n).pipe(By).distribute(e=>e.assertHasKind(`morph`).declareOut(n),tE)},CO),TO=yO.module({root:cE.Array,readonly:`root`,index:cE.nonNegativeIntegerString,liftFrom:wO},{name:`Array`}),EO=tE([`string`,bx.FileConstructor]),DO=tE({meta:`an object representing parsed form data`,domain:`object`,index:{signature:`string`,value:EO.rawOr(EO.array())}}),OO=yO.module({root:[`instanceof`,FormData],value:EO,parsed:DO,parse:tE({in:FormData,morphs:e=>{let t={};for(let[n,r]of e)if(n in t){let e=t[n];typeof e==`string`||e instanceof bx.FileConstructor?t[n]=[e,r]:e.push(r)}else t[n]=r;return t},declaredOut:DO})},{name:`FormData`}),kO=yO.module({Int8:[`instanceof`,Int8Array],Uint8:[`instanceof`,Uint8Array],Uint8Clamped:[`instanceof`,Uint8ClampedArray],Int16:[`instanceof`,Int16Array],Uint16:[`instanceof`,Uint16Array],Int32:[`instanceof`,Int32Array],Uint32:[`instanceof`,Uint32Array],Float32:[`instanceof`,Float32Array],Float64:[`instanceof`,Float64Array],BigInt64:[`instanceof`,BigInt64Array],BigUint64:[`instanceof`,BigUint64Array]},{name:`TypedArray`}),AO={Boolean:1,Number:1,String:1},jO=yO.module({...ob({...xb,...Cb},(e,t)=>e in AO?[]:[e,[`instanceof`,t]]),Array:TO,TypedArray:kO,FormData:OO}),MO=tE({domain:{domain:`number`,meta:`a number representing a Unix timestamp`},divisor:{rule:1,meta:`an integer representing a Unix timestamp`},min:{rule:-864e13,meta:`a Unix timestamp after -8640000000000000`},max:{rule:864e13,meta:`a Unix timestamp before 8640000000000000`},meta:`an integer representing a safe Unix timestamp`}),NO=tE({domain:`number`,divisor:1}),PO=yO.module({root:cE.number,integer:NO,epoch:MO,safe:tE({domain:{domain:`number`,numberAllowsNaN:!1},min:-(2**53-1),max:2**53-1}),NaN:[`===`,NaN],Infinity:[`===`,1/0],NegativeInfinity:[`===`,-1/0]},{name:`number`}),FO=(e,t,n)=>{let r={domain:`string`,pattern:{rule:e.source,flags:e.flags,meta:t}};return n&&(r.meta={format:n}),nE(`intersection`,r)},IO=FO(ox,`a well-formed integer string`),LO=yO.module({root:IO,parse:tE({in:IO,morphs:(e,t)=>{let n=Number.parseInt(e);return Number.isSafeInteger(n)?n:t.error(`an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER`)},declaredOut:cE.integer})},{name:`string.integer`}),RO=FO(/^[\dA-Fa-f]+$/,`hex characters only`),zO=yO.module({root:FO(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,`base64-encoded`),url:FO(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,`base64url-encoded`)},{name:`string.base64`}),BO=FO(/^[A-Z].*$/,`capitalized`),VO=yO.module({root:tE({in:`string`,morphs:e=>e.charAt(0).toUpperCase()+e.slice(1),declaredOut:BO}),preformatted:BO},{name:`string.capitalize`}),HO=tE({domain:`string`,pattern:{meta:`a credit card number`,rule:`^(?:4\\d{12}(?:\\d{3,6})?|5[1-5]\\d{14}|(222[1-9]|22[3-9]\\d|2[3-6]\\d{2}|27[01]\\d|2720)\\d{12}|6(?:011|5\\d\\d)\\d{12,15}|3[47]\\d{13}|3(?:0[0-5]|[68]\\d)\\d{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27]\\d{14}|^(81\\d{14,17}))$`},predicate:{meta:`a credit card number`,predicate:e=>{let t=e.replace(/[ -]+/g,``),n=0,r,i,a=!1;for(let e=t.length-1;e>=0;e--)r=t.substring(e,e+1),i=Number.parseInt(r,10),a?(i*=2,n+=i>=10?i%10+1:i):n+=i,a=!a;return!!(n%10==0&&t)}}}),UO=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,WO=tE({domain:`string`,predicate:{meta:`a parsable date`,predicate:e=>!Number.isNaN(new Date(e).valueOf())}}).assertHasKind(`intersection`),GO=LO.root.internal.narrow((e,t)=>{let n=Number.parseInt(e),r=PO.epoch(n);return r instanceof DS?(t.errors.merge(r),!1):!0}).configure({description:`an integer string representing a safe Unix timestamp`},`self`).assertHasKind(`intersection`),KO=yO.module({root:GO,parse:tE({in:GO,morphs:e=>new Date(e),declaredOut:cE.Date})},{name:`string.date.epoch`}),qO=FO(UO,`an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date`).internal.assertHasKind(`intersection`),JO=yO.module({root:qO,parse:tE({in:qO,morphs:e=>new Date(e),declaredOut:cE.Date})},{name:`string.date.iso`}),YO=yO.module({root:WO,parse:tE({declaredIn:WO,in:`string`,morphs:(e,t)=>{let n=new Date(e);return Number.isNaN(n.valueOf())?t.error(`a parsable date`):n},declaredOut:cE.Date}),iso:JO,epoch:KO},{name:`string.date`}),XO=FO(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,`an email address`,`email`),ZO=`(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,QO=`(${ZO}[.]){3}${ZO}`,$O=RegExp(`^${QO}$`),ek=`(?:[0-9a-fA-F]{1,4})`,tk=RegExp(`^((?:${ek}:){7}(?:${ek}|:)|(?:${ek}:){6}(?:${QO}|:${ek}|:)|(?:${ek}:){5}(?::${QO}|(:${ek}){1,2}|:)|(?:${ek}:){4}(?:(:${ek}){0,1}:${QO}|(:${ek}){1,3}|:)|(?:${ek}:){3}(?:(:${ek}){0,2}:${QO}|(:${ek}){1,4}|:)|(?:${ek}:){2}(?:(:${ek}){0,3}:${QO}|(:${ek}){1,5}|:)|(?:${ek}:){1}(?:(:${ek}){0,4}:${QO}|(:${ek}){1,6}|:)|(?::((?::${ek}){0,5}:${QO}|(?::${ek}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?\$`),nk=yO.module({root:[`v4 | v6`,`@`,`an IP address`],v4:FO($O,`an IPv4 address`,`ipv4`),v6:FO(tk,`an IPv6 address`,`ipv6`)},{name:`string.ip`}),rk=`a JSON string`,ik=e=>{if(!(e instanceof SyntaxError))throw e;return`must be ${rk} (${e})`},ak=tE({meta:rk,domain:`string`,predicate:{meta:rk,predicate:(e,t)=>{try{return JSON.parse(e),!0}catch(e){return t.reject({code:`predicate`,expected:rk,problem:ik(e)})}}}}),ok=yO.module({root:ak,parse:tE({meta:`safe JSON string parser`,in:`string`,morphs:(e,t)=>{if(e.length===0)return t.error({code:`predicate`,expected:rk,actual:`empty`});try{return JSON.parse(e)}catch(e){return t.error({code:`predicate`,expected:rk,problem:ik(e)})}},declaredOut:cE.jsonObject})},{name:`string.json`}),sk=FO(/^[a-z]*$/,`only lowercase letters`),ck=yO.module({root:tE({in:`string`,morphs:e=>e.toLowerCase(),declaredOut:sk}),preformatted:sk},{name:`string.lower`}),lk=[`NFC`,`NFD`,`NFKC`,`NFKD`],uk=ob(lk,(e,t)=>[t,tE({domain:`string`,predicate:e=>e.normalize(t)===e,meta:`${t}-normalized unicode`})]),dk=ob(lk,(e,t)=>[t,tE({in:`string`,morphs:e=>e.normalize(t),declaredOut:uk[t]})]),fk=yO.module({root:dk.NFC,preformatted:uk.NFC},{name:`string.normalize.NFC`}),pk=yO.module({root:dk.NFD,preformatted:uk.NFD},{name:`string.normalize.NFD`}),mk=yO.module({root:dk.NFKC,preformatted:uk.NFKC},{name:`string.normalize.NFKC`}),hk=yO.module({root:dk.NFKD,preformatted:uk.NFKD},{name:`string.normalize.NFKD`}),gk=yO.module({root:`NFC`,NFC:fk,NFD:pk,NFKC:mk,NFKD:hk},{name:`string.normalize`}),_k=FO(rx,`a well-formed numeric string`),vk=yO.module({root:_k,parse:tE({in:_k,morphs:e=>Number.parseFloat(e),declaredOut:cE.number})},{name:`string.numeric`}),yk=`a regex pattern`,bk=tE({domain:`string`,predicate:{meta:yk,predicate:(e,t)=>{try{return new RegExp(e),!0}catch(e){return t.reject({code:`predicate`,expected:yk,problem:String(e)})}}},meta:{format:`regex`}}),xk=FO(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,`a semantic version (see https://semver.org/)`),Sk=FO(/^\S.*\S$|^\S?$/,`trimmed`),Ck=yO.module({root:tE({in:`string`,morphs:e=>e.trim(),declaredOut:Sk}),preformatted:Sk},{name:`string.trim`}),wk=FO(/^[A-Z]*$/,`only uppercase letters`),Tk=yO.module({root:tE({in:`string`,morphs:e=>e.toUpperCase(),declaredOut:wk}),preformatted:wk},{name:`string.upper`}),Ek=tE({domain:`string`,predicate:{meta:`a URL string`,predicate:e=>URL.canParse(e)},meta:{format:`uri`}}),Dk=yO.module({root:Ek,parse:tE({declaredIn:Ek,in:`string`,morphs:(e,t)=>{try{return new URL(e)}catch{return t.error(`a URL string`)}},declaredOut:tE(URL)})},{name:`string.url`}),Ok=yO.module({root:[`versioned | nil | max`,`@`,{description:`a UUID`,format:`uuid`}],"#nil":`'00000000-0000-0000-0000-000000000000'`,"#max":`'ffffffff-ffff-ffff-ffff-ffffffffffff'`,"#versioned":/^[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,v1:FO(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv1`),v2:FO(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv2`),v3:FO(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv3`),v4:FO(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv4`),v5:FO(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv5`),v6:FO(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv6`),v7:FO(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv7`),v8:FO(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv8`)},{name:`string.uuid`}),kk=yO.module({root:cE.string,alpha:FO(/^[A-Za-z]*$/,`only letters`),alphanumeric:FO(/^[\dA-Za-z]*$/,`only letters and digits 0-9`),hex:RO,base64:zO,capitalize:VO,creditCard:HO,date:YO,digits:FO(/^\d*$/,`only digits 0-9`),email:XO,integer:LO,ip:nk,json:ok,lower:ck,normalize:gk,numeric:vk,regex:bk,semver:xk,trim:Ck,upper:Tk,url:Dk,uuid:Ok},{name:`string`}),Ak=yO.module({bigint:cE.bigint,boolean:cE.boolean,false:cE.false,never:cE.never,null:cE.null,number:cE.number,object:cE.object,string:cE.string,symbol:cE.symbol,true:cE.true,unknown:cE.unknown,undefined:cE.undefined}),jk=yO.module({root:cE.unknown,any:cE.unknown},{name:`unknown`}),Mk=yO.module({root:cE.jsonObject,stringify:nE(`morph`,{in:cE.jsonObject,morphs:e=>JSON.stringify(e),declaredOut:cE.string})},{name:`object.json`}),Nk=yO.module({root:cE.object,json:Mk},{name:`object`}),Pk=class extends Hb{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'},Fk=rE([`K`,cE.key],`V`)(e=>({domain:`object`,index:{signature:e.K,value:e.V}}),Pk),Ik=class extends Hb{description='pick a set of properties from an object like `Pick(User, "name | age")`'},Lk=rE([`T`,cE.object],[`K`,cE.key])(e=>e.T.pick(e.K),Ik),Rk=class extends Hb{description='omit a set of properties from an object like `Omit(User, "age")`'},zk=rE([`T`,cE.object],[`K`,cE.key])(e=>e.T.omit(e.K),Rk),Bk=class extends Hb{description="make all named properties of an object optional like `Partial(User)`"},Vk=rE([`T`,cE.object])(e=>e.T.partial(),Bk),Hk=class extends Hb{description="make all named properties of an object required like `Required(User)`"},Uk=rE([`T`,cE.object])(e=>e.T.required(),Hk),Wk=class extends Hb{description='exclude branches of a union like `Exclude("boolean", "true")`'},Gk=rE(`T`,`U`)(e=>e.T.exclude(e.U),Wk),Kk=class extends Hb{description='extract branches of a union like `Extract("0 | false | 1", "number")`'},qk=rE(`T`,`U`)(e=>e.T.extract(e.U),Kk),Jk=yO.module({Exclude:Gk,Extract:qk,Omit:zk,Partial:Vk,Pick:Lk,Record:Fk,Required:Uk}),Yk=vO({...Ak,...Jk,...jO,...SO,string:kk,number:PO,object:Nk,unknown:jk},{prereducedAliases:!0,name:`ark`}),Xk=Yk.export();Object.assign(gO.ambient,Xk),gO.typeAttachments={string:Xk.string.root,number:Xk.number.root,bigint:Xk.bigint,boolean:Xk.boolean,symbol:Xk.symbol,undefined:Xk.undefined,null:Xk.null,object:Xk.object.root,unknown:Xk.unknown.root,false:Xk.false,true:Xk.true,never:Xk.never,arrayIndex:Xk.Array.index,Key:Xk.Key,Record:Xk.Record,Array:Xk.Array.root,Date:Xk.Date};var J=Object.assign(Yk.type,gO.typeAttachments);Yk.match,Yk.fn,Yk.generic,Yk.schema,Yk.define,Yk.declare;var Zk=J(`"local" | "lan" | /^\\d{1,3}(?:\\.\\d{1,3}){3}$/`),Qk=J(`/^[a-z0-9][a-z0-9_-]*$/`);J({id:Qk,label:`1 <= string <= 60`}).onUndeclaredKey(`reject`),J({"id?":Qk,"label?":`1 <= string <= 60`}).onUndeclaredKey(`reject`),J({label:`1 <= string <= 60`}).onUndeclaredKey(`reject`);function $k(e){let t=Zk(e);return t instanceof J.errors?null:t}var eA=J(`1 <= number.integer <= 65535 | null`),tA=J.enumerated(`block`,`warn`,`follow`,`reclaim`,`kill`),nA=tA.default(`block`),rA=J({enabled:`boolean = true`,maxRetries:`number.integer >= 0 = 3`,baseDelayMs:`number >= 0 = 1000`,factor:`number >= 1 = 2`,maxDelayMs:`number >= 0 = 30000`,resetAfterMs:`number >= 0 = 60000`}).onUndeclaredKey(`reject`),iA=J({path:`string = "/"`,method:`"GET" | "HEAD" = "GET"`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer = 400`,expectBody:`string = ""`}).onUndeclaredKey(`reject`),aA=J({maxRssBytes:`number.integer >= 0 = 0`}).onUndeclaredKey(`reject`),oA=J({enabled:`boolean = true`,mode:`"port" | "http" = "port"`,http:iA.default(()=>({})),intervalMs:`number >= 500 = 5000`,timeoutMs:`number >= 100 = 1500`,unhealthyThreshold:`number.integer >= 1 = 3`,forceRestartAfterMs:`number >= 0 = 0`,startTimeoutMs:`number >= 0 = 20000`}).onUndeclaredKey(`reject`),sA=J({signal:`"SIGTERM" | "SIGINT" | "SIGKILL" = "SIGTERM"`,killGroup:`boolean = true`,graceMs:`number >= 0 = 5000`,killPortHolders:`boolean = false`}).onUndeclaredKey(`reject`),cA=J({command:`string`,args:J(`string[]`).default(()=>[]),env:J(`Record<string, string>`).default(()=>({})),timeoutMs:`number >= 1000 = 120000`,runOnce:`boolean = true`}).onUndeclaredKey(`reject`).or(J(`null`)),lA=J(`string | null`),uA=J(`50 <= number.integer <= 100000`),dA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:lA.optional(),enabled:`boolean = true`,autostart:`boolean = false`,persistent:`boolean = false`,command:`string >= 1`,args:J(`string[]`).default(()=>[]),cwd:`string = "."`,env:J(`Record<string, string>`).default(()=>({})),dataEnvs:J(`Record<string, string>`).default(()=>({})),bootstrap:cA.optional(),port:eA.optional(),bind:Zk.default(()=>`local`),onPortConflict:nA,restart:rA.default(()=>({})),health:oA.default(()=>({})),stop:sA.default(()=>({})),logBufferLines:uA.default(()=>500),dependsOn:J(`string[]`).default(()=>[]),envFile:`string = ""`,resources:aA.default(()=>({})),backupPaths:J(`string[]`).default(()=>[]),backupIgnoreGenerated:`boolean = true`}).onUndeclaredKey(`reject`),fA=J({enabled:`boolean = true`,sessionTtlMs:`number >= 60000 = 604800000`,cookieSecure:`"auto" | "always" | "never" = "auto"`,trustProxy:`boolean | "loopback" = false`,maxLoginAttempts:`number.integer >= 1 = 5`,lockoutMs:`number >= 1000 = 60000`}).onUndeclaredKey(`reject`);J({telegram:J({enabled:`boolean = false`,chatId:`string = ""`,onCrash:`boolean = true`,onUnhealthy:`boolean = true`,onForcedRestart:`boolean = true`,onRecovered:`boolean = false`,onHost:`boolean = true`,onDdns:`boolean = true`,cooldownMs:`number >= 0 = 120000`}).onUndeclaredKey(`reject`).default(()=>({}))}).onUndeclaredKey(`reject`);var pA=J({persist:`boolean = true`,maxBytes:`10000 <= number <= 100000000 = 2000000`,keep:`1 <= number.integer <= 10 = 3`}).onUndeclaredKey(`reject`),mA=J({enabled:`boolean = false`}).onUndeclaredKey(`reject`),hA=J({enabled:`boolean = true`,intervalMs:`number >= 5000 = 15000`,diskPaths:J(`string[]`).default(()=>[`.`]),diskUsedPercent:`number >= 0 = 90`,memoryUsedPercent:`number >= 0 = 90`,swapUsedPercent:`number >= 0 = 50`,loadPerCpu:`number >= 0 = 2`,tempCelsius:`number >= 0 = 85`}).onUndeclaredKey(`reject`),gA=J.enumerated(`A`,`AAAA`),_A=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,provider:`string >= 1`,label:`string = ""`}).onUndeclaredKey(`reject`),vA=J({host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/`,account:`string >= 1`,types:gA.array().default(()=>[`A`]),zone:`string?`,ttl:`number.integer >= 1?`,proxied:`boolean = false`,enabled:`boolean = true`}).onUndeclaredKey(`reject`),yA=J({enabled:`boolean = true`,url:`string = ""`}).onUndeclaredKey(`reject`),bA=J({enabled:`boolean = false`,url:`string = ""`}).onUndeclaredKey(`reject`),xA=J({enabled:`boolean = false`,intervalMs:`number >= 60000 = 300000`,ipv4:yA.default(()=>({})),ipv6:bA.default(()=>({})),ttl:`number.integer >= 1 = 1`,accounts:_A.array().default(()=>[]),domains:vA.array().default(()=>[])}).onUndeclaredKey(`reject`),SA=J({enabled:`boolean`,running:`boolean`,lastRunAt:`number | null`,lastResult:`string | null`,ipv4:`string | null`,ipv6:`string | null`,records:J({host:`string`,account:`string`,provider:`string`,type:gA,ip:`string | null`,state:J(`"pending" | "ok" | "unchanged" | "error" | "skipped"`),message:`string | null`,updatedAt:`number | null`}).array()}),CA=J({key:`string`,label:`string`,hint:`string = ""`,optional:`boolean = false`}),wA=J({config:xA,status:SA,providers:J({id:`string`,label:`string`,docsUrl:`string`,families:gA.array(),fields:CA.array(),ttl:`boolean`,proxied:`boolean`,txt:`boolean`}).array(),credentials:J(`string[]`)});J({provider:`string >= 1`,credentials:J(`Record<string, string>`)}).onUndeclaredKey(`reject`),J({enabled:`boolean?`,intervalMs:`number >= 60000?`,ipv4:J({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ipv6:J({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ttl:`number.integer >= 1?`,accounts:_A.array().optional(),domains:vA.array().optional()}).onUndeclaredKey(`reject`),J({enabled:`boolean = true`,dir:`string = ".backups"`,keep:`number.integer >= 1 = 5`,includePaths:J(`string[]`).default(()=>[])}).onUndeclaredKey(`reject`),J({label:`1 <= string <= 60 = "home-hosted"`,port:`1 <= number.integer <= 65535 = 3999`,host:Zk.default(()=>`local`),openBrowser:`boolean = false`,auth:fA.default(()=>({})),tls:mA.default(()=>({}))}).onUndeclaredKey(`reject`);var TA=J({enabled:`boolean = true`,autostart:`boolean = false`,bind:Zk.default(()=>`local`),onPortConflict:nA,restart:rA.default(()=>({})),health:oA.default(()=>({})),stop:sA.default(()=>({})),logBufferLines:uA.default(()=>500)}).onUndeclaredKey(`reject`),EA=J({enabled:`boolean?`,maxRetries:`number.integer >= 0?`,baseDelayMs:`number >= 0?`,factor:`number >= 1?`,maxDelayMs:`number >= 0?`,resetAfterMs:`number >= 0?`}).onUndeclaredKey(`reject`),DA=J({path:`string?`,method:`"GET" | "HEAD"?`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer?`,expectBody:`string?`}).onUndeclaredKey(`reject`),OA=J({maxRssBytes:`number.integer >= 0?`}).onUndeclaredKey(`reject`),kA=J({enabled:`boolean?`,mode:`"port" | "http"?`,http:DA.optional(),intervalMs:`number >= 500?`,timeoutMs:`number >= 100?`,unhealthyThreshold:`number.integer >= 1?`,forceRestartAfterMs:`number >= 0?`,startTimeoutMs:`number >= 0?`}).onUndeclaredKey(`reject`),AA=J({signal:`"SIGTERM" | "SIGINT" | "SIGKILL"?`,killGroup:`boolean?`,graceMs:`number >= 0?`,killPortHolders:`boolean?`}).onUndeclaredKey(`reject`),jA=J({enabled:`boolean?`,sessionTtlMs:`number >= 60000?`,cookieSecure:`"auto" | "always" | "never"?`,trustProxy:`boolean | "loopback"?`,maxLoginAttempts:`number.integer >= 1?`,lockoutMs:`number >= 1000?`}).onUndeclaredKey(`reject`),MA=J({telegram:J({enabled:`boolean?`,chatId:`string?`,onCrash:`boolean?`,onUnhealthy:`boolean?`,onForcedRestart:`boolean?`,onRecovered:`boolean?`,onHost:`boolean?`,onDdns:`boolean?`,cooldownMs:`number >= 0?`}).onUndeclaredKey(`reject`).optional()}).onUndeclaredKey(`reject`),NA=J({enabled:`boolean?`,intervalMs:`number >= 5000?`,diskPaths:J(`string[]`).optional(),diskUsedPercent:`number >= 0?`,memoryUsedPercent:`number >= 0?`,swapUsedPercent:`number >= 0?`,loadPerCpu:`number >= 0?`,tempCelsius:`number >= 0?`}).onUndeclaredKey(`reject`),PA=J({enabled:`boolean?`,dir:`string?`,keep:`number.integer >= 1?`,includePaths:J(`string[]`).optional()}).onUndeclaredKey(`reject`),FA=J({persist:`boolean?`,maxBytes:`10000 <= number <= 100000000?`,keep:`1 <= number.integer <= 10?`}).onUndeclaredKey(`reject`),IA=J({enabled:`boolean?`}).onUndeclaredKey(`reject`),LA=J({label:`1 <= string <= 60 | null?`,port:`1 <= number.integer <= 65535?`,host:Zk.optional(),openBrowser:`boolean?`,auth:jA.optional(),tls:IA.optional()}).onUndeclaredKey(`reject`),RA=J({enabled:`boolean?`,autostart:`boolean?`,bind:Zk.optional(),onPortConflict:tA.optional(),restart:EA.optional(),health:kA.optional(),stop:AA.optional(),logBufferLines:uA.optional()}).onUndeclaredKey(`reject`),zA={label:lA.optional(),enabled:`boolean?`,autostart:`boolean?`,persistent:`boolean?`,command:`string?`,args:`string[]?`,cwd:`string?`,env:`Record<string, string>?`,dataEnvs:`Record<string, string>?`,bootstrap:cA.optional(),port:eA.optional(),bind:Zk.optional(),onPortConflict:tA.optional(),restart:EA.optional(),health:kA.optional(),stop:AA.optional(),logBufferLines:uA.optional(),dependsOn:J(`string[]`).optional(),envFile:`string?`,resources:OA.optional(),backupPaths:J(`string[]`).optional(),backupIgnoreGenerated:`boolean?`},BA=J(zA).onUndeclaredKey(`reject`),VA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,...zA,command:`string`}).onUndeclaredKey(`reject`);J({serverId:`string`,command:`string`,args:`string[]`,cwd:`string`,env:`Record<string, string>`,logDir:`string`,logs:pA,stop:sA}).onUndeclaredKey(`reject`),J({serverId:`string`,nannyPid:`number`,childPid:`number | null`,startedAt:`number`,logFile:`string`,heartbeatAt:`number`,"lastExit?":J({code:`number | null`,signal:`string | null`,at:`number`,runtimeMs:`number`}).onUndeclaredKey(`reject`)}).onUndeclaredKey(`reject`);var HA=J({control:LA.optional(),host:NA.optional(),backups:PA.optional()}).onUndeclaredKey(`reject`),UA=J({defaults:RA.optional(),logs:FA.optional(),notifications:MA.optional()}).onUndeclaredKey(`reject`),WA=J({enabled:`boolean`,passwordSet:`boolean`,passwordUpdatedAt:`number | null`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,exposed:`boolean`,blockedReason:`string | null`,sessionTtlMs:`number`,cookieSecure:`string`,trustProxy:`boolean | "loopback"`,maxLoginAttempts:`number`,lockoutMs:`number`}),GA=J({enabled:`boolean`,certPresent:`boolean`,subject:`string | null`,issuer:`string | null`,validFrom:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,fingerprint:`string | null`,keyMatches:`boolean | null`,error:`string | null`}),KA=J.enumerated(`caddy`),qA=J.enumerated(`server`,`panel`,`external`),JA=J.enumerated(`auto`,`off`,`manual`),YA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/`,enabled:`boolean = true`,target:qA.default(()=>`server`),workspace:`string = ""`,server:`string = ""`,url:`string = ""`,path:`string = ""`,tls:JA.default(()=>`auto`),dnsAccount:`string = ""`}).onUndeclaredKey(`reject`),XA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:`string = ""`}).onUndeclaredKey(`reject`),ZA=J.enumerated(`off`,`local`,`uploaded`,`issued`,`pending`,`failed`,`fallback`),QA=J({enabled:`boolean = false`,resolvers:J(`string[]`).default(()=>[])}).onUndeclaredKey(`reject`),$A=J({enabled:`boolean = false`,engine:KA.default(()=>`caddy`),httpPort:`1 <= number.integer <= 65535 = 80`,httpsPort:`1 <= number.integer <= 65535 = 443`,email:`string = ""`,staging:`boolean = false`,dns01:QA.default(()=>({})),certificates:XA.array().default(()=>[]),routes:YA.array().default(()=>[])}).onUndeclaredKey(`reject`),ej=J({id:KA,installed:`boolean`,version:`string | null`,source:J.enumerated(`downloaded`,`custom`).or(J(`null`)),path:`string | null`,bytes:`number | null`,error:`string | null`}),tj=J({id:KA,label:`string`,docsUrl:`string`,releaseUrl:`string`,acme:`boolean`,internalCa:`boolean`,dns01:`boolean`,tcp:`boolean`}),nj=J({route:YA,status:J.enumerated(`ok`,`disabled`,`no-upstream`,`error`),upstream:`string | null`,message:`string | null`,"certificate?":J({state:ZA,message:`string | null`,"retryInMinutes?":`number`})}),rj=J({state:J.enumerated(`off`,`stopped`,`starting`,`running`,`error`,`unsupported`),pid:`number | null`,urls:J(`string[]`),certExpiryDays:`number | null`,since:`number | null`,lastError:`string | null`}),ij=J({id:`string`,label:`string`,present:`boolean`,used:`boolean`,subject:`string | null`,issuer:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,hosts:J(`string[]`),error:`string | null`}),aj=J({workspace:`string`,account:`string`,provider:`string`,label:`string`,writesTxt:`boolean`,hasCredentials:`boolean`}),oj=J({config:$A,engine:ej,engines:tj.array(),status:rj,routes:nj.array(),certificates:ij.array(),"dnsAccounts?":aj.array()}),sj=J({id:`string`,host:`string`,enabled:`boolean?`,target:qA.optional(),workspace:`string?`,server:`string?`,url:`string?`,path:`string?`,tls:JA.optional(),dnsAccount:`string?`}).onUndeclaredKey(`reject`),cj=J({enabled:`boolean?`,engine:KA.optional(),httpPort:`1 <= number.integer <= 65535?`,httpsPort:`1 <= number.integer <= 65535?`,email:`string?`,staging:`boolean?`,dns01:J({enabled:`boolean | null?`,resolvers:`string[] | null?`}).onUndeclaredKey(`reject`).optional(),certificates:XA.array().optional(),routes:sj.array().optional()}).onUndeclaredKey(`reject`),lj=J({label:`string = ""`,certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`);J({version:`string = ""`}).onUndeclaredKey(`reject`);var uj=J({enabled:`boolean`,tokenSet:`boolean`,chatId:`string`,onCrash:`boolean`,onUnhealthy:`boolean`,onForcedRestart:`boolean`,onRecovered:`boolean`,onHost:`boolean`,onDdns:`boolean?`,cooldownMs:`number`,lastResult:`string | null`,lastResultAt:`number | null`});J({chats:J({id:`string | number`,title:`string`}).array()});var dj=J({telegram:uj});J({authenticated:`boolean`,authRequired:`boolean`,passwordSet:`boolean`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,defaultPassword:`string | null`,sessionTtlMs:`number`});var fj=J({password:`string`}).onUndeclaredKey(`reject`),pj=J(`1 <= string <= 512`),mj=J({currentPassword:`string?`,newPassword:pj}).onUndeclaredKey(`reject`),hj=J(`"stopped" | "starting" | "running" | "stopping" | "backoff" | "crashed" | "conflict"`),gj=J(`"disabled" | "unknown" | "healthy" | "unhealthy"`),_j=J(`"unknown" | "free" | "in-use"`),vj=J({ts:`number`,stream:J(`"stdout" | "stderr" | "system"`),text:`string`}),yj=J({windowMs:`number`,uptimeRatio:`number | null`,restarts:`number`,crashes:`number`,forcedRestarts:`number`,lastCrashAt:`number | null`,lastExitAt:`number | null`,lastRuntimeMs:`number | null`,events:J({serverId:`string`,ts:`number`,type:`"start" | "exit" | "crash" | "forced-restart" | "unhealthy" | "recovered"`,detail:`string`,runtimeMs:`number?`}).array()}),bj=J({cpuPercent:`number | null`,rssBytes:`number | null`,processes:`number`,sampledAt:`number`}),xj=J({path:`string`,totalBytes:`number`,freeBytes:`number`,usedPercent:`number`}),Sj=J({enabled:`boolean`,cpus:`number`,loadAvg:J(`number[]`),uptimeMs:`number`,memoryUsedPercent:`number`,swapUsedPercent:`number`,tempCelsius:`number | null`,disks:xj.array(),alerts:J(`string[]`),sampledAt:`number | null`}),Cj=J({name:`string`,sizeBytes:`number`,createdAt:`number`,encrypted:`boolean`}),wj=J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "secrets" | "tls" | "workspace"`,"workspaceId?":`string`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`,items:J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "servers" | "secrets" | "data"`,"path?":`string`,"origin?":`string`,included:`boolean`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`,"ignoreGenerated?":`boolean`}).array()}),Tj=J({enabled:`boolean`,dir:`string`,keep:`number`,includePaths:J(`string[]`),entries:wj.array(),files:Cj.array()}),Ej=J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "secrets" | "servers" | "tls" | "data"`,"workspaceId?":`string`,restorable:`boolean`,selected:`boolean`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`}),Dj=J({label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,"reasonKey?":`string`,"reasonParams?":`Record<string, string>`});J({dryRun:`boolean`,encrypted:`boolean`,needsPassword:`boolean`,items:Ej.array(),applied:J(`string[]`),"appliedIds?":J(`string[]`),skipped:J(`string[]`),"skippedItems?":Dj.array(),restartRequired:`boolean`,reloaded:`boolean`,error:`string?`}),J({password:pj.optional(),include:J(`string[] >= 1`).optional()}).onUndeclaredKey(`reject`),J({name:`string?`,password:pj.optional(),include:J(`string[]`).optional()}).onUndeclaredKey(`reject`);var Oj=J({id:`string`,"workspaceId?":`string`,config:dA,bindHost:`string`,url:`string | null`,status:hj,health:gj,portState:_j,pid:`number | null`,adopted:`boolean?`,startedAt:`number | null`,exitCode:`number | null`,exitSignal:`string | null`,restarts:`number`,maxRetries:`number`,lastError:`string | null`,nextRetryAt:`number | null`,unhealthySince:`number | null`,bufferedLines:`number`,history:yj,responseMs:`number | null`,resources:bj.or(J(`null`))});J({status:`"ok" | "degraded"`,uptimeMs:`number`,"servers?":J({total:`number`,running:`number`,crashed:`number`,unhealthy:`number`}),"hostAlerts?":`string[]`});var kj=J({label:`string`,port:`number`,host:`string`,bindHost:`string`,url:`string`,openBrowser:`boolean`,restartRequired:`boolean`,protocol:`string`,auth:WA,tls:GA}),Aj=J({custom:`boolean`,dir:`string`,meta:J({"name?":`string`,"version?":`string | null`,"uploadedAt?":`number`,"files?":`number.integer >= 1`,"repo?":`string`,"tag?":`string`,"asset?":`string`,"unix?":`number.integer >= 0`}).or(J(`null`))}),jj=J({id:`string`,label:`string`,configPath:`string`,settingsPath:`string`,configError:`string | null`,"configWarnings?":J(`string[]`),logsDir:`string`,defaults:TA,logs:pA,notifications:dj,"ddns?":SA,serverCount:`number`,runningCount:`number`,crashedCount:`number`,servers:Oj.array()}),Mj=J({control:kj,host:Sj,backups:Tj,ui:Aj,workspaces:jj.array(),"proxy?":oj,projectDir:`string`,dataRoot:`string`,"version?":`string`}),Nj=J({type:`"hello" | "state" | "log" | "server"`,ts:`number`,"workspaceId?":`string`,serverId:`string?`,state:Mj.optional(),server:Oj.optional(),lines:vj.array().optional()});J({limit:`string?`}),J({ok:`boolean`,port:`number | null`,terminated:`number[]`,forced:`number[]`,skipped:`number[]`,free:`boolean`}),J({tail:`string?`,search:`string?`,stream:`"stdout" | "stderr" | "system"?`});var Pj=J({servers:J({serverId:`string`,label:`string`,status:hj,enabled:`boolean`,sizeBytes:`number`,files:J({name:`string`,sizeBytes:`number`}).array()}).array()}),Fj=J({serverId:`string`,enabled:`boolean`,sizeBytes:`number`,files:J(`string[]`),searched:`number | null`,lines:vj.array()});J({botToken:`string?`,chatId:`string?`}).onUndeclaredKey(`reject`),J({botToken:`string >= 1`}).onUndeclaredKey(`reject`),J({message:`string`,code:`string`,"detail?":`unknown`}).onUndeclaredKey(`reject`),J({certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`),J({control:kj,host:hA,backups:Tj,ui:Aj}).and(J({rebinding:`boolean`,targetUrl:`string | null`}));var Ij=J({id:`string`,label:`string`,settingsPath:`string`,configPath:`string`,configError:`string | null`,defaults:TA,logs:pA,notifications:dj});function Lj(e){return e instanceof Error?e.message:String(e)}function Rj(e,t){return`${e}/${t}`}function zj(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Bj=class extends Error{name=`AuthRequiredError`;constructor(){super(`authentication required`)}};async function Vj(e,t){let n=await fetch(e,{...t,headers:{"Content-Type":`application/json`,...t?.headers}}),r=await n.text(),i=r.length>0?JSON.parse(r):null;if(!n.ok){if(n.status===401&&zj(i)&&i.code===`AUTH_REQUIRED`)throw new Bj;let e=zj(i)&&typeof i.message==`string`?i.message:zj(i)&&`error`in i?String(i.error):`request failed with ${n.status}`;throw Error(e)}return i}async function Hj(e){let t=oj(e);if(t instanceof J.errors)throw Error(`proxy contract mismatch: ${t.summary}`);return t}async function Uj(e){let t=wA(e);if(t instanceof J.errors)throw Error(`ddns contract mismatch: ${t.summary}`);return t}function Wj(e){return Vj(`/api/proxy/${e}`,{method:`POST`}).then(Hj)}function Gj(){return Wj(`apply`)}function Kj(e){return`/api/backups/${encodeURIComponent(e)}/download`}function qj(){return Vj(`/api/auth/password`,{method:`DELETE`})}async function Jj(e){return Hj(await Vj(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`DELETE`}))}function Yj(e){return Vj(`/api/backups/${encodeURIComponent(e)}`,{method:`DELETE`})}async function Xj(){return Hj(await Vj(`/api/proxy`))}function Zj(){return Vj(`/api/auth/session`)}function Qj(){return Vj(`/api/settings`)}async function $j(e=``){return Hj(await Vj(`/api/proxy/engine`,{method:`POST`,body:JSON.stringify({version:e})}))}function eM(e){let t=fj({password:e});if(t instanceof J.errors)throw Error(t.summary);return Vj(`/api/auth/login`,{method:`POST`,body:JSON.stringify(t)})}function tM(){return Vj(`/api/auth/logout`,{method:`POST`})}async function nM(e){let t=cj(e);if(t instanceof J.errors)throw Error(t.summary);return Hj(await Vj(`/api/proxy`,{method:`PATCH`,body:JSON.stringify(t)}))}function rM(e){let t={};return e.password!==void 0&&e.password.length>0&&(t.password=e.password),e.include!==void 0&&(t.include=e.include),t}function iM(e,t,n={}){return Vj(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:JSON.stringify({name:e,...rM(n)})})}async function aM(e){return Hj(await Vj(`/api/proxy/routes/${encodeURIComponent(e)}/retry-certificate`,{method:`POST`}))}function oM(){return Wj(`revert`)}function sM(){return Vj(`/api/settings/ui`,{method:`DELETE`})}function cM(e,t){let n=mj(e===void 0?{newPassword:t}:{currentPassword:e,newPassword:t});if(n instanceof J.errors)throw Error(n.summary);return Vj(`/api/auth/password`,{method:`POST`,body:JSON.stringify(n)})}function lM(){return Wj(`start`)}function uM(){return Wj(`stop`)}async function dM(e,t,n,r){let i=lj({label:t,certificate:n,privateKey:r});if(i instanceof J.errors)throw Error(i.summary);return Hj(await Vj(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(i)}))}async function fM(e){let t=new FormData;t.append(`file`,e);let n=await fetch(`/api/settings/ui`,{method:`POST`,body:t}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.message??r?.error??`the upload failed with ${n.status}`);return r}var pM=/^[\w!#$%&'*.^`|~+-]+$/,mM=(e,t,n={})=>{if(!pM.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},hM=(e,t,n)=>(t=encodeURIComponent(t),mM(e,t,n)),gM=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),_M=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??(?=/|$)`);e=e.replace(t,()=>r?`/${r}`:``)}return e},vM=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.set(n,r)}return t},yM=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},bM=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function xM(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function SM(e,t){if(!xM(e)&&!xM(t))return t;let n={...e};for(let e in t){let r=t[e];n[e]=xM(n[e])&&xM(r)?SM(n[e],r):r}return n}var CM=(e,t)=>new Proxy(()=>{},{get(n,r){if(typeof r==`string`&&r!==`then`)return CM(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),wM=(e,t)=>{let n=t.toString();return n?`${e}?${n}`:e},TM=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.append(n,r)}this.rBody=t}e.json!==void 0&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))r!==void 0&&t.push(hM(n,r));t.length>0&&(r.Cookie=t.join(`; `))}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers;for(let[e,t]of Object.entries(r))t!==void 0&&i.set(e,t);let a=this.url;a=bM(a),a=_M(a,this.pathParams),this.queryParams&&(a=wM(a,this.queryParams)),n=this.method.toUpperCase();let o=n!==`GET`&&n!==`HEAD`;return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},EM=((e,t)=>CM(function n(r){let i=t?.buildSearchParams??vM,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=gM(e,a.join(`/`));if(s===`url`||s===`path`){let t=bM(c);return r.args[0]&&(r.args[0].param&&(t=_M(t,r.args[0].param)),r.args[0].query&&(t=wM(t,i(r.args[0].query)))),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=bM(c),n=yM(r.args[0]?.param?_M(e,r.args[0].param):e,`ws`),a=new URL(n),o=r.args[0]?.query;return o&&i(o).forEach((e,t)=>{a.searchParams.append(t,e)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(a.toString())}let l=new TM(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=SM(t,e);return l.fetch(r.args[0],a)}return l},[]))(typeof window>`u`?`http://127.0.0.1`:window.location.origin);J({workspaces:jj.array()});var DM=J({workspace:jj}),OM=J({ok:`boolean`,removed:`unknown`});function kM(e){return e==null||e.length===0?``:`?workspace=${encodeURIComponent(e)}`}function AM(e,t){return{param:{id:t},query:e.length>0?{workspace:e}:{}}}function jM(e,t,n){let r=n??new URLSearchParams;t.length>0&&r.set(`workspace`,t);let i=r.toString();return i.length>0?`${e}?${i}`:e}async function MM(){let e=Mj(await Vj(`/api/state`));if(e instanceof J.errors)throw Error(`state contract mismatch: ${e.summary}`);return e}async function NM(e){let t=DM(e);if(t instanceof J.errors)throw Error(`workspace contract mismatch: ${t.summary}`);return t.workspace}async function PM(e){return NM(await Vj(`/api/workspaces`,{method:`POST`,body:JSON.stringify(e)}))}async function FM(e,t){return NM(await Vj(`/api/workspaces/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({label:t})}))}async function IM(e){let t=OM(await Vj(`/api/workspaces/${encodeURIComponent(e)}`,{method:`DELETE`}));if(t instanceof J.errors)throw Error(`workspace removal contract mismatch: ${t.summary}`);return t}function LM(e){let t=HA(e);if(t instanceof J.errors)throw Error(t.summary);return Vj(`/api/settings`,{method:`PATCH`,body:JSON.stringify(t)})}async function RM(e,t){let n=UA(t);if(n instanceof J.errors)throw Error(n.summary);let r=Ij(await Vj(jM(`/api/settings/workspace`,e),{method:`PATCH`,body:JSON.stringify(n)}));if(r instanceof J.errors)throw Error(`workspace settings contract mismatch: ${r.summary}`);return r}async function zM(e){let t=Pj(await Vj(jM(`/api/logs`,e)));if(t instanceof J.errors)throw Error(`logs contract mismatch: ${t.summary}`);return t.servers}async function BM(e,t,n){let r=new URLSearchParams;n.tail!==void 0&&r.set(`tail`,String(n.tail)),n.search!==void 0&&n.search.length>0&&r.set(`search`,n.search),n.stream!==void 0&&n.stream.length>0&&r.set(`stream`,n.stream);let i=Fj(await Vj(jM(`/api/logs/${encodeURIComponent(t)}`,e,r)));if(i instanceof J.errors)throw Error(`log history contract mismatch: ${i.summary}`);return i}function VM(e,t){return Vj(jM(`/api/logs/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function HM(e,t,n){return jM(`/api/logs/${encodeURIComponent(t)}/download`,e,new URLSearchParams({file:n}))}function UM(e,t){if(t!==void 0&&t.length===0)throw Error("nothing is selected: omit `include` to capture everything, or select at least one item");let n={};return e!==void 0&&e.length>0&&(n.password=e),t!==void 0&&(n.include=t),Vj(`/api/backups`,{method:`POST`,body:JSON.stringify(n)})}async function WM(e,t,n={}){let r=new FormData;r.append(`file`,e),n.password!==void 0&&n.password.length>0&&r.append(`password`,n.password),n.include!==void 0&&r.append(`include`,JSON.stringify(n.include));let i=await fetch(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:r}),a=await i.json().catch(()=>null);if(!i.ok)throw Error(a?.message??a?.error??`restore failed with ${i.status}`);return a}function GM(e,t){return Vj(jM(`/api/notifications/token`,e),{method:`PUT`,body:JSON.stringify({botToken:t})})}function KM(e){return Vj(jM(`/api/notifications/token`,e),{method:`DELETE`})}function qM(e,t){return Vj(jM(`/api/notifications/test`,e),{method:`POST`,body:JSON.stringify(t)})}function JM(e,t){return Vj(jM(`/api/notifications/detect-chats`,e),{method:`POST`,body:JSON.stringify(t)})}async function YM(e){return Uj(await Vj(jM(`/api/ddns`,e)))}async function XM(e,t){return Uj(await Vj(jM(`/api/ddns`,e),{method:`PUT`,body:JSON.stringify(t)}))}async function ZM(e,t,n,r){return Uj(await Vj(jM(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`PUT`,body:JSON.stringify({provider:n,credentials:r})}))}async function QM(e,t){return Uj(await Vj(jM(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`DELETE`}))}async function $M(e){return Uj(await Vj(jM(`/api/ddns/check`,e),{method:`POST`}))}function eN(e,t){return Vj(`/api/settings/tls`,{method:`POST`,body:JSON.stringify({certificate:e,privateKey:t})})}function tN(){return Vj(`/api/settings/tls`,{method:`DELETE`})}async function nN(e,t,n){let r=await EM.api.servers[`:id`][n].$post(AM(e,t)),i=await r.json().catch(()=>null);if(!r.ok)throw Error(i?.message??`request failed with ${r.status}`);return i??{ok:!0}}function rN(e){return Vj(jM(`/api/servers/start-all`,e),{method:`POST`})}async function iN(e,t){let n=await EM.api.servers[`:id`][`free-port`].$post(AM(e,t)),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.message??`request failed with ${n.status}`);return r??{ok:!0,port:null,terminated:[],forced:[],skipped:[],free:!1}}function aN(e){return Vj(jM(`/api/servers/stop-all`,e),{method:`POST`})}function oN(e,t){return Vj(jM(`/api/servers/${encodeURIComponent(t)}/clear-logs`,e),{method:`POST`})}function sN(e,t,n){return Vj(jM(`/api/servers/${encodeURIComponent(t)}`,e),{method:`PATCH`,body:JSON.stringify(n)})}function cN(e,t){return Vj(jM(`/api/servers/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function lN(e,t){return Vj(jM(`/api/servers`,e),{method:`POST`,body:JSON.stringify(t)})}var uN=k(null),dN=k(null);function fN(e){return e===null?`wait`:e.authRequired&&!e.authenticated?`login`:`connect`}function pN(){async function e(){try{uN.value=await Zj()}catch{uN.value=null}}async function t(e){dN.value=null;try{return uN.value=await eM(e),!0}catch(e){return dN.value=Lj(e),!1}}async function n(){try{await tM()}finally{await e()}}function r(){uN.value={authenticated:!1,authRequired:!0,passwordSet:uN.value?.passwordSet??!0,apiTokenSet:uN.value?.apiTokenSet??!1,usingDefaultPassword:uN.value?.usingDefaultPassword??!1,defaultPassword:uN.value?.defaultPassword??null,sessionTtlMs:uN.value?.sessionTtlMs??0}}async function i(t,n){dN.value=null;try{return await cM(t,n),await e(),null}catch(e){return Lj(e)}}async function a(){dN.value=null;try{return await qj(),await e(),null}catch(e){return Lj(e)}}return{session:rn(uN),error:rn(dN),refresh:e,login:t,logout:n,requireLogin:r,setPassword:i,clearPassword:a}}var mN=k([]),hN=1;function gN(e){mN.value=mN.value.filter(t=>t.id!==e)}function _N(e,t=4800){let n=hN++;return mN.value=[...mN.value,{...e,id:n}],t>0&&setTimeout(gN,t,n),n}function vN(){return{toasts:rn(mN),dismiss:gN,push:_N,success:(e,t)=>_N({tone:`ok`,title:e,description:t}),failure:(e,t)=>_N({tone:`danger`,title:e,description:t},9e3),info:(e,t)=>_N({tone:`info`,title:e,description:t}),warn:(e,t)=>_N({tone:`warn`,title:e,description:t},7e3)}}var yN=4e3;function bN(){return tn({ts:[],cpu:[],rss:[],probe:[],lastSampledAt:-1})}function xN(e){let t=e.ts.length-120;t<=0||(e.ts.splice(0,t),e.cpu.splice(0,t),e.rss.splice(0,t),e.probe.splice(0,t))}function SN(e,t,n){let r=t.resources?.sampledAt??0,i=e.ts[e.ts.length-1]??0;if(!(r!==e.lastSampledAt||n-i>=yN)){e.probe.length>0&&(e.probe[e.probe.length-1]=t.responseMs);return}e.lastSampledAt=r,e.ts.push(n);let a=t.status===`running`;e.cpu.push(a?t.resources?.cpuPercent??null:null),e.rss.push(a?t.resources?.rssBytes??null:null),e.probe.push(t.responseMs),xN(e)}function CN(e){let t=0;for(let n of e)n!==null&&n>t&&(t=n);return t}function wN(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n!=null)return n}return null}var TN=8e3,EN=k(null),DN=k(`connecting`),ON=k(null),kN=k(Date.now()),AN=new Map,jN=vN(),MN=new Map,NN=k(0),PN=null,FN=null;function IN(e){let t=MN.get(e);if(t)return t;let n={lines:[],version:k(0),refs:0,source:null};return MN.set(e,n),n}function LN(e,t){let n=IN(e),r=n.lines.concat(t);n.lines=r.length>8e3?r.slice(r.length-TN):r,n.version.value+=1,NN.value+=1}function RN(e){return MN.get(e)?.lines??[]}function zN(e){let t=MN.get(e);t&&(t.lines=[],t.version.value+=1,NN.value+=1)}function BN(e){let t=AN.get(e);if(t)return t;let n=bN();return AN.set(e,n),n}function VN(e){e.workspaceId!==void 0&&SN(BN(Rj(e.workspaceId,e.id)),e,Date.now())}function HN(e){let t=EN.value;if(!t)return;let n=e.workspaceId,r=n===void 0?t.workspaces.filter(t=>t.servers.some(t=>t.id===e.id)):t.workspaces.filter(e=>e.id===n);if(r.length!==1)return;let i=r[0],a=i.servers.find(t=>t.id===e.id),o=n===void 0?{...e,workspaceId:i.id}:e;i.servers=a===void 0?[...i.servers,o]:i.servers.map(t=>t.id===e.id?o:t)}function UN(e){let t;try{t=JSON.parse(e)}catch{return}let n=Nj(t);if(n instanceof J.errors){console.warn(`[home-hosted] ignored malformed SSE frame`,n.summary);return}if(n.type===`hello`||n.type===`state`){if(n.state){EN.value=n.state;for(let e of EN.value.workspaces)for(let t of e.servers)VN(t)}return}if(n.type===`server`&&n.server){let e=n.server;HN(e),VN(e);return}if(n.type===`log`&&n.serverId&&n.lines){let e=n.workspaceId;if(e===void 0)return;LN(Rj(e,n.serverId),n.lines)}}function WN(e,t,n){let r=Rj(e,t);n.lines=[],n.version.value+=1,NN.value+=1;let i=new EventSource(`/api/servers/${encodeURIComponent(t)}/stream${kM(e)}`),a=e=>{let t=e,n;try{n=JSON.parse(t.data)}catch{return}let i=Nj(n);if(i instanceof J.errors){console.warn(`[home-hosted] ignored malformed SSE frame`,i.summary);return}if(i.type===`log`&&i.lines){LN(r,i.lines);return}i.type===`server`&&i.server&&HN(i.server)};for(let e of[`log`,`server`])i.addEventListener(e,a);i.onerror=()=>{},n.source=i}function GN(e,t){let n=IN(Rj(e,t));n.refs+=1,n.source||WN(e,t,n)}function KN(e,t){let n=MN.get(Rj(e,t));n&&(n.refs=Math.max(0,n.refs-1),n.refs===0&&(n.source?.close(),n.source=null))}function qN(){if(PN)return;FN??=setInterval(()=>{kN.value=Date.now()},1e3);let e=new EventSource(`/api/events?logs=0`);PN=e,DN.value=`connecting`,e.onopen=()=>{DN.value=`open`},e.onerror=()=>{DN.value=`closed`};for(let t of[`hello`,`state`,`server`,`log`])e.addEventListener(t,e=>{UN(e.data)})}function JN(){PN?.close(),PN=null,FN&&clearInterval(FN),FN=null}function YN(e,t){let n=W(()=>{let n=bn(e),r=bn(t);return n===null||r===null?null:Rj(n,r)}),r=null;return M(n,e=>{if(r!==null&&r!==e){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&KN(e,t)}if(r=e,e!==null){let[t,n]=e.split(`/`);t!==void 0&&n!==void 0&&GN(t,n)}},{immediate:!0}),Be(()=>{if(r!==null){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&KN(e,t)}r=null}),{version:W(()=>{let e=n.value;return NN.value,e===null?0:MN.get(e)?.version.value??0}),lines(){let e=n.value;return e===null?[]:RN(e)},count:W(()=>{let e=n.value;return NN.value,e===null?0:MN.get(e)?.lines.length??0}),clear(){let e=n.value;e!==null&&zN(e)}}}function XN(){let e=W(()=>EN.value?.workspaces??[]),t=W(()=>e.value.flatMap(e=>e.servers.map(t=>({workspace:e,server:t})))),n=W(()=>EN.value?.control??null),r=W(()=>EN.value?.host??null),i=W(()=>EN.value?.backups??null),a=W(()=>EN.value?.proxy??null),o=W(()=>EN.value?.projectDir??null),s=W(()=>EN.value?.dataRoot??null),c=W(()=>EN.value?.version??null);function l(e){return EN.value?.workspaces.find(t=>t.id===e)}function u(e,t){return l(e)?.servers.find(e=>e.id===t)}function d(e,t){return BN(Rj(e,t))}async function f(){if(EN.value===null)try{EN.value=await MM()}catch(e){e instanceof Bj&&pN().requireLogin()}}async function p(e,t){ON.value=null;try{let n=await e();EN.value=await MM();let r=typeof t.success==`function`?t.success(n):t.success;return r&&jN.success(r),n}catch(e){if(e instanceof Bj){pN().requireLogin();return}let n=Lj(e);ON.value=n,jN.failure(t.title,n);return}}return{appState:EN,workspaces:e,allServers:t,control:n,host:r,backups:i,proxy:a,projectDir:o,dataRoot:s,version:c,connection:rn(DN),lastError:rn(ON),now:rn(kN),workspaceById:l,ensureState:f,serverById:u,seriesOf:d,refresh:(e=`Refresh failed`)=>p(async()=>{},{title:e}),start:(e,t)=>p(()=>nN(e,t,`start`),{title:`Could not start ${t}`}),stop:(e,t)=>p(()=>nN(e,t,`stop`),{title:`Could not stop ${t}`}),restart:(e,t)=>p(()=>nN(e,t,`restart`),{title:`Could not restart ${t}`}),startAll:e=>p(()=>rN(e),{title:`Could not start every server`,success:`Starting every enabled server`}),stopAll:e=>p(()=>aN(e),{title:`Could not stop every server`,success:`Stopping every server`}),setAutostart:(e,t,n)=>p(()=>sN(e,t,{autostart:n}),{title:`Could not change autostart for ${t}`}),setEnabled:(e,t,n)=>p(()=>sN(e,t,{enabled:n}),{title:`Could not change ${t}`}),freePort:(e,t)=>p(()=>iN(e,t),{title:`Could not free the port for ${t}`,success:e=>e.free?`Port ${e.port} is free — start ${t} now`:`Port ${e.port} is still held`}),setBind:(e,t,n)=>{let r=$k(n);return r===null?(jN.failure(`Could not change the bind for ${t}`,`"${n}" is not a bind value`),Promise.resolve(void 0)):p(()=>sN(e,t,{bind:r}),{title:`Could not change the bind for ${t}`})},saveConfig:(e,t,n)=>p(()=>sN(e,t,n),{title:`Could not save ${t}`,success:`${t} updated`}),saveGlobalSettings:e=>p(()=>LM(e),{title:`Could not save the settings`}),saveWorkspaceSettings:(e,t)=>p(()=>RM(e,t),{title:`Could not save the settings`}),clearLogs:(e,t)=>p(async()=>{await oN(e,t),zN(Rj(e,t))},{title:`Could not clear the logs for ${t}`,success:`Buffer cleared`}),create:(e,t)=>p(()=>lN(e,t),{title:`Could not add the server`,success:`Server added`}),remove:(e,t)=>p(async()=>{await cN(e,t),KN(e,t),MN.delete(Rj(e,t)),AN.delete(Rj(e,t))},{title:`Could not remove ${t}`,success:`${t} removed`})}}var ZN=`hh.theme`;function QN(){try{let e=localStorage.getItem(ZN);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var $N=k(QN()),eP=k(typeof matchMedia<`u`&&matchMedia(`(prefers-color-scheme: dark)`).matches),tP=!1;function nP(){tP||typeof matchMedia>`u`||(tP=!0,matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,e=>{eP.value=e.matches,iP()}))}var rP=W(()=>$N.value===`system`?eP.value:$N.value===`dark`);function iP(){typeof document<`u`&&document.documentElement.classList.toggle(`dark`,rP.value)}function aP(){nP(),iP();function e(e){$N.value=e;try{localStorage.setItem(ZN,e)}catch{}iP()}return{preference:$N,isDark:rP,setPreference:e,cycle(){e($N.value===`light`?`dark`:$N.value===`dark`?`system`:`light`)}}}var oP=`hh.workspace`;function sP(){try{return localStorage.getItem(oP)}catch{return null}}function cP(e){try{e===null?localStorage.removeItem(oP):localStorage.setItem(oP,e)}catch{}}var lP=k(sP()),uP=k(!1);function dP(){let e=XN(),t=vN(),n=W(()=>e.appState.value?.workspaces??[]),r=W(()=>{let e=n.value;return e.find(e=>e.id===lP.value)??e[0]??null}),i=W(()=>r.value?.id??``);M([n,lP],()=>{let e=n.value;if(e.length===0)return;let t=e.find(e=>e.id===lP.value)?.id??e[0].id;t!==lP.value&&(lP.value=t,cP(t))},{immediate:!0});function a(e){lP.value=e,cP(e)}let o=W(()=>r.value?.servers??[]),s=W(()=>r.value?.defaults??null),c=W(()=>r.value?.logs??null),l=W(()=>r.value?.notifications??null),u=W(()=>r.value?.configError??null),d=W(()=>r.value?.configWarnings??[]),f=W(()=>r.value?.logsDir??null),p=W(()=>r.value?.serverCount??0),m=W(()=>r.value?.runningCount??0),h=W(()=>r.value?.crashedCount??0);function g(e){return o.value.find(t=>t.id===e)}function _(t){return e.seriesOf(i.value,t)}async function v(n){uP.value=!0;try{let r=await PM(n.trim().length>0?{label:n.trim()}:{});return await e.refresh(`Could not read the workspaces`),a(r.id),t.success(`Workspace “${r.label}” created`),r}catch(e){t.failure(`Could not create the workspace`,Lj(e));return}finally{uP.value=!1}}async function y(n,r){try{return await FM(n,r.trim()),await e.refresh(`Could not read the workspaces`),t.success(`Workspace renamed`),!0}catch(e){return t.failure(`Could not rename the workspace`,Lj(e)),!1}}async function b(n){try{return await IM(n),await e.refresh(`Could not read the workspaces`),t.success(`Workspace deleted`),!0}catch(e){return t.failure(`Could not delete the workspace`,Lj(e)),!1}}return{workspaces:n,selectedId:rn(lP),selected:r,activeId:i,creating:rn(uP),select:a,create:v,rename:y,remove:b,servers:o,serverById:g,seriesOf:_,defaults:s,logsConfig:c,notifications:l,configError:u,configWarnings:d,logsDir:f,serverCount:p,runningCount:m,crashedCount:h,refresh:e.refresh,start:t=>e.start(i.value,t),stop:t=>e.stop(i.value,t),restart:t=>e.restart(i.value,t),startAll:()=>e.startAll(i.value),stopAll:()=>e.stopAll(i.value),setEnabled:(t,n)=>e.setEnabled(i.value,t,n),setAutostart:(t,n)=>e.setAutostart(i.value,t,n),setBind:(t,n)=>e.setBind(i.value,t,n),freePort:t=>e.freePort(i.value,t),clearLogs:t=>e.clearLogs(i.value,t),saveConfig:(t,n)=>e.saveConfig(i.value,t,n),createServer:t=>e.create(i.value,t),removeServer:t=>e.remove(i.value,t)}}var fP=t({default:()=>pP}),pP={"activity.emptyTitle":`No events in the last 24 hours`,"activity.emptyDescription":`Starts, exits, crashes and recoveries show up here as they happen.`,"activity.ran":`ran {duration}`,"addServer.title":`Add a server`,"addServer.description":`Appends an entry to {workspace}'s servers.config.json; every policy you leave out is inherited from its defaults.`,"addServer.thisWorkspace":`this workspace`,"addServer.identity":`Identity`,"addServer.id":`Id`,"addServer.idHint":`Lowercase letters, digits, dashes and underscores; used in URLs and logs.`,"addServer.labelHint":`Shown in the panel; defaults to the id.`,"addServer.process":`Process`,"addServer.commandHint":`Spawned without a shell.`,"addServer.argumentsHint":`One argument per line; whitespace inside a line is preserved.`,"addServer.portLifecycle":`Port & lifecycle`,"addServer.bindHint":`lan exposes it to the network; only do that behind auth.`,"addServer.advanced":`Advanced settings`,"addServer.advancedHint":`environment, backups, policy, lifecycle, bootstrap`,"addServer.backups":`Backups`,"addServer.backupIgnore":`Ignore known generated files`,"addServer.bootstrapDescription":`A one-off command run before the first start.`,"addServer.bootstrapHint":`Installs, migrations, downloads — before the first start, not on every one.`,"addServer.policyResources":`Policy & resources`,"addServer.logBufferHint":`Blank keeps the default.`,"addServer.inheritNote":`Restart, health and stop start out matching {settings}; change one here and it is written into this entry instead of staying inherited.`,"addServer.serverDefaults":`Settings → Server defaults`,"addServer.placeholdersTitle":`Available argument placeholders`,"addServer.submit":`Add to servers.config.json`,"app.name":`home-hosted`,"app.tagline":`Process supervisor control panel`,"bind.local":`local — 127.0.0.1`,"bind.lan":`lan — 0.0.0.0`,"bind.explicit":`{bind} — explicit`,"common.cancel":`Cancel`,"common.confirm":`Confirm`,"common.reset":`Reset`,"common.keepIt":`Keep it`,"common.remove":`Remove`,"common.close":`Close`,"common.save":`Save`,"common.saving":`Saving…`,"common.discard":`Discard`,"common.delete":`Delete`,"common.edit":`Edit`,"common.add":`Add`,"common.retry":`Retry`,"common.copy":`Copy`,"common.copied":`Copied`,"common.enabled":`Enabled`,"common.disabled":`Disabled`,"common.none":`None`,"common.unknown":`unknown`,"common.loading":`Loading…`,"common.selectAll":`Select all`,"common.selectNone":`Select none`,"common.name":`Name`,"common.label":`Label`,"common.hostname":`Hostname`,"common.port":`Port`,"common.command":`Command`,"common.environment":`Environment`,"common.memory":`Memory`,"common.cpu":`CPU`,"common.disk":`Disk`,"common.uptime":`Uptime`,"common.status":`Status`,"common.actions":`Actions`,"common.details":`Details`,"common.overview":`Overview`,"common.warning":`Warning`,"common.error":`Error`,"common.confirmQuestion":`{label}?`,"common.unset":`unset`,"common.never":`never`,"common.now":`now`,"common.dismiss":`Dismiss`,"connection.live":`Live`,"connection.connecting":`Connecting`,"connection.reconnecting":`Reconnecting`,"connection.liveUpdates":`Live updates`,"editor.title":`Edit configuration`,"editor.description":`Writes overrides to {file}; anything left alone keeps inheriting the defaults.`,"editor.inSync":`in sync`,"editor.process":`Process`,"editor.processDescription":`What gets spawned, where, and with which environment.`,"editor.labelPlaceholder":`falls back to the id`,"editor.argumentsHint":`One per line; {port} {host} {home} {projectDir} {dataRoot} {id} {label} {cwd} {bind} {lanIp} are substituted.`,"editor.portTitle":`Port & binding`,"editor.portDescription":`How the port is preflighted and where the process is reachable.`,"editor.bindHint":`A custom IPv4 the config already sets stays selectable.`,"editor.lifecycle":`Lifecycle`,"editor.lifecycleDescription":`Whether the supervisor owns this entry at all.`,"editor.save":`Save to servers.config.json`,"editor.changesTitle":`Unsaved changes`,"editor.changesDescription":`What Save would write to servers.config.json.`,"editor.nothingToSave":`Nothing to save.`,"health.disabled":`Not checked`,"health.unknown":`Not probed`,"health.healthy":`Healthy`,"health.unhealthy":`Unhealthy`,"history.start":`Started`,"history.exit":`Exited`,"history.crash":`Crashed`,"history.forcedRestart":`Forced restart`,"history.unhealthy":`Unhealthy`,"history.recovered":`Recovered`,"host.loadPerCpu":`Load / cpu`,"host.cpuTemp":`CPU temp`,"host.samplingOff":`Host sampling is off`,"host.samplingOffDescription":`Turn it on in Settings to collect load, memory, disk and temperature.`,"host.swap":`Swap`,"host.cpus":`CPUs`,"host.loadAverage":`Load 1 / 5 / 15`,"host.memoryUsed":`Memory used`,"host.sampled":`Sampled`,"host.filesystems":`Filesystems`,"host.thresholdsBreached":`Thresholds breached`,"killPort.trigger":`Kill what holds port {port}`,"killPort.title":`Kill the process on port {port}?`,"killPort.body":`It is asked to stop first, and killed only if it ignores that. Anything this panel supervises is refused, so a managed server cannot be lost this way.`,"killPort.confirm":`Kill it`,"language.label":`Language`,"language.select":`Select a language`,"lifecycle.restartTitle":`Restart policy`,"lifecycle.restartDescription":`Backoff between attempts after a crash.`,"lifecycle.restartOnCrash":`Restart on crash`,"lifecycle.maxRetries":`Max retries`,"lifecycle.maxRetriesHint":`Attempts before the server is left crashed.`,"lifecycle.baseDelay":`Base delay (ms)`,"lifecycle.factor":`Backoff factor`,"lifecycle.maxDelay":`Max delay (ms)`,"lifecycle.resetAfter":`Reset after (ms)`,"lifecycle.resetAfterHint":`A run this long clears the retry counter.`,"lifecycle.healthTitle":`Health check`,"lifecycle.healthDescription":`How readiness is probed once the process is up.`,"lifecycle.probe":`Probe this server`,"lifecycle.probeType":`Probe type`,"lifecycle.probePort":`TCP port — connection only`,"lifecycle.probeHttp":`HTTP request — assert a response`,"lifecycle.interval":`Interval (ms)`,"lifecycle.timeout":`Timeout (ms)`,"lifecycle.unhealthyAfter":`Unhealthy after`,"lifecycle.unhealthyAfterHint":`Consecutive failed probes.`,"lifecycle.forceRestartAfter":`Force restart after (ms)`,"lifecycle.forceRestartAfterHint":`0 disables it.`,"lifecycle.startTimeout":`Start timeout (ms)`,"lifecycle.httpPath":`HTTP path`,"lifecycle.httpMethod":`HTTP method`,"lifecycle.expectStatus":`Expect status`,"lifecycle.expectStatusHint":`Blank accepts anything below.`,"lifecycle.expectStatusBelow":`Healthy below status`,"lifecycle.expectBody":`Body must contain`,"lifecycle.expectBodyPlaceholder":`optional substring`,"lifecycle.headBodyHint":`HEAD has no response body, so this check is ignored — use GET, or clear it.`,"lifecycle.stopTitle":`Stop behaviour`,"lifecycle.stopDescription":`How the process tree is asked to go away.`,"lifecycle.signal":`Signal`,"lifecycle.signalTerm":`SIGTERM — ask it to stop`,"lifecycle.signalInt":`SIGINT — interrupt (Ctrl-C)`,"lifecycle.signalKill":`SIGKILL — kill immediately`,"lifecycle.grace":`Grace period (ms)`,"lifecycle.killGroup":`Kill the whole process group`,"lifecycle.killPortHolders":`Also kill whatever holds the port`,"login.title":`Sign in to continue`,"login.firstRunTitle":`This panel has no password yet`,"login.firstRunSubtitle":`Anything on this machine can reach it. Set a password right after you are in.`,"login.authOffTitle":`Authentication is turned off`,"login.authOffSubtitle":`The panel only listens on loopback, which is the only thing protecting it right now.`,"login.subtitle":`The control panel is protected. Enter the password to continue.`,"login.password":`Password`,"login.showPassword":`Show password`,"login.hidePassword":`Hide password`,"login.signIn":`Sign in`,"login.openDashboard":`Open the dashboard`,"login.exposed":`Exposed`,"login.defaultPasswordWarning":`Still on the default password {password}. Change it under Settings — binding beyond 127.0.0.1 stays refused until you do.`,"login.noPasswordWarning":`No password is set. Open Settings from this machine to add one, or run {command}.`,"login.sessionNote":`Sessions stay signed in for {days} days after the last visit — each request extends that window. Signing out clears this browser only.`,"login.servedFromThisMachine":`served from this machine`,"logs.emptyHint":`No output yet.`,"logs.noMatches":`Nothing matches that search or stream filter.`,"logs.searchPlaceholder":`Search this output`,"logs.searchLabel":`Search the log output`,"logs.clearSearch":`Clear the search`,"logs.prevMatch":`Previous match`,"logs.nextMatch":`Next match`,"logs.showTimestamps":`Show timestamps`,"logs.hideTimestamps":`Hide timestamps`,"logs.timestampsShort":`ts`,"logs.pause":`Pause`,"logs.follow":`Follow`,"logs.clearHint":`Clear the in-memory buffer`,"logs.clearLabel":`Clear the log buffer`,"logs.downloadHint":`Download the persisted file`,"logs.downloadLabel":`Download the log file`,"logs.outputLabel":`Log output`,"logs.jumpToLatest":`Jump to latest`,"logs.streaming":`streaming`,"logs.paused":`paused`,"logs.snapshot":`snapshot`,"logs.linesOf":`{count} of {total} lines`,"logs.matches":`{count} matches`,"logs.rowHeight":`row height {height}px · windowed`,"logs.streamAll":`All`,"logs.streamOut":`out`,"logs.streamErr":`err`,"logs.streamSys":`sys`,"metric.emptyHint":`collecting…`,"nav.global":`Global`,"nav.workspace":`Workspace`,"nav.others":`Others`,"nav.overview":`Overview`,"nav.servers":`Servers`,"nav.logs":`Logs`,"nav.workspaceSettings":`Workspace settings`,"nav.globalOverview":`Global Overview`,"nav.globalSettings":`Global settings`,"nav.reverseProxy":`Reverse Proxy`,"nav.navigation":`Navigation`,"nav.closeNavigation":`Close navigation`,"nav.hostVitals":`Host vitals`,"notice.configError":`The config could not be read: {error}`,"notice.configErrorHint":`The panel keeps running the config it already had; fix {path} and it reloads on its own.`,"notice.defaultPassword":`This panel is still on its default password.`,"notice.defaultPasswordHint":`Change it in Global settings — binding beyond 127.0.0.1 stays refused until you do.`,"notice.noPassword":`Authentication is on but no password is set, so nothing is being asked for.`,"notice.noPasswordHint":`Set one in Global settings to actually lock the panel.`,"notice.exposed":`This panel is reachable beyond 127.0.0.1.`,"notice.exposedHint":`Keep the password strong, or put a TLS-terminating proxy in front of it.`,"notice.authOff":`Authentication is disabled — the panel is only protected by its loopback bind.`,"onPortConflict.block":`block — refuse to start`,"onPortConflict.warn":`warn — start anyway`,"onPortConflict.follow":`follow — adopt a detached restart of itself`,"onPortConflict.reclaim":`reclaim — replace it with a supervised copy`,"onPortConflict.kill":`kill — stop whatever holds the port`,"palette.placeholder":`Jump to a server, run an action, open a setting…`,"palette.openServer":`Open {label}`,"palette.serverLogs":`Logs for {label}`,"palette.startServer":`Start {label}`,"palette.stopServer":`Stop {label}`,"palette.restartServer":`Restart {label}`,"palette.goOverview":`Go to Overview`,"palette.goGlobalOverview":`Go to Global Overview`,"palette.goGlobalSettings":`Go to Global settings`,"palette.goProxy":`Go to Reverse Proxy`,"palette.goServers":`Go to Servers`,"palette.goLogs":`Go to Logs`,"palette.goWorkspaceSettings":`Go to Workspace settings`,"palette.startAll":`Start every enabled server here`,"palette.stopAll":`Stop every server here`,"palette.switchWorkspace":`Switch to {label}`,"palette.globalSetting":`Global setting: {label}`,"palette.workspaceSetting":`Workspace setting: {label}`,"palette.theme":`{theme} theme`,"palette.groupServers":`Servers`,"palette.groupActions":`Actions`,"palette.groupNavigate":`Navigate`,"palette.groupWorkspaces":`Workspaces`,"palette.groupAppearance":`Appearance`,"palette.navigate":`navigate`,"palette.run":`run`,"palette.noMatches":`Nothing matches “{query}”.`,"proxy.account.automatic":`Automatic (the only account that can answer)`,"proxy.account.noTxt":`no TXT support`,"proxy.account.noCredentials":`no credentials`,"proxy.account.gone":`That account is no longer configured.`,"proxy.account.emptyHint":`DNS-01 writes the challenge record here. Empty uses the only account that can answer a challenge, when there is one.`,"proxy.account.cannotWrite":`A {provider} account cannot write TXT records, so it cannot answer a DNS-01 challenge.`,"proxy.account.noCredentialsYet":`No credentials are stored for this {provider} account yet.`,"proxy.account.through":`The challenge is written through this {provider} account.`,"proxy.certificate.title":`Uploaded certificates`,"proxy.certificate.description":`Served by routes set to “Uploaded certificate”. Everything else — public or local — is certified by the engine on its own.`,"proxy.certificate.add":`Add certificate`,"proxy.certificate.emptyTitle":`No certificate uploaded`,"proxy.certificate.emptyDescription":`A route set to “Uploaded certificate” needs a pair covering its hostname, or the engine has nothing to serve for it.`,"proxy.certificate.daysLeft":`{days} days left`,"proxy.certificate.subject":`Subject`,"proxy.certificate.issuer":`Issuer`,"proxy.certificate.validUntil":`Valid until`,"proxy.certificate.covers":`Covers`,"proxy.certificate.noSans":`no hostnames in its SANs`,"proxy.certificate.removeAria":`Remove {name}`,"proxy.certificate.removeQuestion":`Remove “{name}”?`,"proxy.certificate.removeBody":`The pair is deleted from disk. A route still set to “Uploaded certificate” keeps serving the engine's own certificate until you change it, and the panel refuses this while one still serves it.`,"proxy.certificate.removeIt":`Remove it`,"proxy.certificate.stored":`“{label}” stored.`,"proxy.certificate.removed":`“{name}” removed.`,"proxy.certificateDialog.title":`Add a certificate`,"proxy.certificateDialog.description":`The pair is stored on disk under its id, and a route set to “Uploaded certificate” can serve it.`,"proxy.certificateDialog.label":`Label`,"proxy.certificateDialog.labelPlaceholder":`Home wildcard`,"proxy.certificateDialog.id":`Id`,"proxy.certificateDialog.idHint":`names the files on disk`,"proxy.certificateDialog.certFile":`Certificate file (.pem, .crt)`,"proxy.certificateDialog.keyFile":`Private key file (.pem, .key)`,"proxy.certificateDialog.pasteCert":`Or paste the certificate`,"proxy.certificateDialog.pasteKey":`Or paste the private key`,"proxy.certificateDialog.certPlaceholder":`-----BEGIN CERTIFICATE-----`,"proxy.certificateDialog.keyPlaceholder":`-----BEGIN PRIVATE KEY-----`,"proxy.certificateDialog.store":`Store the certificate`,"proxy.certificateDialog.errorLabel":`a label is required`,"proxy.certificateDialog.errorId":`the id must start with a letter or digit, then letters, digits, dash or underscore`,"proxy.certificateDialog.errorTaken":`“{id}” is already used by another certificate`,"proxy.certificateDialog.errorCertificate":`paste or choose the certificate`,"proxy.certificateDialog.errorPrivateKey":`paste or choose the private key`,"proxy.engine.title":`Engine`,"proxy.engine.description":`The reverse proxy itself. The panel downloads the current build, supervises it and applies its configuration through the engine's own admin API.`,"proxy.engine.notInFrame":`The proxy state is not in this panel's frame yet.`,"proxy.engine.readFailed":`The engine could not be read`,"proxy.engine.notInstalled":`No engine installed`,"proxy.engine.installNote":`Installing downloads the current {engine} release the panel supervises — about 46 MB, once. Nothing is exposed until a route is added and the proxy is switched on.`,"proxy.engine.version":`Version`,"proxy.engine.notProbed":`not probed yet`,"proxy.engine.source":`Source`,"proxy.engine.sourceCustom":`a path configured by hand`,"proxy.engine.sourceDownloaded":`downloaded by the panel`,"proxy.engine.size":`Size`,"proxy.engine.binary":`Binary`,"proxy.engine.copyPath":`Copy the binary path`,"proxy.engine.address":`Live address`,"proxy.engine.process":`Process`,"proxy.engine.certificates":`Certificates`,"proxy.engine.noCert":`no public certificate yet`,"proxy.engine.expiresSoon":`soonest expires in {days} days`,"proxy.engine.acme":`ACME certificates`,"proxy.engine.localCa":`Local CA`,"proxy.engine.dns01":`DNS-01`,"proxy.engine.tcpUdp":`TCP/UDP`,"proxy.engine.documentation":`{engine} documentation`,"proxy.engine.failed":`The engine reported a failure`,"proxy.engine.setcapHint":`A privileged port (below 1024) needs this once on Linux:`,"proxy.engine.copyCommand":`Copy the command`,"proxy.engine.install":`Install engine`,"proxy.engine.start":`Start`,"proxy.engine.stop":`Stop`,"proxy.engine.apply":`Apply configuration`,"proxy.engine.revert":`Revert`,"proxy.engine.revertHint":`Go back to the configuration that applied before the last one`,"proxy.engine.update":`Update engine`,"proxy.listener.title":`Listener & certificates`,"proxy.listener.description":`Where the proxy listens. 80 and 443 are what a router forwards and what an ACME challenge expects; a port below 1024 needs a privileged bind.`,"proxy.listener.unprivilegedPorts":`unprivileged ports`,"proxy.listener.run":`Run the reverse proxy`,"proxy.listener.runHint":`Saved with Save settings; the panel starts or stops the engine to match.`,"proxy.listener.httpPort":`HTTP port`,"proxy.listener.httpPortHint":`ACME HTTP-01 challenges and the redirect to HTTPS.`,"proxy.listener.httpsPort":`HTTPS port`,"proxy.listener.httpsPortHint":`Where certificates are served.`,"proxy.listener.useFallback":`Use {http} / {https}`,"proxy.listener.useStandard":`Use 80 / 443`,"proxy.listener.forwardHint":`Running unprivileged — forward 80 and 443 to these ports on your router.`,"proxy.listener.privilegedTitle":`A port below 1024 needs a privileged bind`,"proxy.listener.privilegedBody":`Running the panel as your own user cannot bind 80 or 443 without permission. Either grant it once {how} and restart the engine, or keep {http}/{https} and forward 80/443 from your router. On Windows the port is free to bind, but something else may hold it.`,"proxy.listener.privilegedWithSetcap":`with {command} on the engine binary`,"proxy.listener.email":`ACME account e-mail`,"proxy.listener.emailPlaceholder":`you@example.com`,"proxy.listener.emailHint":`Let's Encrypt uses it to warn you about an expiring certificate. A local-only name gets the engine's own CA and needs none.`,"proxy.listener.emailNeededTitle":`An e-mail is needed for automatic HTTPS`,"proxy.listener.emailNeededBody":`“{host}” is a public hostname, so the engine asks a CA for a certificate and the account address is required. Fill it in, switch the route's TLS off, or turn on the staging endpoint while you try things out.`,"proxy.listener.staging":`Use the ACME staging endpoint`,"proxy.listener.stagingHint":`Untrusted certificates and no rate-limit burn while you try things out.`,"proxy.listener.dns01":`Answer challenges with DNS-01`,"proxy.listener.dns01Hint":`The panel writes the challenge record through a route's DNS account, so no inbound port is needed to get a certificate.`,"proxy.listener.resolvers":`Check the record against`,"proxy.listener.resolversPlaceholder":`1.1.1.1, 8.8.8.8`,"proxy.listener.resolversHint":`Nameservers the engine reads the record from; empty uses its own. Needed where split-horizon DNS shows it a different view.`,"proxy.listener.noAccountTitle":`No DNS account can answer a challenge`,"proxy.listener.noAccountBody":`DNS-01 is on, but no account has credentials it can use. Add one under Workspace Settings → Dynamic DNS, or public names stay on the port challenges and wait for a CA that cannot reach them.`,"proxy.listener.manyAccountsTitle":`Each public route has to pick an account`,"proxy.listener.manyAccountsBody":`More than one account can answer, so “Automatic” cannot choose. Pick one per route, or those names stay on the port challenges.`,"proxy.listener.accountNote":`Each route picks its own account, so names in different zones each get the right one. A route left on “Automatic” uses the only account the table names. A name no account answers stays on the port challenges.`,"proxy.listener.pendingNote":`A public name whose certificate is still being issued is reachable in the meantime — over HTTPS with a temporary untrusted certificate, or over plain HTTP with a page naming the ports to forward.`,"proxy.retry.inFallback":`~8 hours`,"proxy.retryButton.force":`Force retry certificate`,"proxy.retryButton.question":`Ask the CA again for {host}?`,"proxy.retryButton.body":`The engine failed to obtain a CA certificate for this hostname previously and is using its local CA. It retries automatically every {retryIn}.`,"proxy.retryButton.warning":`Retrying now will kill this route and make it unavailable for a bit, are you sure to continue?`,"proxy.retryButton.leave":`Leave it`,"proxy.retryButton.now":`Retry now`,"proxy.routeDialog.titleEdit":`Edit route`,"proxy.routeDialog.titleAdd":`Add route`,"proxy.routeDialog.description":`A hostname, what it forwards to, and how it is served over TLS.`,"proxy.routeDialog.hostname":`Hostname`,"proxy.routeDialog.hostnamePlaceholder":`gitea.example.com`,"proxy.routeDialog.path":`Path prefix`,"proxy.routeDialog.pathPlaceholder":`/optional`,"proxy.routeDialog.pathHint":`Empty serves the whole host.`,"proxy.routeDialog.target":`Target`,"proxy.routeDialog.tls":`TLS`,"proxy.routeDialog.dnsAccount":`DNS account`,"proxy.routeDialog.localNote":`A local-only name is signed by the engine's own CA, so no DNS account is involved.`,"proxy.routeDialog.workspace":`Workspace`,"proxy.routeDialog.server":`Server`,"proxy.routeDialog.noServers":`this workspace has no servers`,"proxy.routeDialog.stoppedNote":`A server that is stopped is not routed: the row shows “No upstream” until it runs again.`,"proxy.routeDialog.upstream":`Upstream`,"proxy.routeDialog.upstreamPlaceholder":`http://10.0.0.5:8080`,"proxy.routeDialog.upstreamHint":`A literal address, including the port. A scheme is optional.`,"proxy.routeDialog.panelNote":`Serving the control panel needs authentication on and a password that is not the default — the panel refuses the save otherwise.`,"proxy.routeDialog.save":`Save route`,"proxy.routes.title":`Routes`,"proxy.routes.description":`One public hostname per service. A route may point at a supervised server in any workspace, at this panel, or at a literal upstream.`,"proxy.routes.add":`Add route`,"proxy.routes.cannotSaveTitle":`These routes cannot be saved as they stand`,"proxy.routes.cannotRoute":`{host} cannot be routed`,"proxy.routes.emptyTitle":`No routes yet`,"proxy.routes.emptyDescription":`Add one to expose a server through a domain — the engine gets the certificate on its own.`,"proxy.routes.addFirst":`Add the first route`,"proxy.routes.columnHostname":`Hostname`,"proxy.routes.columnTarget":`Target`,"proxy.routes.columnUpstream":`Upstream`,"proxy.routes.columnTls":`TLS`,"proxy.routes.columnState":`State`,"proxy.routes.columnOn":`On`,"proxy.routes.openInTab":`Open {url} in a new tab`,"proxy.routes.noHostname":`no hostname yet`,"proxy.routes.toggle":`Route {name}`,"proxy.routes.edit":`Edit {name}`,"proxy.routes.remove":`Remove {name}`,"proxy.status.certified":`certificate ready`,"proxy.status.localCa":`engine CA`,"proxy.status.uploaded":`uploaded pair`,"proxy.status.awaitingCa":`waiting for the CA`,"proxy.status.failed":`certificate failed`,"proxy.status.fellBack":`Fell back to Local CA`,"proxy.status.serving":`Serving`,"proxy.status.disabled":`Disabled`,"proxy.status.noUpstream":`No upstream`,"proxy.status.error":`Error`,"proxy.status.unapplied":`Not applied yet`,"proxy.status.off":`Off`,"proxy.status.stopped":`Stopped`,"proxy.status.starting":`Starting`,"proxy.status.running":`Running`,"proxy.status.unsupported":`Unsupported`,"proxy.target.server":`A supervised server`,"proxy.target.panel":`This control panel`,"proxy.target.external":`A literal upstream`,"proxy.target.controlPanel":`control panel`,"proxy.target.noServer":`no server picked`,"proxy.target.noUpstream":`no upstream`,"proxy.tls.auto":`Automatic — the engine decides`,"proxy.tls.off":`Off — plain HTTP`,"proxy.tls.manual":`Uploaded certificate`,"proxy.tls.plain":`plain HTTP`,"proxy.tls.uploaded":`uploaded certificate`,"proxy.tls.letsEncrypt":`Let’s Encrypt`,"proxy.tls.engineCa":`engine CA (local)`,"proxy.tls.hintOff":`Plain HTTP: no certificate is served for this hostname.`,"proxy.tls.hintManual":`Serves the certificate pair uploaded below.`,"proxy.tls.hintEmpty":`A public hostname gets an ACME certificate; a local-only name gets the engine’s own CA.`,"proxy.tls.hintPublic":`A public hostname, so the engine asks a CA for a certificate — an ACME account e-mail is needed.`,"proxy.tls.hintLocal":`A local-only name, so the engine signs it with its own locally-trusted CA.`,"proxy.validation.labelRequired":`a label is required`,"proxy.validation.idPattern":`the id must start with a letter or digit, then letters, digits, dash or underscore`,"proxy.validation.hostRequired":`a hostname is required`,"proxy.validation.hostPattern":`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,"proxy.validation.hostTaken":`"{host}" is already routed for this path`,"proxy.validation.pathSlash":`a path prefix starts with /`,"proxy.validation.pathSpace":`a path prefix cannot contain a space`,"proxy.validation.idTaken":`route id "{id}" is used twice`,"proxy.validation.workspaceRequired":`pick the workspace that owns the server`,"proxy.validation.serverRequired":`pick a server in that workspace`,"proxy.validation.url":`an upstream like http://10.0.0.5:8080`,"proxy.view.title":`Reverse Proxy`,"proxy.view.description":`Expose your servers through domains, with automatic HTTPS via 80/443 or a DNS challenge.`,"proxy.view.dnsNote":`For DNS-01, add the domain's DNS provider to any workspace under Workspace Settings → Dynamic DNS; a route can then pick that account, from any workspace.`,"proxy.view.readFailed":`The reverse proxy could not be read`,"proxy.view.reading":`Reading the reverse proxy…`,"proxy.view.engineInstalled":`Engine installed`,"proxy.view.engineStarting":`Engine starting`,"proxy.view.engineStopping":`Engine stopping`,"proxy.view.configApplied":`Configuration applied`,"proxy.view.configReverted":`Configuration reverted`,"proxy.view.settingsSaved":`Settings saved.`,"proxy.view.settingsSavedToast":`Settings saved`,"proxy.view.retryFailed":`the retry failed`,"proxy.view.retryAsked":`asking the CA again for {host}`,"proxy.view.fieldChanged":`field changed`,"proxy.view.fieldsChanged":`fields changed`,"proxy.view.noChanges":`No unsaved changes`,"proxy.view.discard":`Discard changes`,"proxy.view.save":`Save settings`,"serverCard.open":`Open {url}`,"serverCard.adoptedHint":`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`,"serverCard.detached":`detached`,"serverCard.persistentHint":"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only an explicit stop does.","serverCard.persistent":`persistent`,"serverCard.disabled":`disabled`,"serverCard.autostart":`autostart`,"serverCard.healthProbe":`Health probe`,"serverCard.notProbed":`not probed`,"serverCard.restarts":`Restarts`,"serverCard.pid":`PID`,"serverCard.rss":`RSS`,"serverCard.procs":`Procs`,"serverCard.portFree":`free`,"serverCard.portInUse":`in-use`,"serverCard.uptime24h":`24h up`,"serverCard.probe":`Probe`,"serverCard.crashes24h":`24h crashes`,"serverCard.lastCrash":`Last crash`,"serverCard.unhealthyFor":`Unhealthy for {duration}`,"serverCard.nextAttempt":`Next attempt {when}`,"serverCard.start":`Start`,"serverCard.stop":`Stop`,"serverCard.restart":`Restart`,"serverCard.detailsHint":`Live logs and full telemetry`,"serverCard.moreActions":`More actions for {label}`,"serverCard.disable":`Disable server`,"serverCard.enable":`Enable server`,"serverCard.removeFromAutostart":`Remove from autostart`,"serverCard.autostartWithPanel":`Autostart with the panel`,"serverCard.clearLogBuffer":`Clear log buffer`,"serverCard.removeServer":`Remove server`,"serverCard.removeTitle":`Remove this server?`,"serverCard.removeDescription":`{label} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,"serverCard.statusField":`status`,"serverForm.workingDirectory":`Working directory`,"serverForm.cwdHint":`Relative paths resolve under projectDir.`,"serverForm.arguments":`Arguments`,"serverForm.portHint":`Blank means the server has no port to probe or preflight.`,"serverForm.bindAddress":`Bind address`,"serverForm.autostart":`Autostart with up`,"serverForm.autostartHint":`Start it whenever the control plane comes up.`,"serverForm.persistent":`Persistent`,"serverForm.persistentHint":"Keeps running when the panel stops; `down` reports it instead of stopping it.","serverForm.envHint":`KEY=value per line, exported to the process.`,"serverForm.dataEnvs":`Data envs`,"serverForm.dataEnvsHint":`ENV=path per line — exported to the process and backed up automatically.`,"serverForm.envFile":`Env file`,"serverForm.envFilePlaceholder":`optional KEY=value file`,"serverForm.envFileHint":`Loaded at spawn; its values override env.`,"serverForm.dependsOn":`Depends on`,"serverForm.dependsOnHint":`Comma separated; started first and waited for until healthy, stopped last.`,"serverForm.backupPaths":`Extra backup paths`,"serverForm.backupPathsHint":`One per line, placeholders allowed; data envs are captured already.`,"serverForm.backupIgnore":`Ignore known generated files when backing this up`,"serverForm.backupIgnoreHint":`Skips node_modules, dist, .next and the other caches nothing restores from.`,"serverForm.bootstrap":`Bootstrap`,"serverForm.bootstrapDescription":`A one-off command run before the first start — installs, migrations, downloads.`,"serverForm.runBootstrap":`Run a bootstrap`,"serverForm.bootstrapHint":`Off means the entry has none and the key is sent as null.`,"serverForm.timeoutMs":`Timeout (ms)`,"serverForm.runOnce":`Only once per session`,"serverForm.runOnceHint":`Off means every start re-runs it.`,"serverForm.bootstrapArgs":`Bootstrap arguments`,"serverForm.bootstrapArgsHint":`One per line; same placeholders as the main arguments.`,"serverForm.bootstrapEnv":`Bootstrap environment`,"serverForm.bootstrapEnvHint":`KEY=value per line, exported to the bootstrap process only.`,"serverForm.onPortConflict":`On port conflict`,"serverForm.logBufferLines":`Log buffer lines`,"serverForm.maxRssMb":`Max RSS (MB)`,"serverForm.maxRssHint":`Restart above this; blank or 0 disables it.`,"serverForm.enabledHint":`Off keeps the entry in the config but refuses to start it.`,"settings.auth.policyTitle":`Access policy`,"settings.auth.policyDescription":`Authentication applies whether the panel is on loopback or exposed to the network.`,"settings.auth.requirePassword":`Require a password`,"settings.auth.requirePasswordHint":`Every request needs a signed-in session.`,"settings.auth.sessionLifetime":`Session lifetime (ms)`,"settings.auth.sessionLifetimeHint":`Idle timeout: 604800000 is one week of no activity. Each request restarts it.`,"settings.auth.cookieSecure":`Cookie Secure`,"settings.auth.cookieSecureAuto":`Auto — only over HTTPS`,"settings.auth.cookieSecureAlways":`Always`,"settings.auth.cookieSecureNever":`Never — plain HTTP`,"settings.auth.trustProxy":`Behind a reverse proxy`,"settings.auth.trustProxyOff":`No — ignore x-forwarded-*`,"settings.auth.trustProxyLoopback":`Yes, from this machine only`,"settings.auth.trustProxyAny":`Yes, from any caller`,"settings.auth.trustProxyHint":`Trust x-forwarded-* for the client address and protocol. 'From this machine only' is the safe choice for a proxy on the same host. 'From any caller' believes the caller's own header, so login lockout counts per forged address and can be bypassed.`,"settings.auth.maxLoginAttempts":`Max login attempts`,"settings.auth.maxLoginAttemptsHint":`Failures before a temporary lockout.`,"settings.auth.lockout":`Lockout (ms)`,"settings.auth.apiTokenSet":`An API token is set`,"settings.auth.apiTokenMissing":`No API token`,"settings.auth.apiTokenNote":`Scripts can call the API with {code} instead of signing in.`,"settings.auth.noTokenNote":`For shell scripts and agents, generate one with {command}.`,"settings.auth.defaultPasswordTitle":`The default password is still in use`,"settings.auth.defaultPasswordText":`Set your own password below. Binding beyond {address} stays refused until you do.`,"settings.auth.blockedTitle":`This listener is being refused`,"settings.auth.noPasswordTitle":`Authentication is on but no password is set`,"settings.auth.noPasswordText":`Nothing is actually required yet, and binding beyond {address} stays refused until a password exists.`,"settings.auth.exposedTitle":`Reachable beyond 127.0.0.1`,"settings.auth.exposedText":`Keep the password strong, or put a TLS-terminating proxy in front of the panel.`,"settings.auth.changePassword":`Change password`,"settings.auth.setPassword":`Set a password`,"settings.auth.passwordDescription":`Stored as a scrypt hash in the secrets file, never in the config.`,"settings.auth.currentPassword":`Current password`,"settings.auth.newPassword":`New password`,"settings.auth.repeatPassword":`Repeat new password`,"settings.auth.passwordMismatch":`The two passwords do not match.`,"settings.auth.updatePassword":`Update password`,"settings.auth.setPasswordAndEnable":`Set password and enable auth`,"settings.auth.clearPassword":`Clear password`,"settings.auth.clearPasswordConfirm":`Confirm clear`,"settings.auth.clearPasswordTitle":`Clear the password?`,"settings.auth.clearPasswordHint":`Authentication is switched off with it, and anyone reaching the panel is let straight in.`,"settings.auth.shortPasswordTitle":`That is a short password`,"settings.auth.shortPasswordText":`It is allowed, but longer is the only thing standing between the network and this panel.`,"settings.auth.passwordUpdated":`Password updated. Other sessions were signed out.`,"settings.auth.passwordCleared":`Password cleared and authentication disabled.`,"settings.backup.createTitle":`Create a backup`,"settings.backup.createDescription":`Pick what this archive captures. Nothing is written until you create it.`,"settings.backup.chooseItems":`Choose items`,"settings.backup.partialCapture":`Only the chosen items are captured.`,"settings.backup.withoutGlobalSettings":`Without the global settings, a restore can only place a workspace where the target panel already declares it.`,"settings.backup.password":`Password (optional)`,"settings.backup.passwordHint":`Encrypts the archive; restoring it asks for the same password.`,"settings.backup.create":`Create backup`,"settings.backup.chooseItemsFor":`{label} — choose items`,"settings.backup.subDescription":`A workspace can be captured whole or only its settings, servers, secrets and declared data paths.`,"settings.backup.selectedOf":`{selected} of {total} selected`,"settings.backup.nothingSelectable":`This workspace declares nothing selectable yet.`,"settings.backup.apply":`Apply`,"settings.backup.created":`Backup created.`,"settings.backup.leafSettingsHint":`Server defaults, log retention and notifications`,"settings.backup.leafServersHint":`Every entry in servers.config.json`,"settings.backup.leafSecretsHint":`Telegram bot token and DDNS credentials`,"settings.backup.leafDataHint":`A declared data path`,"settings.backup.pathFromOrigin":`{path} — from {origin}`,"settings.backup.entrySettingsHint":`Listener, auth, host vitals and the backups policy`,"settings.backup.entrySecretsHint":`Password hash and API token hash`,"settings.backup.entryTlsHint":`The panel's own certificate pair`,"settings.backup.entryWorkspaceHint":`Its settings, servers, secrets and declared data paths`,"settings.backup.entryGlobalSettings":`Global settings`,"settings.backup.entryGlobalSecrets":`Global secrets (password, API token)`,"settings.backup.entryTlsCertificate":`TLS certificate`,"settings.backup.leafSettings":`Settings`,"settings.backup.leafServers":`Servers`,"settings.backup.leafSecrets":`Secrets`,"settings.backup.restoreItemLabel":`{workspace}: {item}`,"settings.backup.noteMissing":`does not exist yet`,"settings.backup.noteCovered":`covered by {path}`,"settings.backup.noteAlreadyDeclared":`already declared by {origin}`,"settings.backup.noteContainsBackupDir":`contains the backup directory`,"settings.backup.noteUnknownWorkspace":`unknown workspace`,"settings.backup.noteMissingFromArchive":`missing from the archive`,"settings.backup.noteDeclaredByBackup":`declared by the backup's config, which is not being restored`,"settings.backup.noteNotDeclared":`not declared by this config, nor by the backup`,"settings.backup.noteRestoredFrom":`restored from {path}`,"settings.backups.policyTitle":`Policy`,"settings.backups.policyDescription":`How many archives the panel keeps, and the extra paths every one of them captures.`,"settings.backups.allow":`Allow backups`,"settings.backups.allowHint":`Off stops new archives; whatever is already on disk stays downloadable and restorable.`,"settings.backups.offTitle":`Backups are off`,"settings.backups.offText":`Nothing new is archived until this is back on. The archives below can still be downloaded, restored and deleted.`,"settings.backups.keep":`Keep`,"settings.backups.keepHint":`Older archives are pruned after each backup.`,"settings.backups.extraPaths":`Extra paths`,"settings.backups.extraPathsHint":`Comma separated, captured in every archive on top of what each workspace declares.`,"settings.backups.extraPathsPlaceholder":`{home}/myapp-data`,"settings.backups.archiveDirectory":`Archive directory`,"settings.backups.copyArchiveDirectory":`Copy the archive directory`,"settings.backups.changeDirectory":`Changing it is a file-level decision: edit {path}.`,"settings.backups.theSettingsFile":`the settings file`,"settings.backups.capturesTitle":`What a backup captures`,"settings.backups.capturesDescription":`Pick these in the create dialog. A workspace can be taken whole or only its settings, servers, secrets and declared data paths.`,"settings.backups.nothingSelectable":`Nothing is selectable yet.`,"settings.backups.fromOrigin":`from {origin}`,"settings.backups.notCaptured":`not captured`,"settings.backups.generatedSkipped":`generated directories skipped`,"settings.backups.included":`included`,"settings.backups.skipped":`skipped`,"settings.backups.workspacesNote":`This panel serves {count} workspaces; each is its own selectable entry.`,"settings.backups.archivesTitle":`Archives`,"settings.backups.archivesDescription":`Stored in the backup directory and downloadable at any time.`,"settings.backups.create":`Create backup…`,"settings.backups.restore":`Restore…`,"settings.backups.noArchives":`No archives yet`,"settings.backups.noArchivesEnabled":`Create one now to capture the panel and whichever workspaces you pick.`,"settings.backups.noArchivesDisabled":`Nothing has been archived yet, and backups are off.`,"settings.backups.encrypted":`encrypted`,"settings.backups.download":`Download`,"settings.backups.restoreAction":`Restore`,"settings.backups.confirmDelete":`Confirm delete`,"settings.backups.deleted":`Deleted {name}.`,"settings.backups.kindSettings":`settings`,"settings.backups.kindServers":`servers`,"settings.backups.kindSecrets":`secrets`,"settings.backups.kindTls":`tls`,"settings.backups.kindData":`data`,"settings.backups.kindWorkspace":`workspace`,"settings.ddns.statePending":`Waiting`,"settings.ddns.stateOk":`Updated`,"settings.ddns.stateUnchanged":`Current`,"settings.ddns.stateSkipped":`Skipped`,"settings.ddns.stateError":`Failed`,"settings.ddns.passFinished":`Dynamic DNS pass finished`,"settings.ddns.credentialsSaved":`Credentials saved for {account}`,"settings.ddns.credentialsRemoved":`Credentials removed for {account}`,"settings.ddns.loadErrorTitle":`Dynamic DNS settings could not be loaded`,"settings.ddns.title":`Dynamic DNS`,"settings.ddns.description":`Keep these hostnames pointed at this machine's public address. Credentials live in the secrets file, never in servers.config.json.`,"settings.ddns.checking":`checking`,"settings.ddns.needsAttention":`needs attention`,"settings.ddns.watching":`watching`,"settings.ddns.updateNow":`Update now`,"settings.ddns.enabled":`Keep dynamic DNS updated`,"settings.ddns.enabledHint":`A pass runs on the interval below; a provider is only called when the address actually changed.`,"settings.ddns.interval":`Check every (ms)`,"settings.ddns.intervalHint":`60000 is one minute; the default is five.`,"settings.ddns.ttl":`TTL (s)`,"settings.ddns.ttlHint":`1 means automatic where the provider supports it.`,"settings.ddns.detectIpv4":`Detect IPv4`,"settings.ddns.detectIpv4Hint":`Needed for A records.`,"settings.ddns.detectIpv6":`Detect IPv6`,"settings.ddns.detectIpv6Hint":`Needed for AAAA records.`,"settings.ddns.accountsTitle":`Provider accounts`,"settings.ddns.accountsDescription":`One entry per API token. Credentials are stored on the server and never come back.`,"settings.ddns.credentialsSet":`credentials saved`,"settings.ddns.noCredentials":`no credentials`,"settings.ddns.credentials":`Credentials`,"settings.ddns.removeAccountBlocked":`Remove the hostnames using this account first`,"settings.ddns.noAccounts":`No accounts yet. Pick a provider and add one.`,"settings.ddns.provider":`Provider`,"settings.ddns.accountId":`Account id`,"settings.ddns.accountIdPlaceholder":`cloudflare-home`,"settings.ddns.accountIdHint":"The account id names the account and keys its stored credentials; lowercase letters, digits, `-` and `_`.","settings.ddns.hostnamesTitle":`Hostnames`,"settings.ddns.hostnamesDescription":`The whole list to keep updated — suba.domain.com, domain.xyz and so on.`,"settings.ddns.account":`Account`,"settings.ddns.recordA":`A (IPv4)`,"settings.ddns.recordAaaa":`AAAA (IPv6)`,"settings.ddns.aaaaUnsupported":`This provider cannot manage AAAA records.`,"settings.ddns.proxied":`Proxied`,"settings.ddns.proxiedHint":`Cloudflare serves this record through its own network.`,"settings.ddns.ipv6Off":`IPv6 detection is off`,"settings.ddns.advanced":`Advanced`,"settings.ddns.advancedHint":`registered domain and TTL override`,"settings.ddns.registeredDomain":`Registered domain`,"settings.ddns.registeredDomainPlaceholder":`example.co.uk`,"settings.ddns.registeredDomainHint":`Only when the provider has to be told the apex, e.g. three-label domains.`,"settings.ddns.ttlOverride":`TTL override (s)`,"settings.ddns.ttlOverrideHint":`Blank uses the value above.`,"settings.ddns.noHostnames":`No hostnames yet.`,"settings.ddns.hostnamePlaceholder":`home.example.com`,"settings.ddns.lastPass":`Last pass`,"settings.ddns.ipv4Value":`IPv4 {address}`,"settings.ddns.ipv6Value":`IPv6 {address}`,"settings.ddns.type":`Type`,"settings.ddns.state":`State`,"settings.ddns.address":`Address`,"settings.ddns.detail":`Detail`,"settings.ddns.credentialsTitle":`Provider credentials`,"settings.ddns.credentialsDescription":`Saved fields are never sent back. Saving replaces every field for this account and runs a pass right away.`,"settings.ddns.optional":`Optional.`,"settings.ddns.whereToGet":`Where to get these`,"settings.ddns.forget":`Forget`,"settings.ddns.forgetConfirm":`Forget them`,"settings.ddns.forgetTitle":`Forget the stored credentials?`,"settings.ddns.forgetHint":`They are removed from disk and cannot be read back; you would need to paste them again.`,"settings.ddns.saveCredentials":`Save credentials`,"settings.defaults.title":`Server defaults`,"settings.defaults.description":`Applied to every entry that does not set its own value.`,"settings.defaults.enabledHint":`New entries start enabled.`,"settings.defaults.autostart":`Autostart with the panel`,"settings.defaults.bind":`Bind`,"settings.defaults.bindLocal":`Local — 127.0.0.1`,"settings.defaults.bindLan":`LAN — 0.0.0.0`,"settings.defaults.onPortConflict":`On port conflict`,"settings.defaults.conflictBlock":`Block the start`,"settings.defaults.conflictWarn":`Warn and start anyway`,"settings.defaults.conflictFollow":`Follow a detached restart of itself`,"settings.defaults.conflictReclaim":`Replace a detached restart with a supervised copy`,"settings.defaults.conflictKill":`Kill whatever holds the port`,"settings.defaults.logBufferLines":`Log buffer lines`,"settings.defaults.logBufferLinesHint":`Kept in memory per server.`,"settings.host.title":`Thresholds`,"settings.host.description":`A threshold of 0 disables that alert. Breaches notify once, and once more on recovery.`,"settings.host.enabled":`Sample this machine`,"settings.host.enabledHint":`Load, memory, swap, disk and CPU temperature, on the interval below.`,"settings.host.interval":`Interval (ms)`,"settings.host.intervalHint":`How often the host is sampled and alerts are checked.`,"settings.host.diskPaths":`Disk paths`,"settings.host.diskPathsHint":`Comma separated; templates like {home} are expanded.`,"settings.host.diskUsed":`Disk used (%)`,"settings.host.memoryUsed":`Memory used (%)`,"settings.host.swapUsed":`Swap used (%)`,"settings.host.zeroDisables":`0 disables the alert.`,"settings.host.loadPerCpu":`Load per CPU`,"settings.host.loadPerCpuHint":`1-minute load average divided by the core count.`,"settings.host.tempCelsius":`CPU temperature (°C)`,"settings.host.tempCelsiusHint":`Linux only; ignored where the OS does not expose it.`,"settings.host.breachingNow":`Breaching now:`,"settings.host.nothingBreaching":`Nothing is breaching right now.`,"settings.interface.title":`Interface`,"settings.interface.description":`The panel is a static site: keep the stock one, or serve your own build from the state directory.`,"settings.interface.currentlyServing":`Currently serving`,"settings.interface.copyDirectory":`Copy the UI directory`,"settings.interface.fileCount":`{count} files`,"settings.interface.sourceStock":`stock`,"settings.interface.sourceCustom":`custom`,"settings.interface.unnamed":`unnamed`,"settings.interface.panelVersion":`Panel version`,"settings.interface.copyPanelVersion":`Copy the panel version`,"settings.interface.panelVersionHint":`The release this panel process is running — {command} prints the same number.`,"settings.interface.panelName":`Panel name`,"settings.interface.panelNameHint":`Shown in the sidebar by the stock UI. A custom UI may show its own name instead.`,"settings.interface.uploadLabel":`Upload a UI build (.zip with an index.html)`,"settings.interface.docsHint":`See {docs} for the API contract. If a custom UI breaks the panel, {command} puts the stock one back from the terminal.`,"settings.interface.resetName":`Reset name`,"settings.interface.confirmRevert":`Confirm revert`,"settings.interface.revertToStock":`Revert to stock`,"settings.interface.install":`Install UI`,"settings.interface.installed":`UI replaced with {name} — refresh the page`,"settings.interface.yourBuild":`your build`,"settings.interface.restored":`stock UI restored — refresh the page`,"settings.interface.nothingInstalled":`no custom UI was installed`,"settings.listener.title":`Listener`,"settings.listener.description":`Where the panel answers. Moving this restarts the panel and sends this page to the new address.`,"settings.listener.port":`Control port`,"settings.listener.portHint":`Default 3999.`,"settings.listener.bind":`Bind`,"settings.listener.bindLocal":`Local`,"settings.listener.bindLan":`LAN`,"settings.listener.bindCustom":`Custom`,"settings.listener.bindLanHint":`0.0.0.0 — reachable from the whole network.`,"settings.listener.bindLocalHint":`127.0.0.1 — this machine only.`,"settings.listener.bindCustomHint":`A specific interface address you type in below.`,"settings.listener.ipv4":`IPv4 address`,"settings.listener.ipv4Placeholder":`192.168.1.20`,"settings.listener.ipv4Error":`Enter an IPv4 address, for example 192.168.1.20.`,"settings.listener.ipv4Hint":`Binding beyond 127.0.0.1 needs a real password.`,"settings.listener.openBrowser":`Open a browser when the panel comes up`,"settings.listener.liveAddress":`Live address`,"settings.listener.restartRequired":`restart required`,"settings.listener.copyLiveAddress":`Copy the live address`,"settings.listener.liveAddressHint":`What the listener is bound to right now; saved changes take effect after the panel rebinds.`,"settings.logs.title":`Retention`,"settings.logs.description":`The live view always comes from memory; these files survive a restart and feed the Logs page.`,"settings.logs.persist":`Keep logs on disk`,"settings.logs.persistHint":`Turn off to hold everything in memory only.`,"settings.logs.maxBytes":`Rotate at (bytes)`,"settings.logs.maxBytesHint":`Per server, before rolling to .1, .2, …`,"settings.logs.keep":`Keep rotated files`,"settings.logs.directory":`Logs directory`,"settings.logs.copyDirectory":`Copy the logs directory`,"settings.logs.browseHint":`Browse and download these files on the {logs} page.`,"settings.paths.dataRoot":`Data root`,"settings.paths.dataRootHint":`HHOSTED_HOME — global settings, workspaces, TLS, backups and the UI.`,"settings.paths.globalSettings":`Global settings`,"settings.paths.globalSettingsHint":`settings.json — listener, auth, TLS policy, host vitals, backups.`,"settings.paths.projectDir":`Project directory`,"settings.paths.projectDirHint":`Base for relative entry paths.`,"settings.paths.panelAddress":`Panel address`,"settings.paths.panelAddressHint":`Where this control panel is live right now.`,"settings.paths.serversConfig":`Servers config`,"settings.paths.serversConfigHint":`{label}'s servers.config.json.`,"settings.paths.workspaceSettings":`Workspace settings`,"settings.paths.workspaceSettingsHint":`Server defaults, log retention, notifications, DDNS.`,"settings.paths.logs":`Logs`,"settings.paths.logsHint":`Persisted output for this workspace.`,"settings.paths.copyPath":`Copy {label}`,"settings.paths.whereThingsLive":`Where things live`,"settings.paths.whereThingsLiveDescription":`Read-only. Copy a path straight into a shell or an editor.`,"settings.paths.workspaceFiles":`Workspace files`,"settings.paths.workspaceFilesDescription":`Each workspace owns its config, settings and log directory; nothing is shared between them.`,"settings.rebind.failed":`The control panel did not answer on {target}. Check the console for the new listener.`,"settings.restore.title":`Restore a backup`,"settings.restore.description":`Nothing is written until the plan is applied.`,"settings.restore.archive":`Archive`,"settings.restore.archiveHint":`A stored archive, or a .zip from this machine.`,"settings.restore.encryptedName":`{name} — encrypted`,"settings.restore.uploadOption":`Upload a file…`,"settings.restore.archiveFile":`Archive file (.zip)`,"settings.restore.unchangedTitle":`Nothing has changed yet`,"settings.restore.archiveLine":`Archive {name}.`,"settings.restore.uploadedArchive":`The uploaded archive.`,"settings.restore.passwordProtected":`This backup is password-protected.`,"settings.restore.password":`Password`,"settings.restore.checkAgain":`Check again with the password`,"settings.restore.choosePrompt":`Choose what to restore — {selected} of {total} selected.`,"settings.restore.willRestore":`Will restore: {items}.`,"settings.restore.skipped":`Skipped: {items}.`,"settings.restore.nothing":`nothing`,"settings.restore.restartNote":`The panel's own settings differ, so restart the panel afterwards.`,"settings.restore.reloadedNote":`Restored workspaces are reloaded immediately; entries marked autostart start on their own.`,"settings.restore.applyStored":`Apply this restore`,"settings.restore.applyUpload":`Restore the upload`,"settings.restore.restored":`Restored {count} item(s).`,"settings.restore.restoredWithNotes":`Restored {count} item(s) — {notes}.`,"settings.restore.noteReloaded":`the restored servers are live, autostart entries starting`,"settings.restore.noteRestart":`restart the panel to apply its own settings`,"settings.restore.reasonSymbolicLink":`symbolic link, skipped`,"settings.restore.reasonNotSelected":`not selected`,"settings.restore.reasonUnrestorable":`cannot be restored here`,"settings.restore.reasonInvalidSettings":`the archive's settings are not valid`,"settings.restore.reasonInvalidServers":`the archive's servers are not valid`,"settings.shell.noUnsavedChanges":`No unsaved changes`,"settings.shell.discard":`Discard changes`,"settings.shell.save":`Save settings`,"settings.shell.unsavedTitle":`Unsaved changes`,"settings.shell.nothingToSave":`Nothing to save.`,"settings.telegram.title":`Telegram`,"settings.telegram.description":`Policy lives in the config; the bot token is a secret and never comes back from the server.`,"settings.telegram.enabled":`Send notifications`,"settings.telegram.enabledHint":`One message per event, throttled by the cooldown below.`,"settings.telegram.chatId":`Chat id`,"settings.telegram.chatIdPlaceholder":`123456789 or @channel`,"settings.telegram.chatIdHint":`Use Detect chats to fill this from the bot's updates.`,"settings.telegram.cooldown":`Cooldown per event (ms)`,"settings.telegram.cooldownHint":`Per server and reason, so a flapping server cannot spam.`,"settings.telegram.onCrash":`Retries exhausted`,"settings.telegram.onUnhealthy":`Port unhealthy`,"settings.telegram.onForcedRestart":`Forced restart`,"settings.telegram.onRecovered":`Recovered`,"settings.telegram.onHost":`Host vitals breached`,"settings.telegram.onHostHint":`Disk, memory, swap, load and CPU temperature, per the thresholds under Host vitals.`,"settings.telegram.onDdns":`Dynamic DNS changed or failed`,"settings.telegram.onDdnsHint":`One message per pass that changed a record, and one for a pass that failed.`,"settings.telegram.botToken":`Bot token`,"settings.telegram.tokenSet":`token set`,"settings.telegram.noToken":`no token`,"settings.telegram.tokenNote":`From @BotFather — a secret, never in servers.config.json.`,"settings.telegram.tokenPlaceholder":`123456789:AA…`,"settings.telegram.tokenSavedPlaceholder":`Saved — type a new token to replace it`,"settings.telegram.saveToken":`Save token`,"settings.telegram.detectChats":`Detect chats`,"settings.telegram.sendTest":`Send test`,"settings.telegram.removeToken":`Remove token`,"settings.telegram.removeTokenConfirm":`Confirm remove`,"settings.telegram.removeTokenTitle":`Remove the bot token?`,"settings.telegram.removeTokenHint":`Notifications stop until you paste a token again.`,"settings.telegram.tokenSaved":`Token saved.`,"settings.telegram.tokenSavedFor":`Token saved for @{username}.`,"settings.telegram.tokenRemoved":`Token removed.`,"settings.telegram.noChats":`No chats found. Send /start to the bot first, then detect again.`,"settings.telegram.testSent":`Test message sent.`,"settings.telegram.testFailed":`The test message failed.`,"settings.telegram.chatsSeen":`Chats the bot has seen:`,"settings.telegram.lastSend":`Last send: {result}`,"settings.tls.title":`HTTPS`,"settings.tls.description":`Upload a PEM pair and the panel serves TLS on its own listener. A self-signed certificate is fine on a home network.`,"settings.tls.serve":`Serve the panel over HTTPS`,"settings.tls.serveHint":`Saved with Save settings; the panel rebinds and this page follows it.`,"settings.tls.certificateTitle":`Certificate`,"settings.tls.certificateDescription":`PEM-encoded certificate and its private key. Both stay in the secrets file.`,"settings.tls.unusableTitle":`The stored certificate cannot be used`,"settings.tls.subject":`Subject`,"settings.tls.issuer":`Issuer`,"settings.tls.validUntil":`Valid until`,"settings.tls.days":`{count} days`,"settings.tls.privateKey":`Private key`,"settings.tls.keyMatches":`matches the certificate`,"settings.tls.keyMismatch":`does not match`,"settings.tls.fingerprint":`Fingerprint`,"settings.tls.copyFingerprint":`Copy the fingerprint`,"settings.tls.noCertificateTitle":`No certificate uploaded`,"settings.tls.noCertificateText":`Upload a PEM certificate and key below, then save. HTTPS is not served until a certificate is present.`,"settings.tls.certFile":`Certificate file (.pem, .crt)`,"settings.tls.keyFile":`Private key file (.pem, .key)`,"settings.tls.pasteCertificate":`Or paste the certificate`,"settings.tls.pasteKey":`Or paste the private key`,"settings.tls.saveCertificate":`Save certificate`,"settings.tls.removeCertificate":`Remove certificate`,"settings.tls.confirmRemove":`Confirm remove`,"settings.tls.removeTitle":`Remove the certificate?`,"settings.tls.removeHint":`TLS stays on but has nothing to serve, so the panel falls back to http once the listener rebinds.`,"settings.tls.stored":`Certificate stored.`,"settings.tls.removed":`Certificate removed.`,"status.stopped":`Stopped`,"status.starting":`Starting`,"status.running":`Running`,"status.stopping":`Stopping`,"status.backoff":`Restarting`,"status.crashed":`Crashed`,"status.conflict":`Port conflict`,"theme.label":`Theme: {theme}`,"theme.light":`light`,"theme.dark":`dark`,"theme.system":`system`,"topbar.search":`Search or run a command`,"topbar.openNavigation":`Open navigation`,"topbar.commandPalette":`Command palette`,"topbar.account":`Account`,"topbar.signedIn":`Signed in`,"topbar.signOut":`Sign out`,"topbar.workspaceLabel":`Workspace: {name}`,"validation.port":`Port must be a whole number between 1 and 65535.`,"validation.idRequired":`An id is required — it is the key this server lives under.`,"validation.idPattern":`The id must start with a lowercase letter or digit and contain only lowercase letters, digits, dashes and underscores.`,"validation.commandRequired":`A command is required — the executable the supervisor spawns.`,"validation.bootstrapCommand":`A bootstrap needs a command to run.`,"views.actions.addAServer":`Add a server`,"views.actions.addServer":`Add server`,"views.actions.startAll":`Start all`,"views.actions.stopAll":`Stop all`,"views.common.thisWorkspace":`this workspace`,"views.globalOverview.configError":`The config could not be read: {error}`,"views.globalOverview.degraded":`degraded`,"views.globalOverview.description":`Host vitals and every server from every workspace, grouped by where it lives.`,"views.globalOverview.emptyDescription":`Pick a workspace in the header and add the first process it should keep alive.`,"views.globalOverview.emptyTitle":`No servers anywhere yet`,"views.globalOverview.groupEmptyDescription":`Add one and it will show up here and on the workspace page.`,"views.globalOverview.groupRunning":`{running}/{total} running`,"views.globalOverview.hostUptime":`Host uptime`,"views.globalOverview.hostVitals":`Host vitals`,"views.globalOverview.hostVitalsNote":`This machine, shared by every workspace.`,"views.globalOverview.openWorkspace":`Open workspace`,"views.globalOverview.panelUptime":`Panel uptime`,"views.globalOverview.samplingOff":`sampling off`,"views.globalOverview.samplingOn":`sampling on`,"views.globalOverview.serversTotal":`{count} servers in total`,"views.globalOverview.serving":`serving`,"views.globalOverview.workspaces":`Workspaces`,"views.globalSettings.authenticationDescription":`Who may sign in to this panel, and how a session is trusted.`,"views.globalSettings.backupsDescription":`One archive per capture, covering the panel and any workspace you pick.`,"views.globalSettings.changesDescription":`What Save would write to the panel's settings file.`,"views.globalSettings.description":`Listener, access, host vitals, backups, TLS and paths for this panel — shared by every workspace.`,"views.globalSettings.hostDescription":`Alert thresholds for this machine's own resources.`,"views.globalSettings.interfaceDescription":`Serve your own panel UI instead of the stock one.`,"views.globalSettings.languageDescription":`The language this panel is shown in, for this browser.`,"views.globalSettings.languageNote":`Your choice is kept in this browser and applies to the login page too. It does not change the panel's own log output or its API messages.`,"views.globalSettings.listenerDescription":`Where the control panel listens and how it announces itself.`,"views.globalSettings.loadErrorTitle":`Some file-only values could not be loaded`,"views.globalSettings.navLabel":`Global settings sections`,"views.globalSettings.pathsDescription":`Where home-hosted keeps its files, globally and per workspace.`,"views.globalSettings.saveFailed":`The settings could not be saved.`,"views.globalSettings.saved":`Settings saved.`,"views.globalSettings.savedRebinding":`Settings saved — the panel is moving to a new address.`,"views.globalSettings.savedToast":`Settings saved`,"views.globalSettings.sectionAuthentication":`Authentication`,"views.globalSettings.sectionBackups":`Backups`,"views.globalSettings.sectionHost":`Host vitals`,"views.globalSettings.sectionInterface":`Interface`,"views.globalSettings.sectionListener":`Listener`,"views.globalSettings.sectionPaths":`Paths`,"views.globalSettings.sectionTls":`TLS`,"views.globalSettings.title":`Global settings`,"views.globalSettings.tlsDescription":`Serve the panel over HTTPS with your own certificate.`,"views.logs.allStreams":`All streams`,"views.logs.clear":`Clear`,"views.logs.clearDescription":`{server} — the file on disk is truncated. The process keeps running and new lines are written from here on.`,"views.logs.clearFile":`Clear file`,"views.logs.clearNote":`Download it first if the output is still needed — this cannot be undone from the panel.`,"views.logs.clearTitle":`Clear the persisted log file?`,"views.logs.fileEmpty":`The persisted file is empty.`,"views.logs.loadedLines":`loaded {count} lines`,"views.logs.modeLive":`Live stream`,"views.logs.modePersisted":`Persisted`,"views.logs.noServersDescription":`Add one and its output will be persisted here.`,"views.logs.noServersTitle":`No servers`,"views.logs.nothingOnDisk":`Nothing on disk for this server — persistence is off, or it has not written anything yet.`,"views.logs.nothingPersisted":`nothing persisted`,"views.logs.persistedSummary":`{workspace} · {persisted} of {total} servers on disk · {size}`,"views.logs.persistedTitle":`Persisted logs`,"views.logs.pickServerDescription":`Persisted output and live streams are per server. Choose one from the list.`,"views.logs.pickServerTitle":`Pick a server`,"views.logs.reload":`Reload`,"views.logs.retentionNote":`Rotation and retention are set under Workspace settings → Logs.`,"views.logs.searchAria":`Search the log`,"views.logs.searchPlaceholder":`search the tail window`,"views.logs.searchedLines":`searched {count} lines`,"views.logs.streamAria":`Stream`,"views.logs.tailAria":`Tail size`,"views.logs.waitingOutput":`Connected — waiting for output.`,"views.overview.acrossTree":`across the tree`,"views.overview.cpuNow":`{value}% cpu now`,"views.overview.crashedOrUnhealthy":`crashed or unhealthy`,"views.overview.description":`Live state of every server in this workspace, refreshed over a single event stream.`,"views.overview.emptyDescription":`Add the first process this workspace should keep alive.`,"views.overview.emptyTitle":`No servers in this workspace`,"views.overview.enabled":`{count} enabled`,"views.overview.longestUptime":`Longest uptime`,"views.overview.needsAttention":`Needs attention`,"views.overview.notUp":`{count} not up`,"views.overview.nothingBroken":`nothing is broken`,"views.overview.nothingRunning":`nothing running`,"views.overview.openFullList":`Open the full list`,"views.overview.peak":`peak {value}`,"views.overview.processMemory":`Process memory`,"views.overview.recentActivity":`Recent activity`,"views.overview.running":`Running`,"views.overview.sampling":`resource history is sampled every 5 s and kept for this session`,"views.overview.stopped":`Stopped`,"views.overview.workspaceLabel":`workspace {id}`,"views.route.server":`Server`,"views.serverDetail.allServers":`All servers`,"views.serverDetail.autostart":`Autostart with the panel`,"views.serverDetail.backToServers":`Back to servers`,"views.serverDetail.bind":`Bind`,"views.serverDetail.bindCustom":`{bind} — custom`,"views.serverDetail.bindLan":`0.0.0.0 — every interface`,"views.serverDetail.bindLocal":`127.0.0.1 — this machine only`,"views.serverDetail.closeEditor":`Close editor`,"views.serverDetail.copyJson":`Copy the JSON config`,"views.serverDetail.crashes24":`24h crashes`,"views.serverDetail.dependencies":`Dependencies`,"views.serverDetail.detached":`detached`,"views.serverDetail.detachedHint":`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`,"views.serverDetail.disableServer":`Disable server`,"views.serverDetail.editHint":`Edit every field of this entry`,"views.serverDetail.effectiveConfig":`Effective configuration`,"views.serverDetail.effectiveConfigNote":`Defaults from Settings are already merged into these values.`,"views.serverDetail.enableServer":`Enable server`,"views.serverDetail.eventHistory":`Event history`,"views.serverDetail.eventHistoryNote":`Kept by the panel for 24 hours.`,"views.serverDetail.fieldArgs":`args`,"views.serverDetail.fieldBackupPaths":`backup paths`,"views.serverDetail.fieldBootstrap":`bootstrap`,"views.serverDetail.fieldCommand":`command`,"views.serverDetail.fieldCwd":`cwd`,"views.serverDetail.fieldDataEnvs":`data envs`,"views.serverDetail.fieldDependsOn":`depends on`,"views.serverDetail.fieldEnv":`env`,"views.serverDetail.fieldEnvFile":`env file`,"views.serverDetail.fieldHealth":`health`,"views.serverDetail.fieldLogBuffer":`log buffer`,"views.serverDetail.fieldOnPortConflict":`on port conflict`,"views.serverDetail.fieldPortBind":`port · bind`,"views.serverDetail.fieldRestart":`restart`,"views.serverDetail.fieldRssLimit":`RSS limit`,"views.serverDetail.fieldStop":`stop`,"views.serverDetail.fields":`Fields`,"views.serverDetail.goneDescription":`{id} is not in servers.config.json any more. It may have been removed from another tab.`,"views.serverDetail.goneTitle":`That server is gone`,"views.serverDetail.health":`Health`,"views.serverDetail.healthProbe":`Health probe`,"views.serverDetail.lastCrash":`Last crash`,"views.serverDetail.lastProbe":`Last probe`,"views.serverDetail.logBufferLines":`{count} lines`,"views.serverDetail.memoryRss":`Memory (RSS)`,"views.serverDetail.moreActions":`More actions for {label}`,"views.serverDetail.neverWritten":`This server has not written anything yet.`,"views.serverDetail.nextAttempt":`Next attempt`,"views.serverDetail.none":`none`,"views.serverDetail.off":`off`,"views.serverDetail.persistent":`persistent`,"views.serverDetail.persistentHint":"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only Stop does.","views.serverDetail.pid":`PID`,"views.serverDetail.portFree":`free`,"views.serverDetail.portInUse":`in use`,"views.serverDetail.portState":`Port state`,"views.serverDetail.probeFailed":`The health probe has not passed.`,"views.serverDetail.probeFailedFor":`The health probe has not passed for {duration}.`,"views.serverDetail.processes":`Processes`,"views.serverDetail.rawJson":`Raw JSON`,"views.serverDetail.removeAutostart":`Remove from autostart`,"views.serverDetail.removeDescription":`{label} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,"views.serverDetail.removeNote":`This cannot be undone from the panel — the entry has to be added back by hand or from a backup.`,"views.serverDetail.removeServer":`Remove server`,"views.serverDetail.removeTitle":`Remove this server?`,"views.serverDetail.restart":`Restart`,"views.serverDetail.restarts":`Restarts`,"views.serverDetail.sectionConfig":`Configuration`,"views.serverDetail.sectionHistory":`History`,"views.serverDetail.sectionOutput":`Live output`,"views.serverDetail.start":`Start`,"views.serverDetail.startsOnItsOwn":`Starts on its own. Add ids under {code} to order it after other servers.`,"views.serverDetail.stop":`Stop`,"views.serverDetail.telemetry":`Telemetry`,"views.serverDetail.telemetryNote":`Sampled every 5 s while this page is open.`,"views.serverDetail.unhealthyFor":`Unhealthy for`,"views.serverDetail.uptime24":`24h uptime`,"views.serverDetail.waitingFirstLine":`Waiting for the first line…`,"views.servers.clearFilter":`Clear the filter`,"views.servers.clearFilters":`Clear filters`,"views.servers.description":`Every entry in {workspace}'s servers.config.json, with live resources, health and history.`,"views.servers.emptyDescription":`Add the first process this panel should supervise. Its command, args, env and working directory all live in the config file.`,"views.servers.emptyTitle":`No servers configured`,"views.servers.filterAll":`All`,"views.servers.filterAria":`Filter servers`,"views.servers.filterAttention":`Attention`,"views.servers.filterDisabled":`Disabled`,"views.servers.filterPlaceholder":`Filter by id, label, command or port`,"views.servers.filterRunning":`Running`,"views.servers.filterStopped":`Stopped`,"views.servers.noMatchDescription":`Try a different status or clear the search.`,"views.servers.noMatchTitle":`Nothing matches that filter`,"views.settings.changesDescription":`What Save would write to {workspace}'s settings.`,"views.settings.configErrorNote":`The panel keeps supervising with the config it already had; fixing the file reloads it on its own.`,"views.settings.configErrorTitle":`The workspace config could not be read`,"views.settings.configWarningTitle":`This workspace's config has a warning`,"views.settings.ddnsDescription":`Keep hostnames pointed at this machine's public address, whichever registrar holds them.`,"views.settings.defaultsDescription":`Applied to every entry in this workspace that does not set its own value.`,"views.settings.description":`Server defaults, log retention, notifications and dynamic DNS for {workspace}.`,"views.settings.logsDescription":`How much output this workspace keeps on disk and for how long.`,"views.settings.navLabel":`Workspace settings sections`,"views.settings.notificationsDescription":`Crash and health alerts for this workspace, sent to a Telegram chat.`,"views.settings.saveFailed":`The settings could not be saved.`,"views.settings.saved":`Workspace settings saved.`,"views.settings.savedToast":`Workspace settings saved`,"views.settings.sectionDdns":`Dynamic DNS`,"views.settings.sectionDefaults":`Server defaults`,"views.settings.sectionLogs":`Logs`,"views.settings.sectionNotifications":`Notifications`,"workspace.new":`New workspace`,"workspace.rename":`Rename workspace`,"workspace.create":`Create workspace`,"workspace.renameAction":`Rename`,"workspace.createHint":`Its own settings, servers, logs, secrets and backups entry — served by this same panel.`,"workspace.renameHint":`Only the name changes; the workspace id stays, so URLs and paths keep working.`,"workspace.nameHint":`Shown in the header.`,"workspace.nameHintId":`Shown in the header. Id: {id}`,"workspace.none":`No workspace`,"workspace.delete":`Delete workspace`,"days.remaining":{one:`{count} day`,other:`{count} days`},"editor.unsaved":{one:`unsaved change`,other:`unsaved changes`},"editor.saveChanges":{one:`Save {count} change`,other:`Save {count} changes`},"logs.lines":{one:`{count} line`,other:`{count} lines`},"palette.results":{one:`{count} result`,other:`{count} results`},"proxy.retry.inMinutes":{one:`~{count} minute`,other:`~{count} minutes`},"proxy.retry.inHours":{one:`~{count} hour`,other:`~{count} hours`},"servers.total":{one:`{count} server`,other:`{count} servers`},"servers.running":{one:`{count} running`,other:`{count} running`},"settings.backup.entriesCount":{one:`{count} entry`,other:`{count} entries`},"settings.backup.itemsSelected":{one:`{count} item selected`,other:`{count} items selected`},"settings.ddns.hostnameCount":{one:`{count} hostname`,other:`{count} hostnames`},"settings.shell.fieldsChanged":{one:`field changed`,other:`fields changed`},"settings.shell.saveChanges":{one:`Save {count} change`,other:`Save {count} changes`},"views.globalOverview.needLook":{one:`{count} server need a look`,other:`{count} servers need a look`},"views.logs.filesOnDisk":{one:`{count} file`,other:`{count} files`},"views.overview.needLook":{one:`{count} server need a look`,other:`{count} servers need a look`}},mP=/\{(\w+)\}/g;function hP(e,t){return`${e}:${t||`index`}`}function gP(e,t){if(e==null)return null;let n=SP(e,t);return n===void 0?null:n}function _P(e,t,n){if(n?.preserveExisting){bP(e,t);return}yP(e,t)}function vP(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yP(e,t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i===`__proto__`)continue;let a=t[i];if(typeof a!=`object`||!a||Array.isArray(a)){e[i]=a;continue}let o=e[i];typeof o==`object`&&o&&!Array.isArray(o)?yP(o,a):e[i]=a}}function bP(e,t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i===`__proto__`)continue;let a=t[i];if(!Object.prototype.hasOwnProperty.call(e,i)){e[i]=a;continue}let o=e[i];vP(a)&&vP(o)&&bP(o,a)}}function xP(e,t){return!t||e.indexOf(`{`)===-1?e:e.replace(mP,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)})}function SP(e,t){if(e==null||typeof t!=`string`||t.length===0)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(!t.includes(`.`))return;let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;let t=r;if(!Object.prototype.hasOwnProperty.call(t,e))return;r=t[e]}return r}function CP(e,t,n){if(typeof t!=`string`||t.length===0)return e;if(Object.prototype.hasOwnProperty.call(e,t)||!t.includes(`.`))return t===`__proto__`?e:{...e,[t]:n};let r=t.split(`.`);if(r.some(e=>e===`__proto__`))return e;let i={...e},a=i;for(let e of r.slice(0,-1)){let t=a[e],n=vP(t)?{...t}:{};a[e]=n,a=n}return a[r[r.length-1]]=n,i}function wP(e,t){let n=TP(e,t),r={};return EP(e,t,``,r),Object.keys(r).length===0?n:{...n,...r}}function TP(e,t){let n={...e};for(let e of Object.keys(t)){if(e===`__proto__`)continue;let r=t[e];if(r==null)continue;let i=n[e];n[e]=vP(r)&&vP(i)?TP(i,r):r}return n}function EP(e,t,n,r){for(let i of Object.keys(e)){if(i===`__proto__`)continue;let a=e[i];if(!vP(a))continue;let o=n?`${n}.${i}`:i,s=t[i];vP(s)?EP(a,s,o,r):s!=null&&DP(a,o,r)}}function DP(e,t,n){for(let r of Object.keys(e)){if(r===`__proto__`)continue;let i=e[r],a=`${t}.${r}`;vP(i)?DP(i,a,n):n[a]=i}}var OP=(e,t,n,r,i)=>{let a=i(e);if(!a)return null;let o=a.toString().split(`|`);if(o.length===0)return null;let s=t<o.length?o[t]:o[o.length-1];return s?xP(s.trim(),{...n,count:t}):null};function kP(e){if(!e)return``;let t=Object.keys(e).sort();if(t.length===0)return``;let n={};for(let r of t)n[r]=e[r];return JSON.stringify(n)}function AP(e,t){let n=kP(t);return n?`${e}\0${n}`:e}var jP=class{constructor(e={}){this.numberCache=new Map,this.dateCache=new Map,this.relativeCache=new Map,this.numberFormats=e.numberFormats??{},this.datetimeFormats=e.datetimeFormats??{}}setNumberFormats(e){this.numberFormats=e,this.numberCache.clear()}setDateTimeFormats(e){this.datetimeFormats=e,this.dateCache.clear()}getNumberFormats(){return this.numberFormats}getDateTimeFormats(){return this.datetimeFormats}clearCache(){this.numberCache.clear(),this.dateCache.clear(),this.relativeCache.clear()}resolveNumberFormat(e,t){return this.numberFormats[e]?.[t]??this.numberFormats[e.split(`-`)[0]]?.[t]}resolveDateTimeFormat(e,t){return this.datetimeFormats[e]?.[t]??this.datetimeFormats[e.split(`-`)[0]]?.[t]}getNumberFormatter(e,t){let n=AP(e,t),r=this.numberCache.get(n);return r||(r=new Intl.NumberFormat(e,t),this.numberCache.set(n,r)),r}getDateTimeFormatter(e,t){let n=AP(e,t),r=this.dateCache.get(n);return r||(r=new Intl.DateTimeFormat(e,t),this.dateCache.set(n,r)),r}getRelativeTimeFormatter(e,t){let n=AP(e,t),r=this.relativeCache.get(n);return r||(r=new Intl.RelativeTimeFormat(e,t),this.relativeCache.set(n,r)),r}formatNumber(e,t,n){return this.getNumberFormatter(t,n).format(e)}formatDate(e,t,n){let r=new Date(e);return Number.isNaN(r.getTime())?`Invalid Date`:this.getDateTimeFormatter(t,n).format(r)}formatRelativeTime(e,t,n){let r=new Date(e),i=this.getRelativeTimeFormatter(t,n);if(Number.isNaN(r.getTime()))return i.format(0,`second`);let a=Math.floor((Date.now()-r.getTime())/1e3);for(let{unit:e,seconds:t}of[{unit:`year`,seconds:31536e3},{unit:`month`,seconds:2592e3},{unit:`day`,seconds:86400},{unit:`hour`,seconds:3600},{unit:`minute`,seconds:60},{unit:`second`,seconds:1}]){let n=Math.floor(a/t);if(n>=1)return i.format(-n,e)}return i.format(0,`second`)}},MP=Symbol(`i18n-leaf-miss`),NP=new WeakMap;function PP(e){let t=NP.get(e);return t||(t={leafByChunk:new Map,generation:0},NP.set(e,t)),t}function FP(e){let t=e?.translations??new Map,n=PP(t),{leafByChunk:r}=n;function i(){n.generation++}function a(e){r.delete(e)}function o(){r.clear()}function s(e){let t=r.get(e);return t||(t=new Map,r.set(e,t)),t}function c(e,t,n){let i=r.get(e);if(i?.has(n)){let e=i.get(n);return e===MP?null:e}if(!t)return s(e).set(n,MP),null;let a=gP(t,n);return s(e).set(n,a===null?MP:a),a}function l(e,n){t.set(e,n),a(e),i()}function u(e,n){let r=t.get(e);if(!r){l(e,{...n});return}_P(r,n),a(e),i()}return{hasCache(e,n){return t.has(hP(e,n))},getCache(e,n){return t.get(hP(e,n))},setCache(e,t,n){r.set(hP(e,t),n)},getGeneration(){return n.generation},hasTranslation(e,n){let r=`${e}:`;for(let[e,i]of t)if(e.startsWith(r)&&gP(i,n)!==null)return!0;return!1},hasPageTranslation(e,n){return t.has(hP(e,n))},getTranslation(e,n,r){let i=hP(e,n);return c(i,t.get(i),r)},lookupIn:c,loadTranslations(e,t,n=`index`){u(hP(e,n),t)},setTranslations(e,t,n=`index`){l(hP(e,n),t)},loadPageTranslations(e,n,r){let i=hP(e,n),a=t.get(i);!a||Object.keys(a).length===0?l(i,{...r}):u(i,r)},mergeTranslation(e,t,n,r=!1){u(hP(e,t),n)},clearCache(){t.clear(),o(),i()}}}var IP=class{constructor(e={}){this.formatter=new jP,this.pinnedCacheKey=``,this.pinnedTree=null,this.pinnedGeneration=-1,this.helper=FP(e.storage);let t={numberFormats:e.numberFormats,datetimeFormats:e.datetimeFormats};this.formatter=new jP(t),this.pluralFunc=e.plural&&e.plural!==OP?(t,n,r,i,a)=>e.plural(t,n,r,i,a)??OP(t,n,r,i,a):OP,this.missingWarn=e.missingWarn??!0,this.missingHandler=e.missingHandler,this.getCustomMissingHandler=e.getCustomMissingHandler}touch(){}resolveRouteName(e){return typeof e==`string`?e:this.getRoute()}ensurePinnedChunk(e,t){let n=hP(e,t),r=this.helper.getGeneration();(this.pinnedCacheKey!==n||this.pinnedGeneration!==r)&&(this.pinnedCacheKey=n,this.pinnedGeneration=r,this.pinnedTree=this.helper.getCache(e,t)??null)}invalidatePin(){this.pinnedCacheKey=``,this.pinnedTree=null,this.pinnedGeneration=-1}resolveLookup(e,t){let n=this.getLocale(),r=this.resolveRouteName(t),i=typeof e==`string`?e:String(e),a=t===void 0||r===this.getRoute(),o;if(a?(this.ensurePinnedChunk(n,r),o=this.helper.lookupIn(this.pinnedCacheKey,this.pinnedTree,i)):o=this.helper.getTranslation(n,r,i),o!==null)return o;let s=this.getFallbackLocale();return n===s?null:this.helper.getTranslation(s,r,i)}resolveHas(e,t){let n=this.getLocale(),r=this.resolveRouteName(t),i=typeof e==`string`?e:String(e);return t===void 0||r===this.getRoute()?(this.ensurePinnedChunk(n,r),this.helper.lookupIn(this.pinnedCacheKey,this.pinnedTree,i)!==null):this.helper.getTranslation(n,r,i)!==null}resolveTranslationTree(e,t){return wP(e,t)}resolveTranslations(e){this.touch();let t=this.getLocale(),n=this.resolveRouteName(e),r=this.helper.getCache(t,n)??{},i=this.getFallbackLocale();if(i===t)return r;let a=this.helper.getCache(i,n);return a?this.resolveTranslationTree(a,r):r}onTranslationsChanged(){}getMissingContext(e){return{locale:this.getLocale(),routeName:this.resolveRouteName(e)}}warnDev(e){this.missingWarn}warnMissing(e,t){let{locale:n,routeName:r}=this.getMissingContext(t),i=this.getCustomMissingHandler?.();if(i){i(n,String(e),r);return}if(this.missingHandler){this.missingHandler(n,String(e),r);return}this.warnDev(`Not found '${e}' key in '${n}' locale messages for route '${r}'.`)}warnMissingFormat(e,t,n){this.warnDev(`Not found '${t}' ${e} format in '${n}' locale. Falling back to default Intl options.`)}t(e,t,n,r){if(!e)return``;if(this.touch(),t===void 0&&n===void 0&&r===void 0&&typeof e==`string`)return this.resolveLookup(e)??(this.warnMissing(e),e);let i=this.resolveLookup(e,r);return i==null?(this.warnMissing(e,r),n===void 0?e:n||e):typeof i!=`string`||!t?i:xP(i,t)}ts(e,t,n,r){return this.t(e,t,n,r)?.toString()??n??e}tc(e,t,n){this.touch();let{count:r,...i}=typeof t==`number`?{count:t}:t;return r===void 0?n??e:this.pluralFunc(e,Number.parseInt(r.toString(),10),i,this.getLocale(),(e,t,n)=>{let r=this.resolveLookup(e);return r==null?n===void 0?void 0:n||e:typeof r!=`string`||!t?r:xP(r,t)})??n??e}tn(e,t,n,r){this.touch();let i=this.resolveNumberFormatArgs(t,n,r);return this.formatter.formatNumber(e,i.locale,i.options)}td(e,t,n,r){this.touch();let i=this.resolveDateTimeFormatArgs(t,n,r);return this.formatter.formatDate(e,i.locale,i.options)}tdr(e,t){return this.touch(),this.formatter.formatRelativeTime(e,this.getLocale(),t)}has(e,t){return this.touch(),this.resolveHas(e,t)}setTranslation(e,t){let n=this.getLocale(),r=this.getRoute(),i=this.helper.getCache(n,r)??{};this.helper.setTranslations(n,CP(i,String(e),t),r),this.invalidatePin(),this.onTranslationsChanged()}clearCache(){this.helper.clearCache(),this.formatter.clearCache(),this.invalidatePin()}resolveNumberFormatArgs(e,t,n){if(typeof e!=`string`)return{locale:this.getLocale(),options:e};let r=this.getLocale(),i;typeof t==`string`?(r=t,i=n):i=t;let a=this.formatter.resolveNumberFormat(r,e);return a||this.warnMissingFormat(`number`,e,r),!a&&!i?{locale:r,options:void 0}:{locale:r,options:a?{...a,...i}:i}}resolveDateTimeFormatArgs(e,t,n){if(typeof e!=`string`)return{locale:this.getLocale(),options:e};let r=this.getLocale(),i;typeof t==`string`?(r=t,i=n):i=t;let a=this.formatter.resolveDateTimeFormat(r,e);return a||this.warnMissingFormat(`datetime`,e,r),!a&&!i?{locale:r,options:void 0}:{locale:r,options:a?{...a,...i}:i}}loadTranslationsCore(e,t,n,r=`index`){n?this.helper.mergeTranslation(e,r,t,!0):this.helper.setTranslations(e,t,r),this.invalidatePin()}loadRouteTranslationsCore(e,t,n,r){r?this.helper.mergeTranslation(e,t,n,!0):this.helper.loadPageTranslations(e,t,n),this.invalidatePin()}extend(e){return Object.assign(this,e)}},LP=Symbol(`i18n`),RP=Symbol(`i18n-locales`),zP=Symbol(`i18n-default-locale`),BP=Symbol(`i18n-router-strategy`),VP=N({name:`I18nGroup`,props:{prefix:{type:String,required:!0},groupClass:{type:String,default:``}},setup(e,{slots:t}){let n=Tr(LP);if(!n)throw Error(`[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.`);let r=(t,r)=>n.t(`${e.prefix}.${t}`,r,void 0,n.getRoute());return()=>ic(`div`,{class:[`i18n-group`,e.groupClass]},t.default?.({prefix:e.prefix,t:r}))}}),HP=N({name:`I18nLink`,props:{to:{type:[String,Object],required:!0},activeStyle:{type:Object,default:()=>({})},localeRoute:{type:Function,default:void 0}},setup(e,{slots:t}){let n=Tr(LP),r=Tr(BP,void 0);if(!n)throw Error(`[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.`);let i=W(()=>typeof e.to==`string`&&/^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(e.to)),a=W(()=>{if(i.value)return e.to;if(e.localeRoute){let t=e.localeRoute(e.to);return typeof t==`string`?t:t.path||`/`}if(!r?.resolvePath)return typeof e.to==`string`?e.to:e.to.path||`/`;let t=r.resolvePath(e.to,n.locale.value);return typeof t==`string`?t:t.path||`/`}),o=W(()=>i.value||!r?!1:r.getCurrentPath().replace(/#.*$/,``).replace(/\/$/,``)===a.value.replace(/#.*$/,``).replace(/\/$/,``)),s=W(()=>o.value?e.activeStyle:{});return()=>i.value?ic(`a`,{href:a.value,target:`_blank`,rel:`noopener noreferrer`,style:s.value},t.default?.()):r?.linkComponent?ic(r.linkComponent,{to:a.value,style:s.value},{default:t.default}):ic(`a`,{href:a.value,style:s.value,onClick:e=>{e.preventDefault(),r?r.push({path:a.value}):window.location.href=a.value}},t.default?.())}}),UP=N({name:`I18nSwitcher`,props:{customLabels:{type:Object,default:()=>({})},customWrapperStyle:{type:Object,default:()=>({})},customButtonStyle:{type:Object,default:()=>({})},customDropdownStyle:{type:Object,default:()=>({})},customItemStyle:{type:Object,default:()=>({})},customLinkStyle:{type:Object,default:()=>({})},customActiveLinkStyle:{type:Object,default:()=>({})},customDisabledLinkStyle:{type:Object,default:()=>({})},customIconStyle:{type:Object,default:()=>({})},locales:{type:Array,default:void 0},currentLocale:{type:[String,Function],default:void 0},getLocaleName:{type:Function,default:void 0},switchLocale:{type:Function,default:void 0},localeRoute:{type:Function,default:void 0}},setup(e,{slots:t}){let n=Tr(LP),r=Tr(BP,void 0),i=Tr(RP,void 0);if(!n)throw Error(`[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.`);if(!i&&!e.locales)throw Error(`[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop.`);let a=W(()=>e.locales||i||[]),o=W(()=>a.value.filter(e=>!e.disabled)),s=W(()=>e.currentLocale===void 0?n.locale.value:typeof e.currentLocale==`function`?e.currentLocale():e.currentLocale),c=W(()=>a.value.some(e=>e.code===s.value&&e.disabled)),l=W(()=>e.getLocaleName?e.getLocaleName()||null:a.value.find(e=>e.code===n.locale.value)?.displayName||null),u=k(!1),d=k(null),f=e=>{e&&(e.stopPropagation(),e.preventDefault()),u.value=!u.value},p=t=>e.customLabels[t.code]||t.displayName||t.code,m=W(()=>{let e=a.value.find(e=>e.code===s.value);return e?p(e):l.value||s.value}),h=async t=>{if(u.value=!1,await ir(),e.switchLocale){e.switchLocale(t);return}if(n.locale.value=t,!r)return;let i=r.getCurrentPath(),a=e.localeRoute?(()=>{let n=e.localeRoute(i,t);return typeof n==`string`?n:n.path||`/`})():r?.resolvePath?(()=>{let e=r.resolvePath(i,t);return typeof e==`string`?e:e.path||`/`})():i;r.push({path:a})},g={position:`relative`,display:`inline-block`,verticalAlign:`middle`},_={padding:`4px 12px`,fontSize:`16px`,cursor:`pointer`,backgroundColor:`#fff`,border:`1px solid #333`,transition:`background-color 0.3s ease`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},v={position:`absolute`,top:`100%`,left:`0`,zIndex:1e3,backgroundColor:`#fff`,border:`1px solid #333`,listStyle:`none`,padding:`0`,margin:`4px 0 0 0`,minWidth:`150px`,boxShadow:`0 2px 8px rgba(0,0,0,0.15)`},y={margin:`0`,padding:`0`},b={display:`block`,padding:`8px 12px`,color:`#333`,textDecoration:`none`,transition:`background-color 0.3s ease`,cursor:`pointer`},x={fontWeight:`bold`,color:`#007bff`,cursor:`not-allowed`},S={marginLeft:`8px`,display:`inline-block`,transition:`transform 0.3s ease`},C={transform:`rotate(180deg)`},w=e=>e?Array.isArray(e)?e:[e]:[],T=e=>{if(!u.value)return;let t=e.target;if(!t||!d.value)return;let n=d.value.contains(t),r=t.closest(`.i18n-switcher-button`)!==null;!n&&!r&&(u.value=!1)};return na(()=>{document.addEventListener(`click`,T)}),oa(()=>{document.removeEventListener(`click`,T)}),()=>{let n=[];t[`before-button`]&&n.push(...w(t[`before-button`]()));let i=[];if(t[`before-selected-locale`]&&i.push(...w(t[`before-selected-locale`]())),i.push(ic(`span`,m.value)),t[`after-selected-locale`]&&i.push(...w(t[`after-selected-locale`]())),i.push(ic(`span`,{style:{...S,...u.value?C:{},...e.customIconStyle}},`▼`)),n.push(ic(`button`,{class:`i18n-switcher-button`,style:{..._,...e.customButtonStyle,...c.value?e.customDisabledLinkStyle:{}},onClick:e=>{e.preventDefault(),e.stopPropagation(),f(e)},type:`button`,ariaHaspopup:!0,ariaExpanded:u.value},i)),t[`before-dropdown`]&&n.push(...w(t[`before-dropdown`]())),u.value){let i=[];t[`before-dropdown-items`]&&i.push(...w(t[`before-dropdown-items`]())),o.value.forEach(n=>{let a=[];t[`before-item`]&&a.push(...w(t[`before-item`]({locale:n})));let o=[];t[`before-link-content`]&&o.push(...w(t[`before-link-content`]({locale:n}))),o.push(p(n)),t[`after-link-content`]&&o.push(...w(t[`after-link-content`]({locale:n})));let c=typeof window<`u`?window.location.pathname:`/`,l=e.localeRoute?e.localeRoute(c,n.code):r?.resolvePath?r.resolvePath(c,n.code):c,u=typeof l==`string`?l:l.path||`#`,d=n.code===s.value;a.push(ic(`a`,{class:`switcher-locale-${n.code}`,href:typeof u==`string`?u:`#`,style:{...b,...d?x:{},...e.customLinkStyle,...d?e.customActiveLinkStyle:{}},onClick:e=>{e.preventDefault(),e.stopPropagation(),h(n.code)}},o)),t[`after-item`]&&a.push(...w(t[`after-item`]({locale:n}))),i.push(ic(`li`,{key:n.code,style:{...y,...e.customItemStyle}},a))}),t[`after-dropdown-items`]&&i.push(...w(t[`after-dropdown-items`]())),n.push(ic(`ul`,{class:`i18n-switcher-dropdown`,style:{...v,...e.customDropdownStyle}},i))}return t[`after-dropdown`]&&n.push(...w(t[`after-dropdown`]())),ic(`div`,{ref:d,class:`i18n-switcher-wrapper`,style:{...g,...e.customWrapperStyle}},n)}}}),WP=N({name:`I18nT`,inheritAttrs:!1,props:{keypath:{type:String,required:!0},plural:{type:[Number,String]},tag:{type:String,default:`span`},params:{type:Object,default:()=>({})},defaultValue:{type:String,default:``},html:{type:Boolean,default:!1},hideIfEmpty:{type:Boolean,default:!1},customPluralRule:{type:Function,default:null},number:{type:[Number,String]},date:{type:[Date,String,Number]},relativeDate:{type:[Date,String,Number]}},setup(e,{slots:t,attrs:n}){let r=Tr(LP);if(!r)throw Error(`[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.`);return()=>{let i={},a=r.getRoute(),o={...n};delete o.innerHTML;let s=t=>e.html?ic(e.tag,{...o,innerHTML:t}):ic(e.tag,o,t);if(e.number!==void 0){let t=Number(e.number),n=r.tn(t),i=r.t(e.keypath,{number:n,...e.params},void 0,a);return s(String(i??``))}if(e.date!==void 0){let t=r.td(e.date),n=r.t(e.keypath,{date:t,...e.params},void 0,a);return s(String(n??``))}if(e.relativeDate!==void 0){let t=r.tdr(e.relativeDate),n=r.t(e.keypath,{relativeDate:t,...e.params},void 0,a);return s(String(n??``))}if(e.plural!==void 0){let t=Number.parseInt(e.plural.toString(),10);return e.customPluralRule?s(e.customPluralRule(e.keypath,t,e.params,r.locale.value,(e,t,n)=>r.t(e,t,n,a))||``):s(r.tc(e.keypath,{count:t,...e.params}))}let c=(r.t(e.keypath,{...e.params,...i},void 0,a)??``).toString();if(e.hideIfEmpty&&!c.trim())return e.defaultValue??null;if(e.html)return s(c);if(t.default)return ic(e.tag,o,t.default({translation:c}));let l=[],u=0;for(let[e,n]of Object.entries(t)){if(e==="default")continue;let t=`{${e}}`,r=c.indexOf(t,u);r!==-1&&(r>u&&l.push(c.slice(u,r)),n&&l.push(ic(n)),u=r+t.length)}return u<c.length&&l.push(c.slice(u)),t.default?ic(e.tag,o,t.default({children:l})):l.length>0?ic(e.tag,o,l):ic(e.tag,o,c)}}}),GP=class extends IP{constructor(e){let t={translations:new Map};if(super({storage:t,plural:e.plural,missingWarn:e.missingWarn,missingHandler:e.missingHandler}),this.listeners=new Set,this.storage=t,this._locale=gn(e.locale),this._fallbackLocale=gn(e.fallbackLocale||e.locale),this._currentRoute=gn(`index`),this._revision=gn(0),e.messages)for(let[t,n]of Object.entries(e.messages))this.helper.loadTranslations(t,n)}get locale(){return this._locale}set locale(e){typeof e==`string`?this._locale.value=e:this._locale=e}get fallbackLocale(){return this._fallbackLocale}set fallbackLocale(e){typeof e==`string`?this._fallbackLocale.value=e:this._fallbackLocale=e}get currentRoute(){return this._currentRoute}setRoute(e){this._currentRoute.value=e}getLocale(){return this._locale.value}getFallbackLocale(){return this._fallbackLocale.value}getRoute(){return this._currentRoute.value}addTranslations(e,t,n=!0){super.loadTranslationsCore(e,t,n),this._revision.value++,this.notifyListeners()}addRouteTranslations(e,t,n,r=!0){super.loadRouteTranslationsCore(e,t,n,r),this._revision.value++,this.notifyListeners()}mergeTranslations(e,t,n){this.helper.mergeTranslation(e,t,n,!0),this._revision.value++,this.notifyListeners()}clearCache(){super.clearCache(),this._revision.value++,this.notifyListeners()}onTranslationsChanged(){this._revision.value++,this.notifyListeners()}subscribeToChanges(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}getStorage(){return this.storage}getRouteCache(){let e={};for(let[t,n]of this.storage.translations)e[t]=n;return e}};function KP(e){let{routingStrategy:t,locales:n,defaultLocale:r,...i}=e,a=new GP(i),o=null,s=t||null;return{global:a,setRoutingStrategy:e=>{s=e,o&&o.provide(BP,e)},install(e){o=e,e.provide(LP,a),s&&e.provide(BP,s),n&&e.provide(RP,n),r&&e.provide(zP,r),e.config.globalProperties.$t=(e,t,n,r)=>a.t(e,t,n,r),e.config.globalProperties.$ts=(e,t,n,r)=>a.ts(e,t,n,r),e.config.globalProperties.$tc=(e,t,n)=>a.tc(e,t,n),e.config.globalProperties.$tn=a.tn.bind(a),e.config.globalProperties.$td=a.td.bind(a),e.config.globalProperties.$tdr=a.tdr.bind(a),e.config.globalProperties.$has=(e,t)=>a.has(e,t),e.config.globalProperties.$i18n=a,e.component(`I18nT`,WP),e.component(`I18nLink`,HP),e.component(`I18nGroup`,VP),e.component(`I18nSwitcher`,UP)}}}var qP=[{code:`en`,iso:`en-US`,name:`English`},{code:`vi`,iso:`vi-VN`,name:`Tiếng Việt`},{code:`zh-CN`,iso:`zh-CN`,name:`简体中文`},{code:`ja`,iso:`ja-JP`,name:`日本語`},{code:`es`,iso:`es-ES`,name:`Español`},{code:`ko`,iso:`ko-KR`,name:`한국어`},{code:`ru`,iso:`ru-RU`,name:`Русский`},{code:`fr`,iso:`fr-FR`,name:`Français`},{code:`de`,iso:`de-DE`,name:`Deutsch`}],JP=`hh.locale`,YP=new Map(qP.map(e=>[e.code,e]));function XP(e){return YP.get(e)}function ZP(e){return YP.has(e)}function QP(e){if(e.length===0)return null;let t=e.toLowerCase(),n=qP.find(e=>e.code.toLowerCase()===t);if(n!==void 0)return n.code;let r=t.split(`-`)[0];return qP.find(e=>e.code.toLowerCase()===r||e.code.toLowerCase().split(`-`)[0]===r)?.code??null}function $P(e,t,n){return e.replace(/\{(\w+)\}/g,(e,r)=>{if(r===`count`)return String(n);let i=t[r];return i===void 0?e:String(i)})}var eF=new Map,tF=(e,t,n,r,i)=>{let a=i(e);if(a==null)return null;if(typeof a==`string`)return $P(a.split(`|`)[0].trim(),n??{},t);let o=eF.get(r);o===void 0&&(o=new Intl.PluralRules(r),eF.set(r,o));let s=a[o.select(t)]??a.other;return typeof s==`string`?$P(s,n??{},t):null},nF=`modulepreload`,rF=function(e){return`/`+e},iF={},aF=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=rF(t,n),t=s(t),t in iF)return;iF[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:nF,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},oF=Object.assign({"../../i18n/generated/en.json":fP}),sF=Object.assign({"../../i18n/generated/de.json":()=>aF(()=>import(`./de-DQxDtYp2.js`),[]),"../../i18n/generated/es.json":()=>aF(()=>import(`./es-BP0qzCTU.js`),[]),"../../i18n/generated/fr.json":()=>aF(()=>import(`./fr-DHCvxiys.js`),[]),"../../i18n/generated/ja.json":()=>aF(()=>import(`./ja-DseIeS1D.js`),[]),"../../i18n/generated/ko.json":()=>aF(()=>import(`./ko-Dcu2b6c2.js`),[]),"../../i18n/generated/ru.json":()=>aF(()=>import(`./ru-DaAAVw09.js`),[]),"../../i18n/generated/vi.json":()=>aF(()=>import(`./vi-D780h-t9.js`),[]),"../../i18n/generated/zh-CN.json":()=>aF(()=>import(`./zh-CN-C8OC-N1b.js`),[])}),cF=KP({locale:`en`,fallbackLocale:`en`,defaultLocale:`en`,plural:tF,missingWarn:!1,messages:{en:Object.values(oF)[0]?.default??{}},locales:qP.map(e=>({...e}))}),lF=new Set([`en`]),uF=new Map;function dF(){try{let e=localStorage.getItem(JP);if(e!==null&&ZP(e))return e}catch{}return null}function fF(){let e=typeof navigator>`u`?[]:[...navigator.languages??[],navigator.language].filter(e=>typeof e==`string`);for(let t of e){let e=QP(t);if(e!==null)return e}return`en`}async function pF(e){if(lF.has(e))return;let t=uF.get(e);if(t!==void 0)return t;let n=sF[`../../i18n/generated/${e}.json`];if(n===void 0)return;let r=n().then(t=>{cF.global.addTranslations(e,t.default,!0),lF.add(e)}).finally(()=>uF.delete(e));return uF.set(e,r),r}function mF(e){typeof document<`u`&&(document.documentElement.lang=XP(e)?.iso??e)}async function hF(e){if(ZP(e)&&e!==cF.global.locale.value){try{await pF(e)}catch{return}cF.global.locale.value=e,mF(e);try{localStorage.setItem(JP,e)}catch{}}}async function gF(){let e=dF()??fF();try{await pF(e)}catch{mF(`en`);return}e!==`en`&&(cF.global.locale.value=e),mF(e)}function Y(e,t,n){let r=cF.global.t(e,t,n??null);return typeof r==`string`?r:String(r??``)}function _F(e,t,n){let r={...n,count:t},i=cF.global.resolveTranslations()[e];return i===void 0?Y(e,r,e):tF(e,t,r,vF(),()=>i)??Y(e,r,e)}function vF(){return cF.global.locale.value}function yF(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=yF(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function bF(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=yF(e))&&(r&&(r+=` `),r+=t);return r}var xF=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},SF=(e,t)=>({classGroupId:e,validator:t}),CF=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),wF=`-`,TF=[],EF=`arbitrary..`,DF=e=>{let t=AF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return kF(e);let n=e.split(wF);return OF(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?xF(i,t):t:i||TF}return n[e]||TF}}},OF=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=OF(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(wF):e.slice(t).join(wF),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},kF=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?EF+r:void 0})(),AF=e=>{let{theme:t,classGroups:n}=e;return jF(n,t)},jF=(e,t)=>{let n=CF();for(let r in e){let i=e[r];MF(i,n,r,t)}return n},MF=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];NF(i,t,n,r)}},NF=(e,t,n,r)=>{if(typeof e==`string`){PF(e,t,n);return}if(typeof e==`function`){FF(e,t,n,r);return}IF(e,t,n,r)},PF=(e,t,n)=>{let r=e===``?t:LF(t,e);r.classGroupId=n},FF=(e,t,n,r)=>{if(RF(e)){MF(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(SF(n,e))},IF=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];MF(o,LF(t,a),n,r)}},LF=(e,t)=>{let n=e,r=t.split(wF),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=CF(),n.nextPart.set(t,i)),n=i}return n},RF=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,zF=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},BF=`!`,VF=`:`,HF=[],UF=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),WF=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===VF){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(BF)?(c=s.slice(0,-1),l=!0):s.startsWith(BF)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return UF(t,l,c,u)};if(t){let e=t+VF,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):UF(HF,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},GF=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},KF=e=>({cache:zF(e.cacheSize),parseClassName:WF(e),sortModifiers:GF(e),postfixLookupClassGroupIds:qF(e),...DF(e)}),qF=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},JF=/\s+/,YF=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(JF),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+BF:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},XF=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=ZF(n))&&(i&&(i+=` `),i+=r);return i},ZF=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=ZF(e[r]))&&(n&&(n+=` `),n+=t);return n},QF=(e,...t)=>{let n,r,i,a,o=o=>(n=KF(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=YF(e,n);return i(e,a),a};return a=o,(...e)=>a(XF(...e))},$F=[],eI=e=>{let t=t=>t[e]||$F;return t.isThemeGetter=!0,t.themeKey=e,t},tI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,iI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,oI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,sI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,lI=e=>rI.test(e),uI=e=>!!e&&!Number.isNaN(Number(e)),dI=e=>!!e&&Number.isInteger(Number(e)),fI=e=>e.endsWith(`%`)&&uI(e.slice(0,-1)),pI=e=>iI.test(e),mI=()=>!0,hI=e=>aI.test(e)&&!oI.test(e),gI=()=>!1,_I=e=>sI.test(e),vI=e=>cI.test(e),yI=e=>!X(e)&&!Z(e),bI=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),xI=e=>II(e,BI,gI),X=e=>tI.test(e),SI=e=>II(e,VI,hI),CI=e=>II(e,HI,uI),wI=e=>II(e,WI,mI),TI=e=>II(e,UI,gI),EI=e=>II(e,RI,gI),DI=e=>II(e,zI,vI),OI=e=>II(e,GI,_I),Z=e=>nI.test(e),kI=e=>LI(e,VI),AI=e=>LI(e,UI),jI=e=>LI(e,RI),MI=e=>LI(e,BI),NI=e=>LI(e,zI),PI=e=>LI(e,GI,!0),FI=e=>LI(e,WI,!0),II=(e,t,n)=>{let r=tI.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},LI=(e,t,n=!1)=>{let r=nI.exec(e);return r?r[1]?t(r[1]):n:!1},RI=e=>e===`position`||e===`percentage`,zI=e=>e===`image`||e===`url`,BI=e=>e===`length`||e===`size`||e===`bg-size`,VI=e=>e===`length`,HI=e=>e===`number`,UI=e=>e===`family-name`,WI=e=>e===`number`||e===`weight`,GI=e=>e===`shadow`,KI=QF(()=>{let e=eI(`color`),t=eI(`font`),n=eI(`text`),r=eI(`font-weight`),i=eI(`tracking`),a=eI(`leading`),o=eI(`breakpoint`),s=eI(`container`),c=eI(`spacing`),l=eI(`radius`),u=eI(`shadow`),d=eI(`inset-shadow`),f=eI(`text-shadow`),p=eI(`drop-shadow`),m=eI(`blur`),h=eI(`perspective`),g=eI(`aspect`),_=eI(`ease`),v=eI(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[lI,`full`,`auto`,...w()],ee=()=>[dI,`none`,`subgrid`,Z,X],te=()=>[`auto`,{span:[`full`,dI,Z,X]},dI,Z,X],ne=()=>[dI,`auto`,Z,X],re=()=>[`auto`,`min`,`max`,`fr`,Z,X],ie=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ae=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],oe=()=>[`auto`,...w()],se=()=>[lI,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ce=()=>[s,lI,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],le=()=>[lI,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],E=()=>[e,Z,X],ue=()=>[...b(),jI,EI,{position:[Z,X]}],de=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],fe=()=>[`auto`,`cover`,`contain`,MI,xI,{size:[Z,X]}],pe=()=>[fI,kI,SI],me=()=>[``,`none`,`full`,l,Z,X],he=()=>[``,uI,kI,SI],ge=()=>[`solid`,`dashed`,`dotted`,`double`],_e=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ve=()=>[uI,fI,jI,EI],ye=()=>[``,`none`,m,Z,X],be=()=>[`none`,uI,Z,X],xe=()=>[`none`,uI,Z,X],D=()=>[uI,Z,X],Se=()=>[lI,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[pI],breakpoint:[pI],color:[mI],container:[pI],"drop-shadow":[pI],ease:[`in`,`out`,`in-out`],font:[yI],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[pI],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[pI],shadow:[pI],spacing:[`px`,uI],text:[pI],"text-shadow":[pI],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,lI,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[bI],columns:[{columns:[uI,`auto`,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[dI,`auto`,Z,X]}],basis:[{basis:[lI,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[uI,lI,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,uI,Z,X]}],shrink:[{shrink:[``,uI,Z,X]}],order:[{order:[dI,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ie(),`normal`]}],"justify-items":[{"justify-items":[...ae(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ae()]}],"align-content":[{content:[`normal`,...ie()]}],"align-items":[{items:[...ae(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ae(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ie()}],"place-items":[{"place-items":[...ae(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ae()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:oe()}],mx:[{mx:oe()}],my:[{my:oe()}],ms:[{ms:oe()}],me:[{me:oe()}],mbs:[{mbs:oe()}],mbe:[{mbe:oe()}],mt:[{mt:oe()}],mr:[{mr:oe()}],mb:[{mb:oe()}],ml:[{ml:oe()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:se()}],"inline-size":[{inline:[`auto`,...ce()]}],"min-inline-size":[{"min-inline":[`auto`,...ce()]}],"max-inline-size":[{"max-inline":[`none`,...ce()]}],"block-size":[{block:[`auto`,...le()]}],"min-block-size":[{"min-block":[`auto`,...le()]}],"max-block-size":[{"max-block":[`none`,...le()]}],w:[{w:[s,`screen`,...se()]}],"min-w":[{"min-w":[s,`screen`,`none`,...se()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...se()]}],h:[{h:[`screen`,`lh`,...se()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...se()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...se()]}],"font-size":[{text:[`base`,n,kI,SI]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,FI,wI]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,fI,X]}],"font-family":[{font:[AI,TI,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[uI,`none`,Z,CI]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ge(),`wavy`]}],"text-decoration-thickness":[{decoration:[uI,`from-font`,`auto`,Z,SI]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[uI,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[dI,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:de()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},dI,Z,X],radial:[``,Z,X],conic:[``,dI,Z,X]},NI,DI]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:me()}],"rounded-s":[{"rounded-s":me()}],"rounded-e":[{"rounded-e":me()}],"rounded-t":[{"rounded-t":me()}],"rounded-r":[{"rounded-r":me()}],"rounded-b":[{"rounded-b":me()}],"rounded-l":[{"rounded-l":me()}],"rounded-ss":[{"rounded-ss":me()}],"rounded-se":[{"rounded-se":me()}],"rounded-ee":[{"rounded-ee":me()}],"rounded-es":[{"rounded-es":me()}],"rounded-tl":[{"rounded-tl":me()}],"rounded-tr":[{"rounded-tr":me()}],"rounded-br":[{"rounded-br":me()}],"rounded-bl":[{"rounded-bl":me()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":he()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ge(),`hidden`,`none`]}],"divide-style":[{divide:[...ge(),`hidden`,`none`]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...ge(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[uI,Z,X]}],"outline-w":[{outline:[``,uI,kI,SI]}],"outline-color":[{outline:E()}],shadow:[{shadow:[``,`inner`,`none`,u,PI,OI]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":[`none`,d,PI,OI]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:he()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[uI,SI]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":[`none`,f,PI,OI]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[uI,Z,X]}],"mix-blend":[{"mix-blend":[..._e(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":_e()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[uI]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[uI]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:de()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ye()}],brightness:[{brightness:[uI,Z,X]}],contrast:[{contrast:[uI,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,PI,OI]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:[``,uI,Z,X]}],"hue-rotate":[{"hue-rotate":[uI,Z,X]}],invert:[{invert:[``,uI,Z,X]}],saturate:[{saturate:[uI,Z,X]}],sepia:[{sepia:[``,uI,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[uI,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[uI,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,uI,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[uI,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,uI,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[uI,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[uI,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,uI,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[uI,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[uI,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":[`scale-3d`],skew:[{skew:D()}],"skew-x":[{"skew-x":D()}],"skew-y":[{"skew-y":D()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":[`translate-none`],zoom:[{zoom:[dI,Z,X]}],accent:[{accent:E()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...E()]}],"stroke-w":[{stroke:[uI,kI,SI,CI]}],stroke:[{stroke:[`none`,...E()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return KI(bF(e))}var qI={stopped:{labelKey:`status.stopped`,tone:`neutral`,transitional:!1},starting:{labelKey:`status.starting`,tone:`warn`,transitional:!0},running:{labelKey:`status.running`,tone:`ok`,transitional:!1},stopping:{labelKey:`status.stopping`,tone:`warn`,transitional:!0},backoff:{labelKey:`status.backoff`,tone:`warn`,transitional:!0},crashed:{labelKey:`status.crashed`,tone:`danger`,transitional:!1},conflict:{labelKey:`status.conflict`,tone:`danger`,transitional:!1}},JI={disabled:{labelKey:`health.disabled`,tone:`neutral`},unknown:{labelKey:`health.unknown`,tone:`neutral`},healthy:{labelKey:`health.healthy`,tone:`ok`},unhealthy:{labelKey:`health.unhealthy`,tone:`danger`}},YI={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},XI={ok:`bg-ok-soft text-ok border-ok/25`,warn:`bg-warn-soft text-warn border-warn/25`,danger:`bg-danger-soft text-danger border-danger/25`,info:`bg-info-soft text-info border-info/25`,neutral:`bg-hover text-muted border-line`,accent:`bg-accent-soft text-accent border-accent/25`},ZI={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,info:`bg-info`,neutral:`bg-faint`,accent:`bg-accent`};function QI(e,t){return e===`crashed`||e===`conflict`||t===`unhealthy`?`danger`:e===`starting`||e===`stopping`||e===`backoff`?`warn`:e===`running`?`ok`:`neutral`}var $I={start:`history.start`,exit:`history.exit`,crash:`history.crash`,"forced-restart":`history.forcedRestart`,unhealthy:`history.unhealthy`,recovered:`history.recovered`},eL={start:`ok`,exit:`neutral`,crash:`danger`,"forced-restart":`warn`,unhealthy:`warn`,recovered:`info`},tL={viewBox:`0 0 80 80`,class:`size-full -rotate-0`},nL=[`stroke-dasharray`],rL=[`stroke-dasharray`],iL={class:`absolute inset-0 grid place-items-center`},aL={class:`font-mono text-sm font-semibold tabular-nums text-ink`},oL={class:`text-2xs font-medium text-faint`},sL=34,cL=.75,lL=N({__name:`Gauge`,props:{value:{},label:{},display:{default:void 0},size:{default:74},tone:{default:void 0},warnAt:{default:75},dangerAt:{default:90}},setup(e){let t=e,n=2*Math.PI*sL,r=W(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(1,Math.max(0,t.value/100))*cL),i=W(()=>t.tone?t.tone:t.value===null||!Number.isFinite(t.value)?`neutral`:t.value>=t.dangerAt?`danger`:t.value>=t.warnAt?`warn`:`ok`),a={ok:`stroke-ok`,warn:`stroke-warn`,danger:`stroke-danger`,info:`stroke-info`,neutral:`stroke-faint`,accent:`stroke-accent`};return(e,o)=>(L(),R(`div`,{class:D(A(Q)(`flex flex-col items-center gap-1`))},[B(`div`,{class:`relative`,style:_e({width:`${t.size}px`,height:`${t.size}px`})},[(L(),R(`svg`,tL,[B(`circle`,{cx:`40`,cy:`40`,r:sL,fill:`none`,class:`stroke-line-soft`,"stroke-width":6,"stroke-dasharray":`${cL*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,8,nL),B(`circle`,{cx:`40`,cy:`40`,r:sL,fill:`none`,class:D([a[i.value],`transition-[stroke-dasharray] duration-300 ease-out`]),"stroke-width":6,"stroke-dasharray":`${r.value*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,10,rL)])),B(`div`,iL,[B(`span`,aL,O(t.display??(t.value===null?`—`:`${Math.round(t.value)}%`)),1)])],4),B(`span`,oL,O(t.label),1)],2))}}),uL=N({__name:`Meter`,props:{value:{},warnAt:{default:75},dangerAt:{default:90},height:{default:`h-1.5`},class:{default:void 0}},setup(e){let t=e,n=W(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(100,Math.max(0,t.value))),r=W(()=>t.value===null?`neutral`:t.value>=t.dangerAt?`danger`:t.value>=t.warnAt?`warn`:`ok`),i={ok:`bg-ok/80`,warn:`bg-warn/85`,danger:`bg-danger/85`,info:`bg-info/80`,neutral:`bg-faint/60`,accent:`bg-accent/80`};return(e,a)=>(L(),R(`div`,{class:D(A(Q)(`w-full overflow-hidden rounded-full bg-line-soft`,t.height,t.class))},[B(`div`,{class:D(A(Q)(`h-full rounded-full transition-[width] duration-300 ease-out`,i[r.value])),style:_e({width:`${n.value}%`})},null,6)],2))}}),dL={key:0,class:`grid size-10 place-items-center rounded-full border border-line bg-panel-2 text-faint`},fL={class:`max-w-sm space-y-1`},pL={class:`text-sm font-medium text-ink`},mL={key:0,class:`text-xs leading-relaxed text-muted`},hL={key:1,class:`flex items-center gap-2`},gL=N({__name:`EmptyState`,props:{title:{},description:{default:void 0},compact:{type:Boolean,default:!1}},setup(e){return(e,t)=>(L(),R(`div`,{class:D(A(Q)(`flex flex-col items-center justify-center gap-3 text-center`,e.$props.compact?`px-4 py-8`:`px-6 py-14`))},[e.$slots.icon?(L(),R(`div`,dL,[F(e.$slots,`icon`)])):U(``,!0),B(`div`,fL,[B(`p`,pL,O(e.$props.title),1),e.$props.description?(L(),R(`p`,mL,O(e.$props.description),1)):U(``,!0)]),e.$slots.action?(L(),R(`div`,hL,[F(e.$slots,`action`)])):U(``,!0)],2))}});function _L(e){return e===null||!Number.isFinite(e)?`—`:`${(e*100).toFixed(e>=.999?0:1)}%`}var vL={span:(e,t,n)=>n===null?`${e}${t}`:`${e}${t} ${n.value}${n.unit}`,now:()=>`now`,ahead:(e,t)=>`in ${e}${t}`,ago:(e,t)=>`${e}${t} ago`,never:()=>`never`};function yL(e,t=vL){if(!Number.isFinite(e)||e<0)return`—`;let n=Math.floor(e/1e3);if(n<60)return t.span(n,`s`,null);let r=Math.floor(n/60);if(r<60)return t.span(r,`m`,{value:n%60,unit:`s`});let i=Math.floor(r/60);return i<24?t.span(i,`h`,{value:r%60,unit:`m`}):t.span(Math.floor(i/24),`d`,{value:i%24,unit:`h`})}function bL(e,t,n=vL){let r=Math.max(0,e-t);return r<1e3?n.now():r<6e4?n.ahead(Math.ceil(r/1e3),`s`):n.ahead(Math.ceil(r/6e4),`m`)}function xL(e,t,n=vL){if(e===null)return n.never();let r=Math.max(0,t-e);return r<6e4?n.ago(Math.floor(r/1e3),`s`):r<36e5?n.ago(Math.floor(r/6e4),`m`):r<864e5?n.ago(Math.floor(r/36e5),`h`):n.ago(Math.floor(r/864e5),`d`)}function SL(){return XP(vF())?.iso}var CL=new Map,wL=new Map,TL={s:`s`,m:`m`,h:`h`,d:`d`};function EL(){return vF()===`en`}function DL(){let e=SL(),t=EL()?`narrow`:`short`,n=`${e??``}:${t}`,r=CL.get(n);return r===void 0&&(r=new Intl.RelativeTimeFormat(e,{numeric:`always`,style:t}),CL.set(n,r)),r}function OL(e,t){if(EL())return`${e}${TL[t]}`;let n={s:`second`,m:`minute`,h:`hour`,d:`day`},r=SL(),i=`${r??``}:${t}`,a=wL.get(i);return a===void 0&&(a=new Intl.NumberFormat(r,{style:`unit`,unit:n[t],unitDisplay:`short`}),wL.set(i,a)),a.format(e)}function kL(e,t,n){return DL().format(n*e,{s:`second`,m:`minute`,h:`hour`,d:`day`}[t])}var AL={span:(e,t,n)=>n===null?OL(e,t):`${OL(e,t)} ${OL(n.value,n.unit)}`,now:()=>Y(`common.now`),ahead:(e,t)=>kL(e,t,1),ago:(e,t)=>kL(e,t,-1),never:()=>Y(`common.never`)};function jL(e){return yL(e,AL)}function ML(e,t){return bL(e,t,AL)}function NL(e,t){return xL(e,t,AL)}function PL(e){let t=new Date(e);return`${t.toLocaleTimeString(SL(),{hour12:!1})}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function FL(e){return new Date(e).toLocaleString(SL(),{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function IL(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`:`—`}function LL(e){if(e===null||!Number.isFinite(e))return`—`;let t=Math.abs(e);return t<1e3?`${e} B`:t<1e6?`${(e/1e3).toFixed(0)} kB`:t<1e9?`${(e/1e3/1e3).toFixed(1)} MB`:`${(e/1e3/1e3/1e3).toFixed(2)} GB`}function RL(e){return e===null||!Number.isFinite(e)?`—`:e>=100?`${Math.round(e)}%`:`${e.toFixed(1)}%`}function zL(e){return e===void 0?Y(`common.unset`):typeof e==`string`?e:JSON.stringify(e)}var BL={key:1,class:`space-y-4`},VL={class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},HL={class:`grid grid-cols-2 gap-x-4 gap-y-2 border-t border-line-soft pt-3 sm:grid-cols-4`},UL={class:`flex items-center gap-1 text-2xs text-faint`},WL={class:`font-mono text-xs text-ink`},GL={class:`text-2xs text-faint`},KL={class:`font-mono text-xs tabular-nums text-ink`},qL={class:`flex items-center gap-1 text-2xs text-faint`},JL={class:`font-mono text-xs text-ink`},YL={class:`flex items-center gap-1 text-2xs text-faint`},XL={class:`font-mono text-xs text-ink`},ZL={class:`space-y-2 border-t border-line-soft pt-3`},QL={class:`flex items-center gap-1.5 text-2xs font-medium text-faint`},$L={class:`flex items-baseline justify-between gap-2`},eR=[`title`],tR={class:`shrink-0 font-mono text-2xs tabular-nums text-faint`},nR={key:0,class:`space-y-1 rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2`},rR={class:`text-2xs font-medium text-danger`},iR=N({__name:`HostVitalsPanel`,props:{host:{},now:{}},setup(e){let t=e,n=W(()=>{let e=t.host;return e?(e.loadAvg[0]??0)/Math.max(1,e.cpus):null}),r=W(()=>t.host?.loadAvg.map(e=>e.toFixed(2)).join(` `)??`—`);return(e,i)=>!t.host||!t.host.enabled?(L(),z(gL,{key:0,compact:``,title:A(Y)(`host.samplingOff`),description:A(Y)(`host.samplingOffDescription`)},null,8,[`title`,`description`])):(L(),R(`div`,BL,[B(`div`,VL,[V(lL,{value:n.value===null?null:n.value/2*100,label:A(Y)(`host.loadPerCpu`),display:n.value===null?`—`:n.value.toFixed(2),size:72,"warn-at":70,"danger-at":100},null,8,[`value`,`label`,`display`]),V(lL,{value:t.host.memoryUsedPercent,label:A(Y)(`common.memory`),size:72},null,8,[`value`,`label`]),V(lL,{value:t.host.swapUsedPercent,label:A(Y)(`host.swap`),size:72,"warn-at":50},null,8,[`value`,`label`]),V(lL,{value:t.host.tempCelsius===null?null:t.host.tempCelsius/85*100,label:A(Y)(`host.cpuTemp`),display:t.host.tempCelsius===null?`n/a`:`${Math.round(t.host.tempCelsius)}°C`,size:72},null,8,[`value`,`label`,`display`])]),B(`dl`,HL,[B(`div`,null,[B(`dt`,UL,[V(A(Jv),{class:`size-3`}),H(O(A(Y)(`host.cpus`)),1)]),B(`dd`,WL,O(t.host.cpus),1)]),B(`div`,null,[B(`dt`,GL,O(A(Y)(`host.loadAverage`)),1),B(`dd`,KL,O(r.value),1)]),B(`div`,null,[B(`dt`,qL,[V(A(dy),{class:`size-3`}),H(O(A(Y)(`host.memoryUsed`)),1)]),B(`dd`,JL,O(t.host.memoryUsedPercent.toFixed(0))+`% `,1)]),B(`div`,null,[B(`dt`,YL,[V(A(Py),{class:`size-3`}),H(O(A(Y)(`host.sampled`)),1)]),B(`dd`,XL,O(A(NL)(t.host.sampledAt,t.now)),1)])]),B(`div`,ZL,[B(`p`,QL,[V(A(ny),{class:`size-3`}),H(O(A(Y)(`host.filesystems`)),1)]),(L(!0),R(I,null,P(t.host.disks,e=>(L(),R(`div`,{key:e.path,class:`space-y-1`},[B(`div`,$L,[B(`span`,{class:`truncate font-mono text-2xs text-muted`,title:e.path},O(e.path),9,eR),B(`span`,tR,O(A(IL)(e.totalBytes-e.freeBytes))+` / `+O(A(IL)(e.totalBytes))+` · `+O(e.usedPercent.toFixed(0))+`% `,1)]),V(uL,{value:e.usedPercent},null,8,[`value`])]))),128))]),t.host.alerts.length>0?(L(),R(`div`,nR,[B(`p`,rR,O(A(Y)(`host.thresholdsBreached`)),1),(L(!0),R(I,null,P(t.host.alerts,e=>(L(),R(`p`,{key:e,class:`text-2xs text-danger`},O(e),1))),128))])):U(``,!0)]))}}),aR={key:1,class:`flex flex-col`},oR={class:`min-w-0 flex-1`},sR={class:`flex items-baseline gap-1.5`},cR={class:`truncate text-xs font-medium text-ink`},lR=[`title`],uR={key:0,class:`text-muted`},dR={class:`shrink-0 pt-0.5 text-2xs text-faint`},fR=N({__name:`ActivityFeed`,props:{servers:{},now:{},limit:{default:12},serverId:{default:void 0}},setup(e){let t=e,n={start:_y,exit:jy,crash:Vv,"forced-restart":Sy,unhealthy:Ly,recovered:Hv},r=W(()=>{let e=[];for(let n of t.servers)if(t.serverId===void 0||n.id===t.serverId)for(let t of n.history.events)e.push({...t,label:n.config.label??n.id});return e.sort((e,t)=>t.ts-e.ts).slice(0,t.limit)});return(e,i)=>{let a=pa(`RouterLink`);return r.value.length===0?(L(),z(gL,{key:0,compact:``,title:A(Y)(`activity.emptyTitle`),description:A(Y)(`activity.emptyDescription`)},null,8,[`title`,`description`])):(L(),R(`ol`,aR,[(L(!0),R(I,null,P(r.value,(e,r)=>(L(),R(`li`,{key:`${e.serverId}-${e.ts}-${r}`,class:D([`flex items-start gap-2.5 border-line-soft py-2`,r>0&&`border-t`])},[(L(),z(ha(n[e.type]),{class:D(A(Q)(`mt-0.5 size-3.5 shrink-0`,A(YI)[A(eL)[e.type]]))},null,8,[`class`])),B(`div`,oR,[B(`p`,sR,[B(`span`,cR,O(A(Y)(A($I)[e.type])),1),V(a,{to:`/servers/${e.serverId}`,class:`truncate text-2xs text-muted hover:text-accent`},{default:j(()=>[H(O(e.label),1)]),_:2},1032,[`to`])]),B(`p`,{class:`mt-0.5 truncate font-mono text-2xs text-faint`,title:e.detail},[H(O(e.detail)+` `,1),e.runtimeMs===void 0?U(``,!0):(L(),R(`span`,uR,` · `+O(A(Y)(`activity.ran`,{duration:A(jL)(e.runtimeMs)})),1))],8,lR)]),B(`span`,dR,O(A(NL)(e.ts,t.now)),1)],2))),128))]))}}}),pR=[`restart`,`health`,`stop`];function mR(e,t){return JSON.stringify(hR(e))===JSON.stringify(hR(t))}function hR(e){if(Array.isArray(e))return e.map(hR);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!=null&&(t[n]=hR(r))}return t}return e??null}function gR(e,t,n=[]){let r={};for(let[i,a]of Object.entries(t)){if(n.includes(i)){let t=e[i]??{},n={};for(let[e,r]of Object.entries(a??{}))mR(t[e],r)||(n[e]=r);Object.keys(n).length>0&&(r[i]=n);continue}mR(e[i],a)||(r[i]=a)}return r}function _R(e,t){let n=e;return gR({...n,label:n.label??``},t,pR)}function vR(e,t=``){return typeof e!=`object`||!e||Array.isArray(e)?[{path:t,value:e}]:Object.entries(e).flatMap(([e,n])=>vR(n,t.length===0?e:`${t}.${e}`))}function yR(e,t){let n=new Map(vR(t).map(e=>[e.path,e.value]));return vR(e).map(e=>({path:e.path,from:n.get(e.path),to:e.value}))}function bR(e){let t=0;for(let n of Object.values(e))t+=typeof n==`object`&&n&&!Array.isArray(n)?bR(n):1;return t}async function xR(e,t=8e3){let n=Date.now()+t;for(;;){try{if((await fetch(`${e}/api/auth/session`,{cache:`no-store`})).ok)return!0}catch{}if(Date.now()>n)return!1;await new Promise(e=>setTimeout(e,250))}}var SR={enabled:!0,maxRetries:3,baseDelayMs:1e3,factor:2,maxDelayMs:3e4,resetAfterMs:6e4},CR={enabled:!0,mode:`port`,http:{path:`/`,method:`GET`,expectStatusBelow:400,expectBody:``},intervalMs:5e3,timeoutMs:1500,unhealthyThreshold:3,forceRestartAfterMs:0,startTimeoutMs:2e4},wR={signal:`SIGTERM`,killGroup:!0,graceMs:5e3,killPortHolders:!1};function TR(e){return{...e,http:{...e.http}}}function ER(){return{control:{label:`home-hosted`,port:3999,host:`local`,openBrowser:!1,tlsEnabled:!1},auth:{enabled:!1,sessionTtlMs:6048e5,cookieSecure:`auto`,trustProxy:`off`,maxLoginAttempts:5,lockoutMs:6e4},host:{enabled:!0,intervalMs:15e3,diskPaths:`.`,diskUsedPercent:90,memoryUsedPercent:90,swapUsedPercent:50,loadPerCpu:2,tempCelsius:85},backups:{enabled:!0,keep:5,includePaths:``}}}function DR(){return{defaults:{enabled:!0,autostart:!1,bind:`local`,onPortConflict:`block`,logBufferLines:500,restart:{...SR},health:TR(CR),stop:{...wR}},logs:{persist:!0,maxBytes:2e6,keep:3},telegram:{enabled:!1,chatId:``,cooldownMs:12e4,onCrash:!0,onUnhealthy:!0,onForcedRestart:!0,onRecovered:!1,onHost:!0,onDdns:!0}}}function OR(e){return e===`loopback`?`loopback`:e===`any`||e===!0}function kR(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:OR(e.trustProxy),maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function AR(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:e.trustProxy===`loopback`?`loopback`:e.trustProxy?`any`:`off`,maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function jR(e){return{label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,tlsEnabled:e.tls.enabled}}function MR(e){return{enabled:e.enabled,chatId:e.chatId,cooldownMs:e.cooldownMs,onCrash:e.onCrash,onUnhealthy:e.onUnhealthy,onForcedRestart:e.onForcedRestart,onRecovered:e.onRecovered,onHost:e.onHost,onDdns:e.onDdns??!0}}function NR(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function PR(e){return{enabled:e.enabled,intervalMs:e.intervalMs,diskPaths:e.diskPaths.join(`, `),diskUsedPercent:e.diskUsedPercent,memoryUsedPercent:e.memoryUsedPercent,swapUsedPercent:e.swapUsedPercent,loadPerCpu:e.loadPerCpu,tempCelsius:e.tempCelsius}}function FR(e){return{enabled:e.enabled,keep:e.keep,includePaths:e.includePaths.join(`, `)}}function IR(e,t){return gR(e,{...t,diskPaths:NR(t.diskPaths)})}function LR(e,t){return gR(e,{...t,includePaths:NR(t.includePaths)})}function RR(e,t){return gR({label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,auth:kR(e.auth),tls:{enabled:e.tls.enabled}},{label:t.control.label,port:t.control.port,host:t.control.host,openBrowser:t.control.openBrowser,auth:{...t.auth,trustProxy:OR(t.auth.trustProxy)},tls:{enabled:t.control.tlsEnabled}},[`auth`,`tls`])}function zR(e,t){return gR(e,t,[`restart`,`health`,`stop`])}function BR(e,t){return gR(e,t)}function VR(e,t){return gR({telegram:MR(e)},{telegram:{...t}},[`telegram`])}function HR(e,t){switch(t){case`control`:return{...e.control,auth:{...e.auth}};case`host`:return{...e.host};case`backups`:return{...e.backups}}}function UR(e,t){return t===`auth`?{...e.auth}:t===`tls`?e.control.tlsEnabled:{label:e.control.label,port:e.control.port,host:e.control.host,openBrowser:e.control.openBrowser}}function WR(e,t,n){return t!==void 0&&qR(t[n],UR(e,n))}function GR(e,t,n){t.control={...t.control??{},[n]:UR(e,n)}}function KR(e,t){switch(t){case`defaults`:return{...e.defaults,restart:{...e.defaults.restart},health:TR(e.defaults.health),stop:{...e.defaults.stop}};case`logs`:return{...e.logs};case`telegram`:return{...e.telegram}}}function qR(e,t){return e!==void 0&&JSON.stringify(e)!==JSON.stringify(t)}function JR(e,t){return e.label!==t.control.label||e.port!==t.control.port||e.host!==t.control.host||e.openBrowser!==t.control.openBrowser}function YR(e,t){return e.tls.enabled!==t.control.tlsEnabled}function XR(e,t){return bR(gR({...AR(e.auth)},{...t.auth}))>0}function ZR(e,t,n){return W({get:e,set:e=>{t(e===null||Number.isNaN(e)?n:e)}})}async function QR(e){if(!e.rebinding)return null;let t=e.targetUrl??e.control.url;return t.length===0||t===window.location.origin?null:await xR(t)?(window.location.replace(t),null):Y(`settings.rebind.failed`,{target:t})}function $R(e){return e.split(`
39
+ fn("string", ":", "number")(s => s.length)`,SD=class extends Bb{$;constructor(e){super((...t)=>new CD(e)(...t),{bind:e}),this.$=e}in(e){return new CD(this.$,e===void 0?void 0:this.$.parse(e))}at(e,t){return new CD(this.$).at(e,t)}case(e,t){return new CD(this.$).case(e,t)}},CD=class extends Bb{$;in;key;branches=[];constructor(e,t){super(e=>this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.parse(e),t]))),this.$=e,this.in=t}at(e,t){return this.key&&K(ED),this.branches.length&&K(TD),this.key=e,t?this.match(t):this}case(e,t){return this.caseEntry(this.$.parse(e),t)}caseEntry(e,t){let n=(this.key?this.$.parse({[this.key]:e}):e).pipe(t);return this.branches.push(n),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.node(`unit`,{unit:e}),t]))}caseEntries(e){for(let t=0;t<e.length;t++){let[n,r]=e[t];if(n==="default")return t!==e.length-1&&K(`default may only be specified as the last key of a switch definition`),this.default(r);if(typeof r!=`function`)return K(`Value for case "${n}" must be a function (was ${Qy(r)})`);this.caseEntry(n,r)}return this}default(e){typeof e==`function`&&this.case(cE.unknown,e);let t={branches:this.branches,ordered:!0};(e===`never`||e===`assert`)&&(t.meta={onFail:wD});let n=this.$.node(`union`,t);if(!this.in)return this.$.finalize(n);let r=this.in.pipe(n);return(e===`never`||e===`assert`)&&(r=r.configureReferences({onFail:wD},`self`)),this.$.finalize(r)}},wD=e=>e.throw(),TD=`A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')`,ED=`At most one key matcher may be specified per expression`,DD=(e,t)=>{if(Ob(e)){if(e[1]===`=`)return[t.$.parseOwnDefinitionFormat(e[0],t),`=`,e[2]];if(e[1]===`?`)return[t.$.parseOwnDefinitionFormat(e[0],t),`?`]}return uO(e,t)},OD=`Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }`,kD=`Only required keys may specify default values, e.g. { value: 'number = 0' }`,AD=(e,t)=>{let n,r={},i=gb(e);for(let[e,a]of i){let i=PD(e);if(i.kind===`spread`){if(!hb(r))return K(ND);let e=t.$.parseOwnDefinitionFormat(a,t);if(e.equals(cE.object))continue;if(!e.hasKind(`intersection`)||!e.basis?.equals(cE.object))return K(FD(e.expression));n=e.structure;continue}if(i.kind===`undeclared`){a!==`reject`&&a!==`delete`&&a!==`ignore`&&K(MD(a)),r.undeclared=a;continue}let o=DD(a,t),s=i;if(i.kind===`required`){Ob(o)?jD(r,`optional`,o[1]===`=`?{key:i.normalized,value:o[0],default:o[2]}:{key:i.normalized,value:o[0]},t):jD(r,`required`,{key:i.normalized,value:o},t);continue}if(Ob(o)&&(o[1]===`?`&&K(OD),o[1]===`=`&&K(kD)),i.kind===`optional`){jD(r,`optional`,{key:i.normalized,value:o},t);continue}let c=DT(t.$.parseOwnDefinitionFormat(s.normalized,t),o,t.$);c.index&&(r.index=Gy(r.index,c.index)),c.required&&(r.required=Gy(r.required,c.required))}let a=t.$.node(`structure`,r);return t.$.parseSchema({domain:`object`,structure:n?.merge(a)??a})},jD=(e,t,n,r)=>{e[t]=Gy(e[t],r.$.node(t,n))},MD=e=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Ox(e)})`,ND=`Spread operator may only be used as the first key in an object`,PD=e=>typeof e==`symbol`?{kind:`required`,normalized:e}:e[e.length-1]===`?`?e[e.length-2]===`\\`?{kind:`required`,normalized:`${e.slice(0,-2)}?`}:{kind:`optional`,normalized:e.slice(0,-1)}:e[0]===`[`&&e[e.length-1]===`]`?{kind:`index`,normalized:e.slice(1,-1)}:e[0]===`\\`&&e[1]===`[`&&e[e.length-1]===`]`?{kind:`required`,normalized:e.slice(1)}:e===`...`?{kind:`spread`}:e===`+`?{kind:`undeclared`}:{kind:`required`,normalized:e===`\\...`?`...`:e===`\\+`?`+`:e},FD=e=>`Spread operand must resolve to an object literal type (was ${e})`,ID=(e,t)=>XD(e)?YD[e[0]](e,t):JD(e)?qD[e[1]](e,t):null,LD=(e,t)=>t.$.parseOwnDefinitionFormat(e[1],t).keyof(),RD=(e,t)=>{if(e[2]===void 0)return K(BE(e[1],``));let n=t.$.parseOwnDefinitionFormat(e[0],t),r=t.$.parseOwnDefinitionFormat(e[2],t);if(e[1]===`|`)return t.$.node(`union`,{branches:[n,r]});let i=e[1]===`&`?qS(n,r,t.$):JS(n,r,t.$);return i instanceof HS?i.throw():i},zD=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).array(),BD=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).pipe(e[2]):K(VD(`=>`,e[2])),VD=(e,t)=>`${e===`:`?`Narrow`:`Morph`} expression requires a function following '${e}' (was ${typeof t})`,HD=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).constrain(`predicate`,e[2]):K(VD(`:`,e[2])),UD=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).configure(e[2],e[3]),WD=e=>e,GD=WD({"[]":zD,"?":()=>K(DE)}),KD=WD({"|":RD,"&":RD,":":HD,"=>":BD,"|>":RD,"@":UD,"=":()=>K(OE)}),qD={...GD,...KD},JD=e=>qD[e[1]]!==void 0,YD=(e=>e)({keyof:LD,instanceof:(e,t)=>{if(typeof e[1]!=`function`)return K(ZD(Db(e[1])));let n=e.slice(1).map(e=>typeof e==`function`?t.$.node(`proto`,{proto:e}):K(ZD(Db(e))));return n.length===1?n[0]:t.$.node(`union`,{branches:n})},"===":(e,t)=>t.$.units(e.slice(1))}),XD=e=>YD[e[0]]!==void 0,ZD=e=>`Expected a constructor following 'instanceof' operator (was ${e})`,QD=(e,t)=>{let n=[{}],r=0;for(;r<e.length;){let i=!1;e[r]===`...`&&r<e.length-1&&(i=!0,r++);let a=DD(e[r],t),[o,s,c]=Ob(a)?a:[a];if(r++,i){if(!o.extends(q.intrinsic.Array))return K(iO(o.expression));n=n.flatMap(e=>o.distribute(t=>rO($x(e),t)))}else n=n.map(e=>s===`?`?eO(e,o):s===`=`?tO(e,o,c):$D(e,o))}return t.$.parseSchema(n.map(e=>hb(e)?{proto:Array,exactLength:0}:{proto:Array,sequence:e}))},$D=(e,t)=>e.defaultables||e.optionals?K(e.variadic?uT:oO):(e.variadic?e.postfix=Gy(e.postfix,t):e.prefix=Gy(e.prefix,t),e),eO=(e,t)=>e.variadic?K(sO):(e.optionals=Gy(e.optionals,t),e),tO=(e,t,n)=>e.variadic?K(sO):e.optionals?K(cO):(e.defaultables=Gy(e.defaultables,[[t,n]]),e),nO=(e,t)=>(e.postfix&&K(aO),e.variadic?e.variadic.equals(t)||K(aO):e.variadic=t.internal,e),rO=(e,t)=>{let n=t.select({method:`find`,kind:`sequence`});if(!n)return nO(e,q.intrinsic.unknown);if(n.prefix)for(let t of n.prefix)$D(e,t);if(n.optionals)for(let t of n.optionals)eO(e,t);if(n.variadic&&nO(e,n.variadic),n.postfix)for(let t of n.postfix)$D(e,t);return e},iO=e=>`Spread element must be an array (was ${e})`,aO=`A tuple may have at most one variadic element`,oO=`A required element may not follow an optional element`,sO=`An optional element may not follow a variadic element`,cO=`A defaultable element may not follow an optional element without a default`,lO={},uO=(e,t)=>{if(typeof e==`string`){if(t.args&&Object.keys(t.args).some(t=>e.includes(t)))return uD(e,t);let n=lO[t.$.name]??={};return n[e]??=uD(e,t)}return Zy(e,`object`)?dO(e,t):K(mO(Qy(e)))},dO=(e,t)=>{let n=Eb(e);switch(n){case void 0:return tS(e,`root`)?e:`~standard`in e?fO(e,t):AD(e,t);case`Array`:return pO(e,t);case`RegExp`:return t.$.node(`intersection`,{domain:`string`,pattern:e},{prereduced:!0});case`Function`:{let t=Rb(e)?e():e;return tS(t,`root`)?t:K(mO(`Function`))}default:return K(mO(n??Ox(e)))}},fO=(e,t)=>t.$.intrinsic.unknown.pipe((t,n)=>{let r=e[`~standard`].validate(t);if(!r.issues)return r.value;for(let{message:e,path:t}of r.issues)t&&t.length?n.error({problem:Gb(e),relativePath:t.map(e=>typeof e==`object`?e.key:e)}):n.error({message:e})}),pO=(e,t)=>ID(e,t)??QD(e,t),mO=e=>`Type definitions must be strings or objects (was ${e})`,hO=class extends Bb{constructor(e){let t=Object.assign({errors:DS,hkt:Hb,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...t)=>{if(t.length===1)return e.parse(t[0]);if(t.length===2&&typeof t[0]==`string`&&t[0][0]===`<`&&t[0][t[0].length-1]===`>`){let n=t[0].slice(1,-1);return new uC(e.parseGenericParams(n,{}),t[1],e,e,null)}return e.parse(t)},{attach:t})}},gO=q,_O=class e extends WT{get ambientAttachments(){if(gO.typeAttachments)return this.cacheGetter(`ambientAttachments`,ob(gO.typeAttachments,(e,t)=>[e,this.bindReference(t)]))}preparseOwnAliasEntry(e,t){let n=e.indexOf(`<`);if(n===-1){if(tS(t,`module`)||tS(t,`generic`))return[e,t];let n=this.name===`ark`?e:e===`root`?this.name:`${this.name}.${e}`,r=this.resolvedConfig.keywords?.[n];return r&&(t=[t,`@`,r]),[e,t]}e[e.length-1]!==`>`&&K(`'>' must be the last character of a generic declaration in a scope`);let r=e.slice(0,n),i=e.slice(n+1,-1);return[r,()=>cC(this.parseGenericParams(i,{alias:r}),t,this)]}parseGenericParams(e,t){return gD(new zx(e),[],this.createParseContext({...t,def:e,prefix:`generic`}))}normalizeRootScopeValue(e){return Rb(e)&&!tS(e,`generic`)?e():e}preparseOwnDefinitionFormat(e,t){return{...t,def:e,prefix:t.alias??`type`}}parseOwnDefinitionFormat(e,t){!(t.alias&&t.alias in this.aliases)&&!t.args&&(t.args={this:t.id});let n=uO(e,t);if(Ob(n)){if(n[1]===`=`)return K(OE);if(n[1]===`?`)return K(DE)}return n}unit=e=>this.units([e]);valueOf=e=>this.units(bb(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node(`proto`,{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(e=>this.parse(e)));and=(...e)=>e.reduce((e,t)=>e.and(this.parse(t)),this.intrinsic.unknown);merge=(...e)=>e.reduce((e,t)=>e.merge(this.parse(t)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new yD(this);match=new SD(this);declare=()=>({type:this.type});define(e){return e}type=new hO(this);static scope=((t,n={})=>new e(t,n));static module=((e,t={})=>this.scope(e,t).export())},vO=Object.assign(_O.scope,{define:e=>e}),yO=_O,bO=class extends Hb{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'},xO=rE([`base`,cE.object],[`props`,cE.object])(e=>e.base.merge(e.props),bO),SO=yO.module({Key:cE.key,Merge:xO}),CO=class extends Hb{},wO=rE(`element`)(e=>{let t=e.element.exclude(cE.Array),n=t.array();return t.rawOr(n).pipe(By).distribute(e=>e.assertHasKind(`morph`).declareOut(n),tE)},CO),TO=yO.module({root:cE.Array,readonly:`root`,index:cE.nonNegativeIntegerString,liftFrom:wO},{name:`Array`}),EO=tE([`string`,bx.FileConstructor]),DO=tE({meta:`an object representing parsed form data`,domain:`object`,index:{signature:`string`,value:EO.rawOr(EO.array())}}),OO=yO.module({root:[`instanceof`,FormData],value:EO,parsed:DO,parse:tE({in:FormData,morphs:e=>{let t={};for(let[n,r]of e)if(n in t){let e=t[n];typeof e==`string`||e instanceof bx.FileConstructor?t[n]=[e,r]:e.push(r)}else t[n]=r;return t},declaredOut:DO})},{name:`FormData`}),kO=yO.module({Int8:[`instanceof`,Int8Array],Uint8:[`instanceof`,Uint8Array],Uint8Clamped:[`instanceof`,Uint8ClampedArray],Int16:[`instanceof`,Int16Array],Uint16:[`instanceof`,Uint16Array],Int32:[`instanceof`,Int32Array],Uint32:[`instanceof`,Uint32Array],Float32:[`instanceof`,Float32Array],Float64:[`instanceof`,Float64Array],BigInt64:[`instanceof`,BigInt64Array],BigUint64:[`instanceof`,BigUint64Array]},{name:`TypedArray`}),AO={Boolean:1,Number:1,String:1},jO=yO.module({...ob({...xb,...Cb},(e,t)=>e in AO?[]:[e,[`instanceof`,t]]),Array:TO,TypedArray:kO,FormData:OO}),MO=tE({domain:{domain:`number`,meta:`a number representing a Unix timestamp`},divisor:{rule:1,meta:`an integer representing a Unix timestamp`},min:{rule:-864e13,meta:`a Unix timestamp after -8640000000000000`},max:{rule:864e13,meta:`a Unix timestamp before 8640000000000000`},meta:`an integer representing a safe Unix timestamp`}),NO=tE({domain:`number`,divisor:1}),PO=yO.module({root:cE.number,integer:NO,epoch:MO,safe:tE({domain:{domain:`number`,numberAllowsNaN:!1},min:-(2**53-1),max:2**53-1}),NaN:[`===`,NaN],Infinity:[`===`,1/0],NegativeInfinity:[`===`,-1/0]},{name:`number`}),FO=(e,t,n)=>{let r={domain:`string`,pattern:{rule:e.source,flags:e.flags,meta:t}};return n&&(r.meta={format:n}),nE(`intersection`,r)},IO=FO(ox,`a well-formed integer string`),LO=yO.module({root:IO,parse:tE({in:IO,morphs:(e,t)=>{let n=Number.parseInt(e);return Number.isSafeInteger(n)?n:t.error(`an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER`)},declaredOut:cE.integer})},{name:`string.integer`}),RO=FO(/^[\dA-Fa-f]+$/,`hex characters only`),zO=yO.module({root:FO(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,`base64-encoded`),url:FO(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,`base64url-encoded`)},{name:`string.base64`}),BO=FO(/^[A-Z].*$/,`capitalized`),VO=yO.module({root:tE({in:`string`,morphs:e=>e.charAt(0).toUpperCase()+e.slice(1),declaredOut:BO}),preformatted:BO},{name:`string.capitalize`}),HO=tE({domain:`string`,pattern:{meta:`a credit card number`,rule:`^(?:4\\d{12}(?:\\d{3,6})?|5[1-5]\\d{14}|(222[1-9]|22[3-9]\\d|2[3-6]\\d{2}|27[01]\\d|2720)\\d{12}|6(?:011|5\\d\\d)\\d{12,15}|3[47]\\d{13}|3(?:0[0-5]|[68]\\d)\\d{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27]\\d{14}|^(81\\d{14,17}))$`},predicate:{meta:`a credit card number`,predicate:e=>{let t=e.replace(/[ -]+/g,``),n=0,r,i,a=!1;for(let e=t.length-1;e>=0;e--)r=t.substring(e,e+1),i=Number.parseInt(r,10),a?(i*=2,n+=i>=10?i%10+1:i):n+=i,a=!a;return!!(n%10==0&&t)}}}),UO=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,WO=tE({domain:`string`,predicate:{meta:`a parsable date`,predicate:e=>!Number.isNaN(new Date(e).valueOf())}}).assertHasKind(`intersection`),GO=LO.root.internal.narrow((e,t)=>{let n=Number.parseInt(e),r=PO.epoch(n);return r instanceof DS?(t.errors.merge(r),!1):!0}).configure({description:`an integer string representing a safe Unix timestamp`},`self`).assertHasKind(`intersection`),KO=yO.module({root:GO,parse:tE({in:GO,morphs:e=>new Date(e),declaredOut:cE.Date})},{name:`string.date.epoch`}),qO=FO(UO,`an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date`).internal.assertHasKind(`intersection`),JO=yO.module({root:qO,parse:tE({in:qO,morphs:e=>new Date(e),declaredOut:cE.Date})},{name:`string.date.iso`}),YO=yO.module({root:WO,parse:tE({declaredIn:WO,in:`string`,morphs:(e,t)=>{let n=new Date(e);return Number.isNaN(n.valueOf())?t.error(`a parsable date`):n},declaredOut:cE.Date}),iso:JO,epoch:KO},{name:`string.date`}),XO=FO(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,`an email address`,`email`),ZO=`(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,QO=`(${ZO}[.]){3}${ZO}`,$O=RegExp(`^${QO}$`),ek=`(?:[0-9a-fA-F]{1,4})`,tk=RegExp(`^((?:${ek}:){7}(?:${ek}|:)|(?:${ek}:){6}(?:${QO}|:${ek}|:)|(?:${ek}:){5}(?::${QO}|(:${ek}){1,2}|:)|(?:${ek}:){4}(?:(:${ek}){0,1}:${QO}|(:${ek}){1,3}|:)|(?:${ek}:){3}(?:(:${ek}){0,2}:${QO}|(:${ek}){1,4}|:)|(?:${ek}:){2}(?:(:${ek}){0,3}:${QO}|(:${ek}){1,5}|:)|(?:${ek}:){1}(?:(:${ek}){0,4}:${QO}|(:${ek}){1,6}|:)|(?::((?::${ek}){0,5}:${QO}|(?::${ek}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?\$`),nk=yO.module({root:[`v4 | v6`,`@`,`an IP address`],v4:FO($O,`an IPv4 address`,`ipv4`),v6:FO(tk,`an IPv6 address`,`ipv6`)},{name:`string.ip`}),rk=`a JSON string`,ik=e=>{if(!(e instanceof SyntaxError))throw e;return`must be ${rk} (${e})`},ak=tE({meta:rk,domain:`string`,predicate:{meta:rk,predicate:(e,t)=>{try{return JSON.parse(e),!0}catch(e){return t.reject({code:`predicate`,expected:rk,problem:ik(e)})}}}}),ok=yO.module({root:ak,parse:tE({meta:`safe JSON string parser`,in:`string`,morphs:(e,t)=>{if(e.length===0)return t.error({code:`predicate`,expected:rk,actual:`empty`});try{return JSON.parse(e)}catch(e){return t.error({code:`predicate`,expected:rk,problem:ik(e)})}},declaredOut:cE.jsonObject})},{name:`string.json`}),sk=FO(/^[a-z]*$/,`only lowercase letters`),ck=yO.module({root:tE({in:`string`,morphs:e=>e.toLowerCase(),declaredOut:sk}),preformatted:sk},{name:`string.lower`}),lk=[`NFC`,`NFD`,`NFKC`,`NFKD`],uk=ob(lk,(e,t)=>[t,tE({domain:`string`,predicate:e=>e.normalize(t)===e,meta:`${t}-normalized unicode`})]),dk=ob(lk,(e,t)=>[t,tE({in:`string`,morphs:e=>e.normalize(t),declaredOut:uk[t]})]),fk=yO.module({root:dk.NFC,preformatted:uk.NFC},{name:`string.normalize.NFC`}),pk=yO.module({root:dk.NFD,preformatted:uk.NFD},{name:`string.normalize.NFD`}),mk=yO.module({root:dk.NFKC,preformatted:uk.NFKC},{name:`string.normalize.NFKC`}),hk=yO.module({root:dk.NFKD,preformatted:uk.NFKD},{name:`string.normalize.NFKD`}),gk=yO.module({root:`NFC`,NFC:fk,NFD:pk,NFKC:mk,NFKD:hk},{name:`string.normalize`}),_k=FO(rx,`a well-formed numeric string`),vk=yO.module({root:_k,parse:tE({in:_k,morphs:e=>Number.parseFloat(e),declaredOut:cE.number})},{name:`string.numeric`}),yk=`a regex pattern`,bk=tE({domain:`string`,predicate:{meta:yk,predicate:(e,t)=>{try{return new RegExp(e),!0}catch(e){return t.reject({code:`predicate`,expected:yk,problem:String(e)})}}},meta:{format:`regex`}}),xk=FO(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,`a semantic version (see https://semver.org/)`),Sk=FO(/^\S.*\S$|^\S?$/,`trimmed`),Ck=yO.module({root:tE({in:`string`,morphs:e=>e.trim(),declaredOut:Sk}),preformatted:Sk},{name:`string.trim`}),wk=FO(/^[A-Z]*$/,`only uppercase letters`),Tk=yO.module({root:tE({in:`string`,morphs:e=>e.toUpperCase(),declaredOut:wk}),preformatted:wk},{name:`string.upper`}),Ek=tE({domain:`string`,predicate:{meta:`a URL string`,predicate:e=>URL.canParse(e)},meta:{format:`uri`}}),Dk=yO.module({root:Ek,parse:tE({declaredIn:Ek,in:`string`,morphs:(e,t)=>{try{return new URL(e)}catch{return t.error(`a URL string`)}},declaredOut:tE(URL)})},{name:`string.url`}),Ok=yO.module({root:[`versioned | nil | max`,`@`,{description:`a UUID`,format:`uuid`}],"#nil":`'00000000-0000-0000-0000-000000000000'`,"#max":`'ffffffff-ffff-ffff-ffff-ffffffffffff'`,"#versioned":/^[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,v1:FO(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv1`),v2:FO(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv2`),v3:FO(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv3`),v4:FO(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv4`),v5:FO(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv5`),v6:FO(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv6`),v7:FO(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv7`),v8:FO(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,`a UUIDv8`)},{name:`string.uuid`}),kk=yO.module({root:cE.string,alpha:FO(/^[A-Za-z]*$/,`only letters`),alphanumeric:FO(/^[\dA-Za-z]*$/,`only letters and digits 0-9`),hex:RO,base64:zO,capitalize:VO,creditCard:HO,date:YO,digits:FO(/^\d*$/,`only digits 0-9`),email:XO,integer:LO,ip:nk,json:ok,lower:ck,normalize:gk,numeric:vk,regex:bk,semver:xk,trim:Ck,upper:Tk,url:Dk,uuid:Ok},{name:`string`}),Ak=yO.module({bigint:cE.bigint,boolean:cE.boolean,false:cE.false,never:cE.never,null:cE.null,number:cE.number,object:cE.object,string:cE.string,symbol:cE.symbol,true:cE.true,unknown:cE.unknown,undefined:cE.undefined}),jk=yO.module({root:cE.unknown,any:cE.unknown},{name:`unknown`}),Mk=yO.module({root:cE.jsonObject,stringify:nE(`morph`,{in:cE.jsonObject,morphs:e=>JSON.stringify(e),declaredOut:cE.string})},{name:`object.json`}),Nk=yO.module({root:cE.object,json:Mk},{name:`object`}),Pk=class extends Hb{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'},Fk=rE([`K`,cE.key],`V`)(e=>({domain:`object`,index:{signature:e.K,value:e.V}}),Pk),Ik=class extends Hb{description='pick a set of properties from an object like `Pick(User, "name | age")`'},Lk=rE([`T`,cE.object],[`K`,cE.key])(e=>e.T.pick(e.K),Ik),Rk=class extends Hb{description='omit a set of properties from an object like `Omit(User, "age")`'},zk=rE([`T`,cE.object],[`K`,cE.key])(e=>e.T.omit(e.K),Rk),Bk=class extends Hb{description="make all named properties of an object optional like `Partial(User)`"},Vk=rE([`T`,cE.object])(e=>e.T.partial(),Bk),Hk=class extends Hb{description="make all named properties of an object required like `Required(User)`"},Uk=rE([`T`,cE.object])(e=>e.T.required(),Hk),Wk=class extends Hb{description='exclude branches of a union like `Exclude("boolean", "true")`'},Gk=rE(`T`,`U`)(e=>e.T.exclude(e.U),Wk),Kk=class extends Hb{description='extract branches of a union like `Extract("0 | false | 1", "number")`'},qk=rE(`T`,`U`)(e=>e.T.extract(e.U),Kk),Jk=yO.module({Exclude:Gk,Extract:qk,Omit:zk,Partial:Vk,Pick:Lk,Record:Fk,Required:Uk}),Yk=vO({...Ak,...Jk,...jO,...SO,string:kk,number:PO,object:Nk,unknown:jk},{prereducedAliases:!0,name:`ark`}),Xk=Yk.export();Object.assign(gO.ambient,Xk),gO.typeAttachments={string:Xk.string.root,number:Xk.number.root,bigint:Xk.bigint,boolean:Xk.boolean,symbol:Xk.symbol,undefined:Xk.undefined,null:Xk.null,object:Xk.object.root,unknown:Xk.unknown.root,false:Xk.false,true:Xk.true,never:Xk.never,arrayIndex:Xk.Array.index,Key:Xk.Key,Record:Xk.Record,Array:Xk.Array.root,Date:Xk.Date};var J=Object.assign(Yk.type,gO.typeAttachments);Yk.match,Yk.fn,Yk.generic,Yk.schema,Yk.define,Yk.declare;var Zk=J(`"local" | "lan" | /^\\d{1,3}(?:\\.\\d{1,3}){3}$/`),Qk=J(`/^[a-z0-9][a-z0-9_-]*$/`);J({id:Qk,label:`1 <= string <= 60`}).onUndeclaredKey(`reject`),J({"id?":Qk,"label?":`1 <= string <= 60`}).onUndeclaredKey(`reject`),J({label:`1 <= string <= 60`}).onUndeclaredKey(`reject`);function $k(e){let t=Zk(e);return t instanceof J.errors?null:t}var eA=J(`1 <= number.integer <= 65535 | null`),tA=J.enumerated(`block`,`warn`,`follow`,`reclaim`,`kill`),nA=tA.default(`block`),rA=J({enabled:`boolean = true`,maxRetries:`number.integer >= 0 = 3`,baseDelayMs:`number >= 0 = 1000`,factor:`number >= 1 = 2`,maxDelayMs:`number >= 0 = 30000`,resetAfterMs:`number >= 0 = 60000`}).onUndeclaredKey(`reject`),iA=J({path:`string = "/"`,method:`"GET" | "HEAD" = "GET"`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer = 400`,expectBody:`string = ""`}).onUndeclaredKey(`reject`),aA=J({maxRssBytes:`number.integer >= 0 = 0`}).onUndeclaredKey(`reject`),oA=J({enabled:`boolean = true`,mode:`"port" | "http" = "port"`,http:iA.default(()=>({})),intervalMs:`number >= 500 = 5000`,timeoutMs:`number >= 100 = 1500`,unhealthyThreshold:`number.integer >= 1 = 3`,forceRestartAfterMs:`number >= 0 = 0`,startTimeoutMs:`number >= 0 = 20000`}).onUndeclaredKey(`reject`),sA=J({signal:`"SIGTERM" | "SIGINT" | "SIGKILL" = "SIGTERM"`,killGroup:`boolean = true`,graceMs:`number >= 0 = 5000`,killPortHolders:`boolean = false`}).onUndeclaredKey(`reject`),cA=J({command:`string`,args:J(`string[]`).default(()=>[]),env:J(`Record<string, string>`).default(()=>({})),timeoutMs:`number >= 1000 = 120000`,runOnce:`boolean = true`}).onUndeclaredKey(`reject`).or(J(`null`)),lA=J(`string | null`),uA=J(`50 <= number.integer <= 100000`),dA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:lA.optional(),enabled:`boolean = true`,autostart:`boolean = false`,persistent:`boolean = false`,command:`string >= 1`,args:J(`string[]`).default(()=>[]),cwd:`string = "."`,env:J(`Record<string, string>`).default(()=>({})),dataEnvs:J(`Record<string, string>`).default(()=>({})),bootstrap:cA.optional(),port:eA.optional(),bind:Zk.default(()=>`local`),onPortConflict:nA,restart:rA.default(()=>({})),health:oA.default(()=>({})),stop:sA.default(()=>({})),logBufferLines:uA.default(()=>500),dependsOn:J(`string[]`).default(()=>[]),envFile:`string = ""`,resources:aA.default(()=>({})),backupPaths:J(`string[]`).default(()=>[]),backupIgnoreGenerated:`boolean = true`}).onUndeclaredKey(`reject`),fA=J({enabled:`boolean = true`,sessionTtlMs:`number >= 60000 = 604800000`,cookieSecure:`"auto" | "always" | "never" = "auto"`,trustProxy:`boolean | "loopback" = false`,maxLoginAttempts:`number.integer >= 1 = 5`,lockoutMs:`number >= 1000 = 60000`}).onUndeclaredKey(`reject`);J({telegram:J({enabled:`boolean = false`,chatId:`string = ""`,onCrash:`boolean = true`,onUnhealthy:`boolean = true`,onForcedRestart:`boolean = true`,onRecovered:`boolean = false`,onHost:`boolean = true`,onDdns:`boolean = true`,cooldownMs:`number >= 0 = 120000`}).onUndeclaredKey(`reject`).default(()=>({}))}).onUndeclaredKey(`reject`);var pA=J({persist:`boolean = true`,maxBytes:`10000 <= number <= 100000000 = 2000000`,keep:`1 <= number.integer <= 10 = 3`}).onUndeclaredKey(`reject`),mA=J({enabled:`boolean = false`}).onUndeclaredKey(`reject`),hA=J({enabled:`boolean = true`,intervalMs:`number >= 5000 = 15000`,diskPaths:J(`string[]`).default(()=>[`.`]),diskUsedPercent:`number >= 0 = 90`,memoryUsedPercent:`number >= 0 = 90`,swapUsedPercent:`number >= 0 = 50`,loadPerCpu:`number >= 0 = 2`,tempCelsius:`number >= 0 = 85`}).onUndeclaredKey(`reject`),gA=J.enumerated(`A`,`AAAA`),_A=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,provider:`string >= 1`,label:`string = ""`}).onUndeclaredKey(`reject`),vA=J({host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/`,account:`string >= 1`,types:gA.array().default(()=>[`A`]),zone:`string?`,ttl:`number.integer >= 1?`,proxied:`boolean = false`,enabled:`boolean = true`}).onUndeclaredKey(`reject`),yA=J({enabled:`boolean = true`,url:`string = ""`}).onUndeclaredKey(`reject`),bA=J({enabled:`boolean = false`,url:`string = ""`}).onUndeclaredKey(`reject`),xA=J({enabled:`boolean = false`,intervalMs:`number >= 60000 = 300000`,ipv4:yA.default(()=>({})),ipv6:bA.default(()=>({})),ttl:`number.integer >= 1 = 1`,accounts:_A.array().default(()=>[]),domains:vA.array().default(()=>[])}).onUndeclaredKey(`reject`),SA=J({enabled:`boolean`,running:`boolean`,lastRunAt:`number | null`,lastResult:`string | null`,ipv4:`string | null`,ipv6:`string | null`,records:J({host:`string`,account:`string`,provider:`string`,type:gA,ip:`string | null`,state:J(`"pending" | "ok" | "unchanged" | "error" | "skipped"`),message:`string | null`,updatedAt:`number | null`}).array()}),CA=J({key:`string`,label:`string`,hint:`string = ""`,optional:`boolean = false`}),wA=J({config:xA,status:SA,providers:J({id:`string`,label:`string`,docsUrl:`string`,families:gA.array(),fields:CA.array(),ttl:`boolean`,proxied:`boolean`,txt:`boolean`}).array(),credentials:J(`string[]`)});J({provider:`string >= 1`,credentials:J(`Record<string, string>`)}).onUndeclaredKey(`reject`),J({enabled:`boolean?`,intervalMs:`number >= 60000?`,ipv4:J({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ipv6:J({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ttl:`number.integer >= 1?`,accounts:_A.array().optional(),domains:vA.array().optional()}).onUndeclaredKey(`reject`),J({enabled:`boolean = true`,dir:`string = ".backups"`,keep:`number.integer >= 1 = 5`,includePaths:J(`string[]`).default(()=>[])}).onUndeclaredKey(`reject`),J({label:`1 <= string <= 60 = "home-hosted"`,port:`1 <= number.integer <= 65535 = 3999`,host:Zk.default(()=>`local`),openBrowser:`boolean = false`,auth:fA.default(()=>({})),tls:mA.default(()=>({}))}).onUndeclaredKey(`reject`);var TA=J({enabled:`boolean = true`,autostart:`boolean = false`,bind:Zk.default(()=>`local`),onPortConflict:nA,restart:rA.default(()=>({})),health:oA.default(()=>({})),stop:sA.default(()=>({})),logBufferLines:uA.default(()=>500)}).onUndeclaredKey(`reject`),EA=J({enabled:`boolean?`,maxRetries:`number.integer >= 0?`,baseDelayMs:`number >= 0?`,factor:`number >= 1?`,maxDelayMs:`number >= 0?`,resetAfterMs:`number >= 0?`}).onUndeclaredKey(`reject`),DA=J({path:`string?`,method:`"GET" | "HEAD"?`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer?`,expectBody:`string?`}).onUndeclaredKey(`reject`),OA=J({maxRssBytes:`number.integer >= 0?`}).onUndeclaredKey(`reject`),kA=J({enabled:`boolean?`,mode:`"port" | "http"?`,http:DA.optional(),intervalMs:`number >= 500?`,timeoutMs:`number >= 100?`,unhealthyThreshold:`number.integer >= 1?`,forceRestartAfterMs:`number >= 0?`,startTimeoutMs:`number >= 0?`}).onUndeclaredKey(`reject`),AA=J({signal:`"SIGTERM" | "SIGINT" | "SIGKILL"?`,killGroup:`boolean?`,graceMs:`number >= 0?`,killPortHolders:`boolean?`}).onUndeclaredKey(`reject`),jA=J({enabled:`boolean?`,sessionTtlMs:`number >= 60000?`,cookieSecure:`"auto" | "always" | "never"?`,trustProxy:`boolean | "loopback"?`,maxLoginAttempts:`number.integer >= 1?`,lockoutMs:`number >= 1000?`}).onUndeclaredKey(`reject`),MA=J({telegram:J({enabled:`boolean?`,chatId:`string?`,onCrash:`boolean?`,onUnhealthy:`boolean?`,onForcedRestart:`boolean?`,onRecovered:`boolean?`,onHost:`boolean?`,onDdns:`boolean?`,cooldownMs:`number >= 0?`}).onUndeclaredKey(`reject`).optional()}).onUndeclaredKey(`reject`),NA=J({enabled:`boolean?`,intervalMs:`number >= 5000?`,diskPaths:J(`string[]`).optional(),diskUsedPercent:`number >= 0?`,memoryUsedPercent:`number >= 0?`,swapUsedPercent:`number >= 0?`,loadPerCpu:`number >= 0?`,tempCelsius:`number >= 0?`}).onUndeclaredKey(`reject`),PA=J({enabled:`boolean?`,dir:`string?`,keep:`number.integer >= 1?`,includePaths:J(`string[]`).optional()}).onUndeclaredKey(`reject`),FA=J({persist:`boolean?`,maxBytes:`10000 <= number <= 100000000?`,keep:`1 <= number.integer <= 10?`}).onUndeclaredKey(`reject`),IA=J({enabled:`boolean?`}).onUndeclaredKey(`reject`),LA=J({label:`1 <= string <= 60 | null?`,port:`1 <= number.integer <= 65535?`,host:Zk.optional(),openBrowser:`boolean?`,auth:jA.optional(),tls:IA.optional()}).onUndeclaredKey(`reject`),RA=J({enabled:`boolean?`,autostart:`boolean?`,bind:Zk.optional(),onPortConflict:tA.optional(),restart:EA.optional(),health:kA.optional(),stop:AA.optional(),logBufferLines:uA.optional()}).onUndeclaredKey(`reject`),zA={label:lA.optional(),enabled:`boolean?`,autostart:`boolean?`,persistent:`boolean?`,command:`string?`,args:`string[]?`,cwd:`string?`,env:`Record<string, string>?`,dataEnvs:`Record<string, string>?`,bootstrap:cA.optional(),port:eA.optional(),bind:Zk.optional(),onPortConflict:tA.optional(),restart:EA.optional(),health:kA.optional(),stop:AA.optional(),logBufferLines:uA.optional(),dependsOn:J(`string[]`).optional(),envFile:`string?`,resources:OA.optional(),backupPaths:J(`string[]`).optional(),backupIgnoreGenerated:`boolean?`},BA=J(zA).onUndeclaredKey(`reject`),VA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,...zA,command:`string`}).onUndeclaredKey(`reject`);J({serverId:`string`,command:`string`,args:`string[]`,cwd:`string`,env:`Record<string, string>`,logDir:`string`,logs:pA,stop:sA}).onUndeclaredKey(`reject`),J({serverId:`string`,nannyPid:`number`,childPid:`number | null`,startedAt:`number`,logFile:`string`,heartbeatAt:`number`,"lastExit?":J({code:`number | null`,signal:`string | null`,at:`number`,runtimeMs:`number`}).onUndeclaredKey(`reject`)}).onUndeclaredKey(`reject`),J({restarts:`number.integer >= 0`,bootstrapDone:`boolean`,"lastPid?":`number | null`,"lastStartedAt?":`number | null`});var HA=J({control:LA.optional(),host:NA.optional(),backups:PA.optional()}).onUndeclaredKey(`reject`),UA=J({defaults:RA.optional(),logs:FA.optional(),notifications:MA.optional()}).onUndeclaredKey(`reject`),WA=J({enabled:`boolean`,passwordSet:`boolean`,passwordUpdatedAt:`number | null`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,exposed:`boolean`,blockedReason:`string | null`,sessionTtlMs:`number`,cookieSecure:`string`,trustProxy:`boolean | "loopback"`,maxLoginAttempts:`number`,lockoutMs:`number`}),GA=J({enabled:`boolean`,certPresent:`boolean`,subject:`string | null`,issuer:`string | null`,validFrom:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,fingerprint:`string | null`,keyMatches:`boolean | null`,error:`string | null`}),KA=J.enumerated(`caddy`),qA=J.enumerated(`server`,`panel`,`external`),JA=J.enumerated(`auto`,`off`,`manual`),YA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/`,enabled:`boolean = true`,target:qA.default(()=>`server`),workspace:`string = ""`,server:`string = ""`,url:`string = ""`,path:`string = ""`,tls:JA.default(()=>`auto`),dnsAccount:`string = ""`}).onUndeclaredKey(`reject`),XA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:`string = ""`}).onUndeclaredKey(`reject`),ZA=J.enumerated(`off`,`local`,`uploaded`,`issued`,`pending`,`failed`,`fallback`),QA=J({enabled:`boolean = false`,resolvers:J(`string[]`).default(()=>[])}).onUndeclaredKey(`reject`),$A=J({enabled:`boolean = false`,engine:KA.default(()=>`caddy`),httpPort:`1 <= number.integer <= 65535 = 80`,httpsPort:`1 <= number.integer <= 65535 = 443`,email:`string = ""`,staging:`boolean = false`,dns01:QA.default(()=>({})),certificates:XA.array().default(()=>[]),routes:YA.array().default(()=>[])}).onUndeclaredKey(`reject`),ej=J({id:KA,installed:`boolean`,version:`string | null`,source:J.enumerated(`downloaded`,`custom`).or(J(`null`)),path:`string | null`,bytes:`number | null`,error:`string | null`}),tj=J({id:KA,label:`string`,docsUrl:`string`,releaseUrl:`string`,acme:`boolean`,internalCa:`boolean`,dns01:`boolean`,tcp:`boolean`}),nj=J({route:YA,status:J.enumerated(`ok`,`disabled`,`no-upstream`,`error`),upstream:`string | null`,message:`string | null`,"certificate?":J({state:ZA,message:`string | null`,"retryInMinutes?":`number`})}),rj=J({state:J.enumerated(`off`,`stopped`,`starting`,`running`,`error`,`unsupported`),pid:`number | null`,urls:J(`string[]`),certExpiryDays:`number | null`,since:`number | null`,lastError:`string | null`}),ij=J({id:`string`,label:`string`,present:`boolean`,used:`boolean`,subject:`string | null`,issuer:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,hosts:J(`string[]`),error:`string | null`}),aj=J({workspace:`string`,account:`string`,provider:`string`,label:`string`,writesTxt:`boolean`,hasCredentials:`boolean`}),oj=J({config:$A,engine:ej,engines:tj.array(),status:rj,routes:nj.array(),certificates:ij.array(),"dnsAccounts?":aj.array()}),sj=J({id:`string`,host:`string`,enabled:`boolean?`,target:qA.optional(),workspace:`string?`,server:`string?`,url:`string?`,path:`string?`,tls:JA.optional(),dnsAccount:`string?`}).onUndeclaredKey(`reject`),cj=J({enabled:`boolean?`,engine:KA.optional(),httpPort:`1 <= number.integer <= 65535?`,httpsPort:`1 <= number.integer <= 65535?`,email:`string?`,staging:`boolean?`,dns01:J({enabled:`boolean | null?`,resolvers:`string[] | null?`}).onUndeclaredKey(`reject`).optional(),certificates:XA.array().optional(),routes:sj.array().optional()}).onUndeclaredKey(`reject`),lj=J({label:`string = ""`,certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`);J({version:`string = ""`}).onUndeclaredKey(`reject`);var uj=J({enabled:`boolean`,tokenSet:`boolean`,chatId:`string`,onCrash:`boolean`,onUnhealthy:`boolean`,onForcedRestart:`boolean`,onRecovered:`boolean`,onHost:`boolean`,onDdns:`boolean?`,cooldownMs:`number`,lastResult:`string | null`,lastResultAt:`number | null`});J({chats:J({id:`string | number`,title:`string`}).array()});var dj=J({telegram:uj});J({authenticated:`boolean`,authRequired:`boolean`,passwordSet:`boolean`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,defaultPassword:`string | null`,sessionTtlMs:`number`});var fj=J({password:`string`}).onUndeclaredKey(`reject`),pj=J(`1 <= string <= 512`),mj=J({currentPassword:`string?`,newPassword:pj}).onUndeclaredKey(`reject`),hj=J(`"stopped" | "starting" | "running" | "stopping" | "backoff" | "crashed" | "conflict"`),gj=J(`"disabled" | "unknown" | "healthy" | "unhealthy"`),_j=J(`"unknown" | "free" | "in-use"`),vj=J({ts:`number`,stream:J(`"stdout" | "stderr" | "system"`),text:`string`}),yj=J({windowMs:`number`,uptimeRatio:`number | null`,restarts:`number`,crashes:`number`,forcedRestarts:`number`,lastCrashAt:`number | null`,lastExitAt:`number | null`,lastRuntimeMs:`number | null`,events:J({serverId:`string`,ts:`number`,type:`"start" | "exit" | "crash" | "forced-restart" | "unhealthy" | "recovered"`,detail:`string`,runtimeMs:`number?`,"actor?":J.enumerated(`policy`,`user`,`agent`,`boot`)}).array()}),bj=J({cpuPercent:`number | null`,rssBytes:`number | null`,processes:`number`,sampledAt:`number`}),xj=J({path:`string`,totalBytes:`number`,freeBytes:`number`,usedPercent:`number`}),Sj=J({enabled:`boolean`,cpus:`number`,loadAvg:J(`number[]`),uptimeMs:`number`,memoryUsedPercent:`number`,swapUsedPercent:`number`,tempCelsius:`number | null`,disks:xj.array(),alerts:J(`string[]`),sampledAt:`number | null`}),Cj=J({name:`string`,sizeBytes:`number`,createdAt:`number`,encrypted:`boolean`}),wj=J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "secrets" | "tls" | "workspace"`,"workspaceId?":`string`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`,items:J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "servers" | "secrets" | "data"`,"secret?":`string`,"path?":`string`,"origin?":`string`,included:`boolean`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`,"ignoreGenerated?":`boolean`}).array()}),Tj=J({enabled:`boolean`,dir:`string`,keep:`number`,includePaths:J(`string[]`),entries:wj.array(),files:Cj.array()}),Ej=J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "secrets" | "servers" | "tls" | "data"`,"workspaceId?":`string`,restorable:`boolean`,selected:`boolean`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`}),Dj=J({label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,"reasonKey?":`string`,"reasonParams?":`Record<string, string>`});J({dryRun:`boolean`,encrypted:`boolean`,needsPassword:`boolean`,"archive?":J({"writtenBy?":`string`,"schema?":`number`}),items:Ej.array(),applied:J(`string[]`),"appliedIds?":J(`string[]`),skipped:J(`string[]`),"skippedItems?":Dj.array(),restartRequired:`boolean`,reloaded:`boolean`,error:`string?`}),J({password:pj.optional(),include:J(`string[] >= 1`).optional()}).onUndeclaredKey(`reject`),J({name:`string?`,password:pj.optional(),include:J(`string[]`).optional()}).onUndeclaredKey(`reject`);var Oj=J({id:`string`,"workspaceId?":`string`,config:dA,bindHost:`string`,url:`string | null`,status:hj,health:gj,portState:_j,pid:`number | null`,adopted:`boolean?`,startedAt:`number | null`,exitCode:`number | null`,exitSignal:`string | null`,restarts:`number`,maxRetries:`number`,lastError:`string | null`,nextRetryAt:`number | null`,unhealthySince:`number | null`,bufferedLines:`number`,history:yj,responseMs:`number | null`,resources:bj.or(J(`null`))});J({status:`"ok" | "degraded"`,uptimeMs:`number`,"servers?":J({total:`number`,running:`number`,crashed:`number`,unhealthy:`number`}),"hostAlerts?":`string[]`});var kj=J({label:`string`,port:`number`,host:`string`,bindHost:`string`,url:`string`,openBrowser:`boolean`,restartRequired:`boolean`,protocol:`string`,auth:WA,tls:GA}),Aj=J({custom:`boolean`,dir:`string`,meta:J({"name?":`string`,"version?":`string | null`,"uploadedAt?":`number`,"files?":`number.integer >= 1`,"repo?":`string`,"tag?":`string`,"asset?":`string`,"unix?":`number.integer >= 0`}).or(J(`null`))}),jj=J({id:`string`,label:`string`,configPath:`string`,settingsPath:`string`,configError:`string | null`,"configWarnings?":J(`string[]`),logsDir:`string`,defaults:TA,logs:pA,notifications:dj,"ddns?":SA,serverCount:`number`,runningCount:`number`,crashedCount:`number`,servers:Oj.array()}),Mj=J({control:kj,host:Sj,backups:Tj,ui:Aj,workspaces:jj.array(),"proxy?":oj,projectDir:`string`,dataRoot:`string`,"version?":`string`}),Nj=J({type:`"hello" | "state" | "log" | "server"`,ts:`number`,"workspaceId?":`string`,serverId:`string?`,state:Mj.optional(),server:Oj.optional(),lines:vj.array().optional()});J({limit:`string?`}),J({ok:`boolean`,port:`number | null`,terminated:`number[]`,forced:`number[]`,skipped:`number[]`,free:`boolean`}),J({tail:`string?`,search:`string?`,stream:`"stdout" | "stderr" | "system"?`});var Pj=J({servers:J({serverId:`string`,label:`string`,status:hj,enabled:`boolean`,sizeBytes:`number`,files:J({name:`string`,sizeBytes:`number`}).array()}).array()}),Fj=J({serverId:`string`,enabled:`boolean`,sizeBytes:`number`,files:J(`string[]`),searched:`number | null`,lines:vj.array()});J({botToken:`string?`,chatId:`string?`}).onUndeclaredKey(`reject`),J({botToken:`string >= 1`}).onUndeclaredKey(`reject`),J({message:`string`,code:`string`,"detail?":`unknown`}).onUndeclaredKey(`reject`),J({certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`),J({control:kj,host:hA,backups:Tj,ui:Aj}).and(J({rebinding:`boolean`,targetUrl:`string | null`}));var Ij=J({id:`string`,label:`string`,settingsPath:`string`,configPath:`string`,configError:`string | null`,defaults:TA,logs:pA,notifications:dj});function Lj(e){return e instanceof Error?e.message:String(e)}function Rj(e,t){return`${e}/${t}`}function zj(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Bj=class extends Error{name=`AuthRequiredError`;constructor(){super(`authentication required`)}};async function Vj(e,t){let n=await fetch(e,{...t,headers:{"Content-Type":`application/json`,...t?.headers}}),r=await n.text(),i=r.length>0?JSON.parse(r):null;if(!n.ok){if(n.status===401&&zj(i)&&i.code===`AUTH_REQUIRED`)throw new Bj;let e=zj(i)&&typeof i.message==`string`?i.message:zj(i)&&`error`in i?String(i.error):`request failed with ${n.status}`;throw Error(e)}return i}async function Hj(e){let t=oj(e);if(t instanceof J.errors)throw Error(`proxy contract mismatch: ${t.summary}`);return t}async function Uj(e){let t=wA(e);if(t instanceof J.errors)throw Error(`ddns contract mismatch: ${t.summary}`);return t}function Wj(e){return Vj(`/api/proxy/${e}`,{method:`POST`}).then(Hj)}function Gj(){return Wj(`apply`)}function Kj(e){return`/api/backups/${encodeURIComponent(e)}/download`}function qj(){return Vj(`/api/auth/password`,{method:`DELETE`})}async function Jj(e){return Hj(await Vj(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`DELETE`}))}function Yj(e){return Vj(`/api/backups/${encodeURIComponent(e)}`,{method:`DELETE`})}async function Xj(){return Hj(await Vj(`/api/proxy`))}function Zj(){return Vj(`/api/auth/session`)}function Qj(){return Vj(`/api/settings`)}async function $j(e=``){return Hj(await Vj(`/api/proxy/engine`,{method:`POST`,body:JSON.stringify({version:e})}))}function eM(e){let t=fj({password:e});if(t instanceof J.errors)throw Error(t.summary);return Vj(`/api/auth/login`,{method:`POST`,body:JSON.stringify(t)})}function tM(){return Vj(`/api/auth/logout`,{method:`POST`})}async function nM(e){let t=cj(e);if(t instanceof J.errors)throw Error(t.summary);return Hj(await Vj(`/api/proxy`,{method:`PATCH`,body:JSON.stringify(t)}))}function rM(e){let t={};return e.password!==void 0&&e.password.length>0&&(t.password=e.password),e.include!==void 0&&(t.include=e.include),t}function iM(e,t,n={}){return Vj(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:JSON.stringify({name:e,...rM(n)})})}async function aM(e){return Hj(await Vj(`/api/proxy/routes/${encodeURIComponent(e)}/retry-certificate`,{method:`POST`}))}function oM(){return Wj(`revert`)}function sM(){return Vj(`/api/settings/ui`,{method:`DELETE`})}function cM(e,t){let n=mj(e===void 0?{newPassword:t}:{currentPassword:e,newPassword:t});if(n instanceof J.errors)throw Error(n.summary);return Vj(`/api/auth/password`,{method:`POST`,body:JSON.stringify(n)})}function lM(){return Wj(`start`)}function uM(){return Wj(`stop`)}async function dM(e,t,n,r){let i=lj({label:t,certificate:n,privateKey:r});if(i instanceof J.errors)throw Error(i.summary);return Hj(await Vj(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(i)}))}async function fM(e){let t=new FormData;t.append(`file`,e);let n=await fetch(`/api/settings/ui`,{method:`POST`,body:t}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.message??r?.error??`the upload failed with ${n.status}`);return r}var pM=/^[\w!#$%&'*.^`|~+-]+$/,mM=(e,t,n={})=>{if(!pM.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},hM=(e,t,n)=>(t=encodeURIComponent(t),mM(e,t,n)),gM=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),_M=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??(?=/|$)`);e=e.replace(t,()=>r?`/${r}`:``)}return e},vM=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.set(n,r)}return t},yM=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},bM=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function xM(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function SM(e,t){if(!xM(e)&&!xM(t))return t;let n={...e};for(let e in t){let r=t[e];n[e]=xM(n[e])&&xM(r)?SM(n[e],r):r}return n}var CM=(e,t)=>new Proxy(()=>{},{get(n,r){if(typeof r==`string`&&r!==`then`)return CM(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),wM=(e,t)=>{let n=t.toString();return n?`${e}?${n}`:e},TM=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.append(n,r)}this.rBody=t}e.json!==void 0&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))r!==void 0&&t.push(hM(n,r));t.length>0&&(r.Cookie=t.join(`; `))}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers;for(let[e,t]of Object.entries(r))t!==void 0&&i.set(e,t);let a=this.url;a=bM(a),a=_M(a,this.pathParams),this.queryParams&&(a=wM(a,this.queryParams)),n=this.method.toUpperCase();let o=n!==`GET`&&n!==`HEAD`;return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},EM=((e,t)=>CM(function n(r){let i=t?.buildSearchParams??vM,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=gM(e,a.join(`/`));if(s===`url`||s===`path`){let t=bM(c);return r.args[0]&&(r.args[0].param&&(t=_M(t,r.args[0].param)),r.args[0].query&&(t=wM(t,i(r.args[0].query)))),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=bM(c),n=yM(r.args[0]?.param?_M(e,r.args[0].param):e,`ws`),a=new URL(n),o=r.args[0]?.query;return o&&i(o).forEach((e,t)=>{a.searchParams.append(t,e)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(a.toString())}let l=new TM(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=SM(t,e);return l.fetch(r.args[0],a)}return l},[]))(typeof window>`u`?`http://127.0.0.1`:window.location.origin);J({workspaces:jj.array()});var DM=J({workspace:jj}),OM=J({ok:`boolean`,removed:`unknown`});function kM(e){return e==null||e.length===0?``:`?workspace=${encodeURIComponent(e)}`}function AM(e,t){return{param:{id:t},query:e.length>0?{workspace:e}:{}}}function jM(e,t,n){let r=n??new URLSearchParams;t.length>0&&r.set(`workspace`,t);let i=r.toString();return i.length>0?`${e}?${i}`:e}async function MM(){let e=Mj(await Vj(`/api/state`));if(e instanceof J.errors)throw Error(`state contract mismatch: ${e.summary}`);return e}async function NM(e){let t=DM(e);if(t instanceof J.errors)throw Error(`workspace contract mismatch: ${t.summary}`);return t.workspace}async function PM(e){return NM(await Vj(`/api/workspaces`,{method:`POST`,body:JSON.stringify(e)}))}async function FM(e,t){return NM(await Vj(`/api/workspaces/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({label:t})}))}async function IM(e){let t=OM(await Vj(`/api/workspaces/${encodeURIComponent(e)}`,{method:`DELETE`}));if(t instanceof J.errors)throw Error(`workspace removal contract mismatch: ${t.summary}`);return t}function LM(e){let t=HA(e);if(t instanceof J.errors)throw Error(t.summary);return Vj(`/api/settings`,{method:`PATCH`,body:JSON.stringify(t)})}async function RM(e,t){let n=UA(t);if(n instanceof J.errors)throw Error(n.summary);let r=Ij(await Vj(jM(`/api/settings/workspace`,e),{method:`PATCH`,body:JSON.stringify(n)}));if(r instanceof J.errors)throw Error(`workspace settings contract mismatch: ${r.summary}`);return r}async function zM(e){let t=Pj(await Vj(jM(`/api/logs`,e)));if(t instanceof J.errors)throw Error(`logs contract mismatch: ${t.summary}`);return t.servers}async function BM(e,t,n){let r=new URLSearchParams;n.tail!==void 0&&r.set(`tail`,String(n.tail)),n.search!==void 0&&n.search.length>0&&r.set(`search`,n.search),n.stream!==void 0&&n.stream.length>0&&r.set(`stream`,n.stream);let i=Fj(await Vj(jM(`/api/logs/${encodeURIComponent(t)}`,e,r)));if(i instanceof J.errors)throw Error(`log history contract mismatch: ${i.summary}`);return i}function VM(e,t){return Vj(jM(`/api/logs/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function HM(e,t,n){return jM(`/api/logs/${encodeURIComponent(t)}/download`,e,new URLSearchParams({file:n}))}function UM(e,t){if(t!==void 0&&t.length===0)throw Error("nothing is selected: omit `include` to capture everything, or select at least one item");let n={};return e!==void 0&&e.length>0&&(n.password=e),t!==void 0&&(n.include=t),Vj(`/api/backups`,{method:`POST`,body:JSON.stringify(n)})}async function WM(e,t,n={}){let r=new FormData;r.append(`file`,e),n.password!==void 0&&n.password.length>0&&r.append(`password`,n.password),n.include!==void 0&&r.append(`include`,JSON.stringify(n.include));let i=await fetch(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:r}),a=await i.json().catch(()=>null);if(!i.ok)throw Error(a?.message??a?.error??`restore failed with ${i.status}`);return a}function GM(e,t){return Vj(jM(`/api/notifications/token`,e),{method:`PUT`,body:JSON.stringify({botToken:t})})}function KM(e){return Vj(jM(`/api/notifications/token`,e),{method:`DELETE`})}function qM(e,t){return Vj(jM(`/api/notifications/test`,e),{method:`POST`,body:JSON.stringify(t)})}function JM(e,t){return Vj(jM(`/api/notifications/detect-chats`,e),{method:`POST`,body:JSON.stringify(t)})}async function YM(e){return Uj(await Vj(jM(`/api/ddns`,e)))}async function XM(e,t){return Uj(await Vj(jM(`/api/ddns`,e),{method:`PUT`,body:JSON.stringify(t)}))}async function ZM(e,t,n,r){return Uj(await Vj(jM(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`PUT`,body:JSON.stringify({provider:n,credentials:r})}))}async function QM(e,t){return Uj(await Vj(jM(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`DELETE`}))}async function $M(e){return Uj(await Vj(jM(`/api/ddns/check`,e),{method:`POST`}))}function eN(e,t){return Vj(`/api/settings/tls`,{method:`POST`,body:JSON.stringify({certificate:e,privateKey:t})})}function tN(){return Vj(`/api/settings/tls`,{method:`DELETE`})}async function nN(e,t,n){let r=await EM.api.servers[`:id`][n].$post(AM(e,t)),i=await r.json().catch(()=>null);if(!r.ok)throw Error(i?.message??`request failed with ${r.status}`);return i??{ok:!0}}function rN(e){return Vj(jM(`/api/servers/start-all`,e),{method:`POST`})}async function iN(e,t){let n=await EM.api.servers[`:id`][`free-port`].$post(AM(e,t)),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.message??`request failed with ${n.status}`);return r??{ok:!0,port:null,terminated:[],forced:[],skipped:[],free:!1}}function aN(e){return Vj(jM(`/api/servers/stop-all`,e),{method:`POST`})}function oN(e,t){return Vj(jM(`/api/servers/${encodeURIComponent(t)}/clear-logs`,e),{method:`POST`})}function sN(e,t,n){return Vj(jM(`/api/servers/${encodeURIComponent(t)}`,e),{method:`PATCH`,body:JSON.stringify(n)})}function cN(e,t){return Vj(jM(`/api/servers/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function lN(e,t){return Vj(jM(`/api/servers`,e),{method:`POST`,body:JSON.stringify(t)})}var uN=k(null),dN=k(null);function fN(e){return e===null?`wait`:e.authRequired&&!e.authenticated?`login`:`connect`}function pN(){async function e(){try{uN.value=await Zj()}catch{uN.value=null}}async function t(e){dN.value=null;try{return uN.value=await eM(e),!0}catch(e){return dN.value=Lj(e),!1}}async function n(){try{await tM()}finally{await e()}}function r(){uN.value={authenticated:!1,authRequired:!0,passwordSet:uN.value?.passwordSet??!0,apiTokenSet:uN.value?.apiTokenSet??!1,usingDefaultPassword:uN.value?.usingDefaultPassword??!1,defaultPassword:uN.value?.defaultPassword??null,sessionTtlMs:uN.value?.sessionTtlMs??0}}async function i(t,n){dN.value=null;try{return await cM(t,n),await e(),null}catch(e){return Lj(e)}}async function a(){dN.value=null;try{return await qj(),await e(),null}catch(e){return Lj(e)}}return{session:rn(uN),error:rn(dN),refresh:e,login:t,logout:n,requireLogin:r,setPassword:i,clearPassword:a}}var mN=k([]),hN=1;function gN(e){mN.value=mN.value.filter(t=>t.id!==e)}function _N(e,t=4800){let n=hN++;return mN.value=[...mN.value,{...e,id:n}],t>0&&setTimeout(gN,t,n),n}function vN(){return{toasts:rn(mN),dismiss:gN,push:_N,success:(e,t)=>_N({tone:`ok`,title:e,description:t}),failure:(e,t)=>_N({tone:`danger`,title:e,description:t},9e3),info:(e,t)=>_N({tone:`info`,title:e,description:t}),warn:(e,t)=>_N({tone:`warn`,title:e,description:t},7e3)}}var yN=4e3;function bN(){return tn({ts:[],cpu:[],rss:[],probe:[],lastSampledAt:-1})}function xN(e){let t=e.ts.length-120;t<=0||(e.ts.splice(0,t),e.cpu.splice(0,t),e.rss.splice(0,t),e.probe.splice(0,t))}function SN(e,t,n){let r=t.resources?.sampledAt??0,i=e.ts[e.ts.length-1]??0;if(!(r!==e.lastSampledAt||n-i>=yN)){e.probe.length>0&&(e.probe[e.probe.length-1]=t.responseMs);return}e.lastSampledAt=r,e.ts.push(n);let a=t.status===`running`;e.cpu.push(a?t.resources?.cpuPercent??null:null),e.rss.push(a?t.resources?.rssBytes??null:null),e.probe.push(t.responseMs),xN(e)}function CN(e){let t=0;for(let n of e)n!==null&&n>t&&(t=n);return t}function wN(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n!=null)return n}return null}var TN=8e3,EN=k(null),DN=k(`connecting`),ON=k(null),kN=k(Date.now()),AN=new Map,jN=vN(),MN=new Map,NN=k(0),PN=null,FN=null;function IN(e){let t=MN.get(e);if(t)return t;let n={lines:[],version:k(0),refs:0,source:null};return MN.set(e,n),n}function LN(e,t){let n=IN(e),r=n.lines.concat(t);n.lines=r.length>8e3?r.slice(r.length-TN):r,n.version.value+=1,NN.value+=1}function RN(e){return MN.get(e)?.lines??[]}function zN(e){let t=MN.get(e);t&&(t.lines=[],t.version.value+=1,NN.value+=1)}function BN(e){let t=AN.get(e);if(t)return t;let n=bN();return AN.set(e,n),n}function VN(e){e.workspaceId!==void 0&&SN(BN(Rj(e.workspaceId,e.id)),e,Date.now())}function HN(e){let t=EN.value;if(!t)return;let n=e.workspaceId,r=n===void 0?t.workspaces.filter(t=>t.servers.some(t=>t.id===e.id)):t.workspaces.filter(e=>e.id===n);if(r.length!==1)return;let i=r[0],a=i.servers.find(t=>t.id===e.id),o=n===void 0?{...e,workspaceId:i.id}:e;i.servers=a===void 0?[...i.servers,o]:i.servers.map(t=>t.id===e.id?o:t)}function UN(e){let t;try{t=JSON.parse(e)}catch{return}let n=Nj(t);if(n instanceof J.errors){console.warn(`[home-hosted] ignored malformed SSE frame`,n.summary);return}if(n.type===`hello`||n.type===`state`){if(n.state){EN.value=n.state;for(let e of EN.value.workspaces)for(let t of e.servers)VN(t)}return}if(n.type===`server`&&n.server){let e=n.server;HN(e),VN(e);return}if(n.type===`log`&&n.serverId&&n.lines){let e=n.workspaceId;if(e===void 0)return;LN(Rj(e,n.serverId),n.lines)}}function WN(e,t,n){let r=Rj(e,t);n.lines=[],n.version.value+=1,NN.value+=1;let i=new EventSource(`/api/servers/${encodeURIComponent(t)}/stream${kM(e)}`),a=e=>{let t=e,n;try{n=JSON.parse(t.data)}catch{return}let i=Nj(n);if(i instanceof J.errors){console.warn(`[home-hosted] ignored malformed SSE frame`,i.summary);return}if(i.type===`log`&&i.lines){LN(r,i.lines);return}i.type===`server`&&i.server&&HN(i.server)};for(let e of[`log`,`server`])i.addEventListener(e,a);i.onerror=()=>{},n.source=i}function GN(e,t){let n=IN(Rj(e,t));n.refs+=1,n.source||WN(e,t,n)}function KN(e,t){let n=MN.get(Rj(e,t));n&&(n.refs=Math.max(0,n.refs-1),n.refs===0&&(n.source?.close(),n.source=null))}function qN(){if(PN)return;FN??=setInterval(()=>{kN.value=Date.now()},1e3);let e=new EventSource(`/api/events?logs=0`);PN=e,DN.value=`connecting`,e.onopen=()=>{DN.value=`open`},e.onerror=()=>{DN.value=`closed`};for(let t of[`hello`,`state`,`server`,`log`])e.addEventListener(t,e=>{UN(e.data)})}function JN(){PN?.close(),PN=null,FN&&clearInterval(FN),FN=null}function YN(e,t){let n=W(()=>{let n=bn(e),r=bn(t);return n===null||r===null?null:Rj(n,r)}),r=null;return M(n,e=>{if(r!==null&&r!==e){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&KN(e,t)}if(r=e,e!==null){let[t,n]=e.split(`/`);t!==void 0&&n!==void 0&&GN(t,n)}},{immediate:!0}),Be(()=>{if(r!==null){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&KN(e,t)}r=null}),{version:W(()=>{let e=n.value;return NN.value,e===null?0:MN.get(e)?.version.value??0}),lines(){let e=n.value;return e===null?[]:RN(e)},count:W(()=>{let e=n.value;return NN.value,e===null?0:MN.get(e)?.lines.length??0}),clear(){let e=n.value;e!==null&&zN(e)}}}function XN(){let e=W(()=>EN.value?.workspaces??[]),t=W(()=>e.value.flatMap(e=>e.servers.map(t=>({workspace:e,server:t})))),n=W(()=>EN.value?.control??null),r=W(()=>EN.value?.host??null),i=W(()=>EN.value?.backups??null),a=W(()=>EN.value?.proxy??null),o=W(()=>EN.value?.projectDir??null),s=W(()=>EN.value?.dataRoot??null),c=W(()=>EN.value?.version??null);function l(e){return EN.value?.workspaces.find(t=>t.id===e)}function u(e,t){return l(e)?.servers.find(e=>e.id===t)}function d(e,t){return BN(Rj(e,t))}async function f(){if(EN.value===null)try{EN.value=await MM()}catch(e){e instanceof Bj&&pN().requireLogin()}}async function p(e,t){ON.value=null;try{let n=await e();EN.value=await MM();let r=typeof t.success==`function`?t.success(n):t.success;return r&&jN.success(r),n}catch(e){if(e instanceof Bj){pN().requireLogin();return}let n=Lj(e);ON.value=n,jN.failure(t.title,n);return}}return{appState:EN,workspaces:e,allServers:t,control:n,host:r,backups:i,proxy:a,projectDir:o,dataRoot:s,version:c,connection:rn(DN),lastError:rn(ON),now:rn(kN),workspaceById:l,ensureState:f,serverById:u,seriesOf:d,refresh:(e=`Refresh failed`)=>p(async()=>{},{title:e}),start:(e,t)=>p(()=>nN(e,t,`start`),{title:`Could not start ${t}`}),stop:(e,t)=>p(()=>nN(e,t,`stop`),{title:`Could not stop ${t}`}),restart:(e,t)=>p(()=>nN(e,t,`restart`),{title:`Could not restart ${t}`}),startAll:e=>p(()=>rN(e),{title:`Could not start every server`,success:`Starting every enabled server`}),stopAll:e=>p(()=>aN(e),{title:`Could not stop every server`,success:`Stopping every server`}),setAutostart:(e,t,n)=>p(()=>sN(e,t,{autostart:n}),{title:`Could not change autostart for ${t}`}),setEnabled:(e,t,n)=>p(()=>sN(e,t,{enabled:n}),{title:`Could not change ${t}`}),freePort:(e,t)=>p(()=>iN(e,t),{title:`Could not free the port for ${t}`,success:e=>e.free?`Port ${e.port} is free — start ${t} now`:`Port ${e.port} is still held`}),setBind:(e,t,n)=>{let r=$k(n);return r===null?(jN.failure(`Could not change the bind for ${t}`,`"${n}" is not a bind value`),Promise.resolve(void 0)):p(()=>sN(e,t,{bind:r}),{title:`Could not change the bind for ${t}`})},saveConfig:(e,t,n)=>p(()=>sN(e,t,n),{title:`Could not save ${t}`,success:`${t} updated`}),saveGlobalSettings:e=>p(()=>LM(e),{title:`Could not save the settings`}),saveWorkspaceSettings:(e,t)=>p(()=>RM(e,t),{title:`Could not save the settings`}),clearLogs:(e,t)=>p(async()=>{await oN(e,t),zN(Rj(e,t))},{title:`Could not clear the logs for ${t}`,success:`Buffer cleared`}),create:(e,t)=>p(()=>lN(e,t),{title:`Could not add the server`,success:`Server added`}),remove:(e,t)=>p(async()=>{await cN(e,t),KN(e,t),MN.delete(Rj(e,t)),AN.delete(Rj(e,t))},{title:`Could not remove ${t}`,success:`${t} removed`})}}var ZN=`hh.theme`;function QN(){try{let e=localStorage.getItem(ZN);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var $N=k(QN()),eP=k(typeof matchMedia<`u`&&matchMedia(`(prefers-color-scheme: dark)`).matches),tP=!1;function nP(){tP||typeof matchMedia>`u`||(tP=!0,matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,e=>{eP.value=e.matches,iP()}))}var rP=W(()=>$N.value===`system`?eP.value:$N.value===`dark`);function iP(){typeof document<`u`&&document.documentElement.classList.toggle(`dark`,rP.value)}function aP(){nP(),iP();function e(e){$N.value=e;try{localStorage.setItem(ZN,e)}catch{}iP()}return{preference:$N,isDark:rP,setPreference:e,cycle(){e($N.value===`light`?`dark`:$N.value===`dark`?`system`:`light`)}}}var oP=`hh.workspace`;function sP(){try{return localStorage.getItem(oP)}catch{return null}}function cP(e){try{e===null?localStorage.removeItem(oP):localStorage.setItem(oP,e)}catch{}}var lP=k(sP()),uP=k(!1);function dP(){let e=XN(),t=vN(),n=W(()=>e.appState.value?.workspaces??[]),r=W(()=>{let e=n.value;return e.find(e=>e.id===lP.value)??e[0]??null}),i=W(()=>r.value?.id??``);M([n,lP],()=>{let e=n.value;if(e.length===0)return;let t=e.find(e=>e.id===lP.value)?.id??e[0].id;t!==lP.value&&(lP.value=t,cP(t))},{immediate:!0});function a(e){lP.value=e,cP(e)}let o=W(()=>r.value?.servers??[]),s=W(()=>r.value?.defaults??null),c=W(()=>r.value?.logs??null),l=W(()=>r.value?.notifications??null),u=W(()=>r.value?.configError??null),d=W(()=>r.value?.configWarnings??[]),f=W(()=>r.value?.logsDir??null),p=W(()=>r.value?.serverCount??0),m=W(()=>r.value?.runningCount??0),h=W(()=>r.value?.crashedCount??0);function g(e){return o.value.find(t=>t.id===e)}function _(t){return e.seriesOf(i.value,t)}async function v(n){uP.value=!0;try{let r=await PM(n.trim().length>0?{label:n.trim()}:{});return await e.refresh(`Could not read the workspaces`),a(r.id),t.success(`Workspace “${r.label}” created`),r}catch(e){t.failure(`Could not create the workspace`,Lj(e));return}finally{uP.value=!1}}async function y(n,r){try{return await FM(n,r.trim()),await e.refresh(`Could not read the workspaces`),t.success(`Workspace renamed`),!0}catch(e){return t.failure(`Could not rename the workspace`,Lj(e)),!1}}async function b(n){try{return await IM(n),await e.refresh(`Could not read the workspaces`),t.success(`Workspace deleted`),!0}catch(e){return t.failure(`Could not delete the workspace`,Lj(e)),!1}}return{workspaces:n,selectedId:rn(lP),selected:r,activeId:i,creating:rn(uP),select:a,create:v,rename:y,remove:b,servers:o,serverById:g,seriesOf:_,defaults:s,logsConfig:c,notifications:l,configError:u,configWarnings:d,logsDir:f,serverCount:p,runningCount:m,crashedCount:h,refresh:e.refresh,start:t=>e.start(i.value,t),stop:t=>e.stop(i.value,t),restart:t=>e.restart(i.value,t),startAll:()=>e.startAll(i.value),stopAll:()=>e.stopAll(i.value),setEnabled:(t,n)=>e.setEnabled(i.value,t,n),setAutostart:(t,n)=>e.setAutostart(i.value,t,n),setBind:(t,n)=>e.setBind(i.value,t,n),freePort:t=>e.freePort(i.value,t),clearLogs:t=>e.clearLogs(i.value,t),saveConfig:(t,n)=>e.saveConfig(i.value,t,n),createServer:t=>e.create(i.value,t),removeServer:t=>e.remove(i.value,t)}}var fP=t({default:()=>pP}),pP={"activity.emptyTitle":`No events in the last 24 hours`,"activity.emptyDescription":`Starts, exits, crashes and recoveries show up here as they happen.`,"activity.ran":`ran {duration}`,"addServer.title":`Add a server`,"addServer.description":`Appends an entry to {workspace}'s servers.config.json; every policy you leave out is inherited from its defaults.`,"addServer.thisWorkspace":`this workspace`,"addServer.identity":`Identity`,"addServer.id":`Id`,"addServer.idHint":`Lowercase letters, digits, dashes and underscores; used in URLs and logs.`,"addServer.labelHint":`Shown in the panel; defaults to the id.`,"addServer.process":`Process`,"addServer.commandHint":`Spawned without a shell.`,"addServer.argumentsHint":`One argument per line; whitespace inside a line is preserved.`,"addServer.portLifecycle":`Port & lifecycle`,"addServer.bindHint":`lan exposes it to the network; only do that behind auth.`,"addServer.advanced":`Advanced settings`,"addServer.advancedHint":`environment, backups, policy, lifecycle, bootstrap`,"addServer.backups":`Backups`,"addServer.backupIgnore":`Ignore known generated files`,"addServer.bootstrapDescription":`A one-off command run before the first start.`,"addServer.bootstrapHint":`Installs, migrations, downloads — before the first start, not on every one.`,"addServer.policyResources":`Policy & resources`,"addServer.logBufferHint":`Blank keeps the default.`,"addServer.inheritNote":`Restart, health and stop start out matching {settings}; change one here and it is written into this entry instead of staying inherited.`,"addServer.serverDefaults":`Settings → Server defaults`,"addServer.placeholdersTitle":`Available argument placeholders`,"addServer.submit":`Add to servers.config.json`,"app.name":`home-hosted`,"app.tagline":`Process supervisor control panel`,"bind.local":`local — 127.0.0.1`,"bind.lan":`lan — 0.0.0.0`,"bind.explicit":`{bind} — explicit`,"common.cancel":`Cancel`,"common.confirm":`Confirm`,"common.reset":`Reset`,"common.keepIt":`Keep it`,"common.remove":`Remove`,"common.close":`Close`,"common.save":`Save`,"common.saving":`Saving…`,"common.discard":`Discard`,"common.delete":`Delete`,"common.edit":`Edit`,"common.add":`Add`,"common.retry":`Retry`,"common.copy":`Copy`,"common.copied":`Copied`,"common.enabled":`Enabled`,"common.disabled":`Disabled`,"common.none":`None`,"common.unknown":`unknown`,"common.loading":`Loading…`,"common.selectAll":`Select all`,"common.selectNone":`Select none`,"common.name":`Name`,"common.label":`Label`,"common.hostname":`Hostname`,"common.port":`Port`,"common.command":`Command`,"common.environment":`Environment`,"common.memory":`Memory`,"common.cpu":`CPU`,"common.disk":`Disk`,"common.uptime":`Uptime`,"common.status":`Status`,"common.actions":`Actions`,"common.details":`Details`,"common.overview":`Overview`,"common.warning":`Warning`,"common.error":`Error`,"common.confirmQuestion":`{label}?`,"common.unset":`unset`,"common.never":`never`,"common.now":`now`,"common.dismiss":`Dismiss`,"connection.live":`Live`,"connection.connecting":`Connecting`,"connection.reconnecting":`Reconnecting`,"connection.liveUpdates":`Live updates`,"editor.title":`Edit configuration`,"editor.description":`Writes overrides to {file}; anything left alone keeps inheriting the defaults.`,"editor.inSync":`in sync`,"editor.process":`Process`,"editor.processDescription":`What gets spawned, where, and with which environment.`,"editor.labelPlaceholder":`falls back to the id`,"editor.argumentsHint":`One per line; {port} {host} {home} {projectDir} {dataRoot} {id} {label} {cwd} {bind} {lanIp} are substituted.`,"editor.portTitle":`Port & binding`,"editor.portDescription":`How the port is preflighted and where the process is reachable.`,"editor.bindHint":`A custom IPv4 the config already sets stays selectable.`,"editor.lifecycle":`Lifecycle`,"editor.lifecycleDescription":`Whether the supervisor owns this entry at all.`,"editor.save":`Save to servers.config.json`,"editor.changesTitle":`Unsaved changes`,"editor.changesDescription":`What Save would write to servers.config.json.`,"editor.nothingToSave":`Nothing to save.`,"health.disabled":`Not checked`,"health.unknown":`Not probed`,"health.healthy":`Healthy`,"health.unhealthy":`Unhealthy`,"history.start":`Started`,"history.exit":`Exited`,"history.crash":`Crashed`,"history.forcedRestart":`Forced restart`,"history.unhealthy":`Unhealthy`,"history.recovered":`Recovered`,"host.loadPerCpu":`Load / cpu`,"host.cpuTemp":`CPU temp`,"host.samplingOff":`Host sampling is off`,"host.samplingOffDescription":`Turn it on in Settings to collect load, memory, disk and temperature.`,"host.swap":`Swap`,"host.cpus":`CPUs`,"host.loadAverage":`Load 1 / 5 / 15`,"host.memoryUsed":`Memory used`,"host.sampled":`Sampled`,"host.filesystems":`Filesystems`,"host.thresholdsBreached":`Thresholds breached`,"killPort.trigger":`Kill what holds port {port}`,"killPort.title":`Kill the process on port {port}?`,"killPort.body":`It is asked to stop first, and killed only if it ignores that. Anything this panel supervises is refused, so a managed server cannot be lost this way.`,"killPort.confirm":`Kill it`,"language.label":`Language`,"language.select":`Select a language`,"lifecycle.restartTitle":`Restart policy`,"lifecycle.restartDescription":`Backoff between attempts after a crash.`,"lifecycle.restartOnCrash":`Restart on crash`,"lifecycle.maxRetries":`Max retries`,"lifecycle.maxRetriesHint":`Attempts before the server is left crashed.`,"lifecycle.baseDelay":`Base delay (ms)`,"lifecycle.factor":`Backoff factor`,"lifecycle.maxDelay":`Max delay (ms)`,"lifecycle.resetAfter":`Reset after (ms)`,"lifecycle.resetAfterHint":`A run this long clears the retry counter.`,"lifecycle.healthTitle":`Health check`,"lifecycle.healthDescription":`How readiness is probed once the process is up.`,"lifecycle.probe":`Probe this server`,"lifecycle.probeType":`Probe type`,"lifecycle.probePort":`TCP port — connection only`,"lifecycle.probeHttp":`HTTP request — assert a response`,"lifecycle.interval":`Interval (ms)`,"lifecycle.timeout":`Timeout (ms)`,"lifecycle.unhealthyAfter":`Unhealthy after`,"lifecycle.unhealthyAfterHint":`Consecutive failed probes.`,"lifecycle.forceRestartAfter":`Force restart after (ms)`,"lifecycle.forceRestartAfterHint":`0 disables it.`,"lifecycle.startTimeout":`Start timeout (ms)`,"lifecycle.httpPath":`HTTP path`,"lifecycle.httpMethod":`HTTP method`,"lifecycle.expectStatus":`Expect status`,"lifecycle.expectStatusHint":`Blank accepts anything below.`,"lifecycle.expectStatusBelow":`Healthy below status`,"lifecycle.expectBody":`Body must contain`,"lifecycle.expectBodyPlaceholder":`optional substring`,"lifecycle.headBodyHint":`HEAD has no response body, so this check is ignored — use GET, or clear it.`,"lifecycle.stopTitle":`Stop behaviour`,"lifecycle.stopDescription":`How the process tree is asked to go away.`,"lifecycle.signal":`Signal`,"lifecycle.signalTerm":`SIGTERM — ask it to stop`,"lifecycle.signalInt":`SIGINT — interrupt (Ctrl-C)`,"lifecycle.signalKill":`SIGKILL — kill immediately`,"lifecycle.grace":`Grace period (ms)`,"lifecycle.killGroup":`Kill the whole process group`,"lifecycle.killPortHolders":`Also kill whatever holds the port`,"login.title":`Sign in to continue`,"login.firstRunTitle":`This panel has no password yet`,"login.firstRunSubtitle":`Anything on this machine can reach it. Set a password right after you are in.`,"login.authOffTitle":`Authentication is turned off`,"login.authOffSubtitle":`The panel only listens on loopback, which is the only thing protecting it right now.`,"login.subtitle":`The control panel is protected. Enter the password to continue.`,"login.password":`Password`,"login.showPassword":`Show password`,"login.hidePassword":`Hide password`,"login.signIn":`Sign in`,"login.openDashboard":`Open the dashboard`,"login.exposed":`Exposed`,"login.defaultPasswordWarning":`Still on the default password {password}. Change it under Settings — binding beyond 127.0.0.1 stays refused until you do.`,"login.noPasswordWarning":`No password is set. Open Settings from this machine to add one, or run {command}.`,"login.sessionNote":`Sessions stay signed in for {days} days after the last visit — each request extends that window. Signing out clears this browser only.`,"login.servedFromThisMachine":`served from this machine`,"logs.emptyHint":`No output yet.`,"logs.noMatches":`Nothing matches that search or stream filter.`,"logs.searchPlaceholder":`Search this output`,"logs.searchLabel":`Search the log output`,"logs.clearSearch":`Clear the search`,"logs.prevMatch":`Previous match`,"logs.nextMatch":`Next match`,"logs.showTimestamps":`Show timestamps`,"logs.hideTimestamps":`Hide timestamps`,"logs.timestampsShort":`ts`,"logs.pause":`Pause`,"logs.follow":`Follow`,"logs.clearHint":`Clear the in-memory buffer`,"logs.clearLabel":`Clear the log buffer`,"logs.downloadHint":`Download the persisted file`,"logs.downloadLabel":`Download the log file`,"logs.outputLabel":`Log output`,"logs.jumpToLatest":`Jump to latest`,"logs.streaming":`streaming`,"logs.paused":`paused`,"logs.snapshot":`snapshot`,"logs.linesOf":`{count} of {total} lines`,"logs.matches":`{count} matches`,"logs.rowHeight":`row height {height}px · windowed`,"logs.streamAll":`All`,"logs.streamOut":`out`,"logs.streamErr":`err`,"logs.streamSys":`sys`,"metric.emptyHint":`collecting…`,"nav.global":`Global`,"nav.workspace":`Workspace`,"nav.others":`Others`,"nav.overview":`Overview`,"nav.servers":`Servers`,"nav.logs":`Logs`,"nav.workspaceSettings":`Workspace settings`,"nav.globalOverview":`Global Overview`,"nav.globalSettings":`Global settings`,"nav.reverseProxy":`Reverse Proxy`,"nav.navigation":`Navigation`,"nav.closeNavigation":`Close navigation`,"nav.hostVitals":`Host vitals`,"notice.configError":`The config could not be read: {error}`,"notice.configErrorHint":`The panel keeps running the config it already had; fix {path} and it reloads on its own.`,"notice.defaultPassword":`This panel is still on its default password.`,"notice.defaultPasswordHint":`Change it in Global settings — binding beyond 127.0.0.1 stays refused until you do.`,"notice.noPassword":`Authentication is on but no password is set, so nothing is being asked for.`,"notice.noPasswordHint":`Set one in Global settings to actually lock the panel.`,"notice.exposed":`This panel is reachable beyond 127.0.0.1.`,"notice.exposedHint":`Keep the password strong, or put a TLS-terminating proxy in front of it.`,"notice.authOff":`Authentication is disabled — the panel is only protected by its loopback bind.`,"onPortConflict.block":`block — refuse to start`,"onPortConflict.warn":`warn — start anyway`,"onPortConflict.follow":`follow — adopt a detached restart of itself`,"onPortConflict.reclaim":`reclaim — replace it with a supervised copy`,"onPortConflict.kill":`kill — stop whatever holds the port`,"palette.placeholder":`Jump to a server, run an action, open a setting…`,"palette.openServer":`Open {label}`,"palette.serverLogs":`Logs for {label}`,"palette.startServer":`Start {label}`,"palette.stopServer":`Stop {label}`,"palette.restartServer":`Restart {label}`,"palette.goOverview":`Go to Overview`,"palette.goGlobalOverview":`Go to Global Overview`,"palette.goGlobalSettings":`Go to Global settings`,"palette.goProxy":`Go to Reverse Proxy`,"palette.goServers":`Go to Servers`,"palette.goLogs":`Go to Logs`,"palette.goWorkspaceSettings":`Go to Workspace settings`,"palette.startAll":`Start every enabled server here`,"palette.stopAll":`Stop every server here`,"palette.switchWorkspace":`Switch to {label}`,"palette.globalSetting":`Global setting: {label}`,"palette.workspaceSetting":`Workspace setting: {label}`,"palette.theme":`{theme} theme`,"palette.groupServers":`Servers`,"palette.groupActions":`Actions`,"palette.groupNavigate":`Navigate`,"palette.groupWorkspaces":`Workspaces`,"palette.groupAppearance":`Appearance`,"palette.navigate":`navigate`,"palette.run":`run`,"palette.noMatches":`Nothing matches “{query}”.`,"proxy.account.automatic":`Automatic (the only account that can answer)`,"proxy.account.noTxt":`no TXT support`,"proxy.account.noCredentials":`no credentials`,"proxy.account.gone":`That account is no longer configured.`,"proxy.account.emptyHint":`DNS-01 writes the challenge record here. Empty uses the only account that can answer a challenge, when there is one.`,"proxy.account.cannotWrite":`A {provider} account cannot write TXT records, so it cannot answer a DNS-01 challenge.`,"proxy.account.noCredentialsYet":`No credentials are stored for this {provider} account yet.`,"proxy.account.through":`The challenge is written through this {provider} account.`,"proxy.certificate.title":`Uploaded certificates`,"proxy.certificate.description":`Served by routes set to “Uploaded certificate”. Everything else — public or local — is certified by the engine on its own.`,"proxy.certificate.add":`Add certificate`,"proxy.certificate.emptyTitle":`No certificate uploaded`,"proxy.certificate.emptyDescription":`A route set to “Uploaded certificate” needs a pair covering its hostname, or the engine has nothing to serve for it.`,"proxy.certificate.daysLeft":`{days} days left`,"proxy.certificate.subject":`Subject`,"proxy.certificate.issuer":`Issuer`,"proxy.certificate.validUntil":`Valid until`,"proxy.certificate.covers":`Covers`,"proxy.certificate.noSans":`no hostnames in its SANs`,"proxy.certificate.removeAria":`Remove {name}`,"proxy.certificate.removeQuestion":`Remove “{name}”?`,"proxy.certificate.removeBody":`The pair is deleted from disk. A route still set to “Uploaded certificate” keeps serving the engine's own certificate until you change it, and the panel refuses this while one still serves it.`,"proxy.certificate.removeIt":`Remove it`,"proxy.certificate.stored":`“{label}” stored.`,"proxy.certificate.removed":`“{name}” removed.`,"proxy.certificateDialog.title":`Add a certificate`,"proxy.certificateDialog.description":`The pair is stored on disk under its id, and a route set to “Uploaded certificate” can serve it.`,"proxy.certificateDialog.label":`Label`,"proxy.certificateDialog.labelPlaceholder":`Home wildcard`,"proxy.certificateDialog.id":`Id`,"proxy.certificateDialog.idHint":`names the files on disk`,"proxy.certificateDialog.certFile":`Certificate file (.pem, .crt)`,"proxy.certificateDialog.keyFile":`Private key file (.pem, .key)`,"proxy.certificateDialog.pasteCert":`Or paste the certificate`,"proxy.certificateDialog.pasteKey":`Or paste the private key`,"proxy.certificateDialog.certPlaceholder":`-----BEGIN CERTIFICATE-----`,"proxy.certificateDialog.keyPlaceholder":`-----BEGIN PRIVATE KEY-----`,"proxy.certificateDialog.store":`Store the certificate`,"proxy.certificateDialog.errorLabel":`a label is required`,"proxy.certificateDialog.errorId":`the id must start with a letter or digit, then letters, digits, dash or underscore`,"proxy.certificateDialog.errorTaken":`“{id}” is already used by another certificate`,"proxy.certificateDialog.errorCertificate":`paste or choose the certificate`,"proxy.certificateDialog.errorPrivateKey":`paste or choose the private key`,"proxy.engine.title":`Engine`,"proxy.engine.description":`The reverse proxy itself. The panel downloads the current build, supervises it and applies its configuration through the engine's own admin API.`,"proxy.engine.notInFrame":`The proxy state is not in this panel's frame yet.`,"proxy.engine.readFailed":`The engine could not be read`,"proxy.engine.notInstalled":`No engine installed`,"proxy.engine.installNote":`Installing downloads the current {engine} release the panel supervises — about 46 MB, once. Nothing is exposed until a route is added and the proxy is switched on.`,"proxy.engine.version":`Version`,"proxy.engine.notProbed":`not probed yet`,"proxy.engine.source":`Source`,"proxy.engine.sourceCustom":`a path configured by hand`,"proxy.engine.sourceDownloaded":`downloaded by the panel`,"proxy.engine.size":`Size`,"proxy.engine.binary":`Binary`,"proxy.engine.copyPath":`Copy the binary path`,"proxy.engine.address":`Live address`,"proxy.engine.process":`Process`,"proxy.engine.certificates":`Certificates`,"proxy.engine.noCert":`no public certificate yet`,"proxy.engine.expiresSoon":`soonest expires in {days} days`,"proxy.engine.acme":`ACME certificates`,"proxy.engine.localCa":`Local CA`,"proxy.engine.dns01":`DNS-01`,"proxy.engine.tcpUdp":`TCP/UDP`,"proxy.engine.documentation":`{engine} documentation`,"proxy.engine.failed":`The engine reported a failure`,"proxy.engine.setcapHint":`A privileged port (below 1024) needs this once on Linux:`,"proxy.engine.copyCommand":`Copy the command`,"proxy.engine.install":`Install engine`,"proxy.engine.start":`Start`,"proxy.engine.stop":`Stop`,"proxy.engine.apply":`Apply configuration`,"proxy.engine.revert":`Revert`,"proxy.engine.revertHint":`Go back to the configuration that applied before the last one`,"proxy.engine.update":`Update engine`,"proxy.listener.title":`Listener & certificates`,"proxy.listener.description":`Where the proxy listens. 80 and 443 are what a router forwards and what an ACME challenge expects; a port below 1024 needs a privileged bind.`,"proxy.listener.unprivilegedPorts":`unprivileged ports`,"proxy.listener.run":`Run the reverse proxy`,"proxy.listener.runHint":`Saved with Save settings; the panel starts or stops the engine to match.`,"proxy.listener.httpPort":`HTTP port`,"proxy.listener.httpPortHint":`ACME HTTP-01 challenges and the redirect to HTTPS.`,"proxy.listener.httpsPort":`HTTPS port`,"proxy.listener.httpsPortHint":`Where certificates are served.`,"proxy.listener.useFallback":`Use {http} / {https}`,"proxy.listener.useStandard":`Use 80 / 443`,"proxy.listener.forwardHint":`Running unprivileged — forward 80 and 443 to these ports on your router.`,"proxy.listener.privilegedTitle":`A port below 1024 needs a privileged bind`,"proxy.listener.privilegedBody":`Running the panel as your own user cannot bind 80 or 443 without permission. Either grant it once {how} and restart the engine, or keep {http}/{https} and forward 80/443 from your router. On Windows the port is free to bind, but something else may hold it.`,"proxy.listener.privilegedWithSetcap":`with {command} on the engine binary`,"proxy.listener.email":`ACME account e-mail`,"proxy.listener.emailPlaceholder":`you@example.com`,"proxy.listener.emailHint":`Let's Encrypt uses it to warn you about an expiring certificate. A local-only name gets the engine's own CA and needs none.`,"proxy.listener.emailNeededTitle":`An e-mail is needed for automatic HTTPS`,"proxy.listener.emailNeededBody":`“{host}” is a public hostname, so the engine asks a CA for a certificate and the account address is required. Fill it in, switch the route's TLS off, or turn on the staging endpoint while you try things out.`,"proxy.listener.staging":`Use the ACME staging endpoint`,"proxy.listener.stagingHint":`Untrusted certificates and no rate-limit burn while you try things out.`,"proxy.listener.dns01":`Answer challenges with DNS-01`,"proxy.listener.dns01Hint":`The panel writes the challenge record through a route's DNS account, so no inbound port is needed to get a certificate.`,"proxy.listener.resolvers":`Check the record against`,"proxy.listener.resolversPlaceholder":`1.1.1.1, 8.8.8.8`,"proxy.listener.resolversHint":`Nameservers the engine reads the record from; empty uses its own. Needed where split-horizon DNS shows it a different view.`,"proxy.listener.noAccountTitle":`No DNS account can answer a challenge`,"proxy.listener.noAccountBody":`DNS-01 is on, but no account has credentials it can use. Add one under Workspace Settings → Dynamic DNS, or public names stay on the port challenges and wait for a CA that cannot reach them.`,"proxy.listener.manyAccountsTitle":`Each public route has to pick an account`,"proxy.listener.manyAccountsBody":`More than one account can answer, so “Automatic” cannot choose. Pick one per route, or those names stay on the port challenges.`,"proxy.listener.accountNote":`Each route picks its own account, so names in different zones each get the right one. A route left on “Automatic” uses the only account the table names. A name no account answers stays on the port challenges.`,"proxy.listener.pendingNote":`A public name whose certificate is still being issued is reachable in the meantime — over HTTPS with a temporary untrusted certificate, or over plain HTTP with a page naming the ports to forward.`,"proxy.retry.inFallback":`~8 hours`,"proxy.retryButton.force":`Force retry certificate`,"proxy.retryButton.question":`Ask the CA again for {host}?`,"proxy.retryButton.body":`The engine failed to obtain a CA certificate for this hostname previously and is using its local CA. It retries automatically every {retryIn}.`,"proxy.retryButton.warning":`Retrying now will kill this route and make it unavailable for a bit, are you sure to continue?`,"proxy.retryButton.leave":`Leave it`,"proxy.retryButton.now":`Retry now`,"proxy.routeDialog.titleEdit":`Edit route`,"proxy.routeDialog.titleAdd":`Add route`,"proxy.routeDialog.description":`A hostname, what it forwards to, and how it is served over TLS.`,"proxy.routeDialog.hostname":`Hostname`,"proxy.routeDialog.hostnamePlaceholder":`gitea.example.com`,"proxy.routeDialog.path":`Path prefix`,"proxy.routeDialog.pathPlaceholder":`/optional`,"proxy.routeDialog.pathHint":`Empty serves the whole host.`,"proxy.routeDialog.target":`Target`,"proxy.routeDialog.tls":`TLS`,"proxy.routeDialog.dnsAccount":`DNS account`,"proxy.routeDialog.localNote":`A local-only name is signed by the engine's own CA, so no DNS account is involved.`,"proxy.routeDialog.workspace":`Workspace`,"proxy.routeDialog.server":`Server`,"proxy.routeDialog.noServers":`this workspace has no servers`,"proxy.routeDialog.stoppedNote":`A server that is stopped is not routed: the row shows “No upstream” until it runs again.`,"proxy.routeDialog.upstream":`Upstream`,"proxy.routeDialog.upstreamPlaceholder":`http://10.0.0.5:8080`,"proxy.routeDialog.upstreamHint":`A literal address, including the port. A scheme is optional.`,"proxy.routeDialog.panelNote":`Serving the control panel needs authentication on and a password that is not the default — the panel refuses the save otherwise.`,"proxy.routeDialog.save":`Save route`,"proxy.routes.title":`Routes`,"proxy.routes.description":`One public hostname per service. A route may point at a supervised server in any workspace, at this panel, or at a literal upstream.`,"proxy.routes.add":`Add route`,"proxy.routes.cannotSaveTitle":`These routes cannot be saved as they stand`,"proxy.routes.cannotRoute":`{host} cannot be routed`,"proxy.routes.emptyTitle":`No routes yet`,"proxy.routes.emptyDescription":`Add one to expose a server through a domain — the engine gets the certificate on its own.`,"proxy.routes.addFirst":`Add the first route`,"proxy.routes.columnHostname":`Hostname`,"proxy.routes.columnTarget":`Target`,"proxy.routes.columnUpstream":`Upstream`,"proxy.routes.columnTls":`TLS`,"proxy.routes.columnState":`State`,"proxy.routes.columnOn":`On`,"proxy.routes.openInTab":`Open {url} in a new tab`,"proxy.routes.noHostname":`no hostname yet`,"proxy.routes.toggle":`Route {name}`,"proxy.routes.edit":`Edit {name}`,"proxy.routes.remove":`Remove {name}`,"proxy.status.certified":`certificate ready`,"proxy.status.localCa":`engine CA`,"proxy.status.uploaded":`uploaded pair`,"proxy.status.awaitingCa":`waiting for the CA`,"proxy.status.failed":`certificate failed`,"proxy.status.fellBack":`Fell back to Local CA`,"proxy.status.serving":`Serving`,"proxy.status.disabled":`Disabled`,"proxy.status.noUpstream":`No upstream`,"proxy.status.error":`Error`,"proxy.status.unapplied":`Not applied yet`,"proxy.status.off":`Off`,"proxy.status.stopped":`Stopped`,"proxy.status.starting":`Starting`,"proxy.status.running":`Running`,"proxy.status.unsupported":`Unsupported`,"proxy.target.server":`A supervised server`,"proxy.target.panel":`This control panel`,"proxy.target.external":`A literal upstream`,"proxy.target.controlPanel":`control panel`,"proxy.target.noServer":`no server picked`,"proxy.target.noUpstream":`no upstream`,"proxy.tls.auto":`Automatic — the engine decides`,"proxy.tls.off":`Off — plain HTTP`,"proxy.tls.manual":`Uploaded certificate`,"proxy.tls.plain":`plain HTTP`,"proxy.tls.uploaded":`uploaded certificate`,"proxy.tls.letsEncrypt":`Let’s Encrypt`,"proxy.tls.engineCa":`engine CA (local)`,"proxy.tls.hintOff":`Plain HTTP: no certificate is served for this hostname.`,"proxy.tls.hintManual":`Serves the certificate pair uploaded below.`,"proxy.tls.hintEmpty":`A public hostname gets an ACME certificate; a local-only name gets the engine’s own CA.`,"proxy.tls.hintPublic":`A public hostname, so the engine asks a CA for a certificate — an ACME account e-mail is needed.`,"proxy.tls.hintLocal":`A local-only name, so the engine signs it with its own locally-trusted CA.`,"proxy.validation.labelRequired":`a label is required`,"proxy.validation.idPattern":`the id must start with a letter or digit, then letters, digits, dash or underscore`,"proxy.validation.hostRequired":`a hostname is required`,"proxy.validation.hostPattern":`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,"proxy.validation.hostTaken":`"{host}" is already routed for this path`,"proxy.validation.pathSlash":`a path prefix starts with /`,"proxy.validation.pathSpace":`a path prefix cannot contain a space`,"proxy.validation.idTaken":`route id "{id}" is used twice`,"proxy.validation.workspaceRequired":`pick the workspace that owns the server`,"proxy.validation.serverRequired":`pick a server in that workspace`,"proxy.validation.url":`an upstream like http://10.0.0.5:8080`,"proxy.view.title":`Reverse Proxy`,"proxy.view.description":`Expose your servers through domains, with automatic HTTPS via 80/443 or a DNS challenge.`,"proxy.view.dnsNote":`For DNS-01, add the domain's DNS provider to any workspace under Workspace Settings → Dynamic DNS; a route can then pick that account, from any workspace.`,"proxy.view.readFailed":`The reverse proxy could not be read`,"proxy.view.reading":`Reading the reverse proxy…`,"proxy.view.engineInstalled":`Engine installed`,"proxy.view.engineStarting":`Engine starting`,"proxy.view.engineStopping":`Engine stopping`,"proxy.view.configApplied":`Configuration applied`,"proxy.view.configReverted":`Configuration reverted`,"proxy.view.settingsSaved":`Settings saved.`,"proxy.view.settingsSavedToast":`Settings saved`,"proxy.view.retryFailed":`the retry failed`,"proxy.view.retryAsked":`asking the CA again for {host}`,"proxy.view.fieldChanged":`field changed`,"proxy.view.fieldsChanged":`fields changed`,"proxy.view.noChanges":`No unsaved changes`,"proxy.view.discard":`Discard changes`,"proxy.view.save":`Save settings`,"serverCard.open":`Open {url}`,"serverCard.adoptedHint":`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`,"serverCard.detached":`detached`,"serverCard.persistentHint":"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only an explicit stop does.","serverCard.persistent":`persistent`,"serverCard.disabled":`disabled`,"serverCard.autostart":`autostart`,"serverCard.healthProbe":`Health probe`,"serverCard.notProbed":`not probed`,"serverCard.restarts":`Restarts`,"serverCard.pid":`PID`,"serverCard.rss":`RSS`,"serverCard.procs":`Procs`,"serverCard.portFree":`free`,"serverCard.portInUse":`in-use`,"serverCard.uptime24h":`24h up`,"serverCard.probe":`Probe`,"serverCard.crashes24h":`24h crashes`,"serverCard.lastCrash":`Last crash`,"serverCard.unhealthyFor":`Unhealthy for {duration}`,"serverCard.nextAttempt":`Next attempt {when}`,"serverCard.start":`Start`,"serverCard.stop":`Stop`,"serverCard.restart":`Restart`,"serverCard.detailsHint":`Live logs and full telemetry`,"serverCard.moreActions":`More actions for {label}`,"serverCard.disable":`Disable server`,"serverCard.enable":`Enable server`,"serverCard.removeFromAutostart":`Remove from autostart`,"serverCard.autostartWithPanel":`Autostart with the panel`,"serverCard.clearLogBuffer":`Clear log buffer`,"serverCard.removeServer":`Remove server`,"serverCard.removeTitle":`Remove this server?`,"serverCard.removeDescription":`{label} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,"serverCard.statusField":`status`,"serverForm.workingDirectory":`Working directory`,"serverForm.cwdHint":`Relative paths resolve under projectDir.`,"serverForm.arguments":`Arguments`,"serverForm.portHint":`Blank means the server has no port to probe or preflight.`,"serverForm.bindAddress":`Bind address`,"serverForm.autostart":`Autostart with up`,"serverForm.autostartHint":`Start it whenever the control plane comes up.`,"serverForm.persistent":`Persistent`,"serverForm.persistentHint":"Keeps running when the panel stops; `down` reports it instead of stopping it.","serverForm.envHint":`KEY=value per line, exported to the process.`,"serverForm.dataEnvs":`Data envs`,"serverForm.dataEnvsHint":`ENV=path per line — exported to the process and backed up automatically.`,"serverForm.envFile":`Env file`,"serverForm.envFilePlaceholder":`optional KEY=value file`,"serverForm.envFileHint":`Loaded at spawn; its values override env.`,"serverForm.dependsOn":`Depends on`,"serverForm.dependsOnHint":`Comma separated; started first and waited for until healthy, stopped last.`,"serverForm.backupPaths":`Extra backup paths`,"serverForm.backupPathsHint":`One per line, placeholders allowed; data envs are captured already.`,"serverForm.backupIgnore":`Ignore known generated files when backing this up`,"serverForm.backupIgnoreHint":`Skips node_modules, dist, .next and the other caches nothing restores from.`,"serverForm.bootstrap":`Bootstrap`,"serverForm.bootstrapDescription":`A one-off command run before the first start — installs, migrations, downloads.`,"serverForm.runBootstrap":`Run a bootstrap`,"serverForm.bootstrapHint":`Off means the entry has none and the key is sent as null.`,"serverForm.timeoutMs":`Timeout (ms)`,"serverForm.runOnce":`Only once per session`,"serverForm.runOnceHint":`Off means every start re-runs it.`,"serverForm.bootstrapArgs":`Bootstrap arguments`,"serverForm.bootstrapArgsHint":`One per line; same placeholders as the main arguments.`,"serverForm.bootstrapEnv":`Bootstrap environment`,"serverForm.bootstrapEnvHint":`KEY=value per line, exported to the bootstrap process only.`,"serverForm.onPortConflict":`On port conflict`,"serverForm.logBufferLines":`Log buffer lines`,"serverForm.maxRssMb":`Max RSS (MB)`,"serverForm.maxRssHint":`Restart above this; blank or 0 disables it.`,"serverForm.enabledHint":`Off keeps the entry in the config but refuses to start it.`,"settings.auth.policyTitle":`Access policy`,"settings.auth.policyDescription":`Authentication applies whether the panel is on loopback or exposed to the network.`,"settings.auth.requirePassword":`Require a password`,"settings.auth.requirePasswordHint":`Every request needs a signed-in session.`,"settings.auth.sessionLifetime":`Session lifetime (ms)`,"settings.auth.sessionLifetimeHint":`Idle timeout: 604800000 is one week of no activity. Each request restarts it.`,"settings.auth.cookieSecure":`Cookie Secure`,"settings.auth.cookieSecureAuto":`Auto — only over HTTPS`,"settings.auth.cookieSecureAlways":`Always`,"settings.auth.cookieSecureNever":`Never — plain HTTP`,"settings.auth.trustProxy":`Behind a reverse proxy`,"settings.auth.trustProxyOff":`No — ignore x-forwarded-*`,"settings.auth.trustProxyLoopback":`Yes, from this machine only`,"settings.auth.trustProxyAny":`Yes, from any caller`,"settings.auth.trustProxyHint":`Trust x-forwarded-* for the client address and protocol. 'From this machine only' is the safe choice for a proxy on the same host. 'From any caller' believes the caller's own header, so login lockout counts per forged address and can be bypassed.`,"settings.auth.maxLoginAttempts":`Max login attempts`,"settings.auth.maxLoginAttemptsHint":`Failures before a temporary lockout.`,"settings.auth.lockout":`Lockout (ms)`,"settings.auth.apiTokenSet":`An API token is set`,"settings.auth.apiTokenMissing":`No API token`,"settings.auth.apiTokenNote":`Scripts can call the API with {code} instead of signing in.`,"settings.auth.noTokenNote":`For shell scripts and agents, generate one with {command}.`,"settings.auth.defaultPasswordTitle":`The default password is still in use`,"settings.auth.defaultPasswordText":`Set your own password below. Binding beyond {address} stays refused until you do.`,"settings.auth.blockedTitle":`This listener is being refused`,"settings.auth.noPasswordTitle":`Authentication is on but no password is set`,"settings.auth.noPasswordText":`Nothing is actually required yet, and binding beyond {address} stays refused until a password exists.`,"settings.auth.exposedTitle":`Reachable beyond 127.0.0.1`,"settings.auth.exposedText":`Keep the password strong, or put a TLS-terminating proxy in front of the panel.`,"settings.auth.changePassword":`Change password`,"settings.auth.setPassword":`Set a password`,"settings.auth.passwordDescription":`Stored as a scrypt hash in the secrets file, never in the config.`,"settings.auth.currentPassword":`Current password`,"settings.auth.newPassword":`New password`,"settings.auth.repeatPassword":`Repeat new password`,"settings.auth.passwordMismatch":`The two passwords do not match.`,"settings.auth.updatePassword":`Update password`,"settings.auth.setPasswordAndEnable":`Set password and enable auth`,"settings.auth.clearPassword":`Clear password`,"settings.auth.clearPasswordConfirm":`Confirm clear`,"settings.auth.clearPasswordTitle":`Clear the password?`,"settings.auth.clearPasswordHint":`Authentication is switched off with it, and anyone reaching the panel is let straight in.`,"settings.auth.shortPasswordTitle":`That is a short password`,"settings.auth.shortPasswordText":`It is allowed, but longer is the only thing standing between the network and this panel.`,"settings.auth.passwordUpdated":`Password updated. Other sessions were signed out.`,"settings.auth.passwordCleared":`Password cleared and authentication disabled.`,"settings.backup.createTitle":`Create a backup`,"settings.backup.createDescription":`Pick what this archive captures. Nothing is written until you create it.`,"settings.backup.chooseItems":`Choose items`,"settings.backup.partialCapture":`Only the chosen items are captured.`,"settings.backup.withoutGlobalSettings":`Without the global settings, a restore can only place a workspace where the target panel already declares it.`,"settings.backup.password":`Password (optional)`,"settings.backup.passwordHint":`Encrypts the archive; restoring it asks for the same password.`,"settings.backup.create":`Create backup`,"settings.backup.chooseItemsFor":`{label} — choose items`,"settings.backup.subDescription":`A workspace can be captured whole or only its settings, servers, secrets and declared data paths.`,"settings.backup.selectedOf":`{selected} of {total} selected`,"settings.backup.nothingSelectable":`This workspace declares nothing selectable yet.`,"settings.backup.apply":`Apply`,"settings.backup.created":`Backup created.`,"settings.backup.leafSettingsHint":`Server defaults, log retention and notifications`,"settings.backup.leafServersHint":`Every entry in servers.config.json`,"settings.backup.leafSecretsHint":`Telegram bot token and DDNS credentials`,"settings.backup.leafDataHint":`A declared data path`,"settings.backup.pathFromOrigin":`{path} — from {origin}`,"settings.backup.entrySettingsHint":`Listener, auth, host vitals and the backups policy`,"settings.backup.entrySecretsHint":`Password hash and API token hash`,"settings.backup.entryTlsHint":`The panel's own certificate pair`,"settings.backup.entryWorkspaceHint":`Its settings, servers, secrets and declared data paths`,"settings.backup.entryGlobalSettings":`Global settings`,"settings.backup.entryGlobalSecrets":`Global secrets (password, API token)`,"settings.backup.entryTlsCertificate":`TLS certificate`,"settings.backup.leafSettings":`Settings`,"settings.backup.leafServers":`Servers`,"settings.backup.leafSecrets":`Secrets`,"settings.backup.secretPassword":`Password`,"settings.backup.secretPasswordHint":`The panel's own password hash; restoring it reinstates the old password`,"settings.backup.secretApiToken":`API token`,"settings.backup.secretApiTokenHint":`The long-lived token scripts and agents use`,"settings.backup.secretTelegram":`Telegram bot token`,"settings.backup.secretTelegramHint":`Used for notifications`,"settings.backup.secretDdns":`DDNS credentials`,"settings.backup.secretDdnsHint":`Provider credentials, kept sealed with their key`,"settings.backup.restoreItemLabel":`{workspace}: {item}`,"settings.backup.noteMissing":`does not exist yet`,"settings.backup.noteCovered":`covered by {path}`,"settings.backup.noteAlreadyDeclared":`already declared by {origin}`,"settings.backup.noteContainsBackupDir":`contains the backup directory`,"settings.backup.noteUnknownWorkspace":`unknown workspace`,"settings.backup.noteMissingFromArchive":`missing from the archive`,"settings.backup.noteDeclaredByBackup":`declared by the backup's config, which is not being restored`,"settings.backup.noteNotDeclared":`not declared by this config, nor by the backup`,"settings.backup.noteRestoredFrom":`restored from {path}`,"settings.backups.policyTitle":`Policy`,"settings.backups.policyDescription":`How many archives the panel keeps, and the extra paths every one of them captures.`,"settings.backups.allow":`Allow backups`,"settings.backups.allowHint":`Off stops new archives; whatever is already on disk stays downloadable and restorable.`,"settings.backups.offTitle":`Backups are off`,"settings.backups.offText":`Nothing new is archived until this is back on. The archives below can still be downloaded, restored and deleted.`,"settings.backups.keep":`Keep`,"settings.backups.keepHint":`Older archives are pruned after each backup.`,"settings.backups.extraPaths":`Extra paths`,"settings.backups.extraPathsHint":`Comma separated, captured in every archive on top of what each workspace declares.`,"settings.backups.extraPathsPlaceholder":`{home}/myapp-data`,"settings.backups.archiveDirectory":`Archive directory`,"settings.backups.copyArchiveDirectory":`Copy the archive directory`,"settings.backups.changeDirectory":`Changing it is a file-level decision: edit {path}.`,"settings.backups.theSettingsFile":`the settings file`,"settings.backups.capturesTitle":`What a backup captures`,"settings.backups.capturesDescription":`Pick these in the create dialog. A workspace can be taken whole or only its settings, servers, secrets and declared data paths.`,"settings.backups.nothingSelectable":`Nothing is selectable yet.`,"settings.backups.fromOrigin":`from {origin}`,"settings.backups.notCaptured":`not captured`,"settings.backups.generatedSkipped":`generated directories skipped`,"settings.backups.included":`included`,"settings.backups.skipped":`skipped`,"settings.backups.workspacesNote":`This panel serves {count} workspaces; each is its own selectable entry.`,"settings.backups.archivesTitle":`Archives`,"settings.backups.archivesDescription":`Stored in the backup directory and downloadable at any time.`,"settings.backups.create":`Create backup…`,"settings.backups.restore":`Restore…`,"settings.backups.noArchives":`No archives yet`,"settings.backups.noArchivesEnabled":`Create one now to capture the panel and whichever workspaces you pick.`,"settings.backups.noArchivesDisabled":`Nothing has been archived yet, and backups are off.`,"settings.backups.encrypted":`encrypted`,"settings.backups.download":`Download`,"settings.backups.restoreAction":`Restore`,"settings.backups.confirmDelete":`Confirm delete`,"settings.backups.deleted":`Deleted {name}.`,"settings.backups.kindSettings":`settings`,"settings.backups.kindServers":`servers`,"settings.backups.kindSecrets":`secrets`,"settings.backups.kindTls":`tls`,"settings.backups.kindData":`data`,"settings.backups.kindWorkspace":`workspace`,"settings.ddns.statePending":`Waiting`,"settings.ddns.stateOk":`Updated`,"settings.ddns.stateUnchanged":`Current`,"settings.ddns.stateSkipped":`Skipped`,"settings.ddns.stateError":`Failed`,"settings.ddns.passFinished":`Dynamic DNS pass finished`,"settings.ddns.credentialsSaved":`Credentials saved for {account}`,"settings.ddns.credentialsRemoved":`Credentials removed for {account}`,"settings.ddns.loadErrorTitle":`Dynamic DNS settings could not be loaded`,"settings.ddns.title":`Dynamic DNS`,"settings.ddns.description":`Keep these hostnames pointed at this machine's public address. Credentials live in the secrets file, never in servers.config.json.`,"settings.ddns.checking":`checking`,"settings.ddns.needsAttention":`needs attention`,"settings.ddns.watching":`watching`,"settings.ddns.updateNow":`Update now`,"settings.ddns.enabled":`Keep dynamic DNS updated`,"settings.ddns.enabledHint":`A pass runs on the interval below; a provider is only called when the address actually changed.`,"settings.ddns.interval":`Check every (ms)`,"settings.ddns.intervalHint":`60000 is one minute; the default is five.`,"settings.ddns.ttl":`TTL (s)`,"settings.ddns.ttlHint":`1 means automatic where the provider supports it.`,"settings.ddns.detectIpv4":`Detect IPv4`,"settings.ddns.detectIpv4Hint":`Needed for A records.`,"settings.ddns.detectIpv6":`Detect IPv6`,"settings.ddns.detectIpv6Hint":`Needed for AAAA records.`,"settings.ddns.accountsTitle":`Provider accounts`,"settings.ddns.accountsDescription":`One entry per API token. Credentials are stored on the server and never come back.`,"settings.ddns.credentialsSet":`credentials saved`,"settings.ddns.noCredentials":`no credentials`,"settings.ddns.credentials":`Credentials`,"settings.ddns.removeAccountBlocked":`Remove the hostnames using this account first`,"settings.ddns.noAccounts":`No accounts yet. Pick a provider and add one.`,"settings.ddns.provider":`Provider`,"settings.ddns.accountId":`Account id`,"settings.ddns.accountIdPlaceholder":`cloudflare-home`,"settings.ddns.accountIdHint":"The account id names the account and keys its stored credentials; lowercase letters, digits, `-` and `_`.","settings.ddns.hostnamesTitle":`Hostnames`,"settings.ddns.hostnamesDescription":`The whole list to keep updated — suba.domain.com, domain.xyz and so on.`,"settings.ddns.account":`Account`,"settings.ddns.recordA":`A (IPv4)`,"settings.ddns.recordAaaa":`AAAA (IPv6)`,"settings.ddns.aaaaUnsupported":`This provider cannot manage AAAA records.`,"settings.ddns.proxied":`Proxied`,"settings.ddns.proxiedHint":`Cloudflare serves this record through its own network.`,"settings.ddns.ipv6Off":`IPv6 detection is off`,"settings.ddns.advanced":`Advanced`,"settings.ddns.advancedHint":`registered domain and TTL override`,"settings.ddns.registeredDomain":`Registered domain`,"settings.ddns.registeredDomainPlaceholder":`example.co.uk`,"settings.ddns.registeredDomainHint":`Only when the provider has to be told the apex, e.g. three-label domains.`,"settings.ddns.ttlOverride":`TTL override (s)`,"settings.ddns.ttlOverrideHint":`Blank uses the value above.`,"settings.ddns.noHostnames":`No hostnames yet.`,"settings.ddns.hostnamePlaceholder":`home.example.com`,"settings.ddns.lastPass":`Last pass`,"settings.ddns.ipv4Value":`IPv4 {address}`,"settings.ddns.ipv6Value":`IPv6 {address}`,"settings.ddns.type":`Type`,"settings.ddns.state":`State`,"settings.ddns.address":`Address`,"settings.ddns.detail":`Detail`,"settings.ddns.credentialsTitle":`Provider credentials`,"settings.ddns.credentialsDescription":`Saved fields are never sent back. Saving replaces every field for this account and runs a pass right away.`,"settings.ddns.optional":`Optional.`,"settings.ddns.whereToGet":`Where to get these`,"settings.ddns.forget":`Forget`,"settings.ddns.forgetConfirm":`Forget them`,"settings.ddns.forgetTitle":`Forget the stored credentials?`,"settings.ddns.forgetHint":`They are removed from disk and cannot be read back; you would need to paste them again.`,"settings.ddns.saveCredentials":`Save credentials`,"settings.defaults.title":`Server defaults`,"settings.defaults.description":`Applied to every entry that does not set its own value.`,"settings.defaults.enabledHint":`New entries start enabled.`,"settings.defaults.autostart":`Autostart with the panel`,"settings.defaults.bind":`Bind`,"settings.defaults.bindLocal":`Local — 127.0.0.1`,"settings.defaults.bindLan":`LAN — 0.0.0.0`,"settings.defaults.onPortConflict":`On port conflict`,"settings.defaults.conflictBlock":`Block the start`,"settings.defaults.conflictWarn":`Warn and start anyway`,"settings.defaults.conflictFollow":`Follow a detached restart of itself`,"settings.defaults.conflictReclaim":`Replace a detached restart with a supervised copy`,"settings.defaults.conflictKill":`Kill whatever holds the port`,"settings.defaults.logBufferLines":`Log buffer lines`,"settings.defaults.logBufferLinesHint":`Kept in memory per server.`,"settings.host.title":`Thresholds`,"settings.host.description":`A threshold of 0 disables that alert. Breaches notify once, and once more on recovery.`,"settings.host.enabled":`Sample this machine`,"settings.host.enabledHint":`Load, memory, swap, disk and CPU temperature, on the interval below.`,"settings.host.interval":`Interval (ms)`,"settings.host.intervalHint":`How often the host is sampled and alerts are checked.`,"settings.host.diskPaths":`Disk paths`,"settings.host.diskPathsHint":`Comma separated; templates like {home} are expanded.`,"settings.host.diskUsed":`Disk used (%)`,"settings.host.memoryUsed":`Memory used (%)`,"settings.host.swapUsed":`Swap used (%)`,"settings.host.zeroDisables":`0 disables the alert.`,"settings.host.loadPerCpu":`Load per CPU`,"settings.host.loadPerCpuHint":`1-minute load average divided by the core count.`,"settings.host.tempCelsius":`CPU temperature (°C)`,"settings.host.tempCelsiusHint":`Linux only; ignored where the OS does not expose it.`,"settings.host.breachingNow":`Breaching now:`,"settings.host.nothingBreaching":`Nothing is breaching right now.`,"settings.interface.title":`Interface`,"settings.interface.description":`The panel is a static site: keep the stock one, or serve your own build from the state directory.`,"settings.interface.currentlyServing":`Currently serving`,"settings.interface.copyDirectory":`Copy the UI directory`,"settings.interface.fileCount":`{count} files`,"settings.interface.sourceStock":`stock`,"settings.interface.sourceCustom":`custom`,"settings.interface.unnamed":`unnamed`,"settings.interface.panelVersion":`Panel version`,"settings.interface.copyPanelVersion":`Copy the panel version`,"settings.interface.panelVersionHint":`The release this panel process is running — {command} prints the same number.`,"settings.interface.panelName":`Panel name`,"settings.interface.panelNameHint":`Shown in the sidebar by the stock UI. A custom UI may show its own name instead.`,"settings.interface.uploadLabel":`Upload a UI build (.zip with an index.html)`,"settings.interface.docsHint":`See {docs} for the API contract. If a custom UI breaks the panel, {command} puts the stock one back from the terminal.`,"settings.interface.resetName":`Reset name`,"settings.interface.confirmRevert":`Confirm revert`,"settings.interface.revertToStock":`Revert to stock`,"settings.interface.install":`Install UI`,"settings.interface.installed":`UI replaced with {name} — refresh the page`,"settings.interface.yourBuild":`your build`,"settings.interface.restored":`stock UI restored — refresh the page`,"settings.interface.nothingInstalled":`no custom UI was installed`,"settings.listener.title":`Listener`,"settings.listener.description":`Where the panel answers. Moving this restarts the panel and sends this page to the new address.`,"settings.listener.port":`Control port`,"settings.listener.portHint":`Default 3999.`,"settings.listener.bind":`Bind`,"settings.listener.bindLocal":`Local`,"settings.listener.bindLan":`LAN`,"settings.listener.bindCustom":`Custom`,"settings.listener.bindLanHint":`0.0.0.0 — reachable from the whole network.`,"settings.listener.bindLocalHint":`127.0.0.1 — this machine only.`,"settings.listener.bindCustomHint":`A specific interface address you type in below.`,"settings.listener.ipv4":`IPv4 address`,"settings.listener.ipv4Placeholder":`192.168.1.20`,"settings.listener.ipv4Error":`Enter an IPv4 address, for example 192.168.1.20.`,"settings.listener.ipv4Hint":`Binding beyond 127.0.0.1 needs a real password.`,"settings.listener.openBrowser":`Open a browser when the panel comes up`,"settings.listener.liveAddress":`Live address`,"settings.listener.restartRequired":`restart required`,"settings.listener.copyLiveAddress":`Copy the live address`,"settings.listener.liveAddressHint":`What the listener is bound to right now; saved changes take effect after the panel rebinds.`,"settings.logs.title":`Retention`,"settings.logs.description":`The live view always comes from memory; these files survive a restart and feed the Logs page.`,"settings.logs.persist":`Keep logs on disk`,"settings.logs.persistHint":`Turn off to hold everything in memory only.`,"settings.logs.maxBytes":`Rotate at (bytes)`,"settings.logs.maxBytesHint":`Per server, before rolling to .1, .2, …`,"settings.logs.keep":`Keep rotated files`,"settings.logs.directory":`Logs directory`,"settings.logs.copyDirectory":`Copy the logs directory`,"settings.logs.browseHint":`Browse and download these files on the {logs} page.`,"settings.paths.dataRoot":`Data root`,"settings.paths.dataRootHint":`HHOSTED_HOME — global settings, workspaces, TLS, backups and the UI.`,"settings.paths.globalSettings":`Global settings`,"settings.paths.globalSettingsHint":`settings.json — listener, auth, TLS policy, host vitals, backups.`,"settings.paths.projectDir":`Project directory`,"settings.paths.projectDirHint":`Base for relative entry paths.`,"settings.paths.panelAddress":`Panel address`,"settings.paths.panelAddressHint":`Where this control panel is live right now.`,"settings.paths.serversConfig":`Servers config`,"settings.paths.serversConfigHint":`{label}'s servers.config.json.`,"settings.paths.workspaceSettings":`Workspace settings`,"settings.paths.workspaceSettingsHint":`Server defaults, log retention, notifications, DDNS.`,"settings.paths.logs":`Logs`,"settings.paths.logsHint":`Persisted output for this workspace.`,"settings.paths.copyPath":`Copy {label}`,"settings.paths.whereThingsLive":`Where things live`,"settings.paths.whereThingsLiveDescription":`Read-only. Copy a path straight into a shell or an editor.`,"settings.paths.workspaceFiles":`Workspace files`,"settings.paths.workspaceFilesDescription":`Each workspace owns its config, settings and log directory; nothing is shared between them.`,"settings.rebind.failed":`The control panel did not answer on {target}. Check the console for the new listener.`,"settings.restore.title":`Restore a backup`,"settings.restore.description":`Nothing is written until the plan is applied.`,"settings.restore.archive":`Archive`,"settings.restore.archiveHint":`A stored archive, or a .zip from this machine.`,"settings.restore.encryptedName":`{name} — encrypted`,"settings.restore.uploadOption":`Upload a file…`,"settings.restore.archiveFile":`Archive file (.zip)`,"settings.restore.unchangedTitle":`Nothing has changed yet`,"settings.restore.archiveLine":`Archive {name}.`,"settings.restore.uploadedArchive":`The uploaded archive.`,"settings.restore.passwordProtected":`This backup is password-protected.`,"settings.restore.password":`Password`,"settings.restore.checkAgain":`Check again with the password`,"settings.restore.choosePrompt":`Choose what to restore — {selected} of {total} selected.`,"settings.restore.willRestore":`Will restore: {items}.`,"settings.restore.skipped":`Skipped: {items}.`,"settings.restore.nothing":`nothing`,"settings.restore.restartNote":`The panel's own settings differ, so restart the panel afterwards.`,"settings.restore.reloadedNote":`Restored workspaces are reloaded immediately; entries marked autostart start on their own.`,"settings.restore.applyStored":`Apply this restore`,"settings.restore.applyUpload":`Restore the upload`,"settings.restore.restored":`Restored {count} item(s).`,"settings.restore.restoredWithNotes":`Restored {count} item(s) — {notes}.`,"settings.restore.noteReloaded":`the restored servers are live, autostart entries starting`,"settings.restore.noteRestart":`restart the panel to apply its own settings`,"settings.restore.reasonSymbolicLink":`symbolic link, skipped`,"settings.restore.reasonNotSelected":`not selected`,"settings.restore.reasonUnrestorable":`cannot be restored here`,"settings.restore.reasonInvalidSettings":`the archive's settings are not valid`,"settings.restore.reasonInvalidServers":`the archive's servers are not valid`,"settings.shell.noUnsavedChanges":`No unsaved changes`,"settings.shell.discard":`Discard changes`,"settings.shell.save":`Save settings`,"settings.shell.unsavedTitle":`Unsaved changes`,"settings.shell.nothingToSave":`Nothing to save.`,"settings.telegram.title":`Telegram`,"settings.telegram.description":`Policy lives in the config; the bot token is a secret and never comes back from the server.`,"settings.telegram.enabled":`Send notifications`,"settings.telegram.enabledHint":`One message per event, throttled by the cooldown below.`,"settings.telegram.chatId":`Chat id`,"settings.telegram.chatIdPlaceholder":`123456789 or @channel`,"settings.telegram.chatIdHint":`Use Detect chats to fill this from the bot's updates.`,"settings.telegram.cooldown":`Cooldown per event (ms)`,"settings.telegram.cooldownHint":`Per server and reason, so a flapping server cannot spam.`,"settings.telegram.onCrash":`Retries exhausted`,"settings.telegram.onUnhealthy":`Port unhealthy`,"settings.telegram.onForcedRestart":`Forced restart`,"settings.telegram.onRecovered":`Recovered`,"settings.telegram.onHost":`Host vitals breached`,"settings.telegram.onHostHint":`Disk, memory, swap, load and CPU temperature, per the thresholds under Host vitals.`,"settings.telegram.onDdns":`Dynamic DNS changed or failed`,"settings.telegram.onDdnsHint":`One message per pass that changed a record, and one for a pass that failed.`,"settings.telegram.botToken":`Bot token`,"settings.telegram.tokenSet":`token set`,"settings.telegram.noToken":`no token`,"settings.telegram.tokenNote":`From @BotFather — a secret, never in servers.config.json.`,"settings.telegram.tokenPlaceholder":`123456789:AA…`,"settings.telegram.tokenSavedPlaceholder":`Saved — type a new token to replace it`,"settings.telegram.saveToken":`Save token`,"settings.telegram.detectChats":`Detect chats`,"settings.telegram.sendTest":`Send test`,"settings.telegram.removeToken":`Remove token`,"settings.telegram.removeTokenConfirm":`Confirm remove`,"settings.telegram.removeTokenTitle":`Remove the bot token?`,"settings.telegram.removeTokenHint":`Notifications stop until you paste a token again.`,"settings.telegram.tokenSaved":`Token saved.`,"settings.telegram.tokenSavedFor":`Token saved for @{username}.`,"settings.telegram.tokenRemoved":`Token removed.`,"settings.telegram.noChats":`No chats found. Send /start to the bot first, then detect again.`,"settings.telegram.testSent":`Test message sent.`,"settings.telegram.testFailed":`The test message failed.`,"settings.telegram.chatsSeen":`Chats the bot has seen:`,"settings.telegram.lastSend":`Last send: {result}`,"settings.tls.title":`HTTPS`,"settings.tls.description":`Upload a PEM pair and the panel serves TLS on its own listener. A self-signed certificate is fine on a home network.`,"settings.tls.serve":`Serve the panel over HTTPS`,"settings.tls.serveHint":`Saved with Save settings; the panel rebinds and this page follows it.`,"settings.tls.certificateTitle":`Certificate`,"settings.tls.certificateDescription":`PEM-encoded certificate and its private key. Both stay in the secrets file.`,"settings.tls.unusableTitle":`The stored certificate cannot be used`,"settings.tls.subject":`Subject`,"settings.tls.issuer":`Issuer`,"settings.tls.validUntil":`Valid until`,"settings.tls.days":`{count} days`,"settings.tls.privateKey":`Private key`,"settings.tls.keyMatches":`matches the certificate`,"settings.tls.keyMismatch":`does not match`,"settings.tls.fingerprint":`Fingerprint`,"settings.tls.copyFingerprint":`Copy the fingerprint`,"settings.tls.noCertificateTitle":`No certificate uploaded`,"settings.tls.noCertificateText":`Upload a PEM certificate and key below, then save. HTTPS is not served until a certificate is present.`,"settings.tls.certFile":`Certificate file (.pem, .crt)`,"settings.tls.keyFile":`Private key file (.pem, .key)`,"settings.tls.pasteCertificate":`Or paste the certificate`,"settings.tls.pasteKey":`Or paste the private key`,"settings.tls.saveCertificate":`Save certificate`,"settings.tls.removeCertificate":`Remove certificate`,"settings.tls.confirmRemove":`Confirm remove`,"settings.tls.removeTitle":`Remove the certificate?`,"settings.tls.removeHint":`TLS stays on but has nothing to serve, so the panel falls back to http once the listener rebinds.`,"settings.tls.stored":`Certificate stored.`,"settings.tls.removed":`Certificate removed.`,"status.stopped":`Stopped`,"status.starting":`Starting`,"status.running":`Running`,"status.stopping":`Stopping`,"status.backoff":`Restarting`,"status.crashed":`Crashed`,"status.conflict":`Port conflict`,"theme.label":`Theme: {theme}`,"theme.light":`light`,"theme.dark":`dark`,"theme.system":`system`,"topbar.search":`Search or run a command`,"topbar.openNavigation":`Open navigation`,"topbar.commandPalette":`Command palette`,"topbar.account":`Account`,"topbar.signedIn":`Signed in`,"topbar.signOut":`Sign out`,"topbar.workspaceLabel":`Workspace: {name}`,"validation.port":`Port must be a whole number between 1 and 65535.`,"validation.idRequired":`An id is required — it is the key this server lives under.`,"validation.idPattern":`The id must start with a lowercase letter or digit and contain only lowercase letters, digits, dashes and underscores.`,"validation.commandRequired":`A command is required — the executable the supervisor spawns.`,"validation.bootstrapCommand":`A bootstrap needs a command to run.`,"views.actions.addAServer":`Add a server`,"views.actions.addServer":`Add server`,"views.actions.startAll":`Start all`,"views.actions.stopAll":`Stop all`,"views.common.thisWorkspace":`this workspace`,"views.globalOverview.configError":`The config could not be read: {error}`,"views.globalOverview.degraded":`degraded`,"views.globalOverview.description":`Host vitals and every server from every workspace, grouped by where it lives.`,"views.globalOverview.emptyDescription":`Pick a workspace in the header and add the first process it should keep alive.`,"views.globalOverview.emptyTitle":`No servers anywhere yet`,"views.globalOverview.groupEmptyDescription":`Add one and it will show up here and on the workspace page.`,"views.globalOverview.groupRunning":`{running}/{total} running`,"views.globalOverview.hostUptime":`Host uptime`,"views.globalOverview.hostVitals":`Host vitals`,"views.globalOverview.hostVitalsNote":`This machine, shared by every workspace.`,"views.globalOverview.openWorkspace":`Open workspace`,"views.globalOverview.panelUptime":`Panel uptime`,"views.globalOverview.samplingOff":`sampling off`,"views.globalOverview.samplingOn":`sampling on`,"views.globalOverview.serversTotal":`{count} servers in total`,"views.globalOverview.serving":`serving`,"views.globalOverview.workspaces":`Workspaces`,"views.globalSettings.authenticationDescription":`Who may sign in to this panel, and how a session is trusted.`,"views.globalSettings.backupsDescription":`One archive per capture, covering the panel and any workspace you pick.`,"views.globalSettings.changesDescription":`What Save would write to the panel's settings file.`,"views.globalSettings.description":`Listener, access, host vitals, backups, TLS and paths for this panel — shared by every workspace.`,"views.globalSettings.hostDescription":`Alert thresholds for this machine's own resources.`,"views.globalSettings.interfaceDescription":`Serve your own panel UI instead of the stock one.`,"views.globalSettings.languageDescription":`The language this panel is shown in, for this browser.`,"views.globalSettings.languageNote":`Your choice is kept in this browser and applies to the login page too. It does not change the panel's own log output or its API messages.`,"views.globalSettings.listenerDescription":`Where the control panel listens and how it announces itself.`,"views.globalSettings.loadErrorTitle":`Some file-only values could not be loaded`,"views.globalSettings.navLabel":`Global settings sections`,"views.globalSettings.pathsDescription":`Where home-hosted keeps its files, globally and per workspace.`,"views.globalSettings.saveFailed":`The settings could not be saved.`,"views.globalSettings.saved":`Settings saved.`,"views.globalSettings.savedRebinding":`Settings saved — the panel is moving to a new address.`,"views.globalSettings.savedToast":`Settings saved`,"views.globalSettings.sectionAuthentication":`Authentication`,"views.globalSettings.sectionBackups":`Backups`,"views.globalSettings.sectionHost":`Host vitals`,"views.globalSettings.sectionInterface":`Interface`,"views.globalSettings.sectionListener":`Listener`,"views.globalSettings.sectionPaths":`Paths`,"views.globalSettings.sectionTls":`TLS`,"views.globalSettings.title":`Global settings`,"views.globalSettings.tlsDescription":`Serve the panel over HTTPS with your own certificate.`,"views.logs.allStreams":`All streams`,"views.logs.clear":`Clear`,"views.logs.clearDescription":`{server} — the file on disk is truncated. The process keeps running and new lines are written from here on.`,"views.logs.clearFile":`Clear file`,"views.logs.clearNote":`Download it first if the output is still needed — this cannot be undone from the panel.`,"views.logs.clearTitle":`Clear the persisted log file?`,"views.logs.fileEmpty":`The persisted file is empty.`,"views.logs.loadedLines":`loaded {count} lines`,"views.logs.modeLive":`Live stream`,"views.logs.modePersisted":`Persisted`,"views.logs.noServersDescription":`Add one and its output will be persisted here.`,"views.logs.noServersTitle":`No servers`,"views.logs.nothingOnDisk":`Nothing on disk for this server — persistence is off, or it has not written anything yet.`,"views.logs.nothingPersisted":`nothing persisted`,"views.logs.persistedSummary":`{workspace} · {persisted} of {total} servers on disk · {size}`,"views.logs.persistedTitle":`Persisted logs`,"views.logs.pickServerDescription":`Persisted output and live streams are per server. Choose one from the list.`,"views.logs.pickServerTitle":`Pick a server`,"views.logs.reload":`Reload`,"views.logs.retentionNote":`Rotation and retention are set under Workspace settings → Logs.`,"views.logs.searchAria":`Search the log`,"views.logs.searchPlaceholder":`search the tail window`,"views.logs.searchedLines":`searched {count} lines`,"views.logs.streamAria":`Stream`,"views.logs.tailAria":`Tail size`,"views.logs.waitingOutput":`Connected — waiting for output.`,"views.overview.acrossTree":`across the tree`,"views.overview.cpuNow":`{value}% cpu now`,"views.overview.crashedOrUnhealthy":`crashed or unhealthy`,"views.overview.description":`Live state of every server in this workspace, refreshed over a single event stream.`,"views.overview.emptyDescription":`Add the first process this workspace should keep alive.`,"views.overview.emptyTitle":`No servers in this workspace`,"views.overview.enabled":`{count} enabled`,"views.overview.longestUptime":`Longest uptime`,"views.overview.needsAttention":`Needs attention`,"views.overview.notUp":`{count} not up`,"views.overview.nothingBroken":`nothing is broken`,"views.overview.nothingRunning":`nothing running`,"views.overview.openFullList":`Open the full list`,"views.overview.peak":`peak {value}`,"views.overview.processMemory":`Process memory`,"views.overview.recentActivity":`Recent activity`,"views.overview.running":`Running`,"views.overview.sampling":`resource history is sampled every 5 s and kept for this session`,"views.overview.stopped":`Stopped`,"views.overview.workspaceLabel":`workspace {id}`,"views.route.server":`Server`,"views.serverDetail.allServers":`All servers`,"views.serverDetail.autostart":`Autostart with the panel`,"views.serverDetail.backToServers":`Back to servers`,"views.serverDetail.bind":`Bind`,"views.serverDetail.bindCustom":`{bind} — custom`,"views.serverDetail.bindLan":`0.0.0.0 — every interface`,"views.serverDetail.bindLocal":`127.0.0.1 — this machine only`,"views.serverDetail.closeEditor":`Close editor`,"views.serverDetail.copyJson":`Copy the JSON config`,"views.serverDetail.crashes24":`24h crashes`,"views.serverDetail.dependencies":`Dependencies`,"views.serverDetail.detached":`detached`,"views.serverDetail.detachedHint":`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`,"views.serverDetail.disableServer":`Disable server`,"views.serverDetail.editHint":`Edit every field of this entry`,"views.serverDetail.effectiveConfig":`Effective configuration`,"views.serverDetail.effectiveConfigNote":`Defaults from Settings are already merged into these values.`,"views.serverDetail.enableServer":`Enable server`,"views.serverDetail.eventHistory":`Event history`,"views.serverDetail.eventHistoryNote":`Kept by the panel for 24 hours.`,"views.serverDetail.fieldArgs":`args`,"views.serverDetail.fieldBackupPaths":`backup paths`,"views.serverDetail.fieldBootstrap":`bootstrap`,"views.serverDetail.fieldCommand":`command`,"views.serverDetail.fieldCwd":`cwd`,"views.serverDetail.fieldDataEnvs":`data envs`,"views.serverDetail.fieldDependsOn":`depends on`,"views.serverDetail.fieldEnv":`env`,"views.serverDetail.fieldEnvFile":`env file`,"views.serverDetail.fieldHealth":`health`,"views.serverDetail.fieldLogBuffer":`log buffer`,"views.serverDetail.fieldOnPortConflict":`on port conflict`,"views.serverDetail.fieldPortBind":`port · bind`,"views.serverDetail.fieldRestart":`restart`,"views.serverDetail.fieldRssLimit":`RSS limit`,"views.serverDetail.fieldStop":`stop`,"views.serverDetail.fields":`Fields`,"views.serverDetail.goneDescription":`{id} is not in servers.config.json any more. It may have been removed from another tab.`,"views.serverDetail.goneTitle":`That server is gone`,"views.serverDetail.health":`Health`,"views.serverDetail.healthProbe":`Health probe`,"views.serverDetail.lastCrash":`Last crash`,"views.serverDetail.lastProbe":`Last probe`,"views.serverDetail.logBufferLines":`{count} lines`,"views.serverDetail.memoryRss":`Memory (RSS)`,"views.serverDetail.moreActions":`More actions for {label}`,"views.serverDetail.neverWritten":`This server has not written anything yet.`,"views.serverDetail.nextAttempt":`Next attempt`,"views.serverDetail.none":`none`,"views.serverDetail.off":`off`,"views.serverDetail.persistent":`persistent`,"views.serverDetail.persistentHint":"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only Stop does.","views.serverDetail.pid":`PID`,"views.serverDetail.portFree":`free`,"views.serverDetail.portInUse":`in use`,"views.serverDetail.portState":`Port state`,"views.serverDetail.probeFailed":`The health probe has not passed.`,"views.serverDetail.probeFailedFor":`The health probe has not passed for {duration}.`,"views.serverDetail.processes":`Processes`,"views.serverDetail.rawJson":`Raw JSON`,"views.serverDetail.removeAutostart":`Remove from autostart`,"views.serverDetail.removeDescription":`{label} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,"views.serverDetail.removeNote":`This cannot be undone from the panel — the entry has to be added back by hand or from a backup.`,"views.serverDetail.removeServer":`Remove server`,"views.serverDetail.removeTitle":`Remove this server?`,"views.serverDetail.restart":`Restart`,"views.serverDetail.restarts":`Restarts`,"views.serverDetail.sectionConfig":`Configuration`,"views.serverDetail.sectionHistory":`History`,"views.serverDetail.sectionOutput":`Live output`,"views.serverDetail.start":`Start`,"views.serverDetail.startsOnItsOwn":`Starts on its own. Add ids under {code} to order it after other servers.`,"views.serverDetail.stop":`Stop`,"views.serverDetail.telemetry":`Telemetry`,"views.serverDetail.telemetryNote":`Sampled every 5 s while this page is open.`,"views.serverDetail.unhealthyFor":`Unhealthy for`,"views.serverDetail.uptime24":`24h uptime`,"views.serverDetail.waitingFirstLine":`Waiting for the first line…`,"views.servers.clearFilter":`Clear the filter`,"views.servers.clearFilters":`Clear filters`,"views.servers.description":`Every entry in {workspace}'s servers.config.json, with live resources, health and history.`,"views.servers.emptyDescription":`Add the first process this panel should supervise. Its command, args, env and working directory all live in the config file.`,"views.servers.emptyTitle":`No servers configured`,"views.servers.filterAll":`All`,"views.servers.filterAria":`Filter servers`,"views.servers.filterAttention":`Attention`,"views.servers.filterDisabled":`Disabled`,"views.servers.filterPlaceholder":`Filter by id, label, command or port`,"views.servers.filterRunning":`Running`,"views.servers.filterStopped":`Stopped`,"views.servers.noMatchDescription":`Try a different status or clear the search.`,"views.servers.noMatchTitle":`Nothing matches that filter`,"views.settings.changesDescription":`What Save would write to {workspace}'s settings.`,"views.settings.configErrorNote":`The panel keeps supervising with the config it already had; fixing the file reloads it on its own.`,"views.settings.configErrorTitle":`The workspace config could not be read`,"views.settings.configWarningTitle":`This workspace's config has a warning`,"views.settings.ddnsDescription":`Keep hostnames pointed at this machine's public address, whichever registrar holds them.`,"views.settings.defaultsDescription":`Applied to every entry in this workspace that does not set its own value.`,"views.settings.description":`Server defaults, log retention, notifications and dynamic DNS for {workspace}.`,"views.settings.logsDescription":`How much output this workspace keeps on disk and for how long.`,"views.settings.navLabel":`Workspace settings sections`,"views.settings.notificationsDescription":`Crash and health alerts for this workspace, sent to a Telegram chat.`,"views.settings.saveFailed":`The settings could not be saved.`,"views.settings.saved":`Workspace settings saved.`,"views.settings.savedToast":`Workspace settings saved`,"views.settings.sectionDdns":`Dynamic DNS`,"views.settings.sectionDefaults":`Server defaults`,"views.settings.sectionLogs":`Logs`,"views.settings.sectionNotifications":`Notifications`,"workspace.new":`New workspace`,"workspace.rename":`Rename workspace`,"workspace.create":`Create workspace`,"workspace.renameAction":`Rename`,"workspace.createHint":`Its own settings, servers, logs, secrets and backups entry — served by this same panel.`,"workspace.renameHint":`Only the name changes; the workspace id stays, so URLs and paths keep working.`,"workspace.nameHint":`Shown in the header.`,"workspace.nameHintId":`Shown in the header. Id: {id}`,"workspace.none":`No workspace`,"workspace.delete":`Delete workspace`,"days.remaining":{one:`{count} day`,other:`{count} days`},"editor.unsaved":{one:`unsaved change`,other:`unsaved changes`},"editor.saveChanges":{one:`Save {count} change`,other:`Save {count} changes`},"logs.lines":{one:`{count} line`,other:`{count} lines`},"palette.results":{one:`{count} result`,other:`{count} results`},"proxy.retry.inMinutes":{one:`~{count} minute`,other:`~{count} minutes`},"proxy.retry.inHours":{one:`~{count} hour`,other:`~{count} hours`},"servers.total":{one:`{count} server`,other:`{count} servers`},"servers.running":{one:`{count} running`,other:`{count} running`},"settings.backup.entriesCount":{one:`{count} entry`,other:`{count} entries`},"settings.backup.itemsSelected":{one:`{count} item selected`,other:`{count} items selected`},"settings.ddns.hostnameCount":{one:`{count} hostname`,other:`{count} hostnames`},"settings.shell.fieldsChanged":{one:`field changed`,other:`fields changed`},"settings.shell.saveChanges":{one:`Save {count} change`,other:`Save {count} changes`},"views.globalOverview.needLook":{one:`{count} server need a look`,other:`{count} servers need a look`},"views.logs.filesOnDisk":{one:`{count} file`,other:`{count} files`},"views.overview.needLook":{one:`{count} server need a look`,other:`{count} servers need a look`}},mP=/\{(\w+)\}/g;function hP(e,t){return`${e}:${t||`index`}`}function gP(e,t){if(e==null)return null;let n=SP(e,t);return n===void 0?null:n}function _P(e,t,n){if(n?.preserveExisting){bP(e,t);return}yP(e,t)}function vP(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yP(e,t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i===`__proto__`)continue;let a=t[i];if(typeof a!=`object`||!a||Array.isArray(a)){e[i]=a;continue}let o=e[i];typeof o==`object`&&o&&!Array.isArray(o)?yP(o,a):e[i]=a}}function bP(e,t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i===`__proto__`)continue;let a=t[i];if(!Object.prototype.hasOwnProperty.call(e,i)){e[i]=a;continue}let o=e[i];vP(a)&&vP(o)&&bP(o,a)}}function xP(e,t){return!t||e.indexOf(`{`)===-1?e:e.replace(mP,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)})}function SP(e,t){if(e==null||typeof t!=`string`||t.length===0)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(!t.includes(`.`))return;let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;let t=r;if(!Object.prototype.hasOwnProperty.call(t,e))return;r=t[e]}return r}function CP(e,t,n){if(typeof t!=`string`||t.length===0)return e;if(Object.prototype.hasOwnProperty.call(e,t)||!t.includes(`.`))return t===`__proto__`?e:{...e,[t]:n};let r=t.split(`.`);if(r.some(e=>e===`__proto__`))return e;let i={...e},a=i;for(let e of r.slice(0,-1)){let t=a[e],n=vP(t)?{...t}:{};a[e]=n,a=n}return a[r[r.length-1]]=n,i}function wP(e,t){let n=TP(e,t),r={};return EP(e,t,``,r),Object.keys(r).length===0?n:{...n,...r}}function TP(e,t){let n={...e};for(let e of Object.keys(t)){if(e===`__proto__`)continue;let r=t[e];if(r==null)continue;let i=n[e];n[e]=vP(r)&&vP(i)?TP(i,r):r}return n}function EP(e,t,n,r){for(let i of Object.keys(e)){if(i===`__proto__`)continue;let a=e[i];if(!vP(a))continue;let o=n?`${n}.${i}`:i,s=t[i];vP(s)?EP(a,s,o,r):s!=null&&DP(a,o,r)}}function DP(e,t,n){for(let r of Object.keys(e)){if(r===`__proto__`)continue;let i=e[r],a=`${t}.${r}`;vP(i)?DP(i,a,n):n[a]=i}}var OP=(e,t,n,r,i)=>{let a=i(e);if(!a)return null;let o=a.toString().split(`|`);if(o.length===0)return null;let s=t<o.length?o[t]:o[o.length-1];return s?xP(s.trim(),{...n,count:t}):null};function kP(e){if(!e)return``;let t=Object.keys(e).sort();if(t.length===0)return``;let n={};for(let r of t)n[r]=e[r];return JSON.stringify(n)}function AP(e,t){let n=kP(t);return n?`${e}\0${n}`:e}var jP=class{constructor(e={}){this.numberCache=new Map,this.dateCache=new Map,this.relativeCache=new Map,this.numberFormats=e.numberFormats??{},this.datetimeFormats=e.datetimeFormats??{}}setNumberFormats(e){this.numberFormats=e,this.numberCache.clear()}setDateTimeFormats(e){this.datetimeFormats=e,this.dateCache.clear()}getNumberFormats(){return this.numberFormats}getDateTimeFormats(){return this.datetimeFormats}clearCache(){this.numberCache.clear(),this.dateCache.clear(),this.relativeCache.clear()}resolveNumberFormat(e,t){return this.numberFormats[e]?.[t]??this.numberFormats[e.split(`-`)[0]]?.[t]}resolveDateTimeFormat(e,t){return this.datetimeFormats[e]?.[t]??this.datetimeFormats[e.split(`-`)[0]]?.[t]}getNumberFormatter(e,t){let n=AP(e,t),r=this.numberCache.get(n);return r||(r=new Intl.NumberFormat(e,t),this.numberCache.set(n,r)),r}getDateTimeFormatter(e,t){let n=AP(e,t),r=this.dateCache.get(n);return r||(r=new Intl.DateTimeFormat(e,t),this.dateCache.set(n,r)),r}getRelativeTimeFormatter(e,t){let n=AP(e,t),r=this.relativeCache.get(n);return r||(r=new Intl.RelativeTimeFormat(e,t),this.relativeCache.set(n,r)),r}formatNumber(e,t,n){return this.getNumberFormatter(t,n).format(e)}formatDate(e,t,n){let r=new Date(e);return Number.isNaN(r.getTime())?`Invalid Date`:this.getDateTimeFormatter(t,n).format(r)}formatRelativeTime(e,t,n){let r=new Date(e),i=this.getRelativeTimeFormatter(t,n);if(Number.isNaN(r.getTime()))return i.format(0,`second`);let a=Math.floor((Date.now()-r.getTime())/1e3);for(let{unit:e,seconds:t}of[{unit:`year`,seconds:31536e3},{unit:`month`,seconds:2592e3},{unit:`day`,seconds:86400},{unit:`hour`,seconds:3600},{unit:`minute`,seconds:60},{unit:`second`,seconds:1}]){let n=Math.floor(a/t);if(n>=1)return i.format(-n,e)}return i.format(0,`second`)}},MP=Symbol(`i18n-leaf-miss`),NP=new WeakMap;function PP(e){let t=NP.get(e);return t||(t={leafByChunk:new Map,generation:0},NP.set(e,t)),t}function FP(e){let t=e?.translations??new Map,n=PP(t),{leafByChunk:r}=n;function i(){n.generation++}function a(e){r.delete(e)}function o(){r.clear()}function s(e){let t=r.get(e);return t||(t=new Map,r.set(e,t)),t}function c(e,t,n){let i=r.get(e);if(i?.has(n)){let e=i.get(n);return e===MP?null:e}if(!t)return s(e).set(n,MP),null;let a=gP(t,n);return s(e).set(n,a===null?MP:a),a}function l(e,n){t.set(e,n),a(e),i()}function u(e,n){let r=t.get(e);if(!r){l(e,{...n});return}_P(r,n),a(e),i()}return{hasCache(e,n){return t.has(hP(e,n))},getCache(e,n){return t.get(hP(e,n))},setCache(e,t,n){r.set(hP(e,t),n)},getGeneration(){return n.generation},hasTranslation(e,n){let r=`${e}:`;for(let[e,i]of t)if(e.startsWith(r)&&gP(i,n)!==null)return!0;return!1},hasPageTranslation(e,n){return t.has(hP(e,n))},getTranslation(e,n,r){let i=hP(e,n);return c(i,t.get(i),r)},lookupIn:c,loadTranslations(e,t,n=`index`){u(hP(e,n),t)},setTranslations(e,t,n=`index`){l(hP(e,n),t)},loadPageTranslations(e,n,r){let i=hP(e,n),a=t.get(i);!a||Object.keys(a).length===0?l(i,{...r}):u(i,r)},mergeTranslation(e,t,n,r=!1){u(hP(e,t),n)},clearCache(){t.clear(),o(),i()}}}var IP=class{constructor(e={}){this.formatter=new jP,this.pinnedCacheKey=``,this.pinnedTree=null,this.pinnedGeneration=-1,this.helper=FP(e.storage);let t={numberFormats:e.numberFormats,datetimeFormats:e.datetimeFormats};this.formatter=new jP(t),this.pluralFunc=e.plural&&e.plural!==OP?(t,n,r,i,a)=>e.plural(t,n,r,i,a)??OP(t,n,r,i,a):OP,this.missingWarn=e.missingWarn??!0,this.missingHandler=e.missingHandler,this.getCustomMissingHandler=e.getCustomMissingHandler}touch(){}resolveRouteName(e){return typeof e==`string`?e:this.getRoute()}ensurePinnedChunk(e,t){let n=hP(e,t),r=this.helper.getGeneration();(this.pinnedCacheKey!==n||this.pinnedGeneration!==r)&&(this.pinnedCacheKey=n,this.pinnedGeneration=r,this.pinnedTree=this.helper.getCache(e,t)??null)}invalidatePin(){this.pinnedCacheKey=``,this.pinnedTree=null,this.pinnedGeneration=-1}resolveLookup(e,t){let n=this.getLocale(),r=this.resolveRouteName(t),i=typeof e==`string`?e:String(e),a=t===void 0||r===this.getRoute(),o;if(a?(this.ensurePinnedChunk(n,r),o=this.helper.lookupIn(this.pinnedCacheKey,this.pinnedTree,i)):o=this.helper.getTranslation(n,r,i),o!==null)return o;let s=this.getFallbackLocale();return n===s?null:this.helper.getTranslation(s,r,i)}resolveHas(e,t){let n=this.getLocale(),r=this.resolveRouteName(t),i=typeof e==`string`?e:String(e);return t===void 0||r===this.getRoute()?(this.ensurePinnedChunk(n,r),this.helper.lookupIn(this.pinnedCacheKey,this.pinnedTree,i)!==null):this.helper.getTranslation(n,r,i)!==null}resolveTranslationTree(e,t){return wP(e,t)}resolveTranslations(e){this.touch();let t=this.getLocale(),n=this.resolveRouteName(e),r=this.helper.getCache(t,n)??{},i=this.getFallbackLocale();if(i===t)return r;let a=this.helper.getCache(i,n);return a?this.resolveTranslationTree(a,r):r}onTranslationsChanged(){}getMissingContext(e){return{locale:this.getLocale(),routeName:this.resolveRouteName(e)}}warnDev(e){this.missingWarn}warnMissing(e,t){let{locale:n,routeName:r}=this.getMissingContext(t),i=this.getCustomMissingHandler?.();if(i){i(n,String(e),r);return}if(this.missingHandler){this.missingHandler(n,String(e),r);return}this.warnDev(`Not found '${e}' key in '${n}' locale messages for route '${r}'.`)}warnMissingFormat(e,t,n){this.warnDev(`Not found '${t}' ${e} format in '${n}' locale. Falling back to default Intl options.`)}t(e,t,n,r){if(!e)return``;if(this.touch(),t===void 0&&n===void 0&&r===void 0&&typeof e==`string`)return this.resolveLookup(e)??(this.warnMissing(e),e);let i=this.resolveLookup(e,r);return i==null?(this.warnMissing(e,r),n===void 0?e:n||e):typeof i!=`string`||!t?i:xP(i,t)}ts(e,t,n,r){return this.t(e,t,n,r)?.toString()??n??e}tc(e,t,n){this.touch();let{count:r,...i}=typeof t==`number`?{count:t}:t;return r===void 0?n??e:this.pluralFunc(e,Number.parseInt(r.toString(),10),i,this.getLocale(),(e,t,n)=>{let r=this.resolveLookup(e);return r==null?n===void 0?void 0:n||e:typeof r!=`string`||!t?r:xP(r,t)})??n??e}tn(e,t,n,r){this.touch();let i=this.resolveNumberFormatArgs(t,n,r);return this.formatter.formatNumber(e,i.locale,i.options)}td(e,t,n,r){this.touch();let i=this.resolveDateTimeFormatArgs(t,n,r);return this.formatter.formatDate(e,i.locale,i.options)}tdr(e,t){return this.touch(),this.formatter.formatRelativeTime(e,this.getLocale(),t)}has(e,t){return this.touch(),this.resolveHas(e,t)}setTranslation(e,t){let n=this.getLocale(),r=this.getRoute(),i=this.helper.getCache(n,r)??{};this.helper.setTranslations(n,CP(i,String(e),t),r),this.invalidatePin(),this.onTranslationsChanged()}clearCache(){this.helper.clearCache(),this.formatter.clearCache(),this.invalidatePin()}resolveNumberFormatArgs(e,t,n){if(typeof e!=`string`)return{locale:this.getLocale(),options:e};let r=this.getLocale(),i;typeof t==`string`?(r=t,i=n):i=t;let a=this.formatter.resolveNumberFormat(r,e);return a||this.warnMissingFormat(`number`,e,r),!a&&!i?{locale:r,options:void 0}:{locale:r,options:a?{...a,...i}:i}}resolveDateTimeFormatArgs(e,t,n){if(typeof e!=`string`)return{locale:this.getLocale(),options:e};let r=this.getLocale(),i;typeof t==`string`?(r=t,i=n):i=t;let a=this.formatter.resolveDateTimeFormat(r,e);return a||this.warnMissingFormat(`datetime`,e,r),!a&&!i?{locale:r,options:void 0}:{locale:r,options:a?{...a,...i}:i}}loadTranslationsCore(e,t,n,r=`index`){n?this.helper.mergeTranslation(e,r,t,!0):this.helper.setTranslations(e,t,r),this.invalidatePin()}loadRouteTranslationsCore(e,t,n,r){r?this.helper.mergeTranslation(e,t,n,!0):this.helper.loadPageTranslations(e,t,n),this.invalidatePin()}extend(e){return Object.assign(this,e)}},LP=Symbol(`i18n`),RP=Symbol(`i18n-locales`),zP=Symbol(`i18n-default-locale`),BP=Symbol(`i18n-router-strategy`),VP=N({name:`I18nGroup`,props:{prefix:{type:String,required:!0},groupClass:{type:String,default:``}},setup(e,{slots:t}){let n=Tr(LP);if(!n)throw Error(`[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.`);let r=(t,r)=>n.t(`${e.prefix}.${t}`,r,void 0,n.getRoute());return()=>ic(`div`,{class:[`i18n-group`,e.groupClass]},t.default?.({prefix:e.prefix,t:r}))}}),HP=N({name:`I18nLink`,props:{to:{type:[String,Object],required:!0},activeStyle:{type:Object,default:()=>({})},localeRoute:{type:Function,default:void 0}},setup(e,{slots:t}){let n=Tr(LP),r=Tr(BP,void 0);if(!n)throw Error(`[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.`);let i=W(()=>typeof e.to==`string`&&/^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(e.to)),a=W(()=>{if(i.value)return e.to;if(e.localeRoute){let t=e.localeRoute(e.to);return typeof t==`string`?t:t.path||`/`}if(!r?.resolvePath)return typeof e.to==`string`?e.to:e.to.path||`/`;let t=r.resolvePath(e.to,n.locale.value);return typeof t==`string`?t:t.path||`/`}),o=W(()=>i.value||!r?!1:r.getCurrentPath().replace(/#.*$/,``).replace(/\/$/,``)===a.value.replace(/#.*$/,``).replace(/\/$/,``)),s=W(()=>o.value?e.activeStyle:{});return()=>i.value?ic(`a`,{href:a.value,target:`_blank`,rel:`noopener noreferrer`,style:s.value},t.default?.()):r?.linkComponent?ic(r.linkComponent,{to:a.value,style:s.value},{default:t.default}):ic(`a`,{href:a.value,style:s.value,onClick:e=>{e.preventDefault(),r?r.push({path:a.value}):window.location.href=a.value}},t.default?.())}}),UP=N({name:`I18nSwitcher`,props:{customLabels:{type:Object,default:()=>({})},customWrapperStyle:{type:Object,default:()=>({})},customButtonStyle:{type:Object,default:()=>({})},customDropdownStyle:{type:Object,default:()=>({})},customItemStyle:{type:Object,default:()=>({})},customLinkStyle:{type:Object,default:()=>({})},customActiveLinkStyle:{type:Object,default:()=>({})},customDisabledLinkStyle:{type:Object,default:()=>({})},customIconStyle:{type:Object,default:()=>({})},locales:{type:Array,default:void 0},currentLocale:{type:[String,Function],default:void 0},getLocaleName:{type:Function,default:void 0},switchLocale:{type:Function,default:void 0},localeRoute:{type:Function,default:void 0}},setup(e,{slots:t}){let n=Tr(LP),r=Tr(BP,void 0),i=Tr(RP,void 0);if(!n)throw Error(`[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.`);if(!i&&!e.locales)throw Error(`[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop.`);let a=W(()=>e.locales||i||[]),o=W(()=>a.value.filter(e=>!e.disabled)),s=W(()=>e.currentLocale===void 0?n.locale.value:typeof e.currentLocale==`function`?e.currentLocale():e.currentLocale),c=W(()=>a.value.some(e=>e.code===s.value&&e.disabled)),l=W(()=>e.getLocaleName?e.getLocaleName()||null:a.value.find(e=>e.code===n.locale.value)?.displayName||null),u=k(!1),d=k(null),f=e=>{e&&(e.stopPropagation(),e.preventDefault()),u.value=!u.value},p=t=>e.customLabels[t.code]||t.displayName||t.code,m=W(()=>{let e=a.value.find(e=>e.code===s.value);return e?p(e):l.value||s.value}),h=async t=>{if(u.value=!1,await ir(),e.switchLocale){e.switchLocale(t);return}if(n.locale.value=t,!r)return;let i=r.getCurrentPath(),a=e.localeRoute?(()=>{let n=e.localeRoute(i,t);return typeof n==`string`?n:n.path||`/`})():r?.resolvePath?(()=>{let e=r.resolvePath(i,t);return typeof e==`string`?e:e.path||`/`})():i;r.push({path:a})},g={position:`relative`,display:`inline-block`,verticalAlign:`middle`},_={padding:`4px 12px`,fontSize:`16px`,cursor:`pointer`,backgroundColor:`#fff`,border:`1px solid #333`,transition:`background-color 0.3s ease`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},v={position:`absolute`,top:`100%`,left:`0`,zIndex:1e3,backgroundColor:`#fff`,border:`1px solid #333`,listStyle:`none`,padding:`0`,margin:`4px 0 0 0`,minWidth:`150px`,boxShadow:`0 2px 8px rgba(0,0,0,0.15)`},y={margin:`0`,padding:`0`},b={display:`block`,padding:`8px 12px`,color:`#333`,textDecoration:`none`,transition:`background-color 0.3s ease`,cursor:`pointer`},x={fontWeight:`bold`,color:`#007bff`,cursor:`not-allowed`},S={marginLeft:`8px`,display:`inline-block`,transition:`transform 0.3s ease`},C={transform:`rotate(180deg)`},w=e=>e?Array.isArray(e)?e:[e]:[],T=e=>{if(!u.value)return;let t=e.target;if(!t||!d.value)return;let n=d.value.contains(t),r=t.closest(`.i18n-switcher-button`)!==null;!n&&!r&&(u.value=!1)};return na(()=>{document.addEventListener(`click`,T)}),oa(()=>{document.removeEventListener(`click`,T)}),()=>{let n=[];t[`before-button`]&&n.push(...w(t[`before-button`]()));let i=[];if(t[`before-selected-locale`]&&i.push(...w(t[`before-selected-locale`]())),i.push(ic(`span`,m.value)),t[`after-selected-locale`]&&i.push(...w(t[`after-selected-locale`]())),i.push(ic(`span`,{style:{...S,...u.value?C:{},...e.customIconStyle}},`▼`)),n.push(ic(`button`,{class:`i18n-switcher-button`,style:{..._,...e.customButtonStyle,...c.value?e.customDisabledLinkStyle:{}},onClick:e=>{e.preventDefault(),e.stopPropagation(),f(e)},type:`button`,ariaHaspopup:!0,ariaExpanded:u.value},i)),t[`before-dropdown`]&&n.push(...w(t[`before-dropdown`]())),u.value){let i=[];t[`before-dropdown-items`]&&i.push(...w(t[`before-dropdown-items`]())),o.value.forEach(n=>{let a=[];t[`before-item`]&&a.push(...w(t[`before-item`]({locale:n})));let o=[];t[`before-link-content`]&&o.push(...w(t[`before-link-content`]({locale:n}))),o.push(p(n)),t[`after-link-content`]&&o.push(...w(t[`after-link-content`]({locale:n})));let c=typeof window<`u`?window.location.pathname:`/`,l=e.localeRoute?e.localeRoute(c,n.code):r?.resolvePath?r.resolvePath(c,n.code):c,u=typeof l==`string`?l:l.path||`#`,d=n.code===s.value;a.push(ic(`a`,{class:`switcher-locale-${n.code}`,href:typeof u==`string`?u:`#`,style:{...b,...d?x:{},...e.customLinkStyle,...d?e.customActiveLinkStyle:{}},onClick:e=>{e.preventDefault(),e.stopPropagation(),h(n.code)}},o)),t[`after-item`]&&a.push(...w(t[`after-item`]({locale:n}))),i.push(ic(`li`,{key:n.code,style:{...y,...e.customItemStyle}},a))}),t[`after-dropdown-items`]&&i.push(...w(t[`after-dropdown-items`]())),n.push(ic(`ul`,{class:`i18n-switcher-dropdown`,style:{...v,...e.customDropdownStyle}},i))}return t[`after-dropdown`]&&n.push(...w(t[`after-dropdown`]())),ic(`div`,{ref:d,class:`i18n-switcher-wrapper`,style:{...g,...e.customWrapperStyle}},n)}}}),WP=N({name:`I18nT`,inheritAttrs:!1,props:{keypath:{type:String,required:!0},plural:{type:[Number,String]},tag:{type:String,default:`span`},params:{type:Object,default:()=>({})},defaultValue:{type:String,default:``},html:{type:Boolean,default:!1},hideIfEmpty:{type:Boolean,default:!1},customPluralRule:{type:Function,default:null},number:{type:[Number,String]},date:{type:[Date,String,Number]},relativeDate:{type:[Date,String,Number]}},setup(e,{slots:t,attrs:n}){let r=Tr(LP);if(!r)throw Error(`[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.`);return()=>{let i={},a=r.getRoute(),o={...n};delete o.innerHTML;let s=t=>e.html?ic(e.tag,{...o,innerHTML:t}):ic(e.tag,o,t);if(e.number!==void 0){let t=Number(e.number),n=r.tn(t),i=r.t(e.keypath,{number:n,...e.params},void 0,a);return s(String(i??``))}if(e.date!==void 0){let t=r.td(e.date),n=r.t(e.keypath,{date:t,...e.params},void 0,a);return s(String(n??``))}if(e.relativeDate!==void 0){let t=r.tdr(e.relativeDate),n=r.t(e.keypath,{relativeDate:t,...e.params},void 0,a);return s(String(n??``))}if(e.plural!==void 0){let t=Number.parseInt(e.plural.toString(),10);return e.customPluralRule?s(e.customPluralRule(e.keypath,t,e.params,r.locale.value,(e,t,n)=>r.t(e,t,n,a))||``):s(r.tc(e.keypath,{count:t,...e.params}))}let c=(r.t(e.keypath,{...e.params,...i},void 0,a)??``).toString();if(e.hideIfEmpty&&!c.trim())return e.defaultValue??null;if(e.html)return s(c);if(t.default)return ic(e.tag,o,t.default({translation:c}));let l=[],u=0;for(let[e,n]of Object.entries(t)){if(e==="default")continue;let t=`{${e}}`,r=c.indexOf(t,u);r!==-1&&(r>u&&l.push(c.slice(u,r)),n&&l.push(ic(n)),u=r+t.length)}return u<c.length&&l.push(c.slice(u)),t.default?ic(e.tag,o,t.default({children:l})):l.length>0?ic(e.tag,o,l):ic(e.tag,o,c)}}}),GP=class extends IP{constructor(e){let t={translations:new Map};if(super({storage:t,plural:e.plural,missingWarn:e.missingWarn,missingHandler:e.missingHandler}),this.listeners=new Set,this.storage=t,this._locale=gn(e.locale),this._fallbackLocale=gn(e.fallbackLocale||e.locale),this._currentRoute=gn(`index`),this._revision=gn(0),e.messages)for(let[t,n]of Object.entries(e.messages))this.helper.loadTranslations(t,n)}get locale(){return this._locale}set locale(e){typeof e==`string`?this._locale.value=e:this._locale=e}get fallbackLocale(){return this._fallbackLocale}set fallbackLocale(e){typeof e==`string`?this._fallbackLocale.value=e:this._fallbackLocale=e}get currentRoute(){return this._currentRoute}setRoute(e){this._currentRoute.value=e}getLocale(){return this._locale.value}getFallbackLocale(){return this._fallbackLocale.value}getRoute(){return this._currentRoute.value}addTranslations(e,t,n=!0){super.loadTranslationsCore(e,t,n),this._revision.value++,this.notifyListeners()}addRouteTranslations(e,t,n,r=!0){super.loadRouteTranslationsCore(e,t,n,r),this._revision.value++,this.notifyListeners()}mergeTranslations(e,t,n){this.helper.mergeTranslation(e,t,n,!0),this._revision.value++,this.notifyListeners()}clearCache(){super.clearCache(),this._revision.value++,this.notifyListeners()}onTranslationsChanged(){this._revision.value++,this.notifyListeners()}subscribeToChanges(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}getStorage(){return this.storage}getRouteCache(){let e={};for(let[t,n]of this.storage.translations)e[t]=n;return e}};function KP(e){let{routingStrategy:t,locales:n,defaultLocale:r,...i}=e,a=new GP(i),o=null,s=t||null;return{global:a,setRoutingStrategy:e=>{s=e,o&&o.provide(BP,e)},install(e){o=e,e.provide(LP,a),s&&e.provide(BP,s),n&&e.provide(RP,n),r&&e.provide(zP,r),e.config.globalProperties.$t=(e,t,n,r)=>a.t(e,t,n,r),e.config.globalProperties.$ts=(e,t,n,r)=>a.ts(e,t,n,r),e.config.globalProperties.$tc=(e,t,n)=>a.tc(e,t,n),e.config.globalProperties.$tn=a.tn.bind(a),e.config.globalProperties.$td=a.td.bind(a),e.config.globalProperties.$tdr=a.tdr.bind(a),e.config.globalProperties.$has=(e,t)=>a.has(e,t),e.config.globalProperties.$i18n=a,e.component(`I18nT`,WP),e.component(`I18nLink`,HP),e.component(`I18nGroup`,VP),e.component(`I18nSwitcher`,UP)}}}var qP=[{code:`en`,iso:`en-US`,name:`English`},{code:`vi`,iso:`vi-VN`,name:`Tiếng Việt`},{code:`zh-CN`,iso:`zh-CN`,name:`简体中文`},{code:`ja`,iso:`ja-JP`,name:`日本語`},{code:`es`,iso:`es-ES`,name:`Español`},{code:`ko`,iso:`ko-KR`,name:`한국어`},{code:`ru`,iso:`ru-RU`,name:`Русский`},{code:`fr`,iso:`fr-FR`,name:`Français`},{code:`de`,iso:`de-DE`,name:`Deutsch`}],JP=`hh.locale`,YP=new Map(qP.map(e=>[e.code,e]));function XP(e){return YP.get(e)}function ZP(e){return YP.has(e)}function QP(e){if(e.length===0)return null;let t=e.toLowerCase(),n=qP.find(e=>e.code.toLowerCase()===t);if(n!==void 0)return n.code;let r=t.split(`-`)[0];return qP.find(e=>e.code.toLowerCase()===r||e.code.toLowerCase().split(`-`)[0]===r)?.code??null}function $P(e,t,n){return e.replace(/\{(\w+)\}/g,(e,r)=>{if(r===`count`)return String(n);let i=t[r];return i===void 0?e:String(i)})}var eF=new Map,tF=(e,t,n,r,i)=>{let a=i(e);if(a==null)return null;if(typeof a==`string`)return $P(a.split(`|`)[0].trim(),n??{},t);let o=eF.get(r);o===void 0&&(o=new Intl.PluralRules(r),eF.set(r,o));let s=a[o.select(t)]??a.other;return typeof s==`string`?$P(s,n??{},t):null},nF=`modulepreload`,rF=function(e){return`/`+e},iF={},aF=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=rF(t,n),t=s(t),t in iF)return;iF[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:nF,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},oF=Object.assign({"../../i18n/generated/en.json":fP}),sF=Object.assign({"../../i18n/generated/de.json":()=>aF(()=>import(`./de-CiT_tMnf.js`),[]),"../../i18n/generated/es.json":()=>aF(()=>import(`./es-JJDGEbt0.js`),[]),"../../i18n/generated/fr.json":()=>aF(()=>import(`./fr-CYIAuJgb.js`),[]),"../../i18n/generated/ja.json":()=>aF(()=>import(`./ja-DmykOijW.js`),[]),"../../i18n/generated/ko.json":()=>aF(()=>import(`./ko-C4EcOJB0.js`),[]),"../../i18n/generated/ru.json":()=>aF(()=>import(`./ru-Dlbre_Q1.js`),[]),"../../i18n/generated/vi.json":()=>aF(()=>import(`./vi-DhBWYY9I.js`),[]),"../../i18n/generated/zh-CN.json":()=>aF(()=>import(`./zh-CN-BI0ZDO_Y.js`),[])}),cF=KP({locale:`en`,fallbackLocale:`en`,defaultLocale:`en`,plural:tF,missingWarn:!1,messages:{en:Object.values(oF)[0]?.default??{}},locales:qP.map(e=>({...e}))}),lF=new Set([`en`]),uF=new Map;function dF(){try{let e=localStorage.getItem(JP);if(e!==null&&ZP(e))return e}catch{}return null}function fF(){let e=typeof navigator>`u`?[]:[...navigator.languages??[],navigator.language].filter(e=>typeof e==`string`);for(let t of e){let e=QP(t);if(e!==null)return e}return`en`}async function pF(e){if(lF.has(e))return;let t=uF.get(e);if(t!==void 0)return t;let n=sF[`../../i18n/generated/${e}.json`];if(n===void 0)return;let r=n().then(t=>{cF.global.addTranslations(e,t.default,!0),lF.add(e)}).finally(()=>uF.delete(e));return uF.set(e,r),r}function mF(e){typeof document<`u`&&(document.documentElement.lang=XP(e)?.iso??e)}async function hF(e){if(ZP(e)&&e!==cF.global.locale.value){try{await pF(e)}catch{return}cF.global.locale.value=e,mF(e);try{localStorage.setItem(JP,e)}catch{}}}async function gF(){let e=dF()??fF();try{await pF(e)}catch{mF(`en`);return}e!==`en`&&(cF.global.locale.value=e),mF(e)}function Y(e,t,n){let r=cF.global.t(e,t,n??null);return typeof r==`string`?r:String(r??``)}function _F(e,t,n){let r={...n,count:t},i=cF.global.resolveTranslations()[e];return i===void 0?Y(e,r,e):tF(e,t,r,vF(),()=>i)??Y(e,r,e)}function vF(){return cF.global.locale.value}function yF(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=yF(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function bF(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=yF(e))&&(r&&(r+=` `),r+=t);return r}var xF=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},SF=(e,t)=>({classGroupId:e,validator:t}),CF=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),wF=`-`,TF=[],EF=`arbitrary..`,DF=e=>{let t=AF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return kF(e);let n=e.split(wF);return OF(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?xF(i,t):t:i||TF}return n[e]||TF}}},OF=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=OF(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(wF):e.slice(t).join(wF),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},kF=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?EF+r:void 0})(),AF=e=>{let{theme:t,classGroups:n}=e;return jF(n,t)},jF=(e,t)=>{let n=CF();for(let r in e){let i=e[r];MF(i,n,r,t)}return n},MF=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];NF(i,t,n,r)}},NF=(e,t,n,r)=>{if(typeof e==`string`){PF(e,t,n);return}if(typeof e==`function`){FF(e,t,n,r);return}IF(e,t,n,r)},PF=(e,t,n)=>{let r=e===``?t:LF(t,e);r.classGroupId=n},FF=(e,t,n,r)=>{if(RF(e)){MF(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(SF(n,e))},IF=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];MF(o,LF(t,a),n,r)}},LF=(e,t)=>{let n=e,r=t.split(wF),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=CF(),n.nextPart.set(t,i)),n=i}return n},RF=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,zF=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},BF=`!`,VF=`:`,HF=[],UF=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),WF=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===VF){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(BF)?(c=s.slice(0,-1),l=!0):s.startsWith(BF)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return UF(t,l,c,u)};if(t){let e=t+VF,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):UF(HF,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},GF=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},KF=e=>({cache:zF(e.cacheSize),parseClassName:WF(e),sortModifiers:GF(e),postfixLookupClassGroupIds:qF(e),...DF(e)}),qF=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},JF=/\s+/,YF=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(JF),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+BF:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},XF=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=ZF(n))&&(i&&(i+=` `),i+=r);return i},ZF=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=ZF(e[r]))&&(n&&(n+=` `),n+=t);return n},QF=(e,...t)=>{let n,r,i,a,o=o=>(n=KF(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=YF(e,n);return i(e,a),a};return a=o,(...e)=>a(XF(...e))},$F=[],eI=e=>{let t=t=>t[e]||$F;return t.isThemeGetter=!0,t.themeKey=e,t},tI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,iI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,oI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,sI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,lI=e=>rI.test(e),uI=e=>!!e&&!Number.isNaN(Number(e)),dI=e=>!!e&&Number.isInteger(Number(e)),fI=e=>e.endsWith(`%`)&&uI(e.slice(0,-1)),pI=e=>iI.test(e),mI=()=>!0,hI=e=>aI.test(e)&&!oI.test(e),gI=()=>!1,_I=e=>sI.test(e),vI=e=>cI.test(e),yI=e=>!X(e)&&!Z(e),bI=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),xI=e=>II(e,BI,gI),X=e=>tI.test(e),SI=e=>II(e,VI,hI),CI=e=>II(e,HI,uI),wI=e=>II(e,WI,mI),TI=e=>II(e,UI,gI),EI=e=>II(e,RI,gI),DI=e=>II(e,zI,vI),OI=e=>II(e,GI,_I),Z=e=>nI.test(e),kI=e=>LI(e,VI),AI=e=>LI(e,UI),jI=e=>LI(e,RI),MI=e=>LI(e,BI),NI=e=>LI(e,zI),PI=e=>LI(e,GI,!0),FI=e=>LI(e,WI,!0),II=(e,t,n)=>{let r=tI.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},LI=(e,t,n=!1)=>{let r=nI.exec(e);return r?r[1]?t(r[1]):n:!1},RI=e=>e===`position`||e===`percentage`,zI=e=>e===`image`||e===`url`,BI=e=>e===`length`||e===`size`||e===`bg-size`,VI=e=>e===`length`,HI=e=>e===`number`,UI=e=>e===`family-name`,WI=e=>e===`number`||e===`weight`,GI=e=>e===`shadow`,KI=QF(()=>{let e=eI(`color`),t=eI(`font`),n=eI(`text`),r=eI(`font-weight`),i=eI(`tracking`),a=eI(`leading`),o=eI(`breakpoint`),s=eI(`container`),c=eI(`spacing`),l=eI(`radius`),u=eI(`shadow`),d=eI(`inset-shadow`),f=eI(`text-shadow`),p=eI(`drop-shadow`),m=eI(`blur`),h=eI(`perspective`),g=eI(`aspect`),_=eI(`ease`),v=eI(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[lI,`full`,`auto`,...w()],ee=()=>[dI,`none`,`subgrid`,Z,X],te=()=>[`auto`,{span:[`full`,dI,Z,X]},dI,Z,X],ne=()=>[dI,`auto`,Z,X],re=()=>[`auto`,`min`,`max`,`fr`,Z,X],ie=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ae=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],oe=()=>[`auto`,...w()],se=()=>[lI,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ce=()=>[s,lI,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],le=()=>[lI,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],E=()=>[e,Z,X],ue=()=>[...b(),jI,EI,{position:[Z,X]}],de=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],fe=()=>[`auto`,`cover`,`contain`,MI,xI,{size:[Z,X]}],pe=()=>[fI,kI,SI],me=()=>[``,`none`,`full`,l,Z,X],he=()=>[``,uI,kI,SI],ge=()=>[`solid`,`dashed`,`dotted`,`double`],_e=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ve=()=>[uI,fI,jI,EI],ye=()=>[``,`none`,m,Z,X],be=()=>[`none`,uI,Z,X],xe=()=>[`none`,uI,Z,X],D=()=>[uI,Z,X],Se=()=>[lI,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[pI],breakpoint:[pI],color:[mI],container:[pI],"drop-shadow":[pI],ease:[`in`,`out`,`in-out`],font:[yI],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[pI],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[pI],shadow:[pI],spacing:[`px`,uI],text:[pI],"text-shadow":[pI],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,lI,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[bI],columns:[{columns:[uI,`auto`,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[dI,`auto`,Z,X]}],basis:[{basis:[lI,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[uI,lI,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,uI,Z,X]}],shrink:[{shrink:[``,uI,Z,X]}],order:[{order:[dI,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ie(),`normal`]}],"justify-items":[{"justify-items":[...ae(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ae()]}],"align-content":[{content:[`normal`,...ie()]}],"align-items":[{items:[...ae(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ae(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ie()}],"place-items":[{"place-items":[...ae(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ae()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:oe()}],mx:[{mx:oe()}],my:[{my:oe()}],ms:[{ms:oe()}],me:[{me:oe()}],mbs:[{mbs:oe()}],mbe:[{mbe:oe()}],mt:[{mt:oe()}],mr:[{mr:oe()}],mb:[{mb:oe()}],ml:[{ml:oe()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:se()}],"inline-size":[{inline:[`auto`,...ce()]}],"min-inline-size":[{"min-inline":[`auto`,...ce()]}],"max-inline-size":[{"max-inline":[`none`,...ce()]}],"block-size":[{block:[`auto`,...le()]}],"min-block-size":[{"min-block":[`auto`,...le()]}],"max-block-size":[{"max-block":[`none`,...le()]}],w:[{w:[s,`screen`,...se()]}],"min-w":[{"min-w":[s,`screen`,`none`,...se()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...se()]}],h:[{h:[`screen`,`lh`,...se()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...se()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...se()]}],"font-size":[{text:[`base`,n,kI,SI]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,FI,wI]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,fI,X]}],"font-family":[{font:[AI,TI,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[uI,`none`,Z,CI]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ge(),`wavy`]}],"text-decoration-thickness":[{decoration:[uI,`from-font`,`auto`,Z,SI]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[uI,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[dI,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:de()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},dI,Z,X],radial:[``,Z,X],conic:[``,dI,Z,X]},NI,DI]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:me()}],"rounded-s":[{"rounded-s":me()}],"rounded-e":[{"rounded-e":me()}],"rounded-t":[{"rounded-t":me()}],"rounded-r":[{"rounded-r":me()}],"rounded-b":[{"rounded-b":me()}],"rounded-l":[{"rounded-l":me()}],"rounded-ss":[{"rounded-ss":me()}],"rounded-se":[{"rounded-se":me()}],"rounded-ee":[{"rounded-ee":me()}],"rounded-es":[{"rounded-es":me()}],"rounded-tl":[{"rounded-tl":me()}],"rounded-tr":[{"rounded-tr":me()}],"rounded-br":[{"rounded-br":me()}],"rounded-bl":[{"rounded-bl":me()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":he()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ge(),`hidden`,`none`]}],"divide-style":[{divide:[...ge(),`hidden`,`none`]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...ge(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[uI,Z,X]}],"outline-w":[{outline:[``,uI,kI,SI]}],"outline-color":[{outline:E()}],shadow:[{shadow:[``,`inner`,`none`,u,PI,OI]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":[`none`,d,PI,OI]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:he()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[uI,SI]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":[`none`,f,PI,OI]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[uI,Z,X]}],"mix-blend":[{"mix-blend":[..._e(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":_e()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[uI]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[uI]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:de()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ye()}],brightness:[{brightness:[uI,Z,X]}],contrast:[{contrast:[uI,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,PI,OI]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:[``,uI,Z,X]}],"hue-rotate":[{"hue-rotate":[uI,Z,X]}],invert:[{invert:[``,uI,Z,X]}],saturate:[{saturate:[uI,Z,X]}],sepia:[{sepia:[``,uI,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[uI,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[uI,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,uI,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[uI,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,uI,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[uI,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[uI,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,uI,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[uI,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[uI,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":[`scale-3d`],skew:[{skew:D()}],"skew-x":[{"skew-x":D()}],"skew-y":[{"skew-y":D()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":[`translate-none`],zoom:[{zoom:[dI,Z,X]}],accent:[{accent:E()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...E()]}],"stroke-w":[{stroke:[uI,kI,SI,CI]}],stroke:[{stroke:[`none`,...E()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return KI(bF(e))}var qI={stopped:{labelKey:`status.stopped`,tone:`neutral`,transitional:!1},starting:{labelKey:`status.starting`,tone:`warn`,transitional:!0},running:{labelKey:`status.running`,tone:`ok`,transitional:!1},stopping:{labelKey:`status.stopping`,tone:`warn`,transitional:!0},backoff:{labelKey:`status.backoff`,tone:`warn`,transitional:!0},crashed:{labelKey:`status.crashed`,tone:`danger`,transitional:!1},conflict:{labelKey:`status.conflict`,tone:`danger`,transitional:!1}},JI={disabled:{labelKey:`health.disabled`,tone:`neutral`},unknown:{labelKey:`health.unknown`,tone:`neutral`},healthy:{labelKey:`health.healthy`,tone:`ok`},unhealthy:{labelKey:`health.unhealthy`,tone:`danger`}},YI={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},XI={ok:`bg-ok-soft text-ok border-ok/25`,warn:`bg-warn-soft text-warn border-warn/25`,danger:`bg-danger-soft text-danger border-danger/25`,info:`bg-info-soft text-info border-info/25`,neutral:`bg-hover text-muted border-line`,accent:`bg-accent-soft text-accent border-accent/25`},ZI={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,info:`bg-info`,neutral:`bg-faint`,accent:`bg-accent`};function QI(e,t){return e===`crashed`||e===`conflict`||t===`unhealthy`?`danger`:e===`starting`||e===`stopping`||e===`backoff`?`warn`:e===`running`?`ok`:`neutral`}var $I={start:`history.start`,exit:`history.exit`,crash:`history.crash`,"forced-restart":`history.forcedRestart`,unhealthy:`history.unhealthy`,recovered:`history.recovered`},eL={start:`ok`,exit:`neutral`,crash:`danger`,"forced-restart":`warn`,unhealthy:`warn`,recovered:`info`},tL={viewBox:`0 0 80 80`,class:`size-full -rotate-0`},nL=[`stroke-dasharray`],rL=[`stroke-dasharray`],iL={class:`absolute inset-0 grid place-items-center`},aL={class:`font-mono text-sm font-semibold tabular-nums text-ink`},oL={class:`text-2xs font-medium text-faint`},sL=34,cL=.75,lL=N({__name:`Gauge`,props:{value:{},label:{},display:{default:void 0},size:{default:74},tone:{default:void 0},warnAt:{default:75},dangerAt:{default:90}},setup(e){let t=e,n=2*Math.PI*sL,r=W(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(1,Math.max(0,t.value/100))*cL),i=W(()=>t.tone?t.tone:t.value===null||!Number.isFinite(t.value)?`neutral`:t.value>=t.dangerAt?`danger`:t.value>=t.warnAt?`warn`:`ok`),a={ok:`stroke-ok`,warn:`stroke-warn`,danger:`stroke-danger`,info:`stroke-info`,neutral:`stroke-faint`,accent:`stroke-accent`};return(e,o)=>(L(),R(`div`,{class:D(A(Q)(`flex flex-col items-center gap-1`))},[B(`div`,{class:`relative`,style:_e({width:`${t.size}px`,height:`${t.size}px`})},[(L(),R(`svg`,tL,[B(`circle`,{cx:`40`,cy:`40`,r:sL,fill:`none`,class:`stroke-line-soft`,"stroke-width":6,"stroke-dasharray":`${cL*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,8,nL),B(`circle`,{cx:`40`,cy:`40`,r:sL,fill:`none`,class:D([a[i.value],`transition-[stroke-dasharray] duration-300 ease-out`]),"stroke-width":6,"stroke-dasharray":`${r.value*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,10,rL)])),B(`div`,iL,[B(`span`,aL,O(t.display??(t.value===null?`—`:`${Math.round(t.value)}%`)),1)])],4),B(`span`,oL,O(t.label),1)],2))}}),uL=N({__name:`Meter`,props:{value:{},warnAt:{default:75},dangerAt:{default:90},height:{default:`h-1.5`},class:{default:void 0}},setup(e){let t=e,n=W(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(100,Math.max(0,t.value))),r=W(()=>t.value===null?`neutral`:t.value>=t.dangerAt?`danger`:t.value>=t.warnAt?`warn`:`ok`),i={ok:`bg-ok/80`,warn:`bg-warn/85`,danger:`bg-danger/85`,info:`bg-info/80`,neutral:`bg-faint/60`,accent:`bg-accent/80`};return(e,a)=>(L(),R(`div`,{class:D(A(Q)(`w-full overflow-hidden rounded-full bg-line-soft`,t.height,t.class))},[B(`div`,{class:D(A(Q)(`h-full rounded-full transition-[width] duration-300 ease-out`,i[r.value])),style:_e({width:`${n.value}%`})},null,6)],2))}}),dL={key:0,class:`grid size-10 place-items-center rounded-full border border-line bg-panel-2 text-faint`},fL={class:`max-w-sm space-y-1`},pL={class:`text-sm font-medium text-ink`},mL={key:0,class:`text-xs leading-relaxed text-muted`},hL={key:1,class:`flex items-center gap-2`},gL=N({__name:`EmptyState`,props:{title:{},description:{default:void 0},compact:{type:Boolean,default:!1}},setup(e){return(e,t)=>(L(),R(`div`,{class:D(A(Q)(`flex flex-col items-center justify-center gap-3 text-center`,e.$props.compact?`px-4 py-8`:`px-6 py-14`))},[e.$slots.icon?(L(),R(`div`,dL,[F(e.$slots,`icon`)])):U(``,!0),B(`div`,fL,[B(`p`,pL,O(e.$props.title),1),e.$props.description?(L(),R(`p`,mL,O(e.$props.description),1)):U(``,!0)]),e.$slots.action?(L(),R(`div`,hL,[F(e.$slots,`action`)])):U(``,!0)],2))}});function _L(e){return e===null||!Number.isFinite(e)?`—`:`${(e*100).toFixed(e>=.999?0:1)}%`}var vL={span:(e,t,n)=>n===null?`${e}${t}`:`${e}${t} ${n.value}${n.unit}`,now:()=>`now`,ahead:(e,t)=>`in ${e}${t}`,ago:(e,t)=>`${e}${t} ago`,never:()=>`never`};function yL(e,t=vL){if(!Number.isFinite(e)||e<0)return`—`;let n=Math.floor(e/1e3);if(n<60)return t.span(n,`s`,null);let r=Math.floor(n/60);if(r<60)return t.span(r,`m`,{value:n%60,unit:`s`});let i=Math.floor(r/60);return i<24?t.span(i,`h`,{value:r%60,unit:`m`}):t.span(Math.floor(i/24),`d`,{value:i%24,unit:`h`})}function bL(e,t,n=vL){let r=Math.max(0,e-t);return r<1e3?n.now():r<6e4?n.ahead(Math.ceil(r/1e3),`s`):n.ahead(Math.ceil(r/6e4),`m`)}function xL(e,t,n=vL){if(e===null)return n.never();let r=Math.max(0,t-e);return r<6e4?n.ago(Math.floor(r/1e3),`s`):r<36e5?n.ago(Math.floor(r/6e4),`m`):r<864e5?n.ago(Math.floor(r/36e5),`h`):n.ago(Math.floor(r/864e5),`d`)}function SL(){return XP(vF())?.iso}var CL=new Map,wL=new Map,TL={s:`s`,m:`m`,h:`h`,d:`d`};function EL(){return vF()===`en`}function DL(){let e=SL(),t=EL()?`narrow`:`short`,n=`${e??``}:${t}`,r=CL.get(n);return r===void 0&&(r=new Intl.RelativeTimeFormat(e,{numeric:`always`,style:t}),CL.set(n,r)),r}function OL(e,t){if(EL())return`${e}${TL[t]}`;let n={s:`second`,m:`minute`,h:`hour`,d:`day`},r=SL(),i=`${r??``}:${t}`,a=wL.get(i);return a===void 0&&(a=new Intl.NumberFormat(r,{style:`unit`,unit:n[t],unitDisplay:`short`}),wL.set(i,a)),a.format(e)}function kL(e,t,n){return DL().format(n*e,{s:`second`,m:`minute`,h:`hour`,d:`day`}[t])}var AL={span:(e,t,n)=>n===null?OL(e,t):`${OL(e,t)} ${OL(n.value,n.unit)}`,now:()=>Y(`common.now`),ahead:(e,t)=>kL(e,t,1),ago:(e,t)=>kL(e,t,-1),never:()=>Y(`common.never`)};function jL(e){return yL(e,AL)}function ML(e,t){return bL(e,t,AL)}function NL(e,t){return xL(e,t,AL)}function PL(e){let t=new Date(e);return`${t.toLocaleTimeString(SL(),{hour12:!1})}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function FL(e){return new Date(e).toLocaleString(SL(),{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function IL(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`:`—`}function LL(e){if(e===null||!Number.isFinite(e))return`—`;let t=Math.abs(e);return t<1e3?`${e} B`:t<1e6?`${(e/1e3).toFixed(0)} kB`:t<1e9?`${(e/1e3/1e3).toFixed(1)} MB`:`${(e/1e3/1e3/1e3).toFixed(2)} GB`}function RL(e){return e===null||!Number.isFinite(e)?`—`:e>=100?`${Math.round(e)}%`:`${e.toFixed(1)}%`}function zL(e){return e===void 0?Y(`common.unset`):typeof e==`string`?e:JSON.stringify(e)}var BL={key:1,class:`space-y-4`},VL={class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},HL={class:`grid grid-cols-2 gap-x-4 gap-y-2 border-t border-line-soft pt-3 sm:grid-cols-4`},UL={class:`flex items-center gap-1 text-2xs text-faint`},WL={class:`font-mono text-xs text-ink`},GL={class:`text-2xs text-faint`},KL={class:`font-mono text-xs tabular-nums text-ink`},qL={class:`flex items-center gap-1 text-2xs text-faint`},JL={class:`font-mono text-xs text-ink`},YL={class:`flex items-center gap-1 text-2xs text-faint`},XL={class:`font-mono text-xs text-ink`},ZL={class:`space-y-2 border-t border-line-soft pt-3`},QL={class:`flex items-center gap-1.5 text-2xs font-medium text-faint`},$L={class:`flex items-baseline justify-between gap-2`},eR=[`title`],tR={class:`shrink-0 font-mono text-2xs tabular-nums text-faint`},nR={key:0,class:`space-y-1 rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2`},rR={class:`text-2xs font-medium text-danger`},iR=N({__name:`HostVitalsPanel`,props:{host:{},now:{}},setup(e){let t=e,n=W(()=>{let e=t.host;return e?(e.loadAvg[0]??0)/Math.max(1,e.cpus):null}),r=W(()=>t.host?.loadAvg.map(e=>e.toFixed(2)).join(` `)??`—`);return(e,i)=>!t.host||!t.host.enabled?(L(),z(gL,{key:0,compact:``,title:A(Y)(`host.samplingOff`),description:A(Y)(`host.samplingOffDescription`)},null,8,[`title`,`description`])):(L(),R(`div`,BL,[B(`div`,VL,[V(lL,{value:n.value===null?null:n.value/2*100,label:A(Y)(`host.loadPerCpu`),display:n.value===null?`—`:n.value.toFixed(2),size:72,"warn-at":70,"danger-at":100},null,8,[`value`,`label`,`display`]),V(lL,{value:t.host.memoryUsedPercent,label:A(Y)(`common.memory`),size:72},null,8,[`value`,`label`]),V(lL,{value:t.host.swapUsedPercent,label:A(Y)(`host.swap`),size:72,"warn-at":50},null,8,[`value`,`label`]),V(lL,{value:t.host.tempCelsius===null?null:t.host.tempCelsius/85*100,label:A(Y)(`host.cpuTemp`),display:t.host.tempCelsius===null?`n/a`:`${Math.round(t.host.tempCelsius)}°C`,size:72},null,8,[`value`,`label`,`display`])]),B(`dl`,HL,[B(`div`,null,[B(`dt`,UL,[V(A(Jv),{class:`size-3`}),H(O(A(Y)(`host.cpus`)),1)]),B(`dd`,WL,O(t.host.cpus),1)]),B(`div`,null,[B(`dt`,GL,O(A(Y)(`host.loadAverage`)),1),B(`dd`,KL,O(r.value),1)]),B(`div`,null,[B(`dt`,qL,[V(A(dy),{class:`size-3`}),H(O(A(Y)(`host.memoryUsed`)),1)]),B(`dd`,JL,O(t.host.memoryUsedPercent.toFixed(0))+`% `,1)]),B(`div`,null,[B(`dt`,YL,[V(A(Py),{class:`size-3`}),H(O(A(Y)(`host.sampled`)),1)]),B(`dd`,XL,O(A(NL)(t.host.sampledAt,t.now)),1)])]),B(`div`,ZL,[B(`p`,QL,[V(A(ny),{class:`size-3`}),H(O(A(Y)(`host.filesystems`)),1)]),(L(!0),R(I,null,P(t.host.disks,e=>(L(),R(`div`,{key:e.path,class:`space-y-1`},[B(`div`,$L,[B(`span`,{class:`truncate font-mono text-2xs text-muted`,title:e.path},O(e.path),9,eR),B(`span`,tR,O(A(IL)(e.totalBytes-e.freeBytes))+` / `+O(A(IL)(e.totalBytes))+` · `+O(e.usedPercent.toFixed(0))+`% `,1)]),V(uL,{value:e.usedPercent},null,8,[`value`])]))),128))]),t.host.alerts.length>0?(L(),R(`div`,nR,[B(`p`,rR,O(A(Y)(`host.thresholdsBreached`)),1),(L(!0),R(I,null,P(t.host.alerts,e=>(L(),R(`p`,{key:e,class:`text-2xs text-danger`},O(e),1))),128))])):U(``,!0)]))}}),aR={key:1,class:`flex flex-col`},oR={class:`min-w-0 flex-1`},sR={class:`flex items-baseline gap-1.5`},cR={class:`truncate text-xs font-medium text-ink`},lR=[`title`],uR={key:0,class:`text-muted`},dR={class:`shrink-0 pt-0.5 text-2xs text-faint`},fR=N({__name:`ActivityFeed`,props:{servers:{},now:{},limit:{default:12},serverId:{default:void 0}},setup(e){let t=e,n={start:_y,exit:jy,crash:Vv,"forced-restart":Sy,unhealthy:Ly,recovered:Hv},r=W(()=>{let e=[];for(let n of t.servers)if(t.serverId===void 0||n.id===t.serverId)for(let t of n.history.events)e.push({...t,label:n.config.label??n.id});return e.sort((e,t)=>t.ts-e.ts).slice(0,t.limit)});return(e,i)=>{let a=pa(`RouterLink`);return r.value.length===0?(L(),z(gL,{key:0,compact:``,title:A(Y)(`activity.emptyTitle`),description:A(Y)(`activity.emptyDescription`)},null,8,[`title`,`description`])):(L(),R(`ol`,aR,[(L(!0),R(I,null,P(r.value,(e,r)=>(L(),R(`li`,{key:`${e.serverId}-${e.ts}-${r}`,class:D([`flex items-start gap-2.5 border-line-soft py-2`,r>0&&`border-t`])},[(L(),z(ha(n[e.type]),{class:D(A(Q)(`mt-0.5 size-3.5 shrink-0`,A(YI)[A(eL)[e.type]]))},null,8,[`class`])),B(`div`,oR,[B(`p`,sR,[B(`span`,cR,O(A(Y)(A($I)[e.type])),1),V(a,{to:`/servers/${e.serverId}`,class:`truncate text-2xs text-muted hover:text-accent`},{default:j(()=>[H(O(e.label),1)]),_:2},1032,[`to`])]),B(`p`,{class:`mt-0.5 truncate font-mono text-2xs text-faint`,title:e.detail},[H(O(e.detail)+` `,1),e.runtimeMs===void 0?U(``,!0):(L(),R(`span`,uR,` · `+O(A(Y)(`activity.ran`,{duration:A(jL)(e.runtimeMs)})),1))],8,lR)]),B(`span`,dR,O(A(NL)(e.ts,t.now)),1)],2))),128))]))}}}),pR=[`restart`,`health`,`stop`];function mR(e,t){return JSON.stringify(hR(e))===JSON.stringify(hR(t))}function hR(e){if(Array.isArray(e))return e.map(hR);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!=null&&(t[n]=hR(r))}return t}return e??null}function gR(e,t,n=[]){let r={};for(let[i,a]of Object.entries(t)){if(n.includes(i)){let t=e[i]??{},n={};for(let[e,r]of Object.entries(a??{}))mR(t[e],r)||(n[e]=r);Object.keys(n).length>0&&(r[i]=n);continue}mR(e[i],a)||(r[i]=a)}return r}function _R(e,t){let n=e;return gR({...n,label:n.label??``},t,pR)}function vR(e,t=``){return typeof e!=`object`||!e||Array.isArray(e)?[{path:t,value:e}]:Object.entries(e).flatMap(([e,n])=>vR(n,t.length===0?e:`${t}.${e}`))}function yR(e,t){let n=new Map(vR(t).map(e=>[e.path,e.value]));return vR(e).map(e=>({path:e.path,from:n.get(e.path),to:e.value}))}function bR(e){let t=0;for(let n of Object.values(e))t+=typeof n==`object`&&n&&!Array.isArray(n)?bR(n):1;return t}async function xR(e,t=8e3){let n=Date.now()+t;for(;;){try{if((await fetch(`${e}/api/auth/session`,{cache:`no-store`})).ok)return!0}catch{}if(Date.now()>n)return!1;await new Promise(e=>setTimeout(e,250))}}var SR={enabled:!0,maxRetries:3,baseDelayMs:1e3,factor:2,maxDelayMs:3e4,resetAfterMs:6e4},CR={enabled:!0,mode:`port`,http:{path:`/`,method:`GET`,expectStatusBelow:400,expectBody:``},intervalMs:5e3,timeoutMs:1500,unhealthyThreshold:3,forceRestartAfterMs:0,startTimeoutMs:2e4},wR={signal:`SIGTERM`,killGroup:!0,graceMs:5e3,killPortHolders:!1};function TR(e){return{...e,http:{...e.http}}}function ER(){return{control:{label:`home-hosted`,port:3999,host:`local`,openBrowser:!1,tlsEnabled:!1},auth:{enabled:!1,sessionTtlMs:6048e5,cookieSecure:`auto`,trustProxy:`off`,maxLoginAttempts:5,lockoutMs:6e4},host:{enabled:!0,intervalMs:15e3,diskPaths:`.`,diskUsedPercent:90,memoryUsedPercent:90,swapUsedPercent:50,loadPerCpu:2,tempCelsius:85},backups:{enabled:!0,keep:5,includePaths:``}}}function DR(){return{defaults:{enabled:!0,autostart:!1,bind:`local`,onPortConflict:`block`,logBufferLines:500,restart:{...SR},health:TR(CR),stop:{...wR}},logs:{persist:!0,maxBytes:2e6,keep:3},telegram:{enabled:!1,chatId:``,cooldownMs:12e4,onCrash:!0,onUnhealthy:!0,onForcedRestart:!0,onRecovered:!1,onHost:!0,onDdns:!0}}}function OR(e){return e===`loopback`?`loopback`:e===`any`||e===!0}function kR(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:OR(e.trustProxy),maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function AR(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:e.trustProxy===`loopback`?`loopback`:e.trustProxy?`any`:`off`,maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function jR(e){return{label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,tlsEnabled:e.tls.enabled}}function MR(e){return{enabled:e.enabled,chatId:e.chatId,cooldownMs:e.cooldownMs,onCrash:e.onCrash,onUnhealthy:e.onUnhealthy,onForcedRestart:e.onForcedRestart,onRecovered:e.onRecovered,onHost:e.onHost,onDdns:e.onDdns??!0}}function NR(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function PR(e){return{enabled:e.enabled,intervalMs:e.intervalMs,diskPaths:e.diskPaths.join(`, `),diskUsedPercent:e.diskUsedPercent,memoryUsedPercent:e.memoryUsedPercent,swapUsedPercent:e.swapUsedPercent,loadPerCpu:e.loadPerCpu,tempCelsius:e.tempCelsius}}function FR(e){return{enabled:e.enabled,keep:e.keep,includePaths:e.includePaths.join(`, `)}}function IR(e,t){return gR(e,{...t,diskPaths:NR(t.diskPaths)})}function LR(e,t){return gR(e,{...t,includePaths:NR(t.includePaths)})}function RR(e,t){return gR({label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,auth:kR(e.auth),tls:{enabled:e.tls.enabled}},{label:t.control.label,port:t.control.port,host:t.control.host,openBrowser:t.control.openBrowser,auth:{...t.auth,trustProxy:OR(t.auth.trustProxy)},tls:{enabled:t.control.tlsEnabled}},[`auth`,`tls`])}function zR(e,t){return gR(e,t,[`restart`,`health`,`stop`])}function BR(e,t){return gR(e,t)}function VR(e,t){return gR({telegram:MR(e)},{telegram:{...t}},[`telegram`])}function HR(e,t){switch(t){case`control`:return{...e.control,auth:{...e.auth}};case`host`:return{...e.host};case`backups`:return{...e.backups}}}function UR(e,t){return t===`auth`?{...e.auth}:t===`tls`?e.control.tlsEnabled:{label:e.control.label,port:e.control.port,host:e.control.host,openBrowser:e.control.openBrowser}}function WR(e,t,n){return t!==void 0&&qR(t[n],UR(e,n))}function GR(e,t,n){t.control={...t.control??{},[n]:UR(e,n)}}function KR(e,t){switch(t){case`defaults`:return{...e.defaults,restart:{...e.defaults.restart},health:TR(e.defaults.health),stop:{...e.defaults.stop}};case`logs`:return{...e.logs};case`telegram`:return{...e.telegram}}}function qR(e,t){return e!==void 0&&JSON.stringify(e)!==JSON.stringify(t)}function JR(e,t){return e.label!==t.control.label||e.port!==t.control.port||e.host!==t.control.host||e.openBrowser!==t.control.openBrowser}function YR(e,t){return e.tls.enabled!==t.control.tlsEnabled}function XR(e,t){return bR(gR({...AR(e.auth)},{...t.auth}))>0}function ZR(e,t,n){return W({get:e,set:e=>{t(e===null||Number.isNaN(e)?n:e)}})}async function QR(e){if(!e.rebinding)return null;let t=e.targetUrl??e.control.url;return t.length===0||t===window.location.origin?null:await xR(t)?(window.location.replace(t),null):Y(`settings.rebind.failed`,{target:t})}function $R(e){return e.split(`
40
40
  `).map(e=>e.trim()).filter(e=>e.length>0)}function ez(e){return Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
41
41
  `)}function tz(e){let t={};for(let n of $R(e)){let e=n.indexOf(`=`);e<=0||(t[n.slice(0,e).trim()]=n.slice(e+1).trim())}return t}function nz(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}var rz=/^[a-z0-9][a-z0-9_-]*$/;function iz(e){return{id:``,label:``,command:``,args:``,cwd:``,port:null,bind:e?.bind??`local`,autostart:e?.autostart??!1,persistent:!1,enabled:e?.enabled??!0,onPortConflict:e?.onPortConflict??`block`,logBufferLines:null,dependsOn:``,envFile:``,env:``,dataEnvs:``,backupPaths:``,backupIgnoreGenerated:!0,maxRssMb:null,restart:{...e?.restart??SR},health:TR(e?.health??CR),stop:{...e?.stop??wR},bootstrapEnabled:!1,bootstrapCommand:``,bootstrapArgs:``,bootstrapEnv:``,bootstrapTimeoutMs:12e4,bootstrapRunOnce:!0}}var az={port:`validation.port`,idRequired:`validation.idRequired`,idPattern:`validation.idPattern`,commandRequired:`validation.commandRequired`,bootstrapCommand:`validation.bootstrapCommand`};function oz(e){return e!==null&&Number.isFinite(e)?e:0}function sz(e){return{args:[],cwd:`.`,env:{},dataEnvs:{},dependsOn:[],envFile:``,backupPaths:[],backupIgnoreGenerated:!0,resources:{maxRssBytes:0},bind:e?.bind??`local`,enabled:e?.enabled??!0,autostart:e?.autostart??!1,persistent:!1,onPortConflict:e?.onPortConflict??`block`,logBufferLines:e?.logBufferLines??500}}function cz(e){return e===null||Number.isNaN(e)||Number.isInteger(e)&&e>=1&&e<=65535?null:az.port}function lz(e,t){let n=oz(e.maxRssMb),r=oz(e.bootstrapTimeoutMs),i=sz(t),a=gR({restart:t?.restart??SR,health:t?.health??CR,stop:t?.stop??wR},{restart:e.restart,health:e.health,stop:e.stop});return{...gR(i,{args:$R(e.args),cwd:e.cwd.trim().length>0?e.cwd.trim():`.`,env:tz(e.env),dataEnvs:tz(e.dataEnvs),dependsOn:nz(e.dependsOn),envFile:e.envFile.trim(),backupPaths:$R(e.backupPaths),backupIgnoreGenerated:e.backupIgnoreGenerated,resources:{maxRssBytes:n>0?Math.round(n*1024*1024):0},bind:e.bind,enabled:e.enabled,autostart:e.autostart,persistent:e.persistent,onPortConflict:e.onPortConflict,logBufferLines:oz(e.logBufferLines)>0?oz(e.logBufferLines):i.logBufferLines}),...a,id:e.id.trim(),...e.label.trim().length===0?{}:{label:e.label.trim()},command:e.command.trim(),...e.port===null||Number.isNaN(e.port)?{}:{port:e.port},...e.bootstrapEnabled?{bootstrap:{command:e.bootstrapCommand.trim(),args:$R(e.bootstrapArgs),env:tz(e.bootstrapEnv),timeoutMs:r>=1e3?r:12e4,runOnce:e.bootstrapRunOnce}}:{}}}function uz(e){return e.id.trim().length===0?az.idRequired:rz.test(e.id.trim())?e.command.trim().length===0?az.commandRequired:e.bootstrapEnabled&&e.bootstrapCommand.trim().length===0?az.bootstrapCommand:cz(e.port):az.idPattern}var dz={class:`mb-3 flex items-start justify-between gap-3`},fz={class:`min-w-0`},pz={class:`text-xs font-semibold text-ink`},mz={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},hz={class:`flex shrink-0 items-center gap-2`},gz=N({__name:`FieldGroup`,props:{title:{},description:{default:void 0},columns:{default:2},dense:{type:Boolean,default:!1},class:{default:void 0}},setup(e){let t=e,n=W(()=>({1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`})[t.columns]);return(e,r)=>(L(),R(`section`,{class:D(A(Q)(`rounded-panel border border-line bg-panel-2/40`,t.dense?`p-3`:`p-3.5`,t.class))},[B(`header`,dz,[B(`div`,fz,[B(`h3`,pz,O(t.title),1),t.description?(L(),R(`p`,mz,O(t.description),1)):U(``,!0)]),B(`div`,hz,[F(e.$slots,`actions`)])]),B(`div`,{class:D(A(Q)(`grid gap-3`,n.value))},[F(e.$slots,`default`)],2)],2))}});function _z(e){return e==null||Number.isNaN(e)?``:String(e)}function vz(e,t){let n=String(e??``).trim();if(n.length===0)return t?null:NaN;let r=Number(n);return Number.isNaN(r)?NaN:r}var yz=`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60 focus-visible:ring-offset-2 focus-visible:ring-offset-page`,bz=`text-xs font-medium text-muted`,xz=`text-2xs leading-4 text-faint`,Sz=[`w-full min-w-0 rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-sm text-ink`,`placeholder:text-faint transition-colors duration-150`,`hover:border-line/80 hover:bg-page`,`focus:border-accent focus:bg-page focus:outline-none focus:ring-2 focus:ring-accent/25`,`disabled:cursor-not-allowed disabled:opacity-50`,`aria-[invalid=true]:border-danger aria-[invalid=true]:focus:ring-danger/25`].join(` `),Cz=`${Sz} font-mono text-xs`,wz=[`for`],Tz=[`id`,`step`,`min`,`max`,`aria-invalid`],Ez={key:1,class:`text-2xs text-danger`},Dz=N({inheritAttrs:!1,__name:`NumberField`,props:za({label:{default:void 0},hint:{default:void 0},error:{default:null},wide:{type:Boolean,default:!1},nullable:{type:Boolean,default:!1},step:{default:void 0},min:{default:void 0},max:{default:void 0}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=so(e,`modelValue`),r=ui(),i=W({get:()=>_z(n.value),set:e=>{n.value=vz(e,t.nullable)}}),a=W(()=>n.value!==null&&Number.isNaN(n.value));return(e,n)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(bz))},O(t.label),11,wz)):U(``,!0),Sr(B(`input`,Ms({id:A(r),"onUpdate:modelValue":n[0]||=e=>i.value=e,type:`number`,inputmode:`numeric`,step:t.step,min:t.min,max:t.max,class:A(Q)(A(Sz),`font-mono tabular-nums`,(t.error||a.value)&&`border-danger`),"aria-invalid":t.error||a.value?!0:void 0},e.$attrs),null,16,Tz),[[Jl,i.value]]),t.error?(L(),R(`p`,Ez,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(xz))},O(t.hint),3)):U(``,!0)],2))}}),Oz=[`for`],kz={class:`relative`},Az=[`id`],jz=[`value`,`disabled`],Mz={key:1,class:`text-2xs text-danger`},Nz=N({inheritAttrs:!1,__name:`SelectField`,props:za({label:{default:void 0},hint:{default:void 0},error:{default:null},options:{},wide:{type:Boolean,default:!1},mono:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=so(e,`modelValue`),r=ui();return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(bz))},O(t.label),11,Oz)):U(``,!0),B(`div`,kz,[Sr(B(`select`,Ms({id:A(r),"onUpdate:modelValue":i[0]||=e=>n.value=e,class:A(Q)(A(Sz),`cursor-pointer appearance-none pr-7`,t.mono&&`font-mono text-xs`,t.error&&`border-danger`)},e.$attrs),[(L(!0),R(I,null,P(t.options,e=>(L(),R(`option`,{key:e.value,value:e.value,disabled:e.disabled},O(e.label),9,jz))),128))],16,Az),[[Ql,n.value]]),V(A(Iv),{class:`pointer-events-none absolute right-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`,"aria-hidden":`true`})]),t.error?(L(),R(`p`,Mz,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(xz))},O(t.hint),3)):U(``,!0)],2))}}),Pz=[`for`],Fz=[`id`,`aria-invalid`,`aria-describedby`],Iz=[`id`],Lz=[`id`],Rz=N({inheritAttrs:!1,__name:`TextField`,props:za({label:{default:void 0},hint:{default:void 0},error:{default:null},wide:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=so(e,`modelValue`),r=ui(),i=W(()=>t.hint||t.error?`${r}-hint`:void 0);return(e,a)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(bz))},O(t.label),11,Pz)):U(``,!0),Sr(B(`input`,Ms({id:A(r),"onUpdate:modelValue":a[0]||=e=>n.value=e,class:A(Q)(A(Sz),t.error&&`border-danger`),"aria-invalid":t.error?!0:void 0,"aria-describedby":i.value},e.$attrs),null,16,Fz),[[ru,n.value]]),t.error?(L(),R(`p`,{key:1,id:`${A(r)}-hint`,class:`text-2xs text-danger`},O(t.error),9,Iz)):t.hint?(L(),R(`p`,{key:2,id:`${A(r)}-hint`,class:D(A(xz))},O(t.hint),11,Lz)):U(``,!0)],2))}}),zz=[`id`],Bz={key:0,class:`block text-2xs text-faint`},Vz=N({__name:`ToggleSwitch`,props:za({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1},trailing:{type:Boolean,default:!1},wide:{type:Boolean,default:!1},srOnly:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=ui(),r=so(e,`modelValue`);return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex items-center gap-2.5`,t.trailing&&`flex-row-reverse justify-end`,t.wide&&`sm:col-span-2`))},[V(A(cg),{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,disabled:t.disabled,"aria-labelledby":A(n),class:D(A(Q)(`relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full border transition-colors duration-150`,`data-[state=checked]:border-accent data-[state=checked]:bg-accent`,`data-[state=unchecked]:border-line data-[state=unchecked]:bg-line-soft`,`disabled:cursor-not-allowed disabled:opacity-45`,A(yz)))},{default:j(()=>[V(A(lg),{class:`block size-3 translate-x-[3px] rounded-full bg-white shadow-sm transition-transform duration-150 ease-out data-[state=checked]:translate-x-[16px]`})]),_:1},8,[`modelValue`,`disabled`,`aria-labelledby`,`class`]),B(`label`,{class:`min-w-0 cursor-pointer select-none`,onClick:i[1]||=e=>!t.disabled&&(r.value=!r.value)},[B(`span`,{id:A(n),class:D(A(Q)(`block text-xs text-ink`,t.srOnly&&`sr-only`))},O(t.label),11,zz),t.hint?(L(),R(`span`,Bz,O(t.hint),1)):U(``,!0)])],2))}}),Hz=N({__name:`LifecycleFields`,props:za({showHttp:{type:Boolean,default:!0}},{restart:{required:!0},restartModifiers:{},health:{required:!0},healthModifiers:{},stop:{required:!0},stopModifiers:{}}),emits:[`update:restart`,`update:health`,`update:stop`],setup(e){let t=so(e,`restart`),n=so(e,`health`),r=so(e,`stop`);function i(e,t,n=0){return W({get:e,set:e=>t(e===null||Number.isNaN(e)?n:e)})}let a=i(()=>t.value.maxRetries,e=>t.value.maxRetries=e),o=i(()=>t.value.baseDelayMs,e=>t.value.baseDelayMs=e),s=i(()=>t.value.factor,e=>t.value.factor=e,1),c=i(()=>t.value.maxDelayMs,e=>t.value.maxDelayMs=e),l=i(()=>t.value.resetAfterMs,e=>t.value.resetAfterMs=e),u=i(()=>n.value.intervalMs,e=>n.value.intervalMs=e,500),d=i(()=>n.value.timeoutMs,e=>n.value.timeoutMs=e,100),f=i(()=>n.value.unhealthyThreshold,e=>n.value.unhealthyThreshold=e,1),p=i(()=>n.value.forceRestartAfterMs,e=>n.value.forceRestartAfterMs=e),m=i(()=>n.value.startTimeoutMs,e=>n.value.startTimeoutMs=e),h=W({get:()=>n.value.http.expectStatus??null,set:e=>{e===null||Number.isNaN(e)?delete n.value.http.expectStatus:n.value.http.expectStatus=e}}),g=i(()=>n.value.http.expectStatusBelow,e=>n.value.http.expectStatusBelow=e,400),_=i(()=>r.value.graceMs,e=>r.value.graceMs=e),v=W(()=>[{value:`SIGTERM`,label:Y(`lifecycle.signalTerm`)},{value:`SIGINT`,label:Y(`lifecycle.signalInt`)},{value:`SIGKILL`,label:Y(`lifecycle.signalKill`)}]);return(i,y)=>(L(),R(I,null,[V(gz,{title:A(Y)(`lifecycle.restartTitle`),description:A(Y)(`lifecycle.restartDescription`),columns:3},{default:j(()=>[V(Vz,{modelValue:t.value.enabled,"onUpdate:modelValue":y[0]||=e=>t.value.enabled=e,label:A(Y)(`lifecycle.restartOnCrash`),wide:``},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:A(a),"onUpdate:modelValue":y[1]||=e=>hn(a)?a.value=e:null,label:A(Y)(`lifecycle.maxRetries`),min:0,hint:A(Y)(`lifecycle.maxRetriesHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(o),"onUpdate:modelValue":y[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`lifecycle.baseDelay`),min:0},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":y[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`lifecycle.factor`),min:1,step:.1},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:A(c),"onUpdate:modelValue":y[4]||=e=>hn(c)?c.value=e:null,label:A(Y)(`lifecycle.maxDelay`),min:0},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:A(l),"onUpdate:modelValue":y[5]||=e=>hn(l)?l.value=e:null,label:A(Y)(`lifecycle.resetAfter`),min:0,hint:A(Y)(`lifecycle.resetAfterHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`lifecycle.healthTitle`),description:A(Y)(`lifecycle.healthDescription`),columns:3},{default:j(()=>[V(Vz,{modelValue:n.value.enabled,"onUpdate:modelValue":y[6]||=e=>n.value.enabled=e,label:A(Y)(`lifecycle.probe`),wide:``},null,8,[`modelValue`,`label`]),V(Nz,{modelValue:n.value.mode,"onUpdate:modelValue":y[7]||=e=>n.value.mode=e,label:A(Y)(`lifecycle.probeType`),options:[{value:`port`,label:A(Y)(`lifecycle.probePort`)},{value:`http`,label:A(Y)(`lifecycle.probeHttp`)}]},null,8,[`modelValue`,`label`,`options`]),V(Dz,{modelValue:A(u),"onUpdate:modelValue":y[8]||=e=>hn(u)?u.value=e:null,label:A(Y)(`lifecycle.interval`),min:500,step:100},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:A(d),"onUpdate:modelValue":y[9]||=e=>hn(d)?d.value=e:null,label:A(Y)(`lifecycle.timeout`),min:100,step:100},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:A(f),"onUpdate:modelValue":y[10]||=e=>hn(f)?f.value=e:null,label:A(Y)(`lifecycle.unhealthyAfter`),min:1,hint:A(Y)(`lifecycle.unhealthyAfterHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(p),"onUpdate:modelValue":y[11]||=e=>hn(p)?p.value=e:null,label:A(Y)(`lifecycle.forceRestartAfter`),min:0,hint:A(Y)(`lifecycle.forceRestartAfterHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(m),"onUpdate:modelValue":y[12]||=e=>hn(m)?m.value=e:null,label:A(Y)(`lifecycle.startTimeout`),min:0},null,8,[`modelValue`,`label`]),e.showHttp&&n.value.mode===`http`?(L(),R(I,{key:0},[V(Rz,{modelValue:n.value.http.path,"onUpdate:modelValue":y[13]||=e=>n.value.http.path=e,label:A(Y)(`lifecycle.httpPath`),placeholder:`/healthz`},null,8,[`modelValue`,`label`]),V(Nz,{modelValue:n.value.http.method,"onUpdate:modelValue":y[14]||=e=>n.value.http.method=e,label:A(Y)(`lifecycle.httpMethod`),options:[{value:`GET`,label:`GET`},{value:`HEAD`,label:`HEAD`}]},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:h.value,"onUpdate:modelValue":y[15]||=e=>h.value=e,label:A(Y)(`lifecycle.expectStatus`),nullable:``,hint:A(Y)(`lifecycle.expectStatusHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(g),"onUpdate:modelValue":y[16]||=e=>hn(g)?g.value=e:null,label:A(Y)(`lifecycle.expectStatusBelow`),min:100},null,8,[`modelValue`,`label`]),V(Rz,{modelValue:n.value.http.expectBody,"onUpdate:modelValue":y[17]||=e=>n.value.http.expectBody=e,label:A(Y)(`lifecycle.expectBody`),placeholder:A(Y)(`lifecycle.expectBodyPlaceholder`),wide:``,hint:n.value.http.method===`HEAD`&&n.value.http.expectBody.length>0?A(Y)(`lifecycle.headBodyHint`):void 0},null,8,[`modelValue`,`label`,`placeholder`,`hint`])],64)):U(``,!0)]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`lifecycle.stopTitle`),description:A(Y)(`lifecycle.stopDescription`),columns:3},{default:j(()=>[V(Nz,{modelValue:r.value.signal,"onUpdate:modelValue":y[18]||=e=>r.value.signal=e,label:A(Y)(`lifecycle.signal`),options:v.value},null,8,[`modelValue`,`label`,`options`]),V(Dz,{modelValue:A(_),"onUpdate:modelValue":y[19]||=e=>hn(_)?_.value=e:null,label:A(Y)(`lifecycle.grace`),min:0},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:r.value.killGroup,"onUpdate:modelValue":y[20]||=e=>r.value.killGroup=e,label:A(Y)(`lifecycle.killGroup`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:r.value.killPortHolders,"onUpdate:modelValue":y[21]||=e=>r.value.killPortHolders=e,label:A(Y)(`lifecycle.killPortHolders`),wide:``},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`])],64))}}),Uz=[`type`,`disabled`,`aria-busy`],$=N({inheritAttrs:!1,__name:`AppButton`,props:{variant:{default:`secondary`},size:{default:`sm`},type:{default:`button`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},block:{type:Boolean,default:!1}},setup(e){let t=e,n=Fa(),r={primary:`bg-accent text-accent-ink border-transparent hover:brightness-110 active:brightness-95 shadow-[inset_0_1px_0_rgb(255_255_255/0.14)]`,secondary:`bg-raise text-ink border-line hover:bg-hover`,ghost:`bg-transparent text-muted border-transparent hover:bg-hover hover:text-ink`,danger:`bg-danger text-white border-transparent hover:brightness-110 active:brightness-95`,"danger-ghost":`bg-transparent text-danger border-danger/30 hover:bg-danger-soft`},i={xs:`h-6 gap-1 px-1.5 text-2xs`,sm:`h-8 gap-1.5 px-2.5 text-xs`,md:`h-9 gap-2 px-3.5 text-sm`,icon:`h-9 w-9 justify-center`,"icon-sm":`h-8 w-8 justify-center`},a=W(()=>Q(`inline-flex select-none items-center rounded-control border font-medium whitespace-nowrap`,`transition-[background-color,border-color,color,filter,opacity] duration-150 ease-out`,`disabled:pointer-events-none disabled:opacity-45`,r[t.variant],i[t.size],t.block&&`w-full`,yz,n.class));return(e,r)=>(L(),R(`button`,Ms({...A(n),class:void 0},{type:t.type,class:a.value,disabled:t.disabled||t.loading,"aria-busy":t.loading||void 0}),[t.loading?(L(),z(A(sy),{key:0,class:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`})):U(``,!0),F(e.$slots,`default`)],16,Uz))}}),Wz=[`open`],Gz={class:`flex cursor-pointer list-none select-none items-center gap-1.5 px-3 py-2 text-xs font-semibold text-ink [&::-webkit-details-marker]:hidden`},Kz={key:0,class:`ml-1 truncate text-2xs font-normal text-faint`},qz={class:`grid gap-3 border-t border-line-soft px-3 py-3`},Jz=N({__name:`Disclosure`,props:{title:{},hint:{default:void 0},open:{type:Boolean,default:!1}},setup(e){let t=e;return(e,n)=>(L(),R(`details`,{class:`group rounded-panel border border-line bg-panel-2/40`,open:t.open},[B(`summary`,Gz,[V(A(Rv),{class:`size-3.5 shrink-0 text-muted transition-transform duration-150 group-open:rotate-90`,"aria-hidden":`true`}),H(` `+O(t.title)+` `,1),t.hint?(L(),R(`span`,Kz,O(t.hint),1)):U(``,!0)]),B(`div`,qz,[F(e.$slots,`default`)])],8,Wz))}}),Yz={class:`flex shrink-0 items-start justify-between gap-4 border-b border-line px-4 py-3`},Xz={class:`min-w-0`},Zz={class:`min-h-0 flex-1 overflow-y-auto px-4 py-3.5`},Qz={key:0,class:`flex shrink-0 items-center justify-end gap-2 border-t border-line bg-panel-2 px-4 py-3`},$z=N({__name:`Modal`,props:za({title:{},description:{default:void 0},width:{default:`w-[min(92vw,34rem)]`}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=so(e,`open`);return(e,r)=>(L(),z(A(lf),{open:n.value,"onUpdate:open":r[0]||=e=>n.value=e},{default:j(()=>[V(A(Yf),null,{default:j(()=>[V(A(qf),{class:`fixed inset-0 z-50 bg-black/45 backdrop-blur-[1px] data-[state=closed]:animate-[hh-fade-out_120ms_ease-in] data-[state=open]:animate-[hh-fade-in_150ms_ease-out]`}),V(A(Wf),{class:D(A(Q)(`fixed left-1/2 top-1/2 z-50 flex max-h-[88dvh] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-panel border border-line bg-panel shadow-float`,`data-[state=closed]:animate-[hh-pop-out_120ms_ease-in] data-[state=open]:animate-[hh-pop-in_160ms_var(--ease-out-quick)]`,t.width))},{default:j(()=>[B(`header`,Yz,[B(`div`,Xz,[V(A(Xf),{class:`text-sm font-semibold text-ink`},{default:j(()=>[H(O(t.title),1)]),_:1}),t.description?(L(),z(A(Gf),{key:0,class:`mt-0.5 text-xs text-muted`},{default:j(()=>[H(O(t.description),1)]),_:1})):U(``,!0)]),V(A(uf),{class:D(A(Q)(`-mr-1 -mt-0.5 grid size-7 shrink-0 place-items-center rounded-control text-muted transition-colors duration-150 hover:bg-hover hover:text-ink`,A(yz))),"aria-label":A(Y)(`common.close`)},{default:j(()=>[V(A(zy),{class:`size-4`})]),_:1},8,[`class`,`aria-label`])]),B(`div`,Zz,[F(e.$slots,`default`)]),e.$slots.footer?(L(),R(`footer`,Qz,[F(e.$slots,`footer`)])):U(``,!0)]),_:3},8,[`class`])]),_:3})]),_:3},8,[`open`]))}}),eB=[`for`],tB=[`id`,`rows`,`placeholder`],nB={key:1,class:`text-2xs text-danger`},rB=N({inheritAttrs:!1,__name:`TextAreaField`,props:za({label:{default:void 0},hint:{default:void 0},error:{default:null},rows:{default:3},placeholder:{default:void 0},wide:{type:Boolean,default:!0},mono:{type:Boolean,default:!0}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=so(e,`modelValue`),r=ui();return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(bz))},O(t.label),11,eB)):U(``,!0),Sr(B(`textarea`,Ms({id:A(r),"onUpdate:modelValue":i[0]||=e=>n.value=e,rows:t.rows,placeholder:t.placeholder,spellcheck:`false`,class:A(Q)(t.mono?A(Cz):`font-sans`,`resize-y leading-relaxed`,t.error&&`border-danger`)},e.$attrs),null,16,tB),[[Jl,n.value]]),t.error?(L(),R(`p`,nB,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(xz))},O(t.hint),3)):U(``,!0)],2))}}),iB=N({__name:`TransText`,props:{k:{},params:{}},setup(e){let t=e,n=Pa(),r=W(()=>Object.keys(n)),i=W(()=>{let e={...t.params};for(let t of r.value)delete e[t];let n=Y(t.k,e),i=[],a=/\{(\w+)\}/g,o=0,s=a.exec(n);for(;s!==null;){s.index>o&&i.push({text:n.slice(o,s.index)});let e=s[1];i.push(r.value.includes(e)?{slot:e}:{text:s[0]}),o=s.index+s[0].length,s=a.exec(n)}return o<n.length&&i.push({text:n.slice(o)}),i});return(e,t)=>(L(),R(`span`,null,[(L(!0),R(I,null,P(i.value,(t,n)=>(L(),R(I,{key:n},[t.slot?F(e.$slots,t.slot,{},void 0,void 0,0):(L(),R(I,{key:1},[H(O(t.text),1)],64))],64))),128))]))}}),aB={class:`text-2xs leading-4 text-faint`},oB={class:`font-mono`},sB={class:`rounded-panel border border-line-soft bg-panel-2/40 p-3`},cB={class:`text-2xs font-medium text-muted`},lB={class:`mt-1.5 flex flex-wrap gap-1`},uB={key:0,class:`rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},dB=N({__name:`AddServerDialog`,props:za({workspaceId:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=XN(),o=k(!1),s=k(null),c=[`{port}`,`{host}`,`{home}`,`{projectDir}`,`{dataRoot}`,`{id}`,`{label}`,`{cwd}`,`{bind}`,`{lanIp}`],l=W(()=>a.workspaceById(n.workspaceId)?.defaults),u=W(()=>a.workspaceById(n.workspaceId)?.label??Y(`addServer.thisWorkspace`)),d=tn(iz(l.value)),f=W(()=>{let e=cz(d.port);return e===null?null:Y(e)});function p(){Object.assign(d,iz(l.value)),s.value=null}M(i,e=>{e&&p()});async function m(){s.value=null;let e=uz(d);if(e!==null){s.value=Y(e);return}let t=VA(lz(d,l.value));if(t instanceof J.errors){s.value=t.summary;return}o.value=!0;try{if(await a.create(n.workspaceId,t),a.lastError.value!==null){s.value=a.lastError.value;return}r(`created`),i.value=!1,p()}finally{o.value=!1}}return(e,t)=>(L(),z($z,{open:i.value,"onUpdate:open":t[29]||=e=>i.value=e,title:A(Y)(`addServer.title`),description:A(Y)(`addServer.description`,{workspace:u.value}),width:`w-[min(94vw,40rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[28]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{type:`submit`,form:`add-server-form`,variant:`primary`,loading:o.value},{default:j(()=>[H(O(A(Y)(`addServer.submit`)),1)]),_:1},8,[`loading`])]),default:j(()=>[B(`form`,{id:`add-server-form`,class:`flex flex-col gap-3`,onSubmit:lu(m,[`prevent`])},[V(gz,{title:A(Y)(`addServer.identity`),columns:2,dense:``},{default:j(()=>[V(Rz,{modelValue:d.id,"onUpdate:modelValue":t[0]||=e=>d.id=e,label:A(Y)(`addServer.id`),placeholder:`my-server`,hint:A(Y)(`addServer.idHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:d.label,"onUpdate:modelValue":t[1]||=e=>d.label=e,label:A(Y)(`common.label`),placeholder:`My server`,hint:A(Y)(`addServer.labelHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(gz,{title:A(Y)(`addServer.process`),columns:2,dense:``},{default:j(()=>[V(Rz,{modelValue:d.command,"onUpdate:modelValue":t[2]||=e=>d.command=e,label:A(Y)(`common.command`),placeholder:`node`,hint:A(Y)(`addServer.commandHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:d.cwd,"onUpdate:modelValue":t[3]||=e=>d.cwd=e,label:A(Y)(`serverForm.workingDirectory`),placeholder:`.`,hint:A(Y)(`serverForm.cwdHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(rB,{modelValue:d.args,"onUpdate:modelValue":t[4]||=e=>d.args=e,label:A(Y)(`serverForm.arguments`),rows:3,hint:A(Y)(`addServer.argumentsHint`),placeholder:`-p
42
- {port}`},null,8,[`modelValue`,`label`,`hint`]),V(gz,{title:A(Y)(`addServer.portLifecycle`),columns:2,dense:``},{default:j(()=>[V(Dz,{modelValue:d.port,"onUpdate:modelValue":t[5]||=e=>d.port=e,label:A(Y)(`common.port`),nullable:``,min:1,max:65535,error:f.value,hint:A(Y)(`serverForm.portHint`)},null,8,[`modelValue`,`label`,`error`,`hint`]),V(Nz,{modelValue:d.bind,"onUpdate:modelValue":t[6]||=e=>d.bind=e,label:A(Y)(`serverForm.bindAddress`),options:[{value:`local`,label:A(Y)(`bind.local`)},{value:`lan`,label:A(Y)(`bind.lan`)}],hint:A(Y)(`addServer.bindHint`)},null,8,[`modelValue`,`label`,`options`,`hint`]),V(Vz,{modelValue:d.autostart,"onUpdate:modelValue":t[7]||=e=>d.autostart=e,label:A(Y)(`serverForm.autostart`),hint:A(Y)(`serverForm.autostartHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:d.persistent,"onUpdate:modelValue":t[8]||=e=>d.persistent=e,label:A(Y)(`serverForm.persistent`),hint:A(Y)(`serverForm.persistentHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(Jz,{title:A(Y)(`addServer.advanced`),hint:A(Y)(`addServer.advancedHint`)},{default:j(()=>[V(gz,{title:A(Y)(`common.environment`),columns:2,dense:``},{default:j(()=>[V(rB,{modelValue:d.env,"onUpdate:modelValue":t[9]||=e=>d.env=e,label:A(Y)(`common.environment`),rows:3,hint:A(Y)(`serverForm.envHint`),placeholder:`NODE_ENV=production`},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:d.dataEnvs,"onUpdate:modelValue":t[10]||=e=>d.dataEnvs=e,label:A(Y)(`serverForm.dataEnvs`),rows:3,hint:A(Y)(`serverForm.dataEnvsHint`),placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:d.envFile,"onUpdate:modelValue":t[11]||=e=>d.envFile=e,label:A(Y)(`serverForm.envFile`),placeholder:A(Y)(`serverForm.envFilePlaceholder`),hint:A(Y)(`serverForm.envFileHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(Rz,{modelValue:d.dependsOn,"onUpdate:modelValue":t[12]||=e=>d.dependsOn=e,label:A(Y)(`serverForm.dependsOn`),placeholder:`postgres, redis`,hint:A(Y)(`serverForm.dependsOnHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(gz,{title:A(Y)(`addServer.backups`),columns:2,dense:``},{default:j(()=>[V(rB,{modelValue:d.backupPaths,"onUpdate:modelValue":t[13]||=e=>d.backupPaths=e,label:A(Y)(`serverForm.backupPaths`),rows:2,hint:A(Y)(`serverForm.backupPathsHint`),placeholder:`{home}/.app/uploads`},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:d.backupIgnoreGenerated,"onUpdate:modelValue":t[14]||=e=>d.backupIgnoreGenerated=e,label:A(Y)(`addServer.backupIgnore`),hint:A(Y)(`serverForm.backupIgnoreHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(Hz,{restart:d.restart,"onUpdate:restart":t[15]||=e=>d.restart=e,health:d.health,"onUpdate:health":t[16]||=e=>d.health=e,stop:d.stop,"onUpdate:stop":t[17]||=e=>d.stop=e},null,8,[`restart`,`health`,`stop`]),V(gz,{title:A(Y)(`serverForm.bootstrap`),description:A(Y)(`addServer.bootstrapDescription`),columns:2,dense:``},{default:j(()=>[V(Vz,{modelValue:d.bootstrapEnabled,"onUpdate:modelValue":t[18]||=e=>d.bootstrapEnabled=e,label:A(Y)(`serverForm.runBootstrap`),hint:A(Y)(`addServer.bootstrapHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),d.bootstrapEnabled?(L(),R(I,{key:0},[V(Rz,{modelValue:d.bootstrapCommand,"onUpdate:modelValue":t[19]||=e=>d.bootstrapCommand=e,label:A(Y)(`common.command`),placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:d.bootstrapTimeoutMs,"onUpdate:modelValue":t[20]||=e=>d.bootstrapTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:d.bootstrapRunOnce,"onUpdate:modelValue":t[21]||=e=>d.bootstrapRunOnce=e,label:A(Y)(`serverForm.runOnce`),hint:A(Y)(`serverForm.runOnceHint`)},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:d.bootstrapArgs,"onUpdate:modelValue":t[22]||=e=>d.bootstrapArgs=e,label:A(Y)(`serverForm.bootstrapArgs`),rows:2,hint:A(Y)(`serverForm.bootstrapArgsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:d.bootstrapEnv,"onUpdate:modelValue":t[23]||=e=>d.bootstrapEnv=e,label:A(Y)(`serverForm.bootstrapEnv`),rows:2,hint:A(Y)(`serverForm.bootstrapEnvHint`)},null,8,[`modelValue`,`label`,`hint`])],64)):U(``,!0)]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`addServer.policyResources`),columns:2,dense:``},{default:j(()=>[V(Nz,{modelValue:d.onPortConflict,"onUpdate:modelValue":t[24]||=e=>d.onPortConflict=e,label:A(Y)(`serverForm.onPortConflict`),options:[{value:`block`,label:A(Y)(`onPortConflict.block`)},{value:`warn`,label:A(Y)(`onPortConflict.warn`)},{value:`follow`,label:A(Y)(`onPortConflict.follow`)},{value:`reclaim`,label:A(Y)(`onPortConflict.reclaim`)},{value:`kill`,label:A(Y)(`onPortConflict.kill`)}]},null,8,[`modelValue`,`label`,`options`]),V(Dz,{modelValue:d.logBufferLines,"onUpdate:modelValue":t[25]||=e=>d.logBufferLines=e,label:A(Y)(`serverForm.logBufferLines`),min:50,max:1e5,step:50,hint:A(Y)(`addServer.logBufferHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:d.maxRssMb,"onUpdate:modelValue":t[26]||=e=>d.maxRssMb=e,label:A(Y)(`serverForm.maxRssMb`),min:0,hint:A(Y)(`serverForm.maxRssHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:d.enabled,"onUpdate:modelValue":t[27]||=e=>d.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`serverForm.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),B(`p`,aB,[V(iB,{k:`addServer.inheritNote`},{settings:j(()=>[B(`span`,oB,O(A(Y)(`addServer.serverDefaults`)),1)]),_:1})])]),_:1},8,[`title`,`hint`]),B(`div`,sB,[B(`p`,cB,O(A(Y)(`addServer.placeholdersTitle`)),1),B(`div`,lB,[(L(),R(I,null,P(c,e=>B(`code`,{key:e,class:`rounded-control border border-line bg-raise px-1.5 py-0.5 font-mono text-2xs text-ink`},O(e),1)),64))])]),s.value?(L(),R(`p`,uB,O(s.value),1)):U(``,!0)],32)]),_:1},8,[`open`,`title`,`description`]))}});function fB(e){let t=e.trim().toLowerCase();return t===`localhost`||t===`::1`||t===`[::1]`||t.endsWith(`.localhost`)?!0:/^127(?:\.\d{1,3}){3}$/.test(t)}function pB(e,t){let{url:n,bindHost:r}=e,i=t.trim();if(n===null||r.trim()!==`0.0.0.0`||i===``||fB(i))return n;try{let e=new URL(n),t=i.includes(`:`)&&!i.startsWith(`[`)?`[${i}]`:i,r=e.port.length>0?`:${e.port}`:``,a=e.pathname===`/`?``:e.pathname;return`${e.protocol}//${t}${r}${a}${e.search}${e.hash}`}catch{return n}}function mB(){return globalThis.location?.hostname??``}var hB={class:`text-xs font-semibold text-ink`},gB={class:`mt-1 text-2xs leading-4 text-muted`},_B={class:`mt-2.5 flex justify-end gap-1.5`},vB=N({__name:`KillPortButton`,props:{port:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(Wh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[V($,{variant:`danger-ghost`,size:`xs`,loading:n.busy},{default:j(()=>[H(O(A(Y)(`killPort.trigger`,{port:n.port})),1)]),_:1},8,[`loading`])]),_:1}),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`start`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,hB,O(A(Y)(`killPort.title`,{port:n.port})),1),B(`p`,gB,O(A(Y)(`killPort.body`)),1),B(`div`,_B,[V(A(Gh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`danger`,loading:n.busy,onClick:a},{default:j(()=>[H(O(A(Y)(`killPort.confirm`)),1)]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),yB=[`viewBox`],bB=[`id`],xB=[`stop-color`],SB=[`stop-color`],CB=[`d`,`fill`],wB=[`d`,`stroke`,`stroke-width`],TB=[`x1`,`x2`,`y2`,`stroke`],EB=[`cx`,`cy`,`fill`],DB={key:0,class:`absolute inset-x-0 top-1/2 border-t border-dashed border-line`},OB=100,kB=N({__name:`Sparkline`,props:za({values:{},height:{default:34},max:{default:null},min:{default:null},fill:{type:Boolean,default:!0},strokeWidth:{default:1.5},color:{default:void 0},class:{default:void 0},interactive:{type:Boolean,default:!1}},{hoverIndex:{default:null},hoverIndexModifiers:{}}),emits:[`update:hoverIndex`],setup(e){let t=e,n=so(e,`hoverIndex`),r=ui(),i=k(null),a=W(()=>{let e=t.values.filter(e=>e!==null&&Number.isFinite(e)),n=t.max??(e.length>0?Math.max(...e):1),r=t.min??0;return{bottom:r,ceiling:n===r?r+1:n}}),o=W(()=>{let e=t.values,{bottom:n,ceiling:r}=a.value,i=r-n,o=e.length>1?OB/(e.length-1):OB,s=e=>t.height-(e-n)/i*t.height,c=[],l=[],u=()=>{if(l.length===0)return;let e=l.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(2)} ${e.y.toFixed(2)}`).join(` `),n=l[0],r=`${e} L${l[l.length-1].x.toFixed(2)} ${t.height} L${n.x.toFixed(2)} ${t.height} Z`;c.push({line:e,area:r}),l=[]};return e.forEach((e,t)=>{if(e===null||!Number.isFinite(e)){u();return}l.push({x:t*o,y:s(e)})}),u(),c}),s=W(()=>n.value===null||t.values.length<2?null:n.value/(t.values.length-1)*OB),c=W(()=>{let e=n.value;if(e===null)return null;let r=t.values[e];if(r==null||!Number.isFinite(r))return null;let{bottom:i,ceiling:o}=a.value;return t.height-(r-i)/(o-i)*t.height});function l(e){if(!t.interactive||!i.value||t.values.length===0)return;let r=i.value.getBoundingClientRect();if(r.width===0)return;let a=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));n.value=Math.round(a*(t.values.length-1))}function u(){n.value=null}return(e,n)=>(L(),R(`div`,{ref_key:`track`,ref:i,class:D(A(Q)(`relative w-full`,t.class)),style:_e({height:`${t.height}px`}),onMousemove:l,onMouseleave:u},[(L(),R(`svg`,{viewBox:`0 0 ${OB} ${t.height}`,preserveAspectRatio:`none`,class:`block size-full overflow-visible`,role:`img`,"aria-hidden":`true`},[B(`defs`,null,[B(`linearGradient`,{id:A(r),x1:`0`,y1:`0`,x2:`0`,y2:`1`},[B(`stop`,{offset:`0%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0.26`},null,8,xB),B(`stop`,{offset:`100%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0`},null,8,SB)],8,bB)]),(L(!0),R(I,null,P(o.value,(e,n)=>(L(),R(I,{key:n},[t.fill?(L(),R(`path`,{key:0,d:e.area,fill:`url(#${A(r)})`,stroke:`none`},null,8,CB)):U(``,!0),B(`path`,{d:e.line,fill:`none`,stroke:t.color??`currentColor`,"stroke-width":t.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`},null,8,wB)],64))),128)),s.value===null?U(``,!0):(L(),R(`line`,{key:0,x1:s.value,x2:s.value,y1:`0`,y2:t.height,stroke:t.color??`currentColor`,"stroke-width":`1`,"stroke-dasharray":`2 2`,"vector-effect":`non-scaling-stroke`,opacity:`0.5`},null,8,TB)),s.value!==null&&c.value!==null?(L(),R(`circle`,{key:1,cx:s.value,cy:c.value,r:`2`,fill:t.color??`currentColor`,"vector-effect":`non-scaling-stroke`},null,8,EB)):U(``,!0)],8,yB)),o.value.length===0?(L(),R(`div`,DB)):U(``,!0)],38))}}),AB={class:`min-w-0`},jB={class:`flex items-baseline justify-between gap-2`},MB={class:`truncate text-2xs font-medium text-faint`},NB={class:`flex shrink-0 items-baseline gap-1.5`},PB={key:0,class:`font-mono text-2xs text-faint`},FB=N({__name:`MetricSpark`,props:{label:{},values:{},format:{},max:{default:null},colorClass:{default:`text-accent`},height:{default:30},sampleMs:{default:5e3},emptyHint:{default:void 0}},setup(e){let t=e,n=k(null),r=W(()=>wN(t.values)),i=W(()=>t.values.some(e=>e!==null)),a=W(()=>{let e=n.value;return e!==null&&t.values[e]!==void 0?t.values[e]??null:r.value}),o=W(()=>{let e=n.value;if(e===null)return null;let r=t.values.length-1-e;if(r<=0)return null;let i=Math.round(r*t.sampleMs/1e3);return i<60?`−${i}s`:`−${Math.round(i/60)}m`});return(e,r)=>(L(),R(`div`,AB,[B(`div`,jB,[B(`span`,MB,O(t.label),1),B(`span`,NB,[o.value?(L(),R(`span`,PB,O(o.value),1)):U(``,!0),B(`span`,{class:D(A(Q)(`font-mono text-xs font-medium tabular-nums`,i.value?`text-ink`:`text-faint`))},O(i.value?t.format(a.value):t.emptyHint??A(Y)(`metric.emptyHint`)),3)])]),V(kB,{"hover-index":n.value,"onUpdate:hoverIndex":r[0]||=e=>n.value=e,values:t.values,height:t.height,max:t.max,interactive:``,class:D(A(Q)(`mt-1`,t.colorClass))},null,8,[`hover-index`,`values`,`height`,`max`,`class`])]))}}),IB={class:`inline-flex flex-wrap items-center gap-1.5`},LB={class:`relative flex size-1.5`},RB={key:0,class:`absolute inset-0 rounded-full bg-current opacity-60`,style:{animation:`hh-pulse-ring 1.6s ease-out infinite`}},zB=N({__name:`StatusPill`,props:{status:{},health:{default:null},showHealth:{type:Boolean,default:!0}},setup(e){let t=e,n=W(()=>qI[t.status]),r=W(()=>t.health?JI[t.health]:null),i=W(()=>t.showHealth&&r.value!==null&&t.health!==`disabled`&&t.health!==`unknown`&&(r.value.tone===`danger`||r.value.tone===`warn`)),a=W(()=>n.value.transitional);return(e,t)=>(L(),R(`span`,IB,[B(`span`,{class:D(A(Q)(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium`,A(XI)[n.value.tone]))},[B(`span`,LB,[a.value?(L(),R(`span`,RB)):U(``,!0),B(`span`,{class:D(A(Q)(`relative size-1.5 rounded-full`,A(ZI)[n.value.tone]))},null,2)]),H(` `+O(A(Y)(n.value.labelKey)),1)],2),i.value&&r.value?(L(),R(`span`,{key:0,class:D(A(Q)(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium`,A(XI)[r.value.tone]))},O(A(Y)(r.value.labelKey)),3)):U(``,!0)]))}}),BB=N({__name:`Tip`,props:{label:{},side:{default:`top`},disabled:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),z(A(gg),{"delay-duration":350},{default:j(()=>[V(A(xg),{"as-child":``},{default:j(()=>[F(t.$slots,`default`)]),_:3}),e.disabled?U(``,!0):(L(),z(A(bg),{key:0},{default:j(()=>[V(A(yg),{side:e.side,"side-offset":6,class:`z-50 max-w-64 rounded-control border border-line bg-raise px-2 py-1 text-2xs text-ink shadow-float data-[state=delayed-open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[H(O(e.label),1)]),_:1},8,[`side`])]),_:1}))]),_:3}))}}),VB={class:`flex items-start justify-between gap-3 px-4 pb-2.5 pt-3.5`},HB={class:`min-w-0`},UB={class:`flex items-center gap-2`},WB=[`href`,`title`,`aria-label`],GB={class:`mt-0.5 flex items-center gap-1.5 truncate font-mono text-2xs text-faint`},KB={class:`text-muted`},qB={key:1,class:`rounded bg-hover px-1 py-px text-muted`},JB={key:2,class:`rounded bg-accent-soft px-1 py-px text-accent`},YB={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},XB={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},ZB=[`title`],QB={key:0,class:`space-y-2.5 border-y border-line-soft px-4 py-3`},$B={class:`grid grid-cols-2 gap-x-4 gap-y-2`},eV={key:1,class:`flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pt-2.5`},tV={class:`text-muted`},nV={class:`text-faint`},rV={key:2,class:`flex flex-col gap-1 px-4 pt-2.5`},iV={key:0,class:`flex items-start gap-1.5 text-2xs leading-4 text-danger`},aV={class:`min-w-0 break-words`},oV={key:2,class:`text-2xs leading-4 text-warn`},sV={key:3,class:`text-2xs leading-4 text-warn`},cV={class:`grid grid-cols-2 gap-x-4 gap-y-1 px-4 py-3 sm:grid-cols-4`},lV={class:`truncate text-2xs text-faint`},uV={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},dV={class:`mt-auto flex items-center gap-1.5 border-t border-line-soft px-4 py-2.5`},fV={class:`grid grid-cols-2 gap-2 text-xs`},pV={class:`font-mono text-ink`},mV={class:`text-faint`},hV={class:`text-ink capitalize`},gV=N({__name:`ServerCard`,props:{server:{},workspaceId:{},series:{},now:{},variant:{default:`default`}},setup(e){let t=e,n={start:_y,exit:jy,crash:Vv,"forced-restart":Sy,unhealthy:Ly,recovered:Hv},r=XN(),i=dP(),a=k(!1),o=k(!1),s=W(()=>t.server.config),c=W(()=>s.value.label&&s.value.label.length>0?s.value.label:t.server.id),l=W(()=>`${s.value.command} ${s.value.args.join(` `)}`.trim()),u=W(()=>QI(t.server.status,t.server.health)),d=W(()=>pB(t.server,mB())),f=W(()=>t.server.status===`running`),p=W(()=>s.value.enabled&&[`stopped`,`crashed`,`conflict`].includes(t.server.status)),m=W(()=>[`running`,`starting`,`backoff`].includes(t.server.status)),h=W(()=>t.server.startedAt===null||!f.value?`—`:jL(t.now-t.server.startedAt)),g=W(()=>t.server.nextRetryAt===null?null:ML(t.server.nextRetryAt,t.now)),_=W(()=>t.server.unhealthySince===null?null:jL(t.now-t.server.unhealthySince)),v=W(()=>t.series?.cpu??[]),y=W(()=>t.series?.rss??[]),b=W(()=>t.series?.probe??[]),x=W(()=>[...t.server.history.events].slice(-3).reverse()),S={unknown:`common.unknown`,free:`serverCard.portFree`,"in-use":`serverCard.portInUse`},C=W(()=>{let e=t.server,n=[{key:`pid`,label:Y(`serverCard.pid`),value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:Y(`common.uptime`),value:h.value},{key:`restarts`,label:Y(`serverCard.restarts`),value:`${e.restarts}/${e.maxRetries}`},{key:`port`,label:Y(`common.port`),value:Y(S[e.portState]??`common.unknown`)},{key:`uptime24`,label:Y(`serverCard.uptime24h`),value:_L(e.history.uptimeRatio)},{key:`probe`,label:Y(`serverCard.probe`),value:e.responseMs===null?`—`:`${e.responseMs} ms`},{key:`rss`,label:Y(`serverCard.rss`),value:LL(e.resources?.rssBytes??null)},{key:`procs`,label:Y(`serverCard.procs`),value:e.resources?String(e.resources.processes):`—`}];return e.history.crashes>0&&n.splice(5,0,{key:`crashes`,label:Y(`serverCard.crashes24h`),value:String(e.history.crashes)}),e.history.lastCrashAt!==null&&n.push({key:`lastcrash`,label:Y(`serverCard.lastCrash`),value:NL(e.history.lastCrashAt,t.now)}),n});async function w(e){a.value=!0;try{await r[e](t.workspaceId,t.server.id)}finally{a.value=!1}}async function T(){a.value=!0;try{await r.freePort(t.workspaceId,t.server.id)}finally{a.value=!1}}async function ee(e){let n=!(e===`enabled`?s.value.enabled:s.value.autostart);e===`enabled`?await r.setEnabled(t.workspaceId,t.server.id,n):await r.setAutostart(t.workspaceId,t.server.id,n)}async function te(){o.value=!1,await r.remove(t.workspaceId,t.server.id)}function ne(){i.select(t.workspaceId)}return(i,f)=>{let h=pa(`RouterLink`);return L(),R(`article`,{class:D(A(Q)(`group relative flex flex-col rounded-panel border bg-panel shadow-card transition-colors duration-150`,`hover:border-line/90`,t.server.status===`crashed`||t.server.status===`conflict`?`border-danger/30`:`border-line`,!s.value.enabled&&`opacity-70`))},[B(`span`,{class:D(A(Q)(`absolute inset-y-3 left-0 w-0.5 rounded-full`,{"bg-ok":u.value===`ok`,"bg-warn":u.value===`warn`,"bg-danger":u.value===`danger`,"bg-faint/50":u.value===`neutral`,"bg-accent":u.value===`accent`||u.value===`info`}))},null,2),B(`header`,VB,[B(`div`,HB,[B(`div`,UB,[V(h,{to:`/servers/${e.server.id}`,class:`truncate text-sm font-semibold tracking-tight text-ink hover:text-accent`,onClick:ne},{default:j(()=>[H(O(c.value),1)]),_:1},8,[`to`]),d.value?(L(),R(`a`,{key:0,href:d.value,target:`_blank`,rel:`noreferrer`,class:`shrink-0 text-faint transition-colors duration-150 hover:text-accent`,title:d.value,"aria-label":A(Y)(`serverCard.open`,{url:d.value})},[V(A(Zv),{class:`size-3.5`})],8,WB)):U(``,!0)]),B(`p`,GB,[B(`span`,null,O(e.server.id),1),s.value.port===null?U(``,!0):(L(),R(I,{key:0},[f[9]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,KB,`:`+O(s.value.port),1)],64)),f[10]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,null,O(e.server.bindHost),1),s.value.enabled?U(``,!0):(L(),R(`span`,qB,O(A(Y)(`serverCard.disabled`)),1)),s.value.autostart?(L(),R(`span`,JB,O(A(Y)(`serverCard.autostart`)),1)):U(``,!0)])]),V(zB,{status:e.server.status,health:e.server.health},null,8,[`status`,`health`]),e.server.adopted?(L(),z(BB,{key:0,label:A(Y)(`serverCard.adoptedHint`)},{default:j(()=>[B(`span`,YB,O(A(Y)(`serverCard.detached`)),1)]),_:1},8,[`label`])):U(``,!0),s.value.persistent?(L(),z(BB,{key:1,label:A(Y)(`serverCard.persistentHint`)},{default:j(()=>[B(`span`,XB,O(A(Y)(`serverCard.persistent`)),1)]),_:1},8,[`label`])):U(``,!0)]),B(`p`,{class:`truncate px-4 pb-3 font-mono text-2xs text-muted`,title:l.value},O(l.value),9,ZB),t.variant===`compact`?U(``,!0):(L(),R(`div`,QB,[B(`div`,$B,[V(FB,{label:A(Y)(`common.cpu`),values:v.value,format:A(RL),max:100,"color-class":`text-cpu`},null,8,[`label`,`values`,`format`]),V(FB,{label:A(Y)(`common.memory`),values:y.value,format:A(LL),"color-class":`text-mem`},null,8,[`label`,`values`,`format`])]),V(FB,{label:A(Y)(`serverCard.healthProbe`),values:b.value,format:e=>e===null?`—`:`${e} ms`,height:22,"color-class":`text-probe`,"empty-hint":A(Y)(`serverCard.notProbed`)},null,8,[`label`,`values`,`format`,`empty-hint`])])),x.value.length>0?(L(),R(`div`,eV,[(L(!0),R(I,null,P(x.value,e=>(L(),R(`span`,{key:`${e.ts}`,class:`inline-flex items-center gap-1 text-2xs`},[(L(),z(ha(n[e.type]),{class:D(A(Q)(`size-3`,A(YI)[A(eL)[e.type]]))},null,8,[`class`])),B(`span`,tV,O(A(Y)(A($I)[e.type])),1),B(`span`,nV,O(A(NL)(e.ts,t.now)),1)]))),128))])):U(``,!0),e.server.lastError||_.value||g.value?(L(),R(`div`,rV,[e.server.lastError?(L(),R(`p`,iV,[V(A(Vv),{class:`mt-0.5 size-3 shrink-0`}),B(`span`,aV,O(e.server.lastError),1)])):U(``,!0),e.server.status===`conflict`&&s.value.port!==null?(L(),z(vB,{key:1,port:s.value.port,busy:a.value,class:`self-start`,onConfirm:T},null,8,[`port`,`busy`])):U(``,!0),_.value?(L(),R(`p`,oV,O(A(Y)(`serverCard.unhealthyFor`,{duration:_.value})),1)):U(``,!0),g.value?(L(),R(`p`,sV,O(A(Y)(`serverCard.nextAttempt`,{when:g.value})),1)):U(``,!0)])):U(``,!0),B(`dl`,cV,[(L(!0),R(I,null,P(C.value,e=>(L(),R(`div`,{key:e.key,class:`min-w-0`},[B(`dt`,lV,O(e.label),1),B(`dd`,uV,O(e.value),1)]))),128))]),B(`div`,dV,[V($,{variant:`primary`,size:`xs`,disabled:a.value||!p.value,onClick:f[0]||=e=>w(`start`)},{default:j(()=>[V(A(_y),{class:`size-3`}),H(O(A(Y)(`serverCard.start`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,disabled:a.value||!m.value,onClick:f[1]||=e=>w(`stop`)},{default:j(()=>[V(A(jy),{class:`size-3`}),H(O(A(Y)(`serverCard.stop`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,disabled:a.value||!s.value.enabled,onClick:f[2]||=e=>w(`restart`)},{default:j(()=>[V(A(Sy),{class:`size-3`}),H(O(A(Y)(`serverCard.restart`)),1)]),_:1},8,[`disabled`]),V(BB,{label:A(Y)(`serverCard.detailsHint`)},{default:j(()=>[V(h,{to:`/servers/${e.server.id}`,onClick:ne},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[V(A(Cy),{class:`size-3`}),H(O(A(Y)(`common.details`)),1)]),_:1})]),_:1},8,[`to`])]),_:1},8,[`label`]),V(A(eg),null,{default:j(()=>[V(A(ag),{"as-child":``},{default:j(()=>[V($,{size:`icon-sm`,variant:`ghost`,class:`ml-auto`,"aria-label":A(Y)(`serverCard.moreActions`,{label:c.value})},{default:j(()=>[V(A(Xv),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),V(A(rg),null,{default:j(()=>[V(A(tg),{"side-offset":4,align:`end`,class:`z-50 min-w-52 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[3]||=e=>ee(`enabled`)},{default:j(()=>[V(A(yy),{class:`size-3.5`}),H(` `+O(s.value.enabled?A(Y)(`serverCard.disable`):A(Y)(`serverCard.enable`)),1)]),_:1}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[4]||=e=>ee(`autostart`)},{default:j(()=>[V(A(_y),{class:`size-3.5`}),H(` `+O(s.value.autostart?A(Y)(`serverCard.removeFromAutostart`):A(Y)(`serverCard.autostartWithPanel`)),1)]),_:1}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[5]||=t=>A(r).clearLogs(e.workspaceId,e.server.id)},{default:j(()=>[V(A(Cy),{class:`size-3.5`}),H(` `+O(A(Y)(`serverCard.clearLogBuffer`)),1)]),_:1}),V(A(ig),{class:`my-1 h-px bg-line`}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:f[6]||=e=>o.value=!0},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(` `+O(A(Y)(`serverCard.removeServer`)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),V($z,{open:o.value,"onUpdate:open":f[8]||=e=>o.value=e,title:A(Y)(`serverCard.removeTitle`),description:A(Y)(`serverCard.removeDescription`,{label:c.value}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:f[7]||=e=>o.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:te},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(O(A(Y)(`common.remove`)),1)]),_:1})]),default:j(()=>[B(`dl`,fV,[B(`div`,null,[f[11]||=B(`dt`,{class:`text-faint`},` id `,-1),B(`dd`,pV,O(e.server.id),1)]),B(`div`,null,[B(`dt`,mV,O(A(Y)(`serverCard.statusField`)),1),B(`dd`,hV,O(e.server.status),1)])])]),_:1},8,[`open`,`title`,`description`])],2)}}}),_V={class:`flex flex-wrap items-start justify-between gap-3`},vV={class:`min-w-0`},yV={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},bV={class:`text-2xl font-semibold tracking-tight text-ink`},xV={key:1,class:`mt-1 max-w-2xl text-xs leading-relaxed text-muted`},SV={class:`flex shrink-0 flex-wrap items-center gap-2`},CV=N({__name:`PageHeader`,props:{title:{},description:{default:void 0},backTo:{default:void 0},backLabel:{default:`Back`}},setup(e){return(e,t)=>{let n=pa(`RouterLink`);return L(),R(`header`,_V,[B(`div`,vV,[e.$props.backTo?(L(),z(n,{key:0,to:e.$props.backTo,class:`mb-1 inline-flex items-center gap-1 text-2xs text-muted transition-colors duration-150 hover:text-ink`},{default:j(()=>[V(A(Lv),{class:`size-3`}),H(` `+O(e.$props.backLabel),1)]),_:1},8,[`to`])):U(``,!0),B(`div`,yV,[B(`h1`,bV,O(e.$props.title),1),F(e.$slots,`badges`)]),e.$props.description?(L(),R(`p`,xV,O(e.$props.description),1)):U(``,!0)]),B(`div`,SV,[F(e.$slots,`actions`)])])}}}),wV={key:0,class:`mb-3 flex items-start justify-between gap-3`},TV={class:`min-w-0`},EV={class:`flex shrink-0 items-center gap-1.5`},DV=N({__name:`Panel`,props:{padded:{type:Boolean,default:!0},class:{}},setup(e){return(e,t)=>(L(),R(`section`,{class:D(A(Q)(`rounded-panel border border-line bg-panel shadow-card`,e.$props.padded&&`p-4`,e.$props.class))},[e.$slots.header||e.$slots.actions?(L(),R(`header`,wV,[B(`div`,TV,[F(e.$slots,`header`)]),B(`div`,EV,[F(e.$slots,`actions`)])])):U(``,!0),F(e.$slots,`default`)],2))}}),OV=N({__name:`Skeleton`,props:{class:{default:`h-4 w-24`},rounded:{default:`rounded`}},setup(e){return(t,n)=>(L(),R(`span`,{class:D(A(Q)(`block animate-pulse bg-line-soft`,e.rounded,t.$props.class)),style:{"animation-duration":`1.4s`},"aria-hidden":`true`},null,2))}}),kV={class:`min-w-0`},AV={class:`truncate text-2xs font-medium text-faint`},jV={key:0,class:`mt-0.5 truncate text-2xs text-muted`},MV=N({__name:`StatTile`,props:{label:{},value:{},hint:{default:void 0},tone:{default:`neutral`},mono:{type:Boolean,default:!0}},setup(e){return(e,t)=>(L(),R(`div`,kV,[B(`p`,AV,O(e.$props.label),1),B(`p`,{class:D(A(Q)(`mt-0.5 truncate text-xl font-semibold tracking-tight`,e.$props.mono&&`font-mono tabular-nums`,e.$props.tone===`neutral`?`text-ink`:A(YI)[e.$props.tone]))},O(e.$props.value),3),e.$props.hint?(L(),R(`p`,jV,O(e.$props.hint),1)):U(``,!0)]))}}),NV=k(null),PV=k(`unknown`),FV=null;async function IV(){try{let e=await(await fetch(`/healthz`,{cache:`no-store`})).json();typeof e.uptimeMs==`number`&&(NV.value=Date.now()-e.uptimeMs),PV.value=e.status===`degraded`?`degraded`:`ok`}catch{PV.value=`unknown`}}function LV(){return FV??=IV().finally(()=>{FV=null}),{startedAt:NV,status:PV,refresh:IV}}var RV={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},zV={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},BV={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},VV={class:`p-4`},HV={class:`p-4`},UV={class:`p-4`},WV={class:`p-4`},GV={class:`p-4`},KV={key:0,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},qV={class:`min-w-0`},JV={class:`text-xs font-medium text-danger`},YV={class:`mt-0.5 flex flex-wrap gap-x-3 gap-y-1 text-2xs text-danger`},XV=[`onClick`],ZV={class:`grid gap-4 lg:grid-cols-3`},QV={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},$V={class:`text-2xs text-muted`},eH={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},tH={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},nH={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},rH={class:`font-mono text-2xs font-normal text-faint`},iH={class:`text-2xs text-muted`},aH={class:`ml-auto flex items-center gap-1.5`},oH={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-3 py-2 text-2xs leading-4 text-danger`},sH={key:2,class:`grid gap-4 lg:grid-cols-2`},cH={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},lH={class:`font-mono`},uH=N({__name:`GlobalOverviewView`,setup(e){let t=XN(),n=dP(),r=LV(),i=Rg(),a=k(!1),o=k(``),s=W(()=>t.appState.value===null),c=W(()=>t.workspaces.value),l=W(()=>t.allServers.value.map(e=>e.server)),u=W(()=>l.value.filter(e=>e.status===`running`)),d=W(()=>l.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),f=W(()=>t.host.value),p=W(()=>r.startedAt.value===null?`—`:jL(t.now.value-r.startedAt.value)),m=W(()=>f.value?.enabled?jL(f.value.uptimeMs):`—`);function h(e){o.value=e,a.value=!0}function g(e,t){n.select(e),i.push(u1(e,`servers`,t))}return na(async()=>{await r.refresh()}),(e,_)=>(L(),R(`div`,RV,[V(CV,{title:A(Y)(`nav.globalOverview`),description:A(Y)(`views.globalOverview.description`)},null,8,[`title`,`description`]),V(DV,{class:`p-0`},{default:j(()=>[s.value?(L(),R(`div`,zV,[(L(),R(I,null,P(5,e=>B(`div`,{key:e,class:`space-y-2`},[V(OV,{class:`h-2.5 w-16`}),V(OV,{class:`h-6 w-20`})])),64))])):(L(),R(`div`,BV,[B(`div`,VV,[V(MV,{label:A(Y)(`views.globalOverview.workspaces`),value:String(c.value.length),hint:A(Y)(`views.globalOverview.serversTotal`,{count:l.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,HV,[V(MV,{label:A(Y)(`views.overview.running`),value:`${u.value.length}/${l.value.length}`,tone:`ok`,hint:A(Y)(`views.overview.notUp`,{count:l.value.length-u.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,UV,[V(MV,{label:A(Y)(`views.overview.needsAttention`),value:String(d.value.length),tone:d.value.length>0?`danger`:`ok`,hint:d.value.length===0?A(Y)(`views.overview.nothingBroken`):A(Y)(`views.overview.crashedOrUnhealthy`)},null,8,[`label`,`value`,`tone`,`hint`])]),B(`div`,WV,[V(MV,{label:A(Y)(`views.globalOverview.panelUptime`),value:p.value,hint:A(r).status.value===`degraded`?A(Y)(`views.globalOverview.degraded`):A(Y)(`views.globalOverview.serving`)},null,8,[`label`,`value`,`hint`])]),B(`div`,GV,[V(MV,{label:A(Y)(`views.globalOverview.hostUptime`),value:m.value,hint:f.value?.enabled?A(Y)(`views.globalOverview.samplingOn`):A(Y)(`views.globalOverview.samplingOff`)},null,8,[`label`,`value`,`hint`])])]))]),_:1}),d.value.length>0?(L(),R(`div`,KV,[V(A(Vv),{class:`mt-0.5 size-4 shrink-0 text-danger`}),B(`div`,qV,[B(`p`,JV,O(A(_F)(`views.globalOverview.needLook`,d.value.length)),1),B(`p`,YV,[(L(!0),R(I,null,P(A(t).allServers.value.filter(e=>e.server.status===`crashed`||e.server.status===`conflict`||e.server.health===`unhealthy`),e=>(L(),R(`button`,{key:`${e.workspace.id}:${e.server.id}`,type:`button`,class:`font-mono underline decoration-danger/40 underline-offset-2 hover:decoration-danger`,onClick:t=>g(e.workspace.id,e.server.id)},O(e.workspace.label)+`/`+O(e.server.id),9,XV))),128))])])])):U(``,!0),B(`div`,ZV,[V(DV,{class:`lg:col-span-2`},{header:j(()=>[B(`h2`,QV,[V(A(Jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.globalOverview.hostVitals`)),1)]),B(`p`,$V,O(A(Y)(`views.globalOverview.hostVitalsNote`)),1)]),default:j(()=>[V(iR,{host:f.value,now:A(t).now.value},null,8,[`host`,`now`])]),_:1}),V(DV,null,{header:j(()=>[B(`h2`,eH,[V(A(jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.overview.recentActivity`)),1)])]),default:j(()=>[V(fR,{servers:l.value,now:A(t).now.value,limit:12},null,8,[`servers`,`now`])]),_:1})]),!s.value&&l.value.length===0?(L(),z(gL,{key:1,title:A(Y)(`views.globalOverview.emptyTitle`),description:A(Y)(`views.globalOverview.emptyDescription`)},{icon:j(()=>[V(A(Ty),{class:`size-4`})]),_:1},8,[`title`,`description`])):U(``,!0),(L(!0),R(I,null,P(c.value,e=>(L(),R(`section`,{key:e.id,class:`space-y-3`},[B(`div`,tH,[B(`h2`,nH,[V(A(ay),{class:`size-3.5 text-faint`}),H(` `+O(e.label)+` `,1),B(`span`,rH,O(e.id),1)]),B(`span`,iH,O(A(Y)(`views.globalOverview.groupRunning`,{running:e.runningCount,total:e.serverCount})),1),B(`div`,aH,[V($,{size:`xs`,variant:`ghost`,onClick:t=>h(e.id)},{default:j(()=>[V(A(vy),{class:`size-3`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1},8,[`onClick`]),V($,{size:`xs`,variant:`ghost`,onClick:t=>{A(n).select(e.id),A(i).push(A(u1)(e.id,`overview`))}},{default:j(()=>[H(O(A(Y)(`views.globalOverview.openWorkspace`)),1)]),_:1},8,[`onClick`])])]),e.configError?(L(),R(`p`,oH,O(A(Y)(`views.globalOverview.configError`,{error:e.configError})),1)):U(``,!0),e.servers.length===0?(L(),z(gL,{key:1,compact:``,title:A(Y)(`views.overview.emptyTitle`),description:A(Y)(`views.globalOverview.groupEmptyDescription`)},{action:j(()=>[V($,{size:`sm`,variant:`primary`,onClick:t=>h(e.id)},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1},8,[`onClick`])]),_:2},1032,[`title`,`description`])):(L(),R(`div`,sH,[(L(!0),R(I,null,P(e.servers,n=>(L(),z(gV,{key:n.id,server:n,"workspace-id":e.id,series:A(t).seriesOf(e.id,n.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]))),128)),B(`p`,cH,[B(`span`,null,O(A(Y)(`views.overview.sampling`)),1),B(`span`,lH,O(A(t).appState.value?.control.url),1)]),V(dB,{open:a.value,"onUpdate:open":_[0]||=e=>a.value=e,"workspace-id":o.value},null,8,[`open`,`workspace-id`])]))}}),dH={class:`text-xs font-semibold text-ink`},fH={key:0,class:`mt-1 text-2xs leading-4 text-muted`},pH={class:`mt-2.5 flex justify-end gap-1.5`},mH=N({__name:`ConfirmButton`,props:{label:{},confirmLabel:{default:void 0},variant:{default:`danger-ghost`},confirmVariant:{default:`danger`},size:{default:`sm`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},title:{default:void 0},hint:{default:void 0}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=W(()=>n.confirmLabel??Y(`common.confirm`)),o=W(()=>n.title??Y(`common.confirmQuestion`,{label:a.value}));function s(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(Wh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[V($,{variant:n.variant,size:n.size,disabled:n.disabled,loading:n.loading},{default:j(()=>[H(O(n.label),1)]),_:1},8,[`variant`,`size`,`disabled`,`loading`])]),_:1}),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`end`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,dH,O(o.value),1),n.hint?(L(),R(`p`,fH,O(n.hint),1)):U(``,!0),B(`div`,pH,[V(A(Gh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:n.confirmVariant,loading:n.loading,onClick:s},{default:j(()=>[H(O(a.value),1)]),_:1},8,[`variant`,`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),hH={class:`min-w-0 flex-1`},gH={key:0,class:`text-xs font-semibold`},_H=N({__name:`Notice`,props:{tone:{default:`info`},title:{default:void 0},class:{default:void 0}},setup(e){let t=e,n={ok:Hv,warn:Ly,danger:my,info:ry,neutral:ry,accent:Dy},r=W(()=>n[t.tone]);return(e,n)=>(L(),R(`div`,{class:D(A(Q)(`flex items-start gap-2 rounded-panel border px-3 py-2`,A(XI)[t.tone],t.class))},[(L(),z(ha(r.value),{class:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`})),B(`div`,hH,[t.title?(L(),R(`p`,gH,O(t.title),1)):U(``,!0),B(`div`,{class:D(A(Q)(`text-xs leading-relaxed text-ink/85`,t.title&&`mt-0.5`))},[F(e.$slots,`default`)],2)])],2))}}),vH={class:`space-y-2`},yH={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},bH=N({__name:`AuthenticationSection`,props:za({view:{},dirty:{type:Boolean}},{auth:{required:!0},authModifiers:{}}),emits:za([`reset`],[`update:auth`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`auth`),a=ZR(()=>i.value.sessionTtlMs,e=>i.value.sessionTtlMs=e,6048e5),o=ZR(()=>i.value.maxLoginAttempts,e=>i.value.maxLoginAttempts=e,5),s=ZR(()=>i.value.lockoutMs,e=>i.value.lockoutMs=e,6e4),c=W(()=>n.view?.auth.passwordSet===!0),l=W(()=>n.view?.auth.apiTokenSet===!0),u=W(()=>n.view?.auth.blockedReason??null),d=W(()=>n.view?.auth.exposed===!0),f=W(()=>n.view?.auth.usingDefaultPassword===!0),p=W(()=>i.value.enabled&&!c.value),{setPassword:m,clearPassword:h}=pN(),g=k(``),_=k(``),v=k(``),y=k(null),b=k(null),x=k(!1),S=W(()=>v.value.length>0&&v.value!==_.value),C=W(()=>_.value.length>0&&_.value.length<8),w=W(()=>_.value.length>0&&!S.value&&(!c.value||g.value.length>0));async function T(){if(w.value&&!x.value){x.value=!0,b.value=null,y.value=null;try{let e=await m(c.value?g.value:void 0,_.value);if(e!==null){b.value=e;return}g.value=``,_.value=``,v.value=``,y.value=Y(`settings.auth.passwordUpdated`)}finally{x.value=!1}}}async function ee(){b.value=null,y.value=null;let e=await h();e===null?y.value=Y(`settings.auth.passwordCleared`):b.value=e}return(e,t)=>(L(),R(I,null,[V(gz,{title:A(Y)(`settings.auth.policyTitle`),description:A(Y)(`settings.auth.policyDescription`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.auth.requirePassword`),hint:A(Y)(`settings.auth.requirePasswordHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(a),"onUpdate:modelValue":t[2]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.auth.sessionLifetime`),min:6e4,hint:A(Y)(`settings.auth.sessionLifetimeHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Nz,{modelValue:i.value.cookieSecure,"onUpdate:modelValue":t[3]||=e=>i.value.cookieSecure=e,label:A(Y)(`settings.auth.cookieSecure`),options:[{value:`auto`,label:A(Y)(`settings.auth.cookieSecureAuto`)},{value:`always`,label:A(Y)(`settings.auth.cookieSecureAlways`)},{value:`never`,label:A(Y)(`settings.auth.cookieSecureNever`)}]},null,8,[`modelValue`,`label`,`options`]),V(Nz,{modelValue:i.value.trustProxy,"onUpdate:modelValue":t[4]||=e=>i.value.trustProxy=e,label:A(Y)(`settings.auth.trustProxy`),options:[{value:`off`,label:A(Y)(`settings.auth.trustProxyOff`)},{value:`loopback`,label:A(Y)(`settings.auth.trustProxyLoopback`)},{value:`any`,label:A(Y)(`settings.auth.trustProxyAny`)}],hint:A(Y)(`settings.auth.trustProxyHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`options`,`hint`]),V(Dz,{modelValue:A(o),"onUpdate:modelValue":t[5]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.auth.maxLoginAttempts`),min:1,hint:A(Y)(`settings.auth.maxLoginAttemptsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":t[6]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.auth.lockout`),min:1e3},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`]),B(`div`,vH,[V(_H,{tone:l.value?`info`:`neutral`,title:l.value?A(Y)(`settings.auth.apiTokenSet`):A(Y)(`settings.auth.apiTokenMissing`)},{default:j(()=>[l.value?(L(),z(iB,{key:0,k:`settings.auth.apiTokenNote`},{code:j(()=>[...t[10]||=[B(`code`,null,`Authorization: Bearer …`,-1)]]),_:1})):(L(),z(iB,{key:1,k:`settings.auth.noTokenNote`},{command:j(()=>[...t[11]||=[B(`code`,null,`home-hosted set-token --generate`,-1)]]),_:1}))]),_:1},8,[`tone`,`title`]),f.value?(L(),z(_H,{key:0,tone:`warn`,title:A(Y)(`settings.auth.defaultPasswordTitle`)},{default:j(()=>[V(iB,{k:`settings.auth.defaultPasswordText`},{address:j(()=>[...t[12]||=[B(`code`,null,`127.0.0.1`,-1)]]),_:1})]),_:1},8,[`title`])):U(``,!0),u.value?(L(),z(_H,{key:1,tone:`danger`,title:A(Y)(`settings.auth.blockedTitle`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`])):p.value?(L(),z(_H,{key:2,tone:`warn`,title:A(Y)(`settings.auth.noPasswordTitle`)},{default:j(()=>[V(iB,{k:`settings.auth.noPasswordText`},{address:j(()=>[...t[13]||=[B(`code`,null,`127.0.0.1`,-1)]]),_:1})]),_:1},8,[`title`])):d.value?(L(),z(_H,{key:3,tone:`warn`,title:A(Y)(`settings.auth.exposedTitle`)},{default:j(()=>[H(O(A(Y)(`settings.auth.exposedText`)),1)]),_:1},8,[`title`])):U(``,!0)]),B(`form`,{class:`mt-3`,onSubmit:lu(T,[`prevent`])},[V(gz,{title:c.value?A(Y)(`settings.auth.changePassword`):A(Y)(`settings.auth.setPassword`),description:A(Y)(`settings.auth.passwordDescription`)},{default:j(()=>[c.value?(L(),z(Rz,{key:0,modelValue:g.value,"onUpdate:modelValue":t[7]||=e=>g.value=e,type:`password`,autocomplete:`current-password`,label:A(Y)(`settings.auth.currentPassword`)},null,8,[`modelValue`,`label`])):U(``,!0),V(Rz,{modelValue:_.value,"onUpdate:modelValue":t[8]||=e=>_.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.auth.newPassword`)},null,8,[`modelValue`,`label`]),V(Rz,{modelValue:v.value,"onUpdate:modelValue":t[9]||=e=>v.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.auth.repeatPassword`),error:S.value?A(Y)(`settings.auth.passwordMismatch`):null},null,8,[`modelValue`,`label`,`error`]),B(`div`,yH,[V($,{type:`submit`,variant:`primary`,disabled:!w.value,loading:x.value},{default:j(()=>[H(O(c.value?A(Y)(`settings.auth.updatePassword`):A(Y)(`settings.auth.setPasswordAndEnable`)),1)]),_:1},8,[`disabled`,`loading`]),c.value?(L(),z(mH,{key:0,label:A(Y)(`settings.auth.clearPassword`),"confirm-label":A(Y)(`settings.auth.clearPasswordConfirm`),"confirm-variant":`danger`,title:A(Y)(`settings.auth.clearPasswordTitle`),hint:A(Y)(`settings.auth.clearPasswordHint`),disabled:x.value,onConfirm:ee},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),C.value||b.value||y.value?(L(),R(I,{key:1},[C.value?(L(),z(_H,{key:0,tone:`warn`,title:A(Y)(`settings.auth.shortPasswordTitle`),class:`sm:col-span-2`},{default:j(()=>[H(O(A(Y)(`settings.auth.shortPasswordText`)),1)]),_:1},8,[`title`])):U(``,!0),b.value?(L(),z(_H,{key:1,tone:`danger`,class:`sm:col-span-2`},{default:j(()=>[H(O(b.value),1)]),_:1})):U(``,!0),y.value?(L(),z(_H,{key:2,tone:`ok`,class:`sm:col-span-2`},{default:j(()=>[H(O(y.value),1)]),_:1})):U(``,!0)],64)):U(``,!0)]),_:1},8,[`title`,`description`])],32)],64))}});function xH(e){return e.labelKey===void 0?e.label:Y(e.labelKey,e.labelParams,e.label)}function SH(e){return e.note===null?null:e.noteKey===void 0?e.note:Y(e.noteKey,e.noteParams,e.note)}var CH={settings:`settings.backups.kindSettings`,servers:`settings.backups.kindServers`,secrets:`settings.backups.kindSecrets`,tls:`settings.backups.kindTls`,data:`settings.backups.kindData`,workspace:`settings.backups.kindWorkspace`};function wH(e){let t=CH[e];return t===void 0?e:Y(t)}function TH(e){let t=SH(e);return t!==null&&t.length>0?t:e.kind===`settings`?Y(`settings.backup.leafSettingsHint`):e.kind===`servers`?Y(`settings.backup.leafServersHint`):e.kind===`secrets`?Y(`settings.backup.leafSecretsHint`):e.path===void 0?Y(`settings.backup.leafDataHint`):e.origin===void 0?e.path:Y(`settings.backup.pathFromOrigin`,{path:e.path,origin:e.origin})}function EH(e){return e.leaves.length>0&&e.leaves.every(e=>e.selected)}function DH(e){let t=SH(e);return t!==null&&t.length>0?t:e.kind===`settings`?Y(`settings.backup.entrySettingsHint`):e.kind===`secrets`?Y(`settings.backup.entrySecretsHint`):e.kind===`tls`?Y(`settings.backup.entryTlsHint`):Y(`settings.backup.entryWorkspaceHint`)}function OH(e,t=[]){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return{id:e.id,label:xH(e),hint:DH(e),kind:e.kind,...e.workspaceId===void 0?{}:{workspaceId:e.workspaceId},selected:t?.selected??!0,leaves:e.items.map(e=>({id:e.id,label:xH(e),hint:TH(e),kind:e.kind,selected:t?.leaves.find(t=>t.id===e.id)?.selected??!0}))}})}function kH(e){return e.kind===`workspace`?e.selected&&e.leaves.some(e=>e.selected):e.selected}function AH(e,t){for(let n of e){n.selected=t;for(let e of n.leaves)e.selected=t}}function jH(e){let t=e.filter(e=>kH(e));if(e.length>0&&t.length===e.length&&t.every(e=>e.kind!==`workspace`||EH(e)))return;let n=[];for(let e of t){if(e.kind!==`workspace`){n.push(e.id);continue}EH(e)?n.push(e.id):n.push(...e.leaves.filter(e=>e.selected).map(e=>e.id))}return n}function MH(e){let t=0,n=0;for(let r of e)kH(r)&&(n+=1,t+=r.kind===`workspace`?r.leaves.filter(e=>e.selected).length:1);return{entries:n,leaves:t}}var NH=[`disabled`],PH={class:`min-w-0`},FH={class:`text-ink`},IH=N({__name:`CheckField`,props:za({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=so(e,`modelValue`);return(e,r)=>(L(),R(`label`,{class:D(A(Q)(`flex cursor-pointer select-none items-start gap-2 rounded-control px-2 py-1.5 text-xs transition-colors duration-150`,`hover:bg-hover`,t.disabled&&`cursor-not-allowed opacity-50 hover:bg-transparent`))},[Sr(B(`input`,{"onUpdate:modelValue":r[0]||=e=>n.value=e,type:`checkbox`,disabled:t.disabled,class:`mt-0.5 size-3.5 shrink-0 cursor-pointer appearance-none rounded-[4px] border border-line bg-page checked:border-accent checked:bg-accent checked:bg-[length:9px] checked:bg-center checked:bg-no-repeat checked:[background-image:url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22white%22 stroke-width=%224%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M20 6 9 17l-5-5%22/></svg>')] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:cursor-not-allowed`},null,8,NH),[[Yl,n.value]]),B(`span`,PH,[B(`span`,FH,O(t.label),1),t.hint?(L(),R(`span`,{key:0,class:D([`mt-0.5 block`,[A(xz)]])},O(t.hint),3)):U(``,!0),F(e.$slots,`default`)])],2))}}),LH={class:`space-y-3`},RH={class:`flex items-center justify-between gap-2`},zH={class:`text-xs font-medium text-muted`},BH={class:`flex items-center gap-1.5`},VH={class:`max-h-80 space-y-1.5 overflow-auto`},HH={class:`flex items-start gap-2.5`},UH={class:`min-w-0 flex-1`},WH={key:0,class:`flex shrink-0 items-center gap-1.5 pt-0.5`},GH={class:`font-mono text-2xs text-faint`},KH={key:1,class:`shrink-0 rounded-control border border-line px-1.5 py-0.5 text-2xs text-faint`},qH={key:0,class:`mt-1 flex items-center gap-1 pl-6 text-2xs text-warn`},JH={class:`space-y-3`},YH={class:`flex items-center justify-between gap-2`},XH={class:`text-xs font-medium text-muted`},ZH={class:`flex items-center gap-1.5`},QH={class:`max-h-72 space-y-1 overflow-auto`},$H={key:0,class:`text-xs text-muted`},eU=N({__name:`BackupDialog`,props:za({state:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=k(!1),o=k(null),s=k(``),c=k([]),l=k(!1),u=k(null),d=k({});function f(e){c.value=OH(n.state?.entries??[],e?c.value:[])}let p=W(()=>MH(c.value)),m=W(()=>c.value.find(e=>e.id===`global:settings`)?.selected??!1),h=W(()=>n.state!==null&&p.value.leaves>0&&!a.value),g=W(()=>u.value===null?0:u.value.leaves.filter(e=>d.value[e.id]===!0).length);M(i,e=>{e&&(s.value=``,o.value=null,f(!1))},{immediate:!0}),M(()=>n.state,()=>{i.value&&f(!0)});function _(e){u.value=e,d.value=Object.fromEntries(e.leaves.map(e=>[e.id,e.selected])),l.value=!0}function v(){let e=u.value;if(e!==null){for(let t of e.leaves)t.selected=d.value[t.id]===!0;e.leaves.some(e=>e.selected)&&(e.selected=!0),l.value=!1,u.value=null}}function y(e){let t=u.value;t!==null&&(d.value=Object.fromEntries(t.leaves.map(t=>[t.id,e])))}async function b(){if(h.value){a.value=!0,o.value=null;try{await UM(s.value,jH(c.value)),i.value=!1,r(`created`,Y(`settings.backup.created`))}catch(e){o.value=Lj(e)}finally{a.value=!1}}}return(e,t)=>(L(),R(I,null,[V($z,{open:i.value,"onUpdate:open":t[4]||=e=>i.value=e,title:A(Y)(`settings.backup.createTitle`),description:A(Y)(`settings.backup.createDescription`),width:`w-[min(92vw,40rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[3]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{size:`sm`,variant:`primary`,disabled:!h.value,loading:a.value,onClick:b},{default:j(()=>[H(O(A(Y)(`settings.backup.create`)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`div`,LH,[B(`div`,RH,[B(`span`,zH,O(A(_F)(`settings.backup.entriesCount`,p.value.entries))+` · `+O(A(_F)(`settings.backup.itemsSelected`,p.value.leaves)),1),B(`div`,BH,[V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[0]||=e=>A(AH)(c.value,!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>A(AH)(c.value,!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1},8,[`disabled`])])]),B(`ul`,VH,[(L(!0),R(I,null,P(c.value,e=>(L(),R(`li`,{key:e.id,class:`rounded-control border border-line-soft bg-panel-2/30 px-2.5 py-2`},[B(`div`,HH,[B(`div`,UH,[V(IH,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:e.label,hint:e.hint,disabled:a.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]),e.kind===`workspace`?(L(),R(`div`,WH,[B(`span`,GH,O(e.leaves.filter(e=>e.selected).length)+`/`+O(e.leaves.length),1),V($,{size:`xs`,variant:`secondary`,disabled:a.value,onClick:t=>_(e)},{default:j(()=>[V(A(Pv),{class:`size-3`}),H(O(A(Y)(`settings.backup.chooseItems`)),1)]),_:1},8,[`disabled`,`onClick`])])):(L(),R(`span`,KH,O(A(wH)(e.kind)),1))]),e.kind===`workspace`&&e.selected&&!A(EH)(e)&&e.leaves.some(e=>e.selected)?(L(),R(`p`,qH,[V(A(ay),{class:`size-3`}),H(` `+O(A(Y)(`settings.backup.partialCapture`)),1)])):U(``,!0)]))),128))]),m.value?U(``,!0):(L(),z(_H,{key:0,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.backup.withoutGlobalSettings`)),1)]),_:1})),V(Rz,{modelValue:s.value,"onUpdate:modelValue":t[2]||=e=>s.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.backup.password`),hint:A(Y)(`settings.backup.passwordHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),o.value?(L(),z(_H,{key:1,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]),V($z,{open:l.value,"onUpdate:open":t[8]||=e=>l.value=e,title:u.value===null?A(Y)(`settings.backup.chooseItems`):A(Y)(`settings.backup.chooseItemsFor`,{label:u.value.label}),description:A(Y)(`settings.backup.subDescription`),width:`w-[min(92vw,34rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[7]||=e=>l.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,onClick:v},{default:j(()=>[H(O(A(Y)(`settings.backup.apply`)),1)]),_:1})]),default:j(()=>[B(`div`,JH,[B(`div`,YH,[B(`span`,XH,O(A(Y)(`settings.backup.selectedOf`,{selected:g.value,total:u.value?.leaves.length??0})),1),B(`div`,ZH,[V($,{size:`xs`,variant:`ghost`,onClick:t[5]||=e=>y(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1}),V($,{size:`xs`,variant:`ghost`,onClick:t[6]||=e=>y(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1})])]),B(`ul`,QH,[(L(!0),R(I,null,P(u.value?.leaves??[],e=>(L(),R(`li`,{key:e.id,class:`rounded-control px-2 py-1.5 hover:bg-hover`},[V(IH,{"model-value":d.value[e.id]===!0,label:e.label,hint:e.hint,"onUpdate:modelValue":t=>d.value[e.id]=t===!0},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`])]))),128))]),u.value?.leaves.length===0?(L(),R(`p`,$H,O(A(Y)(`settings.backup.nothingSelectable`)),1)):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])],64))}}),tU={class:`space-y-3`},nU={key:0,class:`flex min-w-0 flex-col gap-1`},rU=[`disabled`],iU={key:0,class:`font-mono text-2xs text-muted`},aU={class:`mt-2`},oU={class:`mt-2 max-w-sm`},sU={class:`mt-2`},cU={class:`mt-2`},lU={class:`mt-1 max-h-64 space-y-0.5 overflow-auto`},uU={class:`mt-2 flex flex-wrap items-center gap-2`},dU={class:`mt-2`},fU=`__upload__`,pU=N({__name:`RestoreDialog`,props:za({files:{},initial:{default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`applied`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=k(!1),o=k(null),s=k(null),c=k(null),l=k(``),u=k({kind:`upload`}),d=k(fU),f=W(()=>s.value?.items.filter(e=>e.selected).length??0),p=W(()=>{let e=s.value;return e===null?[]:e.appliedIds===void 0?e.applied:e.appliedIds.map(t=>xH(e.items.find(e=>e.id===t)??{label:t}))}),m=W(()=>{let e=s.value;return e===null?[]:e.skippedItems===void 0?e.skipped:e.skippedItems.map(e=>{let t=xH(e);return e.reasonKey===void 0?t:`${t} (${Y(e.reasonKey,e.reasonParams)})`})}),h=W(()=>s.value?.items.some(e=>e.id===`global:settings`&&e.selected)??!1),g=W(()=>s.value?.needsPassword===!0),_=W(()=>s.value!==null&&!g.value&&f.value>0&&!a.value),v=W(()=>[...n.files.map(e=>({value:e.name,label:e.encrypted?Y(`settings.restore.encryptedName`,{name:e.name}):e.name})),{value:fU,label:Y(`settings.restore.uploadOption`)}]),y=Q(Sz,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);function b(e){return Lj(e)}function x(){return l.value.length>0?{password:l.value}:{}}async function S(){let e=u.value;if(e.kind===`upload`&&c.value===null){s.value=null;return}a.value=!0,o.value=null,s.value=null;try{s.value=e.kind===`stored`?await iM(e.name,!1,x()):await WM(c.value,!1,x())}catch(e){o.value=b(e)}finally{a.value=!1}}function C(e){d.value=e,c.value=null,u.value=e===fU?{kind:`upload`}:{kind:`stored`,name:e},S()}function w(e){c.value=e.target.files?.[0]??null,S()}function T(e){for(let t of s.value?.items??[])t.restorable&&(t.selected=e)}async function ee(){let e=s.value,t=u.value;if(e===null||!_.value)return;a.value=!0,o.value=null;let n={...x(),include:e.items.filter(e=>e.restorable&&e.selected).map(e=>e.id)};try{let e=t.kind===`stored`?await iM(t.name,!0,n):await WM(c.value,!0,n);i.value=!1,s.value=null,c.value=null,l.value=``;let a=[];e.reloaded&&a.push(Y(`settings.restore.noteReloaded`)),e.restartRequired&&a.push(Y(`settings.restore.noteRestart`));let o=e.applied.length;r(`applied`,a.length===0?Y(`settings.restore.restored`,{count:o}):Y(`settings.restore.restoredWithNotes`,{count:o,notes:a.join(`; `)}))}catch(e){o.value=b(e)}finally{a.value=!1}}return M(i,e=>{if(!e){s.value=null,c.value=null,l.value=``,o.value=null;return}let t=n.files[0];u.value=n.initial??(t===void 0?{kind:`upload`}:{kind:`stored`,name:t.name}),d.value=u.value.kind===`stored`?u.value.name:fU,S()},{immediate:!0}),(e,t)=>(L(),z($z,{open:i.value,"onUpdate:open":t[4]||=e=>i.value=e,title:A(Y)(`settings.restore.title`),description:A(Y)(`settings.restore.description`),width:`w-[min(92vw,38rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[3]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),s.value&&!g.value?(L(),z($,{key:0,size:`sm`,variant:`danger`,disabled:!_.value,loading:a.value,onClick:ee},{default:j(()=>[H(O(u.value.kind===`stored`?A(Y)(`settings.restore.applyStored`):A(Y)(`settings.restore.applyUpload`)),1)]),_:1},8,[`disabled`,`loading`])):U(``,!0)]),default:j(()=>[B(`div`,tU,[V(Nz,{"model-value":d.value,label:A(Y)(`settings.restore.archive`),hint:A(Y)(`settings.restore.archiveHint`),options:v.value,disabled:a.value,wide:``,"onUpdate:modelValue":C},null,8,[`model-value`,`label`,`hint`,`options`,`disabled`]),u.value.kind===`upload`?(L(),R(`div`,nU,[B(`label`,{class:D(A(bz)),for:`restore-upload`},O(A(Y)(`settings.restore.archiveFile`)),3),B(`input`,{id:`restore-upload`,type:`file`,accept:`.zip,application/zip`,class:D(A(y)),disabled:a.value,onChange:w},null,42,rU),c.value?(L(),R(`p`,iU,O(c.value.name),1)):U(``,!0)])):U(``,!0),a.value?(L(),z(OV,{key:1,class:`h-20 w-full`})):s.value?(L(),z(_H,{key:2,tone:`warn`,title:A(Y)(`settings.restore.unchangedTitle`)},{default:j(()=>[B(`p`,null,[u.value.kind===`stored`?(L(),z(iB,{key:0,k:`settings.restore.archiveLine`},{name:j(()=>[B(`code`,null,O(u.value.name),1)]),_:1})):(L(),R(I,{key:1},[H(O(A(Y)(`settings.restore.uploadedArchive`)),1)],64))]),s.value.needsPassword?(L(),R(I,{key:0},[B(`p`,aU,O(s.value.error??A(Y)(`settings.restore.passwordProtected`)),1),B(`div`,oU,[V(Rz,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,type:`password`,autocomplete:`off`,label:A(Y)(`settings.restore.password`)},null,8,[`modelValue`,`label`])]),B(`div`,sU,[V($,{size:`sm`,variant:`secondary`,disabled:a.value,onClick:S},{default:j(()=>[H(O(A(Y)(`settings.restore.checkAgain`)),1)]),_:1},8,[`disabled`])])],64)):(L(),R(I,{key:1},[B(`p`,cU,O(A(Y)(`settings.restore.choosePrompt`,{selected:f.value,total:s.value.items.length})),1),B(`ul`,lU,[(L(!0),R(I,null,P(s.value.items,e=>(L(),R(`li`,{key:e.id},[V(IH,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:A(xH)(e),hint:[A(wH)(e.kind),e.workspaceId,A(SH)(e)].filter(Boolean).join(` · `),disabled:!e.restorable||a.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]))),128))]),B(`div`,uU,[V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>T(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[2]||=e=>T(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1},8,[`disabled`])]),B(`p`,dU,[H(O(A(Y)(`settings.restore.willRestore`,{items:p.value.join(`, `)||A(Y)(`settings.restore.nothing`)}))+` `,1),m.value.length>0?(L(),R(I,{key:0},[H(O(A(Y)(`settings.restore.skipped`,{items:m.value.join(`, `)})),1)],64)):U(``,!0),s.value.restartRequired?(L(),R(I,{key:1},[H(O(A(Y)(`settings.restore.restartNote`)),1)],64)):h.value?(L(),R(I,{key:2},[H(O(A(Y)(`settings.restore.reloadedNote`)),1)],64)):U(``,!0)])],64))]),_:1},8,[`title`])):U(``,!0),o.value?(L(),z(_H,{key:3,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),mU=[`aria-label`],hU=N({__name:`CopyButton`,props:{value:{},label:{default:void 0},class:{default:void 0}},setup(e){let t=e,n=k(!1),r=null;async function i(){try{await navigator.clipboard.writeText(t.value),n.value=!0,r&&clearTimeout(r),r=setTimeout(()=>{n.value=!1},1400)}catch{}}return Be(()=>{r&&clearTimeout(r)}),(e,r)=>(L(),R(`button`,{type:`button`,class:D(A(Q)(`inline-grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,A(yz),t.class)),"aria-label":n.value?A(Y)(`common.copied`):t.label??A(Y)(`common.copy`),onClick:i},[n.value?(L(),z(A(Fv),{key:0,class:`size-3.5 text-ok`})):(L(),z(A(qv),{key:1,class:`size-3.5`}))],10,mU))}}),gU={key:0,class:`size-1.5 shrink-0 rounded-full bg-current`},_U=N({__name:`ToneBadge`,props:{tone:{default:`neutral`},dot:{type:Boolean,default:!1},mono:{type:Boolean,default:!1},plain:{type:Boolean,default:!1}},setup(e){let t=e,n=W(()=>Q(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium whitespace-nowrap`,t.plain?Q(`border-transparent bg-transparent`,XI[t.tone].split(` `).filter(e=>e.startsWith(`text-`)).join(` `)):XI[t.tone],t.mono&&`font-mono`));return(e,r)=>(L(),R(`span`,{class:D(n.value)},[t.dot?(L(),R(`span`,gU)):U(``,!0),F(e.$slots,`default`)],2))}}),vU={class:`space-y-3`},yU={key:0,class:`sm:col-span-2`},bU={key:1,class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},xU={class:`text-xs font-medium text-muted`},SU={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},CU={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},wU={class:`text-2xs leading-4 text-faint`},TU={key:0,class:`space-y-2 sm:col-span-2`},EU={key:1,class:`text-xs text-muted sm:col-span-2`},DU={key:2,class:`divide-y divide-line-soft sm:col-span-2`},OU={class:`flex items-center gap-2`},kU={class:`min-w-0 flex-1 truncate text-xs font-medium text-ink`},AU={key:0,class:`font-mono text-2xs text-faint`},jU={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},MU={key:1,class:`mt-1 space-y-1`},NU={class:`min-w-0`},PU={class:`truncate font-mono text-2xs text-ink`},FU={class:`mt-0.5 text-2xs leading-4 text-faint`},IU={key:3,class:`text-2xs leading-4 text-faint sm:col-span-2`},LU={key:0,class:`space-y-2 sm:col-span-2`},RU={key:1,class:`sm:col-span-2`},zU={key:2,class:`divide-y divide-line-soft sm:col-span-2`},BU={class:`min-w-0 flex-1`},VU={class:`flex items-center gap-2`},HU={class:`truncate font-mono text-xs text-ink`},UU={class:`mt-0.5 font-mono text-2xs tabular-nums text-muted`},WU={class:`flex items-center gap-1.5`},GU=[`href`],KU={key:3,class:`space-y-2 sm:col-span-2`},qU=N({__name:`BackupsSection`,props:za({state:{},policy:{},configPath:{},workspaces:{},dirty:{type:Boolean}},{form:{required:!0},formModifiers:{}}),emits:za([`reset`],[`update:form`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`form`),a=XN(),o=ZR(()=>i.value.keep,e=>i.value.keep=e,5),s=k(!1),c=k(null),l=k(null),u=k(!1),d=k(!1),f=k(null),p=W(()=>n.state?.files??[]),m=W(()=>n.state?.entries??[]),h=Q(`inline-flex h-6 shrink-0 items-center gap-1 rounded-control border border-line bg-raise px-2 text-2xs font-medium text-ink`,`transition-colors duration-150 hover:bg-hover`,yz);function g(e){f.value=e===void 0?null:{kind:`stored`,name:e},d.value=!0}function _(e){l.value=null,c.value=e,a.refresh()}function v(e){l.value=null,c.value=e,a.refresh()}async function y(e){s.value=!0,l.value=null,c.value=null;try{await Yj(e),c.value=Y(`settings.backups.deleted`,{name:e}),await a.refresh()}catch(e){l.value=Lj(e)}finally{s.value=!1}}return(e,t)=>(L(),R(`div`,vU,[V(gz,{title:A(Y)(`settings.backups.policyTitle`),description:A(Y)(`settings.backups.policyDescription`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.backups.allow`),hint:A(Y)(`settings.backups.allowHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),i.value.enabled?U(``,!0):(L(),R(`div`,yU,[V(_H,{tone:`warn`,title:A(Y)(`settings.backups.offTitle`)},{default:j(()=>[H(O(A(Y)(`settings.backups.offText`)),1)]),_:1},8,[`title`])])),V(Dz,{modelValue:A(o),"onUpdate:modelValue":t[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.backups.keep`),min:1,hint:A(Y)(`settings.backups.keepHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:i.value.includePaths,"onUpdate:modelValue":t[3]||=e=>i.value.includePaths=e,label:A(Y)(`settings.backups.extraPaths`),hint:A(Y)(`settings.backups.extraPathsHint`),placeholder:A(Y)(`settings.backups.extraPathsPlaceholder`)},null,8,[`modelValue`,`label`,`hint`,`placeholder`]),n.policy===null?U(``,!0):(L(),R(`div`,bU,[B(`span`,xU,O(A(Y)(`settings.backups.archiveDirectory`)),1),B(`div`,SU,[B(`span`,CU,O(n.policy.dir),1),V(hU,{value:n.policy.dir,label:A(Y)(`settings.backups.copyArchiveDirectory`)},null,8,[`value`,`label`])]),B(`p`,wU,[V(iB,{k:`settings.backups.changeDirectory`},{path:j(()=>[B(`code`,null,O(n.configPath??A(Y)(`settings.backups.theSettingsFile`)),1)]),_:1})])]))]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`settings.backups.capturesTitle`),description:A(Y)(`settings.backups.capturesDescription`)},{default:j(()=>[n.state===null?(L(),R(`div`,TU,[V(OV,{class:`h-4 w-full`}),V(OV,{class:`h-4 w-2/3`})])):m.value.length===0?(L(),R(`p`,EU,O(A(Y)(`settings.backups.nothingSelectable`)),1)):(L(),R(`ul`,DU,[(L(!0),R(I,null,P(m.value,e=>(L(),R(`li`,{key:e.id,class:`py-2 first:pt-0`},[B(`div`,OU,[B(`p`,kU,O(A(xH)(e)),1),V(_U,{tone:`neutral`,plain:``},{default:j(()=>[H(O(A(wH)(e.kind)),1)]),_:2},1024),e.workspaceId?(L(),R(`span`,AU,O(e.workspaceId),1)):U(``,!0)]),A(SH)(e)?(L(),R(`p`,jU,O(A(SH)(e)),1)):U(``,!0),e.items.length>0?(L(),R(`ul`,MU,[(L(!0),R(I,null,P(e.items,e=>(L(),R(`li`,{key:e.id,class:`flex items-start justify-between gap-3 rounded-control bg-panel-2/40 px-2 py-1`},[B(`div`,NU,[B(`p`,PU,O(e.path??A(xH)(e)),1),B(`p`,FU,[H(O(e.included?e.origin?A(Y)(`settings.backups.fromOrigin`,{origin:e.origin}):A(SH)(e)??A(Y)(`settings.backups.included`):A(SH)(e)??A(Y)(`settings.backups.notCaptured`))+` `,1),e.included&&e.ignoreGenerated?(L(),R(I,{key:0},[H(` · `+O(A(Y)(`settings.backups.generatedSkipped`)),1)],64)):U(``,!0)])]),V(_U,{tone:e.included?`ok`:`neutral`,plain:``},{default:j(()=>[H(O(e.included?A(Y)(`settings.backups.included`):A(Y)(`settings.backups.skipped`)),1)]),_:2},1032,[`tone`])]))),128))])):U(``,!0)]))),128))])),n.workspaces.length>1?(L(),R(`p`,IU,O(A(Y)(`settings.backups.workspacesNote`,{count:n.workspaces.length})),1)):U(``,!0)]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`settings.backups.archivesTitle`),description:A(Y)(`settings.backups.archivesDescription`)},{actions:j(()=>[i.value.enabled?(L(),z($,{key:0,size:`xs`,variant:`primary`,disabled:n.state===null,onClick:t[4]||=e=>u.value=!0},{default:j(()=>[H(O(A(Y)(`settings.backups.create`)),1)]),_:1},8,[`disabled`])):U(``,!0),V($,{size:`xs`,variant:`secondary`,disabled:n.state===null,onClick:t[5]||=e=>g()},{default:j(()=>[H(O(A(Y)(`settings.backups.restore`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[n.state===null?(L(),R(`div`,LU,[V(OV,{class:`h-4 w-full`}),V(OV,{class:`h-4 w-2/3`})])):p.value.length===0?(L(),R(`div`,RU,[V(gL,{compact:``,title:A(Y)(`settings.backups.noArchives`),description:i.value.enabled?A(Y)(`settings.backups.noArchivesEnabled`):A(Y)(`settings.backups.noArchivesDisabled`)},ya({icon:j(()=>[V(A(Mv),{class:`size-4`})]),_:2},[i.value.enabled?{name:`action`,fn:j(()=>[V($,{size:`sm`,variant:`primary`,onClick:t[6]||=e=>u.value=!0},{default:j(()=>[H(O(A(Y)(`settings.backups.create`)),1)]),_:1})]),key:`0`}:void 0]),1032,[`title`,`description`])])):(L(),R(`ul`,zU,[(L(!0),R(I,null,P(p.value,e=>(L(),R(`li`,{key:e.name,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0 last:pb-0`},[B(`div`,BU,[B(`div`,VU,[B(`span`,HU,O(e.name),1),e.encrypted?(L(),z(_U,{key:0,tone:`warn`,plain:``},{default:j(()=>[H(O(A(Y)(`settings.backups.encrypted`)),1)]),_:1})):U(``,!0)]),B(`p`,UU,O(A(IL)(e.sizeBytes))+` · `+O(A(FL)(e.createdAt)),1)]),B(`div`,WU,[B(`a`,{href:Kj(e.name),class:D(A(h))},[V(A(Yv),{class:`size-3`,"aria-hidden":`true`}),H(` `+O(A(Y)(`settings.backups.download`)),1)],10,GU),V($,{size:`xs`,variant:`secondary`,onClick:t=>g(e.name)},{default:j(()=>[V(A(xy),{class:`size-3`,"aria-hidden":`true`}),H(` `+O(A(Y)(`settings.backups.restoreAction`)),1)]),_:1},8,[`onClick`]),V(mH,{label:A(Y)(`common.delete`),"confirm-label":A(Y)(`settings.backups.confirmDelete`),size:`xs`,variant:`ghost`,"confirm-variant":`danger`,disabled:s.value,onConfirm:t=>y(e.name)},null,8,[`label`,`confirm-label`,`disabled`,`onConfirm`])])]))),128))])),l.value||c.value?(L(),R(`div`,KU,[l.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(l.value),1)]),_:1})):U(``,!0),c.value?(L(),z(_H,{key:1,tone:`ok`},{default:j(()=>[H(O(c.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`]),V(eU,{open:u.value,"onUpdate:open":t[7]||=e=>u.value=e,state:n.state,onCreated:_},null,8,[`open`,`state`]),V(pU,{open:d.value,"onUpdate:open":t[8]||=e=>d.value=e,files:p.value,initial:f.value,onApplied:v},null,8,[`open`,`files`,`initial`])]))}}),JU={key:0,class:`mt-3 flex flex-wrap items-center gap-1.5`},YU={class:`text-xs text-muted`},XU={key:1,class:`mt-3 text-xs text-muted`},ZU=N({__name:`HostSection`,props:za({config:{},alerts:{},dirty:{type:Boolean}},{host:{required:!0},hostModifiers:{}}),emits:za([`reset`],[`update:host`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`host`),a=ZR(()=>i.value.intervalMs,e=>i.value.intervalMs=e,15e3),o=ZR(()=>i.value.diskUsedPercent,e=>i.value.diskUsedPercent=e,90),s=ZR(()=>i.value.memoryUsedPercent,e=>i.value.memoryUsedPercent=e,90),c=ZR(()=>i.value.swapUsedPercent,e=>i.value.swapUsedPercent=e,50),l=ZR(()=>i.value.loadPerCpu,e=>i.value.loadPerCpu=e,2),u=ZR(()=>i.value.tempCelsius,e=>i.value.tempCelsius=e,85);return(e,t)=>(L(),R(I,null,[V(gz,{title:A(Y)(`settings.host.title`),description:A(Y)(`settings.host.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.host.enabled`),hint:A(Y)(`settings.host.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(a),"onUpdate:modelValue":t[2]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.host.interval`),min:5e3,hint:A(Y)(`settings.host.intervalHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:i.value.diskPaths,"onUpdate:modelValue":t[3]||=e=>i.value.diskPaths=e,label:A(Y)(`settings.host.diskPaths`),hint:A(Y)(`settings.host.diskPathsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(o),"onUpdate:modelValue":t[4]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.host.diskUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":t[5]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.host.memoryUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(c),"onUpdate:modelValue":t[6]||=e=>hn(c)?c.value=e:null,label:A(Y)(`settings.host.swapUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(l),"onUpdate:modelValue":t[7]||=e=>hn(l)?l.value=e:null,label:A(Y)(`settings.host.loadPerCpu`),min:0,hint:A(Y)(`settings.host.loadPerCpuHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(u),"onUpdate:modelValue":t[8]||=e=>hn(u)?u.value=e:null,label:A(Y)(`settings.host.tempCelsius`),min:0,hint:A(Y)(`settings.host.tempCelsiusHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),n.alerts.length>0?(L(),R(`div`,JU,[B(`span`,YU,O(A(Y)(`settings.host.breachingNow`)),1),(L(!0),R(I,null,P(n.alerts,e=>(L(),z(_U,{key:e,tone:`danger`,dot:``},{default:j(()=>[H(O(e),1)]),_:2},1024))),128))])):i.value.enabled?(L(),R(`p`,XU,O(A(Y)(`settings.host.nothingBreaching`)),1)):U(``,!0)],64))}}),QU={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},$U={class:`text-xs font-medium text-muted`},eW={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},tW={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},nW={class:`text-2xs leading-4 text-faint`},rW={key:0},iW={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},aW={class:`text-xs font-medium text-muted`},oW={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},sW={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},cW={class:`text-2xs leading-4 text-faint`},lW={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},uW={class:`text-xs font-medium text-muted`},dW=[`disabled`],fW={class:`text-2xs leading-4 text-faint sm:col-span-2`},pW=N({__name:`InterfaceSection`,props:za({ui:{},panelVersion:{},labelDirty:{type:Boolean}},{label:{required:!0},labelModifiers:{}}),emits:za([`changed`,`resetLabel`],[`update:label`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`label`),a=k(null),o=k(!1),s=k(null),c=k(null),l=k(!1),u=W(()=>{let e=n.ui;if(e===null)return Y(`common.unknown`);if(!e.custom)return Y(`settings.interface.sourceStock`);let t=e.meta;return t===null?Y(`settings.interface.sourceCustom`):`${Y(`settings.interface.sourceCustom`)} · ${t.name??Y(`settings.interface.unnamed`)}${t.version==null?``:` ${t.version}`}`}),d=W(()=>{let e=n.ui?.meta;if(e==null)return null;let t=e.uploadedAt===void 0?null:new Date(e.uploadedAt).toLocaleString();return`${Y(`settings.interface.fileCount`,{count:e.files??0})}${t===null?``:` · ${t}`}`});function f(e){a.value=e.target.files?.[0]??null,s.value=null,c.value=null}async function p(){if(a.value!==null){o.value=!0,c.value=null,s.value=null;try{let e=await fM(a.value);s.value=Y(`settings.interface.installed`,{name:e.meta?.name??Y(`settings.interface.yourBuild`)}),a.value=null,r(`changed`)}catch(e){c.value=Lj(e)}finally{o.value=!1}}}async function m(){if(!l.value){l.value=!0,setTimeout(()=>{l.value=!1},5e3);return}l.value=!1,o.value=!0,c.value=null;try{let e=await sM();s.value=e.removed?Y(`settings.interface.restored`):Y(`settings.interface.nothingInstalled`),r(`changed`)}catch(e){c.value=Lj(e)}finally{o.value=!1}}return(t,h)=>(L(),z(gz,{title:A(Y)(`settings.interface.title`),description:A(Y)(`settings.interface.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.labelDirty,onClick:h[1]||=e=>r(`resetLabel`)},{default:j(()=>[H(O(A(Y)(`settings.interface.resetName`)),1)]),_:1},8,[`disabled`]),e.ui?.custom?(L(),z($,{key:0,size:`xs`,variant:`ghost`,disabled:o.value,onClick:m},{default:j(()=>[H(O(l.value?A(Y)(`settings.interface.confirmRevert`):A(Y)(`settings.interface.revertToStock`)),1)]),_:1},8,[`disabled`])):U(``,!0),V($,{size:`xs`,variant:`primary`,disabled:o.value||a.value===null,onClick:p},{default:j(()=>[H(O(A(Y)(`settings.interface.install`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[B(`div`,QU,[B(`span`,$U,O(A(Y)(`settings.interface.currentlyServing`)),1),B(`div`,eW,[B(`span`,tW,O(u.value),1),V(hU,{value:e.ui?.dir??``,label:A(Y)(`settings.interface.copyDirectory`)},null,8,[`value`,`label`])]),B(`p`,nW,[d.value?(L(),R(`span`,rW,O(d.value)+` · `,1)):U(``,!0),B(`code`,null,O(e.ui?.dir??`—`),1)])]),B(`div`,iW,[B(`span`,aW,O(A(Y)(`settings.interface.panelVersion`)),1),B(`div`,oW,[B(`span`,sW,O(A(Y)(`app.name`))+` `+O(n.panelVersion??A(Y)(`common.unknown`)),1),n.panelVersion?(L(),z(hU,{key:0,value:n.panelVersion,label:A(Y)(`settings.interface.copyPanelVersion`)},null,8,[`value`,`label`])):U(``,!0)]),B(`p`,cW,[V(iB,{k:`settings.interface.panelVersionHint`},{command:j(()=>[...h[2]||=[B(`code`,null,`home-hosted status`,-1)]]),_:1})])]),V(Rz,{modelValue:i.value,"onUpdate:modelValue":h[0]||=e=>i.value=e,label:A(Y)(`settings.interface.panelName`),hint:A(Y)(`settings.interface.panelNameHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),B(`label`,lW,[B(`span`,uW,O(A(Y)(`settings.interface.uploadLabel`)),1),B(`input`,{type:`file`,accept:`.zip,application/zip`,class:`rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-xs text-ink file:mr-2 file:rounded file:border-0 file:bg-line file:px-2 file:py-1 file:text-xs`,disabled:o.value,onChange:f},null,40,dW)]),c.value?(L(),z(_H,{key:0,tone:`warn`,title:c.value},null,8,[`title`])):s.value?(L(),z(_H,{key:1,tone:`ok`,title:s.value},null,8,[`title`])):U(``,!0),B(`p`,fW,[V(iB,{k:`settings.interface.docsHint`},{docs:j(()=>[...h[3]||=[B(`code`,null,`docs/UI_CREATION.md`,-1)]]),command:j(()=>[...h[4]||=[B(`code`,null,`home-hosted ui-revert`,-1)]]),_:1})])]),_:1},8,[`title`,`description`]))}}),mW={class:`inline-flex items-center gap-0.5 rounded-control border border-line bg-panel-2 p-0.5`},hW=[`aria-pressed`,`onClick`],gW=N({__name:`SegmentedControl`,props:za({options:{},size:{default:`sm`}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=so(e,`modelValue`);return(e,r)=>(L(),R(`div`,mW,[(L(!0),R(I,null,P(t.options,e=>(L(),R(`button`,{key:e.value,type:`button`,class:D(A(Q)(`rounded-[5px] font-medium transition-colors duration-150`,t.size===`sm`?`h-6 px-2 text-2xs`:`h-7 px-2.5 text-xs`,n.value===e.value?`bg-raise text-ink shadow-card`:`text-muted hover:text-ink`)),"aria-pressed":n.value===e.value,onClick:t=>n.value=e.value},O(e.label),11,hW))),128))]))}}),_W={class:`flex min-w-0 flex-col gap-1`},vW={class:`text-xs font-medium text-muted`},yW={class:`text-2xs leading-4 text-faint`},bW={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},xW={class:`text-xs font-medium text-muted`},SW={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},CW={class:`min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-ink`},wW={class:`text-2xs leading-4 text-faint`},TW=N({__name:`ListenerSection`,props:za({view:{},dirty:{type:Boolean}},{control:{required:!0},controlModifiers:{}}),emits:za([`reset`],[`update:control`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`control`),a=ZR(()=>i.value.port,e=>i.value.port=e,3999),o=[`local`,`lan`],s=W({get:()=>o.includes(i.value.host)?i.value.host:`custom`,set:e=>{if(e!==`custom`){i.value.host=e;return}if(!o.includes(i.value.host))return;let t=n.view?.bindHost??``,r=t!==``&&t!==`0.0.0.0`&&t!==`127.0.0.1`&&$k(t)!==null;i.value.host=r?t:`127.0.0.1`}}),c=W(()=>{if(s.value===`custom`&&$k(i.value.host)===null)return Y(`settings.listener.ipv4Error`)}),l=W(()=>n.view?.url??`—`),u=W(()=>s.value===`lan`?Y(`settings.listener.bindLanHint`):s.value===`local`?Y(`settings.listener.bindLocalHint`):Y(`settings.listener.bindCustomHint`));return(e,t)=>(L(),z(gz,{title:A(Y)(`settings.listener.title`),description:A(Y)(`settings.listener.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Dz,{modelValue:A(a),"onUpdate:modelValue":t[1]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.listener.port`),min:1,max:65535,hint:A(Y)(`settings.listener.portHint`)},null,8,[`modelValue`,`label`,`hint`]),B(`div`,_W,[B(`span`,vW,O(A(Y)(`settings.listener.bind`)),1),V(gW,{modelValue:s.value,"onUpdate:modelValue":t[2]||=e=>s.value=e,options:[{value:`local`,label:A(Y)(`settings.listener.bindLocal`)},{value:`lan`,label:A(Y)(`settings.listener.bindLan`)},{value:`custom`,label:A(Y)(`settings.listener.bindCustom`)}]},null,8,[`modelValue`,`options`]),B(`p`,yW,O(u.value),1)]),s.value===`custom`?(L(),z(Rz,{key:0,modelValue:i.value.host,"onUpdate:modelValue":t[3]||=e=>i.value.host=e,label:A(Y)(`settings.listener.ipv4`),placeholder:A(Y)(`settings.listener.ipv4Placeholder`),error:c.value,hint:A(Y)(`settings.listener.ipv4Hint`)},null,8,[`modelValue`,`label`,`placeholder`,`error`,`hint`])):U(``,!0),V(Vz,{modelValue:i.value.openBrowser,"onUpdate:modelValue":t[4]||=e=>i.value.openBrowser=e,label:A(Y)(`settings.listener.openBrowser`),wide:``},null,8,[`modelValue`,`label`]),B(`div`,bW,[B(`span`,xW,O(A(Y)(`settings.listener.liveAddress`)),1),B(`div`,SW,[B(`span`,CW,O(l.value),1),n.view?.restartRequired?(L(),z(_U,{key:0,tone:`warn`,dot:``},{default:j(()=>[H(O(A(Y)(`settings.listener.restartRequired`)),1)]),_:1})):U(``,!0),V(hU,{value:l.value,label:A(Y)(`settings.listener.copyLiveAddress`)},null,8,[`value`,`label`])]),B(`p`,wW,O(A(Y)(`settings.listener.liveAddressHint`)),1)])]),_:1},8,[`title`,`description`]))}}),EW={class:`space-y-3`},DW={class:`divide-y divide-line-soft sm:col-span-2`},OW={class:`min-w-0`},kW={class:`text-xs font-medium text-ink`},AW={class:`mt-0.5 text-2xs leading-4 text-faint`},jW={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},MW={class:`min-w-0 truncate font-mono text-xs text-ink`},NW={class:`flex items-center gap-2 text-xs font-medium text-ink`},PW={class:`font-mono text-2xs font-normal text-faint`},FW={class:`divide-y divide-line-soft`},IW={class:`min-w-0`},LW={class:`text-2xs font-medium text-ink`},RW={class:`mt-0.5 text-2xs leading-4 text-faint`},zW={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},BW={class:`min-w-0 truncate font-mono text-2xs text-ink`},VW=N({__name:`PathsSection`,props:{dataRoot:{},projectDir:{},panelUrl:{},workspaces:{}},setup(e){let t=e,n=W(()=>t.dataRoot===null?null:`${t.dataRoot}/settings.json`),r=W(()=>[{key:`data`,label:Y(`settings.paths.dataRoot`),hint:Y(`settings.paths.dataRootHint`),copyLabel:Y(`settings.paths.dataRoot`),value:t.dataRoot??`—`},{key:`settings`,label:Y(`settings.paths.globalSettings`),hint:Y(`settings.paths.globalSettingsHint`),copyLabel:Y(`settings.paths.globalSettings`),value:n.value??`—`},{key:`project`,label:Y(`settings.paths.projectDir`),hint:Y(`settings.paths.projectDirHint`),copyLabel:Y(`settings.paths.projectDir`),value:t.projectDir??`—`},{key:`panel`,label:Y(`settings.paths.panelAddress`),hint:Y(`settings.paths.panelAddressHint`),copyLabel:Y(`settings.paths.panelAddress`),value:t.panelUrl??`—`}]);function i(e){return[{key:`${e.id}:config`,label:Y(`settings.paths.serversConfig`),hint:Y(`settings.paths.serversConfigHint`,{label:e.label}),copyLabel:Y(`settings.paths.serversConfig`),value:e.configPath},{key:`${e.id}:settings`,label:Y(`settings.paths.workspaceSettings`),hint:Y(`settings.paths.workspaceSettingsHint`),copyLabel:Y(`settings.paths.workspaceSettings`),value:e.settingsPath},{key:`${e.id}:logs`,label:Y(`settings.paths.logs`),hint:Y(`settings.paths.logsHint`),copyLabel:Y(`settings.paths.logs`),value:e.logsDir}]}return(t,n)=>(L(),R(`div`,EW,[V(gz,{title:A(Y)(`settings.paths.whereThingsLive`),description:A(Y)(`settings.paths.whereThingsLiveDescription`)},{default:j(()=>[B(`ul`,DW,[(L(!0),R(I,null,P(r.value,e=>(L(),R(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`},[B(`div`,OW,[B(`p`,kW,O(e.label),1),B(`p`,AW,O(e.hint),1)]),B(`div`,jW,[B(`span`,MW,O(e.value),1),V(hU,{value:e.value,label:A(Y)(`settings.paths.copyPath`,{label:e.copyLabel.toLowerCase()})},null,8,[`value`,`label`])])]))),128))])]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`settings.paths.workspaceFiles`),description:A(Y)(`settings.paths.workspaceFilesDescription`)},{default:j(()=>[(L(!0),R(I,null,P(e.workspaces,e=>(L(),R(`div`,{key:e.id,class:`space-y-2 sm:col-span-2`},[B(`p`,NW,[H(O(e.label)+` `,1),B(`span`,PW,O(e.id),1)]),B(`ul`,FW,[(L(!0),R(I,null,P(i(e),e=>(L(),R(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-1.5`},[B(`div`,IW,[B(`p`,LW,O(e.label),1),B(`p`,RW,O(e.hint),1)]),B(`div`,zW,[B(`span`,BW,O(e.value),1),V(hU,{value:e.value,label:A(Y)(`settings.paths.copyPath`,{label:e.copyLabel.toLowerCase()})},null,8,[`value`,`label`])])]))),128))])]))),128))]),_:1},8,[`title`,`description`])]))}}),HW=[`id`],UW={class:`mb-3`},WW={class:`text-lg font-semibold text-ink`},GW={class:`mt-0.5 text-xs text-muted`},KW=N({__name:`SettingsSection`,props:{id:{},title:{},description:{}},setup(e){return(t,n)=>(L(),R(`section`,{id:e.id,class:`scroll-mt-5`},[B(`header`,UW,[B(`h2`,WW,O(e.title),1),B(`p`,GW,O(e.description),1)]),F(t.$slots,`default`)],8,HW))}}),qW={class:`min-h-full`},JW={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},YW={class:`lg:grid lg:grid-cols-[11rem_minmax(0,1fr)] lg:gap-8`},XW=[`aria-label`],ZW={class:`sticky top-6 space-y-0.5 border-l border-line`},QW=[`aria-current`,`onClick`],$W={class:`space-y-6`},eG={class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},tG={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},nG={class:`min-w-0 flex-1`},rG={class:`text-xs text-muted`},iG={class:`font-mono tabular-nums text-ink`},aG={key:0,class:`mt-0.5 text-xs text-danger`},oG={key:1,class:`mt-0.5 text-xs text-ok`},sG={class:`flex shrink-0 items-center gap-2`},cG={class:`max-h-[60dvh] overflow-auto px-4 py-3`},lG={key:0,class:`divide-y divide-line-soft`},uG={class:`font-mono text-xs text-ink`},dG={class:`ml-auto font-mono text-xs text-muted line-through`},fG={class:`font-mono text-xs text-accent`},pG={key:1,class:`text-xs text-muted`},mG={class:`flex items-center justify-end gap-2 border-t border-line px-4 py-3`},hG=N({__name:`SettingsShell`,props:{sections:{},navLabel:{},changesDescription:{},changedCount:{},changes:{},saveError:{},saveMessage:{},saving:{type:Boolean}},emits:[`save`,`discard`],setup(e,{emit:t}){let n=e,r=t,i=zg(),a=Rg(),o=k(n.sections[0]?.id??``),s=k(!1);function c(e){ir(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function l(e){o.value=e,i.query.section!==e&&a.replace({query:{...i.query,section:e}}),c(e)}M(()=>i.query.section,e=>{let t=typeof e==`string`?e:``;n.sections.some(e=>e.id===t)&&(o.value=t,c(t))},{immediate:!0});let u=null;na(()=>{u=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top)[0];t!==void 0&&t.target.id.length>0&&(o.value=t.target.id)},{rootMargin:`-72px 0px -62% 0px`,threshold:0});for(let e of n.sections){let t=document.getElementById(e.id);t&&u.observe(t)}}),aa(()=>u?.disconnect());function d(){r(`save`),s.value=!1}return(e,t)=>(L(),R(I,null,[B(`div`,qW,[B(`div`,JW,[F(e.$slots,`header`),B(`div`,YW,[B(`nav`,{"aria-label":n.navLabel,class:`hidden lg:block`},[B(`ul`,ZW,[(L(!0),R(I,null,P(n.sections,e=>(L(),R(`li`,{key:e.id},[B(`button`,{type:`button`,"aria-current":o.value===e.id?`true`:void 0,class:D(A(Q)(`-ml-px block w-full border-l-2 py-1.5 pl-3 text-left text-xs transition-colors duration-150`,o.value===e.id?`border-accent font-medium text-accent`:`border-transparent text-muted hover:border-line hover:text-ink`)),onClick:t=>l(e.id)},O(e.title),11,QW)]))),128))])],8,XW),B(`div`,$W,[F(e.$slots,`default`)])])]),B(`div`,eG,[B(`div`,tG,[B(`div`,nG,[B(`p`,rG,[n.changedCount>0?(L(),R(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-xs text-muted underline decoration-line underline-offset-2 hover:text-ink`,onClick:t[0]||=e=>s.value=!0},[B(`span`,iG,O(n.changedCount),1),H(` `+O(A(_F)(`settings.shell.fieldsChanged`,n.changedCount)),1)])):(L(),R(I,{key:1},[H(O(A(Y)(`settings.shell.noUnsavedChanges`)),1)],64))]),n.saveError?(L(),R(`p`,aG,O(n.saveError),1)):n.saveMessage?(L(),R(`p`,oG,O(n.saveMessage),1)):U(``,!0)]),B(`div`,sG,[V($,{variant:`ghost`,disabled:n.changedCount===0||n.saving,onClick:t[1]||=e=>r(`discard`)},{default:j(()=>[H(O(A(Y)(`settings.shell.discard`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:n.changedCount===0,loading:n.saving,onClick:t[2]||=e=>r(`save`)},{default:j(()=>[H(O(A(Y)(`settings.shell.save`)),1)]),_:1},8,[`disabled`,`loading`])])])])]),V($z,{open:s.value,"onUpdate:open":t[4]||=e=>s.value=e,title:A(Y)(`settings.shell.unsavedTitle`),description:n.changesDescription,width:`w-[min(92vw,42rem)]`},{default:j(()=>[B(`div`,cG,[n.changes.length>0?(L(),R(`ul`,lG,[(L(!0),R(I,null,P(n.changes,e=>(L(),R(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[B(`code`,uG,O(e.path),1),B(`span`,dG,O(A(zL)(e.from)),1),t[5]||=B(`span`,{class:`text-2xs text-faint`},`→`,-1),B(`span`,fG,O(A(zL)(e.to)),1)]))),128))])):(L(),R(`p`,pG,O(A(Y)(`settings.shell.nothingToSave`)),1))]),B(`footer`,mG,[V($,{size:`sm`,variant:`ghost`,onClick:t[3]||=e=>s.value=!1},{default:j(()=>[H(O(A(Y)(`common.close`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:n.changes.length===0||n.saving,loading:n.saving,onClick:d},{default:j(()=>[H(O(A(_F)(`settings.shell.saveChanges`,n.changes.length)),1)]),_:1},8,[`disabled`,`loading`])])]),_:1},8,[`open`,`title`,`description`])],64))}}),gG={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},_G={class:`text-xs font-medium text-muted`},vG={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},yG={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},bG={key:0,class:`sm:col-span-2`},xG={key:1,class:`space-y-3 sm:col-span-2`},SG={class:`divide-y divide-line-soft text-xs`},CG={class:`flex items-start justify-between gap-4 py-1.5`},wG={class:`text-muted`},TG={class:`min-w-0 text-right font-mono text-xs text-ink`},EG={class:`flex items-start justify-between gap-4 py-1.5`},DG={class:`text-muted`},OG={class:`min-w-0 text-right font-mono text-xs text-ink`},kG={class:`flex items-start justify-between gap-4 py-1.5`},AG={class:`text-muted`},jG={class:`font-mono text-xs tabular-nums text-ink`},MG={class:`flex items-center justify-between gap-4 py-1.5`},NG={class:`text-muted`},PG={class:`flex items-start justify-between gap-4 py-1.5`},FG={class:`text-muted`},IG={class:`flex min-w-0 items-center gap-1.5`},LG={class:`min-w-0 truncate font-mono text-2xs text-ink`},RG={key:2,class:`sm:col-span-2`},zG={class:`flex min-w-0 flex-col gap-1`},BG={class:`flex min-w-0 flex-col gap-1`},VG={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},HG={key:3,class:`space-y-2 sm:col-span-2`},UG=N({__name:`TlsSection`,props:za({view:{},dirty:{type:Boolean}},{tlsEnabled:{type:Boolean,required:!0},tlsEnabledModifiers:{}}),emits:za([`reset`],[`update:tlsEnabled`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`tlsEnabled`),a=XN(),o=k(``),s=k(``),c=k(null),l=k(null),u=k(!1),d=W(()=>n.view?.tls??null),f=W(()=>n.view?`${n.view.protocol}://${n.view.bindHost}:${n.view.port}`:`—`),p=W(()=>o.value.trim().length>0&&s.value.trim().length>0&&!u.value),m=Q(Sz,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?o.value=r:s.value=r}async function g(){u.value=!0,l.value=null,c.value=null;try{let e=await eN(o.value,s.value);o.value=``,s.value=``,c.value=Y(`settings.tls.stored`),await a.refresh();let t=await QR(e);t!==null&&(l.value=t)}catch(e){l.value=Lj(e)}finally{u.value=!1}}async function _(){u.value=!0,l.value=null,c.value=null;try{let e=await tN();c.value=Y(`settings.tls.removed`),await a.refresh();let t=await QR(e);t!==null&&(l.value=t)}catch(e){l.value=Lj(e)}finally{u.value=!1}}return(e,t)=>(L(),R(I,null,[V(gz,{title:A(Y)(`settings.tls.title`),description:A(Y)(`settings.tls.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value,"onUpdate:modelValue":t[1]||=e=>i.value=e,label:A(Y)(`settings.tls.serve`),hint:A(Y)(`settings.tls.serveHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),B(`div`,gG,[B(`span`,_G,O(A(Y)(`settings.listener.liveAddress`)),1),B(`div`,vG,[B(`span`,yG,O(f.value),1),V(hU,{value:f.value,label:A(Y)(`settings.listener.copyLiveAddress`)},null,8,[`value`,`label`])])])]),_:1},8,[`title`,`description`]),V(gz,{class:`mt-3`,title:A(Y)(`settings.tls.certificateTitle`),description:A(Y)(`settings.tls.certificateDescription`)},{default:j(()=>[d.value?.error?(L(),R(`div`,bG,[V(_H,{tone:`danger`,title:A(Y)(`settings.tls.unusableTitle`)},{default:j(()=>[H(O(d.value.error),1)]),_:1},8,[`title`])])):d.value?.certPresent?(L(),R(`div`,xG,[B(`dl`,SG,[B(`div`,CG,[B(`dt`,wG,O(A(Y)(`settings.tls.subject`)),1),B(`dd`,TG,O(d.value.subject??`—`),1)]),B(`div`,EG,[B(`dt`,DG,O(A(Y)(`settings.tls.issuer`)),1),B(`dd`,OG,O(d.value.issuer??`—`),1)]),B(`div`,kG,[B(`dt`,AG,O(A(Y)(`settings.tls.validUntil`)),1),B(`dd`,jG,[H(O(d.value.validTo?d.value.validTo.slice(0,10):`—`)+` `,1),d.value.daysRemaining===null?U(``,!0):(L(),R(`span`,{key:0,class:D(A(Q)(`ml-1.5`,d.value.daysRemaining<14?`text-warn`:`text-faint`))},` (`+O(A(Y)(`settings.tls.days`,{count:d.value.daysRemaining}))+`) `,3))])]),B(`div`,MG,[B(`dt`,NG,O(A(Y)(`settings.tls.privateKey`)),1),B(`dd`,null,[V(_U,{tone:d.value.keyMatches?`ok`:`danger`,dot:``},{default:j(()=>[H(O(d.value.keyMatches?A(Y)(`settings.tls.keyMatches`):A(Y)(`settings.tls.keyMismatch`)),1)]),_:1},8,[`tone`])])]),B(`div`,PG,[B(`dt`,FG,O(A(Y)(`settings.tls.fingerprint`)),1),B(`dd`,IG,[B(`span`,LG,O(d.value.fingerprint??`—`),1),d.value.fingerprint?(L(),z(hU,{key:0,value:d.value.fingerprint,label:A(Y)(`settings.tls.copyFingerprint`)},null,8,[`value`,`label`])):U(``,!0)])])])])):(L(),R(`div`,RG,[V(_H,{tone:`info`,title:A(Y)(`settings.tls.noCertificateTitle`)},{default:j(()=>[H(O(A(Y)(`settings.tls.noCertificateText`)),1)]),_:1},8,[`title`])])),B(`div`,zG,[B(`label`,{class:D(A(bz)),for:`tls-cert-file`},O(A(Y)(`settings.tls.certFile`)),3),B(`input`,{id:`tls-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:D(A(m)),onChange:t[2]||=e=>h(e,`cert`)},null,34)]),B(`div`,BG,[B(`label`,{class:D(A(bz)),for:`tls-key-file`},O(A(Y)(`settings.tls.keyFile`)),3),B(`input`,{id:`tls-key-file`,type:`file`,accept:`.pem,.key,text/plain`,class:D(A(m)),onChange:t[3]||=e=>h(e,`key`)},null,34)]),V(rB,{modelValue:o.value,"onUpdate:modelValue":t[4]||=e=>o.value=e,label:A(Y)(`settings.tls.pasteCertificate`),rows:4,placeholder:`-----BEGIN CERTIFICATE-----`},null,8,[`modelValue`,`label`]),V(rB,{modelValue:s.value,"onUpdate:modelValue":t[5]||=e=>s.value=e,label:A(Y)(`settings.tls.pasteKey`),rows:4,placeholder:`-----BEGIN PRIVATE KEY-----`},null,8,[`modelValue`,`label`]),B(`div`,VG,[V($,{variant:`primary`,disabled:!p.value,loading:u.value,onClick:g},{default:j(()=>[H(O(A(Y)(`settings.tls.saveCertificate`)),1)]),_:1},8,[`disabled`,`loading`]),d.value?.certPresent?(L(),z(mH,{key:0,label:A(Y)(`settings.tls.removeCertificate`),"confirm-label":A(Y)(`settings.tls.confirmRemove`),"confirm-variant":`danger`,title:A(Y)(`settings.tls.removeTitle`),hint:A(Y)(`settings.tls.removeHint`),disabled:u.value,onConfirm:_},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),l.value||c.value?(L(),R(`div`,HG,[l.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(l.value),1)]),_:1})):U(``,!0),c.value?(L(),z(_H,{key:1,tone:`ok`},{default:j(()=>[H(O(c.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`])],64))}}),WG=N({__name:`LanguageSelect`,props:{labelled:{type:Boolean,default:!0},wide:{type:Boolean,default:!1}},setup(e){let t=e,n=k(!1),r=W(()=>qP.map(e=>({value:e.code,label:e.name}))),i=k(null),a=W({get:()=>i.value??vF(),set:e=>{e!==vF()&&(i.value=e,n.value=!0,hF(e).finally(()=>{i.value=null,n.value=!1}))}});return(e,i)=>(L(),z(Nz,{modelValue:a.value,"onUpdate:modelValue":i[0]||=e=>a.value=e,label:t.labelled?A(Y)(`language.label`):void 0,options:r.value,wide:t.wide,disabled:n.value,"aria-label":t.labelled?void 0:A(Y)(`language.select`),"data-testid":`language-select`},null,8,[`modelValue`,`label`,`options`,`wide`,`disabled`,`aria-label`]))}}),GG={class:`mb-5`},KG={class:`text-xl font-semibold tracking-tight text-ink`},qG={class:`mt-1 text-xs text-muted`},JG={class:`text-2xs leading-4 text-faint sm:col-span-2`},YG=N({__name:`GlobalSettingsView`,setup(e){let t=W(()=>[{id:`listener`,title:Y(`views.globalSettings.sectionListener`)},{id:`authentication`,title:Y(`views.globalSettings.sectionAuthentication`)},{id:`host`,title:Y(`views.globalSettings.sectionHost`)},{id:`backups`,title:Y(`views.globalSettings.sectionBackups`)},{id:`tls`,title:Y(`views.globalSettings.sectionTls`)},{id:`language`,title:Y(`language.label`)},{id:`interface`,title:Y(`views.globalSettings.sectionInterface`)},{id:`paths`,title:Y(`views.globalSettings.sectionPaths`)}]),n=XN(),r=vN(),i=tn(ER()),a=k(!1),o=k(null),s=k(null),c=k(null),l=k(null),u=W(()=>n.control.value),d=W(()=>n.host.value?.alerts??[]),f=W(()=>l.value?.host??null),p=W(()=>l.value?.backups??null),m=W(()=>n.backups.value),h=W(()=>l.value?.ui??null),g=W(()=>n.version.value),_=W(()=>n.dataRoot.value),v=W(()=>n.projectDir.value),y=W(()=>_.value===null?null:`${_.value}/settings.json`),b=W(()=>{let e={},t=u.value;if(t!==null){let n=RR(t,i);Object.keys(n).length>0&&(e.control=n)}let n=f.value;if(n!==null){let t=IR(n,i.host);Object.keys(t).length>0&&(e.host=t)}let r=p.value;if(r!==null){let t=LR(r,i.backups);Object.keys(t).length>0&&(e.backups=t)}return e}),x=W(()=>bR(b.value)),S=W(()=>{let e=u.value,t=f.value,n=p.value;return{control:e===null?{}:{...jR(e),auth:AR(e.auth)},host:t??{},backups:n===null?{}:{enabled:n.enabled,keep:n.keep,includePaths:n.includePaths}}}),C=W(()=>yR(b.value,S.value)),w=W(()=>u.value!==null&&JR(u.value,i)),T=W(()=>u.value!==null&&YR(u.value,i)),ee=W(()=>u.value!==null&&XR(u.value,i)),te=W(()=>f.value!==null&&Object.keys(IR(f.value,i.host)).length>0),ne=W(()=>p.value!==null&&Object.keys(LR(p.value,i.backups)).length>0),re={};function ie(){let e=(e,t)=>{qR(re[e],HR(i,e))||(t(),re[e]=HR(i,e))},t=u.value;t!==null&&(WR(i,re.control,`listener`)||(Object.assign(i.control,jR(t)),GR(i,re,`listener`)),WR(i,re.control,`auth`)||(Object.assign(i.auth,AR(t.auth)),GR(i,re,`auth`)),WR(i,re.control,`tls`)||(i.control.tlsEnabled=t.tls.enabled,GR(i,re,`tls`)));let n=f.value;n!==null&&e(`host`,()=>Object.assign(i.host,PR(n)));let r=p.value;r!==null&&e(`backups`,()=>Object.assign(i.backups,FR(r)))}function ae(){for(let e of Object.keys(re))delete re[e]}function oe(e){re[e]=HR(i,e)}M([u,l],()=>{ie()},{immediate:!0});async function se(){c.value=null;try{l.value=await Qj()}catch(e){c.value=Lj(e)}}na(()=>{se()});async function ce(){let e=b.value;if(!(Object.keys(e).length===0||a.value)){a.value=!0,o.value=null,s.value=null;try{let t=await n.saveGlobalSettings(e);if(!t){o.value=n.lastError.value??Y(`views.globalSettings.saveFailed`);return}s.value=Y(`views.globalSettings.saved`),r.success(Y(`views.globalSettings.savedToast`)),await se(),ae(),ie();let i=await QR(t);i===null?t.rebinding&&(s.value=Y(`views.globalSettings.savedRebinding`)):(s.value=null,o.value=i)}finally{a.value=!1}}}function le(){o.value=null,s.value=null,ae(),ie()}function E(){f.value!==null&&Object.assign(i.host,PR(f.value)),oe(`host`)}function ue(){p.value!==null&&Object.assign(i.backups,FR(p.value)),oe(`backups`)}function de(){if(u.value!==null){let e=jR(u.value);i.control.label=e.label,i.control.port=e.port,i.control.host=e.host,i.control.openBrowser=e.openBrowser}GR(i,re,`listener`)}function fe(){u.value!==null&&Object.assign(i.auth,AR(u.value.auth)),GR(i,re,`auth`)}function pe(){u.value!==null&&(i.control.tlsEnabled=u.value.tls.enabled),GR(i,re,`tls`)}return(e,r)=>(L(),z(hG,{sections:t.value,"nav-label":A(Y)(`views.globalSettings.navLabel`),"changes-description":A(Y)(`views.globalSettings.changesDescription`),"changed-count":x.value,changes:C.value,"save-error":o.value,"save-message":s.value,saving:a.value,onSave:ce,onDiscard:le},{header:j(()=>[B(`header`,GG,[B(`h1`,KG,O(A(Y)(`views.globalSettings.title`)),1),B(`p`,qG,O(A(Y)(`views.globalSettings.description`)),1)]),c.value?(L(),z(_H,{key:0,tone:`warn`,title:A(Y)(`views.globalSettings.loadErrorTitle`),class:`mb-4`},{default:j(()=>[H(O(c.value),1)]),_:1},8,[`title`])):U(``,!0)]),default:j(()=>[V(KW,{id:`listener`,title:A(Y)(`views.globalSettings.sectionListener`),description:A(Y)(`views.globalSettings.listenerDescription`)},{default:j(()=>[V(TW,{control:i.control,"onUpdate:control":r[0]||=e=>i.control=e,view:u.value,dirty:w.value,onReset:de},null,8,[`control`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`authentication`,title:A(Y)(`views.globalSettings.sectionAuthentication`),description:A(Y)(`views.globalSettings.authenticationDescription`)},{default:j(()=>[V(bH,{auth:i.auth,"onUpdate:auth":r[1]||=e=>i.auth=e,view:u.value,dirty:ee.value,onReset:fe},null,8,[`auth`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`host`,title:A(Y)(`views.globalSettings.sectionHost`),description:A(Y)(`views.globalSettings.hostDescription`)},{default:j(()=>[V(ZU,{host:i.host,"onUpdate:host":r[2]||=e=>i.host=e,config:f.value,alerts:d.value,dirty:te.value,onReset:E},null,8,[`host`,`config`,`alerts`,`dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`backups`,title:A(Y)(`views.globalSettings.sectionBackups`),description:A(Y)(`views.globalSettings.backupsDescription`)},{default:j(()=>[V(qU,{form:i.backups,"onUpdate:form":r[3]||=e=>i.backups=e,state:m.value,policy:p.value,"config-path":y.value,workspaces:A(n).workspaces.value,dirty:ne.value,onReset:ue},null,8,[`form`,`state`,`policy`,`config-path`,`workspaces`,`dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`tls`,title:A(Y)(`views.globalSettings.sectionTls`),description:A(Y)(`views.globalSettings.tlsDescription`)},{default:j(()=>[V(UG,{"tls-enabled":i.control.tlsEnabled,"onUpdate:tlsEnabled":r[4]||=e=>i.control.tlsEnabled=e,view:u.value,dirty:T.value,onReset:pe},null,8,[`tls-enabled`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`language`,title:A(Y)(`language.label`),description:A(Y)(`views.globalSettings.languageDescription`)},{default:j(()=>[V(WG,{wide:!0}),B(`p`,JG,O(A(Y)(`views.globalSettings.languageNote`)),1)]),_:1},8,[`title`,`description`]),V(KW,{id:`interface`,title:A(Y)(`views.globalSettings.sectionInterface`),description:A(Y)(`views.globalSettings.interfaceDescription`)},{default:j(()=>[V(pW,{label:i.control.label,"onUpdate:label":r[5]||=e=>i.control.label=e,ui:h.value,"panel-version":g.value,"label-dirty":w.value,onChanged:se,onResetLabel:de},null,8,[`label`,`ui`,`panel-version`,`label-dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`paths`,title:A(Y)(`views.globalSettings.sectionPaths`),description:A(Y)(`views.globalSettings.pathsDescription`)},{default:j(()=>[V(VW,{"data-root":_.value,"project-dir":v.value,"panel-url":u.value?.url??null,workspaces:A(n).workspaces.value},null,8,[`data-root`,`project-dir`,`panel-url`,`workspaces`])]),_:1},8,[`title`,`description`])]),_:1},8,[`sections`,`nav-label`,`changes-description`,`changed-count`,`changes`,`save-error`,`save-message`,`saving`]))}}),XG={class:`relative flex min-h-dvh items-center justify-center overflow-hidden bg-page px-4 py-10`},ZG={class:`hh-enter relative w-full max-w-md`},QG={class:`mb-6 flex items-center gap-3`},$G={class:`text-lg font-semibold tracking-tight text-ink`},eK={class:`text-xs text-muted`},tK={class:`rounded-panel border border-line bg-panel/95 p-5 shadow-float backdrop-blur-sm`},nK={class:`flex items-start justify-between gap-3`},rK={class:`min-w-0`},iK={class:`text-base font-semibold text-ink`},aK={class:`mt-1 text-xs leading-relaxed text-muted`},oK={class:`flex shrink-0 items-center gap-2`},sK={class:`w-36`},cK={class:`flex flex-col gap-1.5`},lK={class:`relative`},uK=[`type`],dK=[`aria-label`],fK={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2 text-xs text-danger`},pK={key:1,class:`mt-5`},mK={class:`mt-4 space-y-2`},hK={key:0,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},gK={class:`text-2xs leading-4 text-warn`},_K={class:`mx-1 rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},vK={key:1,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},yK={class:`text-2xs leading-4 text-warn`},bK={key:2,class:`flex items-start gap-2 rounded-control border border-line-soft bg-panel-2 px-2.5 py-2`},xK={class:`text-2xs leading-4 text-muted`},SK={class:`mt-4 flex items-center justify-center gap-2 text-2xs text-faint`},CK={class:`font-mono`},wK=N({__name:`LoginView`,setup(e){let t=zg(),n=Rg(),r=XN(),{session:i,error:a,login:o,refresh:s}=pN(),c=k(``),l=k(!1),u=k(!1),d=W(()=>i.value?.passwordSet===!1),f=W(()=>i.value!==null&&!i.value.authRequired),p=W(()=>i.value?.usingDefaultPassword===!0&&i.value.defaultPassword!==null),m=W(()=>r.control.value?.auth.exposed===!0),h=W(()=>r.control.value?.url??`—`),g=W(()=>d.value?Y(`login.firstRunTitle`):f.value?Y(`login.authOffTitle`):Y(`login.title`)),_=W(()=>d.value?Y(`login.firstRunSubtitle`):f.value?Y(`login.authOffSubtitle`):Y(`login.subtitle`));async function v(){l.value=!0;try{if(await o(c.value)){c.value=``;let e=typeof t.query.next==`string`?t.query.next:`/`;await n.push(e)}}finally{l.value=!1}}async function y(){await s(),await n.push(`/`)}return na(async()=>{i.value===null&&await s()}),(e,t)=>(L(),R(`div`,XG,[t[5]||=B(`div`,{class:`bg-instrument pointer-events-none absolute inset-0 opacity-60`},null,-1),t[6]||=B(`div`,{class:`pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_15%,var(--page)_78%)]`},null,-1),B(`div`,ZG,[B(`div`,QG,[t[2]||=Os(`<span class="grid size-11 shrink-0 place-items-center rounded-panel border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),B(`div`,null,[B(`p`,$G,O(A(Y)(`app.name`)),1),B(`p`,eK,O(A(Y)(`app.tagline`)),1)])]),B(`section`,tK,[B(`div`,nK,[B(`div`,rK,[B(`h1`,iK,O(g.value),1),B(`p`,aK,O(_.value),1)]),B(`div`,oK,[m.value?(L(),z(_U,{key:0,tone:`warn`,dot:``},{default:j(()=>[H(O(A(Y)(`login.exposed`)),1)]),_:1})):U(``,!0),B(`div`,sK,[V(WG,{labelled:!1})])])]),f.value?(L(),R(`div`,pK,[V($,{variant:`primary`,size:`md`,block:``,onClick:y},{default:j(()=>[H(O(A(Y)(`login.openDashboard`)),1)]),_:1})])):(L(),R(`form`,{key:0,class:`mt-5 space-y-3`,onSubmit:lu(v,[`prevent`])},[B(`div`,cK,[B(`label`,{for:`hh-password`,class:D(A(bz))},O(A(Y)(`login.password`)),3),B(`div`,lK,[Sr(B(`input`,{id:`hh-password`,"onUpdate:modelValue":t[0]||=e=>c.value=e,type:u.value?`text`:`password`,autocomplete:`current-password`,autofocus:``,required:``,class:D(A(Q)(A(Sz),`pr-9`))},null,10,uK),[[ru,c.value]]),B(`button`,{type:`button`,class:`absolute right-1 top-1/2 grid size-7 -translate-y-1/2 place-items-center rounded-control text-faint transition-colors duration-150 hover:text-ink`,"aria-label":u.value?A(Y)(`login.hidePassword`):A(Y)(`login.showPassword`),onClick:t[1]||=e=>u.value=!u.value},[u.value?(L(),z(A(Qv),{key:0,class:`size-3.5`})):(L(),z(A($v),{key:1,class:`size-3.5`}))],8,dK)])]),A(a)?(L(),R(`p`,fK,O(A(a)),1)):U(``,!0),V($,{type:`submit`,variant:`primary`,size:`md`,block:``,loading:l.value},{default:j(()=>[V(A(cy),{class:`size-3.5`}),H(` `+O(A(Y)(`login.signIn`)),1)]),_:1},8,[`loading`])],32)),B(`div`,mK,[p.value?(L(),R(`div`,hK,[V(A(Dy),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),B(`p`,gK,[V(iB,{k:`login.defaultPasswordWarning`},{password:j(()=>[B(`code`,_K,O(A(i)?.defaultPassword),1)]),_:1})])])):d.value?(L(),R(`div`,vK,[V(A(ky),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),B(`p`,yK,[V(iB,{k:`login.noPasswordWarning`},{command:j(()=>[...t[3]||=[B(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`pnpm run auth:set-password`,-1)]]),_:1})])])):(L(),R(`div`,bK,[V(A(Oy),{class:`mt-0.5 size-3.5 shrink-0 text-ok`}),B(`p`,xK,O(A(Y)(`login.sessionNote`,{days:Math.round((A(i)?.sessionTtlMs??0)/864e5)})),1)]))])]),B(`p`,SK,[B(`span`,CK,O(h.value),1),t[4]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,null,O(A(Y)(`login.servedFromThisMachine`)),1)])])]))}}),TK=[`#3f4a5c`,`#f07178`,`#7fd88f`,`#e6b673`,`#82aaff`,`#c792ea`,`#7fdbca`,`#c7d2e3`,`#5a6779`,`#ff8b92`,`#9ae6a8`,`#f2c98a`,`#9dbaff`,`#d7aef0`,`#9ce9dc`,`#eef3fb`],EK=[`#4b5563`,`#c0392b`,`#1c7c3f`,`#9a6700`,`#2f5fe0`,`#7c3aed`,`#0b6f89`,`#334155`,`#6b7280`,`#d64535`,`#22854a`,`#a8620d`,`#3f6bff`,`#8b5cf6`,`#0e7d9c`,`#0f1722`],DK=/\u001B\[([0-9;]*)m/g,OK=/\u001B(?:\[[0-9;?]*[A-HJKSTfhilmnprsu]|\][^\u0007\u001B]*(?:\u0007|\u001B\\)?|[()][0-9A-Z])/g;function kK(e){return Math.max(0,Math.min(255,e))}function AK(e){return e===0?0:55+e*40}function jK(e,t){let n=t?TK:EK;if(e<16)return n[e]??n[7];if(e<232){let t=e-16;return`rgb(${AK(Math.floor(t/36))} ${AK(Math.floor(t%36/6))} ${AK(t%6)})`}let r=8+(e-232)*10;return`rgb(${r} ${r} ${r})`}function MK(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}}function NK(e,t,n){let r=t.length===0?[0]:t.split(`;`).map(e=>e.length===0?0:Number(e));for(let t=0;t<r.length;t+=1){let i=r[t];if(i===0)Object.assign(e,MK());else if(i===1)e.bold=!0;else if(i===2)e.dim=!0;else if(i===3)e.italic=!0;else if(i===4)e.underline=!0;else if(i===22)e.bold=!1,e.dim=!1;else if(i===23)e.italic=!1;else if(i===24)e.underline=!1;else if(i===39)e.fg=null;else if(i===49)e.bg=null;else if(i>=30&&i<=37)e.fg=(n?TK:EK)[i-30]??null;else if(i>=90&&i<=97)e.fg=(n?TK:EK)[i-90+8]??null;else if(i>=40&&i<=47)e.bg=(n?TK:EK)[i-40]??null;else if(i>=100&&i<=107)e.bg=(n?TK:EK)[i-100+8]??null;else if(i===38||i===48){let a=i===38?`fg`:`bg`,o=r[t+1];o===5&&r[t+2]!==void 0?(e[a]=jK(kK(r[t+2]),n),t+=2):o===2&&(e[a]=`rgb(${kK(r[t+2]??0)} ${kK(r[t+3]??0)} ${kK(r[t+4]??0)})`,t+=4)}}}function PK(e,t,n){if(t.length===0)return;let r=e[e.length-1];if(r&&r.fg===n.fg&&r.bg===n.bg&&r.bold===n.bold&&r.dim===n.dim&&r.italic===n.italic&&r.underline===n.underline){r.text+=t;return}e.push({text:t,...n})}function FK(e){return e.includes(`\x1B`)}function IK(e,t=!0){if(!FK(e))return[{text:e,fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}];let n=[],r=MK(),i=0;DK.lastIndex=0;let a=DK.exec(e);for(;a!==null;)PK(n,e.slice(i,a.index).replace(OK,``),r),NK(r,a[1]??``,t),i=a.index+a[0].length,a=DK.exec(e);return PK(n,e.slice(i).replace(OK,``),r),n}var LK={class:`flex h-5 w-max min-w-full items-center gap-2 whitespace-pre px-2 font-mono text-xs leading-5`},RK={key:0,class:`shrink-0 select-none text-faint`},zK={class:`min-w-0`},BK=N({__name:`LogRow`,props:{line:{},query:{},dark:{type:Boolean},showTime:{type:Boolean}},setup(e){let t=e,n=W(()=>IK(t.line.text,t.dark)),r=W(()=>{let e=t.query.trim().toLowerCase(),r=[];for(let t of n.value){if(e.length===0){r.push({text:t.text,hit:!1,span:t});continue}let n=t.text.toLowerCase(),i=0,a=n.indexOf(e);for(;a!==-1;)a>i&&r.push({text:t.text.slice(i,a),hit:!1,span:t}),r.push({text:t.text.slice(a,a+e.length),hit:!0,span:t}),i=a+e.length,a=n.indexOf(e,i);i<t.text.length&&r.push({text:t.text.slice(i),hit:!1,span:t})}return r}),i={stdout:`bg-transparent`,stderr:`bg-danger`,system:`bg-info`};function a(e){let t={};return e.span.fg&&(t.color=e.span.fg),e.span.bg&&(t.backgroundColor=e.span.bg),e.span.bold&&(t.fontWeight=`600`),e.span.dim&&(t.opacity=`0.62`),e.span.italic&&(t.fontStyle=`italic`),e.span.underline&&(t.textDecoration=`underline`),e.hit&&(t.backgroundColor=`var(--warn)`,t.color=`var(--accent-ink)`,t.borderRadius=`2px`),t}return(e,n)=>(L(),R(`div`,LK,[t.showTime?(L(),R(`span`,RK,O(A(PL)(t.line.ts)),1)):U(``,!0),B(`span`,{class:D([`h-3.5 w-0.5 shrink-0 rounded-full`,[i[t.line.stream]]]),"aria-hidden":`true`},null,2),B(`span`,zK,[(L(!0),R(I,null,P(r.value,(e,t)=>(L(),R(`span`,{key:t,style:_e(a(e))},O(e.text),5))),128))])]))}}),VK={class:`flex min-h-0 flex-col overflow-hidden rounded-panel border border-line bg-panel`},HK={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel-2/60 px-2.5 py-2`},UK={class:`relative min-w-40 flex-1 sm:max-w-72`},WK=[`placeholder`,`aria-label`],GK={class:`absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5`},KK={key:0,class:`px-1 font-mono text-2xs tabular-nums text-faint`},qK=[`aria-label`],JK=[`aria-label`],YK=[`aria-label`],XK={class:`ml-auto flex items-center gap-1.5`},ZK=[`href`,`download`],QK={class:`relative min-h-0 flex-1`},$K=[`aria-label`],eq={key:0,class:`px-3 py-6 text-center text-xs text-faint`},tq={class:`flex items-center gap-3 border-t border-line bg-panel-2/60 px-2.5 py-1.5 text-2xs text-faint`},nq={class:`flex items-center gap-1.5`},rq={class:`font-mono tabular-nums`},iq={key:0,class:`font-mono tabular-nums`},aq={class:`ml-auto hidden font-mono tabular-nums sm:inline`},oq=20,sq=12,cq=N({__name:`LogViewer`,props:{lines:{},version:{default:0},live:{type:Boolean,default:!1},emptyHint:{default:void 0},clearable:{type:Boolean,default:!1},downloadUrl:{default:void 0},downloadName:{default:void 0},minHeight:{default:`16rem`}},emits:[`clear`],setup(e,{emit:t}){let n=e,r=t,i=aP(),a=k(null),o=k(0),s=k(320),c=k(!0),l=k(`all`),u=k(``),d=k(!0),f=k(0),p=W(()=>{n.version;let e=u.value.trim().toLowerCase(),t=l.value;return e.length===0&&t===`all`?n.lines:n.lines.filter(n=>!(t!==`all`&&n.stream!==t||e.length>0&&!n.text.toLowerCase().includes(e)))}),m=W(()=>p.value.length),h=W(()=>{let e=u.value.trim().toLowerCase();if(e.length===0)return[];let t=[],n=p.value;for(let r=0;r<n.length;r+=1)n[r].text.toLowerCase().includes(e)&&t.push(r);return t}),g=W(()=>Math.max(0,Math.floor(o.value/oq)-sq)),_=W(()=>Math.min(m.value,Math.ceil((o.value+s.value)/oq)+sq)),v=W(()=>p.value.slice(g.value,_.value)),y=W(()=>h.value[f.value]??-1);function b(){let e=a.value;if(!e)return;o.value=e.scrollTop;let t=e.scrollHeight-e.scrollTop-e.clientHeight;c.value=t<12}function x(){let e=a.value;e&&(e.scrollTop=e.scrollHeight,o.value=e.scrollTop,c.value=!0)}function S(e){let t=a.value;t&&(t.scrollTop=Math.max(0,e*oq-t.clientHeight/2),o.value=t.scrollTop,c.value=!1)}function C(e){let t=h.value.length;t!==0&&(f.value=(f.value+e+t)%t,S(h.value[f.value]))}M(()=>[n.version,m.value],()=>{c.value&&(f.value=0,requestAnimationFrame(x))}),M(h,()=>{f.value=0,h.value.length>0&&u.value.trim().length>0&&requestAnimationFrame(()=>S(h.value[0]))}),M(l,()=>{c.value=!0,requestAnimationFrame(x)});let w=null;na(()=>{let e=a.value;e&&(s.value=e.clientHeight,w=new ResizeObserver(()=>{a.value&&(s.value=a.value.clientHeight)}),w.observe(e),x())}),Be(()=>{w?.disconnect(),w=null});let T=W(()=>[{value:`all`,label:Y(`logs.streamAll`)},{value:`stdout`,label:Y(`logs.streamOut`)},{value:`stderr`,label:Y(`logs.streamErr`)},{value:`system`,label:Y(`logs.streamSys`)}]);return(e,t)=>(L(),R(`div`,VK,[B(`header`,HK,[V(gW,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,options:T.value},null,8,[`modelValue`,`options`]),B(`div`,UK,[V(A(wy),{class:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),Sr(B(`input`,{"onUpdate:modelValue":t[1]||=e=>u.value=e,type:`search`,placeholder:A(Y)(`logs.searchPlaceholder`),class:D([`h-7 py-0 pl-7 text-xs`,[A(Sz)]]),"aria-label":A(Y)(`logs.searchLabel`),onKeydown:t[2]||=du(lu(e=>C(e.shiftKey?-1:1),[`prevent`]),[`enter`])},null,42,WK),[[Jl,u.value]]),B(`div`,GK,[u.value.trim().length>0?(L(),R(`span`,KK,O(h.value.length===0?`0`:`${f.value+1}/${h.value.length}`),1)):U(``,!0),u.value.length>0?(L(),R(`button`,{key:1,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.clearSearch`),onClick:t[3]||=e=>u.value=``},[V(A(zy),{class:`size-3`})],8,qK)):U(``,!0),h.value.length>0?(L(),R(`button`,{key:2,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.prevMatch`),onClick:t[4]||=e=>C(-1)},[V(A(zv),{class:`size-3`})],8,JK)):U(``,!0),h.value.length>0?(L(),R(`button`,{key:3,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.nextMatch`),onClick:t[5]||=e=>C(1)},[V(A(Iv),{class:`size-3`})],8,YK)):U(``,!0)])]),B(`div`,XK,[V(BB,{label:d.value?A(Y)(`logs.hideTimestamps`):A(Y)(`logs.showTimestamps`)},{default:j(()=>[V($,{size:`xs`,variant:`ghost`,onClick:t[6]||=e=>d.value=!d.value},{default:j(()=>[V(A(Wv),{class:D(A(Q)(`size-3`,d.value?`fill-accent text-accent`:`text-faint`))},null,8,[`class`]),H(` `+O(A(Y)(`logs.timestampsShort`)),1)]),_:1})]),_:1},8,[`label`]),V($,{size:`xs`,variant:c.value?`secondary`:`primary`,onClick:t[7]||=e=>c.value?c.value=!1:x()},{default:j(()=>[(L(),z(ha(c.value?A(hy):A(_y)),{class:`size-3`})),H(` `+O(c.value?A(Y)(`logs.pause`):A(Y)(`logs.follow`)),1)]),_:1},8,[`variant`]),n.clearable?(L(),z(BB,{key:0,label:A(Y)(`logs.clearHint`)},{default:j(()=>[V($,{size:`icon-sm`,variant:`ghost`,"aria-label":A(Y)(`logs.clearLabel`),onClick:t[8]||=e=>r(`clear`)},{default:j(()=>[V(A(Iy),{class:`size-3.5`})]),_:1},8,[`aria-label`])]),_:1},8,[`label`])):U(``,!0),n.downloadUrl?(L(),z(BB,{key:1,label:A(Y)(`logs.downloadHint`)},{default:j(()=>[B(`a`,{href:n.downloadUrl,download:n.downloadName},[V($,{size:`icon-sm`,variant:`ghost`,"aria-label":A(Y)(`logs.downloadLabel`)},{default:j(()=>[V(A(Nv),{class:`size-3.5`})]),_:1},8,[`aria-label`])],8,ZK)]),_:1},8,[`label`])):U(``,!0)])]),B(`div`,QK,[B(`div`,{ref_key:`scroller`,ref:a,class:`h-full overflow-auto overscroll-contain bg-page/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50`,style:_e({minHeight:n.minHeight}),tabindex:`0`,role:`log`,"aria-label":A(Y)(`logs.outputLabel`),onScrollPassive:b},[m.value===0?(L(),R(`p`,eq,O(n.lines.length===0?n.emptyHint??A(Y)(`logs.emptyHint`):A(Y)(`logs.noMatches`)),1)):(L(),R(`div`,{key:1,class:`relative w-full`,style:_e({height:`${m.value*oq}px`})},[(L(!0),R(I,null,P(v.value,(e,t)=>(L(),R(`div`,{key:g.value+t,class:D([`absolute left-0 top-0`,g.value+t===y.value&&`bg-warn/10`]),style:_e({transform:`translateY(${(g.value+t)*oq}px)`})},[V(BK,{line:e,query:u.value,dark:A(i).isDark.value,"show-time":d.value},null,8,[`line`,`query`,`dark`,`show-time`])],6))),128))],4))],44,$K),V(Dc,{"enter-active-class":`transition duration-150`,"leave-active-class":`transition duration-100`,"enter-from-class":`opacity-0 translate-y-1`,"leave-to-class":`opacity-0 translate-y-1`},{default:j(()=>[!c.value&&m.value>0?(L(),R(`button`,{key:0,type:`button`,class:`absolute bottom-3 right-4 flex items-center gap-1.5 rounded-full border border-line bg-raise px-2.5 py-1 text-2xs text-muted shadow-float transition-colors duration-150 hover:text-ink`,onClick:x},[V(A(Nv),{class:`size-3`}),H(` `+O(A(Y)(`logs.jumpToLatest`)),1)])):U(``,!0)]),_:1})]),B(`footer`,tq,[B(`span`,nq,[B(`span`,{class:D(A(Q)(`size-1.5 rounded-full`,n.live?c.value?`bg-ok`:`bg-warn`:`bg-faint`))},null,2),H(` `+O(n.live?c.value?A(Y)(`logs.streaming`):A(Y)(`logs.paused`):A(Y)(`logs.snapshot`)),1)]),B(`span`,rq,O(m.value===n.lines.length?A(_F)(`logs.lines`,m.value):A(Y)(`logs.linesOf`,{count:m.value,total:n.lines.length})),1),u.value.trim().length>0?(L(),R(`span`,iq,O(A(Y)(`logs.matches`,{count:h.value.length})),1)):U(``,!0),B(`span`,aq,O(A(Y)(`logs.rowHeight`,{height:oq})),1)])]))}}),lq={class:`flex h-full min-h-0`},uq={class:`hidden w-64 shrink-0 flex-col border-r border-line bg-panel/40 md:flex`},dq={class:`border-b border-line px-3 py-2.5`},fq={class:`text-xs font-semibold text-ink`},pq={class:`mt-0.5 text-2xs text-faint`},mq={class:`min-h-0 flex-1 overflow-y-auto p-1.5`},hq={key:0,class:`space-y-1.5 p-1.5`},gq=[`onClick`],_q={class:`min-w-0 flex-1`},vq={key:0,class:`block truncate font-mono text-2xs text-faint`},yq={key:1,class:`block truncate font-mono text-2xs text-faint`},bq={class:`border-t border-line p-2.5`},xq={class:`text-2xs leading-4 text-faint`},Sq={class:`flex min-w-0 flex-1 flex-col`},Cq={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel/40 px-3 py-2.5`},wq={class:`min-w-0`},Tq={class:`truncate text-sm font-semibold text-ink`},Eq={key:0,class:`ml-1.5 font-mono text-2xs font-normal text-faint`},Dq=[`aria-label`,`placeholder`],Oq={key:0,class:`flex flex-wrap items-center gap-1.5 border-b border-line-soft bg-panel-2/40 px-3 py-2`},kq=[`href`,`download`],Aq={class:`text-faint`},jq={key:1,class:`text-2xs text-faint`},Mq={key:2,class:`ml-auto font-mono text-2xs text-faint`},Nq={key:3,class:`font-mono text-2xs text-faint`},Pq={key:1,class:`flex items-center gap-1.5 border-b border-danger/25 bg-danger-soft px-3 py-2 text-2xs text-danger`},Fq={class:`min-h-0 flex-1 p-3`},Iq={class:`text-xs text-muted`},Lq=N({__name:`LogsView`,setup(e){let t=zg(),n=Rg(),r=dP(),i=k([]),a=k(null),o=k(`disk`),s=k(`2000`),c=k(``),l=k(``),u=k(null),d=k(!1),f=k(null),p=k([]),m=k(0),h=k(!1),g=k(!0),_=W(()=>i.value.find(e=>e.serverId===a.value)??null),v=YN(r.activeId,()=>o.value===`live`?a.value:null),y=v.version,b=W(()=>(y.value,v.lines())),x=W(()=>o.value===`live`?b.value:p.value),S=W(()=>o.value===`live`?y.value:m.value),C=[200,500,2e3,5e3].map(e=>({value:String(e),label:_F(`logs.lines`,e,{count:e})})),w=[{value:``,label:Y(`views.logs.allStreams`)},{value:`stdout`,label:`stdout`},{value:`stderr`,label:`stderr`},{value:`system`,label:`system`}],T=W(()=>i.value.reduce((e,t)=>e+t.sizeBytes,0)),ee=W(()=>i.value.filter(e=>e.files.length>0).length);async function te(){g.value=!0;try{i.value=await zM(r.activeId.value);let e=typeof t.query.server==`string`?t.query.server:null,n=e&&i.value.some(t=>t.serverId===e)?e:a.value&&i.value.some(e=>e.serverId===a.value)?a.value:i.value[0]?.serverId??null;a.value=n}catch(e){f.value=Lj(e)}finally{g.value=!1}}let ne=0;async function re(){let e=a.value;if(e===null||o.value===`live`)return;let t=++ne;d.value=!0,f.value=null;try{let n=await BM(r.activeId.value,e,{tail:Number(s.value),...c.value.length>0?{stream:c.value}:{},...l.value.trim().length>0?{search:l.value.trim()}:{}});if(t!==ne)return;p.value=n.lines,u.value=n.searched??null,m.value+=1}catch(e){if(t!==ne)return;f.value=Lj(e)}finally{t===ne&&(d.value=!1)}}async function ie(){let e=a.value;if(e!==null){h.value=!1;try{await VM(r.activeId.value,e),p.value=[],m.value+=1,await te()}catch(e){f.value=Lj(e)}}}function ae(e){a.value=e,o.value===`live`&&(p.value=[]),n.replace({query:{...t.query,server:e}})}M([a,s,c,o],()=>{o.value===`disk`?re():u.value=null},{immediate:!1});let oe=null;return M(l,()=>{oe!==null&&clearTimeout(oe),oe=setTimeout(()=>{oe=null,o.value===`disk`&&re()},300)}),Be(()=>{oe!==null&&clearTimeout(oe)}),M(()=>r.activeId.value,()=>{a.value=null,p.value=[],o.value=`disk`,te().then(()=>re())}),na(async()=>{await te(),o.value===`disk`&&await re()}),(e,t)=>(L(),R(`div`,lq,[B(`aside`,uq,[B(`div`,dq,[B(`p`,fq,O(A(Y)(`views.logs.persistedTitle`)),1),B(`p`,pq,O(A(Y)(`views.logs.persistedSummary`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`),persisted:ee.value,total:i.value.length,size:A(IL)(T.value)})),1)]),B(`div`,mq,[g.value?(L(),R(`div`,hq,[(L(),R(I,null,P(5,e=>V(OV,{key:e,class:`h-10 w-full`,rounded:`rounded-control`})),64))])):(L(!0),R(I,{key:1},P(i.value,e=>(L(),R(`button`,{key:e.serverId,type:`button`,class:D(A(Q)(`flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors duration-150`,e.serverId===a.value?`bg-accent-soft`:`hover:bg-hover`)),onClick:t=>ae(e.serverId)},[B(`span`,{class:D(A(Q)(`size-1.5 shrink-0 rounded-full`,A(ZI)[A(qI)[e.status].tone]))},null,2),B(`span`,_q,[B(`span`,{class:D(A(Q)(`block truncate text-xs`,e.serverId===a.value?`font-medium text-accent`:`text-ink`))},O(e.label),3),e.files.length>0?(L(),R(`span`,vq,O(A(_F)(`views.logs.filesOnDisk`,e.files.length))+` · `+O(A(IL)(e.sizeBytes)),1)):(L(),R(`span`,yq,O(A(Y)(`views.logs.nothingPersisted`)),1))])],10,gq))),128)),!g.value&&i.value.length===0?(L(),z(gL,{key:2,compact:``,title:A(Y)(`views.logs.noServersTitle`),description:A(Y)(`views.logs.noServersDescription`)},null,8,[`title`,`description`])):U(``,!0)]),B(`div`,bq,[B(`p`,xq,O(A(Y)(`views.logs.retentionNote`)),1)])]),B(`div`,Sq,[B(`header`,Cq,[B(`div`,wq,[B(`h1`,Tq,[H(O(_.value?.label??A(Y)(`nav.logs`))+` `,1),_.value?(L(),R(`span`,Eq,O(_.value.serverId),1)):U(``,!0)])]),V(gW,{modelValue:o.value,"onUpdate:modelValue":t[0]||=e=>o.value=e,class:`ml-auto`,options:[{value:`disk`,label:A(Y)(`views.logs.modePersisted`)},{value:`live`,label:A(Y)(`views.logs.modeLive`)}]},null,8,[`modelValue`,`options`]),o.value===`disk`?(L(),z(Nz,{key:0,modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e,options:A(C),class:`w-32`,"aria-label":A(Y)(`views.logs.tailAria`)},null,8,[`modelValue`,`options`,`aria-label`])):U(``,!0),o.value===`disk`?(L(),z(Nz,{key:1,modelValue:c.value,"onUpdate:modelValue":t[2]||=e=>c.value=e,options:w,class:`w-32`,"aria-label":A(Y)(`views.logs.streamAria`)},null,8,[`modelValue`,`aria-label`])):U(``,!0),o.value===`disk`?Sr((L(),R(`input`,{key:2,"onUpdate:modelValue":t[3]||=e=>l.value=e,type:`search`,class:`w-44 min-w-0 rounded-control border border-line bg-panel px-2.5 py-1.5 text-xs text-ink outline-none transition-colors placeholder:text-faint focus:border-accent/50`,"aria-label":A(Y)(`views.logs.searchAria`),placeholder:A(Y)(`views.logs.searchPlaceholder`)},null,8,Dq)),[[Jl,l.value]]):U(``,!0),o.value===`disk`?(L(),z($,{key:3,size:`sm`,loading:d.value,onClick:re},{default:j(()=>[V(A(by),{class:`size-3.5`}),H(O(A(Y)(`views.logs.reload`)),1)]),_:1},8,[`loading`])):U(``,!0),o.value===`disk`?(L(),z($,{key:4,size:`sm`,variant:`ghost`,disabled:!_.value||_.value.files.length===0,onClick:t[4]||=e=>h.value=!0},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(O(A(Y)(`views.logs.clearFile`)),1)]),_:1},8,[`disabled`])):U(``,!0)]),_.value?(L(),R(`div`,Oq,[V(A(ey),{class:`size-3.5 shrink-0 text-faint`}),_.value.files.length>0?(L(!0),R(I,{key:0},P(_.value.files,e=>(L(),R(`a`,{key:e.name,href:HM(A(r).activeId.value,_.value.serverId,e.name),download:e.name,class:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},[H(O(e.name)+` `,1),B(`span`,Aq,O(A(IL)(e.sizeBytes)),1),V(A(Nv),{class:`size-3`})],8,kq))),128)):(L(),R(`span`,jq,O(A(Y)(`views.logs.nothingOnDisk`)),1)),o.value===`disk`&&p.value.length>0?(L(),R(`span`,Mq,O(A(Y)(`views.logs.loadedLines`,{count:p.value.length})),1)):U(``,!0),u.value===null?U(``,!0):(L(),R(`span`,Nq,` · `+O(A(Y)(`views.logs.searchedLines`,{count:u.value})),1))])):U(``,!0),f.value?(L(),R(`p`,Pq,[V(A(Vv),{class:`size-3.5`}),H(` `+O(f.value),1)])):U(``,!0),B(`div`,Fq,[_.value?d.value&&x.value.length===0?(L(),z(OV,{key:1,class:`h-full w-full`,rounded:`rounded-panel`})):(L(),z(cq,{key:2,lines:x.value,version:S.value,live:o.value===`live`,class:`h-full`,"empty-hint":o.value===`live`?A(Y)(`views.logs.waitingOutput`):A(Y)(`views.logs.fileEmpty`),"min-height":`100%`},null,8,[`lines`,`version`,`live`,`empty-hint`])):(L(),z(gL,{key:0,title:A(Y)(`views.logs.pickServerTitle`),description:A(Y)(`views.logs.pickServerDescription`)},{icon:j(()=>[V(A(Cy),{class:`size-4`})]),_:1},8,[`title`,`description`]))])]),V($z,{open:h.value,"onUpdate:open":t[6]||=e=>h.value=e,title:A(Y)(`views.logs.clearTitle`),description:A(Y)(`views.logs.clearDescription`,{server:_.value?.serverId??``}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[5]||=e=>h.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ie},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(O(A(Y)(`views.logs.clear`)),1)]),_:1})]),default:j(()=>[B(`p`,Iq,O(A(Y)(`views.logs.clearNote`)),1)]),_:1},8,[`open`,`title`,`description`])]))}}),Rq={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},zq={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},Bq={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},Vq={class:`p-4`},Hq={class:`p-4`},Uq={class:`p-4`},Wq={class:`p-4`},Gq={class:`p-4`},Kq={key:0,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},qq={class:`min-w-0`},Jq={class:`text-xs font-medium text-danger`},Yq={class:`mt-0.5 flex flex-wrap gap-x-2 text-2xs text-danger`},Xq={class:`space-y-3`},Zq={class:`flex items-center justify-between`},Qq={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},$q={key:0,class:`grid gap-4 lg:grid-cols-2`},eJ={key:2,class:`grid gap-4 lg:grid-cols-2`},tJ={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},nJ={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},rJ={class:`flex items-center gap-1`},iJ={class:`font-mono`},aJ=N({__name:`OverviewView`,setup(e){let t=XN(),n=dP(),r=k(!1),i=W(()=>t.appState.value===null),a=n.servers,o=W(()=>n.selected.value?.label??Y(`nav.workspace`)),s=W(()=>a.value.filter(e=>e.status===`running`)),c=W(()=>a.value.filter(e=>[`stopped`,`stopping`].includes(e.status))),l=W(()=>a.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),u=W(()=>{let e=0;for(let t of s.value){let n=t.resources?.rssBytes;typeof n==`number`&&(e+=n)}return e}),d=W(()=>{let e=0;for(let t of a.value){let r=CN(n.seriesOf(t.id).rss);r>e&&(e=r)}return e}),f=W(()=>{let e=0;for(let t of s.value)e+=t.resources?.cpuPercent??0;return e}),p=W(()=>{let e=a.value.map(e=>e.startedAt).filter(e=>typeof e==`number`);return e.length===0?`—`:jL(t.now.value-Math.min(...e))});return(e,m)=>{let h=pa(`RouterLink`);return L(),R(`div`,Rq,[V(CV,{title:o.value,description:A(Y)(`views.overview.description`)},{actions:j(()=>[V($,{variant:`ghost`,onClick:m[0]||=e=>A(n).startAll()},{default:j(()=>[V(A(_y),{class:`size-3.5`}),H(O(A(Y)(`views.actions.startAll`)),1)]),_:1}),V($,{variant:`ghost`,onClick:m[1]||=e=>A(n).stopAll()},{default:j(()=>[V(A(jy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.stopAll`)),1)]),_:1}),V($,{variant:`primary`,onClick:m[2]||=e=>r.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1})]),_:1},8,[`title`,`description`]),V(DV,{class:`p-0`},{default:j(()=>[i.value?(L(),R(`div`,zq,[(L(),R(I,null,P(5,e=>B(`div`,{key:e,class:`space-y-2`},[V(OV,{class:`h-2.5 w-16`}),V(OV,{class:`h-6 w-20`})])),64))])):(L(),R(`div`,Bq,[B(`div`,Vq,[V(MV,{label:A(Y)(`views.overview.running`),value:`${s.value.length}/${A(a).length}`,tone:`ok`,hint:A(Y)(`views.overview.notUp`,{count:A(a).length-s.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,Hq,[V(MV,{label:A(Y)(`views.overview.stopped`),value:String(c.value.length),hint:A(Y)(`views.overview.enabled`,{count:A(a).filter(e=>e.config.enabled).length})},null,8,[`label`,`value`,`hint`])]),B(`div`,Uq,[V(MV,{label:A(Y)(`views.overview.needsAttention`),value:String(l.value.length),tone:l.value.length>0?`danger`:`ok`,hint:l.value.length===0?A(Y)(`views.overview.nothingBroken`):A(Y)(`views.overview.crashedOrUnhealthy`)},null,8,[`label`,`value`,`tone`,`hint`])]),B(`div`,Wq,[V(MV,{label:A(Y)(`views.overview.processMemory`),value:A(LL)(u.value),hint:d.value>0?A(Y)(`views.overview.peak`,{value:A(LL)(d.value)}):A(Y)(`views.overview.acrossTree`)},null,8,[`label`,`value`,`hint`])]),B(`div`,Gq,[V(MV,{label:A(Y)(`views.overview.longestUptime`),value:p.value,hint:s.value.length>0?A(Y)(`views.overview.cpuNow`,{value:f.value.toFixed(1)}):A(Y)(`views.overview.nothingRunning`)},null,8,[`label`,`value`,`hint`])])]))]),_:1}),l.value.length>0?(L(),R(`div`,Kq,[V(A(Vv),{class:`mt-0.5 size-4 shrink-0 text-danger`}),B(`div`,qq,[B(`p`,Jq,O(A(_F)(`views.overview.needLook`,l.value.length)),1),B(`p`,Yq,[(L(!0),R(I,null,P(l.value,e=>(L(),z(h,{key:e.id,to:`/servers/${e.id}`,class:`font-mono underline-offset-2 hover:underline`},{default:j(()=>[H(O(e.id),1)]),_:2},1032,[`to`]))),128))])])])):U(``,!0),B(`section`,Xq,[B(`div`,Zq,[B(`h2`,Qq,[V(A(Ty),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`nav.servers`)),1)]),V(h,{to:A(u1)(A(n).activeId.value,`servers`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:j(()=>[H(O(A(Y)(`views.overview.openFullList`)),1)]),_:1},8,[`to`])]),i.value?(L(),R(`div`,$q,[(L(),R(I,null,P(4,e=>V(OV,{key:e,class:`h-64 w-full`,rounded:`rounded-panel`})),64))])):A(a).length===0?(L(),z(gL,{key:1,title:A(Y)(`views.overview.emptyTitle`),description:A(Y)(`views.overview.emptyDescription`)},{icon:j(()=>[V(A(Ty),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:m[3]||=e=>r.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):(L(),R(`div`,eJ,[(L(!0),R(I,null,P(A(a),e=>(L(),z(gV,{key:e.id,server:e,"workspace-id":A(n).activeId.value,series:A(n).seriesOf(e.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]),V(DV,null,{header:j(()=>[B(`h2`,tJ,[V(A(jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.overview.recentActivity`)),1)])]),actions:j(()=>[V(h,{to:A(u1)(A(n).activeId.value,`logs`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:j(()=>[H(O(A(Y)(`nav.logs`)),1)]),_:1},8,[`to`])]),default:j(()=>[V(fR,{servers:A(a),now:A(t).now.value,limit:10},null,8,[`servers`,`now`])]),_:1}),B(`p`,nJ,[B(`span`,rJ,[V(A(Fy),{class:`size-3`}),H(O(A(Y)(`views.overview.sampling`)),1)]),B(`span`,iJ,O(A(n).selected.value?.configPath),1),B(`span`,{class:D(A(Q)(`flex items-center gap-1`))},[m[5]||=B(`span`,{class:`size-1.5 rounded-full bg-ok`},null,-1),H(` `+O(A(Y)(`views.overview.workspaceLabel`,{id:A(n).activeId.value})),1)],2)]),V(dB,{open:r.value,"onUpdate:open":m[4]||=e=>r.value=e,"workspace-id":A(n).activeId.value},null,8,[`open`,`workspace-id`])])}}}),oJ=/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/i,sJ=/^(?:[a-z][a-z0-9+.-]*:\/\/)?(?<authority>[^/?#]+)/i,cJ=[`.localhost`,`.local`,`.internal`,`.home.arpa`,`.lan`,`.home`,`.test`,`.invalid`,`.example`],lJ=/^[a-z0-9][a-z0-9_-]*$/,uJ={hostRequired:()=>`a hostname is required`,hostInvalid:()=>`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,hostDuplicate:e=>`"${e}" is already routed for this path`,pathNeedsSlash:()=>`a path prefix starts with /`,pathHasSpace:()=>`a path prefix cannot contain a space`,idInvalid:()=>`the id must start with a letter or digit, then letters, digits, dash or underscore`,idDuplicate:e=>`route id "${e}" is used twice`,workspaceRequired:()=>`pick the workspace that owns the server`,serverRequired:()=>`pick a server in that workspace`,urlInvalid:()=>`an upstream like http://10.0.0.5:8080`},dJ={controlPanel:()=>`control panel`,noUpstream:()=>`no upstream`,noServerPicked:()=>`no server picked`,fallbackRetry:()=>`~8 hours`,retryOne:(e,t)=>`~${e} ${t}`,retryMany:(e,t)=>`~${e} ${t}s`},fJ=4443,pJ=4480;function mJ(e){return e.label.trim().length>0?e.label:e.id}var hJ=0;function gJ(e){return e.find(e=>e.tls!==`off`&&yJ(e.host))?.host??null}function _J(e){if(e===null||e<0)return`—`;let t=[`B`,`KiB`,`MiB`,`GiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function vJ(e){return e>0&&e<1024}function yJ(e){let t=e.trim().toLowerCase();return t.length===0||t===`localhost`||!t.includes(`.`)||cJ.some(e=>t.endsWith(e))?!1:!/^\d{1,3}(?:\.\d{1,3}){3,}$/.test(t)}function bJ(e,t){let n={};e.enabled!==t.enabled&&(n.enabled=t.enabled),e.httpPort!==t.httpPort&&(n.httpPort=t.httpPort),e.httpsPort!==t.httpsPort&&(n.httpsPort=t.httpsPort),e.email!==t.email&&(n.email=t.email),e.staging!==t.staging&&(n.staging=t.staging);let r=CJ(t.resolvers);return(e.dns01.enabled!==t.dns01||e.dns01.resolvers.join(`,`)!==r.join(`,`))&&(n.dns01={enabled:t.dns01,resolvers:r}),n}function xJ(){return{key:SJ(),id:`route`,host:``,enabled:!0,target:`server`,workspace:``,server:``,url:``,path:``,tls:`auto`,dnsAccount:``}}function SJ(){return hJ+=1,`proxy-route-${hJ}`}function CJ(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(e=>e.length>0)}function wJ(e,t,n){let r=bJ(e,t),i=kJ(e.routes,n);return i!==null&&(r.routes=i),Object.keys(r).length===0?null:r}function TJ(e,t){return e.staging||e.email.trim().length>0?!1:t.some(e=>e.tls!==`off`&&yJ(e.host))}function EJ(e,t=dJ){if(e===null)return t.fallbackRetry();if(e<60)return e===1?t.retryOne(e,`minute`):t.retryMany(e,`minute`);let n=Math.max(1,Math.round(e/60));return n===1?t.retryOne(n,`hour`):t.retryMany(n,`hour`)}function DJ(e,t,n){let r=e.host.trim();if(r.length===0)return null;let i=e.tls===`off`,a=i?t:n,o=i?80:443,s=e.path.length===0||e.path.startsWith(`/`)?e.path:`/${e.path}`;return`${i?`http`:`https`}://${r}${a===o?``:`:${a}`}${s}`}function OJ(e,t){return e.length===t.length&&e.every((e,n)=>AJ(e,t[n]))}function kJ(e,t){return OJ(e,t)?null:FJ(t)}function AJ(e,t){return JSON.stringify(IJ(e))===JSON.stringify(IJ(t))}function jJ(e){return MJ(e,`certificate`)}function MJ(e,t){let n=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40).replace(/-+$/,``);return n.length===0?t:/^[a-z0-9]/.test(n)?n:`r-${n}`}function NJ(e){return MJ(e,`route`)}function PJ(e,t,n=dJ){return e.target===`panel`?n.controlPanel():e.target===`external`?e.url.trim().length>0?e.url.trim():n.noUpstream():e.workspace.length===0||e.server.length===0?n.noServerPicked():`${t.find(t=>t.id===e.workspace)?.label??e.workspace} / ${e.server}`}function FJ(e){return e.map(IJ)}function IJ(e){return{id:e.id,host:e.host,enabled:e.enabled,target:e.target,workspace:e.workspace,server:e.server,url:e.url,path:e.path,tls:e.tls,dnsAccount:e.dnsAccount}}function LJ(e,t){return RJ(e,t)}function RJ(e,t){let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}-${r}`);)r+=1;return`${e}-${r}`}function zJ(e,t){return RJ(e,t)}function BJ(e){return e.httpPort===4480&&e.httpsPort===4443}function VJ(e,t){let n={...uJ,...t.messages},r={},i=e.host.trim();if(i.length===0?r.host=n.hostRequired():oJ.test(i)?t.others.some(t=>t.host.trim().toLowerCase()===i.toLowerCase()&&t.path.replace(/\/+$/,``)===e.path.replace(/\/+$/,``))&&(r.host=n.hostDuplicate(i)):r.host=n.hostInvalid(),e.path.length>0&&!e.path.startsWith(`/`)?r.path=n.pathNeedsSlash():/\s/.test(e.path)&&(r.path=n.pathHasSpace()),lJ.test(e.id)?t.others.some(t=>t.id===e.id)&&(r.id=n.idDuplicate(e.id)):r.id=n.idInvalid(),e.target===`server`){let i=t.workspaces.find(t=>t.id===e.workspace);e.workspace.length===0||i===void 0?r.workspace=n.workspaceRequired():(e.server.length===0||!i.servers.some(t=>t.id===e.server))&&(r.server=n.serverRequired())}e.target===`external`&&HJ(e.url)===null&&(r.url=n.urlInvalid());let a=YA({...IJ(e),host:i});return a instanceof J.errors&&Object.keys(r).length===0&&(r.form=a.summary),r}function HJ(e){let t=e.trim();if(t.length===0)return null;let n=sJ.exec(t)?.groups?.authority;if(n===void 0||n.length===0||n.endsWith(`:`)||/\s/.test(n))return null;let r=t.slice(0,t.indexOf(`:`)).toLowerCase(),i=n.lastIndexOf(`:`);if(i<=0)return{host:n,port:r===`https`?`443`:`80`};let a=n.slice(i+1);return/^\d{1,5}$/.test(a)?{host:n.slice(0,i),port:a}:null}var UJ=[{value:`server`,labelKey:`proxy.target.server`},{value:`panel`,labelKey:`proxy.target.panel`},{value:`external`,labelKey:`proxy.target.external`}],WJ=[{value:`auto`,labelKey:`proxy.tls.auto`},{value:`off`,labelKey:`proxy.tls.off`},{value:`manual`,labelKey:`proxy.tls.manual`}],GJ={off:{labelKey:`proxy.status.off`,tone:`neutral`,transitional:!1},stopped:{labelKey:`proxy.status.stopped`,tone:`neutral`,transitional:!1},starting:{labelKey:`proxy.status.starting`,tone:`warn`,transitional:!0},running:{labelKey:`proxy.status.running`,tone:`ok`,transitional:!1},error:{labelKey:`proxy.status.error`,tone:`danger`,transitional:!1},unsupported:{labelKey:`proxy.status.unsupported`,tone:`warn`,transitional:!1}},KJ={ok:{labelKey:`proxy.status.serving`,tone:`ok`},disabled:{labelKey:`proxy.status.disabled`,tone:`neutral`},"no-upstream":{labelKey:`proxy.status.noUpstream`,tone:`warn`},error:{labelKey:`proxy.status.error`,tone:`danger`}},qJ={off:null,local:{labelKey:`proxy.status.localCa`,tone:`neutral`},uploaded:{labelKey:`proxy.status.uploaded`,tone:`info`},issued:{labelKey:`proxy.status.certified`,tone:`ok`},pending:{labelKey:`proxy.status.awaitingCa`,tone:`warn`},failed:{labelKey:`proxy.status.failed`,tone:`danger`},fallback:{labelKey:`proxy.status.fellBack`,tone:`warn`}};function JJ(e){let t=e.certificate;if(t===void 0)return null;let n=qJ[t.state]??null;return n===null?null:{...n,message:t.message,retryInMinutes:t.retryInMinutes??null}}function YJ(e){return{enabled:e.enabled,httpPort:e.httpPort,httpsPort:e.httpsPort,email:e.email,staging:e.staging,dns01:e.dns01.enabled,resolvers:e.dns01.resolvers.join(`, `)}}function XJ(e){let t=[{value:``,label:Y(`proxy.account.automatic`)}];for(let n of e){let e=n.label.length>0?n.label:n.account,r=[n.writesTxt?null:Y(`proxy.account.noTxt`),n.writesTxt&&!n.hasCredentials?Y(`proxy.account.noCredentials`):null].filter(e=>e!==null);t.push({value:`${n.workspace}/${n.account}`,label:`${e} · ${n.provider} · ${n.workspace}${r.length>0?` (${r.join(`, `)})`:``}`})}return t}function ZJ(e){return{...YJ(e)}}function QJ(e){return structuredClone(dn(e)).map(e=>({...e,key:SJ()}))}function $J(e,t,n){return t===null?[...e,n]:e.map(e=>e.id===t.id?n:e)}function eY(e){return e.tls===`off`?Y(`proxy.tls.plain`):e.tls===`manual`?Y(`proxy.tls.uploaded`):yJ(e.host)?Y(`proxy.tls.letsEncrypt`):Y(`proxy.tls.engineCa`)}var tY={controlPanel:()=>Y(`proxy.target.controlPanel`),noUpstream:()=>Y(`proxy.target.noUpstream`),noServerPicked:()=>Y(`proxy.target.noServer`),fallbackRetry:()=>Y(`proxy.retry.inFallback`),retryOne:(e,t)=>_F(`proxy.retry.in${t===`minute`?`Minutes`:`Hours`}`,e),retryMany:(e,t)=>_F(`proxy.retry.in${t===`minute`?`Minutes`:`Hours`}`,e)},nY={hostRequired:()=>Y(`proxy.validation.hostRequired`),hostInvalid:()=>Y(`proxy.validation.hostPattern`),hostDuplicate:e=>Y(`proxy.validation.hostTaken`,{host:e}),pathNeedsSlash:()=>Y(`proxy.validation.pathSlash`),pathHasSpace:()=>Y(`proxy.validation.pathSpace`),idInvalid:()=>Y(`proxy.validation.idPattern`),idDuplicate:e=>Y(`proxy.validation.idTaken`,{id:e}),workspaceRequired:()=>Y(`proxy.validation.workspaceRequired`),serverRequired:()=>Y(`proxy.validation.serverRequired`),urlInvalid:()=>Y(`proxy.validation.url`)};function rY(e,t){return PJ(e,t,tY)}function iY(e){return EJ(e,tY)}var aY={class:`grid gap-3 sm:grid-cols-2`},oY={class:`grid gap-3 sm:grid-cols-2`},sY={class:`flex min-w-0 flex-col gap-1`},cY={class:`flex min-w-0 flex-col gap-1`},lY=N({__name:`CertificateDialog`,props:za({taken:{},busy:{type:Boolean},error:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`submit`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=k(``),o=k(``),s=k(``),c=k(``),l=k({}),u=k(!1),d=Q(Sz,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`),f=W(()=>LJ(jJ(a.value),n.taken)),p=W(()=>!n.busy&&a.value.trim().length>0&&s.value.trim().length>0&&c.value.trim().length>0);function m(e){o.value=e,u.value=e.trim().length>0}M([a,()=>n.taken],()=>{u.value||(o.value=f.value)},{immediate:!0}),M(i,e=>{e&&(a.value=``,o.value=``,s.value=``,c.value=``,l.value={},u.value=!1)});async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?s.value=r:c.value=r}function g(){let e=a.value.trim(),t=o.value.trim(),i={};e.length===0&&(i.label=Y(`proxy.certificateDialog.errorLabel`)),lJ.test(t)?n.taken.includes(t)&&(i.id=Y(`proxy.certificateDialog.errorTaken`,{id:t})):i.id=Y(`proxy.certificateDialog.errorId`),s.value.trim().length===0&&(i.certificate=Y(`proxy.certificateDialog.errorCertificate`)),c.value.trim().length===0&&(i.privateKey=Y(`proxy.certificateDialog.errorPrivateKey`)),l.value=i,!(Object.keys(i).length>0)&&r(`submit`,{id:t,label:e,certificate:s.value,privateKey:c.value})}return(e,t)=>(L(),z($z,{open:i.value,"onUpdate:open":t[6]||=e=>i.value=e,title:A(Y)(`proxy.certificateDialog.title`),description:A(Y)(`proxy.certificateDialog.description`)},{footer:j(()=>[V($,{variant:`ghost`,disabled:n.busy,onClick:t[5]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:!p.value,loading:n.busy,onClick:g},{default:j(()=>[H(O(A(Y)(`proxy.certificateDialog.store`)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`form`,{class:`space-y-3`,onSubmit:lu(g,[`prevent`])},[B(`div`,aY,[V(Rz,{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:A(Y)(`proxy.certificateDialog.label`),placeholder:A(Y)(`proxy.certificateDialog.labelPlaceholder`),error:l.value.label},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(Rz,{"model-value":o.value,label:A(Y)(`proxy.certificateDialog.id`),hint:A(Y)(`proxy.certificateDialog.idHint`),error:l.value.id,"onUpdate:modelValue":m},null,8,[`model-value`,`label`,`hint`,`error`])]),B(`div`,oY,[B(`div`,sY,[B(`label`,{class:D(A(bz)),for:`proxy-cert-file`},O(A(Y)(`proxy.certificateDialog.certFile`)),3),B(`input`,{id:`proxy-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:D(A(d)),onChange:t[1]||=e=>h(e,`cert`)},null,34)]),B(`div`,cY,[B(`label`,{class:D(A(bz)),for:`proxy-cert-key`},O(A(Y)(`proxy.certificateDialog.keyFile`)),3),B(`input`,{id:`proxy-cert-key`,type:`file`,accept:`.pem,.key,text/plain`,class:D(A(d)),onChange:t[2]||=e=>h(e,`key`)},null,34)])]),V(rB,{modelValue:s.value,"onUpdate:modelValue":t[3]||=e=>s.value=e,label:A(Y)(`proxy.certificateDialog.pasteCert`),rows:4,placeholder:A(Y)(`proxy.certificateDialog.certPlaceholder`),error:l.value.certificate},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(rB,{modelValue:c.value,"onUpdate:modelValue":t[4]||=e=>c.value=e,label:A(Y)(`proxy.certificateDialog.pasteKey`),rows:4,placeholder:A(Y)(`proxy.certificateDialog.keyPlaceholder`),error:l.value.privateKey},null,8,[`modelValue`,`label`,`placeholder`,`error`]),n.error?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(n.error),1)]),_:1})):U(``,!0)],32)]),_:1},8,[`open`,`title`,`description`]))}}),uY={key:0,class:`sm:col-span-2`},dY={key:1,class:`space-y-2 sm:col-span-2`},fY={class:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},pY={class:`min-w-0 text-xs font-medium text-ink`},mY={class:`ml-1.5 font-mono text-2xs text-faint`},hY={key:0,class:`mt-2`},gY={key:1,class:`mt-2 divide-y divide-line-soft text-2xs`},_Y={class:`flex items-start justify-between gap-4 py-1`},vY={class:`text-muted`},yY={class:`min-w-0 text-right font-mono text-ink`},bY={class:`flex items-start justify-between gap-4 py-1`},xY={class:`text-muted`},SY={class:`min-w-0 text-right font-mono text-ink`},CY={class:`flex items-start justify-between gap-4 py-1`},wY={class:`text-muted`},TY={class:`font-mono text-ink`},EY={class:`flex items-start justify-between gap-4 py-1`},DY={class:`shrink-0 text-muted`},OY={class:`min-w-0 text-right font-mono text-ink`},kY={key:1,class:`text-faint`},AY={class:`mt-2 flex justify-end`},jY={class:`text-xs font-semibold text-ink`},MY={class:`mt-1 text-2xs leading-4 text-muted`},NY={class:`mt-2.5 flex justify-end gap-1.5`},PY={key:2,class:`space-y-2 sm:col-span-2`},FY=N({__name:`CertificatePanel`,props:{certificates:{},disabled:{type:Boolean}},emits:[`changed`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=k(!1),o=k(null),s=k(null),c=k(null),l=W(()=>n.certificates.map(e=>e.id));async function u(e,t){a.value=!0,o.value=null,s.value=null;try{return r(`changed`,await e()),s.value=t,!0}catch(e){return o.value=Lj(e),!1}finally{a.value=!1}}async function d(e){await u(()=>dM(e.id,e.label,e.certificate,e.privateKey),Y(`proxy.certificate.stored`,{label:e.label}))&&(i.value=!1)}function f(e){c.value=null,u(()=>Jj(e.id),Y(`proxy.certificate.removed`,{name:mJ(e)}))}return(e,t)=>(L(),z(gz,{title:A(Y)(`proxy.certificate.title`),description:A(Y)(`proxy.certificate.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`secondary`,disabled:n.disabled||a.value,onClick:t[0]||=e=>i.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(` `+O(A(Y)(`proxy.certificate.add`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[n.certificates.length===0?(L(),R(`div`,uY,[V(gL,{compact:``,title:A(Y)(`proxy.certificate.emptyTitle`),description:A(Y)(`proxy.certificate.emptyDescription`)},{icon:j(()=>[V(A(iy),{class:`size-5`})]),action:j(()=>[V($,{variant:`primary`,disabled:n.disabled||a.value,onClick:t[1]||=e=>i.value=!0},{default:j(()=>[H(O(A(Y)(`proxy.certificateDialog.title`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`title`,`description`])])):(L(),R(`ul`,dY,[(L(!0),R(I,null,P(n.certificates,e=>(L(),R(`li`,{key:e.id,class:`rounded-panel border border-line bg-page/40 p-3`},[B(`div`,fY,[B(`p`,pY,[H(O(A(mJ)(e))+` `,1),B(`span`,mY,O(e.id),1)]),e.daysRemaining===null?U(``,!0):(L(),R(`span`,{key:0,class:D([`text-2xs tabular-nums`,e.daysRemaining<14?`text-warn`:`text-faint`])},O(A(Y)(`proxy.certificate.daysLeft`,{days:e.daysRemaining})),3))]),e.error?(L(),R(`div`,hY,[V(_H,{tone:`danger`},{default:j(()=>[H(O(e.error),1)]),_:2},1024)])):(L(),R(`dl`,gY,[B(`div`,_Y,[B(`dt`,vY,O(A(Y)(`proxy.certificate.subject`)),1),B(`dd`,yY,O(e.subject??`—`),1)]),B(`div`,bY,[B(`dt`,xY,O(A(Y)(`proxy.certificate.issuer`)),1),B(`dd`,SY,O(e.issuer??`—`),1)]),B(`div`,CY,[B(`dt`,wY,O(A(Y)(`proxy.certificate.validUntil`)),1),B(`dd`,TY,O(e.validTo?e.validTo.slice(0,10):`—`),1)]),B(`div`,EY,[B(`dt`,DY,O(A(Y)(`proxy.certificate.covers`)),1),B(`dd`,OY,[e.hosts.length>0?(L(),R(I,{key:0},[H(O(e.hosts.join(`, `)),1)],64)):(L(),R(`span`,kY,O(A(Y)(`proxy.certificate.noSans`)),1))])])])),B(`div`,AY,[V(A(Wh),{open:c.value===e.id,"onUpdate:open":t=>c.value=t?e.id:null},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`danger-ghost`,disabled:a.value,"aria-label":A(Y)(`proxy.certificate.removeAria`,{name:A(mJ)(e)})},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(` `+O(A(Y)(`common.remove`)),1)]),_:1},8,[`disabled`,`aria-label`])]),_:2},1024),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`end`,class:D(A(Q)(`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float`,`focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`))},{default:j(()=>[B(`p`,jY,O(A(Y)(`proxy.certificate.removeQuestion`,{name:A(mJ)(e)})),1),B(`p`,MY,O(A(Y)(`proxy.certificate.removeBody`)),1),B(`div`,NY,[V(A(Gh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`danger`,loading:a.value,onClick:t=>f(e)},{default:j(()=>[H(O(A(Y)(`proxy.certificate.removeIt`)),1)]),_:1},8,[`loading`,`onClick`])])]),_:2},1032,[`class`])]),_:2},1024)]),_:2},1032,[`open`,`onUpdate:open`])])]))),128))])),o.value||s.value?(L(),R(`div`,PY,[o.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0),s.value?(L(),z(_H,{key:1,tone:`ok`},{default:j(()=>[H(O(s.value),1)]),_:1})):U(``,!0)])):U(``,!0),V(lY,{open:i.value,"onUpdate:open":t[2]||=e=>i.value=e,taken:l.value,busy:a.value,error:o.value,onSubmit:d},null,8,[`open`,`taken`,`busy`,`error`])]),_:1},8,[`title`,`description`]))}}),IY={key:0,class:`sm:col-span-2`},LY={key:0,class:`sm:col-span-2`},RY={key:1,class:`sm:col-span-2`},zY={class:`divide-y divide-line-soft text-xs sm:col-span-2`},BY={class:`flex items-start justify-between gap-4 py-1.5`},VY={class:`text-muted`},HY={class:`font-mono text-xs text-ink`},UY={class:`flex items-start justify-between gap-4 py-1.5`},WY={class:`text-muted`},GY={class:`text-right text-xs text-ink`},KY={key:0,class:`flex items-start justify-between gap-4 py-1.5`},qY={class:`text-muted`},JY={class:`font-mono text-xs tabular-nums text-ink`},YY={key:1,class:`flex items-start justify-between gap-4 py-1.5`},XY={class:`text-muted`},ZY={class:`flex min-w-0 items-center gap-1.5`},QY={class:`min-w-0 truncate font-mono text-2xs text-ink`},$Y={class:`flex items-start justify-between gap-4 py-1.5`},eX={class:`text-muted`},tX={class:`flex flex-wrap items-center justify-end gap-x-2 gap-y-1 text-right font-mono text-xs`},nX=[`href`],rX={key:0,class:`text-ink`},iX={class:`flex items-start justify-between gap-4 py-1.5`},aX={class:`text-muted`},oX={class:`font-mono text-xs tabular-nums text-ink`},sX={class:`flex items-start justify-between gap-4 py-1.5`},cX={class:`text-muted`},lX={class:`text-xs text-ink`},uX={class:`flex flex-wrap gap-1.5 sm:col-span-2`},dX=[`href`],fX={key:3,class:`sm:col-span-2`},pX={key:4,class:`text-2xs leading-4 text-faint sm:col-span-2`},mX={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},hX={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},gX=N({__name:`EnginePanel`,props:{view:{},busy:{}},emits:[`act`],setup(e,{emit:t}){let n=e,r=t,i=W(()=>n.view?.engine??null),a=W(()=>n.view?.status??null),o=W(()=>n.view?.engines[0]??null),s=W(()=>a.value===null?null:GJ[a.value.state]),c=W(()=>i.value?.installed===!0),l=W(()=>i.value?.path??null),u=W(()=>l.value===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${l.value}`),d=[{key:`acme`,labelKey:`proxy.engine.acme`},{key:`internalCa`,labelKey:`proxy.engine.localCa`},{key:`dns01`,labelKey:`proxy.engine.dns01`},{key:`tcp`,labelKey:`proxy.engine.tcpUdp`}];return(e,t)=>(L(),z(gz,{title:A(Y)(`proxy.engine.title`),description:A(Y)(`proxy.engine.description`)},{actions:j(()=>[s.value?(L(),z(_U,{key:0,tone:s.value.tone,dot:``},{default:j(()=>[H(O(A(Y)(s.value.labelKey)),1)]),_:1},8,[`tone`])):U(``,!0)]),default:j(()=>[i.value===null?(L(),R(`div`,IY,[V(_H,{tone:`info`},{default:j(()=>[H(O(A(Y)(`proxy.engine.notInFrame`)),1)]),_:1})])):(L(),R(I,{key:1},[i.value.error?(L(),R(`div`,LY,[V(_H,{tone:`danger`,title:A(Y)(`proxy.engine.readFailed`)},{default:j(()=>[H(O(i.value.error),1)]),_:1},8,[`title`])])):U(``,!0),c.value?(L(),R(I,{key:2},[B(`dl`,zY,[B(`div`,BY,[B(`dt`,VY,O(A(Y)(`proxy.engine.version`)),1),B(`dd`,HY,O(i.value.version??A(Y)(`proxy.engine.notProbed`)),1)]),B(`div`,UY,[B(`dt`,WY,O(A(Y)(`proxy.engine.source`)),1),B(`dd`,GY,O(i.value.source===`custom`?A(Y)(`proxy.engine.sourceCustom`):A(Y)(`proxy.engine.sourceDownloaded`)),1)]),i.value.bytes===null?U(``,!0):(L(),R(`div`,KY,[B(`dt`,qY,O(A(Y)(`proxy.engine.size`)),1),B(`dd`,JY,O(A(_J)(i.value.bytes)),1)])),l.value?(L(),R(`div`,YY,[B(`dt`,XY,O(A(Y)(`proxy.engine.binary`)),1),B(`dd`,ZY,[B(`span`,QY,O(l.value),1),V(hU,{value:l.value,label:A(Y)(`proxy.engine.copyPath`)},null,8,[`value`,`label`])])])):U(``,!0),B(`div`,$Y,[B(`dt`,eX,O(A(Y)(`proxy.engine.address`)),1),B(`dd`,tX,[(L(!0),R(I,null,P(a.value?.urls??[],e=>(L(),R(`a`,{key:e,href:e,target:`_blank`,rel:`noreferrer`,class:`text-accent underline decoration-line underline-offset-2 hover:decoration-accent`},O(e),9,nX))),128)),!a.value||a.value.urls.length===0?(L(),R(`span`,rX,`—`)):U(``,!0)])]),B(`div`,iX,[B(`dt`,aX,O(A(Y)(`proxy.engine.process`)),1),B(`dd`,oX,O(a.value?.pid??`—`),1)]),B(`div`,sX,[B(`dt`,cX,O(A(Y)(`proxy.engine.certificates`)),1),B(`dd`,lX,O(a.value?.certExpiryDays===null||a.value?.certExpiryDays===void 0?A(Y)(`proxy.engine.noCert`):A(Y)(`proxy.engine.expiresSoon`,{days:a.value.certExpiryDays})),1)])]),B(`div`,uX,[(L(),R(I,null,P(d,e=>V(_U,{key:e.key,tone:o.value?.[e.key]?`ok`:`neutral`},{default:j(()=>[H(O(o.value?.[e.key]?`✓`:`✗`)+` `+O(A(Y)(e.labelKey)),1)]),_:2},1032,[`tone`])),64)),o.value?(L(),R(`a`,{key:0,class:`ml-1 self-center text-2xs text-accent underline decoration-line underline-offset-2`,href:o.value.docsUrl,target:`_blank`,rel:`noreferrer`},O(A(Y)(`proxy.engine.documentation`,{engine:o.value.label})),9,dX)):U(``,!0)])],64)):(L(),R(`div`,RY,[V(_H,{tone:`info`,title:A(Y)(`proxy.engine.notInstalled`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.installNote`,{engine:o.value?.label??i.value.id})),1)]),_:1},8,[`title`])])),a.value?.lastError?(L(),R(`div`,fX,[V(_H,{tone:`danger`,title:A(Y)(`proxy.engine.failed`)},{default:j(()=>[H(O(a.value.lastError),1)]),_:1},8,[`title`])])):U(``,!0),c.value&&u.value?(L(),R(`p`,pX,[H(O(A(Y)(`proxy.engine.setcapHint`))+` `,1),B(`code`,mX,O(u.value),1),V(hU,{value:u.value,label:A(Y)(`proxy.engine.copyCommand`),class:`ml-1 align-middle`},null,8,[`value`,`label`])])):U(``,!0)],64)),B(`div`,hX,[c.value?(L(),R(I,{key:1},[V($,{variant:`primary`,disabled:n.busy!==null||a.value?.state===`running`,loading:n.busy===`start`,onClick:t[1]||=e=>r(`act`,`start`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.start`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state===`off`||a.value?.state===`stopped`,loading:n.busy===`stop`,onClick:t[2]||=e=>r(`act`,`stop`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.stop`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`apply`,onClick:t[3]||=e=>r(`act`,`apply`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.apply`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`ghost`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`revert`,title:A(Y)(`proxy.engine.revertHint`),onClick:t[4]||=e=>r(`act`,`revert`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.revert`)),1)]),_:1},8,[`disabled`,`loading`,`title`]),V($,{variant:`ghost`,disabled:n.busy!==null,loading:n.busy===`install`,onClick:t[5]||=e=>r(`act`,`install`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.update`)),1)]),_:1},8,[`disabled`,`loading`])],64)):(L(),z($,{key:0,variant:`primary`,loading:n.busy===`install`,disabled:n.busy!==null,onClick:t[0]||=e=>r(`act`,`install`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.install`)),1)]),_:1},8,[`loading`,`disabled`]))])]),_:1},8,[`title`,`description`]))}}),_X={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},vX={key:0,class:`text-2xs text-faint`},yX={key:0,class:`sm:col-span-2`},bX={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},xX={key:1},SX={key:1,class:`sm:col-span-2`},CX={key:3,class:`sm:col-span-2`},wX={key:4,class:`sm:col-span-2`},TX={key:5,class:`text-2xs leading-4 text-faint sm:col-span-2`},EX={class:`text-2xs leading-4 text-faint sm:col-span-2`},DX=N({__name:`ListenerPanel`,props:za({emailHost:{},enginePath:{},dnsAccounts:{}},{form:{required:!0},formModifiers:{}}),emits:[`update:form`],setup(e){let t=e,n=so(e,`form`),r=W(()=>t.dnsAccounts.filter(e=>e.writesTxt&&e.hasCredentials)),i=W(()=>BJ(n.value)),a=W(()=>t.enginePath===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${t.enginePath}`),o=W(()=>vJ(n.value.httpPort)||vJ(n.value.httpsPort));function s(){n.value.httpPort=pJ,n.value.httpsPort=fJ}function c(){n.value.httpPort=80,n.value.httpsPort=443}function l(e,t){e===null||Number.isNaN(e)||e>=1&&e<=65535&&(n.value[t]=Math.trunc(e))}return(e,u)=>(L(),z(gz,{title:A(Y)(`proxy.listener.title`),description:A(Y)(`proxy.listener.description`)},{actions:j(()=>[i.value?(L(),z(_U,{key:0,tone:`info`},{default:j(()=>[H(O(A(Y)(`proxy.listener.unprivilegedPorts`)),1)]),_:1})):U(``,!0)]),default:j(()=>[V(Vz,{modelValue:n.value.enabled,"onUpdate:modelValue":u[0]||=e=>n.value.enabled=e,label:A(Y)(`proxy.listener.run`),hint:A(Y)(`proxy.listener.runHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{"model-value":n.value.httpPort,label:A(Y)(`proxy.listener.httpPort`),min:1,max:65535,hint:A(Y)(`proxy.listener.httpPortHint`),"onUpdate:modelValue":u[1]||=e=>l(e,`httpPort`)},null,8,[`model-value`,`label`,`hint`]),V(Dz,{"model-value":n.value.httpsPort,label:A(Y)(`proxy.listener.httpsPort`),min:1,max:65535,hint:A(Y)(`proxy.listener.httpsPortHint`),"onUpdate:modelValue":u[2]||=e=>l(e,`httpsPort`)},null,8,[`model-value`,`label`,`hint`]),B(`div`,_X,[V($,{size:`xs`,variant:`secondary`,onClick:s},{default:j(()=>[H(O(A(Y)(`proxy.listener.useFallback`,{http:A(pJ),https:A(fJ)})),1)]),_:1}),V($,{size:`xs`,variant:`ghost`,onClick:c},{default:j(()=>[H(O(A(Y)(`proxy.listener.useStandard`)),1)]),_:1}),i.value?(L(),R(`span`,vX,O(A(Y)(`proxy.listener.forwardHint`)),1)):U(``,!0)]),o.value?(L(),R(`div`,yX,[V(_H,{tone:`warn`,title:A(Y)(`proxy.listener.privilegedTitle`)},{default:j(()=>[V(iB,{k:`proxy.listener.privilegedBody`,params:{http:A(pJ),https:A(fJ)}},{how:j(()=>[a.value?(L(),R(I,{key:0},[B(`code`,bX,O(a.value),1),V(hU,{value:a.value,label:A(Y)(`proxy.engine.copyCommand`),class:`ml-1 align-middle`},null,8,[`value`,`label`])],64)):(L(),R(`span`,xX,[V(iB,{k:`proxy.listener.privilegedWithSetcap`},{command:j(()=>[...u[7]||=[B(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`setcap`,-1)]]),_:1})]))]),_:1},8,[`params`])]),_:1},8,[`title`])])):U(``,!0),V(Rz,{modelValue:n.value.email,"onUpdate:modelValue":u[3]||=e=>n.value.email=e,label:A(Y)(`proxy.listener.email`),placeholder:A(Y)(`proxy.listener.emailPlaceholder`),hint:A(Y)(`proxy.listener.emailHint`),wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),t.emailHost===null?U(``,!0):(L(),R(`div`,SX,[V(_H,{tone:`warn`,title:A(Y)(`proxy.listener.emailNeededTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.emailNeededBody`,{host:t.emailHost})),1)]),_:1},8,[`title`])])),V(Vz,{modelValue:n.value.staging,"onUpdate:modelValue":u[4]||=e=>n.value.staging=e,label:A(Y)(`proxy.listener.staging`),hint:A(Y)(`proxy.listener.stagingHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:n.value.dns01,"onUpdate:modelValue":u[5]||=e=>n.value.dns01=e,label:A(Y)(`proxy.listener.dns01`),hint:A(Y)(`proxy.listener.dns01Hint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),n.value.dns01?(L(),z(Rz,{key:2,modelValue:n.value.resolvers,"onUpdate:modelValue":u[6]||=e=>n.value.resolvers=e,label:A(Y)(`proxy.listener.resolvers`),placeholder:A(Y)(`proxy.listener.resolversPlaceholder`),hint:A(Y)(`proxy.listener.resolversHint`),spellcheck:`false`,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`])):U(``,!0),n.value.dns01&&r.value.length===0?(L(),R(`div`,CX,[V(_H,{tone:`warn`,title:A(Y)(`proxy.listener.noAccountTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.noAccountBody`)),1)]),_:1},8,[`title`])])):n.value.dns01&&r.value.length>1?(L(),R(`div`,wX,[V(_H,{tone:`info`,title:A(Y)(`proxy.listener.manyAccountsTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.manyAccountsBody`)),1)]),_:1},8,[`title`])])):U(``,!0),n.value.dns01?(L(),R(`p`,TX,O(A(Y)(`proxy.listener.accountNote`)),1)):U(``,!0),B(`p`,EX,O(A(Y)(`proxy.listener.pendingNote`)),1)]),_:1},8,[`title`,`description`]))}}),OX={class:`space-y-3`},kX={key:1,class:`text-2xs leading-4 text-faint sm:col-span-2`},AX={class:`text-2xs leading-4 text-faint sm:col-span-2`},jX={key:4,class:`text-2xs leading-4 text-warn sm:col-span-2`},MX=N({__name:`RouteDialog`,props:za({draft:{},others:{},workspaces:{},dnsAccounts:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`save`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=k(xJ()),o=k({}),s=W(()=>n.draft!==null),c=W(()=>(n.workspaces.find(e=>e.id===a.value.workspace)?.servers??[]).map(e=>({value:e.id,label:e.id}))),l=W(()=>UJ.map(e=>({value:e.value,label:Y(e.labelKey)}))),u=W(()=>WJ.map(e=>({value:e.value,label:Y(e.labelKey)}))),d=W(()=>a.value.tls===`off`?Y(`proxy.tls.hintOff`):a.value.tls===`manual`?Y(`proxy.tls.hintManual`):a.value.host.trim().length===0?Y(`proxy.tls.hintEmpty`):yJ(a.value.host)?Y(`proxy.tls.hintPublic`):Y(`proxy.tls.hintLocal`)),f=W(()=>a.value.tls===`auto`&&yJ(a.value.host)),p=W(()=>XJ(n.dnsAccounts)),m=W(()=>n.dnsAccounts.find(e=>`${e.workspace}/${e.account}`===a.value.dnsAccount)),h=W(()=>m.value===void 0?a.value.dnsAccount.length>0?Y(`proxy.account.gone`):Y(`proxy.account.emptyHint`):m.value.writesTxt?m.value.hasCredentials?Y(`proxy.account.through`,{provider:m.value.provider}):Y(`proxy.account.noCredentialsYet`,{provider:m.value.provider}):Y(`proxy.account.cannotWrite`,{provider:m.value.provider}));M(i,e=>{e&&(a.value=n.draft===null?xJ():structuredClone(dn(n.draft)),a.value.workspace.length===0&&(a.value.workspace=n.workspaces[0]?.id??``),o.value={})}),M(()=>a.value.workspace,()=>{c.value.some(e=>e.value===a.value.server)||(a.value.server=c.value[0]?.value??``)});function g(){let e=a.value.host.trim().toLowerCase(),t={...a.value,host:e,id:zJ(NJ(e),n.others.map(e=>e.id)),workspace:a.value.target===`server`?a.value.workspace:``,server:a.value.target===`server`?a.value.server:``,url:a.value.target===`external`?a.value.url.trim():``},s=VJ(t,{others:n.others,workspaces:n.workspaces,messages:nY});o.value=s,!(Object.keys(s).length>0)&&(r(`save`,t),i.value=!1)}return(e,t)=>(L(),z($z,{open:i.value,"onUpdate:open":t[9]||=e=>i.value=e,title:s.value?A(Y)(`proxy.routeDialog.titleEdit`):A(Y)(`proxy.routeDialog.titleAdd`),description:A(Y)(`proxy.routeDialog.description`),width:`w-[min(92vw,34rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[8]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,onClick:g},{default:j(()=>[H(O(s.value?A(Y)(`proxy.routeDialog.save`):A(Y)(`proxy.routes.add`)),1)]),_:1})]),default:j(()=>[B(`div`,OX,[V(Rz,{modelValue:a.value.host,"onUpdate:modelValue":t[0]||=e=>a.value.host=e,label:A(Y)(`proxy.routeDialog.hostname`),placeholder:A(Y)(`proxy.routeDialog.hostnamePlaceholder`),autocomplete:`off`,spellcheck:`false`,error:o.value.host,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(Rz,{modelValue:a.value.path,"onUpdate:modelValue":t[1]||=e=>a.value.path=e,label:A(Y)(`proxy.routeDialog.path`),placeholder:A(Y)(`proxy.routeDialog.pathPlaceholder`),hint:A(Y)(`proxy.routeDialog.pathHint`),spellcheck:`false`,error:o.value.path,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`error`]),V(Nz,{modelValue:a.value.target,"onUpdate:modelValue":t[2]||=e=>a.value.target=e,label:A(Y)(`proxy.routeDialog.target`),options:l.value},null,8,[`modelValue`,`label`,`options`]),V(Nz,{modelValue:a.value.tls,"onUpdate:modelValue":t[3]||=e=>a.value.tls=e,label:A(Y)(`proxy.routeDialog.tls`),options:u.value,hint:d.value},null,8,[`modelValue`,`label`,`options`,`hint`]),f.value?(L(),z(Nz,{key:0,modelValue:a.value.dnsAccount,"onUpdate:modelValue":t[4]||=e=>a.value.dnsAccount=e,label:A(Y)(`proxy.routeDialog.dnsAccount`),options:p.value,hint:h.value},null,8,[`modelValue`,`label`,`options`,`hint`])):a.value.tls===`auto`?(L(),R(`p`,kX,O(A(Y)(`proxy.routeDialog.localNote`)),1)):U(``,!0),a.value.target===`server`?(L(),R(I,{key:2},[V(Nz,{modelValue:a.value.workspace,"onUpdate:modelValue":t[5]||=e=>a.value.workspace=e,label:A(Y)(`proxy.routeDialog.workspace`),options:n.workspaces.map(e=>({value:e.id,label:e.label})),error:o.value.workspace},null,8,[`modelValue`,`label`,`options`,`error`]),V(Nz,{modelValue:a.value.server,"onUpdate:modelValue":t[6]||=e=>a.value.server=e,label:A(Y)(`proxy.routeDialog.server`),options:c.value,disabled:c.value.length===0,error:o.value.server??(c.value.length===0?A(Y)(`proxy.routeDialog.noServers`):null)},null,8,[`modelValue`,`label`,`options`,`disabled`,`error`]),B(`p`,AX,O(A(Y)(`proxy.routeDialog.stoppedNote`)),1)],64)):U(``,!0),a.value.target===`external`?(L(),z(Rz,{key:3,modelValue:a.value.url,"onUpdate:modelValue":t[7]||=e=>a.value.url=e,label:A(Y)(`proxy.routeDialog.upstream`),placeholder:A(Y)(`proxy.routeDialog.upstreamPlaceholder`),hint:A(Y)(`proxy.routeDialog.upstreamHint`),spellcheck:`false`,error:o.value.url,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`error`])):U(``,!0),a.value.target===`panel`?(L(),R(`p`,jX,O(A(Y)(`proxy.routeDialog.panelNote`)),1)):U(``,!0),o.value.form?(L(),z(_H,{key:5,tone:`danger`},{default:j(()=>[H(O(o.value.form),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),NX={class:`text-xs font-semibold text-ink`},PX={class:`mt-1 text-2xs leading-4 text-muted`},FX={class:`mt-1 text-2xs leading-4 text-warn`},IX={class:`mt-2.5 flex justify-end gap-1.5`},LX=N({__name:`RetryCertificateButton`,props:{host:{},retryIn:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(Wh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`secondary`,loading:n.busy,disabled:n.busy},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.force`)),1)]),_:1},8,[`loading`,`disabled`])]),_:1}),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,NX,O(A(Y)(`proxy.retryButton.question`,{host:n.host})),1),B(`p`,PX,O(A(Y)(`proxy.retryButton.body`,{retryIn:n.retryIn})),1),B(`p`,FX,O(A(Y)(`proxy.retryButton.warning`)),1),B(`div`,IX,[V(A(Gh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.leave`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`primary`,loading:n.busy,onClick:a},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.now`)),1)]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),RX={key:0,class:`sm:col-span-2`},zX={class:`list-disc space-y-0.5 pl-4`},BX={key:1,class:`sm:col-span-2`},VX={key:2,class:`overflow-x-auto sm:col-span-2`},HX={class:`w-full text-left text-xs`},UX={class:`text-2xs text-faint`},WX={class:`py-1 pr-3 font-medium`},GX={class:`py-1 pr-3 font-medium`},KX={class:`py-1 pr-3 font-medium`},qX={class:`py-1 pr-3 font-medium`},JX={class:`py-1 pr-3 font-medium`},YX={class:`py-1 pr-3 font-medium`},XX={class:`py-1 font-medium`},ZX={class:`sr-only`},QX={class:`py-1.5 pr-3`},$X={class:`font-mono text-xs text-ink`},eZ=[`href`,`title`],tZ={key:2,class:`text-accent`},nZ={class:`font-mono text-2xs text-faint`},rZ={class:`py-1.5 pr-3 text-2xs text-muted`},iZ={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},aZ={class:`py-1.5 pr-3 text-2xs text-muted`},oZ={key:0,class:`mt-0.5`},sZ={key:1,class:`mt-1`},cZ={class:`py-1.5 pr-3`},lZ={class:`py-1.5 pr-3`},uZ={class:`py-1.5`},dZ={class:`flex items-center justify-end gap-1`},fZ=N({__name:`RouteTable`,props:{routes:{},views:{},workspaces:{},httpPort:{},httpsPort:{},disabled:{type:Boolean}},emits:[`add`,`edit`,`remove`,`retry`,`toggle`],setup(e,{emit:t}){let n=e,r=t;function i(e){return e===`fallback`}let a=W(()=>n.routes.map(e=>{let t=n.views.find(t=>t.route.id===e.id)??null;return{route:e,view:t,meta:t===null?null:KJ[t.status],target:rY(e,n.workspaces),tls:eY(e),certificate:t===null?null:JJ(t),url:DJ(e,n.httpPort,n.httpsPort)}})),o=W(()=>a.value.filter(e=>e.view?.status===`error`));return(e,t)=>(L(),z(gz,{title:A(Y)(`proxy.routes.title`),description:A(Y)(`proxy.routes.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`secondary`,disabled:n.disabled,onClick:t[0]||=e=>r(`add`)},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(` `+O(A(Y)(`proxy.routes.add`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[o.value.length>0?(L(),R(`div`,RX,[V(_H,{tone:`danger`,title:A(Y)(`proxy.routes.cannotSaveTitle`)},{default:j(()=>[B(`ul`,zX,[(L(!0),R(I,null,P(o.value,e=>(L(),R(`li`,{key:e.route.id},O(e.view?.message??A(Y)(`proxy.routes.cannotRoute`,{host:e.route.host})),1))),128))])]),_:1},8,[`title`])])):U(``,!0),a.value.length===0?(L(),R(`div`,BX,[V(gL,{compact:``,title:A(Y)(`proxy.routes.emptyTitle`),description:A(Y)(`proxy.routes.emptyDescription`)},{icon:j(()=>[V(A(Ry),{class:`size-5`})]),action:j(()=>[V($,{variant:`primary`,disabled:n.disabled,onClick:t[1]||=e=>r(`add`)},{default:j(()=>[H(O(A(Y)(`proxy.routes.addFirst`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`title`,`description`])])):(L(),R(`div`,VX,[B(`table`,HX,[B(`thead`,null,[B(`tr`,UX,[B(`th`,WX,O(A(Y)(`proxy.routes.columnHostname`)),1),B(`th`,GX,O(A(Y)(`proxy.routes.columnTarget`)),1),B(`th`,KX,O(A(Y)(`proxy.routes.columnUpstream`)),1),B(`th`,qX,O(A(Y)(`proxy.routes.columnTls`)),1),B(`th`,JX,O(A(Y)(`proxy.routes.columnState`)),1),B(`th`,YX,O(A(Y)(`proxy.routes.columnOn`)),1),B(`th`,XX,[B(`span`,ZX,O(A(Y)(`common.actions`)),1)])])]),B(`tbody`,null,[(L(!0),R(I,null,P(a.value,e=>(L(),R(`tr`,{key:e.route.key,class:`border-t border-line-soft align-top`},[B(`td`,QX,[B(`p`,$X,[e.url!==null&&e.route.enabled?(L(),R(`a`,{key:0,href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`transition-colors duration-150 hover:text-accent hover:underline`,title:A(Y)(`proxy.routes.openInTab`,{url:e.url})},O(e.route.host),9,eZ)):(L(),R(I,{key:1},[H(O(e.route.host.trim().length>0?e.route.host:A(Y)(`proxy.routes.noHostname`)),1)],64)),e.route.path.length>0?(L(),R(`span`,tZ,O(e.route.path),1)):U(``,!0)]),B(`p`,nZ,O(e.route.id),1)]),B(`td`,rZ,O(e.target),1),B(`td`,iZ,O(e.view?.upstream??`—`),1),B(`td`,aZ,[H(O(e.tls)+` `,1),e.certificate?(L(),R(`div`,oZ,[V(_U,{tone:e.certificate.tone,dot:``},{default:j(()=>[H(O(A(Y)(e.certificate.labelKey)),1)]),_:2},1032,[`tone`]),e.certificate.message?(L(),R(`p`,{key:0,class:D([`mt-0.5 text-2xs`,e.certificate.tone===`danger`?`text-danger`:`text-faint`])},O(e.certificate.message),3)):U(``,!0),i(e.view?.certificate?.state)?(L(),R(`div`,sZ,[V(LX,{host:e.route.host,"retry-in":A(iY)(e.certificate?.retryInMinutes??null),busy:n.disabled,onConfirm:t=>r(`retry`,e.route)},null,8,[`host`,`retry-in`,`busy`,`onConfirm`])])):U(``,!0)])):U(``,!0)]),B(`td`,cZ,[e.meta?(L(),z(_U,{key:0,tone:e.meta.tone,dot:``},{default:j(()=>[H(O(A(Y)(e.meta.labelKey)),1)]),_:2},1032,[`tone`])):(L(),z(_U,{key:1,tone:`info`,dot:``},{default:j(()=>[H(O(A(Y)(`proxy.status.unapplied`)),1)]),_:1})),e.view?.message?(L(),R(`p`,{key:2,class:D([`mt-0.5 text-2xs`,e.view.status===`error`?`text-danger`:`text-warn`])},O(e.view.message),3)):U(``,!0)]),B(`td`,lZ,[V(Vz,{"model-value":e.route.enabled,label:A(Y)(`proxy.routes.toggle`,{name:e.route.host||e.route.id}),"sr-only":``,disabled:n.disabled,"onUpdate:modelValue":t=>r(`toggle`,e.route,t)},null,8,[`model-value`,`label`,`disabled`,`onUpdate:modelValue`])]),B(`td`,uZ,[B(`span`,dZ,[V($,{size:`xs`,variant:`ghost`,disabled:n.disabled,"aria-label":A(Y)(`proxy.routes.edit`,{name:e.route.host||e.route.id}),onClick:t=>r(`edit`,e.route)},{default:j(()=>[V(A(gy),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`]),V($,{size:`xs`,variant:`danger-ghost`,disabled:n.disabled,"aria-label":A(Y)(`proxy.routes.remove`,{name:e.route.host||e.route.id}),onClick:t=>r(`remove`,e.route)},{default:j(()=>[V(A(Iy),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`])])])]))),128))])])]))]),_:1},8,[`title`,`description`]))}}),pZ={class:`min-h-full`},mZ={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},hZ={class:`mb-5`},gZ={class:`text-xl font-semibold tracking-tight text-ink`},_Z={class:`mt-1 text-xs text-muted`},vZ={class:`mt-1 text-2xs leading-4 text-faint`},yZ={key:2,class:`space-y-6`},bZ={key:0,class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},xZ={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},SZ={class:`min-w-0 flex-1`},CZ={class:`text-xs text-muted`},wZ={class:`font-mono tabular-nums text-ink`},TZ={key:0,class:`mt-0.5 text-xs text-danger`},EZ={key:1,class:`mt-0.5 text-xs text-danger`},DZ={key:2,class:`mt-0.5 text-xs text-ok`},OZ={class:`flex shrink-0 items-center gap-2`},kZ=N({__name:`ProxyView`,setup(e){let t=XN(),n=vN(),r=k(null),i=k(null),a=k(null),o=k(!1),s=k(null),c=k({enabled:!1,httpPort:80,httpsPort:443,email:``,staging:!1,dns01:!1,resolvers:``}),l=k([]),u=k(!1),d=k(null),f=W(()=>t.proxy.value??r.value),p=W(()=>f.value?.config??null),m=W(()=>f.value?.engine.path??null),h=W(()=>t.workspaces.value.map(e=>({id:e.id,label:e.label,servers:e.servers.map(e=>({id:e.id}))}))),g=W(()=>TJ(c.value,l.value)?gJ(l.value):null),_=W(()=>p.value!==null&&kJ(p.value.routes,l.value)!==null),v=W(()=>{if(p.value===null)return 0;let e=wJ(p.value,c.value,l.value);return e===null?0:Object.keys(e).filter(e=>e!==`routes`).length+(e.routes===void 0?0:1)}),y=W(()=>(f.value?.routes??[]).filter(e=>e.status===`error`)),b=W(()=>_.value?[]:y.value.map(e=>e.message??Y(`proxy.routes.cannotRoute`,{host:e.route.host}))),x={};function S(){let e=p.value;if(e===null)return;qR(x.listener,{...c.value})||(Object.assign(c.value,ZJ(e)),x.listener={...c.value});let t=FJ(l.value);qR(x.routes,t)||(l.value=QJ(e.routes),x.routes=FJ(l.value))}M(f,S,{immediate:!0});async function C(){i.value=null;try{r.value=await Xj()}catch(e){i.value=Lj(e)}}na(()=>{t.proxy.value===null&&C()});let w={install:()=>$j(),start:lM,stop:uM,apply:Gj,revert:oM},T={install:`proxy.view.engineInstalled`,start:`proxy.view.engineStarting`,stop:`proxy.view.engineStopping`,apply:`proxy.view.configApplied`,revert:`proxy.view.configReverted`};async function ee(e){if(s.value===null){s.value=e,a.value=null;try{r.value=await w[e](),n.success(Y(T[e])),await t.refresh()}catch(e){a.value=Lj(e)}finally{s.value=null}}}let te=k(null),ne=k(null);async function re(){let e=p.value,i=e===null?null:wJ(e,c.value,l.value);if(!(i===null||o.value||b.value.length>0)){o.value=!0,te.value=null,ne.value=null;try{r.value=await nM(i),await t.refresh(),ne.value=Y(`proxy.view.settingsSaved`),n.success(Y(`proxy.view.settingsSavedToast`)),delete x.listener,delete x.routes,S()}catch(e){te.value=Lj(e)}finally{o.value=!1}}}function ie(){te.value=null,ne.value=null,delete x.listener,delete x.routes,S()}function ae(){d.value=null,u.value=!0}function oe(e){d.value=e,u.value=!0}function se(e){l.value=$J(l.value,d.value,e),d.value=null}function ce(e){l.value=l.value.filter(t=>t.key!==e.key)}async function le(e){s.value=`apply`;try{r.value=await aM(e.id),await t.refresh(),n.success(Y(`proxy.view.retryAsked`,{host:e.host}))}catch(e){n.failure(Y(`proxy.view.retryFailed`),Lj(e))}finally{s.value=null}}function E(e,t){e.enabled=t}async function ue(e){r.value=e,await t.refresh()}return(e,t)=>(L(),R(`div`,pZ,[B(`div`,mZ,[B(`header`,hZ,[B(`h1`,gZ,O(A(Y)(`proxy.view.title`)),1),B(`p`,_Z,O(A(Y)(`proxy.view.description`)),1),B(`p`,vZ,O(A(Y)(`proxy.view.dnsNote`)),1)]),i.value?(L(),z(_H,{key:0,tone:`danger`,title:A(Y)(`proxy.view.readFailed`),class:`mb-4`},{default:j(()=>[H(O(i.value),1)]),_:1},8,[`title`])):U(``,!0),f.value===null&&i.value===null?(L(),z(_H,{key:1,tone:`info`,class:`mb-4`},{default:j(()=>[H(O(A(Y)(`proxy.view.reading`)),1)]),_:1})):U(``,!0),f.value===null?U(``,!0):(L(),R(`div`,yZ,[V(gX,{view:f.value,busy:s.value,onAct:ee},null,8,[`view`,`busy`]),a.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(a.value),1)]),_:1})):U(``,!0),V(DX,{form:c.value,"onUpdate:form":t[0]||=e=>c.value=e,"engine-path":m.value,"email-host":g.value,"dns-accounts":f.value?.dnsAccounts??[]},null,8,[`form`,`engine-path`,`email-host`,`dns-accounts`]),V(fZ,{routes:l.value,views:f.value.routes,workspaces:h.value,"http-port":f.value.config.httpPort,"https-port":f.value.config.httpsPort,disabled:o.value,onAdd:ae,onEdit:oe,onRemove:ce,onRetry:le,onToggle:E},null,8,[`routes`,`views`,`workspaces`,`http-port`,`https-port`,`disabled`]),V(FY,{certificates:f.value.certificates,disabled:o.value,onChanged:ue},null,8,[`certificates`,`disabled`])]))]),f.value===null?U(``,!0):(L(),R(`div`,bZ,[B(`div`,xZ,[B(`div`,SZ,[B(`p`,CZ,[v.value>0?(L(),R(I,{key:0},[B(`span`,wZ,O(v.value),1),H(` `+O(A(_F)(`proxy.view.fieldChanged`,v.value)),1)],64)):(L(),R(I,{key:1},[H(O(A(Y)(`proxy.view.noChanges`)),1)],64))]),b.value.length>0?(L(),R(`p`,TZ,O(b.value.join(` · `)),1)):te.value?(L(),R(`p`,EZ,O(te.value),1)):ne.value?(L(),R(`p`,DZ,O(ne.value),1)):U(``,!0)]),B(`div`,OZ,[V($,{variant:`ghost`,disabled:v.value===0||o.value,onClick:ie},{default:j(()=>[H(O(A(Y)(`proxy.view.discard`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:v.value===0||b.value.length>0,loading:o.value,onClick:re},{default:j(()=>[H(O(A(Y)(`proxy.view.save`)),1)]),_:1},8,[`disabled`,`loading`])])])])),V(MX,{open:u.value,"onUpdate:open":t[1]||=e=>u.value=e,draft:d.value,others:l.value.filter(e=>e.key!==d.value?.key),workspaces:h.value,"dns-accounts":f.value?.dnsAccounts??[],onSave:se},null,8,[`open`,`draft`,`others`,`workspaces`,`dns-accounts`])]))}}),AZ={class:`mb-4 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},jZ={class:`min-w-0`},MZ={class:`text-sm font-semibold text-ink`},NZ={class:`mt-0.5 text-2xs leading-4 text-muted`},PZ={class:`flex items-center gap-2`},FZ={class:`font-mono tabular-nums`},IZ={key:1,class:`text-2xs text-faint`},LZ={class:`flex flex-col gap-3`},RZ={key:0,class:`mt-3 rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},zZ={class:`mt-4 flex items-center justify-end gap-2 border-t border-line pt-3.5`},BZ={class:`max-h-[60dvh] overflow-auto`},VZ={key:0,class:`divide-y divide-line-soft`},HZ={class:`font-mono text-xs text-ink`},UZ={class:`ml-auto font-mono text-xs text-muted line-through`},WZ={class:`font-mono text-xs text-accent`},GZ={key:1,class:`text-xs text-muted`},KZ=N({__name:`ServerConfigEditor`,props:{serverId:{},workspaceId:{},config:{}},emits:[`saved`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=[`restart`,`health`,`stop`],a=XN(),o=k(!1),s=k(null);function c(e){return e>0?Math.round(e/1024/1024):null}function l(e){return{label:e.label??``,command:e.command,cwd:e.cwd,args:e.args.join(`
42
+ {port}`},null,8,[`modelValue`,`label`,`hint`]),V(gz,{title:A(Y)(`addServer.portLifecycle`),columns:2,dense:``},{default:j(()=>[V(Dz,{modelValue:d.port,"onUpdate:modelValue":t[5]||=e=>d.port=e,label:A(Y)(`common.port`),nullable:``,min:1,max:65535,error:f.value,hint:A(Y)(`serverForm.portHint`)},null,8,[`modelValue`,`label`,`error`,`hint`]),V(Nz,{modelValue:d.bind,"onUpdate:modelValue":t[6]||=e=>d.bind=e,label:A(Y)(`serverForm.bindAddress`),options:[{value:`local`,label:A(Y)(`bind.local`)},{value:`lan`,label:A(Y)(`bind.lan`)}],hint:A(Y)(`addServer.bindHint`)},null,8,[`modelValue`,`label`,`options`,`hint`]),V(Vz,{modelValue:d.autostart,"onUpdate:modelValue":t[7]||=e=>d.autostart=e,label:A(Y)(`serverForm.autostart`),hint:A(Y)(`serverForm.autostartHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:d.persistent,"onUpdate:modelValue":t[8]||=e=>d.persistent=e,label:A(Y)(`serverForm.persistent`),hint:A(Y)(`serverForm.persistentHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(Jz,{title:A(Y)(`addServer.advanced`),hint:A(Y)(`addServer.advancedHint`)},{default:j(()=>[V(gz,{title:A(Y)(`common.environment`),columns:2,dense:``},{default:j(()=>[V(rB,{modelValue:d.env,"onUpdate:modelValue":t[9]||=e=>d.env=e,label:A(Y)(`common.environment`),rows:3,hint:A(Y)(`serverForm.envHint`),placeholder:`NODE_ENV=production`},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:d.dataEnvs,"onUpdate:modelValue":t[10]||=e=>d.dataEnvs=e,label:A(Y)(`serverForm.dataEnvs`),rows:3,hint:A(Y)(`serverForm.dataEnvsHint`),placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:d.envFile,"onUpdate:modelValue":t[11]||=e=>d.envFile=e,label:A(Y)(`serverForm.envFile`),placeholder:A(Y)(`serverForm.envFilePlaceholder`),hint:A(Y)(`serverForm.envFileHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(Rz,{modelValue:d.dependsOn,"onUpdate:modelValue":t[12]||=e=>d.dependsOn=e,label:A(Y)(`serverForm.dependsOn`),placeholder:`postgres, redis`,hint:A(Y)(`serverForm.dependsOnHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(gz,{title:A(Y)(`addServer.backups`),columns:2,dense:``},{default:j(()=>[V(rB,{modelValue:d.backupPaths,"onUpdate:modelValue":t[13]||=e=>d.backupPaths=e,label:A(Y)(`serverForm.backupPaths`),rows:2,hint:A(Y)(`serverForm.backupPathsHint`),placeholder:`{home}/.app/uploads`},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:d.backupIgnoreGenerated,"onUpdate:modelValue":t[14]||=e=>d.backupIgnoreGenerated=e,label:A(Y)(`addServer.backupIgnore`),hint:A(Y)(`serverForm.backupIgnoreHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(Hz,{restart:d.restart,"onUpdate:restart":t[15]||=e=>d.restart=e,health:d.health,"onUpdate:health":t[16]||=e=>d.health=e,stop:d.stop,"onUpdate:stop":t[17]||=e=>d.stop=e},null,8,[`restart`,`health`,`stop`]),V(gz,{title:A(Y)(`serverForm.bootstrap`),description:A(Y)(`addServer.bootstrapDescription`),columns:2,dense:``},{default:j(()=>[V(Vz,{modelValue:d.bootstrapEnabled,"onUpdate:modelValue":t[18]||=e=>d.bootstrapEnabled=e,label:A(Y)(`serverForm.runBootstrap`),hint:A(Y)(`addServer.bootstrapHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),d.bootstrapEnabled?(L(),R(I,{key:0},[V(Rz,{modelValue:d.bootstrapCommand,"onUpdate:modelValue":t[19]||=e=>d.bootstrapCommand=e,label:A(Y)(`common.command`),placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:d.bootstrapTimeoutMs,"onUpdate:modelValue":t[20]||=e=>d.bootstrapTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:d.bootstrapRunOnce,"onUpdate:modelValue":t[21]||=e=>d.bootstrapRunOnce=e,label:A(Y)(`serverForm.runOnce`),hint:A(Y)(`serverForm.runOnceHint`)},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:d.bootstrapArgs,"onUpdate:modelValue":t[22]||=e=>d.bootstrapArgs=e,label:A(Y)(`serverForm.bootstrapArgs`),rows:2,hint:A(Y)(`serverForm.bootstrapArgsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:d.bootstrapEnv,"onUpdate:modelValue":t[23]||=e=>d.bootstrapEnv=e,label:A(Y)(`serverForm.bootstrapEnv`),rows:2,hint:A(Y)(`serverForm.bootstrapEnvHint`)},null,8,[`modelValue`,`label`,`hint`])],64)):U(``,!0)]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`addServer.policyResources`),columns:2,dense:``},{default:j(()=>[V(Nz,{modelValue:d.onPortConflict,"onUpdate:modelValue":t[24]||=e=>d.onPortConflict=e,label:A(Y)(`serverForm.onPortConflict`),options:[{value:`block`,label:A(Y)(`onPortConflict.block`)},{value:`warn`,label:A(Y)(`onPortConflict.warn`)},{value:`follow`,label:A(Y)(`onPortConflict.follow`)},{value:`reclaim`,label:A(Y)(`onPortConflict.reclaim`)},{value:`kill`,label:A(Y)(`onPortConflict.kill`)}]},null,8,[`modelValue`,`label`,`options`]),V(Dz,{modelValue:d.logBufferLines,"onUpdate:modelValue":t[25]||=e=>d.logBufferLines=e,label:A(Y)(`serverForm.logBufferLines`),min:50,max:1e5,step:50,hint:A(Y)(`addServer.logBufferHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:d.maxRssMb,"onUpdate:modelValue":t[26]||=e=>d.maxRssMb=e,label:A(Y)(`serverForm.maxRssMb`),min:0,hint:A(Y)(`serverForm.maxRssHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:d.enabled,"onUpdate:modelValue":t[27]||=e=>d.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`serverForm.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),B(`p`,aB,[V(iB,{k:`addServer.inheritNote`},{settings:j(()=>[B(`span`,oB,O(A(Y)(`addServer.serverDefaults`)),1)]),_:1})])]),_:1},8,[`title`,`hint`]),B(`div`,sB,[B(`p`,cB,O(A(Y)(`addServer.placeholdersTitle`)),1),B(`div`,lB,[(L(),R(I,null,P(c,e=>B(`code`,{key:e,class:`rounded-control border border-line bg-raise px-1.5 py-0.5 font-mono text-2xs text-ink`},O(e),1)),64))])]),s.value?(L(),R(`p`,uB,O(s.value),1)):U(``,!0)],32)]),_:1},8,[`open`,`title`,`description`]))}});function fB(e){let t=e.trim().toLowerCase();return t===`localhost`||t===`::1`||t===`[::1]`||t.endsWith(`.localhost`)?!0:/^127(?:\.\d{1,3}){3}$/.test(t)}function pB(e,t){let{url:n,bindHost:r}=e,i=t.trim();if(n===null||r.trim()!==`0.0.0.0`||i===``||fB(i))return n;try{let e=new URL(n),t=i.includes(`:`)&&!i.startsWith(`[`)?`[${i}]`:i,r=e.port.length>0?`:${e.port}`:``,a=e.pathname===`/`?``:e.pathname;return`${e.protocol}//${t}${r}${a}${e.search}${e.hash}`}catch{return n}}function mB(){return globalThis.location?.hostname??``}var hB={class:`text-xs font-semibold text-ink`},gB={class:`mt-1 text-2xs leading-4 text-muted`},_B={class:`mt-2.5 flex justify-end gap-1.5`},vB=N({__name:`KillPortButton`,props:{port:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(Wh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[V($,{variant:`danger-ghost`,size:`xs`,loading:n.busy},{default:j(()=>[H(O(A(Y)(`killPort.trigger`,{port:n.port})),1)]),_:1},8,[`loading`])]),_:1}),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`start`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,hB,O(A(Y)(`killPort.title`,{port:n.port})),1),B(`p`,gB,O(A(Y)(`killPort.body`)),1),B(`div`,_B,[V(A(Gh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`danger`,loading:n.busy,onClick:a},{default:j(()=>[H(O(A(Y)(`killPort.confirm`)),1)]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),yB=[`viewBox`],bB=[`id`],xB=[`stop-color`],SB=[`stop-color`],CB=[`d`,`fill`],wB=[`d`,`stroke`,`stroke-width`],TB=[`x1`,`x2`,`y2`,`stroke`],EB=[`cx`,`cy`,`fill`],DB={key:0,class:`absolute inset-x-0 top-1/2 border-t border-dashed border-line`},OB=100,kB=N({__name:`Sparkline`,props:za({values:{},height:{default:34},max:{default:null},min:{default:null},fill:{type:Boolean,default:!0},strokeWidth:{default:1.5},color:{default:void 0},class:{default:void 0},interactive:{type:Boolean,default:!1}},{hoverIndex:{default:null},hoverIndexModifiers:{}}),emits:[`update:hoverIndex`],setup(e){let t=e,n=so(e,`hoverIndex`),r=ui(),i=k(null),a=W(()=>{let e=t.values.filter(e=>e!==null&&Number.isFinite(e)),n=t.max??(e.length>0?Math.max(...e):1),r=t.min??0;return{bottom:r,ceiling:n===r?r+1:n}}),o=W(()=>{let e=t.values,{bottom:n,ceiling:r}=a.value,i=r-n,o=e.length>1?OB/(e.length-1):OB,s=e=>t.height-(e-n)/i*t.height,c=[],l=[],u=()=>{if(l.length===0)return;let e=l.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(2)} ${e.y.toFixed(2)}`).join(` `),n=l[0],r=`${e} L${l[l.length-1].x.toFixed(2)} ${t.height} L${n.x.toFixed(2)} ${t.height} Z`;c.push({line:e,area:r}),l=[]};return e.forEach((e,t)=>{if(e===null||!Number.isFinite(e)){u();return}l.push({x:t*o,y:s(e)})}),u(),c}),s=W(()=>n.value===null||t.values.length<2?null:n.value/(t.values.length-1)*OB),c=W(()=>{let e=n.value;if(e===null)return null;let r=t.values[e];if(r==null||!Number.isFinite(r))return null;let{bottom:i,ceiling:o}=a.value;return t.height-(r-i)/(o-i)*t.height});function l(e){if(!t.interactive||!i.value||t.values.length===0)return;let r=i.value.getBoundingClientRect();if(r.width===0)return;let a=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));n.value=Math.round(a*(t.values.length-1))}function u(){n.value=null}return(e,n)=>(L(),R(`div`,{ref_key:`track`,ref:i,class:D(A(Q)(`relative w-full`,t.class)),style:_e({height:`${t.height}px`}),onMousemove:l,onMouseleave:u},[(L(),R(`svg`,{viewBox:`0 0 ${OB} ${t.height}`,preserveAspectRatio:`none`,class:`block size-full overflow-visible`,role:`img`,"aria-hidden":`true`},[B(`defs`,null,[B(`linearGradient`,{id:A(r),x1:`0`,y1:`0`,x2:`0`,y2:`1`},[B(`stop`,{offset:`0%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0.26`},null,8,xB),B(`stop`,{offset:`100%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0`},null,8,SB)],8,bB)]),(L(!0),R(I,null,P(o.value,(e,n)=>(L(),R(I,{key:n},[t.fill?(L(),R(`path`,{key:0,d:e.area,fill:`url(#${A(r)})`,stroke:`none`},null,8,CB)):U(``,!0),B(`path`,{d:e.line,fill:`none`,stroke:t.color??`currentColor`,"stroke-width":t.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`},null,8,wB)],64))),128)),s.value===null?U(``,!0):(L(),R(`line`,{key:0,x1:s.value,x2:s.value,y1:`0`,y2:t.height,stroke:t.color??`currentColor`,"stroke-width":`1`,"stroke-dasharray":`2 2`,"vector-effect":`non-scaling-stroke`,opacity:`0.5`},null,8,TB)),s.value!==null&&c.value!==null?(L(),R(`circle`,{key:1,cx:s.value,cy:c.value,r:`2`,fill:t.color??`currentColor`,"vector-effect":`non-scaling-stroke`},null,8,EB)):U(``,!0)],8,yB)),o.value.length===0?(L(),R(`div`,DB)):U(``,!0)],38))}}),AB={class:`min-w-0`},jB={class:`flex items-baseline justify-between gap-2`},MB={class:`truncate text-2xs font-medium text-faint`},NB={class:`flex shrink-0 items-baseline gap-1.5`},PB={key:0,class:`font-mono text-2xs text-faint`},FB=N({__name:`MetricSpark`,props:{label:{},values:{},format:{},max:{default:null},colorClass:{default:`text-accent`},height:{default:30},sampleMs:{default:5e3},emptyHint:{default:void 0}},setup(e){let t=e,n=k(null),r=W(()=>wN(t.values)),i=W(()=>t.values.some(e=>e!==null)),a=W(()=>{let e=n.value;return e!==null&&t.values[e]!==void 0?t.values[e]??null:r.value}),o=W(()=>{let e=n.value;if(e===null)return null;let r=t.values.length-1-e;if(r<=0)return null;let i=Math.round(r*t.sampleMs/1e3);return i<60?`−${i}s`:`−${Math.round(i/60)}m`});return(e,r)=>(L(),R(`div`,AB,[B(`div`,jB,[B(`span`,MB,O(t.label),1),B(`span`,NB,[o.value?(L(),R(`span`,PB,O(o.value),1)):U(``,!0),B(`span`,{class:D(A(Q)(`font-mono text-xs font-medium tabular-nums`,i.value?`text-ink`:`text-faint`))},O(i.value?t.format(a.value):t.emptyHint??A(Y)(`metric.emptyHint`)),3)])]),V(kB,{"hover-index":n.value,"onUpdate:hoverIndex":r[0]||=e=>n.value=e,values:t.values,height:t.height,max:t.max,interactive:``,class:D(A(Q)(`mt-1`,t.colorClass))},null,8,[`hover-index`,`values`,`height`,`max`,`class`])]))}}),IB={class:`inline-flex flex-wrap items-center gap-1.5`},LB={class:`relative flex size-1.5`},RB={key:0,class:`absolute inset-0 rounded-full bg-current opacity-60`,style:{animation:`hh-pulse-ring 1.6s ease-out infinite`}},zB=N({__name:`StatusPill`,props:{status:{},health:{default:null},showHealth:{type:Boolean,default:!0}},setup(e){let t=e,n=W(()=>qI[t.status]),r=W(()=>t.health?JI[t.health]:null),i=W(()=>t.showHealth&&r.value!==null&&t.health!==`disabled`&&t.health!==`unknown`&&(r.value.tone===`danger`||r.value.tone===`warn`)),a=W(()=>n.value.transitional);return(e,t)=>(L(),R(`span`,IB,[B(`span`,{class:D(A(Q)(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium`,A(XI)[n.value.tone]))},[B(`span`,LB,[a.value?(L(),R(`span`,RB)):U(``,!0),B(`span`,{class:D(A(Q)(`relative size-1.5 rounded-full`,A(ZI)[n.value.tone]))},null,2)]),H(` `+O(A(Y)(n.value.labelKey)),1)],2),i.value&&r.value?(L(),R(`span`,{key:0,class:D(A(Q)(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium`,A(XI)[r.value.tone]))},O(A(Y)(r.value.labelKey)),3)):U(``,!0)]))}}),BB=N({__name:`Tip`,props:{label:{},side:{default:`top`},disabled:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),z(A(gg),{"delay-duration":350},{default:j(()=>[V(A(xg),{"as-child":``},{default:j(()=>[F(t.$slots,`default`)]),_:3}),e.disabled?U(``,!0):(L(),z(A(bg),{key:0},{default:j(()=>[V(A(yg),{side:e.side,"side-offset":6,class:`z-50 max-w-64 rounded-control border border-line bg-raise px-2 py-1 text-2xs text-ink shadow-float data-[state=delayed-open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[H(O(e.label),1)]),_:1},8,[`side`])]),_:1}))]),_:3}))}}),VB={class:`flex items-start justify-between gap-3 px-4 pb-2.5 pt-3.5`},HB={class:`min-w-0`},UB={class:`flex items-center gap-2`},WB=[`href`,`title`,`aria-label`],GB={class:`mt-0.5 flex items-center gap-1.5 truncate font-mono text-2xs text-faint`},KB={class:`text-muted`},qB={key:1,class:`rounded bg-hover px-1 py-px text-muted`},JB={key:2,class:`rounded bg-accent-soft px-1 py-px text-accent`},YB={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},XB={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},ZB=[`title`],QB={key:0,class:`space-y-2.5 border-y border-line-soft px-4 py-3`},$B={class:`grid grid-cols-2 gap-x-4 gap-y-2`},eV={key:1,class:`flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pt-2.5`},tV={class:`text-muted`},nV={class:`text-faint`},rV={key:2,class:`flex flex-col gap-1 px-4 pt-2.5`},iV={key:0,class:`flex items-start gap-1.5 text-2xs leading-4 text-danger`},aV={class:`min-w-0 break-words`},oV={key:2,class:`text-2xs leading-4 text-warn`},sV={key:3,class:`text-2xs leading-4 text-warn`},cV={class:`grid grid-cols-2 gap-x-4 gap-y-1 px-4 py-3 sm:grid-cols-4`},lV={class:`truncate text-2xs text-faint`},uV={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},dV={class:`mt-auto flex items-center gap-1.5 border-t border-line-soft px-4 py-2.5`},fV={class:`grid grid-cols-2 gap-2 text-xs`},pV={class:`font-mono text-ink`},mV={class:`text-faint`},hV={class:`text-ink capitalize`},gV=N({__name:`ServerCard`,props:{server:{},workspaceId:{},series:{},now:{},variant:{default:`default`}},setup(e){let t=e,n={start:_y,exit:jy,crash:Vv,"forced-restart":Sy,unhealthy:Ly,recovered:Hv},r=XN(),i=dP(),a=k(!1),o=k(!1),s=W(()=>t.server.config),c=W(()=>s.value.label&&s.value.label.length>0?s.value.label:t.server.id),l=W(()=>`${s.value.command} ${s.value.args.join(` `)}`.trim()),u=W(()=>QI(t.server.status,t.server.health)),d=W(()=>pB(t.server,mB())),f=W(()=>t.server.status===`running`),p=W(()=>s.value.enabled&&[`stopped`,`crashed`,`conflict`].includes(t.server.status)),m=W(()=>[`running`,`starting`,`backoff`].includes(t.server.status)),h=W(()=>t.server.startedAt===null||!f.value?`—`:jL(t.now-t.server.startedAt)),g=W(()=>t.server.nextRetryAt===null?null:ML(t.server.nextRetryAt,t.now)),_=W(()=>t.server.unhealthySince===null?null:jL(t.now-t.server.unhealthySince)),v=W(()=>t.series?.cpu??[]),y=W(()=>t.series?.rss??[]),b=W(()=>t.series?.probe??[]),x=W(()=>[...t.server.history.events].slice(-3).reverse()),S={unknown:`common.unknown`,free:`serverCard.portFree`,"in-use":`serverCard.portInUse`},C=W(()=>{let e=t.server,n=[{key:`pid`,label:Y(`serverCard.pid`),value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:Y(`common.uptime`),value:h.value},{key:`restarts`,label:Y(`serverCard.restarts`),value:`${e.restarts}/${e.maxRetries}`},{key:`port`,label:Y(`common.port`),value:Y(S[e.portState]??`common.unknown`)},{key:`uptime24`,label:Y(`serverCard.uptime24h`),value:_L(e.history.uptimeRatio)},{key:`probe`,label:Y(`serverCard.probe`),value:e.responseMs===null?`—`:`${e.responseMs} ms`},{key:`rss`,label:Y(`serverCard.rss`),value:LL(e.resources?.rssBytes??null)},{key:`procs`,label:Y(`serverCard.procs`),value:e.resources?String(e.resources.processes):`—`}];return e.history.crashes>0&&n.splice(5,0,{key:`crashes`,label:Y(`serverCard.crashes24h`),value:String(e.history.crashes)}),e.history.lastCrashAt!==null&&n.push({key:`lastcrash`,label:Y(`serverCard.lastCrash`),value:NL(e.history.lastCrashAt,t.now)}),n});async function w(e){a.value=!0;try{await r[e](t.workspaceId,t.server.id)}finally{a.value=!1}}async function T(){a.value=!0;try{await r.freePort(t.workspaceId,t.server.id)}finally{a.value=!1}}async function ee(e){let n=!(e===`enabled`?s.value.enabled:s.value.autostart);e===`enabled`?await r.setEnabled(t.workspaceId,t.server.id,n):await r.setAutostart(t.workspaceId,t.server.id,n)}async function te(){o.value=!1,await r.remove(t.workspaceId,t.server.id)}function ne(){i.select(t.workspaceId)}return(i,f)=>{let h=pa(`RouterLink`);return L(),R(`article`,{class:D(A(Q)(`group relative flex flex-col rounded-panel border bg-panel shadow-card transition-colors duration-150`,`hover:border-line/90`,t.server.status===`crashed`||t.server.status===`conflict`?`border-danger/30`:`border-line`,!s.value.enabled&&`opacity-70`))},[B(`span`,{class:D(A(Q)(`absolute inset-y-3 left-0 w-0.5 rounded-full`,{"bg-ok":u.value===`ok`,"bg-warn":u.value===`warn`,"bg-danger":u.value===`danger`,"bg-faint/50":u.value===`neutral`,"bg-accent":u.value===`accent`||u.value===`info`}))},null,2),B(`header`,VB,[B(`div`,HB,[B(`div`,UB,[V(h,{to:`/servers/${e.server.id}`,class:`truncate text-sm font-semibold tracking-tight text-ink hover:text-accent`,onClick:ne},{default:j(()=>[H(O(c.value),1)]),_:1},8,[`to`]),d.value?(L(),R(`a`,{key:0,href:d.value,target:`_blank`,rel:`noreferrer`,class:`shrink-0 text-faint transition-colors duration-150 hover:text-accent`,title:d.value,"aria-label":A(Y)(`serverCard.open`,{url:d.value})},[V(A(Zv),{class:`size-3.5`})],8,WB)):U(``,!0)]),B(`p`,GB,[B(`span`,null,O(e.server.id),1),s.value.port===null?U(``,!0):(L(),R(I,{key:0},[f[9]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,KB,`:`+O(s.value.port),1)],64)),f[10]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,null,O(e.server.bindHost),1),s.value.enabled?U(``,!0):(L(),R(`span`,qB,O(A(Y)(`serverCard.disabled`)),1)),s.value.autostart?(L(),R(`span`,JB,O(A(Y)(`serverCard.autostart`)),1)):U(``,!0)])]),V(zB,{status:e.server.status,health:e.server.health},null,8,[`status`,`health`]),e.server.adopted?(L(),z(BB,{key:0,label:A(Y)(`serverCard.adoptedHint`)},{default:j(()=>[B(`span`,YB,O(A(Y)(`serverCard.detached`)),1)]),_:1},8,[`label`])):U(``,!0),s.value.persistent?(L(),z(BB,{key:1,label:A(Y)(`serverCard.persistentHint`)},{default:j(()=>[B(`span`,XB,O(A(Y)(`serverCard.persistent`)),1)]),_:1},8,[`label`])):U(``,!0)]),B(`p`,{class:`truncate px-4 pb-3 font-mono text-2xs text-muted`,title:l.value},O(l.value),9,ZB),t.variant===`compact`?U(``,!0):(L(),R(`div`,QB,[B(`div`,$B,[V(FB,{label:A(Y)(`common.cpu`),values:v.value,format:A(RL),max:100,"color-class":`text-cpu`},null,8,[`label`,`values`,`format`]),V(FB,{label:A(Y)(`common.memory`),values:y.value,format:A(LL),"color-class":`text-mem`},null,8,[`label`,`values`,`format`])]),V(FB,{label:A(Y)(`serverCard.healthProbe`),values:b.value,format:e=>e===null?`—`:`${e} ms`,height:22,"color-class":`text-probe`,"empty-hint":A(Y)(`serverCard.notProbed`)},null,8,[`label`,`values`,`format`,`empty-hint`])])),x.value.length>0?(L(),R(`div`,eV,[(L(!0),R(I,null,P(x.value,e=>(L(),R(`span`,{key:`${e.ts}`,class:`inline-flex items-center gap-1 text-2xs`},[(L(),z(ha(n[e.type]),{class:D(A(Q)(`size-3`,A(YI)[A(eL)[e.type]]))},null,8,[`class`])),B(`span`,tV,O(A(Y)(A($I)[e.type])),1),B(`span`,nV,O(A(NL)(e.ts,t.now)),1)]))),128))])):U(``,!0),e.server.lastError||_.value||g.value?(L(),R(`div`,rV,[e.server.lastError?(L(),R(`p`,iV,[V(A(Vv),{class:`mt-0.5 size-3 shrink-0`}),B(`span`,aV,O(e.server.lastError),1)])):U(``,!0),e.server.status===`conflict`&&s.value.port!==null?(L(),z(vB,{key:1,port:s.value.port,busy:a.value,class:`self-start`,onConfirm:T},null,8,[`port`,`busy`])):U(``,!0),_.value?(L(),R(`p`,oV,O(A(Y)(`serverCard.unhealthyFor`,{duration:_.value})),1)):U(``,!0),g.value?(L(),R(`p`,sV,O(A(Y)(`serverCard.nextAttempt`,{when:g.value})),1)):U(``,!0)])):U(``,!0),B(`dl`,cV,[(L(!0),R(I,null,P(C.value,e=>(L(),R(`div`,{key:e.key,class:`min-w-0`},[B(`dt`,lV,O(e.label),1),B(`dd`,uV,O(e.value),1)]))),128))]),B(`div`,dV,[V($,{variant:`primary`,size:`xs`,disabled:a.value||!p.value,onClick:f[0]||=e=>w(`start`)},{default:j(()=>[V(A(_y),{class:`size-3`}),H(O(A(Y)(`serverCard.start`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,disabled:a.value||!m.value,onClick:f[1]||=e=>w(`stop`)},{default:j(()=>[V(A(jy),{class:`size-3`}),H(O(A(Y)(`serverCard.stop`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,disabled:a.value||!s.value.enabled,onClick:f[2]||=e=>w(`restart`)},{default:j(()=>[V(A(Sy),{class:`size-3`}),H(O(A(Y)(`serverCard.restart`)),1)]),_:1},8,[`disabled`]),V(BB,{label:A(Y)(`serverCard.detailsHint`)},{default:j(()=>[V(h,{to:`/servers/${e.server.id}`,onClick:ne},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[V(A(Cy),{class:`size-3`}),H(O(A(Y)(`common.details`)),1)]),_:1})]),_:1},8,[`to`])]),_:1},8,[`label`]),V(A(eg),null,{default:j(()=>[V(A(ag),{"as-child":``},{default:j(()=>[V($,{size:`icon-sm`,variant:`ghost`,class:`ml-auto`,"aria-label":A(Y)(`serverCard.moreActions`,{label:c.value})},{default:j(()=>[V(A(Xv),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),V(A(rg),null,{default:j(()=>[V(A(tg),{"side-offset":4,align:`end`,class:`z-50 min-w-52 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[3]||=e=>ee(`enabled`)},{default:j(()=>[V(A(yy),{class:`size-3.5`}),H(` `+O(s.value.enabled?A(Y)(`serverCard.disable`):A(Y)(`serverCard.enable`)),1)]),_:1}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[4]||=e=>ee(`autostart`)},{default:j(()=>[V(A(_y),{class:`size-3.5`}),H(` `+O(s.value.autostart?A(Y)(`serverCard.removeFromAutostart`):A(Y)(`serverCard.autostartWithPanel`)),1)]),_:1}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:f[5]||=t=>A(r).clearLogs(e.workspaceId,e.server.id)},{default:j(()=>[V(A(Cy),{class:`size-3.5`}),H(` `+O(A(Y)(`serverCard.clearLogBuffer`)),1)]),_:1}),V(A(ig),{class:`my-1 h-px bg-line`}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:f[6]||=e=>o.value=!0},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(` `+O(A(Y)(`serverCard.removeServer`)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),V($z,{open:o.value,"onUpdate:open":f[8]||=e=>o.value=e,title:A(Y)(`serverCard.removeTitle`),description:A(Y)(`serverCard.removeDescription`,{label:c.value}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:f[7]||=e=>o.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:te},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(O(A(Y)(`common.remove`)),1)]),_:1})]),default:j(()=>[B(`dl`,fV,[B(`div`,null,[f[11]||=B(`dt`,{class:`text-faint`},` id `,-1),B(`dd`,pV,O(e.server.id),1)]),B(`div`,null,[B(`dt`,mV,O(A(Y)(`serverCard.statusField`)),1),B(`dd`,hV,O(e.server.status),1)])])]),_:1},8,[`open`,`title`,`description`])],2)}}}),_V={class:`flex flex-wrap items-start justify-between gap-3`},vV={class:`min-w-0`},yV={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},bV={class:`text-2xl font-semibold tracking-tight text-ink`},xV={key:1,class:`mt-1 max-w-2xl text-xs leading-relaxed text-muted`},SV={class:`flex shrink-0 flex-wrap items-center gap-2`},CV=N({__name:`PageHeader`,props:{title:{},description:{default:void 0},backTo:{default:void 0},backLabel:{default:`Back`}},setup(e){return(e,t)=>{let n=pa(`RouterLink`);return L(),R(`header`,_V,[B(`div`,vV,[e.$props.backTo?(L(),z(n,{key:0,to:e.$props.backTo,class:`mb-1 inline-flex items-center gap-1 text-2xs text-muted transition-colors duration-150 hover:text-ink`},{default:j(()=>[V(A(Lv),{class:`size-3`}),H(` `+O(e.$props.backLabel),1)]),_:1},8,[`to`])):U(``,!0),B(`div`,yV,[B(`h1`,bV,O(e.$props.title),1),F(e.$slots,`badges`)]),e.$props.description?(L(),R(`p`,xV,O(e.$props.description),1)):U(``,!0)]),B(`div`,SV,[F(e.$slots,`actions`)])])}}}),wV={key:0,class:`mb-3 flex items-start justify-between gap-3`},TV={class:`min-w-0`},EV={class:`flex shrink-0 items-center gap-1.5`},DV=N({__name:`Panel`,props:{padded:{type:Boolean,default:!0},class:{}},setup(e){return(e,t)=>(L(),R(`section`,{class:D(A(Q)(`rounded-panel border border-line bg-panel shadow-card`,e.$props.padded&&`p-4`,e.$props.class))},[e.$slots.header||e.$slots.actions?(L(),R(`header`,wV,[B(`div`,TV,[F(e.$slots,`header`)]),B(`div`,EV,[F(e.$slots,`actions`)])])):U(``,!0),F(e.$slots,`default`)],2))}}),OV=N({__name:`Skeleton`,props:{class:{default:`h-4 w-24`},rounded:{default:`rounded`}},setup(e){return(t,n)=>(L(),R(`span`,{class:D(A(Q)(`block animate-pulse bg-line-soft`,e.rounded,t.$props.class)),style:{"animation-duration":`1.4s`},"aria-hidden":`true`},null,2))}}),kV={class:`min-w-0`},AV={class:`truncate text-2xs font-medium text-faint`},jV={key:0,class:`mt-0.5 truncate text-2xs text-muted`},MV=N({__name:`StatTile`,props:{label:{},value:{},hint:{default:void 0},tone:{default:`neutral`},mono:{type:Boolean,default:!0}},setup(e){return(e,t)=>(L(),R(`div`,kV,[B(`p`,AV,O(e.$props.label),1),B(`p`,{class:D(A(Q)(`mt-0.5 truncate text-xl font-semibold tracking-tight`,e.$props.mono&&`font-mono tabular-nums`,e.$props.tone===`neutral`?`text-ink`:A(YI)[e.$props.tone]))},O(e.$props.value),3),e.$props.hint?(L(),R(`p`,jV,O(e.$props.hint),1)):U(``,!0)]))}}),NV=k(null),PV=k(`unknown`),FV=null;async function IV(){try{let e=await(await fetch(`/healthz`,{cache:`no-store`})).json();typeof e.uptimeMs==`number`&&(NV.value=Date.now()-e.uptimeMs),PV.value=e.status===`degraded`?`degraded`:`ok`}catch{PV.value=`unknown`}}function LV(){return FV??=IV().finally(()=>{FV=null}),{startedAt:NV,status:PV,refresh:IV}}var RV={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},zV={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},BV={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},VV={class:`p-4`},HV={class:`p-4`},UV={class:`p-4`},WV={class:`p-4`},GV={class:`p-4`},KV={key:0,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},qV={class:`min-w-0`},JV={class:`text-xs font-medium text-danger`},YV={class:`mt-0.5 flex flex-wrap gap-x-3 gap-y-1 text-2xs text-danger`},XV=[`onClick`],ZV={class:`grid gap-4 lg:grid-cols-3`},QV={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},$V={class:`text-2xs text-muted`},eH={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},tH={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},nH={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},rH={class:`font-mono text-2xs font-normal text-faint`},iH={class:`text-2xs text-muted`},aH={class:`ml-auto flex items-center gap-1.5`},oH={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-3 py-2 text-2xs leading-4 text-danger`},sH={key:2,class:`grid gap-4 lg:grid-cols-2`},cH={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},lH={class:`font-mono`},uH=N({__name:`GlobalOverviewView`,setup(e){let t=XN(),n=dP(),r=LV(),i=Rg(),a=k(!1),o=k(``),s=W(()=>t.appState.value===null),c=W(()=>t.workspaces.value),l=W(()=>t.allServers.value.map(e=>e.server)),u=W(()=>l.value.filter(e=>e.status===`running`)),d=W(()=>l.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),f=W(()=>t.host.value),p=W(()=>r.startedAt.value===null?`—`:jL(t.now.value-r.startedAt.value)),m=W(()=>f.value?.enabled?jL(f.value.uptimeMs):`—`);function h(e){o.value=e,a.value=!0}function g(e,t){n.select(e),i.push(d1(e,`servers`,t))}return na(async()=>{await r.refresh()}),(e,_)=>(L(),R(`div`,RV,[V(CV,{title:A(Y)(`nav.globalOverview`),description:A(Y)(`views.globalOverview.description`)},null,8,[`title`,`description`]),V(DV,{class:`p-0`},{default:j(()=>[s.value?(L(),R(`div`,zV,[(L(),R(I,null,P(5,e=>B(`div`,{key:e,class:`space-y-2`},[V(OV,{class:`h-2.5 w-16`}),V(OV,{class:`h-6 w-20`})])),64))])):(L(),R(`div`,BV,[B(`div`,VV,[V(MV,{label:A(Y)(`views.globalOverview.workspaces`),value:String(c.value.length),hint:A(Y)(`views.globalOverview.serversTotal`,{count:l.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,HV,[V(MV,{label:A(Y)(`views.overview.running`),value:`${u.value.length}/${l.value.length}`,tone:`ok`,hint:A(Y)(`views.overview.notUp`,{count:l.value.length-u.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,UV,[V(MV,{label:A(Y)(`views.overview.needsAttention`),value:String(d.value.length),tone:d.value.length>0?`danger`:`ok`,hint:d.value.length===0?A(Y)(`views.overview.nothingBroken`):A(Y)(`views.overview.crashedOrUnhealthy`)},null,8,[`label`,`value`,`tone`,`hint`])]),B(`div`,WV,[V(MV,{label:A(Y)(`views.globalOverview.panelUptime`),value:p.value,hint:A(r).status.value===`degraded`?A(Y)(`views.globalOverview.degraded`):A(Y)(`views.globalOverview.serving`)},null,8,[`label`,`value`,`hint`])]),B(`div`,GV,[V(MV,{label:A(Y)(`views.globalOverview.hostUptime`),value:m.value,hint:f.value?.enabled?A(Y)(`views.globalOverview.samplingOn`):A(Y)(`views.globalOverview.samplingOff`)},null,8,[`label`,`value`,`hint`])])]))]),_:1}),d.value.length>0?(L(),R(`div`,KV,[V(A(Vv),{class:`mt-0.5 size-4 shrink-0 text-danger`}),B(`div`,qV,[B(`p`,JV,O(A(_F)(`views.globalOverview.needLook`,d.value.length)),1),B(`p`,YV,[(L(!0),R(I,null,P(A(t).allServers.value.filter(e=>e.server.status===`crashed`||e.server.status===`conflict`||e.server.health===`unhealthy`),e=>(L(),R(`button`,{key:`${e.workspace.id}:${e.server.id}`,type:`button`,class:`font-mono underline decoration-danger/40 underline-offset-2 hover:decoration-danger`,onClick:t=>g(e.workspace.id,e.server.id)},O(e.workspace.label)+`/`+O(e.server.id),9,XV))),128))])])])):U(``,!0),B(`div`,ZV,[V(DV,{class:`lg:col-span-2`},{header:j(()=>[B(`h2`,QV,[V(A(Jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.globalOverview.hostVitals`)),1)]),B(`p`,$V,O(A(Y)(`views.globalOverview.hostVitalsNote`)),1)]),default:j(()=>[V(iR,{host:f.value,now:A(t).now.value},null,8,[`host`,`now`])]),_:1}),V(DV,null,{header:j(()=>[B(`h2`,eH,[V(A(jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.overview.recentActivity`)),1)])]),default:j(()=>[V(fR,{servers:l.value,now:A(t).now.value,limit:12},null,8,[`servers`,`now`])]),_:1})]),!s.value&&l.value.length===0?(L(),z(gL,{key:1,title:A(Y)(`views.globalOverview.emptyTitle`),description:A(Y)(`views.globalOverview.emptyDescription`)},{icon:j(()=>[V(A(Ty),{class:`size-4`})]),_:1},8,[`title`,`description`])):U(``,!0),(L(!0),R(I,null,P(c.value,e=>(L(),R(`section`,{key:e.id,class:`space-y-3`},[B(`div`,tH,[B(`h2`,nH,[V(A(ay),{class:`size-3.5 text-faint`}),H(` `+O(e.label)+` `,1),B(`span`,rH,O(e.id),1)]),B(`span`,iH,O(A(Y)(`views.globalOverview.groupRunning`,{running:e.runningCount,total:e.serverCount})),1),B(`div`,aH,[V($,{size:`xs`,variant:`ghost`,onClick:t=>h(e.id)},{default:j(()=>[V(A(vy),{class:`size-3`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1},8,[`onClick`]),V($,{size:`xs`,variant:`ghost`,onClick:t=>{A(n).select(e.id),A(i).push(A(d1)(e.id,`overview`))}},{default:j(()=>[H(O(A(Y)(`views.globalOverview.openWorkspace`)),1)]),_:1},8,[`onClick`])])]),e.configError?(L(),R(`p`,oH,O(A(Y)(`views.globalOverview.configError`,{error:e.configError})),1)):U(``,!0),e.servers.length===0?(L(),z(gL,{key:1,compact:``,title:A(Y)(`views.overview.emptyTitle`),description:A(Y)(`views.globalOverview.groupEmptyDescription`)},{action:j(()=>[V($,{size:`sm`,variant:`primary`,onClick:t=>h(e.id)},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1},8,[`onClick`])]),_:2},1032,[`title`,`description`])):(L(),R(`div`,sH,[(L(!0),R(I,null,P(e.servers,n=>(L(),z(gV,{key:n.id,server:n,"workspace-id":e.id,series:A(t).seriesOf(e.id,n.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]))),128)),B(`p`,cH,[B(`span`,null,O(A(Y)(`views.overview.sampling`)),1),B(`span`,lH,O(A(t).appState.value?.control.url),1)]),V(dB,{open:a.value,"onUpdate:open":_[0]||=e=>a.value=e,"workspace-id":o.value},null,8,[`open`,`workspace-id`])]))}}),dH={class:`text-xs font-semibold text-ink`},fH={key:0,class:`mt-1 text-2xs leading-4 text-muted`},pH={class:`mt-2.5 flex justify-end gap-1.5`},mH=N({__name:`ConfirmButton`,props:{label:{},confirmLabel:{default:void 0},variant:{default:`danger-ghost`},confirmVariant:{default:`danger`},size:{default:`sm`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},title:{default:void 0},hint:{default:void 0}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=W(()=>n.confirmLabel??Y(`common.confirm`)),o=W(()=>n.title??Y(`common.confirmQuestion`,{label:a.value}));function s(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(Wh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[V($,{variant:n.variant,size:n.size,disabled:n.disabled,loading:n.loading},{default:j(()=>[H(O(n.label),1)]),_:1},8,[`variant`,`size`,`disabled`,`loading`])]),_:1}),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`end`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,dH,O(o.value),1),n.hint?(L(),R(`p`,fH,O(n.hint),1)):U(``,!0),B(`div`,pH,[V(A(Gh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:n.confirmVariant,loading:n.loading,onClick:s},{default:j(()=>[H(O(a.value),1)]),_:1},8,[`variant`,`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),hH={class:`min-w-0 flex-1`},gH={key:0,class:`text-xs font-semibold`},_H=N({__name:`Notice`,props:{tone:{default:`info`},title:{default:void 0},class:{default:void 0}},setup(e){let t=e,n={ok:Hv,warn:Ly,danger:my,info:ry,neutral:ry,accent:Dy},r=W(()=>n[t.tone]);return(e,n)=>(L(),R(`div`,{class:D(A(Q)(`flex items-start gap-2 rounded-panel border px-3 py-2`,A(XI)[t.tone],t.class))},[(L(),z(ha(r.value),{class:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`})),B(`div`,hH,[t.title?(L(),R(`p`,gH,O(t.title),1)):U(``,!0),B(`div`,{class:D(A(Q)(`text-xs leading-relaxed text-ink/85`,t.title&&`mt-0.5`))},[F(e.$slots,`default`)],2)])],2))}}),vH={class:`space-y-2`},yH={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},bH=N({__name:`AuthenticationSection`,props:za({view:{},dirty:{type:Boolean}},{auth:{required:!0},authModifiers:{}}),emits:za([`reset`],[`update:auth`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`auth`),a=ZR(()=>i.value.sessionTtlMs,e=>i.value.sessionTtlMs=e,6048e5),o=ZR(()=>i.value.maxLoginAttempts,e=>i.value.maxLoginAttempts=e,5),s=ZR(()=>i.value.lockoutMs,e=>i.value.lockoutMs=e,6e4),c=W(()=>n.view?.auth.passwordSet===!0),l=W(()=>n.view?.auth.apiTokenSet===!0),u=W(()=>n.view?.auth.blockedReason??null),d=W(()=>n.view?.auth.exposed===!0),f=W(()=>n.view?.auth.usingDefaultPassword===!0),p=W(()=>i.value.enabled&&!c.value),{setPassword:m,clearPassword:h}=pN(),g=k(``),_=k(``),v=k(``),y=k(null),b=k(null),x=k(!1),S=W(()=>v.value.length>0&&v.value!==_.value),C=W(()=>_.value.length>0&&_.value.length<8),w=W(()=>_.value.length>0&&!S.value&&(!c.value||g.value.length>0));async function T(){if(w.value&&!x.value){x.value=!0,b.value=null,y.value=null;try{let e=await m(c.value?g.value:void 0,_.value);if(e!==null){b.value=e;return}g.value=``,_.value=``,v.value=``,y.value=Y(`settings.auth.passwordUpdated`)}finally{x.value=!1}}}async function ee(){b.value=null,y.value=null;let e=await h();e===null?y.value=Y(`settings.auth.passwordCleared`):b.value=e}return(e,t)=>(L(),R(I,null,[V(gz,{title:A(Y)(`settings.auth.policyTitle`),description:A(Y)(`settings.auth.policyDescription`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.auth.requirePassword`),hint:A(Y)(`settings.auth.requirePasswordHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(a),"onUpdate:modelValue":t[2]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.auth.sessionLifetime`),min:6e4,hint:A(Y)(`settings.auth.sessionLifetimeHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Nz,{modelValue:i.value.cookieSecure,"onUpdate:modelValue":t[3]||=e=>i.value.cookieSecure=e,label:A(Y)(`settings.auth.cookieSecure`),options:[{value:`auto`,label:A(Y)(`settings.auth.cookieSecureAuto`)},{value:`always`,label:A(Y)(`settings.auth.cookieSecureAlways`)},{value:`never`,label:A(Y)(`settings.auth.cookieSecureNever`)}]},null,8,[`modelValue`,`label`,`options`]),V(Nz,{modelValue:i.value.trustProxy,"onUpdate:modelValue":t[4]||=e=>i.value.trustProxy=e,label:A(Y)(`settings.auth.trustProxy`),options:[{value:`off`,label:A(Y)(`settings.auth.trustProxyOff`)},{value:`loopback`,label:A(Y)(`settings.auth.trustProxyLoopback`)},{value:`any`,label:A(Y)(`settings.auth.trustProxyAny`)}],hint:A(Y)(`settings.auth.trustProxyHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`options`,`hint`]),V(Dz,{modelValue:A(o),"onUpdate:modelValue":t[5]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.auth.maxLoginAttempts`),min:1,hint:A(Y)(`settings.auth.maxLoginAttemptsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":t[6]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.auth.lockout`),min:1e3},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`]),B(`div`,vH,[V(_H,{tone:l.value?`info`:`neutral`,title:l.value?A(Y)(`settings.auth.apiTokenSet`):A(Y)(`settings.auth.apiTokenMissing`)},{default:j(()=>[l.value?(L(),z(iB,{key:0,k:`settings.auth.apiTokenNote`},{code:j(()=>[...t[10]||=[B(`code`,null,`Authorization: Bearer …`,-1)]]),_:1})):(L(),z(iB,{key:1,k:`settings.auth.noTokenNote`},{command:j(()=>[...t[11]||=[B(`code`,null,`home-hosted set-token --generate`,-1)]]),_:1}))]),_:1},8,[`tone`,`title`]),f.value?(L(),z(_H,{key:0,tone:`warn`,title:A(Y)(`settings.auth.defaultPasswordTitle`)},{default:j(()=>[V(iB,{k:`settings.auth.defaultPasswordText`},{address:j(()=>[...t[12]||=[B(`code`,null,`127.0.0.1`,-1)]]),_:1})]),_:1},8,[`title`])):U(``,!0),u.value?(L(),z(_H,{key:1,tone:`danger`,title:A(Y)(`settings.auth.blockedTitle`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`])):p.value?(L(),z(_H,{key:2,tone:`warn`,title:A(Y)(`settings.auth.noPasswordTitle`)},{default:j(()=>[V(iB,{k:`settings.auth.noPasswordText`},{address:j(()=>[...t[13]||=[B(`code`,null,`127.0.0.1`,-1)]]),_:1})]),_:1},8,[`title`])):d.value?(L(),z(_H,{key:3,tone:`warn`,title:A(Y)(`settings.auth.exposedTitle`)},{default:j(()=>[H(O(A(Y)(`settings.auth.exposedText`)),1)]),_:1},8,[`title`])):U(``,!0)]),B(`form`,{class:`mt-3`,onSubmit:lu(T,[`prevent`])},[V(gz,{title:c.value?A(Y)(`settings.auth.changePassword`):A(Y)(`settings.auth.setPassword`),description:A(Y)(`settings.auth.passwordDescription`)},{default:j(()=>[c.value?(L(),z(Rz,{key:0,modelValue:g.value,"onUpdate:modelValue":t[7]||=e=>g.value=e,type:`password`,autocomplete:`current-password`,label:A(Y)(`settings.auth.currentPassword`)},null,8,[`modelValue`,`label`])):U(``,!0),V(Rz,{modelValue:_.value,"onUpdate:modelValue":t[8]||=e=>_.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.auth.newPassword`)},null,8,[`modelValue`,`label`]),V(Rz,{modelValue:v.value,"onUpdate:modelValue":t[9]||=e=>v.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.auth.repeatPassword`),error:S.value?A(Y)(`settings.auth.passwordMismatch`):null},null,8,[`modelValue`,`label`,`error`]),B(`div`,yH,[V($,{type:`submit`,variant:`primary`,disabled:!w.value,loading:x.value},{default:j(()=>[H(O(c.value?A(Y)(`settings.auth.updatePassword`):A(Y)(`settings.auth.setPasswordAndEnable`)),1)]),_:1},8,[`disabled`,`loading`]),c.value?(L(),z(mH,{key:0,label:A(Y)(`settings.auth.clearPassword`),"confirm-label":A(Y)(`settings.auth.clearPasswordConfirm`),"confirm-variant":`danger`,title:A(Y)(`settings.auth.clearPasswordTitle`),hint:A(Y)(`settings.auth.clearPasswordHint`),disabled:x.value,onConfirm:ee},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),C.value||b.value||y.value?(L(),R(I,{key:1},[C.value?(L(),z(_H,{key:0,tone:`warn`,title:A(Y)(`settings.auth.shortPasswordTitle`),class:`sm:col-span-2`},{default:j(()=>[H(O(A(Y)(`settings.auth.shortPasswordText`)),1)]),_:1},8,[`title`])):U(``,!0),b.value?(L(),z(_H,{key:1,tone:`danger`,class:`sm:col-span-2`},{default:j(()=>[H(O(b.value),1)]),_:1})):U(``,!0),y.value?(L(),z(_H,{key:2,tone:`ok`,class:`sm:col-span-2`},{default:j(()=>[H(O(y.value),1)]),_:1})):U(``,!0)],64)):U(``,!0)]),_:1},8,[`title`,`description`])],32)],64))}});function xH(e){return e.labelKey===void 0?e.label:Y(e.labelKey,e.labelParams,e.label)}function SH(e){return e.note===null?null:e.noteKey===void 0?e.note:Y(e.noteKey,e.noteParams,e.note)}var CH={settings:`settings.backups.kindSettings`,servers:`settings.backups.kindServers`,secrets:`settings.backups.kindSecrets`,tls:`settings.backups.kindTls`,data:`settings.backups.kindData`,workspace:`settings.backups.kindWorkspace`};function wH(e){let t=CH[e];return t===void 0?e:Y(t)}var TH={password:`settings.backup.secretPasswordHint`,apiToken:`settings.backup.secretApiTokenHint`,telegram:`settings.backup.secretTelegramHint`,ddns:`settings.backup.secretDdnsHint`};function EH(e){let t=SH(e);if(t!==null&&t.length>0)return t;if(e.kind===`settings`)return Y(`settings.backup.leafSettingsHint`);if(e.kind===`servers`)return Y(`settings.backup.leafServersHint`);if(e.kind===`secrets`){let t=e.secret===void 0?void 0:TH[e.secret];return Y(t===void 0?`settings.backup.leafSecretsHint`:t)}return e.path===void 0?Y(`settings.backup.leafDataHint`):e.origin===void 0?e.path:Y(`settings.backup.pathFromOrigin`,{path:e.path,origin:e.origin})}function DH(e){return e.leaves.length>0&&e.leaves.every(e=>e.selected)}function OH(e){let t=SH(e);return t!==null&&t.length>0?t:e.kind===`settings`?Y(`settings.backup.entrySettingsHint`):e.kind===`secrets`?Y(`settings.backup.entrySecretsHint`):e.kind===`tls`?Y(`settings.backup.entryTlsHint`):Y(`settings.backup.entryWorkspaceHint`)}function kH(e,t=[]){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return{id:e.id,label:xH(e),hint:OH(e),kind:e.kind,...e.workspaceId===void 0?{}:{workspaceId:e.workspaceId},selected:t?.selected??!0,leaves:e.items.map(e=>({id:e.id,label:xH(e),hint:EH(e),kind:e.kind,selected:t?.leaves.find(t=>t.id===e.id)?.selected??!0}))}})}function AH(e){return e.leaves.length===0?e.selected:e.selected&&e.leaves.some(e=>e.selected)}function jH(e,t){for(let n of e){n.selected=t;for(let e of n.leaves)e.selected=t}}function MH(e){let t=e.filter(e=>AH(e));if(e.length>0&&t.length===e.length&&t.every(e=>e.leaves.length===0||DH(e)))return;let n=[];for(let e of t)e.leaves.length===0||DH(e)?n.push(e.id):n.push(...e.leaves.filter(e=>e.selected).map(e=>e.id));return n}function NH(e){let t=0,n=0;for(let r of e)AH(r)&&(n+=1,t+=r.leaves.length===0?1:r.leaves.filter(e=>e.selected).length);return{entries:n,leaves:t}}var PH=[`disabled`],FH={class:`min-w-0`},IH={class:`text-ink`},LH=N({__name:`CheckField`,props:za({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=so(e,`modelValue`);return(e,r)=>(L(),R(`label`,{class:D(A(Q)(`flex cursor-pointer select-none items-start gap-2 rounded-control px-2 py-1.5 text-xs transition-colors duration-150`,`hover:bg-hover`,t.disabled&&`cursor-not-allowed opacity-50 hover:bg-transparent`))},[Sr(B(`input`,{"onUpdate:modelValue":r[0]||=e=>n.value=e,type:`checkbox`,disabled:t.disabled,class:`mt-0.5 size-3.5 shrink-0 cursor-pointer appearance-none rounded-[4px] border border-line bg-page checked:border-accent checked:bg-accent checked:bg-[length:9px] checked:bg-center checked:bg-no-repeat checked:[background-image:url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22white%22 stroke-width=%224%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M20 6 9 17l-5-5%22/></svg>')] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:cursor-not-allowed`},null,8,PH),[[Yl,n.value]]),B(`span`,FH,[B(`span`,IH,O(t.label),1),t.hint?(L(),R(`span`,{key:0,class:D([`mt-0.5 block`,[A(xz)]])},O(t.hint),3)):U(``,!0),F(e.$slots,`default`)])],2))}}),RH={class:`space-y-3`},zH={class:`flex items-center justify-between gap-2`},BH={class:`text-xs font-medium text-muted`},VH={class:`flex items-center gap-1.5`},HH={class:`max-h-80 space-y-1.5 overflow-auto`},UH={class:`flex items-start gap-2.5`},WH={class:`min-w-0 flex-1`},GH={key:0,class:`flex shrink-0 items-center gap-1.5 pt-0.5`},KH={class:`font-mono text-2xs text-faint`},qH={key:1,class:`shrink-0 rounded-control border border-line px-1.5 py-0.5 text-2xs text-faint`},JH={key:0,class:`mt-1 flex items-center gap-1 pl-6 text-2xs text-warn`},YH={class:`space-y-3`},XH={class:`flex items-center justify-between gap-2`},ZH={class:`text-xs font-medium text-muted`},QH={class:`flex items-center gap-1.5`},$H={class:`max-h-72 space-y-1 overflow-auto`},eU={key:0,class:`text-xs text-muted`},tU=N({__name:`BackupDialog`,props:za({state:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=k(!1),o=k(null),s=k(``),c=k([]),l=k(!1),u=k(null),d=k({});function f(e){c.value=kH(n.state?.entries??[],e?c.value:[])}let p=W(()=>NH(c.value)),m=W(()=>c.value.find(e=>e.id===`global:settings`)?.selected??!1),h=W(()=>n.state!==null&&p.value.leaves>0&&!a.value),g=W(()=>u.value===null?0:u.value.leaves.filter(e=>d.value[e.id]===!0).length);M(i,e=>{e&&(s.value=``,o.value=null,f(!1))},{immediate:!0}),M(()=>n.state,()=>{i.value&&f(!0)});function _(e){u.value=e,d.value=Object.fromEntries(e.leaves.map(e=>[e.id,e.selected])),l.value=!0}function v(){let e=u.value;if(e!==null){for(let t of e.leaves)t.selected=d.value[t.id]===!0;e.leaves.some(e=>e.selected)&&(e.selected=!0),l.value=!1,u.value=null}}function y(e){let t=u.value;t!==null&&(d.value=Object.fromEntries(t.leaves.map(t=>[t.id,e])))}async function b(){if(h.value){a.value=!0,o.value=null;try{await UM(s.value,MH(c.value)),i.value=!1,r(`created`,Y(`settings.backup.created`))}catch(e){o.value=Lj(e)}finally{a.value=!1}}}return(e,t)=>(L(),R(I,null,[V($z,{open:i.value,"onUpdate:open":t[4]||=e=>i.value=e,title:A(Y)(`settings.backup.createTitle`),description:A(Y)(`settings.backup.createDescription`),width:`w-[min(92vw,40rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[3]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{size:`sm`,variant:`primary`,disabled:!h.value,loading:a.value,onClick:b},{default:j(()=>[H(O(A(Y)(`settings.backup.create`)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`div`,RH,[B(`div`,zH,[B(`span`,BH,O(A(_F)(`settings.backup.entriesCount`,p.value.entries))+` · `+O(A(_F)(`settings.backup.itemsSelected`,p.value.leaves)),1),B(`div`,VH,[V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[0]||=e=>A(jH)(c.value,!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>A(jH)(c.value,!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1},8,[`disabled`])])]),B(`ul`,HH,[(L(!0),R(I,null,P(c.value,e=>(L(),R(`li`,{key:e.id,class:`rounded-control border border-line-soft bg-panel-2/30 px-2.5 py-2`},[B(`div`,UH,[B(`div`,WH,[V(LH,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:e.label,hint:e.hint,disabled:a.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]),e.leaves.length>0?(L(),R(`div`,GH,[B(`span`,KH,O(e.leaves.filter(e=>e.selected).length)+`/`+O(e.leaves.length),1),V($,{size:`xs`,variant:`secondary`,disabled:a.value,onClick:t=>_(e)},{default:j(()=>[V(A(Pv),{class:`size-3`}),H(O(A(Y)(`settings.backup.chooseItems`)),1)]),_:1},8,[`disabled`,`onClick`])])):(L(),R(`span`,qH,O(A(wH)(e.kind)),1))]),e.selected&&!A(DH)(e)&&e.leaves.some(e=>e.selected)?(L(),R(`p`,JH,[V(A(ay),{class:`size-3`}),H(` `+O(A(Y)(`settings.backup.partialCapture`)),1)])):U(``,!0)]))),128))]),m.value?U(``,!0):(L(),z(_H,{key:0,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.backup.withoutGlobalSettings`)),1)]),_:1})),V(Rz,{modelValue:s.value,"onUpdate:modelValue":t[2]||=e=>s.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.backup.password`),hint:A(Y)(`settings.backup.passwordHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),o.value?(L(),z(_H,{key:1,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]),V($z,{open:l.value,"onUpdate:open":t[8]||=e=>l.value=e,title:u.value===null?A(Y)(`settings.backup.chooseItems`):A(Y)(`settings.backup.chooseItemsFor`,{label:u.value.label}),description:A(Y)(`settings.backup.subDescription`),width:`w-[min(92vw,34rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[7]||=e=>l.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,onClick:v},{default:j(()=>[H(O(A(Y)(`settings.backup.apply`)),1)]),_:1})]),default:j(()=>[B(`div`,YH,[B(`div`,XH,[B(`span`,ZH,O(A(Y)(`settings.backup.selectedOf`,{selected:g.value,total:u.value?.leaves.length??0})),1),B(`div`,QH,[V($,{size:`xs`,variant:`ghost`,onClick:t[5]||=e=>y(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1}),V($,{size:`xs`,variant:`ghost`,onClick:t[6]||=e=>y(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1})])]),B(`ul`,$H,[(L(!0),R(I,null,P(u.value?.leaves??[],e=>(L(),R(`li`,{key:e.id,class:`rounded-control px-2 py-1.5 hover:bg-hover`},[V(LH,{"model-value":d.value[e.id]===!0,label:e.label,hint:e.hint,"onUpdate:modelValue":t=>d.value[e.id]=t===!0},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`])]))),128))]),u.value?.leaves.length===0?(L(),R(`p`,eU,O(A(Y)(`settings.backup.nothingSelectable`)),1)):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])],64))}}),nU={class:`space-y-3`},rU={key:0,class:`flex min-w-0 flex-col gap-1`},iU=[`disabled`],aU={key:0,class:`font-mono text-2xs text-muted`},oU={class:`mt-2`},sU={class:`mt-2 max-w-sm`},cU={class:`mt-2`},lU={class:`mt-2`},uU={class:`mt-1 max-h-64 space-y-0.5 overflow-auto`},dU={class:`mt-2 flex flex-wrap items-center gap-2`},fU={class:`mt-2`},pU=`__upload__`,mU=N({__name:`RestoreDialog`,props:za({files:{},initial:{default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`applied`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=k(!1),o=k(null),s=k(null),c=k(null),l=k(``),u=k({kind:`upload`}),d=k(pU),f=W(()=>s.value?.items.filter(e=>e.selected).length??0),p=W(()=>{let e=s.value;return e===null?[]:e.appliedIds===void 0?e.applied:e.appliedIds.map(t=>xH(e.items.find(e=>e.id===t)??{label:t}))}),m=W(()=>{let e=s.value;return e===null?[]:e.skippedItems===void 0?e.skipped:e.skippedItems.map(e=>{let t=xH(e);return e.reasonKey===void 0?t:`${t} (${Y(e.reasonKey,e.reasonParams)})`})}),h=W(()=>s.value?.items.some(e=>e.id===`global:settings`&&e.selected)??!1),g=W(()=>s.value?.needsPassword===!0),_=W(()=>s.value!==null&&!g.value&&f.value>0&&!a.value),v=W(()=>[...n.files.map(e=>({value:e.name,label:e.encrypted?Y(`settings.restore.encryptedName`,{name:e.name}):e.name})),{value:pU,label:Y(`settings.restore.uploadOption`)}]),y=Q(Sz,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);function b(e){return Lj(e)}function x(){return l.value.length>0?{password:l.value}:{}}async function S(){let e=u.value;if(e.kind===`upload`&&c.value===null){s.value=null;return}a.value=!0,o.value=null,s.value=null;try{s.value=e.kind===`stored`?await iM(e.name,!1,x()):await WM(c.value,!1,x())}catch(e){o.value=b(e)}finally{a.value=!1}}function C(e){d.value=e,c.value=null,u.value=e===pU?{kind:`upload`}:{kind:`stored`,name:e},S()}function w(e){c.value=e.target.files?.[0]??null,S()}function T(e){for(let t of s.value?.items??[])t.restorable&&(t.selected=e)}async function ee(){let e=s.value,t=u.value;if(e===null||!_.value)return;a.value=!0,o.value=null;let n={...x(),include:e.items.filter(e=>e.restorable&&e.selected).map(e=>e.id)};try{let e=t.kind===`stored`?await iM(t.name,!0,n):await WM(c.value,!0,n);i.value=!1,s.value=null,c.value=null,l.value=``;let a=[];e.reloaded&&a.push(Y(`settings.restore.noteReloaded`)),e.restartRequired&&a.push(Y(`settings.restore.noteRestart`));let o=e.applied.length;r(`applied`,a.length===0?Y(`settings.restore.restored`,{count:o}):Y(`settings.restore.restoredWithNotes`,{count:o,notes:a.join(`; `)}))}catch(e){o.value=b(e)}finally{a.value=!1}}return M(i,e=>{if(!e){s.value=null,c.value=null,l.value=``,o.value=null;return}let t=n.files[0];u.value=n.initial??(t===void 0?{kind:`upload`}:{kind:`stored`,name:t.name}),d.value=u.value.kind===`stored`?u.value.name:pU,S()},{immediate:!0}),(e,t)=>(L(),z($z,{open:i.value,"onUpdate:open":t[4]||=e=>i.value=e,title:A(Y)(`settings.restore.title`),description:A(Y)(`settings.restore.description`),width:`w-[min(92vw,38rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[3]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),s.value&&!g.value?(L(),z($,{key:0,size:`sm`,variant:`danger`,disabled:!_.value,loading:a.value,onClick:ee},{default:j(()=>[H(O(u.value.kind===`stored`?A(Y)(`settings.restore.applyStored`):A(Y)(`settings.restore.applyUpload`)),1)]),_:1},8,[`disabled`,`loading`])):U(``,!0)]),default:j(()=>[B(`div`,nU,[V(Nz,{"model-value":d.value,label:A(Y)(`settings.restore.archive`),hint:A(Y)(`settings.restore.archiveHint`),options:v.value,disabled:a.value,wide:``,"onUpdate:modelValue":C},null,8,[`model-value`,`label`,`hint`,`options`,`disabled`]),u.value.kind===`upload`?(L(),R(`div`,rU,[B(`label`,{class:D(A(bz)),for:`restore-upload`},O(A(Y)(`settings.restore.archiveFile`)),3),B(`input`,{id:`restore-upload`,type:`file`,accept:`.zip,application/zip`,class:D(A(y)),disabled:a.value,onChange:w},null,42,iU),c.value?(L(),R(`p`,aU,O(c.value.name),1)):U(``,!0)])):U(``,!0),a.value?(L(),z(OV,{key:1,class:`h-20 w-full`})):s.value?(L(),z(_H,{key:2,tone:`warn`,title:A(Y)(`settings.restore.unchangedTitle`)},{default:j(()=>[B(`p`,null,[u.value.kind===`stored`?(L(),z(iB,{key:0,k:`settings.restore.archiveLine`},{name:j(()=>[B(`code`,null,O(u.value.name),1)]),_:1})):(L(),R(I,{key:1},[H(O(A(Y)(`settings.restore.uploadedArchive`)),1)],64))]),s.value.needsPassword?(L(),R(I,{key:0},[B(`p`,oU,O(s.value.error??A(Y)(`settings.restore.passwordProtected`)),1),B(`div`,sU,[V(Rz,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,type:`password`,autocomplete:`off`,label:A(Y)(`settings.restore.password`)},null,8,[`modelValue`,`label`])]),B(`div`,cU,[V($,{size:`sm`,variant:`secondary`,disabled:a.value,onClick:S},{default:j(()=>[H(O(A(Y)(`settings.restore.checkAgain`)),1)]),_:1},8,[`disabled`])])],64)):(L(),R(I,{key:1},[B(`p`,lU,O(A(Y)(`settings.restore.choosePrompt`,{selected:f.value,total:s.value.items.length})),1),B(`ul`,uU,[(L(!0),R(I,null,P(s.value.items,e=>(L(),R(`li`,{key:e.id},[V(LH,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:A(xH)(e),hint:[A(wH)(e.kind),e.workspaceId,A(SH)(e)].filter(Boolean).join(` · `),disabled:!e.restorable||a.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]))),128))]),B(`div`,dU,[V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>T(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[2]||=e=>T(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1},8,[`disabled`])]),B(`p`,fU,[H(O(A(Y)(`settings.restore.willRestore`,{items:p.value.join(`, `)||A(Y)(`settings.restore.nothing`)}))+` `,1),m.value.length>0?(L(),R(I,{key:0},[H(O(A(Y)(`settings.restore.skipped`,{items:m.value.join(`, `)})),1)],64)):U(``,!0),s.value.restartRequired?(L(),R(I,{key:1},[H(O(A(Y)(`settings.restore.restartNote`)),1)],64)):h.value?(L(),R(I,{key:2},[H(O(A(Y)(`settings.restore.reloadedNote`)),1)],64)):U(``,!0)])],64))]),_:1},8,[`title`])):U(``,!0),o.value?(L(),z(_H,{key:3,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),hU=[`aria-label`],gU=N({__name:`CopyButton`,props:{value:{},label:{default:void 0},class:{default:void 0}},setup(e){let t=e,n=k(!1),r=null;async function i(){try{await navigator.clipboard.writeText(t.value),n.value=!0,r&&clearTimeout(r),r=setTimeout(()=>{n.value=!1},1400)}catch{}}return Be(()=>{r&&clearTimeout(r)}),(e,r)=>(L(),R(`button`,{type:`button`,class:D(A(Q)(`inline-grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,A(yz),t.class)),"aria-label":n.value?A(Y)(`common.copied`):t.label??A(Y)(`common.copy`),onClick:i},[n.value?(L(),z(A(Fv),{key:0,class:`size-3.5 text-ok`})):(L(),z(A(qv),{key:1,class:`size-3.5`}))],10,hU))}}),_U={key:0,class:`size-1.5 shrink-0 rounded-full bg-current`},vU=N({__name:`ToneBadge`,props:{tone:{default:`neutral`},dot:{type:Boolean,default:!1},mono:{type:Boolean,default:!1},plain:{type:Boolean,default:!1}},setup(e){let t=e,n=W(()=>Q(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium whitespace-nowrap`,t.plain?Q(`border-transparent bg-transparent`,XI[t.tone].split(` `).filter(e=>e.startsWith(`text-`)).join(` `)):XI[t.tone],t.mono&&`font-mono`));return(e,r)=>(L(),R(`span`,{class:D(n.value)},[t.dot?(L(),R(`span`,_U)):U(``,!0),F(e.$slots,`default`)],2))}}),yU={class:`space-y-3`},bU={key:0,class:`sm:col-span-2`},xU={key:1,class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},SU={class:`text-xs font-medium text-muted`},CU={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},wU={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},TU={class:`text-2xs leading-4 text-faint`},EU={key:0,class:`space-y-2 sm:col-span-2`},DU={key:1,class:`text-xs text-muted sm:col-span-2`},OU={key:2,class:`divide-y divide-line-soft sm:col-span-2`},kU={class:`flex items-center gap-2`},AU={class:`min-w-0 flex-1 truncate text-xs font-medium text-ink`},jU={key:0,class:`font-mono text-2xs text-faint`},MU={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},NU={key:1,class:`mt-1 space-y-1`},PU={class:`min-w-0`},FU={class:`truncate font-mono text-2xs text-ink`},IU={class:`mt-0.5 text-2xs leading-4 text-faint`},LU={key:3,class:`text-2xs leading-4 text-faint sm:col-span-2`},RU={key:0,class:`space-y-2 sm:col-span-2`},zU={key:1,class:`sm:col-span-2`},BU={key:2,class:`divide-y divide-line-soft sm:col-span-2`},VU={class:`min-w-0 flex-1`},HU={class:`flex items-center gap-2`},UU={class:`truncate font-mono text-xs text-ink`},WU={class:`mt-0.5 font-mono text-2xs tabular-nums text-muted`},GU={class:`flex items-center gap-1.5`},KU=[`href`],qU={key:3,class:`space-y-2 sm:col-span-2`},JU=N({__name:`BackupsSection`,props:za({state:{},policy:{},configPath:{},workspaces:{},dirty:{type:Boolean}},{form:{required:!0},formModifiers:{}}),emits:za([`reset`],[`update:form`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`form`),a=XN(),o=ZR(()=>i.value.keep,e=>i.value.keep=e,5),s=k(!1),c=k(null),l=k(null),u=k(!1),d=k(!1),f=k(null),p=W(()=>n.state?.files??[]),m=W(()=>n.state?.entries??[]),h=Q(`inline-flex h-6 shrink-0 items-center gap-1 rounded-control border border-line bg-raise px-2 text-2xs font-medium text-ink`,`transition-colors duration-150 hover:bg-hover`,yz);function g(e){f.value=e===void 0?null:{kind:`stored`,name:e},d.value=!0}function _(e){l.value=null,c.value=e,a.refresh()}function v(e){l.value=null,c.value=e,a.refresh()}async function y(e){s.value=!0,l.value=null,c.value=null;try{await Yj(e),c.value=Y(`settings.backups.deleted`,{name:e}),await a.refresh()}catch(e){l.value=Lj(e)}finally{s.value=!1}}return(e,t)=>(L(),R(`div`,yU,[V(gz,{title:A(Y)(`settings.backups.policyTitle`),description:A(Y)(`settings.backups.policyDescription`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.backups.allow`),hint:A(Y)(`settings.backups.allowHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),i.value.enabled?U(``,!0):(L(),R(`div`,bU,[V(_H,{tone:`warn`,title:A(Y)(`settings.backups.offTitle`)},{default:j(()=>[H(O(A(Y)(`settings.backups.offText`)),1)]),_:1},8,[`title`])])),V(Dz,{modelValue:A(o),"onUpdate:modelValue":t[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.backups.keep`),min:1,hint:A(Y)(`settings.backups.keepHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:i.value.includePaths,"onUpdate:modelValue":t[3]||=e=>i.value.includePaths=e,label:A(Y)(`settings.backups.extraPaths`),hint:A(Y)(`settings.backups.extraPathsHint`),placeholder:A(Y)(`settings.backups.extraPathsPlaceholder`)},null,8,[`modelValue`,`label`,`hint`,`placeholder`]),n.policy===null?U(``,!0):(L(),R(`div`,xU,[B(`span`,SU,O(A(Y)(`settings.backups.archiveDirectory`)),1),B(`div`,CU,[B(`span`,wU,O(n.policy.dir),1),V(gU,{value:n.policy.dir,label:A(Y)(`settings.backups.copyArchiveDirectory`)},null,8,[`value`,`label`])]),B(`p`,TU,[V(iB,{k:`settings.backups.changeDirectory`},{path:j(()=>[B(`code`,null,O(n.configPath??A(Y)(`settings.backups.theSettingsFile`)),1)]),_:1})])]))]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`settings.backups.capturesTitle`),description:A(Y)(`settings.backups.capturesDescription`)},{default:j(()=>[n.state===null?(L(),R(`div`,EU,[V(OV,{class:`h-4 w-full`}),V(OV,{class:`h-4 w-2/3`})])):m.value.length===0?(L(),R(`p`,DU,O(A(Y)(`settings.backups.nothingSelectable`)),1)):(L(),R(`ul`,OU,[(L(!0),R(I,null,P(m.value,e=>(L(),R(`li`,{key:e.id,class:`py-2 first:pt-0`},[B(`div`,kU,[B(`p`,AU,O(A(xH)(e)),1),V(vU,{tone:`neutral`,plain:``},{default:j(()=>[H(O(A(wH)(e.kind)),1)]),_:2},1024),e.workspaceId?(L(),R(`span`,jU,O(e.workspaceId),1)):U(``,!0)]),A(SH)(e)?(L(),R(`p`,MU,O(A(SH)(e)),1)):U(``,!0),e.items.length>0?(L(),R(`ul`,NU,[(L(!0),R(I,null,P(e.items,e=>(L(),R(`li`,{key:e.id,class:`flex items-start justify-between gap-3 rounded-control bg-panel-2/40 px-2 py-1`},[B(`div`,PU,[B(`p`,FU,O(e.path??A(xH)(e)),1),B(`p`,IU,[H(O(e.included?e.origin?A(Y)(`settings.backups.fromOrigin`,{origin:e.origin}):A(SH)(e)??A(Y)(`settings.backups.included`):A(SH)(e)??A(Y)(`settings.backups.notCaptured`))+` `,1),e.included&&e.ignoreGenerated?(L(),R(I,{key:0},[H(` · `+O(A(Y)(`settings.backups.generatedSkipped`)),1)],64)):U(``,!0)])]),V(vU,{tone:e.included?`ok`:`neutral`,plain:``},{default:j(()=>[H(O(e.included?A(Y)(`settings.backups.included`):A(Y)(`settings.backups.skipped`)),1)]),_:2},1032,[`tone`])]))),128))])):U(``,!0)]))),128))])),n.workspaces.length>1?(L(),R(`p`,LU,O(A(Y)(`settings.backups.workspacesNote`,{count:n.workspaces.length})),1)):U(``,!0)]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`settings.backups.archivesTitle`),description:A(Y)(`settings.backups.archivesDescription`)},{actions:j(()=>[i.value.enabled?(L(),z($,{key:0,size:`xs`,variant:`primary`,disabled:n.state===null,onClick:t[4]||=e=>u.value=!0},{default:j(()=>[H(O(A(Y)(`settings.backups.create`)),1)]),_:1},8,[`disabled`])):U(``,!0),V($,{size:`xs`,variant:`secondary`,disabled:n.state===null,onClick:t[5]||=e=>g()},{default:j(()=>[H(O(A(Y)(`settings.backups.restore`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[n.state===null?(L(),R(`div`,RU,[V(OV,{class:`h-4 w-full`}),V(OV,{class:`h-4 w-2/3`})])):p.value.length===0?(L(),R(`div`,zU,[V(gL,{compact:``,title:A(Y)(`settings.backups.noArchives`),description:i.value.enabled?A(Y)(`settings.backups.noArchivesEnabled`):A(Y)(`settings.backups.noArchivesDisabled`)},ya({icon:j(()=>[V(A(Mv),{class:`size-4`})]),_:2},[i.value.enabled?{name:`action`,fn:j(()=>[V($,{size:`sm`,variant:`primary`,onClick:t[6]||=e=>u.value=!0},{default:j(()=>[H(O(A(Y)(`settings.backups.create`)),1)]),_:1})]),key:`0`}:void 0]),1032,[`title`,`description`])])):(L(),R(`ul`,BU,[(L(!0),R(I,null,P(p.value,e=>(L(),R(`li`,{key:e.name,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0 last:pb-0`},[B(`div`,VU,[B(`div`,HU,[B(`span`,UU,O(e.name),1),e.encrypted?(L(),z(vU,{key:0,tone:`warn`,plain:``},{default:j(()=>[H(O(A(Y)(`settings.backups.encrypted`)),1)]),_:1})):U(``,!0)]),B(`p`,WU,O(A(IL)(e.sizeBytes))+` · `+O(A(FL)(e.createdAt)),1)]),B(`div`,GU,[B(`a`,{href:Kj(e.name),class:D(A(h))},[V(A(Yv),{class:`size-3`,"aria-hidden":`true`}),H(` `+O(A(Y)(`settings.backups.download`)),1)],10,KU),V($,{size:`xs`,variant:`secondary`,onClick:t=>g(e.name)},{default:j(()=>[V(A(xy),{class:`size-3`,"aria-hidden":`true`}),H(` `+O(A(Y)(`settings.backups.restoreAction`)),1)]),_:1},8,[`onClick`]),V(mH,{label:A(Y)(`common.delete`),"confirm-label":A(Y)(`settings.backups.confirmDelete`),size:`xs`,variant:`ghost`,"confirm-variant":`danger`,disabled:s.value,onConfirm:t=>y(e.name)},null,8,[`label`,`confirm-label`,`disabled`,`onConfirm`])])]))),128))])),l.value||c.value?(L(),R(`div`,qU,[l.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(l.value),1)]),_:1})):U(``,!0),c.value?(L(),z(_H,{key:1,tone:`ok`},{default:j(()=>[H(O(c.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`]),V(tU,{open:u.value,"onUpdate:open":t[7]||=e=>u.value=e,state:n.state,onCreated:_},null,8,[`open`,`state`]),V(mU,{open:d.value,"onUpdate:open":t[8]||=e=>d.value=e,files:p.value,initial:f.value,onApplied:v},null,8,[`open`,`files`,`initial`])]))}}),YU={key:0,class:`mt-3 flex flex-wrap items-center gap-1.5`},XU={class:`text-xs text-muted`},ZU={key:1,class:`mt-3 text-xs text-muted`},QU=N({__name:`HostSection`,props:za({config:{},alerts:{},dirty:{type:Boolean}},{host:{required:!0},hostModifiers:{}}),emits:za([`reset`],[`update:host`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`host`),a=ZR(()=>i.value.intervalMs,e=>i.value.intervalMs=e,15e3),o=ZR(()=>i.value.diskUsedPercent,e=>i.value.diskUsedPercent=e,90),s=ZR(()=>i.value.memoryUsedPercent,e=>i.value.memoryUsedPercent=e,90),c=ZR(()=>i.value.swapUsedPercent,e=>i.value.swapUsedPercent=e,50),l=ZR(()=>i.value.loadPerCpu,e=>i.value.loadPerCpu=e,2),u=ZR(()=>i.value.tempCelsius,e=>i.value.tempCelsius=e,85);return(e,t)=>(L(),R(I,null,[V(gz,{title:A(Y)(`settings.host.title`),description:A(Y)(`settings.host.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.host.enabled`),hint:A(Y)(`settings.host.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(a),"onUpdate:modelValue":t[2]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.host.interval`),min:5e3,hint:A(Y)(`settings.host.intervalHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:i.value.diskPaths,"onUpdate:modelValue":t[3]||=e=>i.value.diskPaths=e,label:A(Y)(`settings.host.diskPaths`),hint:A(Y)(`settings.host.diskPathsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(o),"onUpdate:modelValue":t[4]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.host.diskUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":t[5]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.host.memoryUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(c),"onUpdate:modelValue":t[6]||=e=>hn(c)?c.value=e:null,label:A(Y)(`settings.host.swapUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(l),"onUpdate:modelValue":t[7]||=e=>hn(l)?l.value=e:null,label:A(Y)(`settings.host.loadPerCpu`),min:0,hint:A(Y)(`settings.host.loadPerCpuHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(u),"onUpdate:modelValue":t[8]||=e=>hn(u)?u.value=e:null,label:A(Y)(`settings.host.tempCelsius`),min:0,hint:A(Y)(`settings.host.tempCelsiusHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),n.alerts.length>0?(L(),R(`div`,YU,[B(`span`,XU,O(A(Y)(`settings.host.breachingNow`)),1),(L(!0),R(I,null,P(n.alerts,e=>(L(),z(vU,{key:e,tone:`danger`,dot:``},{default:j(()=>[H(O(e),1)]),_:2},1024))),128))])):i.value.enabled?(L(),R(`p`,ZU,O(A(Y)(`settings.host.nothingBreaching`)),1)):U(``,!0)],64))}}),$U={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},eW={class:`text-xs font-medium text-muted`},tW={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},nW={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},rW={class:`text-2xs leading-4 text-faint`},iW={key:0},aW={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},oW={class:`text-xs font-medium text-muted`},sW={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},cW={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},lW={class:`text-2xs leading-4 text-faint`},uW={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},dW={class:`text-xs font-medium text-muted`},fW=[`disabled`],pW={class:`text-2xs leading-4 text-faint sm:col-span-2`},mW=N({__name:`InterfaceSection`,props:za({ui:{},panelVersion:{},labelDirty:{type:Boolean}},{label:{required:!0},labelModifiers:{}}),emits:za([`changed`,`resetLabel`],[`update:label`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`label`),a=k(null),o=k(!1),s=k(null),c=k(null),l=k(!1),u=W(()=>{let e=n.ui;if(e===null)return Y(`common.unknown`);if(!e.custom)return Y(`settings.interface.sourceStock`);let t=e.meta;return t===null?Y(`settings.interface.sourceCustom`):`${Y(`settings.interface.sourceCustom`)} · ${t.name??Y(`settings.interface.unnamed`)}${t.version==null?``:` ${t.version}`}`}),d=W(()=>{let e=n.ui?.meta;if(e==null)return null;let t=e.uploadedAt===void 0?null:new Date(e.uploadedAt).toLocaleString();return`${Y(`settings.interface.fileCount`,{count:e.files??0})}${t===null?``:` · ${t}`}`});function f(e){a.value=e.target.files?.[0]??null,s.value=null,c.value=null}async function p(){if(a.value!==null){o.value=!0,c.value=null,s.value=null;try{let e=await fM(a.value);s.value=Y(`settings.interface.installed`,{name:e.meta?.name??Y(`settings.interface.yourBuild`)}),a.value=null,r(`changed`)}catch(e){c.value=Lj(e)}finally{o.value=!1}}}async function m(){if(!l.value){l.value=!0,setTimeout(()=>{l.value=!1},5e3);return}l.value=!1,o.value=!0,c.value=null;try{let e=await sM();s.value=e.removed?Y(`settings.interface.restored`):Y(`settings.interface.nothingInstalled`),r(`changed`)}catch(e){c.value=Lj(e)}finally{o.value=!1}}return(t,h)=>(L(),z(gz,{title:A(Y)(`settings.interface.title`),description:A(Y)(`settings.interface.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.labelDirty,onClick:h[1]||=e=>r(`resetLabel`)},{default:j(()=>[H(O(A(Y)(`settings.interface.resetName`)),1)]),_:1},8,[`disabled`]),e.ui?.custom?(L(),z($,{key:0,size:`xs`,variant:`ghost`,disabled:o.value,onClick:m},{default:j(()=>[H(O(l.value?A(Y)(`settings.interface.confirmRevert`):A(Y)(`settings.interface.revertToStock`)),1)]),_:1},8,[`disabled`])):U(``,!0),V($,{size:`xs`,variant:`primary`,disabled:o.value||a.value===null,onClick:p},{default:j(()=>[H(O(A(Y)(`settings.interface.install`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[B(`div`,$U,[B(`span`,eW,O(A(Y)(`settings.interface.currentlyServing`)),1),B(`div`,tW,[B(`span`,nW,O(u.value),1),V(gU,{value:e.ui?.dir??``,label:A(Y)(`settings.interface.copyDirectory`)},null,8,[`value`,`label`])]),B(`p`,rW,[d.value?(L(),R(`span`,iW,O(d.value)+` · `,1)):U(``,!0),B(`code`,null,O(e.ui?.dir??`—`),1)])]),B(`div`,aW,[B(`span`,oW,O(A(Y)(`settings.interface.panelVersion`)),1),B(`div`,sW,[B(`span`,cW,O(A(Y)(`app.name`))+` `+O(n.panelVersion??A(Y)(`common.unknown`)),1),n.panelVersion?(L(),z(gU,{key:0,value:n.panelVersion,label:A(Y)(`settings.interface.copyPanelVersion`)},null,8,[`value`,`label`])):U(``,!0)]),B(`p`,lW,[V(iB,{k:`settings.interface.panelVersionHint`},{command:j(()=>[...h[2]||=[B(`code`,null,`home-hosted status`,-1)]]),_:1})])]),V(Rz,{modelValue:i.value,"onUpdate:modelValue":h[0]||=e=>i.value=e,label:A(Y)(`settings.interface.panelName`),hint:A(Y)(`settings.interface.panelNameHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),B(`label`,uW,[B(`span`,dW,O(A(Y)(`settings.interface.uploadLabel`)),1),B(`input`,{type:`file`,accept:`.zip,application/zip`,class:`rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-xs text-ink file:mr-2 file:rounded file:border-0 file:bg-line file:px-2 file:py-1 file:text-xs`,disabled:o.value,onChange:f},null,40,fW)]),c.value?(L(),z(_H,{key:0,tone:`warn`,title:c.value},null,8,[`title`])):s.value?(L(),z(_H,{key:1,tone:`ok`,title:s.value},null,8,[`title`])):U(``,!0),B(`p`,pW,[V(iB,{k:`settings.interface.docsHint`},{docs:j(()=>[...h[3]||=[B(`code`,null,`docs/UI_CREATION.md`,-1)]]),command:j(()=>[...h[4]||=[B(`code`,null,`home-hosted ui-revert`,-1)]]),_:1})])]),_:1},8,[`title`,`description`]))}}),hW={class:`inline-flex items-center gap-0.5 rounded-control border border-line bg-panel-2 p-0.5`},gW=[`aria-pressed`,`onClick`],_W=N({__name:`SegmentedControl`,props:za({options:{},size:{default:`sm`}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=so(e,`modelValue`);return(e,r)=>(L(),R(`div`,hW,[(L(!0),R(I,null,P(t.options,e=>(L(),R(`button`,{key:e.value,type:`button`,class:D(A(Q)(`rounded-[5px] font-medium transition-colors duration-150`,t.size===`sm`?`h-6 px-2 text-2xs`:`h-7 px-2.5 text-xs`,n.value===e.value?`bg-raise text-ink shadow-card`:`text-muted hover:text-ink`)),"aria-pressed":n.value===e.value,onClick:t=>n.value=e.value},O(e.label),11,gW))),128))]))}}),vW={class:`flex min-w-0 flex-col gap-1`},yW={class:`text-xs font-medium text-muted`},bW={class:`text-2xs leading-4 text-faint`},xW={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},SW={class:`text-xs font-medium text-muted`},CW={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},wW={class:`min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-ink`},TW={class:`text-2xs leading-4 text-faint`},EW=N({__name:`ListenerSection`,props:za({view:{},dirty:{type:Boolean}},{control:{required:!0},controlModifiers:{}}),emits:za([`reset`],[`update:control`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`control`),a=ZR(()=>i.value.port,e=>i.value.port=e,3999),o=[`local`,`lan`],s=W({get:()=>o.includes(i.value.host)?i.value.host:`custom`,set:e=>{if(e!==`custom`){i.value.host=e;return}if(!o.includes(i.value.host))return;let t=n.view?.bindHost??``,r=t!==``&&t!==`0.0.0.0`&&t!==`127.0.0.1`&&$k(t)!==null;i.value.host=r?t:`127.0.0.1`}}),c=W(()=>{if(s.value===`custom`&&$k(i.value.host)===null)return Y(`settings.listener.ipv4Error`)}),l=W(()=>n.view?.url??`—`),u=W(()=>s.value===`lan`?Y(`settings.listener.bindLanHint`):s.value===`local`?Y(`settings.listener.bindLocalHint`):Y(`settings.listener.bindCustomHint`));return(e,t)=>(L(),z(gz,{title:A(Y)(`settings.listener.title`),description:A(Y)(`settings.listener.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Dz,{modelValue:A(a),"onUpdate:modelValue":t[1]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.listener.port`),min:1,max:65535,hint:A(Y)(`settings.listener.portHint`)},null,8,[`modelValue`,`label`,`hint`]),B(`div`,vW,[B(`span`,yW,O(A(Y)(`settings.listener.bind`)),1),V(_W,{modelValue:s.value,"onUpdate:modelValue":t[2]||=e=>s.value=e,options:[{value:`local`,label:A(Y)(`settings.listener.bindLocal`)},{value:`lan`,label:A(Y)(`settings.listener.bindLan`)},{value:`custom`,label:A(Y)(`settings.listener.bindCustom`)}]},null,8,[`modelValue`,`options`]),B(`p`,bW,O(u.value),1)]),s.value===`custom`?(L(),z(Rz,{key:0,modelValue:i.value.host,"onUpdate:modelValue":t[3]||=e=>i.value.host=e,label:A(Y)(`settings.listener.ipv4`),placeholder:A(Y)(`settings.listener.ipv4Placeholder`),error:c.value,hint:A(Y)(`settings.listener.ipv4Hint`)},null,8,[`modelValue`,`label`,`placeholder`,`error`,`hint`])):U(``,!0),V(Vz,{modelValue:i.value.openBrowser,"onUpdate:modelValue":t[4]||=e=>i.value.openBrowser=e,label:A(Y)(`settings.listener.openBrowser`),wide:``},null,8,[`modelValue`,`label`]),B(`div`,xW,[B(`span`,SW,O(A(Y)(`settings.listener.liveAddress`)),1),B(`div`,CW,[B(`span`,wW,O(l.value),1),n.view?.restartRequired?(L(),z(vU,{key:0,tone:`warn`,dot:``},{default:j(()=>[H(O(A(Y)(`settings.listener.restartRequired`)),1)]),_:1})):U(``,!0),V(gU,{value:l.value,label:A(Y)(`settings.listener.copyLiveAddress`)},null,8,[`value`,`label`])]),B(`p`,TW,O(A(Y)(`settings.listener.liveAddressHint`)),1)])]),_:1},8,[`title`,`description`]))}}),DW={class:`space-y-3`},OW={class:`divide-y divide-line-soft sm:col-span-2`},kW={class:`min-w-0`},AW={class:`text-xs font-medium text-ink`},jW={class:`mt-0.5 text-2xs leading-4 text-faint`},MW={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},NW={class:`min-w-0 truncate font-mono text-xs text-ink`},PW={class:`flex items-center gap-2 text-xs font-medium text-ink`},FW={class:`font-mono text-2xs font-normal text-faint`},IW={class:`divide-y divide-line-soft`},LW={class:`min-w-0`},RW={class:`text-2xs font-medium text-ink`},zW={class:`mt-0.5 text-2xs leading-4 text-faint`},BW={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},VW={class:`min-w-0 truncate font-mono text-2xs text-ink`},HW=N({__name:`PathsSection`,props:{dataRoot:{},projectDir:{},panelUrl:{},workspaces:{}},setup(e){let t=e,n=W(()=>t.dataRoot===null?null:`${t.dataRoot}/settings.json`),r=W(()=>[{key:`data`,label:Y(`settings.paths.dataRoot`),hint:Y(`settings.paths.dataRootHint`),copyLabel:Y(`settings.paths.dataRoot`),value:t.dataRoot??`—`},{key:`settings`,label:Y(`settings.paths.globalSettings`),hint:Y(`settings.paths.globalSettingsHint`),copyLabel:Y(`settings.paths.globalSettings`),value:n.value??`—`},{key:`project`,label:Y(`settings.paths.projectDir`),hint:Y(`settings.paths.projectDirHint`),copyLabel:Y(`settings.paths.projectDir`),value:t.projectDir??`—`},{key:`panel`,label:Y(`settings.paths.panelAddress`),hint:Y(`settings.paths.panelAddressHint`),copyLabel:Y(`settings.paths.panelAddress`),value:t.panelUrl??`—`}]);function i(e){return[{key:`${e.id}:config`,label:Y(`settings.paths.serversConfig`),hint:Y(`settings.paths.serversConfigHint`,{label:e.label}),copyLabel:Y(`settings.paths.serversConfig`),value:e.configPath},{key:`${e.id}:settings`,label:Y(`settings.paths.workspaceSettings`),hint:Y(`settings.paths.workspaceSettingsHint`),copyLabel:Y(`settings.paths.workspaceSettings`),value:e.settingsPath},{key:`${e.id}:logs`,label:Y(`settings.paths.logs`),hint:Y(`settings.paths.logsHint`),copyLabel:Y(`settings.paths.logs`),value:e.logsDir}]}return(t,n)=>(L(),R(`div`,DW,[V(gz,{title:A(Y)(`settings.paths.whereThingsLive`),description:A(Y)(`settings.paths.whereThingsLiveDescription`)},{default:j(()=>[B(`ul`,OW,[(L(!0),R(I,null,P(r.value,e=>(L(),R(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`},[B(`div`,kW,[B(`p`,AW,O(e.label),1),B(`p`,jW,O(e.hint),1)]),B(`div`,MW,[B(`span`,NW,O(e.value),1),V(gU,{value:e.value,label:A(Y)(`settings.paths.copyPath`,{label:e.copyLabel.toLowerCase()})},null,8,[`value`,`label`])])]))),128))])]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`settings.paths.workspaceFiles`),description:A(Y)(`settings.paths.workspaceFilesDescription`)},{default:j(()=>[(L(!0),R(I,null,P(e.workspaces,e=>(L(),R(`div`,{key:e.id,class:`space-y-2 sm:col-span-2`},[B(`p`,PW,[H(O(e.label)+` `,1),B(`span`,FW,O(e.id),1)]),B(`ul`,IW,[(L(!0),R(I,null,P(i(e),e=>(L(),R(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-1.5`},[B(`div`,LW,[B(`p`,RW,O(e.label),1),B(`p`,zW,O(e.hint),1)]),B(`div`,BW,[B(`span`,VW,O(e.value),1),V(gU,{value:e.value,label:A(Y)(`settings.paths.copyPath`,{label:e.copyLabel.toLowerCase()})},null,8,[`value`,`label`])])]))),128))])]))),128))]),_:1},8,[`title`,`description`])]))}}),UW=[`id`],WW={class:`mb-3`},GW={class:`text-lg font-semibold text-ink`},KW={class:`mt-0.5 text-xs text-muted`},qW=N({__name:`SettingsSection`,props:{id:{},title:{},description:{}},setup(e){return(t,n)=>(L(),R(`section`,{id:e.id,class:`scroll-mt-5`},[B(`header`,WW,[B(`h2`,GW,O(e.title),1),B(`p`,KW,O(e.description),1)]),F(t.$slots,`default`)],8,UW))}}),JW={class:`min-h-full`},YW={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},XW={class:`lg:grid lg:grid-cols-[11rem_minmax(0,1fr)] lg:gap-8`},ZW=[`aria-label`],QW={class:`sticky top-6 space-y-0.5 border-l border-line`},$W=[`aria-current`,`onClick`],eG={class:`space-y-6`},tG={class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},nG={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},rG={class:`min-w-0 flex-1`},iG={class:`text-xs text-muted`},aG={class:`font-mono tabular-nums text-ink`},oG={key:0,class:`mt-0.5 text-xs text-danger`},sG={key:1,class:`mt-0.5 text-xs text-ok`},cG={class:`flex shrink-0 items-center gap-2`},lG={class:`max-h-[60dvh] overflow-auto px-4 py-3`},uG={key:0,class:`divide-y divide-line-soft`},dG={class:`font-mono text-xs text-ink`},fG={class:`ml-auto font-mono text-xs text-muted line-through`},pG={class:`font-mono text-xs text-accent`},mG={key:1,class:`text-xs text-muted`},hG={class:`flex items-center justify-end gap-2 border-t border-line px-4 py-3`},gG=N({__name:`SettingsShell`,props:{sections:{},navLabel:{},changesDescription:{},changedCount:{},changes:{},saveError:{},saveMessage:{},saving:{type:Boolean}},emits:[`save`,`discard`],setup(e,{emit:t}){let n=e,r=t,i=zg(),a=Rg(),o=k(n.sections[0]?.id??``),s=k(!1);function c(e){ir(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function l(e){o.value=e,i.query.section!==e&&a.replace({query:{...i.query,section:e}}),c(e)}M(()=>i.query.section,e=>{let t=typeof e==`string`?e:``;n.sections.some(e=>e.id===t)&&(o.value=t,c(t))},{immediate:!0});let u=null;na(()=>{u=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top)[0];t!==void 0&&t.target.id.length>0&&(o.value=t.target.id)},{rootMargin:`-72px 0px -62% 0px`,threshold:0});for(let e of n.sections){let t=document.getElementById(e.id);t&&u.observe(t)}}),aa(()=>u?.disconnect());function d(){r(`save`),s.value=!1}return(e,t)=>(L(),R(I,null,[B(`div`,JW,[B(`div`,YW,[F(e.$slots,`header`),B(`div`,XW,[B(`nav`,{"aria-label":n.navLabel,class:`hidden lg:block`},[B(`ul`,QW,[(L(!0),R(I,null,P(n.sections,e=>(L(),R(`li`,{key:e.id},[B(`button`,{type:`button`,"aria-current":o.value===e.id?`true`:void 0,class:D(A(Q)(`-ml-px block w-full border-l-2 py-1.5 pl-3 text-left text-xs transition-colors duration-150`,o.value===e.id?`border-accent font-medium text-accent`:`border-transparent text-muted hover:border-line hover:text-ink`)),onClick:t=>l(e.id)},O(e.title),11,$W)]))),128))])],8,ZW),B(`div`,eG,[F(e.$slots,`default`)])])]),B(`div`,tG,[B(`div`,nG,[B(`div`,rG,[B(`p`,iG,[n.changedCount>0?(L(),R(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-xs text-muted underline decoration-line underline-offset-2 hover:text-ink`,onClick:t[0]||=e=>s.value=!0},[B(`span`,aG,O(n.changedCount),1),H(` `+O(A(_F)(`settings.shell.fieldsChanged`,n.changedCount)),1)])):(L(),R(I,{key:1},[H(O(A(Y)(`settings.shell.noUnsavedChanges`)),1)],64))]),n.saveError?(L(),R(`p`,oG,O(n.saveError),1)):n.saveMessage?(L(),R(`p`,sG,O(n.saveMessage),1)):U(``,!0)]),B(`div`,cG,[V($,{variant:`ghost`,disabled:n.changedCount===0||n.saving,onClick:t[1]||=e=>r(`discard`)},{default:j(()=>[H(O(A(Y)(`settings.shell.discard`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:n.changedCount===0,loading:n.saving,onClick:t[2]||=e=>r(`save`)},{default:j(()=>[H(O(A(Y)(`settings.shell.save`)),1)]),_:1},8,[`disabled`,`loading`])])])])]),V($z,{open:s.value,"onUpdate:open":t[4]||=e=>s.value=e,title:A(Y)(`settings.shell.unsavedTitle`),description:n.changesDescription,width:`w-[min(92vw,42rem)]`},{default:j(()=>[B(`div`,lG,[n.changes.length>0?(L(),R(`ul`,uG,[(L(!0),R(I,null,P(n.changes,e=>(L(),R(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[B(`code`,dG,O(e.path),1),B(`span`,fG,O(A(zL)(e.from)),1),t[5]||=B(`span`,{class:`text-2xs text-faint`},`→`,-1),B(`span`,pG,O(A(zL)(e.to)),1)]))),128))])):(L(),R(`p`,mG,O(A(Y)(`settings.shell.nothingToSave`)),1))]),B(`footer`,hG,[V($,{size:`sm`,variant:`ghost`,onClick:t[3]||=e=>s.value=!1},{default:j(()=>[H(O(A(Y)(`common.close`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:n.changes.length===0||n.saving,loading:n.saving,onClick:d},{default:j(()=>[H(O(A(_F)(`settings.shell.saveChanges`,n.changes.length)),1)]),_:1},8,[`disabled`,`loading`])])]),_:1},8,[`open`,`title`,`description`])],64))}}),_G={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},vG={class:`text-xs font-medium text-muted`},yG={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},bG={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},xG={key:0,class:`sm:col-span-2`},SG={key:1,class:`space-y-3 sm:col-span-2`},CG={class:`divide-y divide-line-soft text-xs`},wG={class:`flex items-start justify-between gap-4 py-1.5`},TG={class:`text-muted`},EG={class:`min-w-0 text-right font-mono text-xs text-ink`},DG={class:`flex items-start justify-between gap-4 py-1.5`},OG={class:`text-muted`},kG={class:`min-w-0 text-right font-mono text-xs text-ink`},AG={class:`flex items-start justify-between gap-4 py-1.5`},jG={class:`text-muted`},MG={class:`font-mono text-xs tabular-nums text-ink`},NG={class:`flex items-center justify-between gap-4 py-1.5`},PG={class:`text-muted`},FG={class:`flex items-start justify-between gap-4 py-1.5`},IG={class:`text-muted`},LG={class:`flex min-w-0 items-center gap-1.5`},RG={class:`min-w-0 truncate font-mono text-2xs text-ink`},zG={key:2,class:`sm:col-span-2`},BG={class:`flex min-w-0 flex-col gap-1`},VG={class:`flex min-w-0 flex-col gap-1`},HG={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},UG={key:3,class:`space-y-2 sm:col-span-2`},WG=N({__name:`TlsSection`,props:za({view:{},dirty:{type:Boolean}},{tlsEnabled:{type:Boolean,required:!0},tlsEnabledModifiers:{}}),emits:za([`reset`],[`update:tlsEnabled`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`tlsEnabled`),a=XN(),o=k(``),s=k(``),c=k(null),l=k(null),u=k(!1),d=W(()=>n.view?.tls??null),f=W(()=>n.view?`${n.view.protocol}://${n.view.bindHost}:${n.view.port}`:`—`),p=W(()=>o.value.trim().length>0&&s.value.trim().length>0&&!u.value),m=Q(Sz,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?o.value=r:s.value=r}async function g(){u.value=!0,l.value=null,c.value=null;try{let e=await eN(o.value,s.value);o.value=``,s.value=``,c.value=Y(`settings.tls.stored`),await a.refresh();let t=await QR(e);t!==null&&(l.value=t)}catch(e){l.value=Lj(e)}finally{u.value=!1}}async function _(){u.value=!0,l.value=null,c.value=null;try{let e=await tN();c.value=Y(`settings.tls.removed`),await a.refresh();let t=await QR(e);t!==null&&(l.value=t)}catch(e){l.value=Lj(e)}finally{u.value=!1}}return(e,t)=>(L(),R(I,null,[V(gz,{title:A(Y)(`settings.tls.title`),description:A(Y)(`settings.tls.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value,"onUpdate:modelValue":t[1]||=e=>i.value=e,label:A(Y)(`settings.tls.serve`),hint:A(Y)(`settings.tls.serveHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),B(`div`,_G,[B(`span`,vG,O(A(Y)(`settings.listener.liveAddress`)),1),B(`div`,yG,[B(`span`,bG,O(f.value),1),V(gU,{value:f.value,label:A(Y)(`settings.listener.copyLiveAddress`)},null,8,[`value`,`label`])])])]),_:1},8,[`title`,`description`]),V(gz,{class:`mt-3`,title:A(Y)(`settings.tls.certificateTitle`),description:A(Y)(`settings.tls.certificateDescription`)},{default:j(()=>[d.value?.error?(L(),R(`div`,xG,[V(_H,{tone:`danger`,title:A(Y)(`settings.tls.unusableTitle`)},{default:j(()=>[H(O(d.value.error),1)]),_:1},8,[`title`])])):d.value?.certPresent?(L(),R(`div`,SG,[B(`dl`,CG,[B(`div`,wG,[B(`dt`,TG,O(A(Y)(`settings.tls.subject`)),1),B(`dd`,EG,O(d.value.subject??`—`),1)]),B(`div`,DG,[B(`dt`,OG,O(A(Y)(`settings.tls.issuer`)),1),B(`dd`,kG,O(d.value.issuer??`—`),1)]),B(`div`,AG,[B(`dt`,jG,O(A(Y)(`settings.tls.validUntil`)),1),B(`dd`,MG,[H(O(d.value.validTo?d.value.validTo.slice(0,10):`—`)+` `,1),d.value.daysRemaining===null?U(``,!0):(L(),R(`span`,{key:0,class:D(A(Q)(`ml-1.5`,d.value.daysRemaining<14?`text-warn`:`text-faint`))},` (`+O(A(Y)(`settings.tls.days`,{count:d.value.daysRemaining}))+`) `,3))])]),B(`div`,NG,[B(`dt`,PG,O(A(Y)(`settings.tls.privateKey`)),1),B(`dd`,null,[V(vU,{tone:d.value.keyMatches?`ok`:`danger`,dot:``},{default:j(()=>[H(O(d.value.keyMatches?A(Y)(`settings.tls.keyMatches`):A(Y)(`settings.tls.keyMismatch`)),1)]),_:1},8,[`tone`])])]),B(`div`,FG,[B(`dt`,IG,O(A(Y)(`settings.tls.fingerprint`)),1),B(`dd`,LG,[B(`span`,RG,O(d.value.fingerprint??`—`),1),d.value.fingerprint?(L(),z(gU,{key:0,value:d.value.fingerprint,label:A(Y)(`settings.tls.copyFingerprint`)},null,8,[`value`,`label`])):U(``,!0)])])])])):(L(),R(`div`,zG,[V(_H,{tone:`info`,title:A(Y)(`settings.tls.noCertificateTitle`)},{default:j(()=>[H(O(A(Y)(`settings.tls.noCertificateText`)),1)]),_:1},8,[`title`])])),B(`div`,BG,[B(`label`,{class:D(A(bz)),for:`tls-cert-file`},O(A(Y)(`settings.tls.certFile`)),3),B(`input`,{id:`tls-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:D(A(m)),onChange:t[2]||=e=>h(e,`cert`)},null,34)]),B(`div`,VG,[B(`label`,{class:D(A(bz)),for:`tls-key-file`},O(A(Y)(`settings.tls.keyFile`)),3),B(`input`,{id:`tls-key-file`,type:`file`,accept:`.pem,.key,text/plain`,class:D(A(m)),onChange:t[3]||=e=>h(e,`key`)},null,34)]),V(rB,{modelValue:o.value,"onUpdate:modelValue":t[4]||=e=>o.value=e,label:A(Y)(`settings.tls.pasteCertificate`),rows:4,placeholder:`-----BEGIN CERTIFICATE-----`},null,8,[`modelValue`,`label`]),V(rB,{modelValue:s.value,"onUpdate:modelValue":t[5]||=e=>s.value=e,label:A(Y)(`settings.tls.pasteKey`),rows:4,placeholder:`-----BEGIN PRIVATE KEY-----`},null,8,[`modelValue`,`label`]),B(`div`,HG,[V($,{variant:`primary`,disabled:!p.value,loading:u.value,onClick:g},{default:j(()=>[H(O(A(Y)(`settings.tls.saveCertificate`)),1)]),_:1},8,[`disabled`,`loading`]),d.value?.certPresent?(L(),z(mH,{key:0,label:A(Y)(`settings.tls.removeCertificate`),"confirm-label":A(Y)(`settings.tls.confirmRemove`),"confirm-variant":`danger`,title:A(Y)(`settings.tls.removeTitle`),hint:A(Y)(`settings.tls.removeHint`),disabled:u.value,onConfirm:_},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),l.value||c.value?(L(),R(`div`,UG,[l.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(l.value),1)]),_:1})):U(``,!0),c.value?(L(),z(_H,{key:1,tone:`ok`},{default:j(()=>[H(O(c.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`])],64))}}),GG=N({__name:`LanguageSelect`,props:{labelled:{type:Boolean,default:!0},wide:{type:Boolean,default:!1}},setup(e){let t=e,n=k(!1),r=W(()=>qP.map(e=>({value:e.code,label:e.name}))),i=k(null),a=W({get:()=>i.value??vF(),set:e=>{e!==vF()&&(i.value=e,n.value=!0,hF(e).finally(()=>{i.value=null,n.value=!1}))}});return(e,i)=>(L(),z(Nz,{modelValue:a.value,"onUpdate:modelValue":i[0]||=e=>a.value=e,label:t.labelled?A(Y)(`language.label`):void 0,options:r.value,wide:t.wide,disabled:n.value,"aria-label":t.labelled?void 0:A(Y)(`language.select`),"data-testid":`language-select`},null,8,[`modelValue`,`label`,`options`,`wide`,`disabled`,`aria-label`]))}}),KG={class:`mb-5`},qG={class:`text-xl font-semibold tracking-tight text-ink`},JG={class:`mt-1 text-xs text-muted`},YG={class:`text-2xs leading-4 text-faint sm:col-span-2`},XG=N({__name:`GlobalSettingsView`,setup(e){let t=W(()=>[{id:`listener`,title:Y(`views.globalSettings.sectionListener`)},{id:`authentication`,title:Y(`views.globalSettings.sectionAuthentication`)},{id:`host`,title:Y(`views.globalSettings.sectionHost`)},{id:`backups`,title:Y(`views.globalSettings.sectionBackups`)},{id:`tls`,title:Y(`views.globalSettings.sectionTls`)},{id:`language`,title:Y(`language.label`)},{id:`interface`,title:Y(`views.globalSettings.sectionInterface`)},{id:`paths`,title:Y(`views.globalSettings.sectionPaths`)}]),n=XN(),r=vN(),i=tn(ER()),a=k(!1),o=k(null),s=k(null),c=k(null),l=k(null),u=W(()=>n.control.value),d=W(()=>n.host.value?.alerts??[]),f=W(()=>l.value?.host??null),p=W(()=>l.value?.backups??null),m=W(()=>n.backups.value),h=W(()=>l.value?.ui??null),g=W(()=>n.version.value),_=W(()=>n.dataRoot.value),v=W(()=>n.projectDir.value),y=W(()=>_.value===null?null:`${_.value}/settings.json`),b=W(()=>{let e={},t=u.value;if(t!==null){let n=RR(t,i);Object.keys(n).length>0&&(e.control=n)}let n=f.value;if(n!==null){let t=IR(n,i.host);Object.keys(t).length>0&&(e.host=t)}let r=p.value;if(r!==null){let t=LR(r,i.backups);Object.keys(t).length>0&&(e.backups=t)}return e}),x=W(()=>bR(b.value)),S=W(()=>{let e=u.value,t=f.value,n=p.value;return{control:e===null?{}:{...jR(e),auth:AR(e.auth)},host:t??{},backups:n===null?{}:{enabled:n.enabled,keep:n.keep,includePaths:n.includePaths}}}),C=W(()=>yR(b.value,S.value)),w=W(()=>u.value!==null&&JR(u.value,i)),T=W(()=>u.value!==null&&YR(u.value,i)),ee=W(()=>u.value!==null&&XR(u.value,i)),te=W(()=>f.value!==null&&Object.keys(IR(f.value,i.host)).length>0),ne=W(()=>p.value!==null&&Object.keys(LR(p.value,i.backups)).length>0),re={};function ie(){let e=(e,t)=>{qR(re[e],HR(i,e))||(t(),re[e]=HR(i,e))},t=u.value;t!==null&&(WR(i,re.control,`listener`)||(Object.assign(i.control,jR(t)),GR(i,re,`listener`)),WR(i,re.control,`auth`)||(Object.assign(i.auth,AR(t.auth)),GR(i,re,`auth`)),WR(i,re.control,`tls`)||(i.control.tlsEnabled=t.tls.enabled,GR(i,re,`tls`)));let n=f.value;n!==null&&e(`host`,()=>Object.assign(i.host,PR(n)));let r=p.value;r!==null&&e(`backups`,()=>Object.assign(i.backups,FR(r)))}function ae(){for(let e of Object.keys(re))delete re[e]}function oe(e){re[e]=HR(i,e)}M([u,l],()=>{ie()},{immediate:!0});async function se(){c.value=null;try{l.value=await Qj()}catch(e){c.value=Lj(e)}}na(()=>{se()});async function ce(){let e=b.value;if(!(Object.keys(e).length===0||a.value)){a.value=!0,o.value=null,s.value=null;try{let t=await n.saveGlobalSettings(e);if(!t){o.value=n.lastError.value??Y(`views.globalSettings.saveFailed`);return}s.value=Y(`views.globalSettings.saved`),r.success(Y(`views.globalSettings.savedToast`)),await se(),ae(),ie();let i=await QR(t);i===null?t.rebinding&&(s.value=Y(`views.globalSettings.savedRebinding`)):(s.value=null,o.value=i)}finally{a.value=!1}}}function le(){o.value=null,s.value=null,ae(),ie()}function E(){f.value!==null&&Object.assign(i.host,PR(f.value)),oe(`host`)}function ue(){p.value!==null&&Object.assign(i.backups,FR(p.value)),oe(`backups`)}function de(){if(u.value!==null){let e=jR(u.value);i.control.label=e.label,i.control.port=e.port,i.control.host=e.host,i.control.openBrowser=e.openBrowser}GR(i,re,`listener`)}function fe(){u.value!==null&&Object.assign(i.auth,AR(u.value.auth)),GR(i,re,`auth`)}function pe(){u.value!==null&&(i.control.tlsEnabled=u.value.tls.enabled),GR(i,re,`tls`)}return(e,r)=>(L(),z(gG,{sections:t.value,"nav-label":A(Y)(`views.globalSettings.navLabel`),"changes-description":A(Y)(`views.globalSettings.changesDescription`),"changed-count":x.value,changes:C.value,"save-error":o.value,"save-message":s.value,saving:a.value,onSave:ce,onDiscard:le},{header:j(()=>[B(`header`,KG,[B(`h1`,qG,O(A(Y)(`views.globalSettings.title`)),1),B(`p`,JG,O(A(Y)(`views.globalSettings.description`)),1)]),c.value?(L(),z(_H,{key:0,tone:`warn`,title:A(Y)(`views.globalSettings.loadErrorTitle`),class:`mb-4`},{default:j(()=>[H(O(c.value),1)]),_:1},8,[`title`])):U(``,!0)]),default:j(()=>[V(qW,{id:`listener`,title:A(Y)(`views.globalSettings.sectionListener`),description:A(Y)(`views.globalSettings.listenerDescription`)},{default:j(()=>[V(EW,{control:i.control,"onUpdate:control":r[0]||=e=>i.control=e,view:u.value,dirty:w.value,onReset:de},null,8,[`control`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`authentication`,title:A(Y)(`views.globalSettings.sectionAuthentication`),description:A(Y)(`views.globalSettings.authenticationDescription`)},{default:j(()=>[V(bH,{auth:i.auth,"onUpdate:auth":r[1]||=e=>i.auth=e,view:u.value,dirty:ee.value,onReset:fe},null,8,[`auth`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`host`,title:A(Y)(`views.globalSettings.sectionHost`),description:A(Y)(`views.globalSettings.hostDescription`)},{default:j(()=>[V(QU,{host:i.host,"onUpdate:host":r[2]||=e=>i.host=e,config:f.value,alerts:d.value,dirty:te.value,onReset:E},null,8,[`host`,`config`,`alerts`,`dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`backups`,title:A(Y)(`views.globalSettings.sectionBackups`),description:A(Y)(`views.globalSettings.backupsDescription`)},{default:j(()=>[V(JU,{form:i.backups,"onUpdate:form":r[3]||=e=>i.backups=e,state:m.value,policy:p.value,"config-path":y.value,workspaces:A(n).workspaces.value,dirty:ne.value,onReset:ue},null,8,[`form`,`state`,`policy`,`config-path`,`workspaces`,`dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`tls`,title:A(Y)(`views.globalSettings.sectionTls`),description:A(Y)(`views.globalSettings.tlsDescription`)},{default:j(()=>[V(WG,{"tls-enabled":i.control.tlsEnabled,"onUpdate:tlsEnabled":r[4]||=e=>i.control.tlsEnabled=e,view:u.value,dirty:T.value,onReset:pe},null,8,[`tls-enabled`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`language`,title:A(Y)(`language.label`),description:A(Y)(`views.globalSettings.languageDescription`)},{default:j(()=>[V(GG,{wide:!0}),B(`p`,YG,O(A(Y)(`views.globalSettings.languageNote`)),1)]),_:1},8,[`title`,`description`]),V(qW,{id:`interface`,title:A(Y)(`views.globalSettings.sectionInterface`),description:A(Y)(`views.globalSettings.interfaceDescription`)},{default:j(()=>[V(mW,{label:i.control.label,"onUpdate:label":r[5]||=e=>i.control.label=e,ui:h.value,"panel-version":g.value,"label-dirty":w.value,onChanged:se,onResetLabel:de},null,8,[`label`,`ui`,`panel-version`,`label-dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`paths`,title:A(Y)(`views.globalSettings.sectionPaths`),description:A(Y)(`views.globalSettings.pathsDescription`)},{default:j(()=>[V(HW,{"data-root":_.value,"project-dir":v.value,"panel-url":u.value?.url??null,workspaces:A(n).workspaces.value},null,8,[`data-root`,`project-dir`,`panel-url`,`workspaces`])]),_:1},8,[`title`,`description`])]),_:1},8,[`sections`,`nav-label`,`changes-description`,`changed-count`,`changes`,`save-error`,`save-message`,`saving`]))}}),ZG={class:`relative flex min-h-dvh items-center justify-center overflow-hidden bg-page px-4 py-10`},QG={class:`hh-enter relative w-full max-w-md`},$G={class:`mb-6 flex items-center gap-3`},eK={class:`text-lg font-semibold tracking-tight text-ink`},tK={class:`text-xs text-muted`},nK={class:`rounded-panel border border-line bg-panel/95 p-5 shadow-float backdrop-blur-sm`},rK={class:`flex items-start justify-between gap-3`},iK={class:`min-w-0`},aK={class:`text-base font-semibold text-ink`},oK={class:`mt-1 text-xs leading-relaxed text-muted`},sK={class:`flex shrink-0 items-center gap-2`},cK={class:`w-36`},lK={class:`flex flex-col gap-1.5`},uK={class:`relative`},dK=[`type`],fK=[`aria-label`],pK={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2 text-xs text-danger`},mK={key:1,class:`mt-5`},hK={class:`mt-4 space-y-2`},gK={key:0,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},_K={class:`text-2xs leading-4 text-warn`},vK={class:`mx-1 rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},yK={key:1,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},bK={class:`text-2xs leading-4 text-warn`},xK={key:2,class:`flex items-start gap-2 rounded-control border border-line-soft bg-panel-2 px-2.5 py-2`},SK={class:`text-2xs leading-4 text-muted`},CK={class:`mt-4 flex items-center justify-center gap-2 text-2xs text-faint`},wK={class:`font-mono`},TK=N({__name:`LoginView`,setup(e){let t=zg(),n=Rg(),r=XN(),{session:i,error:a,login:o,refresh:s}=pN(),c=k(``),l=k(!1),u=k(!1),d=W(()=>i.value?.passwordSet===!1),f=W(()=>i.value!==null&&!i.value.authRequired),p=W(()=>i.value?.usingDefaultPassword===!0&&i.value.defaultPassword!==null),m=W(()=>r.control.value?.auth.exposed===!0),h=W(()=>r.control.value?.url??`—`),g=W(()=>d.value?Y(`login.firstRunTitle`):f.value?Y(`login.authOffTitle`):Y(`login.title`)),_=W(()=>d.value?Y(`login.firstRunSubtitle`):f.value?Y(`login.authOffSubtitle`):Y(`login.subtitle`));async function v(){l.value=!0;try{if(await o(c.value)){c.value=``;let e=typeof t.query.next==`string`?t.query.next:`/`;await n.push(e)}}finally{l.value=!1}}async function y(){await s(),await n.push(`/`)}return na(async()=>{i.value===null&&await s()}),(e,t)=>(L(),R(`div`,ZG,[t[5]||=B(`div`,{class:`bg-instrument pointer-events-none absolute inset-0 opacity-60`},null,-1),t[6]||=B(`div`,{class:`pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_15%,var(--page)_78%)]`},null,-1),B(`div`,QG,[B(`div`,$G,[t[2]||=Os(`<span class="grid size-11 shrink-0 place-items-center rounded-panel border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),B(`div`,null,[B(`p`,eK,O(A(Y)(`app.name`)),1),B(`p`,tK,O(A(Y)(`app.tagline`)),1)])]),B(`section`,nK,[B(`div`,rK,[B(`div`,iK,[B(`h1`,aK,O(g.value),1),B(`p`,oK,O(_.value),1)]),B(`div`,sK,[m.value?(L(),z(vU,{key:0,tone:`warn`,dot:``},{default:j(()=>[H(O(A(Y)(`login.exposed`)),1)]),_:1})):U(``,!0),B(`div`,cK,[V(GG,{labelled:!1})])])]),f.value?(L(),R(`div`,mK,[V($,{variant:`primary`,size:`md`,block:``,onClick:y},{default:j(()=>[H(O(A(Y)(`login.openDashboard`)),1)]),_:1})])):(L(),R(`form`,{key:0,class:`mt-5 space-y-3`,onSubmit:lu(v,[`prevent`])},[B(`div`,lK,[B(`label`,{for:`hh-password`,class:D(A(bz))},O(A(Y)(`login.password`)),3),B(`div`,uK,[Sr(B(`input`,{id:`hh-password`,"onUpdate:modelValue":t[0]||=e=>c.value=e,type:u.value?`text`:`password`,autocomplete:`current-password`,autofocus:``,required:``,class:D(A(Q)(A(Sz),`pr-9`))},null,10,dK),[[ru,c.value]]),B(`button`,{type:`button`,class:`absolute right-1 top-1/2 grid size-7 -translate-y-1/2 place-items-center rounded-control text-faint transition-colors duration-150 hover:text-ink`,"aria-label":u.value?A(Y)(`login.hidePassword`):A(Y)(`login.showPassword`),onClick:t[1]||=e=>u.value=!u.value},[u.value?(L(),z(A(Qv),{key:0,class:`size-3.5`})):(L(),z(A($v),{key:1,class:`size-3.5`}))],8,fK)])]),A(a)?(L(),R(`p`,pK,O(A(a)),1)):U(``,!0),V($,{type:`submit`,variant:`primary`,size:`md`,block:``,loading:l.value},{default:j(()=>[V(A(cy),{class:`size-3.5`}),H(` `+O(A(Y)(`login.signIn`)),1)]),_:1},8,[`loading`])],32)),B(`div`,hK,[p.value?(L(),R(`div`,gK,[V(A(Dy),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),B(`p`,_K,[V(iB,{k:`login.defaultPasswordWarning`},{password:j(()=>[B(`code`,vK,O(A(i)?.defaultPassword),1)]),_:1})])])):d.value?(L(),R(`div`,yK,[V(A(ky),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),B(`p`,bK,[V(iB,{k:`login.noPasswordWarning`},{command:j(()=>[...t[3]||=[B(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`pnpm run auth:set-password`,-1)]]),_:1})])])):(L(),R(`div`,xK,[V(A(Oy),{class:`mt-0.5 size-3.5 shrink-0 text-ok`}),B(`p`,SK,O(A(Y)(`login.sessionNote`,{days:Math.round((A(i)?.sessionTtlMs??0)/864e5)})),1)]))])]),B(`p`,CK,[B(`span`,wK,O(h.value),1),t[4]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,null,O(A(Y)(`login.servedFromThisMachine`)),1)])])]))}}),EK=[`#3f4a5c`,`#f07178`,`#7fd88f`,`#e6b673`,`#82aaff`,`#c792ea`,`#7fdbca`,`#c7d2e3`,`#5a6779`,`#ff8b92`,`#9ae6a8`,`#f2c98a`,`#9dbaff`,`#d7aef0`,`#9ce9dc`,`#eef3fb`],DK=[`#4b5563`,`#c0392b`,`#1c7c3f`,`#9a6700`,`#2f5fe0`,`#7c3aed`,`#0b6f89`,`#334155`,`#6b7280`,`#d64535`,`#22854a`,`#a8620d`,`#3f6bff`,`#8b5cf6`,`#0e7d9c`,`#0f1722`],OK=/\u001B\[([0-9;]*)m/g,kK=/\u001B(?:\[[0-9;?]*[A-HJKSTfhilmnprsu]|\][^\u0007\u001B]*(?:\u0007|\u001B\\)?|[()][0-9A-Z])/g;function AK(e){return Math.max(0,Math.min(255,e))}function jK(e){return e===0?0:55+e*40}function MK(e,t){let n=t?EK:DK;if(e<16)return n[e]??n[7];if(e<232){let t=e-16;return`rgb(${jK(Math.floor(t/36))} ${jK(Math.floor(t%36/6))} ${jK(t%6)})`}let r=8+(e-232)*10;return`rgb(${r} ${r} ${r})`}function NK(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}}function PK(e,t,n){let r=t.length===0?[0]:t.split(`;`).map(e=>e.length===0?0:Number(e));for(let t=0;t<r.length;t+=1){let i=r[t];if(i===0)Object.assign(e,NK());else if(i===1)e.bold=!0;else if(i===2)e.dim=!0;else if(i===3)e.italic=!0;else if(i===4)e.underline=!0;else if(i===22)e.bold=!1,e.dim=!1;else if(i===23)e.italic=!1;else if(i===24)e.underline=!1;else if(i===39)e.fg=null;else if(i===49)e.bg=null;else if(i>=30&&i<=37)e.fg=(n?EK:DK)[i-30]??null;else if(i>=90&&i<=97)e.fg=(n?EK:DK)[i-90+8]??null;else if(i>=40&&i<=47)e.bg=(n?EK:DK)[i-40]??null;else if(i>=100&&i<=107)e.bg=(n?EK:DK)[i-100+8]??null;else if(i===38||i===48){let a=i===38?`fg`:`bg`,o=r[t+1];o===5&&r[t+2]!==void 0?(e[a]=MK(AK(r[t+2]),n),t+=2):o===2&&(e[a]=`rgb(${AK(r[t+2]??0)} ${AK(r[t+3]??0)} ${AK(r[t+4]??0)})`,t+=4)}}}function FK(e,t,n){if(t.length===0)return;let r=e[e.length-1];if(r&&r.fg===n.fg&&r.bg===n.bg&&r.bold===n.bold&&r.dim===n.dim&&r.italic===n.italic&&r.underline===n.underline){r.text+=t;return}e.push({text:t,...n})}function IK(e){return e.includes(`\x1B`)}function LK(e,t=!0){if(!IK(e))return[{text:e,fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}];let n=[],r=NK(),i=0;OK.lastIndex=0;let a=OK.exec(e);for(;a!==null;)FK(n,e.slice(i,a.index).replace(kK,``),r),PK(r,a[1]??``,t),i=a.index+a[0].length,a=OK.exec(e);return FK(n,e.slice(i).replace(kK,``),r),n}var RK={class:`flex h-5 w-max min-w-full items-center gap-2 whitespace-pre px-2 font-mono text-xs leading-5`},zK={key:0,class:`shrink-0 select-none text-faint`},BK={class:`min-w-0`},VK=N({__name:`LogRow`,props:{line:{},query:{},dark:{type:Boolean},showTime:{type:Boolean}},setup(e){let t=e,n=W(()=>LK(t.line.text,t.dark)),r=W(()=>{let e=t.query.trim().toLowerCase(),r=[];for(let t of n.value){if(e.length===0){r.push({text:t.text,hit:!1,span:t});continue}let n=t.text.toLowerCase(),i=0,a=n.indexOf(e);for(;a!==-1;)a>i&&r.push({text:t.text.slice(i,a),hit:!1,span:t}),r.push({text:t.text.slice(a,a+e.length),hit:!0,span:t}),i=a+e.length,a=n.indexOf(e,i);i<t.text.length&&r.push({text:t.text.slice(i),hit:!1,span:t})}return r}),i={stdout:`bg-transparent`,stderr:`bg-danger`,system:`bg-info`};function a(e){let t={};return e.span.fg&&(t.color=e.span.fg),e.span.bg&&(t.backgroundColor=e.span.bg),e.span.bold&&(t.fontWeight=`600`),e.span.dim&&(t.opacity=`0.62`),e.span.italic&&(t.fontStyle=`italic`),e.span.underline&&(t.textDecoration=`underline`),e.hit&&(t.backgroundColor=`var(--warn)`,t.color=`var(--accent-ink)`,t.borderRadius=`2px`),t}return(e,n)=>(L(),R(`div`,RK,[t.showTime?(L(),R(`span`,zK,O(A(PL)(t.line.ts)),1)):U(``,!0),B(`span`,{class:D([`h-3.5 w-0.5 shrink-0 rounded-full`,[i[t.line.stream]]]),"aria-hidden":`true`},null,2),B(`span`,BK,[(L(!0),R(I,null,P(r.value,(e,t)=>(L(),R(`span`,{key:t,style:_e(a(e))},O(e.text),5))),128))])]))}}),HK={class:`flex min-h-0 flex-col overflow-hidden rounded-panel border border-line bg-panel`},UK={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel-2/60 px-2.5 py-2`},WK={class:`relative min-w-40 flex-1 sm:max-w-72`},GK=[`placeholder`,`aria-label`],KK={class:`absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5`},qK={key:0,class:`px-1 font-mono text-2xs tabular-nums text-faint`},JK=[`aria-label`],YK=[`aria-label`],XK=[`aria-label`],ZK={class:`ml-auto flex items-center gap-1.5`},QK=[`href`,`download`],$K={class:`relative min-h-0 flex-1`},eq=[`aria-label`],tq={key:0,class:`px-3 py-6 text-center text-xs text-faint`},nq={class:`flex items-center gap-3 border-t border-line bg-panel-2/60 px-2.5 py-1.5 text-2xs text-faint`},rq={class:`flex items-center gap-1.5`},iq={class:`font-mono tabular-nums`},aq={key:0,class:`font-mono tabular-nums`},oq={class:`ml-auto hidden font-mono tabular-nums sm:inline`},sq=20,cq=12,lq=N({__name:`LogViewer`,props:{lines:{},version:{default:0},live:{type:Boolean,default:!1},emptyHint:{default:void 0},clearable:{type:Boolean,default:!1},downloadUrl:{default:void 0},downloadName:{default:void 0},minHeight:{default:`16rem`}},emits:[`clear`],setup(e,{emit:t}){let n=e,r=t,i=aP(),a=k(null),o=k(0),s=k(320),c=k(!0),l=k(`all`),u=k(``),d=k(!0),f=k(0),p=W(()=>{n.version;let e=u.value.trim().toLowerCase(),t=l.value;return e.length===0&&t===`all`?n.lines:n.lines.filter(n=>!(t!==`all`&&n.stream!==t||e.length>0&&!n.text.toLowerCase().includes(e)))}),m=W(()=>p.value.length),h=W(()=>{let e=u.value.trim().toLowerCase();if(e.length===0)return[];let t=[],n=p.value;for(let r=0;r<n.length;r+=1)n[r].text.toLowerCase().includes(e)&&t.push(r);return t}),g=W(()=>Math.max(0,Math.floor(o.value/sq)-cq)),_=W(()=>Math.min(m.value,Math.ceil((o.value+s.value)/sq)+cq)),v=W(()=>p.value.slice(g.value,_.value)),y=W(()=>h.value[f.value]??-1);function b(){let e=a.value;if(!e)return;o.value=e.scrollTop;let t=e.scrollHeight-e.scrollTop-e.clientHeight;c.value=t<12}function x(){let e=a.value;e&&(e.scrollTop=e.scrollHeight,o.value=e.scrollTop,c.value=!0)}function S(e){let t=a.value;t&&(t.scrollTop=Math.max(0,e*sq-t.clientHeight/2),o.value=t.scrollTop,c.value=!1)}function C(e){let t=h.value.length;t!==0&&(f.value=(f.value+e+t)%t,S(h.value[f.value]))}M(()=>[n.version,m.value],()=>{c.value&&(f.value=0,requestAnimationFrame(x))}),M(h,()=>{f.value=0,h.value.length>0&&u.value.trim().length>0&&requestAnimationFrame(()=>S(h.value[0]))}),M(l,()=>{c.value=!0,requestAnimationFrame(x)});let w=null;na(()=>{let e=a.value;e&&(s.value=e.clientHeight,w=new ResizeObserver(()=>{a.value&&(s.value=a.value.clientHeight)}),w.observe(e),x())}),Be(()=>{w?.disconnect(),w=null});let T=W(()=>[{value:`all`,label:Y(`logs.streamAll`)},{value:`stdout`,label:Y(`logs.streamOut`)},{value:`stderr`,label:Y(`logs.streamErr`)},{value:`system`,label:Y(`logs.streamSys`)}]);return(e,t)=>(L(),R(`div`,HK,[B(`header`,UK,[V(_W,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,options:T.value},null,8,[`modelValue`,`options`]),B(`div`,WK,[V(A(wy),{class:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),Sr(B(`input`,{"onUpdate:modelValue":t[1]||=e=>u.value=e,type:`search`,placeholder:A(Y)(`logs.searchPlaceholder`),class:D([`h-7 py-0 pl-7 text-xs`,[A(Sz)]]),"aria-label":A(Y)(`logs.searchLabel`),onKeydown:t[2]||=du(lu(e=>C(e.shiftKey?-1:1),[`prevent`]),[`enter`])},null,42,GK),[[Jl,u.value]]),B(`div`,KK,[u.value.trim().length>0?(L(),R(`span`,qK,O(h.value.length===0?`0`:`${f.value+1}/${h.value.length}`),1)):U(``,!0),u.value.length>0?(L(),R(`button`,{key:1,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.clearSearch`),onClick:t[3]||=e=>u.value=``},[V(A(zy),{class:`size-3`})],8,JK)):U(``,!0),h.value.length>0?(L(),R(`button`,{key:2,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.prevMatch`),onClick:t[4]||=e=>C(-1)},[V(A(zv),{class:`size-3`})],8,YK)):U(``,!0),h.value.length>0?(L(),R(`button`,{key:3,type:`button`,class:`grid size-5 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.nextMatch`),onClick:t[5]||=e=>C(1)},[V(A(Iv),{class:`size-3`})],8,XK)):U(``,!0)])]),B(`div`,ZK,[V(BB,{label:d.value?A(Y)(`logs.hideTimestamps`):A(Y)(`logs.showTimestamps`)},{default:j(()=>[V($,{size:`xs`,variant:`ghost`,onClick:t[6]||=e=>d.value=!d.value},{default:j(()=>[V(A(Wv),{class:D(A(Q)(`size-3`,d.value?`fill-accent text-accent`:`text-faint`))},null,8,[`class`]),H(` `+O(A(Y)(`logs.timestampsShort`)),1)]),_:1})]),_:1},8,[`label`]),V($,{size:`xs`,variant:c.value?`secondary`:`primary`,onClick:t[7]||=e=>c.value?c.value=!1:x()},{default:j(()=>[(L(),z(ha(c.value?A(hy):A(_y)),{class:`size-3`})),H(` `+O(c.value?A(Y)(`logs.pause`):A(Y)(`logs.follow`)),1)]),_:1},8,[`variant`]),n.clearable?(L(),z(BB,{key:0,label:A(Y)(`logs.clearHint`)},{default:j(()=>[V($,{size:`icon-sm`,variant:`ghost`,"aria-label":A(Y)(`logs.clearLabel`),onClick:t[8]||=e=>r(`clear`)},{default:j(()=>[V(A(Iy),{class:`size-3.5`})]),_:1},8,[`aria-label`])]),_:1},8,[`label`])):U(``,!0),n.downloadUrl?(L(),z(BB,{key:1,label:A(Y)(`logs.downloadHint`)},{default:j(()=>[B(`a`,{href:n.downloadUrl,download:n.downloadName},[V($,{size:`icon-sm`,variant:`ghost`,"aria-label":A(Y)(`logs.downloadLabel`)},{default:j(()=>[V(A(Nv),{class:`size-3.5`})]),_:1},8,[`aria-label`])],8,QK)]),_:1},8,[`label`])):U(``,!0)])]),B(`div`,$K,[B(`div`,{ref_key:`scroller`,ref:a,class:`h-full overflow-auto overscroll-contain bg-page/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50`,style:_e({minHeight:n.minHeight}),tabindex:`0`,role:`log`,"aria-label":A(Y)(`logs.outputLabel`),onScrollPassive:b},[m.value===0?(L(),R(`p`,tq,O(n.lines.length===0?n.emptyHint??A(Y)(`logs.emptyHint`):A(Y)(`logs.noMatches`)),1)):(L(),R(`div`,{key:1,class:`relative w-full`,style:_e({height:`${m.value*sq}px`})},[(L(!0),R(I,null,P(v.value,(e,t)=>(L(),R(`div`,{key:g.value+t,class:D([`absolute left-0 top-0`,g.value+t===y.value&&`bg-warn/10`]),style:_e({transform:`translateY(${(g.value+t)*sq}px)`})},[V(VK,{line:e,query:u.value,dark:A(i).isDark.value,"show-time":d.value},null,8,[`line`,`query`,`dark`,`show-time`])],6))),128))],4))],44,eq),V(Dc,{"enter-active-class":`transition duration-150`,"leave-active-class":`transition duration-100`,"enter-from-class":`opacity-0 translate-y-1`,"leave-to-class":`opacity-0 translate-y-1`},{default:j(()=>[!c.value&&m.value>0?(L(),R(`button`,{key:0,type:`button`,class:`absolute bottom-3 right-4 flex items-center gap-1.5 rounded-full border border-line bg-raise px-2.5 py-1 text-2xs text-muted shadow-float transition-colors duration-150 hover:text-ink`,onClick:x},[V(A(Nv),{class:`size-3`}),H(` `+O(A(Y)(`logs.jumpToLatest`)),1)])):U(``,!0)]),_:1})]),B(`footer`,nq,[B(`span`,rq,[B(`span`,{class:D(A(Q)(`size-1.5 rounded-full`,n.live?c.value?`bg-ok`:`bg-warn`:`bg-faint`))},null,2),H(` `+O(n.live?c.value?A(Y)(`logs.streaming`):A(Y)(`logs.paused`):A(Y)(`logs.snapshot`)),1)]),B(`span`,iq,O(m.value===n.lines.length?A(_F)(`logs.lines`,m.value):A(Y)(`logs.linesOf`,{count:m.value,total:n.lines.length})),1),u.value.trim().length>0?(L(),R(`span`,aq,O(A(Y)(`logs.matches`,{count:h.value.length})),1)):U(``,!0),B(`span`,oq,O(A(Y)(`logs.rowHeight`,{height:sq})),1)])]))}}),uq={class:`flex h-full min-h-0`},dq={class:`hidden w-64 shrink-0 flex-col border-r border-line bg-panel/40 md:flex`},fq={class:`border-b border-line px-3 py-2.5`},pq={class:`text-xs font-semibold text-ink`},mq={class:`mt-0.5 text-2xs text-faint`},hq={class:`min-h-0 flex-1 overflow-y-auto p-1.5`},gq={key:0,class:`space-y-1.5 p-1.5`},_q=[`onClick`],vq={class:`min-w-0 flex-1`},yq={key:0,class:`block truncate font-mono text-2xs text-faint`},bq={key:1,class:`block truncate font-mono text-2xs text-faint`},xq={class:`border-t border-line p-2.5`},Sq={class:`text-2xs leading-4 text-faint`},Cq={class:`flex min-w-0 flex-1 flex-col`},wq={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel/40 px-3 py-2.5`},Tq={class:`min-w-0`},Eq={class:`truncate text-sm font-semibold text-ink`},Dq={key:0,class:`ml-1.5 font-mono text-2xs font-normal text-faint`},Oq=[`aria-label`,`placeholder`],kq={key:0,class:`flex flex-wrap items-center gap-1.5 border-b border-line-soft bg-panel-2/40 px-3 py-2`},Aq=[`href`,`download`],jq={class:`text-faint`},Mq={key:1,class:`text-2xs text-faint`},Nq={key:2,class:`ml-auto font-mono text-2xs text-faint`},Pq={key:3,class:`font-mono text-2xs text-faint`},Fq={key:1,class:`flex items-center gap-1.5 border-b border-danger/25 bg-danger-soft px-3 py-2 text-2xs text-danger`},Iq={class:`min-h-0 flex-1 p-3`},Lq={class:`text-xs text-muted`},Rq=N({__name:`LogsView`,setup(e){let t=zg(),n=Rg(),r=dP(),i=k([]),a=k(null),o=k(`disk`),s=k(`2000`),c=k(``),l=k(``),u=k(null),d=k(!1),f=k(null),p=k([]),m=k(0),h=k(!1),g=k(!0),_=W(()=>i.value.find(e=>e.serverId===a.value)??null),v=YN(r.activeId,()=>o.value===`live`?a.value:null),y=v.version,b=W(()=>(y.value,v.lines())),x=W(()=>o.value===`live`?b.value:p.value),S=W(()=>o.value===`live`?y.value:m.value),C=[200,500,2e3,5e3].map(e=>({value:String(e),label:_F(`logs.lines`,e,{count:e})})),w=[{value:``,label:Y(`views.logs.allStreams`)},{value:`stdout`,label:`stdout`},{value:`stderr`,label:`stderr`},{value:`system`,label:`system`}],T=W(()=>i.value.reduce((e,t)=>e+t.sizeBytes,0)),ee=W(()=>i.value.filter(e=>e.files.length>0).length);async function te(){g.value=!0;try{i.value=await zM(r.activeId.value);let e=typeof t.query.server==`string`?t.query.server:null,n=e&&i.value.some(t=>t.serverId===e)?e:a.value&&i.value.some(e=>e.serverId===a.value)?a.value:i.value[0]?.serverId??null;a.value=n}catch(e){f.value=Lj(e)}finally{g.value=!1}}let ne=0;async function re(){let e=a.value;if(e===null||o.value===`live`)return;let t=++ne;d.value=!0,f.value=null;try{let n=await BM(r.activeId.value,e,{tail:Number(s.value),...c.value.length>0?{stream:c.value}:{},...l.value.trim().length>0?{search:l.value.trim()}:{}});if(t!==ne)return;p.value=n.lines,u.value=n.searched??null,m.value+=1}catch(e){if(t!==ne)return;f.value=Lj(e)}finally{t===ne&&(d.value=!1)}}async function ie(){let e=a.value;if(e!==null){h.value=!1;try{await VM(r.activeId.value,e),p.value=[],m.value+=1,await te()}catch(e){f.value=Lj(e)}}}function ae(e){a.value=e,o.value===`live`&&(p.value=[]),n.replace({query:{...t.query,server:e}})}M([a,s,c,o],()=>{o.value===`disk`?re():u.value=null},{immediate:!1});let oe=null;return M(l,()=>{oe!==null&&clearTimeout(oe),oe=setTimeout(()=>{oe=null,o.value===`disk`&&re()},300)}),Be(()=>{oe!==null&&clearTimeout(oe)}),M(()=>r.activeId.value,()=>{a.value=null,p.value=[],o.value=`disk`,te().then(()=>re())}),na(async()=>{await te(),o.value===`disk`&&await re()}),(e,t)=>(L(),R(`div`,uq,[B(`aside`,dq,[B(`div`,fq,[B(`p`,pq,O(A(Y)(`views.logs.persistedTitle`)),1),B(`p`,mq,O(A(Y)(`views.logs.persistedSummary`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`),persisted:ee.value,total:i.value.length,size:A(IL)(T.value)})),1)]),B(`div`,hq,[g.value?(L(),R(`div`,gq,[(L(),R(I,null,P(5,e=>V(OV,{key:e,class:`h-10 w-full`,rounded:`rounded-control`})),64))])):(L(!0),R(I,{key:1},P(i.value,e=>(L(),R(`button`,{key:e.serverId,type:`button`,class:D(A(Q)(`flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors duration-150`,e.serverId===a.value?`bg-accent-soft`:`hover:bg-hover`)),onClick:t=>ae(e.serverId)},[B(`span`,{class:D(A(Q)(`size-1.5 shrink-0 rounded-full`,A(ZI)[A(qI)[e.status].tone]))},null,2),B(`span`,vq,[B(`span`,{class:D(A(Q)(`block truncate text-xs`,e.serverId===a.value?`font-medium text-accent`:`text-ink`))},O(e.label),3),e.files.length>0?(L(),R(`span`,yq,O(A(_F)(`views.logs.filesOnDisk`,e.files.length))+` · `+O(A(IL)(e.sizeBytes)),1)):(L(),R(`span`,bq,O(A(Y)(`views.logs.nothingPersisted`)),1))])],10,_q))),128)),!g.value&&i.value.length===0?(L(),z(gL,{key:2,compact:``,title:A(Y)(`views.logs.noServersTitle`),description:A(Y)(`views.logs.noServersDescription`)},null,8,[`title`,`description`])):U(``,!0)]),B(`div`,xq,[B(`p`,Sq,O(A(Y)(`views.logs.retentionNote`)),1)])]),B(`div`,Cq,[B(`header`,wq,[B(`div`,Tq,[B(`h1`,Eq,[H(O(_.value?.label??A(Y)(`nav.logs`))+` `,1),_.value?(L(),R(`span`,Dq,O(_.value.serverId),1)):U(``,!0)])]),V(_W,{modelValue:o.value,"onUpdate:modelValue":t[0]||=e=>o.value=e,class:`ml-auto`,options:[{value:`disk`,label:A(Y)(`views.logs.modePersisted`)},{value:`live`,label:A(Y)(`views.logs.modeLive`)}]},null,8,[`modelValue`,`options`]),o.value===`disk`?(L(),z(Nz,{key:0,modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e,options:A(C),class:`w-32`,"aria-label":A(Y)(`views.logs.tailAria`)},null,8,[`modelValue`,`options`,`aria-label`])):U(``,!0),o.value===`disk`?(L(),z(Nz,{key:1,modelValue:c.value,"onUpdate:modelValue":t[2]||=e=>c.value=e,options:w,class:`w-32`,"aria-label":A(Y)(`views.logs.streamAria`)},null,8,[`modelValue`,`aria-label`])):U(``,!0),o.value===`disk`?Sr((L(),R(`input`,{key:2,"onUpdate:modelValue":t[3]||=e=>l.value=e,type:`search`,class:`w-44 min-w-0 rounded-control border border-line bg-panel px-2.5 py-1.5 text-xs text-ink outline-none transition-colors placeholder:text-faint focus:border-accent/50`,"aria-label":A(Y)(`views.logs.searchAria`),placeholder:A(Y)(`views.logs.searchPlaceholder`)},null,8,Oq)),[[Jl,l.value]]):U(``,!0),o.value===`disk`?(L(),z($,{key:3,size:`sm`,loading:d.value,onClick:re},{default:j(()=>[V(A(by),{class:`size-3.5`}),H(O(A(Y)(`views.logs.reload`)),1)]),_:1},8,[`loading`])):U(``,!0),o.value===`disk`?(L(),z($,{key:4,size:`sm`,variant:`ghost`,disabled:!_.value||_.value.files.length===0,onClick:t[4]||=e=>h.value=!0},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(O(A(Y)(`views.logs.clearFile`)),1)]),_:1},8,[`disabled`])):U(``,!0)]),_.value?(L(),R(`div`,kq,[V(A(ey),{class:`size-3.5 shrink-0 text-faint`}),_.value.files.length>0?(L(!0),R(I,{key:0},P(_.value.files,e=>(L(),R(`a`,{key:e.name,href:HM(A(r).activeId.value,_.value.serverId,e.name),download:e.name,class:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},[H(O(e.name)+` `,1),B(`span`,jq,O(A(IL)(e.sizeBytes)),1),V(A(Nv),{class:`size-3`})],8,Aq))),128)):(L(),R(`span`,Mq,O(A(Y)(`views.logs.nothingOnDisk`)),1)),o.value===`disk`&&p.value.length>0?(L(),R(`span`,Nq,O(A(Y)(`views.logs.loadedLines`,{count:p.value.length})),1)):U(``,!0),u.value===null?U(``,!0):(L(),R(`span`,Pq,` · `+O(A(Y)(`views.logs.searchedLines`,{count:u.value})),1))])):U(``,!0),f.value?(L(),R(`p`,Fq,[V(A(Vv),{class:`size-3.5`}),H(` `+O(f.value),1)])):U(``,!0),B(`div`,Iq,[_.value?d.value&&x.value.length===0?(L(),z(OV,{key:1,class:`h-full w-full`,rounded:`rounded-panel`})):(L(),z(lq,{key:2,lines:x.value,version:S.value,live:o.value===`live`,class:`h-full`,"empty-hint":o.value===`live`?A(Y)(`views.logs.waitingOutput`):A(Y)(`views.logs.fileEmpty`),"min-height":`100%`},null,8,[`lines`,`version`,`live`,`empty-hint`])):(L(),z(gL,{key:0,title:A(Y)(`views.logs.pickServerTitle`),description:A(Y)(`views.logs.pickServerDescription`)},{icon:j(()=>[V(A(Cy),{class:`size-4`})]),_:1},8,[`title`,`description`]))])]),V($z,{open:h.value,"onUpdate:open":t[6]||=e=>h.value=e,title:A(Y)(`views.logs.clearTitle`),description:A(Y)(`views.logs.clearDescription`,{server:_.value?.serverId??``}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[5]||=e=>h.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ie},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(O(A(Y)(`views.logs.clear`)),1)]),_:1})]),default:j(()=>[B(`p`,Lq,O(A(Y)(`views.logs.clearNote`)),1)]),_:1},8,[`open`,`title`,`description`])]))}}),zq={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},Bq={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},Vq={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},Hq={class:`p-4`},Uq={class:`p-4`},Wq={class:`p-4`},Gq={class:`p-4`},Kq={class:`p-4`},qq={key:0,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},Jq={class:`min-w-0`},Yq={class:`text-xs font-medium text-danger`},Xq={class:`mt-0.5 flex flex-wrap gap-x-2 text-2xs text-danger`},Zq={class:`space-y-3`},Qq={class:`flex items-center justify-between`},$q={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},eJ={key:0,class:`grid gap-4 lg:grid-cols-2`},tJ={key:2,class:`grid gap-4 lg:grid-cols-2`},nJ={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},rJ={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},iJ={class:`flex items-center gap-1`},aJ={class:`font-mono`},oJ=N({__name:`OverviewView`,setup(e){let t=XN(),n=dP(),r=k(!1),i=W(()=>t.appState.value===null),a=n.servers,o=W(()=>n.selected.value?.label??Y(`nav.workspace`)),s=W(()=>a.value.filter(e=>e.status===`running`)),c=W(()=>a.value.filter(e=>[`stopped`,`stopping`].includes(e.status))),l=W(()=>a.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),u=W(()=>{let e=0;for(let t of s.value){let n=t.resources?.rssBytes;typeof n==`number`&&(e+=n)}return e}),d=W(()=>{let e=0;for(let t of a.value){let r=CN(n.seriesOf(t.id).rss);r>e&&(e=r)}return e}),f=W(()=>{let e=0;for(let t of s.value)e+=t.resources?.cpuPercent??0;return e}),p=W(()=>{let e=a.value.map(e=>e.startedAt).filter(e=>typeof e==`number`);return e.length===0?`—`:jL(t.now.value-Math.min(...e))});return(e,m)=>{let h=pa(`RouterLink`);return L(),R(`div`,zq,[V(CV,{title:o.value,description:A(Y)(`views.overview.description`)},{actions:j(()=>[V($,{variant:`ghost`,onClick:m[0]||=e=>A(n).startAll()},{default:j(()=>[V(A(_y),{class:`size-3.5`}),H(O(A(Y)(`views.actions.startAll`)),1)]),_:1}),V($,{variant:`ghost`,onClick:m[1]||=e=>A(n).stopAll()},{default:j(()=>[V(A(jy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.stopAll`)),1)]),_:1}),V($,{variant:`primary`,onClick:m[2]||=e=>r.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1})]),_:1},8,[`title`,`description`]),V(DV,{class:`p-0`},{default:j(()=>[i.value?(L(),R(`div`,Bq,[(L(),R(I,null,P(5,e=>B(`div`,{key:e,class:`space-y-2`},[V(OV,{class:`h-2.5 w-16`}),V(OV,{class:`h-6 w-20`})])),64))])):(L(),R(`div`,Vq,[B(`div`,Hq,[V(MV,{label:A(Y)(`views.overview.running`),value:`${s.value.length}/${A(a).length}`,tone:`ok`,hint:A(Y)(`views.overview.notUp`,{count:A(a).length-s.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,Uq,[V(MV,{label:A(Y)(`views.overview.stopped`),value:String(c.value.length),hint:A(Y)(`views.overview.enabled`,{count:A(a).filter(e=>e.config.enabled).length})},null,8,[`label`,`value`,`hint`])]),B(`div`,Wq,[V(MV,{label:A(Y)(`views.overview.needsAttention`),value:String(l.value.length),tone:l.value.length>0?`danger`:`ok`,hint:l.value.length===0?A(Y)(`views.overview.nothingBroken`):A(Y)(`views.overview.crashedOrUnhealthy`)},null,8,[`label`,`value`,`tone`,`hint`])]),B(`div`,Gq,[V(MV,{label:A(Y)(`views.overview.processMemory`),value:A(LL)(u.value),hint:d.value>0?A(Y)(`views.overview.peak`,{value:A(LL)(d.value)}):A(Y)(`views.overview.acrossTree`)},null,8,[`label`,`value`,`hint`])]),B(`div`,Kq,[V(MV,{label:A(Y)(`views.overview.longestUptime`),value:p.value,hint:s.value.length>0?A(Y)(`views.overview.cpuNow`,{value:f.value.toFixed(1)}):A(Y)(`views.overview.nothingRunning`)},null,8,[`label`,`value`,`hint`])])]))]),_:1}),l.value.length>0?(L(),R(`div`,qq,[V(A(Vv),{class:`mt-0.5 size-4 shrink-0 text-danger`}),B(`div`,Jq,[B(`p`,Yq,O(A(_F)(`views.overview.needLook`,l.value.length)),1),B(`p`,Xq,[(L(!0),R(I,null,P(l.value,e=>(L(),z(h,{key:e.id,to:`/servers/${e.id}`,class:`font-mono underline-offset-2 hover:underline`},{default:j(()=>[H(O(e.id),1)]),_:2},1032,[`to`]))),128))])])])):U(``,!0),B(`section`,Zq,[B(`div`,Qq,[B(`h2`,$q,[V(A(Ty),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`nav.servers`)),1)]),V(h,{to:A(d1)(A(n).activeId.value,`servers`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:j(()=>[H(O(A(Y)(`views.overview.openFullList`)),1)]),_:1},8,[`to`])]),i.value?(L(),R(`div`,eJ,[(L(),R(I,null,P(4,e=>V(OV,{key:e,class:`h-64 w-full`,rounded:`rounded-panel`})),64))])):A(a).length===0?(L(),z(gL,{key:1,title:A(Y)(`views.overview.emptyTitle`),description:A(Y)(`views.overview.emptyDescription`)},{icon:j(()=>[V(A(Ty),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:m[3]||=e=>r.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):(L(),R(`div`,tJ,[(L(!0),R(I,null,P(A(a),e=>(L(),z(gV,{key:e.id,server:e,"workspace-id":A(n).activeId.value,series:A(n).seriesOf(e.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]),V(DV,null,{header:j(()=>[B(`h2`,nJ,[V(A(jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.overview.recentActivity`)),1)])]),actions:j(()=>[V(h,{to:A(d1)(A(n).activeId.value,`logs`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:j(()=>[H(O(A(Y)(`nav.logs`)),1)]),_:1},8,[`to`])]),default:j(()=>[V(fR,{servers:A(a),now:A(t).now.value,limit:10},null,8,[`servers`,`now`])]),_:1}),B(`p`,rJ,[B(`span`,iJ,[V(A(Fy),{class:`size-3`}),H(O(A(Y)(`views.overview.sampling`)),1)]),B(`span`,aJ,O(A(n).selected.value?.configPath),1),B(`span`,{class:D(A(Q)(`flex items-center gap-1`))},[m[5]||=B(`span`,{class:`size-1.5 rounded-full bg-ok`},null,-1),H(` `+O(A(Y)(`views.overview.workspaceLabel`,{id:A(n).activeId.value})),1)],2)]),V(dB,{open:r.value,"onUpdate:open":m[4]||=e=>r.value=e,"workspace-id":A(n).activeId.value},null,8,[`open`,`workspace-id`])])}}}),sJ=/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/i,cJ=/^(?:[a-z][a-z0-9+.-]*:\/\/)?(?<authority>[^/?#]+)/i,lJ=[`.localhost`,`.local`,`.internal`,`.home.arpa`,`.lan`,`.home`,`.test`,`.invalid`,`.example`],uJ=/^[a-z0-9][a-z0-9_-]*$/,dJ={hostRequired:()=>`a hostname is required`,hostInvalid:()=>`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,hostDuplicate:e=>`"${e}" is already routed for this path`,pathNeedsSlash:()=>`a path prefix starts with /`,pathHasSpace:()=>`a path prefix cannot contain a space`,idInvalid:()=>`the id must start with a letter or digit, then letters, digits, dash or underscore`,idDuplicate:e=>`route id "${e}" is used twice`,workspaceRequired:()=>`pick the workspace that owns the server`,serverRequired:()=>`pick a server in that workspace`,urlInvalid:()=>`an upstream like http://10.0.0.5:8080`},fJ={controlPanel:()=>`control panel`,noUpstream:()=>`no upstream`,noServerPicked:()=>`no server picked`,fallbackRetry:()=>`~8 hours`,retryOne:(e,t)=>`~${e} ${t}`,retryMany:(e,t)=>`~${e} ${t}s`},pJ=4443,mJ=4480;function hJ(e){return e.label.trim().length>0?e.label:e.id}var gJ=0;function _J(e){return e.find(e=>e.tls!==`off`&&bJ(e.host))?.host??null}function vJ(e){if(e===null||e<0)return`—`;let t=[`B`,`KiB`,`MiB`,`GiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function yJ(e){return e>0&&e<1024}function bJ(e){let t=e.trim().toLowerCase();return t.length===0||t===`localhost`||!t.includes(`.`)||lJ.some(e=>t.endsWith(e))?!1:!/^\d{1,3}(?:\.\d{1,3}){3,}$/.test(t)}function xJ(e,t){let n={};e.enabled!==t.enabled&&(n.enabled=t.enabled),e.httpPort!==t.httpPort&&(n.httpPort=t.httpPort),e.httpsPort!==t.httpsPort&&(n.httpsPort=t.httpsPort),e.email!==t.email&&(n.email=t.email),e.staging!==t.staging&&(n.staging=t.staging);let r=wJ(t.resolvers);return(e.dns01.enabled!==t.dns01||e.dns01.resolvers.join(`,`)!==r.join(`,`))&&(n.dns01={enabled:t.dns01,resolvers:r}),n}function SJ(){return{key:CJ(),id:`route`,host:``,enabled:!0,target:`server`,workspace:``,server:``,url:``,path:``,tls:`auto`,dnsAccount:``}}function CJ(){return gJ+=1,`proxy-route-${gJ}`}function wJ(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(e=>e.length>0)}function TJ(e,t,n){let r=xJ(e,t),i=AJ(e.routes,n);return i!==null&&(r.routes=i),Object.keys(r).length===0?null:r}function EJ(e,t){return e.staging||e.email.trim().length>0?!1:t.some(e=>e.tls!==`off`&&bJ(e.host))}function DJ(e,t=fJ){if(e===null)return t.fallbackRetry();if(e<60)return e===1?t.retryOne(e,`minute`):t.retryMany(e,`minute`);let n=Math.max(1,Math.round(e/60));return n===1?t.retryOne(n,`hour`):t.retryMany(n,`hour`)}function OJ(e,t,n){let r=e.host.trim();if(r.length===0)return null;let i=e.tls===`off`,a=i?t:n,o=i?80:443,s=e.path.length===0||e.path.startsWith(`/`)?e.path:`/${e.path}`;return`${i?`http`:`https`}://${r}${a===o?``:`:${a}`}${s}`}function kJ(e,t){return e.length===t.length&&e.every((e,n)=>jJ(e,t[n]))}function AJ(e,t){return kJ(e,t)?null:IJ(t)}function jJ(e,t){return JSON.stringify(LJ(e))===JSON.stringify(LJ(t))}function MJ(e){return NJ(e,`certificate`)}function NJ(e,t){let n=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40).replace(/-+$/,``);return n.length===0?t:/^[a-z0-9]/.test(n)?n:`r-${n}`}function PJ(e){return NJ(e,`route`)}function FJ(e,t,n=fJ){return e.target===`panel`?n.controlPanel():e.target===`external`?e.url.trim().length>0?e.url.trim():n.noUpstream():e.workspace.length===0||e.server.length===0?n.noServerPicked():`${t.find(t=>t.id===e.workspace)?.label??e.workspace} / ${e.server}`}function IJ(e){return e.map(LJ)}function LJ(e){return{id:e.id,host:e.host,enabled:e.enabled,target:e.target,workspace:e.workspace,server:e.server,url:e.url,path:e.path,tls:e.tls,dnsAccount:e.dnsAccount}}function RJ(e,t){return zJ(e,t)}function zJ(e,t){let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}-${r}`);)r+=1;return`${e}-${r}`}function BJ(e,t){return zJ(e,t)}function VJ(e){return e.httpPort===4480&&e.httpsPort===4443}function HJ(e,t){let n={...dJ,...t.messages},r={},i=e.host.trim();if(i.length===0?r.host=n.hostRequired():sJ.test(i)?t.others.some(t=>t.host.trim().toLowerCase()===i.toLowerCase()&&t.path.replace(/\/+$/,``)===e.path.replace(/\/+$/,``))&&(r.host=n.hostDuplicate(i)):r.host=n.hostInvalid(),e.path.length>0&&!e.path.startsWith(`/`)?r.path=n.pathNeedsSlash():/\s/.test(e.path)&&(r.path=n.pathHasSpace()),uJ.test(e.id)?t.others.some(t=>t.id===e.id)&&(r.id=n.idDuplicate(e.id)):r.id=n.idInvalid(),e.target===`server`){let i=t.workspaces.find(t=>t.id===e.workspace);e.workspace.length===0||i===void 0?r.workspace=n.workspaceRequired():(e.server.length===0||!i.servers.some(t=>t.id===e.server))&&(r.server=n.serverRequired())}e.target===`external`&&UJ(e.url)===null&&(r.url=n.urlInvalid());let a=YA({...LJ(e),host:i});return a instanceof J.errors&&Object.keys(r).length===0&&(r.form=a.summary),r}function UJ(e){let t=e.trim();if(t.length===0)return null;let n=cJ.exec(t)?.groups?.authority;if(n===void 0||n.length===0||n.endsWith(`:`)||/\s/.test(n))return null;let r=t.slice(0,t.indexOf(`:`)).toLowerCase(),i=n.lastIndexOf(`:`);if(i<=0)return{host:n,port:r===`https`?`443`:`80`};let a=n.slice(i+1);return/^\d{1,5}$/.test(a)?{host:n.slice(0,i),port:a}:null}var WJ=[{value:`server`,labelKey:`proxy.target.server`},{value:`panel`,labelKey:`proxy.target.panel`},{value:`external`,labelKey:`proxy.target.external`}],GJ=[{value:`auto`,labelKey:`proxy.tls.auto`},{value:`off`,labelKey:`proxy.tls.off`},{value:`manual`,labelKey:`proxy.tls.manual`}],KJ={off:{labelKey:`proxy.status.off`,tone:`neutral`,transitional:!1},stopped:{labelKey:`proxy.status.stopped`,tone:`neutral`,transitional:!1},starting:{labelKey:`proxy.status.starting`,tone:`warn`,transitional:!0},running:{labelKey:`proxy.status.running`,tone:`ok`,transitional:!1},error:{labelKey:`proxy.status.error`,tone:`danger`,transitional:!1},unsupported:{labelKey:`proxy.status.unsupported`,tone:`warn`,transitional:!1}},qJ={ok:{labelKey:`proxy.status.serving`,tone:`ok`},disabled:{labelKey:`proxy.status.disabled`,tone:`neutral`},"no-upstream":{labelKey:`proxy.status.noUpstream`,tone:`warn`},error:{labelKey:`proxy.status.error`,tone:`danger`}},JJ={off:null,local:{labelKey:`proxy.status.localCa`,tone:`neutral`},uploaded:{labelKey:`proxy.status.uploaded`,tone:`info`},issued:{labelKey:`proxy.status.certified`,tone:`ok`},pending:{labelKey:`proxy.status.awaitingCa`,tone:`warn`},failed:{labelKey:`proxy.status.failed`,tone:`danger`},fallback:{labelKey:`proxy.status.fellBack`,tone:`warn`}};function YJ(e){let t=e.certificate;if(t===void 0)return null;let n=JJ[t.state]??null;return n===null?null:{...n,message:t.message,retryInMinutes:t.retryInMinutes??null}}function XJ(e){return{enabled:e.enabled,httpPort:e.httpPort,httpsPort:e.httpsPort,email:e.email,staging:e.staging,dns01:e.dns01.enabled,resolvers:e.dns01.resolvers.join(`, `)}}function ZJ(e){let t=[{value:``,label:Y(`proxy.account.automatic`)}];for(let n of e){let e=n.label.length>0?n.label:n.account,r=[n.writesTxt?null:Y(`proxy.account.noTxt`),n.writesTxt&&!n.hasCredentials?Y(`proxy.account.noCredentials`):null].filter(e=>e!==null);t.push({value:`${n.workspace}/${n.account}`,label:`${e} · ${n.provider} · ${n.workspace}${r.length>0?` (${r.join(`, `)})`:``}`})}return t}function QJ(e){return{...XJ(e)}}function $J(e){return structuredClone(dn(e)).map(e=>({...e,key:CJ()}))}function eY(e,t,n){return t===null?[...e,n]:e.map(e=>e.id===t.id?n:e)}function tY(e){return e.tls===`off`?Y(`proxy.tls.plain`):e.tls===`manual`?Y(`proxy.tls.uploaded`):bJ(e.host)?Y(`proxy.tls.letsEncrypt`):Y(`proxy.tls.engineCa`)}var nY={controlPanel:()=>Y(`proxy.target.controlPanel`),noUpstream:()=>Y(`proxy.target.noUpstream`),noServerPicked:()=>Y(`proxy.target.noServer`),fallbackRetry:()=>Y(`proxy.retry.inFallback`),retryOne:(e,t)=>_F(`proxy.retry.in${t===`minute`?`Minutes`:`Hours`}`,e),retryMany:(e,t)=>_F(`proxy.retry.in${t===`minute`?`Minutes`:`Hours`}`,e)},rY={hostRequired:()=>Y(`proxy.validation.hostRequired`),hostInvalid:()=>Y(`proxy.validation.hostPattern`),hostDuplicate:e=>Y(`proxy.validation.hostTaken`,{host:e}),pathNeedsSlash:()=>Y(`proxy.validation.pathSlash`),pathHasSpace:()=>Y(`proxy.validation.pathSpace`),idInvalid:()=>Y(`proxy.validation.idPattern`),idDuplicate:e=>Y(`proxy.validation.idTaken`,{id:e}),workspaceRequired:()=>Y(`proxy.validation.workspaceRequired`),serverRequired:()=>Y(`proxy.validation.serverRequired`),urlInvalid:()=>Y(`proxy.validation.url`)};function iY(e,t){return FJ(e,t,nY)}function aY(e){return DJ(e,nY)}var oY={class:`grid gap-3 sm:grid-cols-2`},sY={class:`grid gap-3 sm:grid-cols-2`},cY={class:`flex min-w-0 flex-col gap-1`},lY={class:`flex min-w-0 flex-col gap-1`},uY=N({__name:`CertificateDialog`,props:za({taken:{},busy:{type:Boolean},error:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`submit`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=k(``),o=k(``),s=k(``),c=k(``),l=k({}),u=k(!1),d=Q(Sz,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`),f=W(()=>RJ(MJ(a.value),n.taken)),p=W(()=>!n.busy&&a.value.trim().length>0&&s.value.trim().length>0&&c.value.trim().length>0);function m(e){o.value=e,u.value=e.trim().length>0}M([a,()=>n.taken],()=>{u.value||(o.value=f.value)},{immediate:!0}),M(i,e=>{e&&(a.value=``,o.value=``,s.value=``,c.value=``,l.value={},u.value=!1)});async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?s.value=r:c.value=r}function g(){let e=a.value.trim(),t=o.value.trim(),i={};e.length===0&&(i.label=Y(`proxy.certificateDialog.errorLabel`)),uJ.test(t)?n.taken.includes(t)&&(i.id=Y(`proxy.certificateDialog.errorTaken`,{id:t})):i.id=Y(`proxy.certificateDialog.errorId`),s.value.trim().length===0&&(i.certificate=Y(`proxy.certificateDialog.errorCertificate`)),c.value.trim().length===0&&(i.privateKey=Y(`proxy.certificateDialog.errorPrivateKey`)),l.value=i,!(Object.keys(i).length>0)&&r(`submit`,{id:t,label:e,certificate:s.value,privateKey:c.value})}return(e,t)=>(L(),z($z,{open:i.value,"onUpdate:open":t[6]||=e=>i.value=e,title:A(Y)(`proxy.certificateDialog.title`),description:A(Y)(`proxy.certificateDialog.description`)},{footer:j(()=>[V($,{variant:`ghost`,disabled:n.busy,onClick:t[5]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:!p.value,loading:n.busy,onClick:g},{default:j(()=>[H(O(A(Y)(`proxy.certificateDialog.store`)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`form`,{class:`space-y-3`,onSubmit:lu(g,[`prevent`])},[B(`div`,oY,[V(Rz,{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:A(Y)(`proxy.certificateDialog.label`),placeholder:A(Y)(`proxy.certificateDialog.labelPlaceholder`),error:l.value.label},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(Rz,{"model-value":o.value,label:A(Y)(`proxy.certificateDialog.id`),hint:A(Y)(`proxy.certificateDialog.idHint`),error:l.value.id,"onUpdate:modelValue":m},null,8,[`model-value`,`label`,`hint`,`error`])]),B(`div`,sY,[B(`div`,cY,[B(`label`,{class:D(A(bz)),for:`proxy-cert-file`},O(A(Y)(`proxy.certificateDialog.certFile`)),3),B(`input`,{id:`proxy-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:D(A(d)),onChange:t[1]||=e=>h(e,`cert`)},null,34)]),B(`div`,lY,[B(`label`,{class:D(A(bz)),for:`proxy-cert-key`},O(A(Y)(`proxy.certificateDialog.keyFile`)),3),B(`input`,{id:`proxy-cert-key`,type:`file`,accept:`.pem,.key,text/plain`,class:D(A(d)),onChange:t[2]||=e=>h(e,`key`)},null,34)])]),V(rB,{modelValue:s.value,"onUpdate:modelValue":t[3]||=e=>s.value=e,label:A(Y)(`proxy.certificateDialog.pasteCert`),rows:4,placeholder:A(Y)(`proxy.certificateDialog.certPlaceholder`),error:l.value.certificate},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(rB,{modelValue:c.value,"onUpdate:modelValue":t[4]||=e=>c.value=e,label:A(Y)(`proxy.certificateDialog.pasteKey`),rows:4,placeholder:A(Y)(`proxy.certificateDialog.keyPlaceholder`),error:l.value.privateKey},null,8,[`modelValue`,`label`,`placeholder`,`error`]),n.error?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(n.error),1)]),_:1})):U(``,!0)],32)]),_:1},8,[`open`,`title`,`description`]))}}),dY={key:0,class:`sm:col-span-2`},fY={key:1,class:`space-y-2 sm:col-span-2`},pY={class:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},mY={class:`min-w-0 text-xs font-medium text-ink`},hY={class:`ml-1.5 font-mono text-2xs text-faint`},gY={key:0,class:`mt-2`},_Y={key:1,class:`mt-2 divide-y divide-line-soft text-2xs`},vY={class:`flex items-start justify-between gap-4 py-1`},yY={class:`text-muted`},bY={class:`min-w-0 text-right font-mono text-ink`},xY={class:`flex items-start justify-between gap-4 py-1`},SY={class:`text-muted`},CY={class:`min-w-0 text-right font-mono text-ink`},wY={class:`flex items-start justify-between gap-4 py-1`},TY={class:`text-muted`},EY={class:`font-mono text-ink`},DY={class:`flex items-start justify-between gap-4 py-1`},OY={class:`shrink-0 text-muted`},kY={class:`min-w-0 text-right font-mono text-ink`},AY={key:1,class:`text-faint`},jY={class:`mt-2 flex justify-end`},MY={class:`text-xs font-semibold text-ink`},NY={class:`mt-1 text-2xs leading-4 text-muted`},PY={class:`mt-2.5 flex justify-end gap-1.5`},FY={key:2,class:`space-y-2 sm:col-span-2`},IY=N({__name:`CertificatePanel`,props:{certificates:{},disabled:{type:Boolean}},emits:[`changed`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=k(!1),o=k(null),s=k(null),c=k(null),l=W(()=>n.certificates.map(e=>e.id));async function u(e,t){a.value=!0,o.value=null,s.value=null;try{return r(`changed`,await e()),s.value=t,!0}catch(e){return o.value=Lj(e),!1}finally{a.value=!1}}async function d(e){await u(()=>dM(e.id,e.label,e.certificate,e.privateKey),Y(`proxy.certificate.stored`,{label:e.label}))&&(i.value=!1)}function f(e){c.value=null,u(()=>Jj(e.id),Y(`proxy.certificate.removed`,{name:hJ(e)}))}return(e,t)=>(L(),z(gz,{title:A(Y)(`proxy.certificate.title`),description:A(Y)(`proxy.certificate.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`secondary`,disabled:n.disabled||a.value,onClick:t[0]||=e=>i.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(` `+O(A(Y)(`proxy.certificate.add`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[n.certificates.length===0?(L(),R(`div`,dY,[V(gL,{compact:``,title:A(Y)(`proxy.certificate.emptyTitle`),description:A(Y)(`proxy.certificate.emptyDescription`)},{icon:j(()=>[V(A(iy),{class:`size-5`})]),action:j(()=>[V($,{variant:`primary`,disabled:n.disabled||a.value,onClick:t[1]||=e=>i.value=!0},{default:j(()=>[H(O(A(Y)(`proxy.certificateDialog.title`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`title`,`description`])])):(L(),R(`ul`,fY,[(L(!0),R(I,null,P(n.certificates,e=>(L(),R(`li`,{key:e.id,class:`rounded-panel border border-line bg-page/40 p-3`},[B(`div`,pY,[B(`p`,mY,[H(O(A(hJ)(e))+` `,1),B(`span`,hY,O(e.id),1)]),e.daysRemaining===null?U(``,!0):(L(),R(`span`,{key:0,class:D([`text-2xs tabular-nums`,e.daysRemaining<14?`text-warn`:`text-faint`])},O(A(Y)(`proxy.certificate.daysLeft`,{days:e.daysRemaining})),3))]),e.error?(L(),R(`div`,gY,[V(_H,{tone:`danger`},{default:j(()=>[H(O(e.error),1)]),_:2},1024)])):(L(),R(`dl`,_Y,[B(`div`,vY,[B(`dt`,yY,O(A(Y)(`proxy.certificate.subject`)),1),B(`dd`,bY,O(e.subject??`—`),1)]),B(`div`,xY,[B(`dt`,SY,O(A(Y)(`proxy.certificate.issuer`)),1),B(`dd`,CY,O(e.issuer??`—`),1)]),B(`div`,wY,[B(`dt`,TY,O(A(Y)(`proxy.certificate.validUntil`)),1),B(`dd`,EY,O(e.validTo?e.validTo.slice(0,10):`—`),1)]),B(`div`,DY,[B(`dt`,OY,O(A(Y)(`proxy.certificate.covers`)),1),B(`dd`,kY,[e.hosts.length>0?(L(),R(I,{key:0},[H(O(e.hosts.join(`, `)),1)],64)):(L(),R(`span`,AY,O(A(Y)(`proxy.certificate.noSans`)),1))])])])),B(`div`,jY,[V(A(Wh),{open:c.value===e.id,"onUpdate:open":t=>c.value=t?e.id:null},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`danger-ghost`,disabled:a.value,"aria-label":A(Y)(`proxy.certificate.removeAria`,{name:A(hJ)(e)})},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(` `+O(A(Y)(`common.remove`)),1)]),_:1},8,[`disabled`,`aria-label`])]),_:2},1024),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`end`,class:D(A(Q)(`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float`,`focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`))},{default:j(()=>[B(`p`,MY,O(A(Y)(`proxy.certificate.removeQuestion`,{name:A(hJ)(e)})),1),B(`p`,NY,O(A(Y)(`proxy.certificate.removeBody`)),1),B(`div`,PY,[V(A(Gh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`danger`,loading:a.value,onClick:t=>f(e)},{default:j(()=>[H(O(A(Y)(`proxy.certificate.removeIt`)),1)]),_:1},8,[`loading`,`onClick`])])]),_:2},1032,[`class`])]),_:2},1024)]),_:2},1032,[`open`,`onUpdate:open`])])]))),128))])),o.value||s.value?(L(),R(`div`,FY,[o.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0),s.value?(L(),z(_H,{key:1,tone:`ok`},{default:j(()=>[H(O(s.value),1)]),_:1})):U(``,!0)])):U(``,!0),V(uY,{open:i.value,"onUpdate:open":t[2]||=e=>i.value=e,taken:l.value,busy:a.value,error:o.value,onSubmit:d},null,8,[`open`,`taken`,`busy`,`error`])]),_:1},8,[`title`,`description`]))}}),LY={key:0,class:`sm:col-span-2`},RY={key:0,class:`sm:col-span-2`},zY={key:1,class:`sm:col-span-2`},BY={class:`divide-y divide-line-soft text-xs sm:col-span-2`},VY={class:`flex items-start justify-between gap-4 py-1.5`},HY={class:`text-muted`},UY={class:`font-mono text-xs text-ink`},WY={class:`flex items-start justify-between gap-4 py-1.5`},GY={class:`text-muted`},KY={class:`text-right text-xs text-ink`},qY={key:0,class:`flex items-start justify-between gap-4 py-1.5`},JY={class:`text-muted`},YY={class:`font-mono text-xs tabular-nums text-ink`},XY={key:1,class:`flex items-start justify-between gap-4 py-1.5`},ZY={class:`text-muted`},QY={class:`flex min-w-0 items-center gap-1.5`},$Y={class:`min-w-0 truncate font-mono text-2xs text-ink`},eX={class:`flex items-start justify-between gap-4 py-1.5`},tX={class:`text-muted`},nX={class:`flex flex-wrap items-center justify-end gap-x-2 gap-y-1 text-right font-mono text-xs`},rX=[`href`],iX={key:0,class:`text-ink`},aX={class:`flex items-start justify-between gap-4 py-1.5`},oX={class:`text-muted`},sX={class:`font-mono text-xs tabular-nums text-ink`},cX={class:`flex items-start justify-between gap-4 py-1.5`},lX={class:`text-muted`},uX={class:`text-xs text-ink`},dX={class:`flex flex-wrap gap-1.5 sm:col-span-2`},fX=[`href`],pX={key:3,class:`sm:col-span-2`},mX={key:4,class:`text-2xs leading-4 text-faint sm:col-span-2`},hX={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},gX={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},_X=N({__name:`EnginePanel`,props:{view:{},busy:{}},emits:[`act`],setup(e,{emit:t}){let n=e,r=t,i=W(()=>n.view?.engine??null),a=W(()=>n.view?.status??null),o=W(()=>n.view?.engines[0]??null),s=W(()=>a.value===null?null:KJ[a.value.state]),c=W(()=>i.value?.installed===!0),l=W(()=>i.value?.path??null),u=W(()=>l.value===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${l.value}`),d=[{key:`acme`,labelKey:`proxy.engine.acme`},{key:`internalCa`,labelKey:`proxy.engine.localCa`},{key:`dns01`,labelKey:`proxy.engine.dns01`},{key:`tcp`,labelKey:`proxy.engine.tcpUdp`}];return(e,t)=>(L(),z(gz,{title:A(Y)(`proxy.engine.title`),description:A(Y)(`proxy.engine.description`)},{actions:j(()=>[s.value?(L(),z(vU,{key:0,tone:s.value.tone,dot:``},{default:j(()=>[H(O(A(Y)(s.value.labelKey)),1)]),_:1},8,[`tone`])):U(``,!0)]),default:j(()=>[i.value===null?(L(),R(`div`,LY,[V(_H,{tone:`info`},{default:j(()=>[H(O(A(Y)(`proxy.engine.notInFrame`)),1)]),_:1})])):(L(),R(I,{key:1},[i.value.error?(L(),R(`div`,RY,[V(_H,{tone:`danger`,title:A(Y)(`proxy.engine.readFailed`)},{default:j(()=>[H(O(i.value.error),1)]),_:1},8,[`title`])])):U(``,!0),c.value?(L(),R(I,{key:2},[B(`dl`,BY,[B(`div`,VY,[B(`dt`,HY,O(A(Y)(`proxy.engine.version`)),1),B(`dd`,UY,O(i.value.version??A(Y)(`proxy.engine.notProbed`)),1)]),B(`div`,WY,[B(`dt`,GY,O(A(Y)(`proxy.engine.source`)),1),B(`dd`,KY,O(i.value.source===`custom`?A(Y)(`proxy.engine.sourceCustom`):A(Y)(`proxy.engine.sourceDownloaded`)),1)]),i.value.bytes===null?U(``,!0):(L(),R(`div`,qY,[B(`dt`,JY,O(A(Y)(`proxy.engine.size`)),1),B(`dd`,YY,O(A(vJ)(i.value.bytes)),1)])),l.value?(L(),R(`div`,XY,[B(`dt`,ZY,O(A(Y)(`proxy.engine.binary`)),1),B(`dd`,QY,[B(`span`,$Y,O(l.value),1),V(gU,{value:l.value,label:A(Y)(`proxy.engine.copyPath`)},null,8,[`value`,`label`])])])):U(``,!0),B(`div`,eX,[B(`dt`,tX,O(A(Y)(`proxy.engine.address`)),1),B(`dd`,nX,[(L(!0),R(I,null,P(a.value?.urls??[],e=>(L(),R(`a`,{key:e,href:e,target:`_blank`,rel:`noreferrer`,class:`text-accent underline decoration-line underline-offset-2 hover:decoration-accent`},O(e),9,rX))),128)),!a.value||a.value.urls.length===0?(L(),R(`span`,iX,`—`)):U(``,!0)])]),B(`div`,aX,[B(`dt`,oX,O(A(Y)(`proxy.engine.process`)),1),B(`dd`,sX,O(a.value?.pid??`—`),1)]),B(`div`,cX,[B(`dt`,lX,O(A(Y)(`proxy.engine.certificates`)),1),B(`dd`,uX,O(a.value?.certExpiryDays===null||a.value?.certExpiryDays===void 0?A(Y)(`proxy.engine.noCert`):A(Y)(`proxy.engine.expiresSoon`,{days:a.value.certExpiryDays})),1)])]),B(`div`,dX,[(L(),R(I,null,P(d,e=>V(vU,{key:e.key,tone:o.value?.[e.key]?`ok`:`neutral`},{default:j(()=>[H(O(o.value?.[e.key]?`✓`:`✗`)+` `+O(A(Y)(e.labelKey)),1)]),_:2},1032,[`tone`])),64)),o.value?(L(),R(`a`,{key:0,class:`ml-1 self-center text-2xs text-accent underline decoration-line underline-offset-2`,href:o.value.docsUrl,target:`_blank`,rel:`noreferrer`},O(A(Y)(`proxy.engine.documentation`,{engine:o.value.label})),9,fX)):U(``,!0)])],64)):(L(),R(`div`,zY,[V(_H,{tone:`info`,title:A(Y)(`proxy.engine.notInstalled`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.installNote`,{engine:o.value?.label??i.value.id})),1)]),_:1},8,[`title`])])),a.value?.lastError?(L(),R(`div`,pX,[V(_H,{tone:`danger`,title:A(Y)(`proxy.engine.failed`)},{default:j(()=>[H(O(a.value.lastError),1)]),_:1},8,[`title`])])):U(``,!0),c.value&&u.value?(L(),R(`p`,mX,[H(O(A(Y)(`proxy.engine.setcapHint`))+` `,1),B(`code`,hX,O(u.value),1),V(gU,{value:u.value,label:A(Y)(`proxy.engine.copyCommand`),class:`ml-1 align-middle`},null,8,[`value`,`label`])])):U(``,!0)],64)),B(`div`,gX,[c.value?(L(),R(I,{key:1},[V($,{variant:`primary`,disabled:n.busy!==null||a.value?.state===`running`,loading:n.busy===`start`,onClick:t[1]||=e=>r(`act`,`start`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.start`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state===`off`||a.value?.state===`stopped`,loading:n.busy===`stop`,onClick:t[2]||=e=>r(`act`,`stop`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.stop`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`apply`,onClick:t[3]||=e=>r(`act`,`apply`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.apply`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`ghost`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`revert`,title:A(Y)(`proxy.engine.revertHint`),onClick:t[4]||=e=>r(`act`,`revert`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.revert`)),1)]),_:1},8,[`disabled`,`loading`,`title`]),V($,{variant:`ghost`,disabled:n.busy!==null,loading:n.busy===`install`,onClick:t[5]||=e=>r(`act`,`install`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.update`)),1)]),_:1},8,[`disabled`,`loading`])],64)):(L(),z($,{key:0,variant:`primary`,loading:n.busy===`install`,disabled:n.busy!==null,onClick:t[0]||=e=>r(`act`,`install`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.install`)),1)]),_:1},8,[`loading`,`disabled`]))])]),_:1},8,[`title`,`description`]))}}),vX={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},yX={key:0,class:`text-2xs text-faint`},bX={key:0,class:`sm:col-span-2`},xX={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},SX={key:1},CX={key:1,class:`sm:col-span-2`},wX={key:3,class:`sm:col-span-2`},TX={key:4,class:`sm:col-span-2`},EX={key:5,class:`text-2xs leading-4 text-faint sm:col-span-2`},DX={class:`text-2xs leading-4 text-faint sm:col-span-2`},OX=N({__name:`ListenerPanel`,props:za({emailHost:{},enginePath:{},dnsAccounts:{}},{form:{required:!0},formModifiers:{}}),emits:[`update:form`],setup(e){let t=e,n=so(e,`form`),r=W(()=>t.dnsAccounts.filter(e=>e.writesTxt&&e.hasCredentials)),i=W(()=>VJ(n.value)),a=W(()=>t.enginePath===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${t.enginePath}`),o=W(()=>yJ(n.value.httpPort)||yJ(n.value.httpsPort));function s(){n.value.httpPort=mJ,n.value.httpsPort=pJ}function c(){n.value.httpPort=80,n.value.httpsPort=443}function l(e,t){e===null||Number.isNaN(e)||e>=1&&e<=65535&&(n.value[t]=Math.trunc(e))}return(e,u)=>(L(),z(gz,{title:A(Y)(`proxy.listener.title`),description:A(Y)(`proxy.listener.description`)},{actions:j(()=>[i.value?(L(),z(vU,{key:0,tone:`info`},{default:j(()=>[H(O(A(Y)(`proxy.listener.unprivilegedPorts`)),1)]),_:1})):U(``,!0)]),default:j(()=>[V(Vz,{modelValue:n.value.enabled,"onUpdate:modelValue":u[0]||=e=>n.value.enabled=e,label:A(Y)(`proxy.listener.run`),hint:A(Y)(`proxy.listener.runHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{"model-value":n.value.httpPort,label:A(Y)(`proxy.listener.httpPort`),min:1,max:65535,hint:A(Y)(`proxy.listener.httpPortHint`),"onUpdate:modelValue":u[1]||=e=>l(e,`httpPort`)},null,8,[`model-value`,`label`,`hint`]),V(Dz,{"model-value":n.value.httpsPort,label:A(Y)(`proxy.listener.httpsPort`),min:1,max:65535,hint:A(Y)(`proxy.listener.httpsPortHint`),"onUpdate:modelValue":u[2]||=e=>l(e,`httpsPort`)},null,8,[`model-value`,`label`,`hint`]),B(`div`,vX,[V($,{size:`xs`,variant:`secondary`,onClick:s},{default:j(()=>[H(O(A(Y)(`proxy.listener.useFallback`,{http:A(mJ),https:A(pJ)})),1)]),_:1}),V($,{size:`xs`,variant:`ghost`,onClick:c},{default:j(()=>[H(O(A(Y)(`proxy.listener.useStandard`)),1)]),_:1}),i.value?(L(),R(`span`,yX,O(A(Y)(`proxy.listener.forwardHint`)),1)):U(``,!0)]),o.value?(L(),R(`div`,bX,[V(_H,{tone:`warn`,title:A(Y)(`proxy.listener.privilegedTitle`)},{default:j(()=>[V(iB,{k:`proxy.listener.privilegedBody`,params:{http:A(mJ),https:A(pJ)}},{how:j(()=>[a.value?(L(),R(I,{key:0},[B(`code`,xX,O(a.value),1),V(gU,{value:a.value,label:A(Y)(`proxy.engine.copyCommand`),class:`ml-1 align-middle`},null,8,[`value`,`label`])],64)):(L(),R(`span`,SX,[V(iB,{k:`proxy.listener.privilegedWithSetcap`},{command:j(()=>[...u[7]||=[B(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`setcap`,-1)]]),_:1})]))]),_:1},8,[`params`])]),_:1},8,[`title`])])):U(``,!0),V(Rz,{modelValue:n.value.email,"onUpdate:modelValue":u[3]||=e=>n.value.email=e,label:A(Y)(`proxy.listener.email`),placeholder:A(Y)(`proxy.listener.emailPlaceholder`),hint:A(Y)(`proxy.listener.emailHint`),wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),t.emailHost===null?U(``,!0):(L(),R(`div`,CX,[V(_H,{tone:`warn`,title:A(Y)(`proxy.listener.emailNeededTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.emailNeededBody`,{host:t.emailHost})),1)]),_:1},8,[`title`])])),V(Vz,{modelValue:n.value.staging,"onUpdate:modelValue":u[4]||=e=>n.value.staging=e,label:A(Y)(`proxy.listener.staging`),hint:A(Y)(`proxy.listener.stagingHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:n.value.dns01,"onUpdate:modelValue":u[5]||=e=>n.value.dns01=e,label:A(Y)(`proxy.listener.dns01`),hint:A(Y)(`proxy.listener.dns01Hint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),n.value.dns01?(L(),z(Rz,{key:2,modelValue:n.value.resolvers,"onUpdate:modelValue":u[6]||=e=>n.value.resolvers=e,label:A(Y)(`proxy.listener.resolvers`),placeholder:A(Y)(`proxy.listener.resolversPlaceholder`),hint:A(Y)(`proxy.listener.resolversHint`),spellcheck:`false`,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`])):U(``,!0),n.value.dns01&&r.value.length===0?(L(),R(`div`,wX,[V(_H,{tone:`warn`,title:A(Y)(`proxy.listener.noAccountTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.noAccountBody`)),1)]),_:1},8,[`title`])])):n.value.dns01&&r.value.length>1?(L(),R(`div`,TX,[V(_H,{tone:`info`,title:A(Y)(`proxy.listener.manyAccountsTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.manyAccountsBody`)),1)]),_:1},8,[`title`])])):U(``,!0),n.value.dns01?(L(),R(`p`,EX,O(A(Y)(`proxy.listener.accountNote`)),1)):U(``,!0),B(`p`,DX,O(A(Y)(`proxy.listener.pendingNote`)),1)]),_:1},8,[`title`,`description`]))}}),kX={class:`space-y-3`},AX={key:1,class:`text-2xs leading-4 text-faint sm:col-span-2`},jX={class:`text-2xs leading-4 text-faint sm:col-span-2`},MX={key:4,class:`text-2xs leading-4 text-warn sm:col-span-2`},NX=N({__name:`RouteDialog`,props:za({draft:{},others:{},workspaces:{},dnsAccounts:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:za([`save`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`open`),a=k(SJ()),o=k({}),s=W(()=>n.draft!==null),c=W(()=>(n.workspaces.find(e=>e.id===a.value.workspace)?.servers??[]).map(e=>({value:e.id,label:e.id}))),l=W(()=>WJ.map(e=>({value:e.value,label:Y(e.labelKey)}))),u=W(()=>GJ.map(e=>({value:e.value,label:Y(e.labelKey)}))),d=W(()=>a.value.tls===`off`?Y(`proxy.tls.hintOff`):a.value.tls===`manual`?Y(`proxy.tls.hintManual`):a.value.host.trim().length===0?Y(`proxy.tls.hintEmpty`):bJ(a.value.host)?Y(`proxy.tls.hintPublic`):Y(`proxy.tls.hintLocal`)),f=W(()=>a.value.tls===`auto`&&bJ(a.value.host)),p=W(()=>ZJ(n.dnsAccounts)),m=W(()=>n.dnsAccounts.find(e=>`${e.workspace}/${e.account}`===a.value.dnsAccount)),h=W(()=>m.value===void 0?a.value.dnsAccount.length>0?Y(`proxy.account.gone`):Y(`proxy.account.emptyHint`):m.value.writesTxt?m.value.hasCredentials?Y(`proxy.account.through`,{provider:m.value.provider}):Y(`proxy.account.noCredentialsYet`,{provider:m.value.provider}):Y(`proxy.account.cannotWrite`,{provider:m.value.provider}));M(i,e=>{e&&(a.value=n.draft===null?SJ():structuredClone(dn(n.draft)),a.value.workspace.length===0&&(a.value.workspace=n.workspaces[0]?.id??``),o.value={})}),M(()=>a.value.workspace,()=>{c.value.some(e=>e.value===a.value.server)||(a.value.server=c.value[0]?.value??``)});function g(){let e=a.value.host.trim().toLowerCase(),t={...a.value,host:e,id:BJ(PJ(e),n.others.map(e=>e.id)),workspace:a.value.target===`server`?a.value.workspace:``,server:a.value.target===`server`?a.value.server:``,url:a.value.target===`external`?a.value.url.trim():``},s=HJ(t,{others:n.others,workspaces:n.workspaces,messages:rY});o.value=s,!(Object.keys(s).length>0)&&(r(`save`,t),i.value=!1)}return(e,t)=>(L(),z($z,{open:i.value,"onUpdate:open":t[9]||=e=>i.value=e,title:s.value?A(Y)(`proxy.routeDialog.titleEdit`):A(Y)(`proxy.routeDialog.titleAdd`),description:A(Y)(`proxy.routeDialog.description`),width:`w-[min(92vw,34rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[8]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,onClick:g},{default:j(()=>[H(O(s.value?A(Y)(`proxy.routeDialog.save`):A(Y)(`proxy.routes.add`)),1)]),_:1})]),default:j(()=>[B(`div`,kX,[V(Rz,{modelValue:a.value.host,"onUpdate:modelValue":t[0]||=e=>a.value.host=e,label:A(Y)(`proxy.routeDialog.hostname`),placeholder:A(Y)(`proxy.routeDialog.hostnamePlaceholder`),autocomplete:`off`,spellcheck:`false`,error:o.value.host,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(Rz,{modelValue:a.value.path,"onUpdate:modelValue":t[1]||=e=>a.value.path=e,label:A(Y)(`proxy.routeDialog.path`),placeholder:A(Y)(`proxy.routeDialog.pathPlaceholder`),hint:A(Y)(`proxy.routeDialog.pathHint`),spellcheck:`false`,error:o.value.path,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`error`]),V(Nz,{modelValue:a.value.target,"onUpdate:modelValue":t[2]||=e=>a.value.target=e,label:A(Y)(`proxy.routeDialog.target`),options:l.value},null,8,[`modelValue`,`label`,`options`]),V(Nz,{modelValue:a.value.tls,"onUpdate:modelValue":t[3]||=e=>a.value.tls=e,label:A(Y)(`proxy.routeDialog.tls`),options:u.value,hint:d.value},null,8,[`modelValue`,`label`,`options`,`hint`]),f.value?(L(),z(Nz,{key:0,modelValue:a.value.dnsAccount,"onUpdate:modelValue":t[4]||=e=>a.value.dnsAccount=e,label:A(Y)(`proxy.routeDialog.dnsAccount`),options:p.value,hint:h.value},null,8,[`modelValue`,`label`,`options`,`hint`])):a.value.tls===`auto`?(L(),R(`p`,AX,O(A(Y)(`proxy.routeDialog.localNote`)),1)):U(``,!0),a.value.target===`server`?(L(),R(I,{key:2},[V(Nz,{modelValue:a.value.workspace,"onUpdate:modelValue":t[5]||=e=>a.value.workspace=e,label:A(Y)(`proxy.routeDialog.workspace`),options:n.workspaces.map(e=>({value:e.id,label:e.label})),error:o.value.workspace},null,8,[`modelValue`,`label`,`options`,`error`]),V(Nz,{modelValue:a.value.server,"onUpdate:modelValue":t[6]||=e=>a.value.server=e,label:A(Y)(`proxy.routeDialog.server`),options:c.value,disabled:c.value.length===0,error:o.value.server??(c.value.length===0?A(Y)(`proxy.routeDialog.noServers`):null)},null,8,[`modelValue`,`label`,`options`,`disabled`,`error`]),B(`p`,jX,O(A(Y)(`proxy.routeDialog.stoppedNote`)),1)],64)):U(``,!0),a.value.target===`external`?(L(),z(Rz,{key:3,modelValue:a.value.url,"onUpdate:modelValue":t[7]||=e=>a.value.url=e,label:A(Y)(`proxy.routeDialog.upstream`),placeholder:A(Y)(`proxy.routeDialog.upstreamPlaceholder`),hint:A(Y)(`proxy.routeDialog.upstreamHint`),spellcheck:`false`,error:o.value.url,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`error`])):U(``,!0),a.value.target===`panel`?(L(),R(`p`,MX,O(A(Y)(`proxy.routeDialog.panelNote`)),1)):U(``,!0),o.value.form?(L(),z(_H,{key:5,tone:`danger`},{default:j(()=>[H(O(o.value.form),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),PX={class:`text-xs font-semibold text-ink`},FX={class:`mt-1 text-2xs leading-4 text-muted`},IX={class:`mt-1 text-2xs leading-4 text-warn`},LX={class:`mt-2.5 flex justify-end gap-1.5`},RX=N({__name:`RetryCertificateButton`,props:{host:{},retryIn:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(Wh),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`secondary`,loading:n.busy,disabled:n.busy},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.force`)),1)]),_:1},8,[`loading`,`disabled`])]),_:1}),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,PX,O(A(Y)(`proxy.retryButton.question`,{host:n.host})),1),B(`p`,FX,O(A(Y)(`proxy.retryButton.body`,{retryIn:n.retryIn})),1),B(`p`,IX,O(A(Y)(`proxy.retryButton.warning`)),1),B(`div`,LX,[V(A(Gh),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.leave`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`primary`,loading:n.busy,onClick:a},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.now`)),1)]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),zX={key:0,class:`sm:col-span-2`},BX={class:`list-disc space-y-0.5 pl-4`},VX={key:1,class:`sm:col-span-2`},HX={key:2,class:`overflow-x-auto sm:col-span-2`},UX={class:`w-full text-left text-xs`},WX={class:`text-2xs text-faint`},GX={class:`py-1 pr-3 font-medium`},KX={class:`py-1 pr-3 font-medium`},qX={class:`py-1 pr-3 font-medium`},JX={class:`py-1 pr-3 font-medium`},YX={class:`py-1 pr-3 font-medium`},XX={class:`py-1 pr-3 font-medium`},ZX={class:`py-1 font-medium`},QX={class:`sr-only`},$X={class:`py-1.5 pr-3`},eZ={class:`font-mono text-xs text-ink`},tZ=[`href`,`title`],nZ={key:2,class:`text-accent`},rZ={class:`font-mono text-2xs text-faint`},iZ={class:`py-1.5 pr-3 text-2xs text-muted`},aZ={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},oZ={class:`py-1.5 pr-3 text-2xs text-muted`},sZ={key:0,class:`mt-0.5`},cZ={key:1,class:`mt-1`},lZ={class:`py-1.5 pr-3`},uZ={class:`py-1.5 pr-3`},dZ={class:`py-1.5`},fZ={class:`flex items-center justify-end gap-1`},pZ=N({__name:`RouteTable`,props:{routes:{},views:{},workspaces:{},httpPort:{},httpsPort:{},disabled:{type:Boolean}},emits:[`add`,`edit`,`remove`,`retry`,`toggle`],setup(e,{emit:t}){let n=e,r=t;function i(e){return e===`fallback`}let a=W(()=>n.routes.map(e=>{let t=n.views.find(t=>t.route.id===e.id)??null;return{route:e,view:t,meta:t===null?null:qJ[t.status],target:iY(e,n.workspaces),tls:tY(e),certificate:t===null?null:YJ(t),url:OJ(e,n.httpPort,n.httpsPort)}})),o=W(()=>a.value.filter(e=>e.view?.status===`error`));return(e,t)=>(L(),z(gz,{title:A(Y)(`proxy.routes.title`),description:A(Y)(`proxy.routes.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`secondary`,disabled:n.disabled,onClick:t[0]||=e=>r(`add`)},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(` `+O(A(Y)(`proxy.routes.add`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[o.value.length>0?(L(),R(`div`,zX,[V(_H,{tone:`danger`,title:A(Y)(`proxy.routes.cannotSaveTitle`)},{default:j(()=>[B(`ul`,BX,[(L(!0),R(I,null,P(o.value,e=>(L(),R(`li`,{key:e.route.id},O(e.view?.message??A(Y)(`proxy.routes.cannotRoute`,{host:e.route.host})),1))),128))])]),_:1},8,[`title`])])):U(``,!0),a.value.length===0?(L(),R(`div`,VX,[V(gL,{compact:``,title:A(Y)(`proxy.routes.emptyTitle`),description:A(Y)(`proxy.routes.emptyDescription`)},{icon:j(()=>[V(A(Ry),{class:`size-5`})]),action:j(()=>[V($,{variant:`primary`,disabled:n.disabled,onClick:t[1]||=e=>r(`add`)},{default:j(()=>[H(O(A(Y)(`proxy.routes.addFirst`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`title`,`description`])])):(L(),R(`div`,HX,[B(`table`,UX,[B(`thead`,null,[B(`tr`,WX,[B(`th`,GX,O(A(Y)(`proxy.routes.columnHostname`)),1),B(`th`,KX,O(A(Y)(`proxy.routes.columnTarget`)),1),B(`th`,qX,O(A(Y)(`proxy.routes.columnUpstream`)),1),B(`th`,JX,O(A(Y)(`proxy.routes.columnTls`)),1),B(`th`,YX,O(A(Y)(`proxy.routes.columnState`)),1),B(`th`,XX,O(A(Y)(`proxy.routes.columnOn`)),1),B(`th`,ZX,[B(`span`,QX,O(A(Y)(`common.actions`)),1)])])]),B(`tbody`,null,[(L(!0),R(I,null,P(a.value,e=>(L(),R(`tr`,{key:e.route.key,class:`border-t border-line-soft align-top`},[B(`td`,$X,[B(`p`,eZ,[e.url!==null&&e.route.enabled?(L(),R(`a`,{key:0,href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`transition-colors duration-150 hover:text-accent hover:underline`,title:A(Y)(`proxy.routes.openInTab`,{url:e.url})},O(e.route.host),9,tZ)):(L(),R(I,{key:1},[H(O(e.route.host.trim().length>0?e.route.host:A(Y)(`proxy.routes.noHostname`)),1)],64)),e.route.path.length>0?(L(),R(`span`,nZ,O(e.route.path),1)):U(``,!0)]),B(`p`,rZ,O(e.route.id),1)]),B(`td`,iZ,O(e.target),1),B(`td`,aZ,O(e.view?.upstream??`—`),1),B(`td`,oZ,[H(O(e.tls)+` `,1),e.certificate?(L(),R(`div`,sZ,[V(vU,{tone:e.certificate.tone,dot:``},{default:j(()=>[H(O(A(Y)(e.certificate.labelKey)),1)]),_:2},1032,[`tone`]),e.certificate.message?(L(),R(`p`,{key:0,class:D([`mt-0.5 text-2xs`,e.certificate.tone===`danger`?`text-danger`:`text-faint`])},O(e.certificate.message),3)):U(``,!0),i(e.view?.certificate?.state)?(L(),R(`div`,cZ,[V(RX,{host:e.route.host,"retry-in":A(aY)(e.certificate?.retryInMinutes??null),busy:n.disabled,onConfirm:t=>r(`retry`,e.route)},null,8,[`host`,`retry-in`,`busy`,`onConfirm`])])):U(``,!0)])):U(``,!0)]),B(`td`,lZ,[e.meta?(L(),z(vU,{key:0,tone:e.meta.tone,dot:``},{default:j(()=>[H(O(A(Y)(e.meta.labelKey)),1)]),_:2},1032,[`tone`])):(L(),z(vU,{key:1,tone:`info`,dot:``},{default:j(()=>[H(O(A(Y)(`proxy.status.unapplied`)),1)]),_:1})),e.view?.message?(L(),R(`p`,{key:2,class:D([`mt-0.5 text-2xs`,e.view.status===`error`?`text-danger`:`text-warn`])},O(e.view.message),3)):U(``,!0)]),B(`td`,uZ,[V(Vz,{"model-value":e.route.enabled,label:A(Y)(`proxy.routes.toggle`,{name:e.route.host||e.route.id}),"sr-only":``,disabled:n.disabled,"onUpdate:modelValue":t=>r(`toggle`,e.route,t)},null,8,[`model-value`,`label`,`disabled`,`onUpdate:modelValue`])]),B(`td`,dZ,[B(`span`,fZ,[V($,{size:`xs`,variant:`ghost`,disabled:n.disabled,"aria-label":A(Y)(`proxy.routes.edit`,{name:e.route.host||e.route.id}),onClick:t=>r(`edit`,e.route)},{default:j(()=>[V(A(gy),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`]),V($,{size:`xs`,variant:`danger-ghost`,disabled:n.disabled,"aria-label":A(Y)(`proxy.routes.remove`,{name:e.route.host||e.route.id}),onClick:t=>r(`remove`,e.route)},{default:j(()=>[V(A(Iy),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`])])])]))),128))])])]))]),_:1},8,[`title`,`description`]))}}),mZ={class:`min-h-full`},hZ={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},gZ={class:`mb-5`},_Z={class:`text-xl font-semibold tracking-tight text-ink`},vZ={class:`mt-1 text-xs text-muted`},yZ={class:`mt-1 text-2xs leading-4 text-faint`},bZ={key:2,class:`space-y-6`},xZ={key:0,class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},SZ={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},CZ={class:`min-w-0 flex-1`},wZ={class:`text-xs text-muted`},TZ={class:`font-mono tabular-nums text-ink`},EZ={key:0,class:`mt-0.5 text-xs text-danger`},DZ={key:1,class:`mt-0.5 text-xs text-danger`},OZ={key:2,class:`mt-0.5 text-xs text-ok`},kZ={class:`flex shrink-0 items-center gap-2`},AZ=N({__name:`ProxyView`,setup(e){let t=XN(),n=vN(),r=k(null),i=k(null),a=k(null),o=k(!1),s=k(null),c=k({enabled:!1,httpPort:80,httpsPort:443,email:``,staging:!1,dns01:!1,resolvers:``}),l=k([]),u=k(!1),d=k(null),f=W(()=>t.proxy.value??r.value),p=W(()=>f.value?.config??null),m=W(()=>f.value?.engine.path??null),h=W(()=>t.workspaces.value.map(e=>({id:e.id,label:e.label,servers:e.servers.map(e=>({id:e.id}))}))),g=W(()=>EJ(c.value,l.value)?_J(l.value):null),_=W(()=>p.value!==null&&AJ(p.value.routes,l.value)!==null),v=W(()=>{if(p.value===null)return 0;let e=TJ(p.value,c.value,l.value);return e===null?0:Object.keys(e).filter(e=>e!==`routes`).length+(e.routes===void 0?0:1)}),y=W(()=>(f.value?.routes??[]).filter(e=>e.status===`error`)),b=W(()=>_.value?[]:y.value.map(e=>e.message??Y(`proxy.routes.cannotRoute`,{host:e.route.host}))),x={};function S(){let e=p.value;if(e===null)return;qR(x.listener,{...c.value})||(Object.assign(c.value,QJ(e)),x.listener={...c.value});let t=IJ(l.value);qR(x.routes,t)||(l.value=$J(e.routes),x.routes=IJ(l.value))}M(f,S,{immediate:!0});async function C(){i.value=null;try{r.value=await Xj()}catch(e){i.value=Lj(e)}}na(()=>{t.proxy.value===null&&C()});let w={install:()=>$j(),start:lM,stop:uM,apply:Gj,revert:oM},T={install:`proxy.view.engineInstalled`,start:`proxy.view.engineStarting`,stop:`proxy.view.engineStopping`,apply:`proxy.view.configApplied`,revert:`proxy.view.configReverted`};async function ee(e){if(s.value===null){s.value=e,a.value=null;try{r.value=await w[e](),n.success(Y(T[e])),await t.refresh()}catch(e){a.value=Lj(e)}finally{s.value=null}}}let te=k(null),ne=k(null);async function re(){let e=p.value,i=e===null?null:TJ(e,c.value,l.value);if(!(i===null||o.value||b.value.length>0)){o.value=!0,te.value=null,ne.value=null;try{r.value=await nM(i),await t.refresh(),ne.value=Y(`proxy.view.settingsSaved`),n.success(Y(`proxy.view.settingsSavedToast`)),delete x.listener,delete x.routes,S()}catch(e){te.value=Lj(e)}finally{o.value=!1}}}function ie(){te.value=null,ne.value=null,delete x.listener,delete x.routes,S()}function ae(){d.value=null,u.value=!0}function oe(e){d.value=e,u.value=!0}function se(e){l.value=eY(l.value,d.value,e),d.value=null}function ce(e){l.value=l.value.filter(t=>t.key!==e.key)}async function le(e){s.value=`apply`;try{r.value=await aM(e.id),await t.refresh(),n.success(Y(`proxy.view.retryAsked`,{host:e.host}))}catch(e){n.failure(Y(`proxy.view.retryFailed`),Lj(e))}finally{s.value=null}}function E(e,t){e.enabled=t}async function ue(e){r.value=e,await t.refresh()}return(e,t)=>(L(),R(`div`,mZ,[B(`div`,hZ,[B(`header`,gZ,[B(`h1`,_Z,O(A(Y)(`proxy.view.title`)),1),B(`p`,vZ,O(A(Y)(`proxy.view.description`)),1),B(`p`,yZ,O(A(Y)(`proxy.view.dnsNote`)),1)]),i.value?(L(),z(_H,{key:0,tone:`danger`,title:A(Y)(`proxy.view.readFailed`),class:`mb-4`},{default:j(()=>[H(O(i.value),1)]),_:1},8,[`title`])):U(``,!0),f.value===null&&i.value===null?(L(),z(_H,{key:1,tone:`info`,class:`mb-4`},{default:j(()=>[H(O(A(Y)(`proxy.view.reading`)),1)]),_:1})):U(``,!0),f.value===null?U(``,!0):(L(),R(`div`,bZ,[V(_X,{view:f.value,busy:s.value,onAct:ee},null,8,[`view`,`busy`]),a.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(a.value),1)]),_:1})):U(``,!0),V(OX,{form:c.value,"onUpdate:form":t[0]||=e=>c.value=e,"engine-path":m.value,"email-host":g.value,"dns-accounts":f.value?.dnsAccounts??[]},null,8,[`form`,`engine-path`,`email-host`,`dns-accounts`]),V(pZ,{routes:l.value,views:f.value.routes,workspaces:h.value,"http-port":f.value.config.httpPort,"https-port":f.value.config.httpsPort,disabled:o.value,onAdd:ae,onEdit:oe,onRemove:ce,onRetry:le,onToggle:E},null,8,[`routes`,`views`,`workspaces`,`http-port`,`https-port`,`disabled`]),V(IY,{certificates:f.value.certificates,disabled:o.value,onChanged:ue},null,8,[`certificates`,`disabled`])]))]),f.value===null?U(``,!0):(L(),R(`div`,xZ,[B(`div`,SZ,[B(`div`,CZ,[B(`p`,wZ,[v.value>0?(L(),R(I,{key:0},[B(`span`,TZ,O(v.value),1),H(` `+O(A(_F)(`proxy.view.fieldChanged`,v.value)),1)],64)):(L(),R(I,{key:1},[H(O(A(Y)(`proxy.view.noChanges`)),1)],64))]),b.value.length>0?(L(),R(`p`,EZ,O(b.value.join(` · `)),1)):te.value?(L(),R(`p`,DZ,O(te.value),1)):ne.value?(L(),R(`p`,OZ,O(ne.value),1)):U(``,!0)]),B(`div`,kZ,[V($,{variant:`ghost`,disabled:v.value===0||o.value,onClick:ie},{default:j(()=>[H(O(A(Y)(`proxy.view.discard`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:v.value===0||b.value.length>0,loading:o.value,onClick:re},{default:j(()=>[H(O(A(Y)(`proxy.view.save`)),1)]),_:1},8,[`disabled`,`loading`])])])])),V(NX,{open:u.value,"onUpdate:open":t[1]||=e=>u.value=e,draft:d.value,others:l.value.filter(e=>e.key!==d.value?.key),workspaces:h.value,"dns-accounts":f.value?.dnsAccounts??[],onSave:se},null,8,[`open`,`draft`,`others`,`workspaces`,`dns-accounts`])]))}}),jZ={class:`mb-4 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},MZ={class:`min-w-0`},NZ={class:`text-sm font-semibold text-ink`},PZ={class:`mt-0.5 text-2xs leading-4 text-muted`},FZ={class:`flex items-center gap-2`},IZ={class:`font-mono tabular-nums`},LZ={key:1,class:`text-2xs text-faint`},RZ={class:`flex flex-col gap-3`},zZ={key:0,class:`mt-3 rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},BZ={class:`mt-4 flex items-center justify-end gap-2 border-t border-line pt-3.5`},VZ={class:`max-h-[60dvh] overflow-auto`},HZ={key:0,class:`divide-y divide-line-soft`},UZ={class:`font-mono text-xs text-ink`},WZ={class:`ml-auto font-mono text-xs text-muted line-through`},GZ={class:`font-mono text-xs text-accent`},KZ={key:1,class:`text-xs text-muted`},qZ=N({__name:`ServerConfigEditor`,props:{serverId:{},workspaceId:{},config:{}},emits:[`saved`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=[`restart`,`health`,`stop`],a=XN(),o=k(!1),s=k(null);function c(e){return e>0?Math.round(e/1024/1024):null}function l(e){return{label:e.label??``,command:e.command,cwd:e.cwd,args:e.args.join(`
43
43
  `),env:ez(e.env),dataEnvs:ez(e.dataEnvs),backupPaths:e.backupPaths.join(`
44
44
  `),backupIgnoreGenerated:e.backupIgnoreGenerated!==!1,dependsOn:e.dependsOn.join(`, `),envFile:e.envFile,maxRssMb:c(e.resources.maxRssBytes),port:e.port,bind:e.bind,onPortConflict:e.onPortConflict,logBufferLines:e.logBufferLines,enabled:e.enabled,autostart:e.autostart,persistent:e.persistent===!0,bootstrapEnabled:e.bootstrap!==null&&e.bootstrap!==void 0,bootstrapCommand:e.bootstrap?.command??``,bootstrapArgs:(e.bootstrap?.args??[]).join(`
45
- `),bootstrapEnv:ez(e.bootstrap?.env??{}),bootstrapTimeoutMs:e.bootstrap?.timeoutMs??12e4,bootstrapRunOnce:e.bootstrap?.runOnce??!0}}let u=tn(l(n.config)),d=k({...n.config.restart}),f=k(TR(n.config.health)),p=k({...n.config.stop}),m=W(()=>{let e=[{value:`local`,label:Y(`bind.local`)},{value:`lan`,label:Y(`bind.lan`)}];return/^\d{1,3}(?:\.\d{1,3}){3}$/.test(n.config.bind)&&e.push({value:n.config.bind,label:Y(`bind.explicit`,{bind:n.config.bind})}),e});function h(){let e=Number.isFinite(u.maxRssMb)?u.maxRssMb:0,t=Number.isFinite(u.logBufferLines)&&u.logBufferLines>=50?u.logBufferLines:50,n=Number.isFinite(u.bootstrapTimeoutMs)?u.bootstrapTimeoutMs:0;return{label:u.label.trim().length===0?null:u.label.trim(),command:u.command.trim(),cwd:u.cwd.trim()===``?`.`:u.cwd.trim(),args:$R(u.args),env:tz(u.env),dataEnvs:tz(u.dataEnvs),backupPaths:$R(u.backupPaths),backupIgnoreGenerated:u.backupIgnoreGenerated,dependsOn:nz(u.dependsOn),envFile:u.envFile.trim(),resources:{maxRssBytes:e>0?Math.round(e*1024*1024):0},port:u.port===null||Number.isNaN(u.port)?null:u.port,bind:u.bind,onPortConflict:u.onPortConflict,logBufferLines:t,enabled:u.enabled,autostart:u.autostart,persistent:u.persistent,restart:{...d.value},health:TR(f.value),stop:{...p.value},bootstrap:u.bootstrapEnabled?{command:u.bootstrapCommand.trim(),args:$R(u.bootstrapArgs),env:tz(u.bootstrapEnv),timeoutMs:n,runOnce:u.bootstrapRunOnce}:null}}function g(e,t){let r=n.config[t]??{},i=e[t]??{},a={};for(let[e,t]of Object.entries(i))r[e]!==t&&(a[e]=t);return Object.keys(a).length>0?a:null}function _(e){for(let t of i)g(e,t)===null&&delete e[t];return _R(n.config,e)}function v(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}let y=W(()=>_(h())),b=W(()=>bR(y.value)),x=W(()=>b.value>0),S=W(()=>yR(y.value,n.config)),C=k(!1),w=T(n.config);function T(e){return JSON.parse(JSON.stringify(e))}function ee(e){Object.assign(u,l(e)),d.value={...e.restart},f.value=TR(e.health),p.value={...e.stop},w=T(e),s.value=null}M(()=>n.config,e=>{v(e,w)||ee(e)});async function te(){s.value=null,o.value=!0;try{let e=h(),t=BA(e);if(t instanceof J.errors){s.value=t.summary;return}let i=_(e);if(Object.keys(i).length===0){r(`saved`);return}if(await a.saveConfig(n.workspaceId,n.serverId,i),a.lastError.value!==null){s.value=a.lastError.value;return}r(`saved`)}finally{o.value=!1}}return(e,t)=>(L(),R(I,null,[B(`form`,{class:`border-t border-line bg-page/40 px-4 py-4`,onSubmit:lu(te,[`prevent`])},[B(`header`,AZ,[B(`div`,jZ,[B(`h2`,MZ,O(A(Y)(`editor.title`)),1),B(`p`,NZ,[V(iB,{k:`editor.description`},{file:j(()=>[...t[32]||=[B(`span`,{class:`font-mono`},`servers.config.json`,-1)]]),_:1})])]),B(`div`,PZ,[b.value>0?(L(),R(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-2xs text-warn underline decoration-warn/40 underline-offset-2 transition-colors duration-150 hover:text-ink`,onClick:t[0]||=e=>C.value=!0},[B(`span`,FZ,O(b.value),1),H(` `+O(A(_F)(`editor.unsaved`,b.value)),1)])):(L(),R(`span`,IZ,O(A(Y)(`editor.inSync`)),1))])]),B(`div`,LZ,[V(gz,{title:A(Y)(`editor.process`),description:A(Y)(`editor.processDescription`),columns:2},{default:j(()=>[V(Rz,{modelValue:u.label,"onUpdate:modelValue":t[1]||=e=>u.label=e,label:A(Y)(`common.label`),placeholder:A(Y)(`editor.labelPlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V(Rz,{modelValue:u.command,"onUpdate:modelValue":t[2]||=e=>u.command=e,label:A(Y)(`common.command`),placeholder:`node`,required:``,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(Rz,{modelValue:u.cwd,"onUpdate:modelValue":t[3]||=e=>u.cwd=e,label:A(Y)(`serverForm.workingDirectory`),placeholder:`.`,hint:A(Y)(`serverForm.cwdHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:u.envFile,"onUpdate:modelValue":t[4]||=e=>u.envFile=e,label:A(Y)(`serverForm.envFile`),placeholder:A(Y)(`serverForm.envFilePlaceholder`),hint:A(Y)(`serverForm.envFileHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(rB,{modelValue:u.args,"onUpdate:modelValue":t[5]||=e=>u.args=e,label:A(Y)(`serverForm.arguments`),rows:3,hint:A(Y)(`editor.argumentsHint`),placeholder:`-p
46
- {port}`},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:u.env,"onUpdate:modelValue":t[6]||=e=>u.env=e,label:A(Y)(`common.environment`),rows:3,hint:A(Y)(`serverForm.envHint`),placeholder:`NODE_ENV=production`},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:u.dataEnvs,"onUpdate:modelValue":t[7]||=e=>u.dataEnvs=e,label:A(Y)(`serverForm.dataEnvs`),rows:3,hint:A(Y)(`serverForm.dataEnvsHint`),placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:u.backupPaths,"onUpdate:modelValue":t[8]||=e=>u.backupPaths=e,label:A(Y)(`serverForm.backupPaths`),rows:2,hint:A(Y)(`serverForm.backupPathsHint`),placeholder:`{home}/.app/uploads`},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:u.backupIgnoreGenerated,"onUpdate:modelValue":t[9]||=e=>u.backupIgnoreGenerated=e,label:A(Y)(`serverForm.backupIgnore`),hint:A(Y)(`serverForm.backupIgnoreHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:u.dependsOn,"onUpdate:modelValue":t[10]||=e=>u.dependsOn=e,label:A(Y)(`serverForm.dependsOn`),placeholder:`postgres, redis`,hint:A(Y)(`serverForm.dependsOnHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:u.maxRssMb,"onUpdate:modelValue":t[11]||=e=>u.maxRssMb=e,label:A(Y)(`serverForm.maxRssMb`),min:0,hint:A(Y)(`serverForm.maxRssHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`editor.portTitle`),description:A(Y)(`editor.portDescription`),columns:2},{default:j(()=>[V(Dz,{modelValue:u.port,"onUpdate:modelValue":t[12]||=e=>u.port=e,label:A(Y)(`common.port`),nullable:``,min:1,max:65535,hint:A(Y)(`serverForm.portHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Nz,{modelValue:u.bind,"onUpdate:modelValue":t[13]||=e=>u.bind=e,label:A(Y)(`serverForm.bindAddress`),options:m.value,hint:A(Y)(`editor.bindHint`)},null,8,[`modelValue`,`label`,`options`,`hint`]),V(Nz,{modelValue:u.onPortConflict,"onUpdate:modelValue":t[14]||=e=>u.onPortConflict=e,label:A(Y)(`serverForm.onPortConflict`),options:[{value:`block`,label:A(Y)(`onPortConflict.block`)},{value:`warn`,label:A(Y)(`onPortConflict.warn`)},{value:`follow`,label:A(Y)(`onPortConflict.follow`)},{value:`reclaim`,label:A(Y)(`onPortConflict.reclaim`)},{value:`kill`,label:A(Y)(`onPortConflict.kill`)}]},null,8,[`modelValue`,`label`,`options`]),V(Dz,{modelValue:u.logBufferLines,"onUpdate:modelValue":t[15]||=e=>u.logBufferLines=e,label:A(Y)(`serverForm.logBufferLines`),min:50,max:1e5,step:50},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`editor.lifecycle`),description:A(Y)(`editor.lifecycleDescription`),columns:3},{default:j(()=>[V(Vz,{modelValue:u.enabled,"onUpdate:modelValue":t[16]||=e=>u.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`serverForm.enabledHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:u.autostart,"onUpdate:modelValue":t[17]||=e=>u.autostart=e,label:A(Y)(`serverForm.autostart`),hint:A(Y)(`serverForm.autostartHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:u.persistent,"onUpdate:modelValue":t[18]||=e=>u.persistent=e,label:A(Y)(`serverForm.persistent`),hint:A(Y)(`serverForm.persistentHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(Hz,{restart:d.value,"onUpdate:restart":t[19]||=e=>d.value=e,health:f.value,"onUpdate:health":t[20]||=e=>f.value=e,stop:p.value,"onUpdate:stop":t[21]||=e=>p.value=e},null,8,[`restart`,`health`,`stop`]),V(gz,{title:A(Y)(`serverForm.bootstrap`),description:A(Y)(`serverForm.bootstrapDescription`),columns:2},{default:j(()=>[V(Vz,{modelValue:u.bootstrapEnabled,"onUpdate:modelValue":t[22]||=e=>u.bootstrapEnabled=e,label:A(Y)(`serverForm.runBootstrap`),hint:A(Y)(`serverForm.bootstrapHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),u.bootstrapEnabled?(L(),R(I,{key:0},[V(Rz,{modelValue:u.bootstrapCommand,"onUpdate:modelValue":t[23]||=e=>u.bootstrapCommand=e,label:A(Y)(`common.command`),placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:u.bootstrapTimeoutMs,"onUpdate:modelValue":t[24]||=e=>u.bootstrapTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:u.bootstrapRunOnce,"onUpdate:modelValue":t[25]||=e=>u.bootstrapRunOnce=e,label:A(Y)(`serverForm.runOnce`),hint:A(Y)(`serverForm.runOnceHint`)},null,8,[`modelValue`,`label`,`hint`])],64)):U(``,!0),u.bootstrapEnabled?(L(),z(rB,{key:1,modelValue:u.bootstrapArgs,"onUpdate:modelValue":t[26]||=e=>u.bootstrapArgs=e,label:A(Y)(`serverForm.bootstrapArgs`),rows:2,hint:A(Y)(`serverForm.bootstrapArgsHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0),u.bootstrapEnabled?(L(),z(rB,{key:2,modelValue:u.bootstrapEnv,"onUpdate:modelValue":t[27]||=e=>u.bootstrapEnv=e,label:A(Y)(`serverForm.bootstrapEnv`),rows:2,hint:A(Y)(`serverForm.bootstrapEnvHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0)]),_:1},8,[`title`,`description`])]),s.value?(L(),R(`p`,RZ,O(s.value),1)):U(``,!0),B(`div`,zZ,[V($,{variant:`ghost`,onClick:t[28]||=e=>r(`cancel`)},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{type:`submit`,variant:`primary`,disabled:o.value||!x.value,loading:o.value},{default:j(()=>[H(O(A(Y)(`editor.save`)),1)]),_:1},8,[`disabled`,`loading`])])],32),V($z,{open:C.value,"onUpdate:open":t[31]||=e=>C.value=e,title:A(Y)(`editor.changesTitle`),description:A(Y)(`editor.changesDescription`),width:`w-[min(92vw,42rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[29]||=e=>C.value=!1},{default:j(()=>[H(O(A(Y)(`common.close`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:S.value.length===0||o.value,loading:o.value,onClick:t[30]||=e=>{te(),C.value=!1}},{default:j(()=>[H(O(A(_F)(`editor.saveChanges`,S.value.length)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`div`,BZ,[S.value.length>0?(L(),R(`ul`,VZ,[(L(!0),R(I,null,P(S.value,e=>(L(),R(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[B(`code`,HZ,O(e.path),1),B(`span`,UZ,O(A(zL)(e.from)),1),t[33]||=B(`span`,{class:`text-2xs text-faint`},`→`,-1),B(`span`,WZ,O(A(zL)(e.to)),1)]))),128))])):(L(),R(`p`,GZ,O(A(Y)(`editor.nothingToSave`)),1))])]),_:1},8,[`open`,`title`,`description`])],64))}}),qZ={key:0,class:`mx-auto max-w-3xl p-4 sm:p-5`},JZ={key:1,class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},YZ={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},XZ={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},ZZ={class:`font-mono text-xs text-faint`},QZ=[`href`],$Z={class:`px-2 py-1.5`},eQ={class:`mb-1 text-2xs text-faint`},tQ={class:`flex flex-col gap-0.5`},nQ=[`onClick`],rQ={class:`space-y-2`},iQ={key:0,class:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-control border border-danger/25 bg-danger-soft px-3 py-2`},aQ={class:`min-w-0 flex-1 text-2xs leading-4 text-danger`},oQ={key:1,class:`rounded-control border border-warn/25 bg-warn-soft px-3 py-2 text-2xs leading-4 text-warn`},sQ={class:`grid grid-cols-2 gap-x-4 gap-y-3 p-4 sm:grid-cols-4 lg:grid-cols-6`},cQ={class:`truncate text-2xs text-faint`},lQ={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},uQ={class:`text-sm font-semibold text-ink`},dQ={class:`text-2xs text-muted`},fQ={class:`grid gap-4 sm:grid-cols-3`},pQ={class:`flex items-center justify-between gap-3`},mQ=[`title`],hQ={key:1,class:`space-y-4`},gQ={class:`text-sm font-semibold text-ink`},_Q={class:`text-2xs text-muted`},vQ={key:0,class:`max-h-96 overflow-auto rounded-control border border-line bg-page/60 p-3 font-mono text-2xs leading-5 text-muted`},yQ={key:1,class:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2`},bQ={class:`text-2xs text-faint`},xQ=[`title`],SQ={key:2,class:`grid gap-4 lg:grid-cols-3`},CQ={class:`text-sm font-semibold text-ink`},wQ={class:`text-2xs text-muted`},TQ={class:`text-sm font-semibold text-ink`},EQ={key:0,class:`flex flex-wrap gap-1.5`},DQ={key:1,class:`text-xs text-muted`},OQ={class:`text-xs text-muted`},kQ=N({__name:`ServerDetailView`,setup(e){let t=zg(),n=XN(),r=dP(),i=W(()=>String(t.params.id??``));M([i,()=>n.appState.value],()=>{let e=i.value;if(e.length===0||r.serverById(e)!==void 0)return;let t=n.workspaces.value.filter(t=>t.servers.some(t=>t.id===e));t.length===1&&r.select(t[0].id)},{immediate:!0});let a=W(()=>r.serverById(i.value)),o=W(()=>a.value?.config),s=W(()=>{let e=o.value;return e?.label&&e.label.length>0?e.label:i.value}),c=k(`output`),l=k(!1),u=k(!1),d=k(!1),f=k(!1),p=YN(r.activeId,()=>a.value?i.value:null),m=p.version,h=W(()=>(m.value,p.lines())),g=W(()=>r.seriesOf(i.value)),_=n.now,v=W(()=>a.value?pB(a.value,mB()):null),y=W(()=>g.value.cpu),b=W(()=>g.value.rss),x=W(()=>g.value.probe),S=W(()=>{let e=a.value;return!e||e.startedAt===null||e.status!==`running`?`—`:jL(_.value-e.startedAt)}),C=W(()=>a.value?.status===`running`),w={unknown:`common.unknown`,free:`views.serverDetail.portFree`,"in-use":`views.serverDetail.portInUse`},T=W(()=>{let e=a.value;if(!e)return[];let t=[{key:`pid`,label:Y(`views.serverDetail.pid`),value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:Y(`common.uptime`),value:S.value},{key:`status`,label:Y(`common.status`),value:Y(qI[e.status].labelKey)},{key:`health`,label:Y(`views.serverDetail.health`),value:Y(JI[e.health].labelKey)},{key:`port`,label:Y(`views.serverDetail.portState`),value:Y(w[e.portState]??`common.unknown`)},{key:`probe`,label:Y(`views.serverDetail.lastProbe`),value:e.responseMs===null?`—`:`${e.responseMs} ms`},{key:`rss`,label:`RSS`,value:LL(e.resources?.rssBytes??null)},{key:`procs`,label:Y(`views.serverDetail.processes`),value:e.resources?String(e.resources.processes):`—`},{key:`restarts`,label:Y(`views.serverDetail.restarts`),value:`${e.restarts}/${e.maxRetries}`},{key:`up24`,label:Y(`views.serverDetail.uptime24`),value:_L(e.history.uptimeRatio)},{key:`crashes`,label:Y(`views.serverDetail.crashes24`),value:String(e.history.crashes)},{key:`lastcrash`,label:Y(`views.serverDetail.lastCrash`),value:NL(e.history.lastCrashAt,_.value)}];return e.nextRetryAt!==null&&t.push({key:`retry`,label:Y(`views.serverDetail.nextAttempt`),value:ML(e.nextRetryAt,_.value)}),e.unhealthySince!==null&&t.push({key:`unhealthy`,label:Y(`views.serverDetail.unhealthyFor`),value:jL(_.value-e.unhealthySince)}),t}),ee=W(()=>JSON.stringify(o.value??{},null,2)),te=W(()=>o.value?`${o.value.command} ${o.value.args.join(` `)}`.trim():``),ne=W(()=>{let e=o.value?.bind??`local`,t=[{value:`local`,label:Y(`views.serverDetail.bindLocal`)},{value:`lan`,label:Y(`views.serverDetail.bindLan`)}];return e!==`local`&&e!==`lan`&&t.push({value:e,label:Y(`views.serverDetail.bindCustom`,{bind:e})}),t});async function re(e){f.value=!0;try{await n[e](r.activeId.value,i.value)}finally{f.value=!1}}async function ie(){d.value=!1,await r.removeServer(i.value)}async function ae(){let e=a.value;if(e){f.value=!0;try{await r.freePort(e.id)}finally{f.value=!1}}}let oe=W(()=>HM(r.activeId.value,i.value,`${i.value}.log`)),se=[{value:`output`,labelKey:`views.serverDetail.sectionOutput`},{value:`config`,labelKey:`views.serverDetail.sectionConfig`},{value:`history`,labelKey:`views.serverDetail.sectionHistory`}].map(e=>({value:e.value,label:Y(e.labelKey)}));return(e,t)=>{let n=pa(`RouterLink`);return a.value?(L(),R(`div`,JZ,[V(CV,{title:s.value,"back-to":A(u1)(A(r).activeId.value,`servers`),"back-label":A(Y)(`views.serverDetail.allServers`)},{badges:j(()=>[V(zB,{status:a.value.status,health:a.value.health},null,8,[`status`,`health`]),a.value.adopted?(L(),z(BB,{key:0,label:A(Y)(`views.serverDetail.detachedHint`)},{default:j(()=>[B(`span`,YZ,O(A(Y)(`views.serverDetail.detached`)),1)]),_:1},8,[`label`])):U(``,!0),a.value.config.persistent?(L(),z(BB,{key:1,label:A(Y)(`views.serverDetail.persistentHint`)},{default:j(()=>[B(`span`,XZ,O(A(Y)(`views.serverDetail.persistent`)),1)]),_:1},8,[`label`])):U(``,!0),B(`span`,ZZ,O(a.value.id),1),v.value?(L(),R(`a`,{key:2,href:v.value,target:`_blank`,rel:`noreferrer`,class:`inline-flex items-center gap-1 font-mono text-xs text-accent hover:underline`},[H(O(v.value)+` `,1),V(A(Zv),{class:`size-3`})],8,QZ)):U(``,!0)]),actions:j(()=>[V($,{variant:`primary`,disabled:f.value||!o.value?.enabled||[`running`,`starting`].includes(a.value.status),onClick:t[0]||=e=>re(`start`)},{default:j(()=>[V(A(_y),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.start`)),1)]),_:1},8,[`disabled`]),V($,{disabled:f.value||a.value.status===`stopped`,onClick:t[1]||=e=>re(`stop`)},{default:j(()=>[V(A(jy),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.stop`)),1)]),_:1},8,[`disabled`]),V($,{disabled:f.value||!o.value?.enabled,onClick:t[2]||=e=>re(`restart`)},{default:j(()=>[V(A(Sy),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.restart`)),1)]),_:1},8,[`disabled`]),V(BB,{label:A(Y)(`views.serverDetail.editHint`)},{default:j(()=>[V($,{variant:l.value?`secondary`:`ghost`,onClick:t[3]||=e=>{l.value=!l.value,c.value=`config`}},{default:j(()=>[V(A(gy),{class:`size-3.5`}),H(O(l.value?A(Y)(`views.serverDetail.closeEditor`):A(Y)(`common.edit`)),1)]),_:1},8,[`variant`])]),_:1},8,[`label`]),V(A(eg),null,{default:j(()=>[V(A(ag),{"as-child":``},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":A(Y)(`views.serverDetail.moreActions`,{label:s.value})},{default:j(()=>[V(A(Xv),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),V(A(rg),null,{default:j(()=>[V(A(tg),{"side-offset":4,align:`end`,class:`z-50 min-w-56 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[4]||=e=>A(r).setEnabled(a.value.id,!a.value.config.enabled)},{default:j(()=>[H(O(o.value?.enabled?A(Y)(`views.serverDetail.disableServer`):A(Y)(`views.serverDetail.enableServer`)),1)]),_:1}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[5]||=e=>A(r).setAutostart(a.value.id,!a.value.config.autostart)},{default:j(()=>[H(O(o.value?.autostart?A(Y)(`views.serverDetail.removeAutostart`):A(Y)(`views.serverDetail.autostart`)),1)]),_:1}),V(A(ig),{class:`my-1 h-px bg-line`}),B(`div`,$Z,[B(`p`,eQ,O(A(Y)(`views.serverDetail.bind`)),1),B(`div`,tQ,[(L(!0),R(I,null,P(ne.value,e=>(L(),R(`button`,{key:e.value,type:`button`,class:D([`rounded-control px-2 py-1 text-left font-mono text-2xs transition-colors duration-150 hover:bg-hover`,e.value===o.value?.bind?`text-accent`:`text-muted`]),onClick:t=>A(r).setBind(a.value.id,e.value)},O(e.label),11,nQ))),128))])]),V(A(ig),{class:`my-1 h-px bg-line`}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:t[6]||=e=>d.value=!0},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(` `+O(A(Y)(`views.serverDetail.removeServer`)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,[`title`,`back-to`,`back-label`]),B(`div`,rQ,[a.value.lastError?(L(),R(`div`,iQ,[B(`p`,aQ,O(a.value.lastError),1),a.value.status===`conflict`&&a.value.config.port!==null?(L(),z(vB,{key:0,port:a.value.config.port,busy:f.value,onConfirm:ae},null,8,[`port`,`busy`])):U(``,!0)])):U(``,!0),a.value.health===`unhealthy`?(L(),R(`p`,oQ,[a.value.unhealthySince===null?(L(),R(I,{key:1},[H(O(A(Y)(`views.serverDetail.probeFailed`)),1)],64)):(L(),R(I,{key:0},[H(O(A(Y)(`views.serverDetail.probeFailedFor`,{duration:A(jL)(A(_)-a.value.unhealthySince)})),1)],64))])):U(``,!0)]),V(DV,{class:`p-0`},{default:j(()=>[B(`dl`,sQ,[(L(!0),R(I,null,P(T.value,e=>(L(),R(`div`,{key:e.key,class:`min-w-0`},[B(`dt`,cQ,O(e.label),1),B(`dd`,lQ,O(e.value),1)]))),128))])]),_:1}),V(DV,null,{header:j(()=>[B(`h2`,uQ,O(A(Y)(`views.serverDetail.telemetry`)),1),B(`p`,dQ,O(A(Y)(`views.serverDetail.telemetryNote`)),1)]),default:j(()=>[B(`div`,fQ,[V(FB,{label:A(Y)(`common.cpu`),values:y.value,format:A(RL),max:100,"color-class":`text-cpu`,height:40},null,8,[`label`,`values`,`format`]),V(FB,{label:A(Y)(`views.serverDetail.memoryRss`),values:b.value,format:A(LL),"color-class":`text-mem`,height:40},null,8,[`label`,`values`,`format`]),V(FB,{label:A(Y)(`views.serverDetail.healthProbe`),values:x.value,format:e=>e===null?`—`:`${e} ms`,"color-class":`text-probe`,height:40},null,8,[`label`,`values`,`format`])])]),_:1}),B(`div`,pQ,[V(gW,{modelValue:c.value,"onUpdate:modelValue":t[7]||=e=>c.value=e,options:A(se),size:`md`},null,8,[`modelValue`,`options`]),B(`p`,{class:`hidden font-mono text-2xs text-faint sm:block`,title:te.value},O(te.value),9,mQ)]),c.value===`output`?(L(),z(cq,{key:0,lines:h.value,version:A(m),live:``,clearable:``,"download-url":a.value.config.logBufferLines>0?oe.value:void 0,"download-name":`${a.value.id}.log`,"empty-hint":C.value?A(Y)(`views.serverDetail.waitingFirstLine`):A(Y)(`views.serverDetail.neverWritten`),"min-height":`22rem`,onClear:t[8]||=e=>A(r).clearLogs(a.value.id)},null,8,[`lines`,`version`,`download-url`,`download-name`,`empty-hint`])):c.value===`config`?(L(),R(`div`,hQ,[l.value?(L(),z(KZ,{key:0,"server-id":a.value.id,"workspace-id":A(r).activeId.value,config:a.value.config,onSaved:t[9]||=e=>l.value=!1,onCancel:t[10]||=e=>l.value=!1},null,8,[`server-id`,`workspace-id`,`config`])):(L(),z(DV,{key:1},{header:j(()=>[B(`h2`,gQ,O(A(Y)(`views.serverDetail.effectiveConfig`)),1),B(`p`,_Q,O(A(Y)(`views.serverDetail.effectiveConfigNote`)),1)]),actions:j(()=>[V($,{size:`xs`,variant:`ghost`,onClick:t[11]||=e=>u.value=!u.value},{default:j(()=>[V(A(Gv),{class:`size-3`}),H(O(u.value?A(Y)(`views.serverDetail.fields`):A(Y)(`views.serverDetail.rawJson`)),1)]),_:1}),V(hU,{value:ee.value,label:A(Y)(`views.serverDetail.copyJson`)},null,8,[`value`,`label`]),V($,{size:`xs`,variant:`primary`,onClick:t[12]||=e=>l.value=!0},{default:j(()=>[V(A(gy),{class:`size-3`}),H(O(A(Y)(`common.edit`)),1)]),_:1})]),default:j(()=>[u.value?(L(),R(`pre`,vQ,O(ee.value),1)):(L(),R(`dl`,yQ,[(L(!0),R(I,null,P([{label:A(Y)(`views.serverDetail.fieldCommand`),value:o.value?.command},{label:A(Y)(`views.serverDetail.fieldArgs`),value:o.value?.args.join(` `)||`—`},{label:A(Y)(`views.serverDetail.fieldCwd`),value:o.value?.cwd},{label:A(Y)(`views.serverDetail.fieldEnv`),value:Object.keys(o.value?.env??{}).join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldDataEnvs`),value:Object.entries(o.value?.dataEnvs??{}).map(([e,t])=>`${e}=${t}`).join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldEnvFile`),value:o.value?.envFile||`—`},{label:A(Y)(`views.serverDetail.fieldPortBind`),value:`${o.value?.port??A(Y)(`common.none`)} · ${o.value?.bind}`},{label:A(Y)(`views.serverDetail.fieldOnPortConflict`),value:o.value?.onPortConflict},{label:A(Y)(`views.serverDetail.fieldLogBuffer`),value:A(_F)(`logs.lines`,o.value?.logBufferLines??0)},{label:A(Y)(`views.serverDetail.fieldRssLimit`),value:o.value?.resources.maxRssBytes?A(LL)(o.value.resources.maxRssBytes):A(Y)(`common.none`)},{label:A(Y)(`views.serverDetail.fieldHealth`),value:o.value?.health.enabled?`${o.value.health.mode} every ${o.value.health.intervalMs} ms`:A(Y)(`common.disabled`)},{label:A(Y)(`views.serverDetail.fieldRestart`),value:o.value?.restart.enabled?`${o.value.restart.maxRetries} retries, ×${o.value.restart.factor}`:A(Y)(`common.disabled`)},{label:A(Y)(`views.serverDetail.fieldStop`),value:o.value?`${o.value.stop.signal} after ${o.value.stop.graceMs} ms`:`—`},{label:A(Y)(`views.serverDetail.fieldBootstrap`),value:o.value?.bootstrap?`${o.value.bootstrap.command} ${o.value.bootstrap.args.join(` `)}`:A(Y)(`common.none`)},{label:A(Y)(`views.serverDetail.fieldBackupPaths`),value:o.value?.backupPaths.join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldDependsOn`),value:o.value?.dependsOn.join(`, `)||`—`}],e=>(L(),R(`div`,{key:e.label,class:`min-w-0 border-b border-line-soft pb-1.5 last:border-0`},[B(`dt`,bQ,O(e.label),1),B(`dd`,{class:`truncate font-mono text-xs text-ink`,title:String(e.value)},O(e.value),9,xQ)]))),128))]))]),_:1}))])):(L(),R(`div`,SQ,[V(DV,{class:`lg:col-span-2`},{header:j(()=>[B(`h2`,CQ,O(A(Y)(`views.serverDetail.eventHistory`)),1),B(`p`,wQ,O(A(Y)(`views.serverDetail.eventHistoryNote`)),1)]),default:j(()=>[V(fR,{servers:[a.value],now:A(_),limit:30},null,8,[`servers`,`now`])]),_:1}),V(DV,null,{header:j(()=>[B(`h2`,TQ,O(A(Y)(`views.serverDetail.dependencies`)),1)]),default:j(()=>[o.value&&o.value.dependsOn.length>0?(L(),R(`div`,EQ,[(L(!0),R(I,null,P(o.value.dependsOn,e=>(L(),z(n,{key:e,to:`/servers/${e}`,class:`rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},{default:j(()=>[H(O(e),1)]),_:2},1032,[`to`]))),128))])):(L(),R(`p`,DQ,[V(iB,{k:`views.serverDetail.startsOnItsOwn`},{code:j(()=>[...t[15]||=[B(`code`,null,`dependsOn`,-1)]]),_:1})]))]),_:1})])),V($z,{open:d.value,"onUpdate:open":t[14]||=e=>d.value=e,title:A(Y)(`views.serverDetail.removeTitle`),description:A(Y)(`views.serverDetail.removeDescription`,{label:s.value}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[13]||=e=>d.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ie},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(O(A(Y)(`common.remove`)),1)]),_:1})]),default:j(()=>[B(`p`,OQ,O(A(Y)(`views.serverDetail.removeNote`)),1)]),_:1},8,[`open`,`title`,`description`])])):(L(),R(`div`,qZ,[V(gL,{title:A(Y)(`views.serverDetail.goneTitle`),description:A(Y)(`views.serverDetail.goneDescription`,{id:i.value})},{action:j(()=>[V(n,{to:A(u1)(A(r).activeId.value,`servers`)},{default:j(()=>[V($,{variant:`primary`},{default:j(()=>[H(O(A(Y)(`views.serverDetail.backToServers`)),1)]),_:1})]),_:1},8,[`to`])]),_:1},8,[`title`,`description`])]))}}}),AQ={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},jQ={class:`flex flex-wrap items-center gap-2`},MQ={class:`relative ml-auto w-full sm:w-64`},NQ=[`placeholder`,`aria-label`],PQ=[`aria-label`],FQ={key:0,class:`grid gap-4 lg:grid-cols-2`},IQ={key:3,class:`grid gap-4 lg:grid-cols-2`},LQ=N({__name:`ServersView`,setup(e){let t=XN(),n=dP(),{servers:r}=n,i=k(!1),a=k(``),o=k(`all`),s=[{value:`all`,labelKey:`views.servers.filterAll`},{value:`running`,labelKey:`views.servers.filterRunning`},{value:`stopped`,labelKey:`views.servers.filterStopped`},{value:`attention`,labelKey:`views.servers.filterAttention`},{value:`disabled`,labelKey:`views.servers.filterDisabled`}],c=W(()=>t.appState.value===null),l=W(()=>{let e=a.value.trim().toLowerCase();return r.value.filter(t=>o.value===`running`&&t.status!==`running`||o.value===`stopped`&&![`stopped`,`stopping`].includes(t.status)||o.value===`disabled`&&t.config.enabled||o.value===`attention`&&t.status!==`crashed`&&t.status!==`conflict`&&t.health!==`unhealthy`?!1:e.length===0||`${t.id} ${t.config.label??``} ${t.config.command} ${t.config.port??``}`.toLowerCase().includes(e))}),u=W(()=>({all:r.value.length,running:r.value.filter(e=>e.status===`running`).length,attention:r.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`).length})),d=W(()=>s.map(e=>({value:e.value,label:`${Y(e.labelKey)}${e.value===`all`?` ${u.value.all}`:e.value===`running`?` ${u.value.running}`:e.value===`attention`&&u.value.attention>0?` ${u.value.attention}`:``}`})));return(e,s)=>(L(),R(`div`,AQ,[V(CV,{title:A(Y)(`nav.servers`),description:A(Y)(`views.servers.description`,{workspace:A(n).selected.value?.label??A(Y)(`nav.workspace`)})},{actions:j(()=>[V($,{variant:`ghost`,onClick:s[0]||=e=>A(n).startAll()},{default:j(()=>[V(A(_y),{class:`size-3.5`}),H(O(A(Y)(`views.actions.startAll`)),1)]),_:1}),V($,{variant:`ghost`,onClick:s[1]||=e=>A(n).stopAll()},{default:j(()=>[V(A(jy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.stopAll`)),1)]),_:1}),V($,{variant:`primary`,onClick:s[2]||=e=>i.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1})]),_:1},8,[`title`,`description`]),B(`div`,jQ,[V(gW,{modelValue:o.value,"onUpdate:modelValue":s[3]||=e=>o.value=e,options:d.value},null,8,[`modelValue`,`options`]),B(`div`,MQ,[V(A(wy),{class:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),Sr(B(`input`,{"onUpdate:modelValue":s[4]||=e=>a.value=e,type:`search`,placeholder:A(Y)(`views.servers.filterPlaceholder`),class:D([`pl-8`,[A(Sz)]]),"aria-label":A(Y)(`views.servers.filterAria`)},null,10,NQ),[[Jl,a.value]]),a.value.length>0?(L(),R(`button`,{key:0,type:`button`,class:`absolute right-1.5 top-1/2 grid size-6 -translate-y-1/2 place-items-center rounded-control text-faint hover:text-ink`,"aria-label":A(Y)(`views.servers.clearFilter`),onClick:s[5]||=e=>a.value=``},[V(A(zy),{class:`size-3.5`})],8,PQ)):U(``,!0)])]),c.value?(L(),R(`div`,FQ,[(L(),R(I,null,P(4,e=>V(OV,{key:e,class:`h-72 w-full`,rounded:`rounded-panel`})),64))])):A(r).length===0?(L(),z(gL,{key:1,title:A(Y)(`views.servers.emptyTitle`),description:A(Y)(`views.servers.emptyDescription`)},{icon:j(()=>[V(A(Ty),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:s[6]||=e=>i.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):l.value.length===0?(L(),z(gL,{key:2,compact:``,title:A(Y)(`views.servers.noMatchTitle`),description:A(Y)(`views.servers.noMatchDescription`)},{action:j(()=>[V($,{onClick:s[7]||=e=>{a.value=``,o.value=`all`}},{default:j(()=>[H(O(A(Y)(`views.servers.clearFilters`)),1)]),_:1})]),_:1},8,[`title`,`description`])):(L(),R(`div`,IQ,[(L(!0),R(I,null,P(l.value,e=>(L(),z(gV,{key:e.id,server:e,"workspace-id":A(n).activeId.value,series:A(n).seriesOf(e.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))])),V(dB,{open:i.value,"onUpdate:open":s[8]||=e=>i.value=e,"workspace-id":A(n).activeId.value},null,8,[`open`,`workspace-id`])]))}}),RQ=0;function zQ(){return RQ+=1,`ddns-row-${RQ}`}function BQ(){return zQ()}function VQ(e){let t=structuredClone(dn(e));return t.domains=(t.domains??[]).map(e=>({...e,key:e.key??zQ()})),t}function HQ(e){let t=structuredClone(dn(e));return{...t,domains:t.domains.map(({key:e,...t})=>t)}}function UQ(e,t){return e===null||t===null?e===t:JSON.stringify(HQ(e))===JSON.stringify(HQ(t))}var WQ={intervalMs:3e5,ttl:1};function GQ(e,t){return e===null||Number.isNaN(e)?WQ[t]:e}var KQ={class:`space-y-3`},qQ={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},JQ={class:`mb-3`},YQ={class:`text-xs font-semibold text-ink`},XQ={class:`mt-0.5 text-2xs leading-4 text-muted`},ZQ={key:0,class:`divide-y divide-line-soft`},QQ={class:`min-w-0`},$Q={class:`font-mono text-xs text-ink`},e$={class:`text-2xs text-faint`},t$={key:0},n$={class:`ml-auto flex items-center gap-2`},r$={key:1,class:`text-2xs text-muted`},i$={class:`mt-3 grid gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},a$={class:`mt-1.5 text-2xs text-faint`},o$={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},s$={class:`mb-3`},c$={class:`text-xs font-semibold text-ink`},l$={class:`mt-0.5 text-2xs leading-4 text-muted`},u$={key:0,class:`space-y-2`},d$={class:`flex flex-wrap items-end gap-2`},f$={class:`min-w-40 flex-1`},p$={class:`w-44 shrink-0`},m$={class:`mt-1 flex flex-wrap items-center gap-x-4 gap-y-1`},h$={key:1,class:`text-2xs text-muted`},g$={class:`mt-3 grid gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},_$={key:1,class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},v$={class:`mb-2 flex flex-wrap items-center gap-x-3 gap-y-1`},y$={class:`text-xs font-semibold text-ink`},b$={key:0,class:`text-2xs text-muted`},x$={key:1,class:`font-mono text-2xs text-faint`},S$={key:2,class:`font-mono text-2xs text-faint`},C$={key:3,class:`ml-auto text-2xs text-faint`},w$={class:`overflow-x-auto`},T$={class:`w-full text-left text-xs`},E$={class:`text-2xs text-faint`},D$={class:`py-1 pr-3 font-medium`},O$={class:`py-1 pr-3 font-medium`},k$={class:`py-1 pr-3 font-medium`},A$={class:`py-1 pr-3 font-medium`},j$={class:`py-1 font-medium`},M$={class:`py-1.5 pr-3 font-mono text-2xs text-ink`},N$={class:`py-1.5 pr-3 text-2xs text-muted`},P$={class:`py-1.5 pr-3`},F$={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},I$={class:`py-1.5 text-2xs text-faint`},L$={class:`space-y-3`},R$={class:`text-2xs leading-4 text-muted`},z$=[`href`],B$=N({__name:`DdnsSection`,props:{patch:{default:null},patchModifiers:{},baseline:{default:null},baselineModifiers:{}},emits:[`update:patch`,`update:baseline`],setup(e,{expose:t}){let n=so(e,`patch`),r=so(e,`baseline`),i={pending:{labelKey:`settings.ddns.statePending`,tone:`neutral`},ok:{labelKey:`settings.ddns.stateOk`,tone:`ok`},unchanged:{labelKey:`settings.ddns.stateUnchanged`,tone:`neutral`},skipped:{labelKey:`settings.ddns.stateSkipped`,tone:`warn`},error:{labelKey:`settings.ddns.stateError`,tone:`danger`}},a=XN(),o=dP(),s=vN(),c=k(null),l=k(null),u=k(null),d=k(null),f=k(!1),p=tn({id:``,provider:`cloudflare`}),m=tn({host:``,account:``}),h=k(null),g=k({}),_=k(!1),v=k(null),y=W(()=>c.value?.providers??[]),b=W(()=>l.value?.accounts??[]),x=W(()=>l.value?.domains??[]),S=W(()=>b.value.map(e=>e.id).join(`,`)),C=W(()=>y.value.map(e=>({value:e.id,label:e.label}))),w=W(()=>b.value.map(e=>({value:e.id,label:e.id}))),T=W(()=>o.selected.value?.ddns??c.value?.status??null),ee=W(()=>l.value!==null&&r.value!==null&&!UQ(l.value,r.value)),te=W(()=>/^[a-z0-9][a-z0-9_-]*$/.test(p.id)&&!b.value.some(e=>e.id===p.id)),ne=W(()=>m.host.includes(`.`)&&m.account.length>0&&!x.value.some(e=>e.host.toLowerCase()===m.host.trim().toLowerCase())),re=W({get:()=>h.value!==null,set:e=>{e||(h.value=null)}}),ie=W(()=>h.value===null?[]:ae(h.value.provider)?.fields??[]);function ae(e){return y.value.find(t=>t.id===e)??null}function oe(e){let t=b.value.find(t=>t.id===e.account);return t===void 0?null:ae(t.provider)}function se(e){return ae(e.provider)?.label??e.provider}function ce(e){return c.value?.credentials.includes(e)===!0}function le(e){return x.value.filter(t=>t.account===e).length}function E(e,t,n){let r=n?[...new Set([...e.types,t])]:e.types.filter(e=>e!==t);e.types=r.length>0?r:e.types}function ue(e,t,n){n==null||n===``?delete e[t]:e[t]=n}function de(e,t,n){e!==null&&(e[t]=GQ(n,t))}function fe(){n.value=l.value===null||r.value===null||UQ(l.value,r.value)?null:HQ(l.value)}function pe(e,t=!1){c.value=e,r.value=VQ(e.config),t||(l.value=VQ(e.config)),fe()}async function me(){u.value=null;try{pe(await YM(o.activeId.value)),p.provider=C.value[0]?.value??`cloudflare`,m.account=b.value[0]?.id??``}catch(e){u.value=Lj(e)}}na(()=>{me()}),M(()=>o.activeId.value,(e,t)=>{e!==t&&e.length>0&&me()}),M(l,fe,{deep:!0}),M(S,()=>{b.value.some(e=>e.id===m.account)||(m.account=b.value[0]?.id??``)});function he(){te.value&&l.value!==null&&(l.value.accounts.push({id:p.id,provider:p.provider,label:``}),p.id=``)}function ge(e){l.value===null||le(e.id)>0||(l.value.accounts=l.value.accounts.filter(t=>t.id!==e.id))}function _e(){ne.value&&l.value!==null&&(l.value.domains.push({host:m.host.trim().toLowerCase(),account:m.account,types:[`A`],proxied:!1,enabled:!0,key:BQ()}),m.host=``)}function ve(e){l.value!==null&&(l.value.domains=l.value.domains.filter(t=>t!==e))}function ye(){r.value!==null&&(l.value=VQ(r.value)),d.value=null}async function be(){if(!f.value){f.value=!0,d.value=null;try{pe(await $M(o.activeId.value),!0),s.success(T.value?.lastResult??Y(`settings.ddns.passFinished`))}catch(e){d.value=Lj(e)}finally{f.value=!1}}}function xe(e){h.value=e,g.value=Object.fromEntries((ae(e.provider)?.fields??[]).map(e=>[e.key,``])),v.value=null}async function D(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{pe(await ZM(o.activeId.value,e.id,e.provider,g.value),!0),s.success(Y(`settings.ddns.credentialsSaved`,{account:e.id})),h.value=null}catch(e){v.value=Lj(e)}finally{_.value=!1}}}async function Se(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{pe(await QM(o.activeId.value,e.id),!0),s.success(Y(`settings.ddns.credentialsRemoved`,{account:e.id})),h.value=null}catch(e){v.value=Lj(e)}finally{_.value=!1}}}return t({reload:me}),(e,t)=>(L(),R(I,null,[B(`div`,KQ,[u.value?(L(),z(_H,{key:0,tone:`danger`,title:A(Y)(`settings.ddns.loadErrorTitle`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`])):U(``,!0),l.value===null?U(``,!0):(L(),R(I,{key:1},[V(gz,{title:A(Y)(`settings.ddns.title`),description:A(Y)(`settings.ddns.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!ee.value,onClick:ye},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`]),T.value?.running?(L(),z(_U,{key:0,tone:`info`,dot:``},{default:j(()=>[H(O(A(Y)(`settings.ddns.checking`)),1)]),_:1})):T.value?.enabled?(L(),z(_U,{key:1,tone:T.value.records.some(e=>e.state===`error`)?`danger`:`ok`,dot:``},{default:j(()=>[H(O(T.value.records.some(e=>e.state===`error`)?A(Y)(`settings.ddns.needsAttention`):A(Y)(`settings.ddns.watching`)),1)]),_:1},8,[`tone`])):U(``,!0),V($,{size:`xs`,variant:`ghost`,loading:f.value,onClick:be},{default:j(()=>[H(O(A(Y)(`settings.ddns.updateNow`)),1)]),_:1},8,[`loading`])]),default:j(()=>[V(Vz,{modelValue:l.value.enabled,"onUpdate:modelValue":t[0]||=e=>l.value.enabled=e,label:A(Y)(`settings.ddns.enabled`),hint:A(Y)(`settings.ddns.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{"model-value":l.value.intervalMs,label:A(Y)(`settings.ddns.interval`),min:6e4,step:6e4,hint:A(Y)(`settings.ddns.intervalHint`),"onUpdate:modelValue":t[1]||=e=>de(l.value,`intervalMs`,e)},null,8,[`model-value`,`label`,`hint`]),V(Dz,{"model-value":l.value.ttl,label:A(Y)(`settings.ddns.ttl`),min:1,hint:A(Y)(`settings.ddns.ttlHint`),"onUpdate:modelValue":t[2]||=e=>de(l.value,`ttl`,e)},null,8,[`model-value`,`label`,`hint`]),V(Vz,{modelValue:l.value.ipv4.enabled,"onUpdate:modelValue":t[3]||=e=>l.value.ipv4.enabled=e,label:A(Y)(`settings.ddns.detectIpv4`),hint:A(Y)(`settings.ddns.detectIpv4Hint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:l.value.ipv6.enabled,"onUpdate:modelValue":t[4]||=e=>l.value.ipv6.enabled=e,label:A(Y)(`settings.ddns.detectIpv6`),hint:A(Y)(`settings.ddns.detectIpv6Hint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),d.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(d.value),1)]),_:1})):U(``,!0),B(`section`,qQ,[B(`header`,JQ,[B(`h3`,YQ,O(A(Y)(`settings.ddns.accountsTitle`)),1),B(`p`,XQ,O(A(Y)(`settings.ddns.accountsDescription`)),1)]),b.value.length>0?(L(),R(`ul`,ZQ,[(L(!0),R(I,null,P(b.value,e=>(L(),R(`li`,{key:e.id,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0`},[B(`div`,QQ,[B(`p`,$Q,O(e.id),1),B(`p`,e$,[H(O(se(e))+` `,1),le(e.id)>0?(L(),R(`span`,t$,` · `+O(A(_F)(`settings.ddns.hostnameCount`,le(e.id))),1)):U(``,!0)])]),B(`div`,n$,[V(_U,{tone:ce(e.id)?`ok`:`warn`,dot:``},{default:j(()=>[H(O(ce(e.id)?A(Y)(`settings.ddns.credentialsSet`):A(Y)(`settings.ddns.noCredentials`)),1)]),_:2},1032,[`tone`]),V($,{size:`xs`,variant:`secondary`,onClick:t=>xe(e)},{default:j(()=>[H(O(A(Y)(`settings.ddns.credentials`)),1)]),_:1},8,[`onClick`]),V($,{size:`xs`,variant:`danger-ghost`,disabled:le(e.id)>0,title:le(e.id)>0?A(Y)(`settings.ddns.removeAccountBlocked`):void 0,onClick:t=>ge(e)},{default:j(()=>[H(O(A(Y)(`common.remove`)),1)]),_:1},8,[`disabled`,`title`,`onClick`])])]))),128))])):(L(),R(`p`,r$,O(A(Y)(`settings.ddns.noAccounts`)),1)),B(`div`,i$,[V(Nz,{modelValue:p.provider,"onUpdate:modelValue":t[5]||=e=>p.provider=e,label:A(Y)(`settings.ddns.provider`),options:C.value},null,8,[`modelValue`,`label`,`options`]),V(Rz,{modelValue:p.id,"onUpdate:modelValue":t[6]||=e=>p.id=e,label:A(Y)(`settings.ddns.accountId`),placeholder:A(Y)(`settings.ddns.accountIdPlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V($,{variant:`secondary`,disabled:!te.value,onClick:he},{default:j(()=>[H(O(A(Y)(`common.add`)),1)]),_:1},8,[`disabled`])]),B(`p`,a$,O(A(Y)(`settings.ddns.accountIdHint`)),1)]),B(`section`,o$,[B(`header`,s$,[B(`h3`,c$,O(A(Y)(`settings.ddns.hostnamesTitle`)),1),B(`p`,l$,O(A(Y)(`settings.ddns.hostnamesDescription`)),1)]),x.value.length>0?(L(),R(`ul`,u$,[(L(!0),R(I,null,P(x.value,e=>(L(),R(`li`,{key:e.key,class:`rounded-control border border-line-soft bg-panel/50 p-2.5`},[B(`div`,d$,[B(`div`,f$,[V(Rz,{modelValue:e.host,"onUpdate:modelValue":t=>e.host=t,label:A(Y)(`common.hostname`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`])]),B(`div`,p$,[V(Nz,{modelValue:e.account,"onUpdate:modelValue":t=>e.account=t,label:A(Y)(`settings.ddns.account`),options:w.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`options`])]),V(IH,{modelValue:e.enabled,"onUpdate:modelValue":t=>e.enabled=t,label:A(Y)(`common.enabled`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`]),V($,{size:`xs`,variant:`danger-ghost`,onClick:t=>ve(e)},{default:j(()=>[H(O(A(Y)(`common.remove`)),1)]),_:1},8,[`onClick`])]),B(`div`,m$,[V(IH,{"model-value":e.types.includes(`A`),label:A(Y)(`settings.ddns.recordA`),"onUpdate:modelValue":t=>E(e,`A`,t===!0)},null,8,[`model-value`,`label`,`onUpdate:modelValue`]),V(IH,{"model-value":e.types.includes(`AAAA`),label:A(Y)(`settings.ddns.recordAaaa`),disabled:oe(e)?.families.includes(`AAAA`)===!1,hint:oe(e)?.families.includes(`AAAA`)===!1?A(Y)(`settings.ddns.aaaaUnsupported`):void 0,"onUpdate:modelValue":t=>E(e,`AAAA`,t===!0)},null,8,[`model-value`,`label`,`disabled`,`hint`,`onUpdate:modelValue`]),oe(e)?.proxied===!0?(L(),z(IH,{key:0,modelValue:e.proxied,"onUpdate:modelValue":t=>e.proxied=t,label:A(Y)(`settings.ddns.proxied`),hint:A(Y)(`settings.ddns.proxiedHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`])):U(``,!0),e.types.includes(`AAAA`)&&!l.value.ipv6.enabled?(L(),z(_U,{key:1,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.ddns.ipv6Off`)),1)]),_:1})):U(``,!0)]),V(Jz,{title:A(Y)(`settings.ddns.advanced`),hint:A(Y)(`settings.ddns.advancedHint`),class:`mt-2`},{default:j(()=>[V(Rz,{"model-value":e.zone??``,label:A(Y)(`settings.ddns.registeredDomain`),placeholder:A(Y)(`settings.ddns.registeredDomainPlaceholder`),hint:A(Y)(`settings.ddns.registeredDomainHint`),"onUpdate:modelValue":t=>ue(e,`zone`,t)},null,8,[`model-value`,`label`,`placeholder`,`hint`,`onUpdate:modelValue`]),oe(e)?.ttl===!1?U(``,!0):(L(),z(Dz,{key:0,"model-value":e.ttl??null,min:1,nullable:``,label:A(Y)(`settings.ddns.ttlOverride`),hint:A(Y)(`settings.ddns.ttlOverrideHint`),"onUpdate:modelValue":t=>ue(e,`ttl`,t)},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`]))]),_:2},1032,[`title`,`hint`])]))),128))])):(L(),R(`p`,h$,O(A(Y)(`settings.ddns.noHostnames`)),1)),B(`div`,g$,[V(Rz,{modelValue:m.host,"onUpdate:modelValue":t[7]||=e=>m.host=e,label:A(Y)(`common.hostname`),placeholder:A(Y)(`settings.ddns.hostnamePlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V(Nz,{modelValue:m.account,"onUpdate:modelValue":t[8]||=e=>m.account=e,label:A(Y)(`settings.ddns.account`),options:w.value,disabled:b.value.length===0},null,8,[`modelValue`,`label`,`options`,`disabled`]),V($,{variant:`secondary`,disabled:!ne.value,onClick:_e},{default:j(()=>[H(O(A(Y)(`common.add`)),1)]),_:1},8,[`disabled`])])]),T.value!==null&&T.value.records.length>0?(L(),R(`section`,_$,[B(`header`,v$,[B(`h3`,y$,O(A(Y)(`settings.ddns.lastPass`)),1),T.value.lastResult?(L(),R(`span`,b$,O(T.value.lastResult),1)):U(``,!0),T.value.ipv4?(L(),R(`span`,x$,O(A(Y)(`settings.ddns.ipv4Value`,{address:T.value.ipv4})),1)):U(``,!0),T.value.ipv6?(L(),R(`span`,S$,O(A(Y)(`settings.ddns.ipv6Value`,{address:T.value.ipv6})),1)):U(``,!0),T.value.lastRunAt?(L(),R(`span`,C$,O(A(NL)(T.value.lastRunAt,A(a).now.value)),1)):U(``,!0)]),B(`div`,w$,[B(`table`,T$,[B(`thead`,null,[B(`tr`,E$,[B(`th`,D$,O(A(Y)(`common.hostname`)),1),B(`th`,O$,O(A(Y)(`settings.ddns.type`)),1),B(`th`,k$,O(A(Y)(`settings.ddns.state`)),1),B(`th`,A$,O(A(Y)(`settings.ddns.address`)),1),B(`th`,j$,O(A(Y)(`settings.ddns.detail`)),1)])]),B(`tbody`,null,[(L(!0),R(I,null,P(T.value.records,e=>(L(),R(`tr`,{key:`${e.host}|${e.type}`,class:`border-t border-line-soft align-top`},[B(`td`,M$,O(e.host),1),B(`td`,N$,O(e.type),1),B(`td`,P$,[V(_U,{tone:i[e.state].tone,dot:``},{default:j(()=>[H(O(A(Y)(i[e.state].labelKey)),1)]),_:2},1032,[`tone`])]),B(`td`,F$,O(e.ip??`—`),1),B(`td`,I$,O(e.message??`—`),1)]))),128))])])])])):U(``,!0)],64))]),V($z,{open:re.value,"onUpdate:open":t[10]||=e=>re.value=e,title:A(Y)(`settings.ddns.credentialsTitle`),description:h.value===null?``:`${se(h.value)} — ${h.value.id}`,width:`w-[min(92vw,32rem)]`},{footer:j(()=>[h.value!==null&&ce(h.value.id)?(L(),z(mH,{key:0,label:A(Y)(`settings.ddns.forget`),"confirm-label":A(Y)(`settings.ddns.forgetConfirm`),title:A(Y)(`settings.ddns.forgetTitle`),hint:A(Y)(`settings.ddns.forgetHint`),loading:_.value,disabled:_.value,onConfirm:Se},null,8,[`label`,`confirm-label`,`title`,`hint`,`loading`,`disabled`])):U(``,!0),V($,{size:`sm`,variant:`ghost`,disabled:_.value,onClick:t[9]||=e=>re.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{size:`sm`,variant:`primary`,loading:_.value,disabled:Object.values(g.value).every(e=>e.trim().length===0),onClick:D},{default:j(()=>[H(O(A(Y)(`settings.ddns.saveCredentials`)),1)]),_:1},8,[`loading`,`disabled`])]),default:j(()=>[B(`div`,L$,[B(`p`,R$,O(A(Y)(`settings.ddns.credentialsDescription`)),1),(L(!0),R(I,null,P(ie.value,e=>(L(),z(Rz,{key:e.key,modelValue:g.value[e.key],"onUpdate:modelValue":t=>g.value[e.key]=t,type:`password`,autocomplete:`off`,label:e.label,hint:`${e.hint}${e.optional?` ${A(Y)(`settings.ddns.optional`)}`:``}`,wide:``},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]))),128)),h.value===null?U(``,!0):(L(),R(`a`,{key:0,class:`inline-block text-2xs text-accent underline decoration-line underline-offset-2`,href:ae(h.value.provider)?.docsUrl,target:`_blank`,rel:`noreferrer`},O(A(Y)(`settings.ddns.whereToGet`)),9,z$)),v.value?(L(),z(_H,{key:1,tone:`danger`},{default:j(()=>[H(O(v.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])],64))}}),V$={class:`mt-3 space-y-3`},H$=N({__name:`DefaultsSection`,props:za({dirty:{type:Boolean}},{defaults:{required:!0},defaultsModifiers:{}}),emits:za([`reset`],[`update:defaults`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`defaults`),a=ZR(()=>i.value.logBufferLines,e=>i.value.logBufferLines=e,500);return(e,t)=>(L(),R(I,null,[V(gz,{title:A(Y)(`settings.defaults.title`),description:A(Y)(`settings.defaults.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`settings.defaults.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:i.value.autostart,"onUpdate:modelValue":t[2]||=e=>i.value.autostart=e,label:A(Y)(`settings.defaults.autostart`)},null,8,[`modelValue`,`label`]),V(Nz,{modelValue:i.value.bind,"onUpdate:modelValue":t[3]||=e=>i.value.bind=e,label:A(Y)(`settings.defaults.bind`),options:[{value:`local`,label:A(Y)(`settings.defaults.bindLocal`)},{value:`lan`,label:A(Y)(`settings.defaults.bindLan`)}]},null,8,[`modelValue`,`label`,`options`]),V(Nz,{modelValue:i.value.onPortConflict,"onUpdate:modelValue":t[4]||=e=>i.value.onPortConflict=e,label:A(Y)(`settings.defaults.onPortConflict`),options:[{value:`block`,label:A(Y)(`settings.defaults.conflictBlock`)},{value:`warn`,label:A(Y)(`settings.defaults.conflictWarn`)},{value:`follow`,label:A(Y)(`settings.defaults.conflictFollow`)},{value:`reclaim`,label:A(Y)(`settings.defaults.conflictReclaim`)},{value:`kill`,label:A(Y)(`settings.defaults.conflictKill`)}]},null,8,[`modelValue`,`label`,`options`]),V(Dz,{modelValue:A(a),"onUpdate:modelValue":t[5]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.defaults.logBufferLines`),min:50,max:1e5,hint:A(Y)(`settings.defaults.logBufferLinesHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),B(`div`,V$,[V(Hz,{restart:i.value.restart,"onUpdate:restart":t[6]||=e=>i.value.restart=e,health:i.value.health,"onUpdate:health":t[7]||=e=>i.value.health=e,stop:i.value.stop,"onUpdate:stop":t[8]||=e=>i.value.stop=e},null,8,[`restart`,`health`,`stop`])])],64))}}),U$={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},W$={class:`text-xs font-medium text-muted`},G$={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},K$={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},q$={class:`text-2xs leading-4 text-faint`},J$=N({__name:`LogsSection`,props:za({logsDir:{},dirty:{type:Boolean}},{logs:{required:!0},logsModifiers:{}}),emits:za([`reset`],[`update:logs`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`logs`),a=dP(),o=ZR(()=>i.value.maxBytes,e=>i.value.maxBytes=e,2e6),s=ZR(()=>i.value.keep,e=>i.value.keep=e,3),c=W(()=>n.logsDir??`—`);return(e,t)=>{let l=pa(`RouterLink`);return L(),z(gz,{title:A(Y)(`settings.logs.title`),description:A(Y)(`settings.logs.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.persist,"onUpdate:modelValue":t[1]||=e=>i.value.persist=e,label:A(Y)(`settings.logs.persist`),hint:A(Y)(`settings.logs.persistHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(o),"onUpdate:modelValue":t[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.logs.maxBytes`),min:1e4,max:1e8,hint:A(Y)(`settings.logs.maxBytesHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":t[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.logs.keep`),min:1,max:10},null,8,[`modelValue`,`label`]),B(`div`,U$,[B(`span`,W$,O(A(Y)(`settings.logs.directory`)),1),B(`div`,G$,[B(`span`,K$,O(c.value),1),V(hU,{value:c.value,label:A(Y)(`settings.logs.copyDirectory`)},null,8,[`value`,`label`])]),B(`p`,q$,[V(iB,{k:`settings.logs.browseHint`},{logs:j(()=>[V(l,{to:A(u1)(A(a).activeId.value,`logs`),class:`text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`},{default:j(()=>[H(O(A(Y)(`nav.logs`)),1)]),_:1},8,[`to`])]),_:1})])])]),_:1},8,[`title`,`description`])}}}),Y$={class:`flex items-center gap-2 border-t border-line-soft pt-3 sm:col-span-2`},X$={class:`text-xs font-medium text-muted`},Z$={class:`text-2xs text-faint`},Q$={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},$$={key:0,class:`sm:col-span-2`},e1={class:`mb-1.5 text-xs text-muted`},t1={class:`flex flex-wrap gap-1.5`},n1={key:1,class:`sm:col-span-2`},r1={class:`text-2xs leading-4 text-faint`},i1={key:2,class:`space-y-2 sm:col-span-2`},a1=N({__name:`NotificationsSection`,props:za({status:{},dirty:{type:Boolean}},{telegram:{required:!0},telegramModifiers:{}}),emits:za([`reset`],[`update:telegram`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`telegram`),a=XN(),o=dP(),s=ZR(()=>i.value.cooldownMs,e=>i.value.cooldownMs=e,12e4),c=k(``),l=k(null),u=k(null),d=k([]),f=k(!1),p=W(()=>n.status?.tokenSet===!0),m=W(()=>n.status?.lastResult??null),h=W(()=>n.status?.lastResultAt??null),g=W(()=>p.value?Y(`settings.telegram.tokenSavedPlaceholder`):Y(`settings.telegram.tokenPlaceholder`));async function _(){f.value=!0,u.value=null,l.value=null;try{let e=await GM(o.activeId.value,c.value.trim());c.value=``,l.value=e.username?Y(`settings.telegram.tokenSavedFor`,{username:e.username}):Y(`settings.telegram.tokenSaved`),await a.refresh()}catch(e){u.value=Lj(e)}finally{f.value=!1}}async function v(){f.value=!0,u.value=null,l.value=null;try{await KM(o.activeId.value),l.value=Y(`settings.telegram.tokenRemoved`),await a.refresh()}catch(e){u.value=Lj(e)}finally{f.value=!1}}async function y(){f.value=!0,u.value=null,l.value=null;try{let e=c.value.trim(),t=await JM(o.activeId.value,e.length>0?{botToken:e}:{});d.value=t.chats,t.chats.length===0&&(u.value=Y(`settings.telegram.noChats`))}catch(e){u.value=Lj(e)}finally{f.value=!1}}async function b(){f.value=!0,u.value=null,l.value=null;try{let e=c.value.trim(),t=await qM(o.activeId.value,{chatId:i.value.chatId.length>0?i.value.chatId:void 0,...e.length>0?{botToken:e}:{}});t.ok?l.value=Y(`settings.telegram.testSent`):u.value=t.error??Y(`settings.telegram.testFailed`),await a.refresh()}catch(e){u.value=Lj(e)}finally{f.value=!1}}return(e,t)=>(L(),z(gz,{title:A(Y)(`settings.telegram.title`),description:A(Y)(`settings.telegram.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.telegram.enabled`),hint:A(Y)(`settings.telegram.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:i.value.chatId,"onUpdate:modelValue":t[2]||=e=>i.value.chatId=e,label:A(Y)(`settings.telegram.chatId`),placeholder:A(Y)(`settings.telegram.chatIdPlaceholder`),hint:A(Y)(`settings.telegram.chatIdHint`)},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":t[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.telegram.cooldown`),min:0,hint:A(Y)(`settings.telegram.cooldownHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:i.value.onCrash,"onUpdate:modelValue":t[4]||=e=>i.value.onCrash=e,label:A(Y)(`settings.telegram.onCrash`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:i.value.onUnhealthy,"onUpdate:modelValue":t[5]||=e=>i.value.onUnhealthy=e,label:A(Y)(`settings.telegram.onUnhealthy`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:i.value.onForcedRestart,"onUpdate:modelValue":t[6]||=e=>i.value.onForcedRestart=e,label:A(Y)(`settings.telegram.onForcedRestart`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:i.value.onRecovered,"onUpdate:modelValue":t[7]||=e=>i.value.onRecovered=e,label:A(Y)(`settings.telegram.onRecovered`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:i.value.onHost,"onUpdate:modelValue":t[8]||=e=>i.value.onHost=e,label:A(Y)(`settings.telegram.onHost`),hint:A(Y)(`settings.telegram.onHostHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:i.value.onDdns,"onUpdate:modelValue":t[9]||=e=>i.value.onDdns=e,label:A(Y)(`settings.telegram.onDdns`),hint:A(Y)(`settings.telegram.onDdnsHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),B(`div`,Y$,[B(`span`,X$,O(A(Y)(`settings.telegram.botToken`)),1),V(_U,{tone:p.value?`ok`:`warn`,dot:``},{default:j(()=>[H(O(p.value?A(Y)(`settings.telegram.tokenSet`):A(Y)(`settings.telegram.noToken`)),1)]),_:1},8,[`tone`]),B(`span`,Z$,O(A(Y)(`settings.telegram.tokenNote`)),1)]),V(Rz,{modelValue:c.value,"onUpdate:modelValue":t[10]||=e=>c.value=e,type:`password`,autocomplete:`off`,label:A(Y)(`settings.telegram.botToken`),placeholder:g.value,wide:``},null,8,[`modelValue`,`label`,`placeholder`]),B(`div`,Q$,[V($,{variant:`primary`,disabled:f.value||c.value.trim().length===0,loading:f.value&&c.value.trim().length>0,onClick:_},{default:j(()=>[H(O(A(Y)(`settings.telegram.saveToken`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:f.value,onClick:y},{default:j(()=>[H(O(A(Y)(`settings.telegram.detectChats`)),1)]),_:1},8,[`disabled`]),V($,{variant:`secondary`,disabled:f.value,onClick:b},{default:j(()=>[H(O(A(Y)(`settings.telegram.sendTest`)),1)]),_:1},8,[`disabled`]),p.value?(L(),z(mH,{key:0,label:A(Y)(`settings.telegram.removeToken`),"confirm-label":A(Y)(`settings.telegram.removeTokenConfirm`),"confirm-variant":`danger`,title:A(Y)(`settings.telegram.removeTokenTitle`),hint:A(Y)(`settings.telegram.removeTokenHint`),disabled:f.value,onConfirm:v},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),d.value.length>0?(L(),R(`div`,$$,[B(`p`,e1,O(A(Y)(`settings.telegram.chatsSeen`)),1),B(`div`,t1,[(L(!0),R(I,null,P(d.value,e=>(L(),z($,{key:String(e.id),size:`xs`,variant:`secondary`,onClick:t=>i.value.chatId=String(e.id)},{default:j(()=>[H(O(e.title)+` (`+O(e.id)+`) `,1)]),_:2},1032,[`onClick`]))),128))])])):U(``,!0),m.value?(L(),R(`div`,n1,[B(`p`,r1,O(A(Y)(`settings.telegram.lastSend`,{result:m.value}))+O(h.value?` · ${A(NL)(h.value,A(a).now.value)}`:``),1)])):U(``,!0),u.value||l.value?(L(),R(`div`,i1,[u.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(u.value),1)]),_:1})):U(``,!0),l.value?(L(),z(_H,{key:1,tone:`ok`},{default:j(()=>[H(O(l.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`]))}}),o1={class:`mt-1`},s1=N({__name:`SettingsView`,setup(e){let t=W(()=>[{id:`defaults`,title:Y(`views.settings.sectionDefaults`)},{id:`logs`,title:Y(`views.settings.sectionLogs`)},{id:`notifications`,title:Y(`views.settings.sectionNotifications`)},{id:`ddns`,title:Y(`views.settings.sectionDdns`)}]),n=XN(),r=dP(),i=vN(),a=tn(DR()),o=k(!1),s=k(null),c=k(null),l=k(null),u=k(null),d=k(null),f=W(()=>r.defaults.value),p=W(()=>r.logsConfig.value),m=W(()=>r.notifications.value?.telegram??null),h=W(()=>r.logsDir.value),g=W(()=>{let e={},t=f.value,n=p.value,r=m.value;if(t!==null){let n=zR(t,a.defaults);Object.keys(n).length>0&&(e.defaults=n)}if(n!==null){let t=BR(n,a.logs);Object.keys(t).length>0&&(e.logs=t)}if(r!==null){let t=VR(r,a.telegram);Object.keys(t).length>0&&(e.notifications=t)}return e}),_=W(()=>bR(g.value)+(l.value===null?0:bR(l.value))),v=W(()=>{let e=m.value;return{defaults:f.value??{},logs:p.value??{},notifications:e===null?{}:{telegram:MR(e)},ddns:u.value??{}}}),y=W(()=>yR({...g.value,...l.value===null?{}:{ddns:l.value}},v.value)),b=W(()=>f.value!==null&&Object.keys(zR(f.value,a.defaults)).length>0),x=W(()=>p.value!==null&&Object.keys(BR(p.value,a.logs)).length>0),S=W(()=>m.value!==null&&Object.keys(VR(m.value,a.telegram)).length>0),C={};function w(){let e=(e,t)=>{qR(C[e],KR(a,e))||(t(),C[e]=KR(a,e))},t=f.value;t!==null&&e(`defaults`,()=>{a.defaults.enabled=t.enabled,a.defaults.autostart=t.autostart,a.defaults.bind=t.bind,a.defaults.onPortConflict=t.onPortConflict,a.defaults.logBufferLines=t.logBufferLines,a.defaults.restart={...t.restart},a.defaults.health=TR(t.health),a.defaults.stop={...t.stop}});let n=p.value;n!==null&&e(`logs`,()=>Object.assign(a.logs,n));let r=m.value;r!==null&&e(`telegram`,()=>Object.assign(a.telegram,MR(r)))}function T(){for(let e of Object.keys(C))delete C[e]}M([f,p,m],()=>{w()},{immediate:!0});async function ee(){let e=g.value,t=l.value,a=Object.keys(e).length>0;if(!(!a&&t===null||o.value||r.activeId.value.length===0)){o.value=!0,s.value=null,c.value=null;try{if(a&&!await n.saveWorkspaceSettings(r.activeId.value,e)){s.value=n.lastError.value??Y(`views.settings.saveFailed`);return}t!==null&&(await XM(r.activeId.value,t),await d.value?.reload()),c.value=Y(`views.settings.saved`),i.success(Y(`views.settings.savedToast`)),T(),w()}catch(e){s.value=Lj(e)}finally{o.value=!1}}}function te(){s.value=null,c.value=null,T(),w(),d.value?.reload()}function ne(){let e=f.value;e!==null&&(a.defaults.enabled=e.enabled,a.defaults.autostart=e.autostart,a.defaults.bind=e.bind,a.defaults.onPortConflict=e.onPortConflict,a.defaults.logBufferLines=e.logBufferLines,a.defaults.restart={...e.restart},a.defaults.health=TR(e.health),a.defaults.stop={...e.stop},ae(`defaults`))}function re(){p.value!==null&&Object.assign(a.logs,p.value),ae(`logs`)}function ie(){m.value!==null&&Object.assign(a.telegram,MR(m.value)),ae(`telegram`)}function ae(e){C[e]=KR(a,e)}return M(()=>r.activeId.value,()=>{T(),w(),s.value=null,c.value=null}),(e,n)=>(L(),z(hG,{sections:t.value,"nav-label":A(Y)(`views.settings.navLabel`),"changes-description":A(Y)(`views.settings.changesDescription`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`)}),"changed-count":_.value,changes:y.value,"save-error":s.value,"save-message":c.value,saving:o.value,onSave:ee,onDiscard:te},{header:j(()=>[V(CV,{title:A(Y)(`nav.workspaceSettings`),description:A(Y)(`views.settings.description`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`)})},null,8,[`title`,`description`]),A(r).configError.value?(L(),z(_H,{key:0,tone:`danger`,title:A(Y)(`views.settings.configErrorTitle`),class:`mb-4`},{default:j(()=>[B(`p`,null,O(A(r).configError.value),1),B(`p`,o1,O(A(Y)(`views.settings.configErrorNote`)),1)]),_:1},8,[`title`])):A(r).configWarnings.value.length>0?(L(),z(_H,{key:1,tone:`warn`,title:A(Y)(`views.settings.configWarningTitle`),class:`mb-4`},{default:j(()=>[(L(!0),R(I,null,P(A(r).configWarnings.value,e=>(L(),R(`p`,{key:e,class:`font-mono`},O(e),1))),128))]),_:1},8,[`title`])):U(``,!0)]),default:j(()=>[V(KW,{id:`defaults`,title:A(Y)(`views.settings.sectionDefaults`),description:A(Y)(`views.settings.defaultsDescription`)},{default:j(()=>[V(H$,{defaults:a.defaults,"onUpdate:defaults":n[0]||=e=>a.defaults=e,dirty:b.value,onReset:ne},null,8,[`defaults`,`dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`logs`,title:A(Y)(`views.settings.sectionLogs`),description:A(Y)(`views.settings.logsDescription`)},{default:j(()=>[V(J$,{logs:a.logs,"onUpdate:logs":n[1]||=e=>a.logs=e,"logs-dir":h.value,dirty:x.value,onReset:re},null,8,[`logs`,`logs-dir`,`dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`notifications`,title:A(Y)(`views.settings.sectionNotifications`),description:A(Y)(`views.settings.notificationsDescription`)},{default:j(()=>[V(a1,{telegram:a.telegram,"onUpdate:telegram":n[2]||=e=>a.telegram=e,status:m.value,dirty:S.value,onReset:ie},null,8,[`telegram`,`status`,`dirty`])]),_:1},8,[`title`,`description`]),V(KW,{id:`ddns`,title:A(Y)(`views.settings.sectionDdns`),description:A(Y)(`views.settings.ddnsDescription`)},{default:j(()=>[V(B$,{ref_key:`ddnsSection`,ref:d,patch:l.value,"onUpdate:patch":n[3]||=e=>l.value=e,baseline:u.value,"onUpdate:baseline":n[4]||=e=>u.value=e},null,8,[`patch`,`baseline`])]),_:1},8,[`title`,`description`])]),_:1},8,[`sections`,`nav-label`,`changes-description`,`changed-count`,`changes`,`save-error`,`save-message`,`saving`]))}}),c1=new Set([`overview`,`servers`,`server-detail`,`logs`,`settings`]),l1=Sv({history:W_(),routes:[{path:`/w/:workspaceId`,name:`overview`,component:aJ,meta:{titleKey:`nav.overview`}},{path:`/w/:workspaceId/servers`,name:`servers`,component:LQ,meta:{titleKey:`nav.servers`}},{path:`/w/:workspaceId/servers/:id`,name:`server-detail`,component:kQ,meta:{titleKey:`views.route.server`}},{path:`/w/:workspaceId/logs`,name:`logs`,component:Lq,meta:{titleKey:`nav.logs`}},{path:`/w/:workspaceId/settings`,name:`settings`,component:s1,meta:{titleKey:`nav.workspaceSettings`}},{path:`/global/overview`,name:`global-overview`,component:uH,meta:{titleKey:`nav.globalOverview`}},{path:`/global/settings`,name:`global-settings`,component:YG,meta:{titleKey:`nav.globalSettings`}},{path:`/proxy`,name:`proxy`,component:kZ,meta:{titleKey:`nav.reverseProxy`}},{path:`/login`,name:`login`,component:wK,meta:{titleKey:`login.signIn`}},{path:`/`,name:`home`,component:aJ},{path:`/:pathMatch(.*)*`,name:`not-found`,component:aJ}]});function u1(e,t=`overview`,n){let r=`/w/${encodeURIComponent(e)}`;return t===`overview`?r:t===`servers`?n===void 0?`${r}/servers`:`${r}/servers/${encodeURIComponent(n)}`:`${r}/${t}`}l1.beforeEach(async e=>{let{session:t,refresh:n}=pN();t.value===null&&await n();let r=t.value?.authRequired===!0,i=t.value?.authenticated===!0;if(r&&!i&&e.name!==`login`)return{name:`login`,query:e.fullPath===`/`?void 0:{next:e.fullPath}};if(e.name===`login`&&(!r||i))return{name:`global-overview`,replace:!0};if(e.name===`login`||e.name===`global-overview`||e.name===`global-settings`||e.name===`proxy`)return!0;if(e.name===`home`||e.name===`not-found`)return{name:`global-overview`,replace:!0};await XN().ensureState();let a=dP(),o=a.workspaces.value;if(o.length===0)return!0;let s=typeof e.params.workspaceId==`string`?e.params.workspaceId:``;if(s.length>0&&o.some(e=>e.id===s)&&(a.select(s),c1.has(String(e.name))))return!0;let c=a.activeId.value||o[0].id,l=String(e.name??``),u={...e.params,workspaceId:c};return l===`server-detail`&&u.id===void 0?{name:`servers`,params:{workspaceId:c},query:e.query,replace:!0}:{name:l,params:u,query:e.query,replace:!0}});var d1={class:`flex items-center gap-2.5 border-b border-line px-3.5`},f1=[`placeholder`],p1={key:0,class:`px-3 py-8 text-center text-xs text-muted`},m1={class:`px-2.5 pb-1 pt-2.5 text-2xs font-medium text-faint`},h1=[`data-active`,`onMousemove`,`onClick`],g1={class:`min-w-0 flex-1 truncate text-sm`},_1={key:0,class:`shrink-0 font-mono text-2xs text-faint`},v1={class:`flex items-center gap-3 border-t border-line bg-panel-2 px-3.5 py-2 text-2xs text-faint`},y1={class:`ml-auto font-mono`},b1=N({__name:`CommandPalette`,props:{open:{type:Boolean,default:!1},openModifiers:{}},emits:[`update:open`],setup(e){let t=so(e,`open`),n=Rg(),r=XN(),i=dP(),a=aP(),o=k(``),s=k(0),c=k(null),l=k(null);function u(e){n.push(e)}function d(e){i.select(e);let t=String(n.currentRoute.value.name??``);t===`overview`||t===`servers`||t===`logs`||t===`settings`?u(u1(e,t)):t===`server-detail`&&u(u1(e,`servers`))}function f(e){e(),t.value=!1}let p=[`stopped`,`crashed`,`conflict`],m=[`running`,`starting`,`backoff`],h=W(()=>{let e=[],t=r.allServers.value;function n(e,t){i.select(e),u(t)}let o=e=>u1(i.activeId.value,e);for(let{workspace:i,server:a}of t){let t=a.config.label??a.id,o=Y(qI[a.status].labelKey);e.push({id:`open:${i.id}:${a.id}`,title:Y(`palette.openServer`,{label:t}),group:Y(`palette.groupServers`),icon:Ty,detail:`${i.label} · ${a.id} · ${o}`,keywords:`server detail ${a.id} ${i.label} show`,run:()=>n(i.id,u1(i.id,`servers`,a.id))}),e.push({id:`logs:${i.id}:${a.id}`,title:Y(`palette.serverLogs`,{label:t}),group:Y(`palette.groupServers`),icon:Ny,detail:`${i.label} · ${a.id}`,keywords:`log tail output ${a.id} ${i.label}`,run:()=>n(i.id,`${u1(i.id,`logs`)}?server=${encodeURIComponent(a.id)}`)}),p.includes(a.status)&&a.config.enabled&&e.push({id:`start:${i.id}:${a.id}`,title:Y(`palette.startServer`,{label:t}),group:Y(`palette.groupActions`),icon:_y,detail:`${i.label} · ${a.id}`,keywords:`run launch ${a.id} ${i.label}`,run:()=>f(()=>void r.start(i.id,a.id))}),m.includes(a.status)&&e.push({id:`stop:${i.id}:${a.id}`,title:Y(`palette.stopServer`,{label:t}),group:Y(`palette.groupActions`),icon:jy,detail:`${i.label} · ${a.id}`,keywords:`halt kill ${a.id} ${i.label}`,run:()=>f(()=>void r.stop(i.id,a.id))}),a.config.enabled&&e.push({id:`restart:${i.id}:${a.id}`,title:Y(`palette.restartServer`,{label:t}),group:Y(`palette.groupActions`),icon:Sy,detail:`${i.label} · ${a.id}`,keywords:`bounce reload ${a.id} ${i.label}`,run:()=>f(()=>void r.restart(i.id,a.id))})}e.push({id:`nav:overview`,title:Y(`palette.goOverview`),group:Y(`palette.groupNavigate`),icon:oy,keywords:`dashboard home workspace`,run:()=>u(o(`overview`))},{id:`nav:global`,title:Y(`palette.goGlobalOverview`),group:Y(`palette.groupNavigate`),icon:ty,keywords:`dashboard home host vitals every workspace`,run:()=>u(`/global/overview`)},{id:`nav:global-settings`,title:Y(`palette.goGlobalSettings`),group:Y(`palette.groupNavigate`),icon:Ay,keywords:`panel listener auth tls backups host`,run:()=>u(`/global/settings`)},{id:`nav:proxy`,title:Y(`palette.goProxy`),group:Y(`palette.groupNavigate`),icon:Ry,keywords:`caddy domain route acme certificate https expose`,run:()=>u(`/proxy`)},{id:`nav:servers`,title:Y(`palette.goServers`),group:Y(`palette.groupNavigate`),icon:Ty,keywords:`processes list workspace`,run:()=>u(o(`servers`))},{id:`nav:logs`,title:Y(`palette.goLogs`),group:Y(`palette.groupNavigate`),icon:Cy,keywords:`output files tail workspace`,run:()=>u(o(`logs`))},{id:`nav:settings`,title:Y(`palette.goWorkspaceSettings`),group:Y(`palette.groupNavigate`),icon:Ey,keywords:`defaults notifications ddns config workspace`,run:()=>u(o(`settings`))},{id:`act:start-all`,title:Y(`palette.startAll`),group:Y(`palette.groupActions`),icon:_y,keywords:`boot all workspace`,run:()=>f(()=>void r.startAll(i.activeId.value))},{id:`act:stop-all`,title:Y(`palette.stopAll`),group:Y(`palette.groupActions`),icon:jy,keywords:`halt all workspace`,run:()=>f(()=>void r.stopAll(i.activeId.value))});for(let t of i.workspaces.value)e.push({id:`ws:${t.id}`,title:Y(`palette.switchWorkspace`,{label:t.label}),group:Y(`palette.groupWorkspaces`),icon:ay,detail:t.id,keywords:`workspace switch scope ${t.label}`,run:()=>f(()=>d(t.id))});for(let[t,n]of[[`listener`,`settings.listener.title`],[`authentication`,`settings.authentication.title`],[`host`,`settings.host.title`],[`backups`,`settings.backups.title`],[`tls`,`settings.tls.title`],[`language`,`language.label`],[`interface`,`settings.interface.title`],[`paths`,`settings.paths.title`]])e.push({id:`gset:${t}`,title:Y(`palette.globalSetting`,{label:Y(n)}),group:Y(`nav.globalSettings`),icon:ty,keywords:`configure panel ${t}`,run:()=>u(`/global/settings?section=${t}`)});for(let[t,n]of[[`defaults`,`settings.defaults.title`],[`logs`,`settings.logs.title`],[`notifications`,`settings.notifications.title`],[`ddns`,`settings.ddns.title`]])e.push({id:`wset:${t}`,title:Y(`palette.workspaceSetting`,{label:Y(n)}),group:Y(`nav.workspaceSettings`),icon:Ey,keywords:`configure workspace ${t}`,run:()=>u(`${u1(i.activeId.value,`settings`)}?section=${t}`)});let s=[[`light`,`theme.light`,My],[`dark`,`theme.dark`,py],[`system`,`theme.system`,fy]];for(let[t,n,r]of s)e.push({id:`theme:${t}`,title:Y(`palette.theme`,{theme:Y(n)}),group:Y(`palette.groupAppearance`),icon:r,keywords:`colour color dark light mode appearance`,run:()=>f(()=>a.setPreference(t))});return e}),g=W(()=>{let e=o.value.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.length===0?h.value.slice(0,40):h.value.map(t=>{let n=`${t.title} ${t.detail??``} ${t.keywords??``} ${t.group}`.toLowerCase(),r=0;for(let t of e){let e=n.indexOf(t);if(e===-1)return null;r+=e===0?0:e}return{command:t,score:r}}).filter(e=>e!==null).sort((e,t)=>e.score-t.score).slice(0,40).map(e=>e.command)}),_=W(()=>{let e=new Map;for(let t of g.value){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]}),v=W(()=>_.value.flatMap(([,e])=>e));M(g,()=>{s.value=0}),M(t,async e=>{e&&(o.value=``,s.value=0,await ir(),c.value?.focus())});function y(e){let t=v.value.length;t!==0&&(s.value=(s.value+e+t)%t,ir(()=>{l.value?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})}))}function b(e){e.key===`ArrowDown`?(e.preventDefault(),y(1)):e.key===`ArrowUp`?(e.preventDefault(),y(-1)):e.key===`Enter`&&(e.preventDefault(),v.value[s.value]?.run())}function x(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t.value=!t.value)}return na(()=>window.addEventListener(`keydown`,x)),Be(()=>window.removeEventListener(`keydown`,x)),(e,n)=>(L(),z(A(lf),{open:t.value,"onUpdate:open":n[2]||=e=>t.value=e},{default:j(()=>[V(A(Yf),null,{default:j(()=>[V(A(qf),{class:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px] data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`}),V(A(Wf),{class:`fixed left-1/2 top-[10vh] z-50 w-[min(94vw,38rem)] -translate-x-1/2 overflow-hidden rounded-panel border border-line bg-panel shadow-float data-[state=open]:animate-[hh-pop-in_150ms_var(--ease-out-quick)]`,onOpenAutoFocus:n[1]||=lu(()=>{},[`prevent`]),onKeydown:b},{default:j(()=>[V(A(Xf),{class:`sr-only`},{default:j(()=>[H(O(A(Y)(`topbar.commandPalette`)),1)]),_:1}),B(`div`,d1,[V(A(wy),{class:`size-4 shrink-0 text-faint`}),Sr(B(`input`,{ref_key:`input`,ref:c,"onUpdate:modelValue":n[0]||=e=>o.value=e,type:`text`,placeholder:A(Y)(`palette.placeholder`),class:`h-12 w-full bg-transparent text-sm text-ink outline-none placeholder:text-faint`,autocomplete:`off`,spellcheck:`false`},null,8,f1),[[Jl,o.value]]),n[3]||=B(`kbd`,{class:`shrink-0 rounded border border-line bg-page px-1.5 py-0.5 font-mono text-2xs text-faint`},`esc`,-1)]),B(`div`,{ref_key:`list`,ref:l,class:`max-h-[min(60vh,26rem)] overflow-y-auto p-1.5`},[v.value.length===0?(L(),R(`p`,p1,O(A(Y)(`palette.noMatches`,{query:o.value})),1)):U(``,!0),(L(!0),R(I,null,P(_.value,([e,t])=>(L(),R(I,{key:e},[B(`p`,m1,O(e),1),(L(!0),R(I,null,P(t,e=>(L(),R(`button`,{key:e.id,type:`button`,"data-active":v.value[s.value]?.id===e.id,class:D(A(Q)(`flex w-full items-center gap-2.5 rounded-control px-2.5 py-2 text-left transition-colors duration-100`,v.value[s.value]?.id===e.id?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`)),onMousemove:t=>s.value=v.value.findIndex(t=>t.id===e.id),onClick:t=>e.run()},[(L(),z(ha(e.icon),{class:D([`size-4 shrink-0`,v.value[s.value]?.id===e.id?`text-accent`:`text-faint`])},null,8,[`class`])),B(`span`,g1,O(e.title),1),e.detail?(L(),R(`span`,_1,O(e.detail),1)):U(``,!0),V(A(Rv),{class:D([`size-3.5 shrink-0 text-faint opacity-0 transition-opacity duration-100`,{"opacity-100":v.value[s.value]?.id===e.id}])},null,8,[`class`])],42,h1))),128))],64))),128))],512),B(`div`,v1,[B(`span`,null,[n[4]||=B(`kbd`,{class:`font-mono`},`↑↓`,-1),H(` `+O(A(Y)(`palette.navigate`)),1)]),B(`span`,null,[n[5]||=B(`kbd`,{class:`font-mono`},`↵`,-1),H(` `+O(A(Y)(`palette.run`)),1)]),B(`span`,y1,O(A(_F)(`palette.results`,v.value.length)),1)])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),x1={class:`rounded-panel border border-line bg-panel-2/70 p-3`},S1={class:`mb-2 flex items-center justify-between`},C1={class:`text-2xs font-medium text-faint`},w1={key:0,class:`text-2xs text-faint`},T1={key:0,class:`grid grid-cols-2 gap-x-1 gap-y-2`},E1={key:1,class:`py-3 text-center text-2xs text-faint`},D1={key:2,class:`mt-2 flex items-start gap-1.5 rounded-control bg-danger-soft px-2 py-1.5`},O1={class:`text-2xs leading-4 text-danger`},k1=2,A1=85,j1=N({__name:`InstrumentCluster`,props:{host:{}},setup(e){let t=e,n=W(()=>{let e=t.host;return e?(e.loadAvg[0]??0)/Math.max(1,e.cpus):null}),r=W(()=>n.value===null?null:n.value/k1*100),i=W(()=>n.value===null?`—`:n.value.toFixed(2)),a=W(()=>{let e=t.host?.disks??[];return e.length===0?null:Math.max(...e.map(e=>e.usedPercent))}),o=W(()=>{let e=t.host?.tempCelsius??null;return e===null?null:e/A1*100}),s=W(()=>{let e=t.host?.tempCelsius??null;return e===null?`n/a`:`${Math.round(e)}°`});return(e,n)=>(L(),R(`div`,x1,[B(`div`,S1,[B(`span`,C1,O(A(Y)(`nav.hostVitals`)),1),t.host?.enabled===!1?(L(),R(`span`,w1,`off`)):U(``,!0)]),t.host?.enabled?(L(),R(`div`,T1,[V(lL,{value:r.value,label:A(Y)(`host.loadPerCpu`),display:i.value,size:58,"warn-at":70,"danger-at":100},null,8,[`value`,`label`,`display`]),V(lL,{value:t.host?.memoryUsedPercent??null,label:A(Y)(`common.memory`),size:58},null,8,[`value`,`label`]),V(lL,{value:a.value,label:A(Y)(`common.disk`),size:58},null,8,[`value`,`label`]),V(lL,{value:o.value,label:A(Y)(`host.cpuTemp`),display:s.value,size:58},null,8,[`value`,`label`,`display`])])):(L(),R(`p`,E1,` Sampling is disabled in Settings. `)),t.host&&t.host.alerts.length>0?(L(),R(`div`,D1,[n[0]||=B(`span`,{class:`mt-1 size-1.5 shrink-0 rounded-full bg-danger`},null,-1),B(`span`,O1,O(t.host.alerts.join(` · `)),1)])):U(``,!0)]))}}),M1={class:`flex h-full min-h-0 flex-col gap-3 overflow-y-auto p-3`},N1={class:`flex items-center gap-2 px-1 pt-1`},P1={class:`min-w-0`},F1={class:`truncate text-sm font-semibold tracking-tight text-ink`},I1=[`title`],L1=[`aria-label`],R1=[`aria-label`],z1={class:`flex items-center gap-1 truncate px-2.5 pb-1 text-2xs font-medium text-faint`},B1={key:1,class:`text-muted`},V1={class:`mt-auto flex flex-col gap-3`},H1={class:`flex items-center gap-2 rounded-control border border-line bg-panel-2/70 px-2.5 py-2`},U1={class:`relative flex size-2 shrink-0`},W1={class:`text-2xs text-muted`},G1=[`title`],K1=N({__name:`SideNav`,props:{host:{},connection:{},panelLabel:{},panelVersion:{},planLabel:{},workspaceId:{},workspaceLabel:{},running:{},total:{}},emits:[`navigate`,`close`],setup(e,{emit:t}){let n=e,r=t,i=zg(),a=W(()=>[{to:u1(n.workspaceId,`overview`),labelKey:`nav.overview`,icon:oy,exact:!0,servers:!1},{to:u1(n.workspaceId,`servers`),labelKey:`nav.servers`,icon:Ty,exact:!1,servers:!0},{to:u1(n.workspaceId,`logs`),labelKey:`nav.logs`,icon:Cy,exact:!1,servers:!1},{to:u1(n.workspaceId,`settings`),labelKey:`nav.workspaceSettings`,icon:Ey,exact:!1,servers:!1}]),o=[{to:`/global/overview`,labelKey:`nav.globalOverview`,icon:ty,exact:!0,servers:!1},{to:`/global/settings`,labelKey:`nav.globalSettings`,icon:Ay,exact:!1,servers:!1}],s=[{to:`/proxy`,labelKey:`nav.reverseProxy`,icon:Ry,exact:!1,servers:!1}],c=W(()=>[{titleKey:`nav.global`,label:``,icon:ty,items:o},{titleKey:`nav.workspace`,label:n.workspaceLabel,icon:void 0,items:a.value},{titleKey:`nav.others`,label:``,icon:Pv,items:s}]);function l(e){return e.exact?i.path===e.to:i.path===e.to||i.path.startsWith(`${e.to}/`)}let u=W(()=>n.panelVersion===null?n.panelLabel:`${n.panelLabel} · v${n.panelVersion}`),d=W(()=>({open:{labelKey:`connection.live`,dot:`bg-ok`},connecting:{labelKey:`connection.connecting`,dot:`bg-warn`},closed:{labelKey:`connection.reconnecting`,dot:`bg-danger`}})[n.connection]);return(e,t)=>{let i=pa(`RouterLink`);return L(),R(`div`,M1,[B(`div`,N1,[t[2]||=Os(`<span class="grid size-8 shrink-0 place-items-center rounded-[9px] border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-4.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),B(`div`,P1,[B(`p`,F1,O(A(Y)(`app.name`)),1),B(`p`,{class:`truncate text-2xs text-faint`,title:u.value},O(u.value),9,I1)]),B(`button`,{type:`button`,class:`ml-auto grid size-7 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":A(Y)(`nav.closeNavigation`),onClick:t[0]||=e=>r(`close`)},[V(A(zy),{class:`size-4`})],8,L1)]),B(`nav`,{class:`flex flex-col gap-3`,"aria-label":A(Y)(`nav.navigation`)},[(L(!0),R(I,null,P(c.value,e=>(L(),R(`div`,{key:e.titleKey,class:`flex min-h-0 flex-col gap-0.5`},[B(`p`,z1,[e.icon?(L(),z(ha(e.icon),{key:0,class:`size-3 shrink-0`})):U(``,!0),H(` `+O(e.label?`${A(Y)(e.titleKey)} · `:A(Y)(e.titleKey)),1),e.label?(L(),R(`span`,B1,O(e.label),1)):U(``,!0)]),(L(!0),R(I,null,P(e.items,e=>(L(),z(i,{key:e.to,to:e.to,class:D(A(Q)(`group flex items-center gap-2.5 rounded-control px-2.5 py-1.5 text-sm transition-colors duration-150`,l(e)?`bg-accent-soft font-medium text-accent`:`text-muted hover:bg-hover hover:text-ink`)),onClick:t[1]||=e=>r(`navigate`)},{default:j(()=>[(L(),z(ha(e.icon),{class:`size-4 shrink-0`,"stroke-width":l(e)?2.1:1.8},null,8,[`stroke-width`])),H(` `+O(A(Y)(e.labelKey))+` `,1),e.servers?(L(),R(`span`,{key:0,class:D([`ml-auto font-mono text-2xs tabular-nums`,l(e)?`text-accent`:`text-faint`])},O(n.running)+`/`+O(n.total),3)):U(``,!0)]),_:2},1032,[`to`,`class`]))),128))]))),128))],8,R1),B(`div`,V1,[V(j1,{host:n.host},null,8,[`host`]),B(`div`,H1,[B(`span`,U1,[B(`span`,{class:D(A(Q)(`absolute inset-0 rounded-full`,d.value.dot,n.connection!==`open`&&`animate-ping opacity-60`))},null,2),B(`span`,{class:D(A(Q)(`relative size-2 rounded-full`,d.value.dot))},null,2)]),B(`span`,W1,O(A(Y)(d.value.labelKey)),1),B(`span`,{class:`ml-auto truncate font-mono text-2xs text-faint`,title:n.planLabel},O(n.planLabel),9,G1)])])])}}}),q1={key:0,class:`flex flex-col gap-px border-b border-line bg-panel/60`},J1={class:`text-2xs leading-4`},Y1={class:`font-medium`},X1={key:0,class:`opacity-80`},Z1=N({__name:`SystemNotices`,props:{control:{},configError:{},configPath:{}},setup(e){let t=e,n=W(()=>{let e=[],n=t.control?.auth;return t.configError&&e.push({id:`config`,tone:`danger`,text:Y(`notice.configError`,{error:t.configError}),hint:Y(`notice.configErrorHint`,{path:t.configPath??`servers.config.json`})}),n&&(n.blockedReason&&e.push({id:`blocked`,tone:`danger`,text:n.blockedReason}),n.usingDefaultPassword?e.push({id:`default-password`,tone:`warn`,text:Y(`notice.defaultPassword`),hint:Y(`notice.defaultPasswordHint`)}):n.enabled&&!n.passwordSet&&e.push({id:`no-password`,tone:`warn`,text:Y(`notice.noPassword`),hint:Y(`notice.noPasswordHint`)}),n.exposed&&e.push({id:`exposed`,tone:`warn`,text:Y(`notice.exposed`),hint:Y(`notice.exposedHint`)}),!n.enabled&&!n.exposed&&e.push({id:`auth-off`,tone:`info`,text:Y(`notice.authOff`)})),e}),r={warn:{wrap:`border-warn/25 bg-warn-soft text-warn`,icon:Ly},danger:{wrap:`border-danger/25 bg-danger-soft text-danger`,icon:Vv},info:{wrap:`border-line bg-panel-2 text-muted`,icon:Vv}};return(e,t)=>n.value.length>0?(L(),R(`div`,q1,[(L(!0),R(I,null,P(n.value,e=>(L(),R(`div`,{key:e.id,class:D([`flex items-start gap-2 px-3 py-1.5 sm:px-4`,r[e.tone].wrap])},[(L(),z(ha(r[e.tone].icon),{class:`mt-0.5 size-3.5 shrink-0`})),B(`p`,J1,[B(`span`,Y1,O(e.text),1),e.hint?(L(),R(`span`,X1,O(e.hint),1)):U(``,!0)])],2))),128))])):U(``,!0)}}),Q1={class:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-[min(92vw,22rem)] flex-col gap-2`,role:`status`,"aria-live":`polite`},$1={class:`min-w-0 flex-1`},e0={class:`text-xs font-medium text-ink`},t0={key:0,class:`mt-0.5 break-words text-2xs leading-4 text-muted`},n0=[`aria-label`,`onClick`],r0=N({__name:`ToastStack`,setup(e){let{toasts:t,dismiss:n}=vN(),r={ok:Hv,danger:Uv,warn:Ly,info:ry,accent:ry,neutral:ry},i={ok:`text-ok`,danger:`text-danger`,warn:`text-warn`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},a=W(()=>t.value);return(e,t)=>(L(),R(`div`,Q1,[V(Il,{"enter-active-class":`transition duration-150 ease-out`,"enter-from-class":`translate-x-2 opacity-0`,"leave-active-class":`transition duration-100 ease-in`,"leave-to-class":`translate-x-2 opacity-0`},{default:j(()=>[(L(!0),R(I,null,P(a.value,e=>(L(),R(`div`,{key:e.id,class:`pointer-events-auto flex items-start gap-2.5 rounded-panel border border-line bg-raise p-3 shadow-float`},[(L(),z(ha(r[e.tone]),{class:D(A(Q)(`mt-0.5 size-4 shrink-0`,i[e.tone]))},null,8,[`class`])),B(`div`,$1,[B(`p`,e0,O(e.title),1),e.description?(L(),R(`p`,t0,O(e.description),1)):U(``,!0)]),B(`button`,{type:`button`,class:`-mr-1 -mt-0.5 grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,"aria-label":A(Y)(`common.dismiss`),onClick:t=>A(n)(e.id)},[V(A(zy),{class:`size-3.5`})],8,n0)]))),128))]),_:1})]))}}),i0={class:`space-y-3`},a0={key:0,class:`rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 text-2xs leading-4 text-danger`},o0=N({__name:`WorkspaceDialog`,props:za({mode:{},initial:{default:``},submit:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=so(e,`open`),r=k(t.initial),i=k(!1),a=k(null),o=W(()=>t.mode===`create`?Y(`workspace.new`):Y(`workspace.rename`)),s=W(()=>t.mode===`create`?Y(`workspace.create`):Y(`workspace.renameAction`)),c=W(()=>r.value.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40));M(n,e=>{e&&(r.value=t.initial,a.value=null)});async function l(){let e=r.value.trim();if(e.length===0){a.value=`A workspace needs a name.`;return}i.value=!0,a.value=null;try{await t.submit(e)&&(n.value=!1)}finally{i.value=!1}}return(t,u)=>(L(),z($z,{open:n.value,"onUpdate:open":u[2]||=e=>n.value=e,title:o.value,description:e.mode===`create`?A(Y)(`workspace.createHint`):A(Y)(`workspace.renameHint`),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,disabled:i.value,onClick:u[1]||=e=>n.value=!1},{default:j(()=>[...u[3]||=[H(` Cancel `,-1)]]),_:1},8,[`disabled`]),V($,{variant:`primary`,loading:i.value,onClick:l},{default:j(()=>[H(O(s.value),1)]),_:1},8,[`loading`])]),default:j(()=>[B(`div`,i0,[V(Rz,{modelValue:r.value,"onUpdate:modelValue":u[0]||=e=>r.value=e,label:A(Y)(`common.name`),placeholder:`Home lab`,hint:e.mode===`create`&&c.value.length>0?A(Y)(`workspace.nameHintId`,{id:c.value}):A(Y)(`workspace.nameHint`),wide:``,onKeydown:du(lu(l,[`prevent`]),[`enter`])},null,8,[`modelValue`,`label`,`hint`,`onKeydown`]),a.value?(L(),R(`p`,a0,O(a.value),1)):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),s0=[`aria-label`],c0={class:`min-w-0 truncate font-medium text-ink`},l0={class:`hidden shrink-0 font-mono text-2xs text-faint sm:inline`},u0={key:0,class:`max-h-64 overflow-y-auto`},d0=[`onClick`],f0={class:`min-w-0 flex-1`},p0={class:`block truncate text-xs`},m0={class:`block truncate font-mono text-2xs text-faint`},h0={class:`shrink-0 font-mono text-2xs text-faint`},g0={key:1,class:`px-2 py-2 text-xs text-muted`},_0={class:`px-2 pt-1.5 text-xs font-semibold text-ink`},v0={class:`mt-2 flex justify-end gap-1.5 px-1 pb-1`},y0=N({__name:`WorkspacePicker`,props:{workspaces:{},selectedId:{}},emits:[`select`,`create`,`rename`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=k(!1),o=W(()=>n.workspaces.find(e=>e.id===n.selectedId)??null);function s(e){r(`select`,e),i.value=!1}function c(){a.value=!0}function l(){a.value=!1}function u(){let e=o.value;a.value=!1,i.value=!1,e!==null&&r(`remove`,e)}function d(){i.value=!1,r(`create`)}function f(){i.value=!1,o.value!==null&&r(`rename`,o.value)}async function p(e){i.value=e,e&&(a.value=!1,await ir())}return(t,n)=>(L(),z(A(Wh),{open:i.value,"onUpdate:open":p},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[B(`button`,{type:`button`,class:D(A(Q)(`flex h-8 max-w-36 items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 text-xs transition-colors duration-150 hover:border-line hover:text-ink sm:max-w-52`,A(yz))),"aria-label":A(Y)(`topbar.workspaceLabel`,{name:o.value?.label??A(Y)(`common.none`)})},[V(A(ay),{class:`size-3.5 shrink-0 text-faint`}),B(`span`,c0,O(o.value?.label??A(Y)(`workspace.none`)),1),B(`span`,l0,O(o.value?.runningCount??0)+`/`+O(o.value?.serverCount??0),1),V(A(Bv),{class:`size-3 shrink-0 text-faint`})],10,s0)]),_:1}),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-1 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[a.value?(L(),R(I,{key:1},[B(`p`,_0,` Delete “`+O(o.value?.label)+`”? `,1),n[4]||=B(`p`,{class:`mt-1 px-2 text-2xs leading-4 text-muted`},` Its servers are stopped, and its config, settings, logs, secrets and nanny state are removed from disk. A backup taken first is the only way back. `,-1),B(`div`,v0,[V($,{size:`xs`,variant:`ghost`,onClick:l},{default:j(()=>[...n[3]||=[H(` Keep it `,-1)]]),_:1}),V($,{size:`xs`,variant:`danger`,onClick:u},{default:j(()=>[V(A(Iy),{class:`size-3`}),H(O(A(Y)(`workspace.delete`)),1)]),_:1})])],64)):(L(),R(I,{key:0},[n[1]||=B(`p`,{class:`px-2 pb-1 pt-1.5 text-2xs font-medium text-faint`},` Workspaces `,-1),e.workspaces.length>0?(L(),R(`ul`,u0,[(L(!0),R(I,null,P(e.workspaces,t=>(L(),R(`li`,{key:t.id},[B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left transition-colors duration-100`,t.id===e.selectedId?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`)),onClick:e=>s(t.id)},[V(A(Fv),{class:D([`size-3.5 shrink-0`,t.id===e.selectedId?`text-accent`:`opacity-0`])},null,8,[`class`]),B(`span`,f0,[B(`span`,p0,O(t.label),1),B(`span`,m0,O(t.id),1)]),B(`span`,h0,O(t.runningCount)+`/`+O(t.serverCount),1)],10,d0)]))),128))])):(L(),R(`p`,g0,` The panel serves no workspace yet. `)),n[2]||=B(`div`,{class:`my-1 h-px bg-line`},null,-1),B(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted outline-none transition-colors duration-100 hover:bg-hover hover:text-ink`,onClick:d},[V(A(vy),{class:`size-3.5`}),n[0]||=H(` New workspace… `,-1)]),o.value?(L(),R(I,{key:2},[B(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted outline-none transition-colors duration-100 hover:bg-hover hover:text-ink`,onClick:f},[V(A(gy),{class:`size-3.5`}),H(` Rename “`+O(o.value.label)+`”… `,1)]),B(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-danger outline-none transition-colors duration-100 hover:bg-danger-soft`,onClick:c},[V(A(Iy),{class:`size-3.5`}),H(` Delete “`+O(o.value.label)+`”… `,1)])],64)):U(``,!0)],64))]),_:1})]),_:1})]),_:1},8,[`open`]))}}),b0=N({__name:`WorkspaceSwitcher`,setup(e){let{workspaces:t,activeId:n,select:r,create:i,rename:a,remove:o}=dP(),s=zg(),c=Rg(),l=k(!1),u=k(`create`),d=k(null);function f(e){r(e);let t=String(s.name??``);if(t===`overview`||t===`servers`||t===`logs`||t===`settings`){c.push(u1(e,t));return}t===`server-detail`&&c.push(u1(e,`servers`))}function p(){u.value=`create`,d.value=null,l.value=!0}function m(e){u.value=`rename`,d.value=e,l.value=!0}async function h(e){if(u.value===`create`)return await i(e)!==void 0;let t=d.value;return t!==null&&a(t.id,e)}async function g(e){let t=String(s.params.workspaceId??``)||n.value;if(!await o(e.id)||t!==e.id)return;let r=String(s.name??``);(r===`overview`||r===`servers`||r===`logs`||r===`settings`)&&c.push(u1(n.value,r))}return(e,r)=>(L(),R(I,null,[V(y0,{workspaces:A(t),"selected-id":A(n),onSelect:f,onCreate:p,onRename:m,onRemove:g},null,8,[`workspaces`,`selected-id`]),V(o0,{open:l.value,"onUpdate:open":r[0]||=e=>l.value=e,mode:u.value,initial:d.value?.label??``,submit:h},null,8,[`open`,`mode`,`initial`])],64))}}),x0={class:`flex h-13 shrink-0 items-center gap-3 border-b border-line bg-panel/80 px-3 backdrop-blur-sm sm:px-4`},S0=[`aria-label`],C0={class:`min-w-0 flex-1 truncate text-sm font-semibold tracking-tight text-ink`},w0={class:`flex shrink-0 items-center gap-1.5`},T0={class:`pr-6`},E0={class:`hidden items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 py-1.5 md:flex`},D0={class:`font-mono text-2xs text-muted`},O0={class:`px-2 py-1.5`},k0={class:`text-2xs text-faint`},A0={class:`truncate font-mono text-2xs text-muted`},j0=N({__name:`TopBar`,props:{panelUrl:{},connection:{},authenticated:{type:Boolean}},emits:[`menu`,`palette`,`signOut`],setup(e,{emit:t}){let n=e,r=t,i=zg(),a=aP(),o=W(()=>{if(i.name===`server-detail`)return`${Y(`nav.servers`)} / ${String(i.params.id??``)}`;let e=i.meta.titleKey;return typeof e==`string`?Y(e):String(i.meta.title??Y(`app.name`))}),s=W(()=>a.preference.value===`dark`?py:a.preference.value===`light`?My:fy),c=W(()=>Y(`theme.label`,{theme:Y(`theme.${a.preference.value}`)})),l=W(()=>({open:`bg-ok`,connecting:`bg-warn`,closed:`bg-danger`})[n.connection]),u=W(()=>({open:`connection.liveUpdates`,connecting:`connection.connecting`,closed:`connection.reconnecting`})[n.connection]);return(t,i)=>(L(),R(`header`,x0,[B(`button`,{type:`button`,class:`grid size-8 shrink-0 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":A(Y)(`topbar.openNavigation`),onClick:i[0]||=e=>r(`menu`)},[V(A(uy),{class:`size-4`})],8,S0),B(`h1`,C0,O(o.value),1),B(`div`,w0,[B(`button`,{type:`button`,class:D(A(Q)(`hidden h-8 items-center gap-2 rounded-control border border-line bg-panel-2 px-2.5 text-xs text-faint transition-colors duration-150 hover:border-line hover:text-muted sm:flex`,A(yz))),onClick:i[1]||=e=>r(`palette`)},[V(A(wy),{class:`size-3.5`}),B(`span`,T0,O(A(Y)(`topbar.search`)),1),i[5]||=B(`kbd`,{class:`rounded border border-line bg-page px-1 py-0.5 font-mono text-2xs text-faint`},`⌘K`,-1)],2),V(BB,{label:A(Y)(u.value)},{default:j(()=>[B(`span`,E0,[B(`span`,{class:D(A(Q)(`size-1.5 rounded-full`,l.value))},null,2),B(`span`,D0,O(e.panelUrl),1)])]),_:1},8,[`label`]),V(BB,{label:c.value},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":c.value,onClick:i[2]||=e=>A(a).cycle()},{default:j(()=>[(L(),z(ha(s.value),{class:`size-4`}))]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),n.authenticated?(L(),z(A(eg),{key:0},{default:j(()=>[V(A(ag),{"as-child":``},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":A(Y)(`topbar.account`)},{default:j(()=>[...i[6]||=[B(`span`,{class:`grid size-5 place-items-center rounded-full bg-accent-soft font-mono text-2xs font-semibold text-accent`},`hh`,-1)]]),_:1},8,[`aria-label`])]),_:1}),V(A(rg),null,{default:j(()=>[V(A(tg),{"side-offset":6,align:`end`,class:`z-50 min-w-44 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`div`,O0,[B(`p`,k0,O(A(Y)(`topbar.signedIn`)),1),B(`p`,A0,O(n.panelUrl),1)]),V(A(ig),{class:`my-1 h-px bg-line`}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:i[3]||=e=>r(`signOut`)},{default:j(()=>[V(A(ly),{class:`size-3.5`}),H(` `+O(A(Y)(`topbar.signOut`)),1)]),_:1})]),_:1})]),_:1})]),_:1})):U(``,!0),V(BB,{label:A(Y)(`topbar.commandPalette`)},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,class:`sm:hidden`,"aria-label":A(Y)(`topbar.commandPalette`),onClick:i[4]||=e=>r(`palette`)},{default:j(()=>[V(A(Kv),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),V(b0)])]))}}),M0={key:1,class:`flex h-dvh overflow-hidden bg-page`},N0={class:`hidden w-60 shrink-0 border-r border-line bg-panel/50 lg:block`},P0={key:0,class:`fixed inset-y-0 left-0 z-40 w-64 border-r border-line bg-panel lg:hidden`},F0={class:`flex min-w-0 flex-1 flex-col`},I0=N({__name:`App`,setup(e){let t=zg(),n=Rg(),r=XN(),i=dP(),{session:a,logout:o}=pN(),s=k(!1),c=k(!1),l=W(()=>a.value?.authenticated===!0),u=W(()=>a.value?.authRequired===!0),d=W(()=>t.name===`login`),f=W(()=>t.name===`logs`),p=W(()=>i.runningCount.value),m=W(()=>i.serverCount.value),h=W(()=>r.control.value?.url??`—`),g=W(()=>r.host.value),_=W(()=>r.control.value?.label??`home-hosted`),v=W(()=>r.version.value),y=W(()=>i.selected.value?.label??`none`),b=W(()=>i.activeId.value);return M(W(()=>fN(a.value)),e=>{if(e!==`wait`){if(e===`login`){JN(),n.push({name:`login`});return}qN()}},{immediate:!0}),M(()=>t.fullPath,()=>{c.value=!1}),na(async()=>{(!u.value||l.value)&&await r.refresh()}),Be(()=>JN()),(e,t)=>{let n=pa(`RouterView`);return L(),z(A(fg),{"delay-duration":300},{default:j(()=>[d.value?(L(),z(n,{key:0})):(L(),R(`div`,M0,[B(`aside`,N0,[V(K1,{host:g.value,connection:A(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])]),V(Dc,{"enter-active-class":`transition-opacity duration-150`,"leave-active-class":`transition-opacity duration-100`,"enter-from-class":`opacity-0`,"leave-to-class":`opacity-0`},{default:j(()=>[c.value?(L(),R(`div`,{key:0,class:`fixed inset-0 z-40 bg-black/45 lg:hidden`,onClick:t[0]||=e=>c.value=!1})):U(``,!0)]),_:1}),V(Dc,{"enter-active-class":`transition-transform duration-150 ease-out`,"leave-active-class":`transition-transform duration-100 ease-in`,"enter-from-class":`-translate-x-full`,"leave-to-class":`-translate-x-full`},{default:j(()=>[c.value?(L(),R(`aside`,P0,[V(K1,{host:g.value,connection:A(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value,onNavigate:t[1]||=e=>c.value=!1,onClose:t[2]||=e=>c.value=!1},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])])):U(``,!0)]),_:1}),B(`div`,F0,[V(j0,{"panel-url":h.value,connection:A(r).connection.value,authenticated:l.value,onMenu:t[3]||=e=>c.value=!0,onPalette:t[4]||=e=>s.value=!0,onSignOut:t[5]||=e=>A(o)()},null,8,[`panel-url`,`connection`,`authenticated`]),d.value?U(``,!0):(L(),z(Z1,{key:0,control:A(r).control.value,"config-error":A(i).configError.value,"config-path":A(i).selected.value?.configPath},null,8,[`control`,`config-error`,`config-path`])),B(`main`,{class:D(A(Q)(`relative min-h-0 flex-1`,f.value?`overflow-hidden`:`overflow-y-auto`))},[V(n)],2)])])),V(b1,{open:s.value,"onUpdate:open":t[6]||=e=>s.value=e},null,8,[`open`]),V(r0)]),_:1})}}});gF().catch(()=>{}).finally(()=>{yu(I0).use(l1).mount(`#app`)});
45
+ `),bootstrapEnv:ez(e.bootstrap?.env??{}),bootstrapTimeoutMs:e.bootstrap?.timeoutMs??12e4,bootstrapRunOnce:e.bootstrap?.runOnce??!0}}let u=tn(l(n.config)),d=k({...n.config.restart}),f=k(TR(n.config.health)),p=k({...n.config.stop}),m=W(()=>{let e=[{value:`local`,label:Y(`bind.local`)},{value:`lan`,label:Y(`bind.lan`)}];return/^\d{1,3}(?:\.\d{1,3}){3}$/.test(n.config.bind)&&e.push({value:n.config.bind,label:Y(`bind.explicit`,{bind:n.config.bind})}),e});function h(){let e=Number.isFinite(u.maxRssMb)?u.maxRssMb:0,t=Number.isFinite(u.logBufferLines)&&u.logBufferLines>=50?u.logBufferLines:50,n=Number.isFinite(u.bootstrapTimeoutMs)?u.bootstrapTimeoutMs:0;return{label:u.label.trim().length===0?null:u.label.trim(),command:u.command.trim(),cwd:u.cwd.trim()===``?`.`:u.cwd.trim(),args:$R(u.args),env:tz(u.env),dataEnvs:tz(u.dataEnvs),backupPaths:$R(u.backupPaths),backupIgnoreGenerated:u.backupIgnoreGenerated,dependsOn:nz(u.dependsOn),envFile:u.envFile.trim(),resources:{maxRssBytes:e>0?Math.round(e*1024*1024):0},port:u.port===null||Number.isNaN(u.port)?null:u.port,bind:u.bind,onPortConflict:u.onPortConflict,logBufferLines:t,enabled:u.enabled,autostart:u.autostart,persistent:u.persistent,restart:{...d.value},health:TR(f.value),stop:{...p.value},bootstrap:u.bootstrapEnabled?{command:u.bootstrapCommand.trim(),args:$R(u.bootstrapArgs),env:tz(u.bootstrapEnv),timeoutMs:n,runOnce:u.bootstrapRunOnce}:null}}function g(e,t){let r=n.config[t]??{},i=e[t]??{},a={};for(let[e,t]of Object.entries(i))r[e]!==t&&(a[e]=t);return Object.keys(a).length>0?a:null}function _(e){for(let t of i)g(e,t)===null&&delete e[t];return _R(n.config,e)}function v(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}let y=W(()=>_(h())),b=W(()=>bR(y.value)),x=W(()=>b.value>0),S=W(()=>yR(y.value,n.config)),C=k(!1),w=T(n.config);function T(e){return JSON.parse(JSON.stringify(e))}function ee(e){Object.assign(u,l(e)),d.value={...e.restart},f.value=TR(e.health),p.value={...e.stop},w=T(e),s.value=null}M(()=>n.config,e=>{v(e,w)||ee(e)});async function te(){s.value=null,o.value=!0;try{let e=h(),t=BA(e);if(t instanceof J.errors){s.value=t.summary;return}let i=_(e);if(Object.keys(i).length===0){r(`saved`);return}if(await a.saveConfig(n.workspaceId,n.serverId,i),a.lastError.value!==null){s.value=a.lastError.value;return}r(`saved`)}finally{o.value=!1}}return(e,t)=>(L(),R(I,null,[B(`form`,{class:`border-t border-line bg-page/40 px-4 py-4`,onSubmit:lu(te,[`prevent`])},[B(`header`,jZ,[B(`div`,MZ,[B(`h2`,NZ,O(A(Y)(`editor.title`)),1),B(`p`,PZ,[V(iB,{k:`editor.description`},{file:j(()=>[...t[32]||=[B(`span`,{class:`font-mono`},`servers.config.json`,-1)]]),_:1})])]),B(`div`,FZ,[b.value>0?(L(),R(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-2xs text-warn underline decoration-warn/40 underline-offset-2 transition-colors duration-150 hover:text-ink`,onClick:t[0]||=e=>C.value=!0},[B(`span`,IZ,O(b.value),1),H(` `+O(A(_F)(`editor.unsaved`,b.value)),1)])):(L(),R(`span`,LZ,O(A(Y)(`editor.inSync`)),1))])]),B(`div`,RZ,[V(gz,{title:A(Y)(`editor.process`),description:A(Y)(`editor.processDescription`),columns:2},{default:j(()=>[V(Rz,{modelValue:u.label,"onUpdate:modelValue":t[1]||=e=>u.label=e,label:A(Y)(`common.label`),placeholder:A(Y)(`editor.labelPlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V(Rz,{modelValue:u.command,"onUpdate:modelValue":t[2]||=e=>u.command=e,label:A(Y)(`common.command`),placeholder:`node`,required:``,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(Rz,{modelValue:u.cwd,"onUpdate:modelValue":t[3]||=e=>u.cwd=e,label:A(Y)(`serverForm.workingDirectory`),placeholder:`.`,hint:A(Y)(`serverForm.cwdHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:u.envFile,"onUpdate:modelValue":t[4]||=e=>u.envFile=e,label:A(Y)(`serverForm.envFile`),placeholder:A(Y)(`serverForm.envFilePlaceholder`),hint:A(Y)(`serverForm.envFileHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(rB,{modelValue:u.args,"onUpdate:modelValue":t[5]||=e=>u.args=e,label:A(Y)(`serverForm.arguments`),rows:3,hint:A(Y)(`editor.argumentsHint`),placeholder:`-p
46
+ {port}`},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:u.env,"onUpdate:modelValue":t[6]||=e=>u.env=e,label:A(Y)(`common.environment`),rows:3,hint:A(Y)(`serverForm.envHint`),placeholder:`NODE_ENV=production`},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:u.dataEnvs,"onUpdate:modelValue":t[7]||=e=>u.dataEnvs=e,label:A(Y)(`serverForm.dataEnvs`),rows:3,hint:A(Y)(`serverForm.dataEnvsHint`),placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`,`label`,`hint`]),V(rB,{modelValue:u.backupPaths,"onUpdate:modelValue":t[8]||=e=>u.backupPaths=e,label:A(Y)(`serverForm.backupPaths`),rows:2,hint:A(Y)(`serverForm.backupPathsHint`),placeholder:`{home}/.app/uploads`},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:u.backupIgnoreGenerated,"onUpdate:modelValue":t[9]||=e=>u.backupIgnoreGenerated=e,label:A(Y)(`serverForm.backupIgnore`),hint:A(Y)(`serverForm.backupIgnoreHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:u.dependsOn,"onUpdate:modelValue":t[10]||=e=>u.dependsOn=e,label:A(Y)(`serverForm.dependsOn`),placeholder:`postgres, redis`,hint:A(Y)(`serverForm.dependsOnHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:u.maxRssMb,"onUpdate:modelValue":t[11]||=e=>u.maxRssMb=e,label:A(Y)(`serverForm.maxRssMb`),min:0,hint:A(Y)(`serverForm.maxRssHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`editor.portTitle`),description:A(Y)(`editor.portDescription`),columns:2},{default:j(()=>[V(Dz,{modelValue:u.port,"onUpdate:modelValue":t[12]||=e=>u.port=e,label:A(Y)(`common.port`),nullable:``,min:1,max:65535,hint:A(Y)(`serverForm.portHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Nz,{modelValue:u.bind,"onUpdate:modelValue":t[13]||=e=>u.bind=e,label:A(Y)(`serverForm.bindAddress`),options:m.value,hint:A(Y)(`editor.bindHint`)},null,8,[`modelValue`,`label`,`options`,`hint`]),V(Nz,{modelValue:u.onPortConflict,"onUpdate:modelValue":t[14]||=e=>u.onPortConflict=e,label:A(Y)(`serverForm.onPortConflict`),options:[{value:`block`,label:A(Y)(`onPortConflict.block`)},{value:`warn`,label:A(Y)(`onPortConflict.warn`)},{value:`follow`,label:A(Y)(`onPortConflict.follow`)},{value:`reclaim`,label:A(Y)(`onPortConflict.reclaim`)},{value:`kill`,label:A(Y)(`onPortConflict.kill`)}]},null,8,[`modelValue`,`label`,`options`]),V(Dz,{modelValue:u.logBufferLines,"onUpdate:modelValue":t[15]||=e=>u.logBufferLines=e,label:A(Y)(`serverForm.logBufferLines`),min:50,max:1e5,step:50},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`]),V(gz,{title:A(Y)(`editor.lifecycle`),description:A(Y)(`editor.lifecycleDescription`),columns:3},{default:j(()=>[V(Vz,{modelValue:u.enabled,"onUpdate:modelValue":t[16]||=e=>u.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`serverForm.enabledHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:u.autostart,"onUpdate:modelValue":t[17]||=e=>u.autostart=e,label:A(Y)(`serverForm.autostart`),hint:A(Y)(`serverForm.autostartHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:u.persistent,"onUpdate:modelValue":t[18]||=e=>u.persistent=e,label:A(Y)(`serverForm.persistent`),hint:A(Y)(`serverForm.persistentHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(Hz,{restart:d.value,"onUpdate:restart":t[19]||=e=>d.value=e,health:f.value,"onUpdate:health":t[20]||=e=>f.value=e,stop:p.value,"onUpdate:stop":t[21]||=e=>p.value=e},null,8,[`restart`,`health`,`stop`]),V(gz,{title:A(Y)(`serverForm.bootstrap`),description:A(Y)(`serverForm.bootstrapDescription`),columns:2},{default:j(()=>[V(Vz,{modelValue:u.bootstrapEnabled,"onUpdate:modelValue":t[22]||=e=>u.bootstrapEnabled=e,label:A(Y)(`serverForm.runBootstrap`),hint:A(Y)(`serverForm.bootstrapHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),u.bootstrapEnabled?(L(),R(I,{key:0},[V(Rz,{modelValue:u.bootstrapCommand,"onUpdate:modelValue":t[23]||=e=>u.bootstrapCommand=e,label:A(Y)(`common.command`),placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(Dz,{modelValue:u.bootstrapTimeoutMs,"onUpdate:modelValue":t[24]||=e=>u.bootstrapTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:u.bootstrapRunOnce,"onUpdate:modelValue":t[25]||=e=>u.bootstrapRunOnce=e,label:A(Y)(`serverForm.runOnce`),hint:A(Y)(`serverForm.runOnceHint`)},null,8,[`modelValue`,`label`,`hint`])],64)):U(``,!0),u.bootstrapEnabled?(L(),z(rB,{key:1,modelValue:u.bootstrapArgs,"onUpdate:modelValue":t[26]||=e=>u.bootstrapArgs=e,label:A(Y)(`serverForm.bootstrapArgs`),rows:2,hint:A(Y)(`serverForm.bootstrapArgsHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0),u.bootstrapEnabled?(L(),z(rB,{key:2,modelValue:u.bootstrapEnv,"onUpdate:modelValue":t[27]||=e=>u.bootstrapEnv=e,label:A(Y)(`serverForm.bootstrapEnv`),rows:2,hint:A(Y)(`serverForm.bootstrapEnvHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0)]),_:1},8,[`title`,`description`])]),s.value?(L(),R(`p`,zZ,O(s.value),1)):U(``,!0),B(`div`,BZ,[V($,{variant:`ghost`,onClick:t[28]||=e=>r(`cancel`)},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{type:`submit`,variant:`primary`,disabled:o.value||!x.value,loading:o.value},{default:j(()=>[H(O(A(Y)(`editor.save`)),1)]),_:1},8,[`disabled`,`loading`])])],32),V($z,{open:C.value,"onUpdate:open":t[31]||=e=>C.value=e,title:A(Y)(`editor.changesTitle`),description:A(Y)(`editor.changesDescription`),width:`w-[min(92vw,42rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[29]||=e=>C.value=!1},{default:j(()=>[H(O(A(Y)(`common.close`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:S.value.length===0||o.value,loading:o.value,onClick:t[30]||=e=>{te(),C.value=!1}},{default:j(()=>[H(O(A(_F)(`editor.saveChanges`,S.value.length)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`div`,VZ,[S.value.length>0?(L(),R(`ul`,HZ,[(L(!0),R(I,null,P(S.value,e=>(L(),R(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[B(`code`,UZ,O(e.path),1),B(`span`,WZ,O(A(zL)(e.from)),1),t[33]||=B(`span`,{class:`text-2xs text-faint`},`→`,-1),B(`span`,GZ,O(A(zL)(e.to)),1)]))),128))])):(L(),R(`p`,KZ,O(A(Y)(`editor.nothingToSave`)),1))])]),_:1},8,[`open`,`title`,`description`])],64))}}),JZ={key:0,class:`mx-auto max-w-3xl p-4 sm:p-5`},YZ={key:1,class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},XZ={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},ZZ={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},QZ={class:`font-mono text-xs text-faint`},$Z=[`href`],eQ={class:`px-2 py-1.5`},tQ={class:`mb-1 text-2xs text-faint`},nQ={class:`flex flex-col gap-0.5`},rQ=[`onClick`],iQ={class:`space-y-2`},aQ={key:0,class:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-control border border-danger/25 bg-danger-soft px-3 py-2`},oQ={class:`min-w-0 flex-1 text-2xs leading-4 text-danger`},sQ={key:1,class:`rounded-control border border-warn/25 bg-warn-soft px-3 py-2 text-2xs leading-4 text-warn`},cQ={class:`grid grid-cols-2 gap-x-4 gap-y-3 p-4 sm:grid-cols-4 lg:grid-cols-6`},lQ={class:`truncate text-2xs text-faint`},uQ={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},dQ={class:`text-sm font-semibold text-ink`},fQ={class:`text-2xs text-muted`},pQ={class:`grid gap-4 sm:grid-cols-3`},mQ={class:`flex items-center justify-between gap-3`},hQ=[`title`],gQ={key:1,class:`space-y-4`},_Q={class:`text-sm font-semibold text-ink`},vQ={class:`text-2xs text-muted`},yQ={key:0,class:`max-h-96 overflow-auto rounded-control border border-line bg-page/60 p-3 font-mono text-2xs leading-5 text-muted`},bQ={key:1,class:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2`},xQ={class:`text-2xs text-faint`},SQ=[`title`],CQ={key:2,class:`grid gap-4 lg:grid-cols-3`},wQ={class:`text-sm font-semibold text-ink`},TQ={class:`text-2xs text-muted`},EQ={class:`text-sm font-semibold text-ink`},DQ={key:0,class:`flex flex-wrap gap-1.5`},OQ={key:1,class:`text-xs text-muted`},kQ={class:`text-xs text-muted`},AQ=N({__name:`ServerDetailView`,setup(e){let t=zg(),n=XN(),r=dP(),i=W(()=>String(t.params.id??``));M([i,()=>n.appState.value],()=>{let e=i.value;if(e.length===0||r.serverById(e)!==void 0)return;let t=n.workspaces.value.filter(t=>t.servers.some(t=>t.id===e));t.length===1&&r.select(t[0].id)},{immediate:!0});let a=W(()=>r.serverById(i.value)),o=W(()=>a.value?.config),s=W(()=>{let e=o.value;return e?.label&&e.label.length>0?e.label:i.value}),c=k(`output`),l=k(!1),u=k(!1),d=k(!1),f=k(!1),p=YN(r.activeId,()=>a.value?i.value:null),m=p.version,h=W(()=>(m.value,p.lines())),g=W(()=>r.seriesOf(i.value)),_=n.now,v=W(()=>a.value?pB(a.value,mB()):null),y=W(()=>g.value.cpu),b=W(()=>g.value.rss),x=W(()=>g.value.probe),S=W(()=>{let e=a.value;return!e||e.startedAt===null||e.status!==`running`?`—`:jL(_.value-e.startedAt)}),C=W(()=>a.value?.status===`running`),w={unknown:`common.unknown`,free:`views.serverDetail.portFree`,"in-use":`views.serverDetail.portInUse`},T=W(()=>{let e=a.value;if(!e)return[];let t=[{key:`pid`,label:Y(`views.serverDetail.pid`),value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:Y(`common.uptime`),value:S.value},{key:`status`,label:Y(`common.status`),value:Y(qI[e.status].labelKey)},{key:`health`,label:Y(`views.serverDetail.health`),value:Y(JI[e.health].labelKey)},{key:`port`,label:Y(`views.serverDetail.portState`),value:Y(w[e.portState]??`common.unknown`)},{key:`probe`,label:Y(`views.serverDetail.lastProbe`),value:e.responseMs===null?`—`:`${e.responseMs} ms`},{key:`rss`,label:`RSS`,value:LL(e.resources?.rssBytes??null)},{key:`procs`,label:Y(`views.serverDetail.processes`),value:e.resources?String(e.resources.processes):`—`},{key:`restarts`,label:Y(`views.serverDetail.restarts`),value:`${e.restarts}/${e.maxRetries}`},{key:`up24`,label:Y(`views.serverDetail.uptime24`),value:_L(e.history.uptimeRatio)},{key:`crashes`,label:Y(`views.serverDetail.crashes24`),value:String(e.history.crashes)},{key:`lastcrash`,label:Y(`views.serverDetail.lastCrash`),value:NL(e.history.lastCrashAt,_.value)}];return e.nextRetryAt!==null&&t.push({key:`retry`,label:Y(`views.serverDetail.nextAttempt`),value:ML(e.nextRetryAt,_.value)}),e.unhealthySince!==null&&t.push({key:`unhealthy`,label:Y(`views.serverDetail.unhealthyFor`),value:jL(_.value-e.unhealthySince)}),t}),ee=W(()=>JSON.stringify(o.value??{},null,2)),te=W(()=>o.value?`${o.value.command} ${o.value.args.join(` `)}`.trim():``),ne=W(()=>{let e=o.value?.bind??`local`,t=[{value:`local`,label:Y(`views.serverDetail.bindLocal`)},{value:`lan`,label:Y(`views.serverDetail.bindLan`)}];return e!==`local`&&e!==`lan`&&t.push({value:e,label:Y(`views.serverDetail.bindCustom`,{bind:e})}),t});async function re(e){f.value=!0;try{await n[e](r.activeId.value,i.value)}finally{f.value=!1}}async function ie(){d.value=!1,await r.removeServer(i.value)}async function ae(){let e=a.value;if(e){f.value=!0;try{await r.freePort(e.id)}finally{f.value=!1}}}let oe=W(()=>HM(r.activeId.value,i.value,`${i.value}.log`)),se=[{value:`output`,labelKey:`views.serverDetail.sectionOutput`},{value:`config`,labelKey:`views.serverDetail.sectionConfig`},{value:`history`,labelKey:`views.serverDetail.sectionHistory`}].map(e=>({value:e.value,label:Y(e.labelKey)}));return(e,t)=>{let n=pa(`RouterLink`);return a.value?(L(),R(`div`,YZ,[V(CV,{title:s.value,"back-to":A(d1)(A(r).activeId.value,`servers`),"back-label":A(Y)(`views.serverDetail.allServers`)},{badges:j(()=>[V(zB,{status:a.value.status,health:a.value.health},null,8,[`status`,`health`]),a.value.adopted?(L(),z(BB,{key:0,label:A(Y)(`views.serverDetail.detachedHint`)},{default:j(()=>[B(`span`,XZ,O(A(Y)(`views.serverDetail.detached`)),1)]),_:1},8,[`label`])):U(``,!0),a.value.config.persistent?(L(),z(BB,{key:1,label:A(Y)(`views.serverDetail.persistentHint`)},{default:j(()=>[B(`span`,ZZ,O(A(Y)(`views.serverDetail.persistent`)),1)]),_:1},8,[`label`])):U(``,!0),B(`span`,QZ,O(a.value.id),1),v.value?(L(),R(`a`,{key:2,href:v.value,target:`_blank`,rel:`noreferrer`,class:`inline-flex items-center gap-1 font-mono text-xs text-accent hover:underline`},[H(O(v.value)+` `,1),V(A(Zv),{class:`size-3`})],8,$Z)):U(``,!0)]),actions:j(()=>[V($,{variant:`primary`,disabled:f.value||!o.value?.enabled||[`running`,`starting`].includes(a.value.status),onClick:t[0]||=e=>re(`start`)},{default:j(()=>[V(A(_y),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.start`)),1)]),_:1},8,[`disabled`]),V($,{disabled:f.value||a.value.status===`stopped`,onClick:t[1]||=e=>re(`stop`)},{default:j(()=>[V(A(jy),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.stop`)),1)]),_:1},8,[`disabled`]),V($,{disabled:f.value||!o.value?.enabled,onClick:t[2]||=e=>re(`restart`)},{default:j(()=>[V(A(Sy),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.restart`)),1)]),_:1},8,[`disabled`]),V(BB,{label:A(Y)(`views.serverDetail.editHint`)},{default:j(()=>[V($,{variant:l.value?`secondary`:`ghost`,onClick:t[3]||=e=>{l.value=!l.value,c.value=`config`}},{default:j(()=>[V(A(gy),{class:`size-3.5`}),H(O(l.value?A(Y)(`views.serverDetail.closeEditor`):A(Y)(`common.edit`)),1)]),_:1},8,[`variant`])]),_:1},8,[`label`]),V(A(eg),null,{default:j(()=>[V(A(ag),{"as-child":``},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":A(Y)(`views.serverDetail.moreActions`,{label:s.value})},{default:j(()=>[V(A(Xv),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),V(A(rg),null,{default:j(()=>[V(A(tg),{"side-offset":4,align:`end`,class:`z-50 min-w-56 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[4]||=e=>A(r).setEnabled(a.value.id,!a.value.config.enabled)},{default:j(()=>[H(O(o.value?.enabled?A(Y)(`views.serverDetail.disableServer`):A(Y)(`views.serverDetail.enableServer`)),1)]),_:1}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[5]||=e=>A(r).setAutostart(a.value.id,!a.value.config.autostart)},{default:j(()=>[H(O(o.value?.autostart?A(Y)(`views.serverDetail.removeAutostart`):A(Y)(`views.serverDetail.autostart`)),1)]),_:1}),V(A(ig),{class:`my-1 h-px bg-line`}),B(`div`,eQ,[B(`p`,tQ,O(A(Y)(`views.serverDetail.bind`)),1),B(`div`,nQ,[(L(!0),R(I,null,P(ne.value,e=>(L(),R(`button`,{key:e.value,type:`button`,class:D([`rounded-control px-2 py-1 text-left font-mono text-2xs transition-colors duration-150 hover:bg-hover`,e.value===o.value?.bind?`text-accent`:`text-muted`]),onClick:t=>A(r).setBind(a.value.id,e.value)},O(e.label),11,rQ))),128))])]),V(A(ig),{class:`my-1 h-px bg-line`}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:t[6]||=e=>d.value=!0},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(` `+O(A(Y)(`views.serverDetail.removeServer`)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,[`title`,`back-to`,`back-label`]),B(`div`,iQ,[a.value.lastError?(L(),R(`div`,aQ,[B(`p`,oQ,O(a.value.lastError),1),a.value.status===`conflict`&&a.value.config.port!==null?(L(),z(vB,{key:0,port:a.value.config.port,busy:f.value,onConfirm:ae},null,8,[`port`,`busy`])):U(``,!0)])):U(``,!0),a.value.health===`unhealthy`?(L(),R(`p`,sQ,[a.value.unhealthySince===null?(L(),R(I,{key:1},[H(O(A(Y)(`views.serverDetail.probeFailed`)),1)],64)):(L(),R(I,{key:0},[H(O(A(Y)(`views.serverDetail.probeFailedFor`,{duration:A(jL)(A(_)-a.value.unhealthySince)})),1)],64))])):U(``,!0)]),V(DV,{class:`p-0`},{default:j(()=>[B(`dl`,cQ,[(L(!0),R(I,null,P(T.value,e=>(L(),R(`div`,{key:e.key,class:`min-w-0`},[B(`dt`,lQ,O(e.label),1),B(`dd`,uQ,O(e.value),1)]))),128))])]),_:1}),V(DV,null,{header:j(()=>[B(`h2`,dQ,O(A(Y)(`views.serverDetail.telemetry`)),1),B(`p`,fQ,O(A(Y)(`views.serverDetail.telemetryNote`)),1)]),default:j(()=>[B(`div`,pQ,[V(FB,{label:A(Y)(`common.cpu`),values:y.value,format:A(RL),max:100,"color-class":`text-cpu`,height:40},null,8,[`label`,`values`,`format`]),V(FB,{label:A(Y)(`views.serverDetail.memoryRss`),values:b.value,format:A(LL),"color-class":`text-mem`,height:40},null,8,[`label`,`values`,`format`]),V(FB,{label:A(Y)(`views.serverDetail.healthProbe`),values:x.value,format:e=>e===null?`—`:`${e} ms`,"color-class":`text-probe`,height:40},null,8,[`label`,`values`,`format`])])]),_:1}),B(`div`,mQ,[V(_W,{modelValue:c.value,"onUpdate:modelValue":t[7]||=e=>c.value=e,options:A(se),size:`md`},null,8,[`modelValue`,`options`]),B(`p`,{class:`hidden font-mono text-2xs text-faint sm:block`,title:te.value},O(te.value),9,hQ)]),c.value===`output`?(L(),z(lq,{key:0,lines:h.value,version:A(m),live:``,clearable:``,"download-url":a.value.config.logBufferLines>0?oe.value:void 0,"download-name":`${a.value.id}.log`,"empty-hint":C.value?A(Y)(`views.serverDetail.waitingFirstLine`):A(Y)(`views.serverDetail.neverWritten`),"min-height":`22rem`,onClear:t[8]||=e=>A(r).clearLogs(a.value.id)},null,8,[`lines`,`version`,`download-url`,`download-name`,`empty-hint`])):c.value===`config`?(L(),R(`div`,gQ,[l.value?(L(),z(qZ,{key:0,"server-id":a.value.id,"workspace-id":A(r).activeId.value,config:a.value.config,onSaved:t[9]||=e=>l.value=!1,onCancel:t[10]||=e=>l.value=!1},null,8,[`server-id`,`workspace-id`,`config`])):(L(),z(DV,{key:1},{header:j(()=>[B(`h2`,_Q,O(A(Y)(`views.serverDetail.effectiveConfig`)),1),B(`p`,vQ,O(A(Y)(`views.serverDetail.effectiveConfigNote`)),1)]),actions:j(()=>[V($,{size:`xs`,variant:`ghost`,onClick:t[11]||=e=>u.value=!u.value},{default:j(()=>[V(A(Gv),{class:`size-3`}),H(O(u.value?A(Y)(`views.serverDetail.fields`):A(Y)(`views.serverDetail.rawJson`)),1)]),_:1}),V(gU,{value:ee.value,label:A(Y)(`views.serverDetail.copyJson`)},null,8,[`value`,`label`]),V($,{size:`xs`,variant:`primary`,onClick:t[12]||=e=>l.value=!0},{default:j(()=>[V(A(gy),{class:`size-3`}),H(O(A(Y)(`common.edit`)),1)]),_:1})]),default:j(()=>[u.value?(L(),R(`pre`,yQ,O(ee.value),1)):(L(),R(`dl`,bQ,[(L(!0),R(I,null,P([{label:A(Y)(`views.serverDetail.fieldCommand`),value:o.value?.command},{label:A(Y)(`views.serverDetail.fieldArgs`),value:o.value?.args.join(` `)||`—`},{label:A(Y)(`views.serverDetail.fieldCwd`),value:o.value?.cwd},{label:A(Y)(`views.serverDetail.fieldEnv`),value:Object.keys(o.value?.env??{}).join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldDataEnvs`),value:Object.entries(o.value?.dataEnvs??{}).map(([e,t])=>`${e}=${t}`).join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldEnvFile`),value:o.value?.envFile||`—`},{label:A(Y)(`views.serverDetail.fieldPortBind`),value:`${o.value?.port??A(Y)(`common.none`)} · ${o.value?.bind}`},{label:A(Y)(`views.serverDetail.fieldOnPortConflict`),value:o.value?.onPortConflict},{label:A(Y)(`views.serverDetail.fieldLogBuffer`),value:A(_F)(`logs.lines`,o.value?.logBufferLines??0)},{label:A(Y)(`views.serverDetail.fieldRssLimit`),value:o.value?.resources.maxRssBytes?A(LL)(o.value.resources.maxRssBytes):A(Y)(`common.none`)},{label:A(Y)(`views.serverDetail.fieldHealth`),value:o.value?.health.enabled?`${o.value.health.mode} every ${o.value.health.intervalMs} ms`:A(Y)(`common.disabled`)},{label:A(Y)(`views.serverDetail.fieldRestart`),value:o.value?.restart.enabled?`${o.value.restart.maxRetries} retries, ×${o.value.restart.factor}`:A(Y)(`common.disabled`)},{label:A(Y)(`views.serverDetail.fieldStop`),value:o.value?`${o.value.stop.signal} after ${o.value.stop.graceMs} ms`:`—`},{label:A(Y)(`views.serverDetail.fieldBootstrap`),value:o.value?.bootstrap?`${o.value.bootstrap.command} ${o.value.bootstrap.args.join(` `)}`:A(Y)(`common.none`)},{label:A(Y)(`views.serverDetail.fieldBackupPaths`),value:o.value?.backupPaths.join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldDependsOn`),value:o.value?.dependsOn.join(`, `)||`—`}],e=>(L(),R(`div`,{key:e.label,class:`min-w-0 border-b border-line-soft pb-1.5 last:border-0`},[B(`dt`,xQ,O(e.label),1),B(`dd`,{class:`truncate font-mono text-xs text-ink`,title:String(e.value)},O(e.value),9,SQ)]))),128))]))]),_:1}))])):(L(),R(`div`,CQ,[V(DV,{class:`lg:col-span-2`},{header:j(()=>[B(`h2`,wQ,O(A(Y)(`views.serverDetail.eventHistory`)),1),B(`p`,TQ,O(A(Y)(`views.serverDetail.eventHistoryNote`)),1)]),default:j(()=>[V(fR,{servers:[a.value],now:A(_),limit:30},null,8,[`servers`,`now`])]),_:1}),V(DV,null,{header:j(()=>[B(`h2`,EQ,O(A(Y)(`views.serverDetail.dependencies`)),1)]),default:j(()=>[o.value&&o.value.dependsOn.length>0?(L(),R(`div`,DQ,[(L(!0),R(I,null,P(o.value.dependsOn,e=>(L(),z(n,{key:e,to:`/servers/${e}`,class:`rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},{default:j(()=>[H(O(e),1)]),_:2},1032,[`to`]))),128))])):(L(),R(`p`,OQ,[V(iB,{k:`views.serverDetail.startsOnItsOwn`},{code:j(()=>[...t[15]||=[B(`code`,null,`dependsOn`,-1)]]),_:1})]))]),_:1})])),V($z,{open:d.value,"onUpdate:open":t[14]||=e=>d.value=e,title:A(Y)(`views.serverDetail.removeTitle`),description:A(Y)(`views.serverDetail.removeDescription`,{label:s.value}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[13]||=e=>d.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ie},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(O(A(Y)(`common.remove`)),1)]),_:1})]),default:j(()=>[B(`p`,kQ,O(A(Y)(`views.serverDetail.removeNote`)),1)]),_:1},8,[`open`,`title`,`description`])])):(L(),R(`div`,JZ,[V(gL,{title:A(Y)(`views.serverDetail.goneTitle`),description:A(Y)(`views.serverDetail.goneDescription`,{id:i.value})},{action:j(()=>[V(n,{to:A(d1)(A(r).activeId.value,`servers`)},{default:j(()=>[V($,{variant:`primary`},{default:j(()=>[H(O(A(Y)(`views.serverDetail.backToServers`)),1)]),_:1})]),_:1},8,[`to`])]),_:1},8,[`title`,`description`])]))}}}),jQ={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},MQ={class:`flex flex-wrap items-center gap-2`},NQ={class:`relative ml-auto w-full sm:w-64`},PQ=[`placeholder`,`aria-label`],FQ=[`aria-label`],IQ={key:0,class:`grid gap-4 lg:grid-cols-2`},LQ={key:3,class:`grid gap-4 lg:grid-cols-2`},RQ=N({__name:`ServersView`,setup(e){let t=XN(),n=dP(),{servers:r}=n,i=k(!1),a=k(``),o=k(`all`),s=[{value:`all`,labelKey:`views.servers.filterAll`},{value:`running`,labelKey:`views.servers.filterRunning`},{value:`stopped`,labelKey:`views.servers.filterStopped`},{value:`attention`,labelKey:`views.servers.filterAttention`},{value:`disabled`,labelKey:`views.servers.filterDisabled`}],c=W(()=>t.appState.value===null),l=W(()=>{let e=a.value.trim().toLowerCase();return r.value.filter(t=>o.value===`running`&&t.status!==`running`||o.value===`stopped`&&![`stopped`,`stopping`].includes(t.status)||o.value===`disabled`&&t.config.enabled||o.value===`attention`&&t.status!==`crashed`&&t.status!==`conflict`&&t.health!==`unhealthy`?!1:e.length===0||`${t.id} ${t.config.label??``} ${t.config.command} ${t.config.port??``}`.toLowerCase().includes(e))}),u=W(()=>({all:r.value.length,running:r.value.filter(e=>e.status===`running`).length,attention:r.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`).length})),d=W(()=>s.map(e=>({value:e.value,label:`${Y(e.labelKey)}${e.value===`all`?` ${u.value.all}`:e.value===`running`?` ${u.value.running}`:e.value===`attention`&&u.value.attention>0?` ${u.value.attention}`:``}`})));return(e,s)=>(L(),R(`div`,jQ,[V(CV,{title:A(Y)(`nav.servers`),description:A(Y)(`views.servers.description`,{workspace:A(n).selected.value?.label??A(Y)(`nav.workspace`)})},{actions:j(()=>[V($,{variant:`ghost`,onClick:s[0]||=e=>A(n).startAll()},{default:j(()=>[V(A(_y),{class:`size-3.5`}),H(O(A(Y)(`views.actions.startAll`)),1)]),_:1}),V($,{variant:`ghost`,onClick:s[1]||=e=>A(n).stopAll()},{default:j(()=>[V(A(jy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.stopAll`)),1)]),_:1}),V($,{variant:`primary`,onClick:s[2]||=e=>i.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1})]),_:1},8,[`title`,`description`]),B(`div`,MQ,[V(_W,{modelValue:o.value,"onUpdate:modelValue":s[3]||=e=>o.value=e,options:d.value},null,8,[`modelValue`,`options`]),B(`div`,NQ,[V(A(wy),{class:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),Sr(B(`input`,{"onUpdate:modelValue":s[4]||=e=>a.value=e,type:`search`,placeholder:A(Y)(`views.servers.filterPlaceholder`),class:D([`pl-8`,[A(Sz)]]),"aria-label":A(Y)(`views.servers.filterAria`)},null,10,PQ),[[Jl,a.value]]),a.value.length>0?(L(),R(`button`,{key:0,type:`button`,class:`absolute right-1.5 top-1/2 grid size-6 -translate-y-1/2 place-items-center rounded-control text-faint hover:text-ink`,"aria-label":A(Y)(`views.servers.clearFilter`),onClick:s[5]||=e=>a.value=``},[V(A(zy),{class:`size-3.5`})],8,FQ)):U(``,!0)])]),c.value?(L(),R(`div`,IQ,[(L(),R(I,null,P(4,e=>V(OV,{key:e,class:`h-72 w-full`,rounded:`rounded-panel`})),64))])):A(r).length===0?(L(),z(gL,{key:1,title:A(Y)(`views.servers.emptyTitle`),description:A(Y)(`views.servers.emptyDescription`)},{icon:j(()=>[V(A(Ty),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:s[6]||=e=>i.value=!0},{default:j(()=>[V(A(vy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):l.value.length===0?(L(),z(gL,{key:2,compact:``,title:A(Y)(`views.servers.noMatchTitle`),description:A(Y)(`views.servers.noMatchDescription`)},{action:j(()=>[V($,{onClick:s[7]||=e=>{a.value=``,o.value=`all`}},{default:j(()=>[H(O(A(Y)(`views.servers.clearFilters`)),1)]),_:1})]),_:1},8,[`title`,`description`])):(L(),R(`div`,LQ,[(L(!0),R(I,null,P(l.value,e=>(L(),z(gV,{key:e.id,server:e,"workspace-id":A(n).activeId.value,series:A(n).seriesOf(e.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))])),V(dB,{open:i.value,"onUpdate:open":s[8]||=e=>i.value=e,"workspace-id":A(n).activeId.value},null,8,[`open`,`workspace-id`])]))}}),zQ=0;function BQ(){return zQ+=1,`ddns-row-${zQ}`}function VQ(){return BQ()}function HQ(e){let t=structuredClone(dn(e));return t.domains=(t.domains??[]).map(e=>({...e,key:e.key??BQ()})),t}function UQ(e){let t=structuredClone(dn(e));return{...t,domains:t.domains.map(({key:e,...t})=>t)}}function WQ(e,t){return e===null||t===null?e===t:JSON.stringify(UQ(e))===JSON.stringify(UQ(t))}var GQ={intervalMs:3e5,ttl:1};function KQ(e,t){return e===null||Number.isNaN(e)?GQ[t]:e}var qQ={class:`space-y-3`},JQ={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},YQ={class:`mb-3`},XQ={class:`text-xs font-semibold text-ink`},ZQ={class:`mt-0.5 text-2xs leading-4 text-muted`},QQ={key:0,class:`divide-y divide-line-soft`},$Q={class:`min-w-0`},e$={class:`font-mono text-xs text-ink`},t$={class:`text-2xs text-faint`},n$={key:0},r$={class:`ml-auto flex items-center gap-2`},i$={key:1,class:`text-2xs text-muted`},a$={class:`mt-3 grid gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},o$={class:`mt-1.5 text-2xs text-faint`},s$={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},c$={class:`mb-3`},l$={class:`text-xs font-semibold text-ink`},u$={class:`mt-0.5 text-2xs leading-4 text-muted`},d$={key:0,class:`space-y-2`},f$={class:`flex flex-wrap items-end gap-2`},p$={class:`min-w-40 flex-1`},m$={class:`w-44 shrink-0`},h$={class:`mt-1 flex flex-wrap items-center gap-x-4 gap-y-1`},g$={key:1,class:`text-2xs text-muted`},_$={class:`mt-3 grid gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},v$={key:1,class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},y$={class:`mb-2 flex flex-wrap items-center gap-x-3 gap-y-1`},b$={class:`text-xs font-semibold text-ink`},x$={key:0,class:`text-2xs text-muted`},S$={key:1,class:`font-mono text-2xs text-faint`},C$={key:2,class:`font-mono text-2xs text-faint`},w$={key:3,class:`ml-auto text-2xs text-faint`},T$={class:`overflow-x-auto`},E$={class:`w-full text-left text-xs`},D$={class:`text-2xs text-faint`},O$={class:`py-1 pr-3 font-medium`},k$={class:`py-1 pr-3 font-medium`},A$={class:`py-1 pr-3 font-medium`},j$={class:`py-1 pr-3 font-medium`},M$={class:`py-1 font-medium`},N$={class:`py-1.5 pr-3 font-mono text-2xs text-ink`},P$={class:`py-1.5 pr-3 text-2xs text-muted`},F$={class:`py-1.5 pr-3`},I$={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},L$={class:`py-1.5 text-2xs text-faint`},R$={class:`space-y-3`},z$={class:`text-2xs leading-4 text-muted`},B$=[`href`],V$=N({__name:`DdnsSection`,props:{patch:{default:null},patchModifiers:{},baseline:{default:null},baselineModifiers:{}},emits:[`update:patch`,`update:baseline`],setup(e,{expose:t}){let n=so(e,`patch`),r=so(e,`baseline`),i={pending:{labelKey:`settings.ddns.statePending`,tone:`neutral`},ok:{labelKey:`settings.ddns.stateOk`,tone:`ok`},unchanged:{labelKey:`settings.ddns.stateUnchanged`,tone:`neutral`},skipped:{labelKey:`settings.ddns.stateSkipped`,tone:`warn`},error:{labelKey:`settings.ddns.stateError`,tone:`danger`}},a=XN(),o=dP(),s=vN(),c=k(null),l=k(null),u=k(null),d=k(null),f=k(!1),p=tn({id:``,provider:`cloudflare`}),m=tn({host:``,account:``}),h=k(null),g=k({}),_=k(!1),v=k(null),y=W(()=>c.value?.providers??[]),b=W(()=>l.value?.accounts??[]),x=W(()=>l.value?.domains??[]),S=W(()=>b.value.map(e=>e.id).join(`,`)),C=W(()=>y.value.map(e=>({value:e.id,label:e.label}))),w=W(()=>b.value.map(e=>({value:e.id,label:e.id}))),T=W(()=>o.selected.value?.ddns??c.value?.status??null),ee=W(()=>l.value!==null&&r.value!==null&&!WQ(l.value,r.value)),te=W(()=>/^[a-z0-9][a-z0-9_-]*$/.test(p.id)&&!b.value.some(e=>e.id===p.id)),ne=W(()=>m.host.includes(`.`)&&m.account.length>0&&!x.value.some(e=>e.host.toLowerCase()===m.host.trim().toLowerCase())),re=W({get:()=>h.value!==null,set:e=>{e||(h.value=null)}}),ie=W(()=>h.value===null?[]:ae(h.value.provider)?.fields??[]);function ae(e){return y.value.find(t=>t.id===e)??null}function oe(e){let t=b.value.find(t=>t.id===e.account);return t===void 0?null:ae(t.provider)}function se(e){return ae(e.provider)?.label??e.provider}function ce(e){return c.value?.credentials.includes(e)===!0}function le(e){return x.value.filter(t=>t.account===e).length}function E(e,t,n){let r=n?[...new Set([...e.types,t])]:e.types.filter(e=>e!==t);e.types=r.length>0?r:e.types}function ue(e,t,n){n==null||n===``?delete e[t]:e[t]=n}function de(e,t,n){e!==null&&(e[t]=KQ(n,t))}function fe(){n.value=l.value===null||r.value===null||WQ(l.value,r.value)?null:UQ(l.value)}function pe(e,t=!1){c.value=e,r.value=HQ(e.config),t||(l.value=HQ(e.config)),fe()}async function me(){u.value=null;try{pe(await YM(o.activeId.value)),p.provider=C.value[0]?.value??`cloudflare`,m.account=b.value[0]?.id??``}catch(e){u.value=Lj(e)}}na(()=>{me()}),M(()=>o.activeId.value,(e,t)=>{e!==t&&e.length>0&&me()}),M(l,fe,{deep:!0}),M(S,()=>{b.value.some(e=>e.id===m.account)||(m.account=b.value[0]?.id??``)});function he(){te.value&&l.value!==null&&(l.value.accounts.push({id:p.id,provider:p.provider,label:``}),p.id=``)}function ge(e){l.value===null||le(e.id)>0||(l.value.accounts=l.value.accounts.filter(t=>t.id!==e.id))}function _e(){ne.value&&l.value!==null&&(l.value.domains.push({host:m.host.trim().toLowerCase(),account:m.account,types:[`A`],proxied:!1,enabled:!0,key:VQ()}),m.host=``)}function ve(e){l.value!==null&&(l.value.domains=l.value.domains.filter(t=>t!==e))}function ye(){r.value!==null&&(l.value=HQ(r.value)),d.value=null}async function be(){if(!f.value){f.value=!0,d.value=null;try{pe(await $M(o.activeId.value),!0),s.success(T.value?.lastResult??Y(`settings.ddns.passFinished`))}catch(e){d.value=Lj(e)}finally{f.value=!1}}}function xe(e){h.value=e,g.value=Object.fromEntries((ae(e.provider)?.fields??[]).map(e=>[e.key,``])),v.value=null}async function D(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{pe(await ZM(o.activeId.value,e.id,e.provider,g.value),!0),s.success(Y(`settings.ddns.credentialsSaved`,{account:e.id})),h.value=null}catch(e){v.value=Lj(e)}finally{_.value=!1}}}async function Se(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{pe(await QM(o.activeId.value,e.id),!0),s.success(Y(`settings.ddns.credentialsRemoved`,{account:e.id})),h.value=null}catch(e){v.value=Lj(e)}finally{_.value=!1}}}return t({reload:me}),(e,t)=>(L(),R(I,null,[B(`div`,qQ,[u.value?(L(),z(_H,{key:0,tone:`danger`,title:A(Y)(`settings.ddns.loadErrorTitle`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`])):U(``,!0),l.value===null?U(``,!0):(L(),R(I,{key:1},[V(gz,{title:A(Y)(`settings.ddns.title`),description:A(Y)(`settings.ddns.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!ee.value,onClick:ye},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`]),T.value?.running?(L(),z(vU,{key:0,tone:`info`,dot:``},{default:j(()=>[H(O(A(Y)(`settings.ddns.checking`)),1)]),_:1})):T.value?.enabled?(L(),z(vU,{key:1,tone:T.value.records.some(e=>e.state===`error`)?`danger`:`ok`,dot:``},{default:j(()=>[H(O(T.value.records.some(e=>e.state===`error`)?A(Y)(`settings.ddns.needsAttention`):A(Y)(`settings.ddns.watching`)),1)]),_:1},8,[`tone`])):U(``,!0),V($,{size:`xs`,variant:`ghost`,loading:f.value,onClick:be},{default:j(()=>[H(O(A(Y)(`settings.ddns.updateNow`)),1)]),_:1},8,[`loading`])]),default:j(()=>[V(Vz,{modelValue:l.value.enabled,"onUpdate:modelValue":t[0]||=e=>l.value.enabled=e,label:A(Y)(`settings.ddns.enabled`),hint:A(Y)(`settings.ddns.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{"model-value":l.value.intervalMs,label:A(Y)(`settings.ddns.interval`),min:6e4,step:6e4,hint:A(Y)(`settings.ddns.intervalHint`),"onUpdate:modelValue":t[1]||=e=>de(l.value,`intervalMs`,e)},null,8,[`model-value`,`label`,`hint`]),V(Dz,{"model-value":l.value.ttl,label:A(Y)(`settings.ddns.ttl`),min:1,hint:A(Y)(`settings.ddns.ttlHint`),"onUpdate:modelValue":t[2]||=e=>de(l.value,`ttl`,e)},null,8,[`model-value`,`label`,`hint`]),V(Vz,{modelValue:l.value.ipv4.enabled,"onUpdate:modelValue":t[3]||=e=>l.value.ipv4.enabled=e,label:A(Y)(`settings.ddns.detectIpv4`),hint:A(Y)(`settings.ddns.detectIpv4Hint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:l.value.ipv6.enabled,"onUpdate:modelValue":t[4]||=e=>l.value.ipv6.enabled=e,label:A(Y)(`settings.ddns.detectIpv6`),hint:A(Y)(`settings.ddns.detectIpv6Hint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),d.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(d.value),1)]),_:1})):U(``,!0),B(`section`,JQ,[B(`header`,YQ,[B(`h3`,XQ,O(A(Y)(`settings.ddns.accountsTitle`)),1),B(`p`,ZQ,O(A(Y)(`settings.ddns.accountsDescription`)),1)]),b.value.length>0?(L(),R(`ul`,QQ,[(L(!0),R(I,null,P(b.value,e=>(L(),R(`li`,{key:e.id,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0`},[B(`div`,$Q,[B(`p`,e$,O(e.id),1),B(`p`,t$,[H(O(se(e))+` `,1),le(e.id)>0?(L(),R(`span`,n$,` · `+O(A(_F)(`settings.ddns.hostnameCount`,le(e.id))),1)):U(``,!0)])]),B(`div`,r$,[V(vU,{tone:ce(e.id)?`ok`:`warn`,dot:``},{default:j(()=>[H(O(ce(e.id)?A(Y)(`settings.ddns.credentialsSet`):A(Y)(`settings.ddns.noCredentials`)),1)]),_:2},1032,[`tone`]),V($,{size:`xs`,variant:`secondary`,onClick:t=>xe(e)},{default:j(()=>[H(O(A(Y)(`settings.ddns.credentials`)),1)]),_:1},8,[`onClick`]),V($,{size:`xs`,variant:`danger-ghost`,disabled:le(e.id)>0,title:le(e.id)>0?A(Y)(`settings.ddns.removeAccountBlocked`):void 0,onClick:t=>ge(e)},{default:j(()=>[H(O(A(Y)(`common.remove`)),1)]),_:1},8,[`disabled`,`title`,`onClick`])])]))),128))])):(L(),R(`p`,i$,O(A(Y)(`settings.ddns.noAccounts`)),1)),B(`div`,a$,[V(Nz,{modelValue:p.provider,"onUpdate:modelValue":t[5]||=e=>p.provider=e,label:A(Y)(`settings.ddns.provider`),options:C.value},null,8,[`modelValue`,`label`,`options`]),V(Rz,{modelValue:p.id,"onUpdate:modelValue":t[6]||=e=>p.id=e,label:A(Y)(`settings.ddns.accountId`),placeholder:A(Y)(`settings.ddns.accountIdPlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V($,{variant:`secondary`,disabled:!te.value,onClick:he},{default:j(()=>[H(O(A(Y)(`common.add`)),1)]),_:1},8,[`disabled`])]),B(`p`,o$,O(A(Y)(`settings.ddns.accountIdHint`)),1)]),B(`section`,s$,[B(`header`,c$,[B(`h3`,l$,O(A(Y)(`settings.ddns.hostnamesTitle`)),1),B(`p`,u$,O(A(Y)(`settings.ddns.hostnamesDescription`)),1)]),x.value.length>0?(L(),R(`ul`,d$,[(L(!0),R(I,null,P(x.value,e=>(L(),R(`li`,{key:e.key,class:`rounded-control border border-line-soft bg-panel/50 p-2.5`},[B(`div`,f$,[B(`div`,p$,[V(Rz,{modelValue:e.host,"onUpdate:modelValue":t=>e.host=t,label:A(Y)(`common.hostname`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`])]),B(`div`,m$,[V(Nz,{modelValue:e.account,"onUpdate:modelValue":t=>e.account=t,label:A(Y)(`settings.ddns.account`),options:w.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`options`])]),V(LH,{modelValue:e.enabled,"onUpdate:modelValue":t=>e.enabled=t,label:A(Y)(`common.enabled`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`]),V($,{size:`xs`,variant:`danger-ghost`,onClick:t=>ve(e)},{default:j(()=>[H(O(A(Y)(`common.remove`)),1)]),_:1},8,[`onClick`])]),B(`div`,h$,[V(LH,{"model-value":e.types.includes(`A`),label:A(Y)(`settings.ddns.recordA`),"onUpdate:modelValue":t=>E(e,`A`,t===!0)},null,8,[`model-value`,`label`,`onUpdate:modelValue`]),V(LH,{"model-value":e.types.includes(`AAAA`),label:A(Y)(`settings.ddns.recordAaaa`),disabled:oe(e)?.families.includes(`AAAA`)===!1,hint:oe(e)?.families.includes(`AAAA`)===!1?A(Y)(`settings.ddns.aaaaUnsupported`):void 0,"onUpdate:modelValue":t=>E(e,`AAAA`,t===!0)},null,8,[`model-value`,`label`,`disabled`,`hint`,`onUpdate:modelValue`]),oe(e)?.proxied===!0?(L(),z(LH,{key:0,modelValue:e.proxied,"onUpdate:modelValue":t=>e.proxied=t,label:A(Y)(`settings.ddns.proxied`),hint:A(Y)(`settings.ddns.proxiedHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`])):U(``,!0),e.types.includes(`AAAA`)&&!l.value.ipv6.enabled?(L(),z(vU,{key:1,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.ddns.ipv6Off`)),1)]),_:1})):U(``,!0)]),V(Jz,{title:A(Y)(`settings.ddns.advanced`),hint:A(Y)(`settings.ddns.advancedHint`),class:`mt-2`},{default:j(()=>[V(Rz,{"model-value":e.zone??``,label:A(Y)(`settings.ddns.registeredDomain`),placeholder:A(Y)(`settings.ddns.registeredDomainPlaceholder`),hint:A(Y)(`settings.ddns.registeredDomainHint`),"onUpdate:modelValue":t=>ue(e,`zone`,t)},null,8,[`model-value`,`label`,`placeholder`,`hint`,`onUpdate:modelValue`]),oe(e)?.ttl===!1?U(``,!0):(L(),z(Dz,{key:0,"model-value":e.ttl??null,min:1,nullable:``,label:A(Y)(`settings.ddns.ttlOverride`),hint:A(Y)(`settings.ddns.ttlOverrideHint`),"onUpdate:modelValue":t=>ue(e,`ttl`,t)},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`]))]),_:2},1032,[`title`,`hint`])]))),128))])):(L(),R(`p`,g$,O(A(Y)(`settings.ddns.noHostnames`)),1)),B(`div`,_$,[V(Rz,{modelValue:m.host,"onUpdate:modelValue":t[7]||=e=>m.host=e,label:A(Y)(`common.hostname`),placeholder:A(Y)(`settings.ddns.hostnamePlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V(Nz,{modelValue:m.account,"onUpdate:modelValue":t[8]||=e=>m.account=e,label:A(Y)(`settings.ddns.account`),options:w.value,disabled:b.value.length===0},null,8,[`modelValue`,`label`,`options`,`disabled`]),V($,{variant:`secondary`,disabled:!ne.value,onClick:_e},{default:j(()=>[H(O(A(Y)(`common.add`)),1)]),_:1},8,[`disabled`])])]),T.value!==null&&T.value.records.length>0?(L(),R(`section`,v$,[B(`header`,y$,[B(`h3`,b$,O(A(Y)(`settings.ddns.lastPass`)),1),T.value.lastResult?(L(),R(`span`,x$,O(T.value.lastResult),1)):U(``,!0),T.value.ipv4?(L(),R(`span`,S$,O(A(Y)(`settings.ddns.ipv4Value`,{address:T.value.ipv4})),1)):U(``,!0),T.value.ipv6?(L(),R(`span`,C$,O(A(Y)(`settings.ddns.ipv6Value`,{address:T.value.ipv6})),1)):U(``,!0),T.value.lastRunAt?(L(),R(`span`,w$,O(A(NL)(T.value.lastRunAt,A(a).now.value)),1)):U(``,!0)]),B(`div`,T$,[B(`table`,E$,[B(`thead`,null,[B(`tr`,D$,[B(`th`,O$,O(A(Y)(`common.hostname`)),1),B(`th`,k$,O(A(Y)(`settings.ddns.type`)),1),B(`th`,A$,O(A(Y)(`settings.ddns.state`)),1),B(`th`,j$,O(A(Y)(`settings.ddns.address`)),1),B(`th`,M$,O(A(Y)(`settings.ddns.detail`)),1)])]),B(`tbody`,null,[(L(!0),R(I,null,P(T.value.records,e=>(L(),R(`tr`,{key:`${e.host}|${e.type}`,class:`border-t border-line-soft align-top`},[B(`td`,N$,O(e.host),1),B(`td`,P$,O(e.type),1),B(`td`,F$,[V(vU,{tone:i[e.state].tone,dot:``},{default:j(()=>[H(O(A(Y)(i[e.state].labelKey)),1)]),_:2},1032,[`tone`])]),B(`td`,I$,O(e.ip??`—`),1),B(`td`,L$,O(e.message??`—`),1)]))),128))])])])])):U(``,!0)],64))]),V($z,{open:re.value,"onUpdate:open":t[10]||=e=>re.value=e,title:A(Y)(`settings.ddns.credentialsTitle`),description:h.value===null?``:`${se(h.value)} — ${h.value.id}`,width:`w-[min(92vw,32rem)]`},{footer:j(()=>[h.value!==null&&ce(h.value.id)?(L(),z(mH,{key:0,label:A(Y)(`settings.ddns.forget`),"confirm-label":A(Y)(`settings.ddns.forgetConfirm`),title:A(Y)(`settings.ddns.forgetTitle`),hint:A(Y)(`settings.ddns.forgetHint`),loading:_.value,disabled:_.value,onConfirm:Se},null,8,[`label`,`confirm-label`,`title`,`hint`,`loading`,`disabled`])):U(``,!0),V($,{size:`sm`,variant:`ghost`,disabled:_.value,onClick:t[9]||=e=>re.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{size:`sm`,variant:`primary`,loading:_.value,disabled:Object.values(g.value).every(e=>e.trim().length===0),onClick:D},{default:j(()=>[H(O(A(Y)(`settings.ddns.saveCredentials`)),1)]),_:1},8,[`loading`,`disabled`])]),default:j(()=>[B(`div`,R$,[B(`p`,z$,O(A(Y)(`settings.ddns.credentialsDescription`)),1),(L(!0),R(I,null,P(ie.value,e=>(L(),z(Rz,{key:e.key,modelValue:g.value[e.key],"onUpdate:modelValue":t=>g.value[e.key]=t,type:`password`,autocomplete:`off`,label:e.label,hint:`${e.hint}${e.optional?` ${A(Y)(`settings.ddns.optional`)}`:``}`,wide:``},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]))),128)),h.value===null?U(``,!0):(L(),R(`a`,{key:0,class:`inline-block text-2xs text-accent underline decoration-line underline-offset-2`,href:ae(h.value.provider)?.docsUrl,target:`_blank`,rel:`noreferrer`},O(A(Y)(`settings.ddns.whereToGet`)),9,B$)),v.value?(L(),z(_H,{key:1,tone:`danger`},{default:j(()=>[H(O(v.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])],64))}}),H$={class:`mt-3 space-y-3`},U$=N({__name:`DefaultsSection`,props:za({dirty:{type:Boolean}},{defaults:{required:!0},defaultsModifiers:{}}),emits:za([`reset`],[`update:defaults`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`defaults`),a=ZR(()=>i.value.logBufferLines,e=>i.value.logBufferLines=e,500);return(e,t)=>(L(),R(I,null,[V(gz,{title:A(Y)(`settings.defaults.title`),description:A(Y)(`settings.defaults.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`settings.defaults.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:i.value.autostart,"onUpdate:modelValue":t[2]||=e=>i.value.autostart=e,label:A(Y)(`settings.defaults.autostart`)},null,8,[`modelValue`,`label`]),V(Nz,{modelValue:i.value.bind,"onUpdate:modelValue":t[3]||=e=>i.value.bind=e,label:A(Y)(`settings.defaults.bind`),options:[{value:`local`,label:A(Y)(`settings.defaults.bindLocal`)},{value:`lan`,label:A(Y)(`settings.defaults.bindLan`)}]},null,8,[`modelValue`,`label`,`options`]),V(Nz,{modelValue:i.value.onPortConflict,"onUpdate:modelValue":t[4]||=e=>i.value.onPortConflict=e,label:A(Y)(`settings.defaults.onPortConflict`),options:[{value:`block`,label:A(Y)(`settings.defaults.conflictBlock`)},{value:`warn`,label:A(Y)(`settings.defaults.conflictWarn`)},{value:`follow`,label:A(Y)(`settings.defaults.conflictFollow`)},{value:`reclaim`,label:A(Y)(`settings.defaults.conflictReclaim`)},{value:`kill`,label:A(Y)(`settings.defaults.conflictKill`)}]},null,8,[`modelValue`,`label`,`options`]),V(Dz,{modelValue:A(a),"onUpdate:modelValue":t[5]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.defaults.logBufferLines`),min:50,max:1e5,hint:A(Y)(`settings.defaults.logBufferLinesHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),B(`div`,H$,[V(Hz,{restart:i.value.restart,"onUpdate:restart":t[6]||=e=>i.value.restart=e,health:i.value.health,"onUpdate:health":t[7]||=e=>i.value.health=e,stop:i.value.stop,"onUpdate:stop":t[8]||=e=>i.value.stop=e},null,8,[`restart`,`health`,`stop`])])],64))}}),W$={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},G$={class:`text-xs font-medium text-muted`},K$={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},q$={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},J$={class:`text-2xs leading-4 text-faint`},Y$=N({__name:`LogsSection`,props:za({logsDir:{},dirty:{type:Boolean}},{logs:{required:!0},logsModifiers:{}}),emits:za([`reset`],[`update:logs`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`logs`),a=dP(),o=ZR(()=>i.value.maxBytes,e=>i.value.maxBytes=e,2e6),s=ZR(()=>i.value.keep,e=>i.value.keep=e,3),c=W(()=>n.logsDir??`—`);return(e,t)=>{let l=pa(`RouterLink`);return L(),z(gz,{title:A(Y)(`settings.logs.title`),description:A(Y)(`settings.logs.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.persist,"onUpdate:modelValue":t[1]||=e=>i.value.persist=e,label:A(Y)(`settings.logs.persist`),hint:A(Y)(`settings.logs.persistHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(o),"onUpdate:modelValue":t[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.logs.maxBytes`),min:1e4,max:1e8,hint:A(Y)(`settings.logs.maxBytesHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":t[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.logs.keep`),min:1,max:10},null,8,[`modelValue`,`label`]),B(`div`,W$,[B(`span`,G$,O(A(Y)(`settings.logs.directory`)),1),B(`div`,K$,[B(`span`,q$,O(c.value),1),V(gU,{value:c.value,label:A(Y)(`settings.logs.copyDirectory`)},null,8,[`value`,`label`])]),B(`p`,J$,[V(iB,{k:`settings.logs.browseHint`},{logs:j(()=>[V(l,{to:A(d1)(A(a).activeId.value,`logs`),class:`text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`},{default:j(()=>[H(O(A(Y)(`nav.logs`)),1)]),_:1},8,[`to`])]),_:1})])])]),_:1},8,[`title`,`description`])}}}),X$={class:`flex items-center gap-2 border-t border-line-soft pt-3 sm:col-span-2`},Z$={class:`text-xs font-medium text-muted`},Q$={class:`text-2xs text-faint`},$$={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},e1={key:0,class:`sm:col-span-2`},t1={class:`mb-1.5 text-xs text-muted`},n1={class:`flex flex-wrap gap-1.5`},r1={key:1,class:`sm:col-span-2`},i1={class:`text-2xs leading-4 text-faint`},a1={key:2,class:`space-y-2 sm:col-span-2`},o1=N({__name:`NotificationsSection`,props:za({status:{},dirty:{type:Boolean}},{telegram:{required:!0},telegramModifiers:{}}),emits:za([`reset`],[`update:telegram`]),setup(e,{emit:t}){let n=e,r=t,i=so(e,`telegram`),a=XN(),o=dP(),s=ZR(()=>i.value.cooldownMs,e=>i.value.cooldownMs=e,12e4),c=k(``),l=k(null),u=k(null),d=k([]),f=k(!1),p=W(()=>n.status?.tokenSet===!0),m=W(()=>n.status?.lastResult??null),h=W(()=>n.status?.lastResultAt??null),g=W(()=>p.value?Y(`settings.telegram.tokenSavedPlaceholder`):Y(`settings.telegram.tokenPlaceholder`));async function _(){f.value=!0,u.value=null,l.value=null;try{let e=await GM(o.activeId.value,c.value.trim());c.value=``,l.value=e.username?Y(`settings.telegram.tokenSavedFor`,{username:e.username}):Y(`settings.telegram.tokenSaved`),await a.refresh()}catch(e){u.value=Lj(e)}finally{f.value=!1}}async function v(){f.value=!0,u.value=null,l.value=null;try{await KM(o.activeId.value),l.value=Y(`settings.telegram.tokenRemoved`),await a.refresh()}catch(e){u.value=Lj(e)}finally{f.value=!1}}async function y(){f.value=!0,u.value=null,l.value=null;try{let e=c.value.trim(),t=await JM(o.activeId.value,e.length>0?{botToken:e}:{});d.value=t.chats,t.chats.length===0&&(u.value=Y(`settings.telegram.noChats`))}catch(e){u.value=Lj(e)}finally{f.value=!1}}async function b(){f.value=!0,u.value=null,l.value=null;try{let e=c.value.trim(),t=await qM(o.activeId.value,{chatId:i.value.chatId.length>0?i.value.chatId:void 0,...e.length>0?{botToken:e}:{}});t.ok?l.value=Y(`settings.telegram.testSent`):u.value=t.error??Y(`settings.telegram.testFailed`),await a.refresh()}catch(e){u.value=Lj(e)}finally{f.value=!1}}return(e,t)=>(L(),z(gz,{title:A(Y)(`settings.telegram.title`),description:A(Y)(`settings.telegram.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(Vz,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.telegram.enabled`),hint:A(Y)(`settings.telegram.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Rz,{modelValue:i.value.chatId,"onUpdate:modelValue":t[2]||=e=>i.value.chatId=e,label:A(Y)(`settings.telegram.chatId`),placeholder:A(Y)(`settings.telegram.chatIdPlaceholder`),hint:A(Y)(`settings.telegram.chatIdHint`)},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(Dz,{modelValue:A(s),"onUpdate:modelValue":t[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.telegram.cooldown`),min:0,hint:A(Y)(`settings.telegram.cooldownHint`)},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:i.value.onCrash,"onUpdate:modelValue":t[4]||=e=>i.value.onCrash=e,label:A(Y)(`settings.telegram.onCrash`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:i.value.onUnhealthy,"onUpdate:modelValue":t[5]||=e=>i.value.onUnhealthy=e,label:A(Y)(`settings.telegram.onUnhealthy`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:i.value.onForcedRestart,"onUpdate:modelValue":t[6]||=e=>i.value.onForcedRestart=e,label:A(Y)(`settings.telegram.onForcedRestart`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:i.value.onRecovered,"onUpdate:modelValue":t[7]||=e=>i.value.onRecovered=e,label:A(Y)(`settings.telegram.onRecovered`)},null,8,[`modelValue`,`label`]),V(Vz,{modelValue:i.value.onHost,"onUpdate:modelValue":t[8]||=e=>i.value.onHost=e,label:A(Y)(`settings.telegram.onHost`),hint:A(Y)(`settings.telegram.onHostHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(Vz,{modelValue:i.value.onDdns,"onUpdate:modelValue":t[9]||=e=>i.value.onDdns=e,label:A(Y)(`settings.telegram.onDdns`),hint:A(Y)(`settings.telegram.onDdnsHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),B(`div`,X$,[B(`span`,Z$,O(A(Y)(`settings.telegram.botToken`)),1),V(vU,{tone:p.value?`ok`:`warn`,dot:``},{default:j(()=>[H(O(p.value?A(Y)(`settings.telegram.tokenSet`):A(Y)(`settings.telegram.noToken`)),1)]),_:1},8,[`tone`]),B(`span`,Q$,O(A(Y)(`settings.telegram.tokenNote`)),1)]),V(Rz,{modelValue:c.value,"onUpdate:modelValue":t[10]||=e=>c.value=e,type:`password`,autocomplete:`off`,label:A(Y)(`settings.telegram.botToken`),placeholder:g.value,wide:``},null,8,[`modelValue`,`label`,`placeholder`]),B(`div`,$$,[V($,{variant:`primary`,disabled:f.value||c.value.trim().length===0,loading:f.value&&c.value.trim().length>0,onClick:_},{default:j(()=>[H(O(A(Y)(`settings.telegram.saveToken`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:f.value,onClick:y},{default:j(()=>[H(O(A(Y)(`settings.telegram.detectChats`)),1)]),_:1},8,[`disabled`]),V($,{variant:`secondary`,disabled:f.value,onClick:b},{default:j(()=>[H(O(A(Y)(`settings.telegram.sendTest`)),1)]),_:1},8,[`disabled`]),p.value?(L(),z(mH,{key:0,label:A(Y)(`settings.telegram.removeToken`),"confirm-label":A(Y)(`settings.telegram.removeTokenConfirm`),"confirm-variant":`danger`,title:A(Y)(`settings.telegram.removeTokenTitle`),hint:A(Y)(`settings.telegram.removeTokenHint`),disabled:f.value,onConfirm:v},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),d.value.length>0?(L(),R(`div`,e1,[B(`p`,t1,O(A(Y)(`settings.telegram.chatsSeen`)),1),B(`div`,n1,[(L(!0),R(I,null,P(d.value,e=>(L(),z($,{key:String(e.id),size:`xs`,variant:`secondary`,onClick:t=>i.value.chatId=String(e.id)},{default:j(()=>[H(O(e.title)+` (`+O(e.id)+`) `,1)]),_:2},1032,[`onClick`]))),128))])])):U(``,!0),m.value?(L(),R(`div`,r1,[B(`p`,i1,O(A(Y)(`settings.telegram.lastSend`,{result:m.value}))+O(h.value?` · ${A(NL)(h.value,A(a).now.value)}`:``),1)])):U(``,!0),u.value||l.value?(L(),R(`div`,a1,[u.value?(L(),z(_H,{key:0,tone:`danger`},{default:j(()=>[H(O(u.value),1)]),_:1})):U(``,!0),l.value?(L(),z(_H,{key:1,tone:`ok`},{default:j(()=>[H(O(l.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`]))}}),s1={class:`mt-1`},c1=N({__name:`SettingsView`,setup(e){let t=W(()=>[{id:`defaults`,title:Y(`views.settings.sectionDefaults`)},{id:`logs`,title:Y(`views.settings.sectionLogs`)},{id:`notifications`,title:Y(`views.settings.sectionNotifications`)},{id:`ddns`,title:Y(`views.settings.sectionDdns`)}]),n=XN(),r=dP(),i=vN(),a=tn(DR()),o=k(!1),s=k(null),c=k(null),l=k(null),u=k(null),d=k(null),f=W(()=>r.defaults.value),p=W(()=>r.logsConfig.value),m=W(()=>r.notifications.value?.telegram??null),h=W(()=>r.logsDir.value),g=W(()=>{let e={},t=f.value,n=p.value,r=m.value;if(t!==null){let n=zR(t,a.defaults);Object.keys(n).length>0&&(e.defaults=n)}if(n!==null){let t=BR(n,a.logs);Object.keys(t).length>0&&(e.logs=t)}if(r!==null){let t=VR(r,a.telegram);Object.keys(t).length>0&&(e.notifications=t)}return e}),_=W(()=>bR(g.value)+(l.value===null?0:bR(l.value))),v=W(()=>{let e=m.value;return{defaults:f.value??{},logs:p.value??{},notifications:e===null?{}:{telegram:MR(e)},ddns:u.value??{}}}),y=W(()=>yR({...g.value,...l.value===null?{}:{ddns:l.value}},v.value)),b=W(()=>f.value!==null&&Object.keys(zR(f.value,a.defaults)).length>0),x=W(()=>p.value!==null&&Object.keys(BR(p.value,a.logs)).length>0),S=W(()=>m.value!==null&&Object.keys(VR(m.value,a.telegram)).length>0),C={};function w(){let e=(e,t)=>{qR(C[e],KR(a,e))||(t(),C[e]=KR(a,e))},t=f.value;t!==null&&e(`defaults`,()=>{a.defaults.enabled=t.enabled,a.defaults.autostart=t.autostart,a.defaults.bind=t.bind,a.defaults.onPortConflict=t.onPortConflict,a.defaults.logBufferLines=t.logBufferLines,a.defaults.restart={...t.restart},a.defaults.health=TR(t.health),a.defaults.stop={...t.stop}});let n=p.value;n!==null&&e(`logs`,()=>Object.assign(a.logs,n));let r=m.value;r!==null&&e(`telegram`,()=>Object.assign(a.telegram,MR(r)))}function T(){for(let e of Object.keys(C))delete C[e]}M([f,p,m],()=>{w()},{immediate:!0});async function ee(){let e=g.value,t=l.value,a=Object.keys(e).length>0;if(!(!a&&t===null||o.value||r.activeId.value.length===0)){o.value=!0,s.value=null,c.value=null;try{if(a&&!await n.saveWorkspaceSettings(r.activeId.value,e)){s.value=n.lastError.value??Y(`views.settings.saveFailed`);return}t!==null&&(await XM(r.activeId.value,t),await d.value?.reload()),c.value=Y(`views.settings.saved`),i.success(Y(`views.settings.savedToast`)),T(),w()}catch(e){s.value=Lj(e)}finally{o.value=!1}}}function te(){s.value=null,c.value=null,T(),w(),d.value?.reload()}function ne(){let e=f.value;e!==null&&(a.defaults.enabled=e.enabled,a.defaults.autostart=e.autostart,a.defaults.bind=e.bind,a.defaults.onPortConflict=e.onPortConflict,a.defaults.logBufferLines=e.logBufferLines,a.defaults.restart={...e.restart},a.defaults.health=TR(e.health),a.defaults.stop={...e.stop},ae(`defaults`))}function re(){p.value!==null&&Object.assign(a.logs,p.value),ae(`logs`)}function ie(){m.value!==null&&Object.assign(a.telegram,MR(m.value)),ae(`telegram`)}function ae(e){C[e]=KR(a,e)}return M(()=>r.activeId.value,()=>{T(),w(),s.value=null,c.value=null}),(e,n)=>(L(),z(gG,{sections:t.value,"nav-label":A(Y)(`views.settings.navLabel`),"changes-description":A(Y)(`views.settings.changesDescription`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`)}),"changed-count":_.value,changes:y.value,"save-error":s.value,"save-message":c.value,saving:o.value,onSave:ee,onDiscard:te},{header:j(()=>[V(CV,{title:A(Y)(`nav.workspaceSettings`),description:A(Y)(`views.settings.description`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`)})},null,8,[`title`,`description`]),A(r).configError.value?(L(),z(_H,{key:0,tone:`danger`,title:A(Y)(`views.settings.configErrorTitle`),class:`mb-4`},{default:j(()=>[B(`p`,null,O(A(r).configError.value),1),B(`p`,s1,O(A(Y)(`views.settings.configErrorNote`)),1)]),_:1},8,[`title`])):A(r).configWarnings.value.length>0?(L(),z(_H,{key:1,tone:`warn`,title:A(Y)(`views.settings.configWarningTitle`),class:`mb-4`},{default:j(()=>[(L(!0),R(I,null,P(A(r).configWarnings.value,e=>(L(),R(`p`,{key:e,class:`font-mono`},O(e),1))),128))]),_:1},8,[`title`])):U(``,!0)]),default:j(()=>[V(qW,{id:`defaults`,title:A(Y)(`views.settings.sectionDefaults`),description:A(Y)(`views.settings.defaultsDescription`)},{default:j(()=>[V(U$,{defaults:a.defaults,"onUpdate:defaults":n[0]||=e=>a.defaults=e,dirty:b.value,onReset:ne},null,8,[`defaults`,`dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`logs`,title:A(Y)(`views.settings.sectionLogs`),description:A(Y)(`views.settings.logsDescription`)},{default:j(()=>[V(Y$,{logs:a.logs,"onUpdate:logs":n[1]||=e=>a.logs=e,"logs-dir":h.value,dirty:x.value,onReset:re},null,8,[`logs`,`logs-dir`,`dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`notifications`,title:A(Y)(`views.settings.sectionNotifications`),description:A(Y)(`views.settings.notificationsDescription`)},{default:j(()=>[V(o1,{telegram:a.telegram,"onUpdate:telegram":n[2]||=e=>a.telegram=e,status:m.value,dirty:S.value,onReset:ie},null,8,[`telegram`,`status`,`dirty`])]),_:1},8,[`title`,`description`]),V(qW,{id:`ddns`,title:A(Y)(`views.settings.sectionDdns`),description:A(Y)(`views.settings.ddnsDescription`)},{default:j(()=>[V(V$,{ref_key:`ddnsSection`,ref:d,patch:l.value,"onUpdate:patch":n[3]||=e=>l.value=e,baseline:u.value,"onUpdate:baseline":n[4]||=e=>u.value=e},null,8,[`patch`,`baseline`])]),_:1},8,[`title`,`description`])]),_:1},8,[`sections`,`nav-label`,`changes-description`,`changed-count`,`changes`,`save-error`,`save-message`,`saving`]))}}),l1=new Set([`overview`,`servers`,`server-detail`,`logs`,`settings`]),u1=Sv({history:W_(),routes:[{path:`/w/:workspaceId`,name:`overview`,component:oJ,meta:{titleKey:`nav.overview`}},{path:`/w/:workspaceId/servers`,name:`servers`,component:RQ,meta:{titleKey:`nav.servers`}},{path:`/w/:workspaceId/servers/:id`,name:`server-detail`,component:AQ,meta:{titleKey:`views.route.server`}},{path:`/w/:workspaceId/logs`,name:`logs`,component:Rq,meta:{titleKey:`nav.logs`}},{path:`/w/:workspaceId/settings`,name:`settings`,component:c1,meta:{titleKey:`nav.workspaceSettings`}},{path:`/global/overview`,name:`global-overview`,component:uH,meta:{titleKey:`nav.globalOverview`}},{path:`/global/settings`,name:`global-settings`,component:XG,meta:{titleKey:`nav.globalSettings`}},{path:`/proxy`,name:`proxy`,component:AZ,meta:{titleKey:`nav.reverseProxy`}},{path:`/login`,name:`login`,component:TK,meta:{titleKey:`login.signIn`}},{path:`/`,name:`home`,component:oJ},{path:`/:pathMatch(.*)*`,name:`not-found`,component:oJ}]});function d1(e,t=`overview`,n){let r=`/w/${encodeURIComponent(e)}`;return t===`overview`?r:t===`servers`?n===void 0?`${r}/servers`:`${r}/servers/${encodeURIComponent(n)}`:`${r}/${t}`}u1.beforeEach(async e=>{let{session:t,refresh:n}=pN();t.value===null&&await n();let r=t.value?.authRequired===!0,i=t.value?.authenticated===!0;if(r&&!i&&e.name!==`login`)return{name:`login`,query:e.fullPath===`/`?void 0:{next:e.fullPath}};if(e.name===`login`&&(!r||i))return{name:`global-overview`,replace:!0};if(e.name===`login`||e.name===`global-overview`||e.name===`global-settings`||e.name===`proxy`)return!0;if(e.name===`home`||e.name===`not-found`)return{name:`global-overview`,replace:!0};await XN().ensureState();let a=dP(),o=a.workspaces.value;if(o.length===0)return!0;let s=typeof e.params.workspaceId==`string`?e.params.workspaceId:``;if(s.length>0&&o.some(e=>e.id===s)&&(a.select(s),l1.has(String(e.name))))return!0;let c=a.activeId.value||o[0].id,l=String(e.name??``),u={...e.params,workspaceId:c};return l===`server-detail`&&u.id===void 0?{name:`servers`,params:{workspaceId:c},query:e.query,replace:!0}:{name:l,params:u,query:e.query,replace:!0}});var f1={class:`flex items-center gap-2.5 border-b border-line px-3.5`},p1=[`placeholder`],m1={key:0,class:`px-3 py-8 text-center text-xs text-muted`},h1={class:`px-2.5 pb-1 pt-2.5 text-2xs font-medium text-faint`},g1=[`data-active`,`onMousemove`,`onClick`],_1={class:`min-w-0 flex-1 truncate text-sm`},v1={key:0,class:`shrink-0 font-mono text-2xs text-faint`},y1={class:`flex items-center gap-3 border-t border-line bg-panel-2 px-3.5 py-2 text-2xs text-faint`},b1={class:`ml-auto font-mono`},x1=N({__name:`CommandPalette`,props:{open:{type:Boolean,default:!1},openModifiers:{}},emits:[`update:open`],setup(e){let t=so(e,`open`),n=Rg(),r=XN(),i=dP(),a=aP(),o=k(``),s=k(0),c=k(null),l=k(null);function u(e){n.push(e)}function d(e){i.select(e);let t=String(n.currentRoute.value.name??``);t===`overview`||t===`servers`||t===`logs`||t===`settings`?u(d1(e,t)):t===`server-detail`&&u(d1(e,`servers`))}function f(e){e(),t.value=!1}let p=[`stopped`,`crashed`,`conflict`],m=[`running`,`starting`,`backoff`],h=W(()=>{let e=[],t=r.allServers.value;function n(e,t){i.select(e),u(t)}let o=e=>d1(i.activeId.value,e);for(let{workspace:i,server:a}of t){let t=a.config.label??a.id,o=Y(qI[a.status].labelKey);e.push({id:`open:${i.id}:${a.id}`,title:Y(`palette.openServer`,{label:t}),group:Y(`palette.groupServers`),icon:Ty,detail:`${i.label} · ${a.id} · ${o}`,keywords:`server detail ${a.id} ${i.label} show`,run:()=>n(i.id,d1(i.id,`servers`,a.id))}),e.push({id:`logs:${i.id}:${a.id}`,title:Y(`palette.serverLogs`,{label:t}),group:Y(`palette.groupServers`),icon:Ny,detail:`${i.label} · ${a.id}`,keywords:`log tail output ${a.id} ${i.label}`,run:()=>n(i.id,`${d1(i.id,`logs`)}?server=${encodeURIComponent(a.id)}`)}),p.includes(a.status)&&a.config.enabled&&e.push({id:`start:${i.id}:${a.id}`,title:Y(`palette.startServer`,{label:t}),group:Y(`palette.groupActions`),icon:_y,detail:`${i.label} · ${a.id}`,keywords:`run launch ${a.id} ${i.label}`,run:()=>f(()=>void r.start(i.id,a.id))}),m.includes(a.status)&&e.push({id:`stop:${i.id}:${a.id}`,title:Y(`palette.stopServer`,{label:t}),group:Y(`palette.groupActions`),icon:jy,detail:`${i.label} · ${a.id}`,keywords:`halt kill ${a.id} ${i.label}`,run:()=>f(()=>void r.stop(i.id,a.id))}),a.config.enabled&&e.push({id:`restart:${i.id}:${a.id}`,title:Y(`palette.restartServer`,{label:t}),group:Y(`palette.groupActions`),icon:Sy,detail:`${i.label} · ${a.id}`,keywords:`bounce reload ${a.id} ${i.label}`,run:()=>f(()=>void r.restart(i.id,a.id))})}e.push({id:`nav:overview`,title:Y(`palette.goOverview`),group:Y(`palette.groupNavigate`),icon:oy,keywords:`dashboard home workspace`,run:()=>u(o(`overview`))},{id:`nav:global`,title:Y(`palette.goGlobalOverview`),group:Y(`palette.groupNavigate`),icon:ty,keywords:`dashboard home host vitals every workspace`,run:()=>u(`/global/overview`)},{id:`nav:global-settings`,title:Y(`palette.goGlobalSettings`),group:Y(`palette.groupNavigate`),icon:Ay,keywords:`panel listener auth tls backups host`,run:()=>u(`/global/settings`)},{id:`nav:proxy`,title:Y(`palette.goProxy`),group:Y(`palette.groupNavigate`),icon:Ry,keywords:`caddy domain route acme certificate https expose`,run:()=>u(`/proxy`)},{id:`nav:servers`,title:Y(`palette.goServers`),group:Y(`palette.groupNavigate`),icon:Ty,keywords:`processes list workspace`,run:()=>u(o(`servers`))},{id:`nav:logs`,title:Y(`palette.goLogs`),group:Y(`palette.groupNavigate`),icon:Cy,keywords:`output files tail workspace`,run:()=>u(o(`logs`))},{id:`nav:settings`,title:Y(`palette.goWorkspaceSettings`),group:Y(`palette.groupNavigate`),icon:Ey,keywords:`defaults notifications ddns config workspace`,run:()=>u(o(`settings`))},{id:`act:start-all`,title:Y(`palette.startAll`),group:Y(`palette.groupActions`),icon:_y,keywords:`boot all workspace`,run:()=>f(()=>void r.startAll(i.activeId.value))},{id:`act:stop-all`,title:Y(`palette.stopAll`),group:Y(`palette.groupActions`),icon:jy,keywords:`halt all workspace`,run:()=>f(()=>void r.stopAll(i.activeId.value))});for(let t of i.workspaces.value)e.push({id:`ws:${t.id}`,title:Y(`palette.switchWorkspace`,{label:t.label}),group:Y(`palette.groupWorkspaces`),icon:ay,detail:t.id,keywords:`workspace switch scope ${t.label}`,run:()=>f(()=>d(t.id))});for(let[t,n]of[[`listener`,`settings.listener.title`],[`authentication`,`settings.authentication.title`],[`host`,`settings.host.title`],[`backups`,`settings.backups.title`],[`tls`,`settings.tls.title`],[`language`,`language.label`],[`interface`,`settings.interface.title`],[`paths`,`settings.paths.title`]])e.push({id:`gset:${t}`,title:Y(`palette.globalSetting`,{label:Y(n)}),group:Y(`nav.globalSettings`),icon:ty,keywords:`configure panel ${t}`,run:()=>u(`/global/settings?section=${t}`)});for(let[t,n]of[[`defaults`,`settings.defaults.title`],[`logs`,`settings.logs.title`],[`notifications`,`settings.notifications.title`],[`ddns`,`settings.ddns.title`]])e.push({id:`wset:${t}`,title:Y(`palette.workspaceSetting`,{label:Y(n)}),group:Y(`nav.workspaceSettings`),icon:Ey,keywords:`configure workspace ${t}`,run:()=>u(`${d1(i.activeId.value,`settings`)}?section=${t}`)});let s=[[`light`,`theme.light`,My],[`dark`,`theme.dark`,py],[`system`,`theme.system`,fy]];for(let[t,n,r]of s)e.push({id:`theme:${t}`,title:Y(`palette.theme`,{theme:Y(n)}),group:Y(`palette.groupAppearance`),icon:r,keywords:`colour color dark light mode appearance`,run:()=>f(()=>a.setPreference(t))});return e}),g=W(()=>{let e=o.value.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.length===0?h.value.slice(0,40):h.value.map(t=>{let n=`${t.title} ${t.detail??``} ${t.keywords??``} ${t.group}`.toLowerCase(),r=0;for(let t of e){let e=n.indexOf(t);if(e===-1)return null;r+=e===0?0:e}return{command:t,score:r}}).filter(e=>e!==null).sort((e,t)=>e.score-t.score).slice(0,40).map(e=>e.command)}),_=W(()=>{let e=new Map;for(let t of g.value){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]}),v=W(()=>_.value.flatMap(([,e])=>e));M(g,()=>{s.value=0}),M(t,async e=>{e&&(o.value=``,s.value=0,await ir(),c.value?.focus())});function y(e){let t=v.value.length;t!==0&&(s.value=(s.value+e+t)%t,ir(()=>{l.value?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})}))}function b(e){e.key===`ArrowDown`?(e.preventDefault(),y(1)):e.key===`ArrowUp`?(e.preventDefault(),y(-1)):e.key===`Enter`&&(e.preventDefault(),v.value[s.value]?.run())}function x(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t.value=!t.value)}return na(()=>window.addEventListener(`keydown`,x)),Be(()=>window.removeEventListener(`keydown`,x)),(e,n)=>(L(),z(A(lf),{open:t.value,"onUpdate:open":n[2]||=e=>t.value=e},{default:j(()=>[V(A(Yf),null,{default:j(()=>[V(A(qf),{class:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px] data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`}),V(A(Wf),{class:`fixed left-1/2 top-[10vh] z-50 w-[min(94vw,38rem)] -translate-x-1/2 overflow-hidden rounded-panel border border-line bg-panel shadow-float data-[state=open]:animate-[hh-pop-in_150ms_var(--ease-out-quick)]`,onOpenAutoFocus:n[1]||=lu(()=>{},[`prevent`]),onKeydown:b},{default:j(()=>[V(A(Xf),{class:`sr-only`},{default:j(()=>[H(O(A(Y)(`topbar.commandPalette`)),1)]),_:1}),B(`div`,f1,[V(A(wy),{class:`size-4 shrink-0 text-faint`}),Sr(B(`input`,{ref_key:`input`,ref:c,"onUpdate:modelValue":n[0]||=e=>o.value=e,type:`text`,placeholder:A(Y)(`palette.placeholder`),class:`h-12 w-full bg-transparent text-sm text-ink outline-none placeholder:text-faint`,autocomplete:`off`,spellcheck:`false`},null,8,p1),[[Jl,o.value]]),n[3]||=B(`kbd`,{class:`shrink-0 rounded border border-line bg-page px-1.5 py-0.5 font-mono text-2xs text-faint`},`esc`,-1)]),B(`div`,{ref_key:`list`,ref:l,class:`max-h-[min(60vh,26rem)] overflow-y-auto p-1.5`},[v.value.length===0?(L(),R(`p`,m1,O(A(Y)(`palette.noMatches`,{query:o.value})),1)):U(``,!0),(L(!0),R(I,null,P(_.value,([e,t])=>(L(),R(I,{key:e},[B(`p`,h1,O(e),1),(L(!0),R(I,null,P(t,e=>(L(),R(`button`,{key:e.id,type:`button`,"data-active":v.value[s.value]?.id===e.id,class:D(A(Q)(`flex w-full items-center gap-2.5 rounded-control px-2.5 py-2 text-left transition-colors duration-100`,v.value[s.value]?.id===e.id?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`)),onMousemove:t=>s.value=v.value.findIndex(t=>t.id===e.id),onClick:t=>e.run()},[(L(),z(ha(e.icon),{class:D([`size-4 shrink-0`,v.value[s.value]?.id===e.id?`text-accent`:`text-faint`])},null,8,[`class`])),B(`span`,_1,O(e.title),1),e.detail?(L(),R(`span`,v1,O(e.detail),1)):U(``,!0),V(A(Rv),{class:D([`size-3.5 shrink-0 text-faint opacity-0 transition-opacity duration-100`,{"opacity-100":v.value[s.value]?.id===e.id}])},null,8,[`class`])],42,g1))),128))],64))),128))],512),B(`div`,y1,[B(`span`,null,[n[4]||=B(`kbd`,{class:`font-mono`},`↑↓`,-1),H(` `+O(A(Y)(`palette.navigate`)),1)]),B(`span`,null,[n[5]||=B(`kbd`,{class:`font-mono`},`↵`,-1),H(` `+O(A(Y)(`palette.run`)),1)]),B(`span`,b1,O(A(_F)(`palette.results`,v.value.length)),1)])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),S1={class:`rounded-panel border border-line bg-panel-2/70 p-3`},C1={class:`mb-2 flex items-center justify-between`},w1={class:`text-2xs font-medium text-faint`},T1={key:0,class:`text-2xs text-faint`},E1={key:0,class:`grid grid-cols-2 gap-x-1 gap-y-2`},D1={key:1,class:`py-3 text-center text-2xs text-faint`},O1={key:2,class:`mt-2 flex items-start gap-1.5 rounded-control bg-danger-soft px-2 py-1.5`},k1={class:`text-2xs leading-4 text-danger`},A1=2,j1=85,M1=N({__name:`InstrumentCluster`,props:{host:{}},setup(e){let t=e,n=W(()=>{let e=t.host;return e?(e.loadAvg[0]??0)/Math.max(1,e.cpus):null}),r=W(()=>n.value===null?null:n.value/A1*100),i=W(()=>n.value===null?`—`:n.value.toFixed(2)),a=W(()=>{let e=t.host?.disks??[];return e.length===0?null:Math.max(...e.map(e=>e.usedPercent))}),o=W(()=>{let e=t.host?.tempCelsius??null;return e===null?null:e/j1*100}),s=W(()=>{let e=t.host?.tempCelsius??null;return e===null?`n/a`:`${Math.round(e)}°`});return(e,n)=>(L(),R(`div`,S1,[B(`div`,C1,[B(`span`,w1,O(A(Y)(`nav.hostVitals`)),1),t.host?.enabled===!1?(L(),R(`span`,T1,`off`)):U(``,!0)]),t.host?.enabled?(L(),R(`div`,E1,[V(lL,{value:r.value,label:A(Y)(`host.loadPerCpu`),display:i.value,size:58,"warn-at":70,"danger-at":100},null,8,[`value`,`label`,`display`]),V(lL,{value:t.host?.memoryUsedPercent??null,label:A(Y)(`common.memory`),size:58},null,8,[`value`,`label`]),V(lL,{value:a.value,label:A(Y)(`common.disk`),size:58},null,8,[`value`,`label`]),V(lL,{value:o.value,label:A(Y)(`host.cpuTemp`),display:s.value,size:58},null,8,[`value`,`label`,`display`])])):(L(),R(`p`,D1,` Sampling is disabled in Settings. `)),t.host&&t.host.alerts.length>0?(L(),R(`div`,O1,[n[0]||=B(`span`,{class:`mt-1 size-1.5 shrink-0 rounded-full bg-danger`},null,-1),B(`span`,k1,O(t.host.alerts.join(` · `)),1)])):U(``,!0)]))}}),N1={class:`flex h-full min-h-0 flex-col gap-3 overflow-y-auto p-3`},P1={class:`flex items-center gap-2 px-1 pt-1`},F1={class:`min-w-0`},I1={class:`truncate text-sm font-semibold tracking-tight text-ink`},L1=[`title`],R1=[`aria-label`],z1=[`aria-label`],B1={class:`flex items-center gap-1 truncate px-2.5 pb-1 text-2xs font-medium text-faint`},V1={key:1,class:`text-muted`},H1={class:`mt-auto flex flex-col gap-3`},U1={class:`flex items-center gap-2 rounded-control border border-line bg-panel-2/70 px-2.5 py-2`},W1={class:`relative flex size-2 shrink-0`},G1={class:`text-2xs text-muted`},K1=[`title`],q1=N({__name:`SideNav`,props:{host:{},connection:{},panelLabel:{},panelVersion:{},planLabel:{},workspaceId:{},workspaceLabel:{},running:{},total:{}},emits:[`navigate`,`close`],setup(e,{emit:t}){let n=e,r=t,i=zg(),a=W(()=>[{to:d1(n.workspaceId,`overview`),labelKey:`nav.overview`,icon:oy,exact:!0,servers:!1},{to:d1(n.workspaceId,`servers`),labelKey:`nav.servers`,icon:Ty,exact:!1,servers:!0},{to:d1(n.workspaceId,`logs`),labelKey:`nav.logs`,icon:Cy,exact:!1,servers:!1},{to:d1(n.workspaceId,`settings`),labelKey:`nav.workspaceSettings`,icon:Ey,exact:!1,servers:!1}]),o=[{to:`/global/overview`,labelKey:`nav.globalOverview`,icon:ty,exact:!0,servers:!1},{to:`/global/settings`,labelKey:`nav.globalSettings`,icon:Ay,exact:!1,servers:!1}],s=[{to:`/proxy`,labelKey:`nav.reverseProxy`,icon:Ry,exact:!1,servers:!1}],c=W(()=>[{titleKey:`nav.global`,label:``,icon:ty,items:o},{titleKey:`nav.workspace`,label:n.workspaceLabel,icon:void 0,items:a.value},{titleKey:`nav.others`,label:``,icon:Pv,items:s}]);function l(e){return e.exact?i.path===e.to:i.path===e.to||i.path.startsWith(`${e.to}/`)}let u=W(()=>n.panelVersion===null?n.panelLabel:`${n.panelLabel} · v${n.panelVersion}`),d=W(()=>({open:{labelKey:`connection.live`,dot:`bg-ok`},connecting:{labelKey:`connection.connecting`,dot:`bg-warn`},closed:{labelKey:`connection.reconnecting`,dot:`bg-danger`}})[n.connection]);return(e,t)=>{let i=pa(`RouterLink`);return L(),R(`div`,N1,[B(`div`,P1,[t[2]||=Os(`<span class="grid size-8 shrink-0 place-items-center rounded-[9px] border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-4.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),B(`div`,F1,[B(`p`,I1,O(A(Y)(`app.name`)),1),B(`p`,{class:`truncate text-2xs text-faint`,title:u.value},O(u.value),9,L1)]),B(`button`,{type:`button`,class:`ml-auto grid size-7 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":A(Y)(`nav.closeNavigation`),onClick:t[0]||=e=>r(`close`)},[V(A(zy),{class:`size-4`})],8,R1)]),B(`nav`,{class:`flex flex-col gap-3`,"aria-label":A(Y)(`nav.navigation`)},[(L(!0),R(I,null,P(c.value,e=>(L(),R(`div`,{key:e.titleKey,class:`flex min-h-0 flex-col gap-0.5`},[B(`p`,B1,[e.icon?(L(),z(ha(e.icon),{key:0,class:`size-3 shrink-0`})):U(``,!0),H(` `+O(e.label?`${A(Y)(e.titleKey)} · `:A(Y)(e.titleKey)),1),e.label?(L(),R(`span`,V1,O(e.label),1)):U(``,!0)]),(L(!0),R(I,null,P(e.items,e=>(L(),z(i,{key:e.to,to:e.to,class:D(A(Q)(`group flex items-center gap-2.5 rounded-control px-2.5 py-1.5 text-sm transition-colors duration-150`,l(e)?`bg-accent-soft font-medium text-accent`:`text-muted hover:bg-hover hover:text-ink`)),onClick:t[1]||=e=>r(`navigate`)},{default:j(()=>[(L(),z(ha(e.icon),{class:`size-4 shrink-0`,"stroke-width":l(e)?2.1:1.8},null,8,[`stroke-width`])),H(` `+O(A(Y)(e.labelKey))+` `,1),e.servers?(L(),R(`span`,{key:0,class:D([`ml-auto font-mono text-2xs tabular-nums`,l(e)?`text-accent`:`text-faint`])},O(n.running)+`/`+O(n.total),3)):U(``,!0)]),_:2},1032,[`to`,`class`]))),128))]))),128))],8,z1),B(`div`,H1,[V(M1,{host:n.host},null,8,[`host`]),B(`div`,U1,[B(`span`,W1,[B(`span`,{class:D(A(Q)(`absolute inset-0 rounded-full`,d.value.dot,n.connection!==`open`&&`animate-ping opacity-60`))},null,2),B(`span`,{class:D(A(Q)(`relative size-2 rounded-full`,d.value.dot))},null,2)]),B(`span`,G1,O(A(Y)(d.value.labelKey)),1),B(`span`,{class:`ml-auto truncate font-mono text-2xs text-faint`,title:n.planLabel},O(n.planLabel),9,K1)])])])}}}),J1={key:0,class:`flex flex-col gap-px border-b border-line bg-panel/60`},Y1={class:`text-2xs leading-4`},X1={class:`font-medium`},Z1={key:0,class:`opacity-80`},Q1=N({__name:`SystemNotices`,props:{control:{},configError:{},configPath:{}},setup(e){let t=e,n=W(()=>{let e=[],n=t.control?.auth;return t.configError&&e.push({id:`config`,tone:`danger`,text:Y(`notice.configError`,{error:t.configError}),hint:Y(`notice.configErrorHint`,{path:t.configPath??`servers.config.json`})}),n&&(n.blockedReason&&e.push({id:`blocked`,tone:`danger`,text:n.blockedReason}),n.usingDefaultPassword?e.push({id:`default-password`,tone:`warn`,text:Y(`notice.defaultPassword`),hint:Y(`notice.defaultPasswordHint`)}):n.enabled&&!n.passwordSet&&e.push({id:`no-password`,tone:`warn`,text:Y(`notice.noPassword`),hint:Y(`notice.noPasswordHint`)}),n.exposed&&e.push({id:`exposed`,tone:`warn`,text:Y(`notice.exposed`),hint:Y(`notice.exposedHint`)}),!n.enabled&&!n.exposed&&e.push({id:`auth-off`,tone:`info`,text:Y(`notice.authOff`)})),e}),r={warn:{wrap:`border-warn/25 bg-warn-soft text-warn`,icon:Ly},danger:{wrap:`border-danger/25 bg-danger-soft text-danger`,icon:Vv},info:{wrap:`border-line bg-panel-2 text-muted`,icon:Vv}};return(e,t)=>n.value.length>0?(L(),R(`div`,J1,[(L(!0),R(I,null,P(n.value,e=>(L(),R(`div`,{key:e.id,class:D([`flex items-start gap-2 px-3 py-1.5 sm:px-4`,r[e.tone].wrap])},[(L(),z(ha(r[e.tone].icon),{class:`mt-0.5 size-3.5 shrink-0`})),B(`p`,Y1,[B(`span`,X1,O(e.text),1),e.hint?(L(),R(`span`,Z1,O(e.hint),1)):U(``,!0)])],2))),128))])):U(``,!0)}}),$1={class:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-[min(92vw,22rem)] flex-col gap-2`,role:`status`,"aria-live":`polite`},e0={class:`min-w-0 flex-1`},t0={class:`text-xs font-medium text-ink`},n0={key:0,class:`mt-0.5 break-words text-2xs leading-4 text-muted`},r0=[`aria-label`,`onClick`],i0=N({__name:`ToastStack`,setup(e){let{toasts:t,dismiss:n}=vN(),r={ok:Hv,danger:Uv,warn:Ly,info:ry,accent:ry,neutral:ry},i={ok:`text-ok`,danger:`text-danger`,warn:`text-warn`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},a=W(()=>t.value);return(e,t)=>(L(),R(`div`,$1,[V(Il,{"enter-active-class":`transition duration-150 ease-out`,"enter-from-class":`translate-x-2 opacity-0`,"leave-active-class":`transition duration-100 ease-in`,"leave-to-class":`translate-x-2 opacity-0`},{default:j(()=>[(L(!0),R(I,null,P(a.value,e=>(L(),R(`div`,{key:e.id,class:`pointer-events-auto flex items-start gap-2.5 rounded-panel border border-line bg-raise p-3 shadow-float`},[(L(),z(ha(r[e.tone]),{class:D(A(Q)(`mt-0.5 size-4 shrink-0`,i[e.tone]))},null,8,[`class`])),B(`div`,e0,[B(`p`,t0,O(e.title),1),e.description?(L(),R(`p`,n0,O(e.description),1)):U(``,!0)]),B(`button`,{type:`button`,class:`-mr-1 -mt-0.5 grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,"aria-label":A(Y)(`common.dismiss`),onClick:t=>A(n)(e.id)},[V(A(zy),{class:`size-3.5`})],8,r0)]))),128))]),_:1})]))}}),a0={class:`space-y-3`},o0={key:0,class:`rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 text-2xs leading-4 text-danger`},s0=N({__name:`WorkspaceDialog`,props:za({mode:{},initial:{default:``},submit:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=so(e,`open`),r=k(t.initial),i=k(!1),a=k(null),o=W(()=>t.mode===`create`?Y(`workspace.new`):Y(`workspace.rename`)),s=W(()=>t.mode===`create`?Y(`workspace.create`):Y(`workspace.renameAction`)),c=W(()=>r.value.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40));M(n,e=>{e&&(r.value=t.initial,a.value=null)});async function l(){let e=r.value.trim();if(e.length===0){a.value=`A workspace needs a name.`;return}i.value=!0,a.value=null;try{await t.submit(e)&&(n.value=!1)}finally{i.value=!1}}return(t,u)=>(L(),z($z,{open:n.value,"onUpdate:open":u[2]||=e=>n.value=e,title:o.value,description:e.mode===`create`?A(Y)(`workspace.createHint`):A(Y)(`workspace.renameHint`),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,disabled:i.value,onClick:u[1]||=e=>n.value=!1},{default:j(()=>[...u[3]||=[H(` Cancel `,-1)]]),_:1},8,[`disabled`]),V($,{variant:`primary`,loading:i.value,onClick:l},{default:j(()=>[H(O(s.value),1)]),_:1},8,[`loading`])]),default:j(()=>[B(`div`,a0,[V(Rz,{modelValue:r.value,"onUpdate:modelValue":u[0]||=e=>r.value=e,label:A(Y)(`common.name`),placeholder:`Home lab`,hint:e.mode===`create`&&c.value.length>0?A(Y)(`workspace.nameHintId`,{id:c.value}):A(Y)(`workspace.nameHint`),wide:``,onKeydown:du(lu(l,[`prevent`]),[`enter`])},null,8,[`modelValue`,`label`,`hint`,`onKeydown`]),a.value?(L(),R(`p`,o0,O(a.value),1)):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),c0=[`aria-label`],l0={class:`min-w-0 truncate font-medium text-ink`},u0={class:`hidden shrink-0 font-mono text-2xs text-faint sm:inline`},d0={key:0,class:`max-h-64 overflow-y-auto`},f0=[`onClick`],p0={class:`min-w-0 flex-1`},m0={class:`block truncate text-xs`},h0={class:`block truncate font-mono text-2xs text-faint`},g0={class:`shrink-0 font-mono text-2xs text-faint`},_0={key:1,class:`px-2 py-2 text-xs text-muted`},v0={class:`px-2 pt-1.5 text-xs font-semibold text-ink`},y0={class:`mt-2 flex justify-end gap-1.5 px-1 pb-1`},b0=N({__name:`WorkspacePicker`,props:{workspaces:{},selectedId:{}},emits:[`select`,`create`,`rename`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=k(!1),o=W(()=>n.workspaces.find(e=>e.id===n.selectedId)??null);function s(e){r(`select`,e),i.value=!1}function c(){a.value=!0}function l(){a.value=!1}function u(){let e=o.value;a.value=!1,i.value=!1,e!==null&&r(`remove`,e)}function d(){i.value=!1,r(`create`)}function f(){i.value=!1,o.value!==null&&r(`rename`,o.value)}async function p(e){i.value=e,e&&(a.value=!1,await ir())}return(t,n)=>(L(),z(A(Wh),{open:i.value,"onUpdate:open":p},{default:j(()=>[V(A(Zh),{"as-child":``},{default:j(()=>[B(`button`,{type:`button`,class:D(A(Q)(`flex h-8 max-w-36 items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 text-xs transition-colors duration-150 hover:border-line hover:text-ink sm:max-w-52`,A(yz))),"aria-label":A(Y)(`topbar.workspaceLabel`,{name:o.value?.label??A(Y)(`common.none`)})},[V(A(ay),{class:`size-3.5 shrink-0 text-faint`}),B(`span`,l0,O(o.value?.label??A(Y)(`workspace.none`)),1),B(`span`,u0,O(o.value?.runningCount??0)+`/`+O(o.value?.serverCount??0),1),V(A(Bv),{class:`size-3 shrink-0 text-faint`})],10,c0)]),_:1}),V(A(Xh),null,{default:j(()=>[V(A(Yh),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-1 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[a.value?(L(),R(I,{key:1},[B(`p`,v0,` Delete “`+O(o.value?.label)+`”? `,1),n[4]||=B(`p`,{class:`mt-1 px-2 text-2xs leading-4 text-muted`},` Its servers are stopped, and its config, settings, logs, secrets and nanny state are removed from disk. A backup taken first is the only way back. `,-1),B(`div`,y0,[V($,{size:`xs`,variant:`ghost`,onClick:l},{default:j(()=>[...n[3]||=[H(` Keep it `,-1)]]),_:1}),V($,{size:`xs`,variant:`danger`,onClick:u},{default:j(()=>[V(A(Iy),{class:`size-3`}),H(O(A(Y)(`workspace.delete`)),1)]),_:1})])],64)):(L(),R(I,{key:0},[n[1]||=B(`p`,{class:`px-2 pb-1 pt-1.5 text-2xs font-medium text-faint`},` Workspaces `,-1),e.workspaces.length>0?(L(),R(`ul`,d0,[(L(!0),R(I,null,P(e.workspaces,t=>(L(),R(`li`,{key:t.id},[B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left transition-colors duration-100`,t.id===e.selectedId?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`)),onClick:e=>s(t.id)},[V(A(Fv),{class:D([`size-3.5 shrink-0`,t.id===e.selectedId?`text-accent`:`opacity-0`])},null,8,[`class`]),B(`span`,p0,[B(`span`,m0,O(t.label),1),B(`span`,h0,O(t.id),1)]),B(`span`,g0,O(t.runningCount)+`/`+O(t.serverCount),1)],10,f0)]))),128))])):(L(),R(`p`,_0,` The panel serves no workspace yet. `)),n[2]||=B(`div`,{class:`my-1 h-px bg-line`},null,-1),B(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted outline-none transition-colors duration-100 hover:bg-hover hover:text-ink`,onClick:d},[V(A(vy),{class:`size-3.5`}),n[0]||=H(` New workspace… `,-1)]),o.value?(L(),R(I,{key:2},[B(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted outline-none transition-colors duration-100 hover:bg-hover hover:text-ink`,onClick:f},[V(A(gy),{class:`size-3.5`}),H(` Rename “`+O(o.value.label)+`”… `,1)]),B(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-danger outline-none transition-colors duration-100 hover:bg-danger-soft`,onClick:c},[V(A(Iy),{class:`size-3.5`}),H(` Delete “`+O(o.value.label)+`”… `,1)])],64)):U(``,!0)],64))]),_:1})]),_:1})]),_:1},8,[`open`]))}}),x0=N({__name:`WorkspaceSwitcher`,setup(e){let{workspaces:t,activeId:n,select:r,create:i,rename:a,remove:o}=dP(),s=zg(),c=Rg(),l=k(!1),u=k(`create`),d=k(null);function f(e){r(e);let t=String(s.name??``);if(t===`overview`||t===`servers`||t===`logs`||t===`settings`){c.push(d1(e,t));return}t===`server-detail`&&c.push(d1(e,`servers`))}function p(){u.value=`create`,d.value=null,l.value=!0}function m(e){u.value=`rename`,d.value=e,l.value=!0}async function h(e){if(u.value===`create`)return await i(e)!==void 0;let t=d.value;return t!==null&&a(t.id,e)}async function g(e){let t=String(s.params.workspaceId??``)||n.value;if(!await o(e.id)||t!==e.id)return;let r=String(s.name??``);(r===`overview`||r===`servers`||r===`logs`||r===`settings`)&&c.push(d1(n.value,r))}return(e,r)=>(L(),R(I,null,[V(b0,{workspaces:A(t),"selected-id":A(n),onSelect:f,onCreate:p,onRename:m,onRemove:g},null,8,[`workspaces`,`selected-id`]),V(s0,{open:l.value,"onUpdate:open":r[0]||=e=>l.value=e,mode:u.value,initial:d.value?.label??``,submit:h},null,8,[`open`,`mode`,`initial`])],64))}}),S0={class:`flex h-13 shrink-0 items-center gap-3 border-b border-line bg-panel/80 px-3 backdrop-blur-sm sm:px-4`},C0=[`aria-label`],w0={class:`min-w-0 flex-1 truncate text-sm font-semibold tracking-tight text-ink`},T0={class:`flex shrink-0 items-center gap-1.5`},E0={class:`pr-6`},D0={class:`hidden items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 py-1.5 md:flex`},O0={class:`font-mono text-2xs text-muted`},k0={class:`px-2 py-1.5`},A0={class:`text-2xs text-faint`},j0={class:`truncate font-mono text-2xs text-muted`},M0=N({__name:`TopBar`,props:{panelUrl:{},connection:{},authenticated:{type:Boolean}},emits:[`menu`,`palette`,`signOut`],setup(e,{emit:t}){let n=e,r=t,i=zg(),a=aP(),o=W(()=>{if(i.name===`server-detail`)return`${Y(`nav.servers`)} / ${String(i.params.id??``)}`;let e=i.meta.titleKey;return typeof e==`string`?Y(e):String(i.meta.title??Y(`app.name`))}),s=W(()=>a.preference.value===`dark`?py:a.preference.value===`light`?My:fy),c=W(()=>Y(`theme.label`,{theme:Y(`theme.${a.preference.value}`)})),l=W(()=>({open:`bg-ok`,connecting:`bg-warn`,closed:`bg-danger`})[n.connection]),u=W(()=>({open:`connection.liveUpdates`,connecting:`connection.connecting`,closed:`connection.reconnecting`})[n.connection]);return(t,i)=>(L(),R(`header`,S0,[B(`button`,{type:`button`,class:`grid size-8 shrink-0 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":A(Y)(`topbar.openNavigation`),onClick:i[0]||=e=>r(`menu`)},[V(A(uy),{class:`size-4`})],8,C0),B(`h1`,w0,O(o.value),1),B(`div`,T0,[B(`button`,{type:`button`,class:D(A(Q)(`hidden h-8 items-center gap-2 rounded-control border border-line bg-panel-2 px-2.5 text-xs text-faint transition-colors duration-150 hover:border-line hover:text-muted sm:flex`,A(yz))),onClick:i[1]||=e=>r(`palette`)},[V(A(wy),{class:`size-3.5`}),B(`span`,E0,O(A(Y)(`topbar.search`)),1),i[5]||=B(`kbd`,{class:`rounded border border-line bg-page px-1 py-0.5 font-mono text-2xs text-faint`},`⌘K`,-1)],2),V(BB,{label:A(Y)(u.value)},{default:j(()=>[B(`span`,D0,[B(`span`,{class:D(A(Q)(`size-1.5 rounded-full`,l.value))},null,2),B(`span`,O0,O(e.panelUrl),1)])]),_:1},8,[`label`]),V(BB,{label:c.value},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":c.value,onClick:i[2]||=e=>A(a).cycle()},{default:j(()=>[(L(),z(ha(s.value),{class:`size-4`}))]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),n.authenticated?(L(),z(A(eg),{key:0},{default:j(()=>[V(A(ag),{"as-child":``},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":A(Y)(`topbar.account`)},{default:j(()=>[...i[6]||=[B(`span`,{class:`grid size-5 place-items-center rounded-full bg-accent-soft font-mono text-2xs font-semibold text-accent`},`hh`,-1)]]),_:1},8,[`aria-label`])]),_:1}),V(A(rg),null,{default:j(()=>[V(A(tg),{"side-offset":6,align:`end`,class:`z-50 min-w-44 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`div`,k0,[B(`p`,A0,O(A(Y)(`topbar.signedIn`)),1),B(`p`,j0,O(n.panelUrl),1)]),V(A(ig),{class:`my-1 h-px bg-line`}),V(A(ng),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:i[3]||=e=>r(`signOut`)},{default:j(()=>[V(A(ly),{class:`size-3.5`}),H(` `+O(A(Y)(`topbar.signOut`)),1)]),_:1})]),_:1})]),_:1})]),_:1})):U(``,!0),V(BB,{label:A(Y)(`topbar.commandPalette`)},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,class:`sm:hidden`,"aria-label":A(Y)(`topbar.commandPalette`),onClick:i[4]||=e=>r(`palette`)},{default:j(()=>[V(A(Kv),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),V(x0)])]))}}),N0={key:1,class:`flex h-dvh overflow-hidden bg-page`},P0={class:`hidden w-60 shrink-0 border-r border-line bg-panel/50 lg:block`},F0={key:0,class:`fixed inset-y-0 left-0 z-40 w-64 border-r border-line bg-panel lg:hidden`},I0={class:`flex min-w-0 flex-1 flex-col`},L0=N({__name:`App`,setup(e){let t=zg(),n=Rg(),r=XN(),i=dP(),{session:a,logout:o}=pN(),s=k(!1),c=k(!1),l=W(()=>a.value?.authenticated===!0),u=W(()=>a.value?.authRequired===!0),d=W(()=>t.name===`login`),f=W(()=>t.name===`logs`),p=W(()=>i.runningCount.value),m=W(()=>i.serverCount.value),h=W(()=>r.control.value?.url??`—`),g=W(()=>r.host.value),_=W(()=>r.control.value?.label??`home-hosted`),v=W(()=>r.version.value),y=W(()=>i.selected.value?.label??`none`),b=W(()=>i.activeId.value);return M(W(()=>fN(a.value)),e=>{if(e!==`wait`){if(e===`login`){JN(),n.push({name:`login`});return}qN()}},{immediate:!0}),M(()=>t.fullPath,()=>{c.value=!1}),na(async()=>{(!u.value||l.value)&&await r.refresh()}),Be(()=>JN()),(e,t)=>{let n=pa(`RouterView`);return L(),z(A(fg),{"delay-duration":300},{default:j(()=>[d.value?(L(),z(n,{key:0})):(L(),R(`div`,N0,[B(`aside`,P0,[V(q1,{host:g.value,connection:A(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])]),V(Dc,{"enter-active-class":`transition-opacity duration-150`,"leave-active-class":`transition-opacity duration-100`,"enter-from-class":`opacity-0`,"leave-to-class":`opacity-0`},{default:j(()=>[c.value?(L(),R(`div`,{key:0,class:`fixed inset-0 z-40 bg-black/45 lg:hidden`,onClick:t[0]||=e=>c.value=!1})):U(``,!0)]),_:1}),V(Dc,{"enter-active-class":`transition-transform duration-150 ease-out`,"leave-active-class":`transition-transform duration-100 ease-in`,"enter-from-class":`-translate-x-full`,"leave-to-class":`-translate-x-full`},{default:j(()=>[c.value?(L(),R(`aside`,F0,[V(q1,{host:g.value,connection:A(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value,onNavigate:t[1]||=e=>c.value=!1,onClose:t[2]||=e=>c.value=!1},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])])):U(``,!0)]),_:1}),B(`div`,I0,[V(M0,{"panel-url":h.value,connection:A(r).connection.value,authenticated:l.value,onMenu:t[3]||=e=>c.value=!0,onPalette:t[4]||=e=>s.value=!0,onSignOut:t[5]||=e=>A(o)()},null,8,[`panel-url`,`connection`,`authenticated`]),d.value?U(``,!0):(L(),z(Q1,{key:0,control:A(r).control.value,"config-error":A(i).configError.value,"config-path":A(i).selected.value?.configPath},null,8,[`control`,`config-error`,`config-path`])),B(`main`,{class:D(A(Q)(`relative min-h-0 flex-1`,f.value?`overflow-hidden`:`overflow-y-auto`))},[V(n)],2)])])),V(x1,{open:s.value,"onUpdate:open":t[6]||=e=>s.value=e},null,8,[`open`]),V(i0)]),_:1})}}});gF().catch(()=>{}).finally(()=>{yu(L0).use(u1).mount(`#app`)});