Files
intotheeast-com-content/plugins/admin2/app/_app/immutable/chunks/BlCK739y.js
T

2 lines
2.9 KiB
JavaScript

import"./DsnmJJEf.js";import{p as M,e as F,f as T,a as _,b as C,o as A,d as f,r as l,s as R,g as i,t as j,c as G,h as V,i as u,m as k,v as W,j as n}from"./krC2xWPP.js";import{d as X,e as S,s as z,a as w}from"./CddAxf8c.js";import{i as L}from"./DjsWWzyL.js";import{h as B}from"./DSIsCMt7.js";import{g as H,i as v}from"./Cu5ilWky.js";import{X as K}from"./CiIMiELt.js";import{b as I}from"./CMqN2HxG.js";import{t as y}from"./Lvd_r9sp.js";var P=G('<div class="fixed inset-0 z-50 flex items-center justify-center bg-neutral-900/75 p-4 backdrop-blur-sm sm:p-8"><div class="flex max-h-[90vh] w-full max-w-3xl flex-col rounded-xl border border-border bg-card shadow-2xl"><div class="flex shrink-0 items-center justify-between border-b border-border px-6 py-4"><h2 class="text-lg font-semibold text-foreground"> </h2> <button type="button" class="inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"><!></button></div> <div class="prose prose-sm dark:prose-invert max-w-none overflow-y-auto px-6 py-5"></div></div></div>');function ae(a,t){M(t,!0);const r=V(()=>t.content?H.parse(t.content,{async:!1}):"");function o(e){e.target===e.currentTarget&&t.onclose()}function c(e){e.key==="Escape"&&t.onclose()}var d=F();S("keydown",A,function(...e){(t.open?c:void 0)?.apply(this,e)});var m=T(d);{var g=e=>{var s=P(),p=f(s),b=f(p),h=f(b),N=f(h,!0);l(h);var E=R(h,2),O=f(E);K(O,{size:16}),l(E),l(b);var x=R(b,2);B(x,()=>i(r),!0),l(x),l(p),l(s),j(()=>z(N,t.title)),w("click",s,o),w("click",E,function(...D){t.onclose?.apply(this,D)}),_(e,s)};L(m,e=>{t.open&&e(g)})}_(a,d),C()}X(["click"]);function U(a,t){let r=a;for(const o of t.split(".")){if(r==null||typeof r!="object")return;r=r[o]}return r}function se(a){let t=u(k([])),r=u(k({})),o=u(!1),c=u(!1);function d(e){const s=e&&typeof e=="object"&&"status"in e?e.status:0;y.error(s===409?v.t("ADMIN_NEXT.CONFIG.CONFIGURATION_WAS_MODIFIED_ELSEWHERE"):v.t("ADMIN_NEXT.CONFIG.OVERRIDE.REVERT_FAILED"))}async function m(e){if(!(!a.canWrite()||i(o))){n(o,!0);try{const s=await I(a.scope(),{keys:[e]},a.etag());a.applyFieldRevert(e,U(s.data,e),s.etag),n(t,s.overrides,!0),n(r,s.fallback,!0),y.success(v.t("ADMIN_NEXT.CONFIG.OVERRIDE.REVERTED"))}catch(s){d(s)}finally{n(o,!1)}}}async function g(){if(n(c,!1),!(!a.canWrite()||i(o))){n(o,!0);try{const e=await I(a.scope(),{reset:!0},a.etag());a.applyReset(e.data,e.etag),n(t,e.overrides,!0),n(r,e.fallback,!0),y.success(v.t("ADMIN_NEXT.CONFIG.OVERRIDE.RESET_DONE"))}catch(e){d(e)}finally{n(o,!1)}}}return W("configOverrides",{isOverridden:e=>i(t).includes(e),getFallback:e=>i(r)[e],revert:e=>m(e),get canRevert(){return a.canWrite()}}),{get overrides(){return i(t)},get fallback(){return i(r)},get reverting(){return i(o)},get showResetModal(){return i(c)},set showResetModal(e){n(c,e,!0)},ingest(e){n(t,e.overrides,!0),n(r,e.fallback,!0)},reset:g}}export{ae as M,se as p};