import{K as p,u as d,r as t,y as n,R as x,a as g,j as a,L as h}from"./app-BMysVXg2.js";const E=()=>{const{errors:l,flash:o}=p().props,{error:c,log:u}=d(),f=t.useRef(!1),i=t.useMemo(()=>l?Object.values(l).flat().filter(e=>typeof e=="string"&&e.length>0):[],[l]);return t.useEffect(()=>{i.length!==0&&i.forEach(e=>{const s=`err-${e}`;n.isActive(s)||(n.error("Terjadi Kesalahan",{toastId:s}),c(e,{toastId:s}))})},[i,c]),t.useEffect(()=>{if(!(o!=null&&o.message))return;const{message:e,success:s}=o,r=`flash-${e}`;n.isActive(r)||(s===!0?(n.success(e,{toastId:r}),u(e)):(n.error(e,{toastId:r}),c(e)))},[o,u,c]),t.useEffect(()=>{f.current||(f.current=!0)},[]),{toast:n,dismissAllToasts:n.dismiss}},y=x.memo(({children:l,title:o,className:c=""})=>{const{props:u}=p(),{log:f,count:i}=d(),e=g(),s=t.useRef(0),r=t.useMemo(()=>e.APP_DEBUG,[e.APP_DEBUG]),m=t.useMemo(()=>e.APP_ENV==="local",[e.APP_ENV]);return E(),t.useEffect(()=>{s.current+=1,r&&(i("Component Rendered"),f({renderCount:s.current,pageProps:u,timestamp:new Date().toISOString(),component:"AppLayout"}),s.current>1&&console.warn(`⚠️ AppLayout rendered ${s.current} times!`))},[r,i,f,u]),a.jsxs("div",{className:"min-h-screen relative bg-primary overflow-hidden",children:[a.jsx(h,{title:o}),(m||r)&&a.jsxs("div",{className:"fixed w-60 h-50 flex flex-col justify-end rotate-45 origin-top-right top-0 -right-42 z-50 bg-yellow-300/50 text-center py-1 px-8 text-black animate-pulse text-sm",children:[a.jsx("span",{className:"font-bold text-yellow-900",children:"MODE"}),a.jsx("span",{className:"font-bold text-yellow-900",children:r?"DEBUG ACTIVED":"production"})]}),a.jsx("div",{className:"mx-auto min-h-screen max-w-xl rounded-t-lg bg-primary shadow-sm overflow-hidden",children:a.jsx("main",{className:`${c} h-full`,children:l})})]})});y.displayName="AppLayout";export{y as A,E as u};
