import"./DsnmJJEf.js";import{p as K,d,g as s,s as o,r as m,t as b,a as N,b as Q,k as F,c as C,h as y,m as X,x as Y,j as u}from"./qex-fw8l.js";import{d as Z,s as x,a as B}from"./vzbhwc8t.js";import{i as D}from"./BnUrxEZg.js";import{s as O,t as z}from"./HL7kq492.js";import{i as E}from"./dc0o8kHW.js";import{s as $,h as S}from"./CxxCFhYQ.js";import{B as ee}from"./B_GGJ0US.js";import{F as te}from"./CMWooxU3.js";import{U as V}from"./tKQLeGMs.js";import{E as M}from"./uQHiYYot.js";import{G as ae}from"./B69KjhhV.js";import{b as re}from"./DhUXsTAu.js";import{B as ne}from"./CSb8bsFS.js";import{a as W}from"./fHQf17EE.js";var T=C('<a target="_blank" rel="noopener" class="inline-flex items-center gap-1 hover:text-foreground"><!> <!></a>'),oe=C('<span class="inline-flex items-center gap-1"><!> </span>'),se=C('<div class="mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground"><!> <!> <button type="button" class="inline-flex items-center gap-1 hover:text-foreground"><!> </button> <button type="button" class="inline-flex items-center gap-1 hover:text-foreground"><!> </button> <!> <!></div>');function pe(l,a){K(a,!0);const n=F(()=>a.extension.author?.url??null),f=F(()=>a.extension.author?.name??null),R=F(()=>!!a.extension.homepage&&!$(a.extension.homepage,s(n)));var h=se(),p=d(h);{var A=t=>{var r=T(),i=d(r);V(i,{size:10});var c=o(i),_=o(c);M(_,{size:10}),m(r),b(g=>{O(r,"href",s(n)),x(c,` ${g??""} `)},[()=>s(f)||S(s(n))]),N(t,r)},e=t=>{var r=oe(),i=d(r);V(i,{size:10});var c=o(i);m(r),b(()=>x(c,` ${s(f)??""}`)),N(t,r)};D(p,t=>{s(n)?t(A):s(f)&&t(e,1)})}var v=o(p,2);{var L=t=>{var r=T(),i=d(r);ae(i,{size:10});var c=o(i),_=o(c);M(_,{size:10}),m(r),b(g=>{O(r,"href",a.extension.homepage),x(c,` ${g??""} `)},[()=>S(a.extension.homepage)]),N(t,r)};D(v,t=>{s(R)&&a.extension.homepage&&t(L)})}var I=o(v,2),w=d(I);ee(w,{size:10});var j=o(w);m(I);var k=o(I,2),G=d(k);te(G,{size:10});var H=o(G);m(k);var U=o(k,2);{var P=t=>{var r=T(),i=d(r);re(i,{size:10});var c=o(i),_=o(c);M(_,{size:10}),m(r),b(g=>{O(r,"href",a.extension.docs),x(c,` ${g??""} `)},[()=>E.t("ADMIN_NEXT.DOCUMENTATION")]),N(t,r)};D(U,t=>{a.extension.docs&&t(P)})}var q=o(U,2);{var J=t=>{var r=T(),i=d(r);ne(i,{size:10});var c=o(i),_=o(c);M(_,{size:10}),m(r),b(g=>{O(r,"href",a.extension.bugs),x(c,` ${g??""} `)},[()=>E.t("ADMIN_NEXT.REPORT_ISSUE")]),N(t,r)};D(q,t=>{a.extension.bugs&&t(J)})}m(h),b(t=>{x(j,` ${t??""}`),x(H,` ${a.changelogLabel??""}`)},[()=>E.t("ADMIN_NEXT.README")]),B("click",I,function(...t){a.onReadme?.apply(this,t)}),B("click",k,function(...t){a.onChangelog?.apply(this,t)}),N(l,h),Q()}Z(["click"]);function ie(l,a){let n=l;for(const f of a.split(".")){if(n==null||typeof n!="object")return;n=n[f]}return n}function Ie(l){let a=y(X([])),n=y(X({})),f=y(!1),R=y(!1);function h(e){const v=e&&typeof e=="object"&&"status"in e?e.status:0;z.error(v===409?E.t("ADMIN_NEXT.CONFIG.CONFIGURATION_WAS_MODIFIED_ELSEWHERE"):E.t("ADMIN_NEXT.CONFIG.OVERRIDE.REVERT_FAILED"))}async function p(e){if(!(!l.canWrite()||s(f))){u(f,!0);try{const v=await W(l.scope(),{keys:[e]},l.etag());l.applyFieldRevert(e,ie(v.data,e),v.etag),u(a,v.overrides,!0),u(n,v.fallback,!0),z.success(E.t("ADMIN_NEXT.CONFIG.OVERRIDE.REVERTED"))}catch(v){h(v)}finally{u(f,!1)}}}async function A(){if(u(R,!1),!(!l.canWrite()||s(f))){u(f,!0);try{const e=await W(l.scope(),{reset:!0},l.etag());l.applyReset(e.data,e.etag),u(a,e.overrides,!0),u(n,e.fallback,!0),z.success(E.t("ADMIN_NEXT.CONFIG.OVERRIDE.RESET_DONE"))}catch(e){h(e)}finally{u(f,!1)}}}return Y("configOverrides",{isOverridden:e=>s(a).includes(e),getFallback:e=>s(n)[e],revert:e=>p(e),get canRevert(){return l.canWrite()}}),{get overrides(){return s(a)},get fallback(){return s(n)},get reverting(){return s(f)},get showResetModal(){return s(R)},set showResetModal(e){u(R,e,!0)},ingest(e){u(a,e.overrides,!0),u(n,e.fallback,!0)},reset:A}}export{pe as E,Ie as p};
