import{d as Y,f as T,a as E}from"../chunks/8V7BUHOp.js";import{p as aa,b as G,d as ea,u as ta,t as L,a as sa,c as a,s,e as N,r as e,g as v,h as ra,i as oa}from"../chunks/CwuLZfOX.js";import{s as m}from"../chunks/CaaTB9LM.js";import{i as ia}from"../chunks/ChcH33Yj.js";import{e as na,i as la,s as P,a as ca}from"../chunks/BSwjzqJH.js";import{S as pa}from"../chunks/DT2ZPtBg.js";import"../chunks/DUxDMF0-.js";import{G as da}from"../chunks/Bq3wCS1F.js";import{g as F}from"../chunks/Ey3lesIV.js";import{C as va}from"../chunks/A_Q6qwT4.js";import{T as ma}from"../chunks/J7yDsL_K.js";var _a=(o,p)=>F("/zones/"+p()),fa=(o,p)=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),F("/zones/"+p()))},ua=o=>o.stopPropagation(),ba=T('<div role="link" tabindex="0" class="mt-4 grid gap-8 lg:gap-12 border-2 border-primary p-2 rounded-xl cursor-pointer"><div class="flex justify-between items-center w-full"><h3 class="text-3xl font-semibold"> </h3> <div class="flex items-center gap-2"><span class="badge badge-secondary h-8"> </span> <span><!></span> <a class="btn btn-primary btn-sm">Edit</a></div></div> <div><h3 class="text-l">Location: <span class="text-gray-400"> </span></h3> <h3 class="text-l">Description: <span class="text-gray-400"> </span></h3> <h3 class="text-l">Supplies: <span class="text-gray-400"> </span></h3></div></div>'),xa=T('<section><div class="container mx-auto"><div class="flex items-center gap-2 sticky bg-base-100 z-40" style="top:4.11rem"><!></div> <div class="flex justify-between text-left mb-2"><h2 class="text-4xl font-semibold ">Zones</h2> <a class="btn btn-primary btn-sm">Add Zone</a></div> <!></div></section>');function Oa(o,p){aa(p,!0);const H=new pa(["Zones/+/+"]);let w=G(ea({})),z=G(0);ta(()=>{const h=H.getData(),n={};for(const[_,l]of Object.entries(h)){const t=_.split("/");if(t.length<3)continue;const r=t[1],c=t[2];if(!(!r||!c)){n[r]||(n[r]={});try{n[r][c]=l}catch(d){console.warn(`Failed to parse field "${c}" with value "${l}"`,d)}}}N(z,Math.max(...Object.keys(n).map(Number))+1),N(w,n,!0)});var u=xa(),S=a(u),b=a(S),M=a(b);da(M,{}),e(b);var x=s(b,2),q=s(a(x),2);e(x);var B=s(x,2);na(B,17,()=>Object.entries(v(w)),la,(h,n)=>{var _=ra(()=>oa(v(n),2));let l=()=>v(_)[0],t=()=>v(_)[1];var r=ba();r.__click=[_a,l],r.__keydown=[fa,l];var c=a(r),d=a(c),J=a(d,!0);e(d);var Z=s(d,2),g=a(Z),K=a(g);e(g);var f=s(g,2);let j;var Q=a(f);{var R=i=>{va(i,{})},U=i=>{ma(i,{})};ia(Q,i=>{t().Status==="1"?i(R):i(U,!1)})}e(f);var D=s(f,2);D.__click=[ua],e(Z),e(c);var I=s(c,2),y=a(I),O=s(a(y)),V=a(O,!0);e(O),e(y);var k=s(y,2),$=s(a(k)),W=a($,!0);e($),e(k);var A=s(k,2),C=s(a(A)),X=a(C,!0);e(C),e(A),e(I),e(r),L(i=>{m(J,t().Name),m(K,`Zone ${l()??""}`),j=ca(f,1,"badge h-8",null,j,i),P(D,"href","/zones/"+l()+"/edit"),m(V,t().Location),m(W,t().Description),m(X,t().Supplies)},[()=>({"badge-success":t().Status==="1","badge-error":t().Status==="2"||t().Status==="3"||t().Status==="4"})]),E(h,r)}),e(S),e(u),L(()=>P(q,"href","/zones/new_"+v(z)+"/edit")),E(o,u),sa()}Y(["click","keydown"]);export{Oa as component};
