1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/CyqBW2sg.js","../chunks/DsnmJJEf.js","../chunks/CrZWGQw6.js","../chunks/DnKQ9cPv.js","../chunks/Cf9b1Pg_.js","../chunks/Dz3h3GFh.js","../chunks/Dm50tvsH.js","../chunks/Bv3bVpA9.js","../chunks/CRma1Vqn.js","../chunks/DvQYBH6E.js","../chunks/C6XItoiV.js","../chunks/Cj793bts.js","../chunks/0iQJZVSR.js","../chunks/Czj6Wchg.js","../chunks/DxT3OYjk.js","../chunks/CwPSEJ8P.js","../chunks/CqkleIqs.js","../chunks/DiCFD1Dp.js","../chunks/CVwbU7iF.js","../chunks/XonWkzlN.js"])))=>i.map(i=>d[i]); 2import{_ as Ca}from"../chunks/PPVm8Dsz.js";import"../chunks/DsnmJJEf.js";import{o as ma,a as Ta}from"../chunks/Czj6Wchg.js";import{p as sr,b as Ke,d as oe,n as R,a as c,e as dr,k as et,h as e,l as F,c as s,r as i,s as t,t as U,m as $,u as O,f as b,aJ as Qe,aZ as Sr,w as ja,i as pt,bP as Ea,j as sa,aP as Ua,W as La,aL as Fr,o as Oa}from"../chunks/CrZWGQw6.js";import{d as ia,s as j,a as G,e as $e}from"../chunks/Cf9b1Pg_.js";import{a as Da}from"../chunks/c80CAWEb.js";import{s as fa,r as ga,p as St,i as E}from"../chunks/Dm50tvsH.js";import{e as he,i as Xr}from"../chunks/DvQYBH6E.js";import{c as za}from"../chunks/DyozxAKL.js";import{t as xa}from"../chunks/7z66R2s9.js";import{r as Xe,a as Ye,s as ae,d as _t}from"../chunks/DnKQ9cPv.js";import{s as Te,c as Aa}from"../chunks/Dz3h3GFh.js";import{b as Yr}from"../chunks/C6XItoiV.js";import{g as Cr,i as Pa}from"../chunks/B1vmx_uJ.js";import{p as da}from"../chunks/BOaKQnFg.js";import{f as ea}from"../chunks/b1-d2NKg.js";import{s as ya}from"../chunks/DQdCbt27.js";import{P as ta}from"../chunks/DDgbR28v.js";import{D as ba}from"../chunks/CRma1Vqn.js";import{c as ra}from"../chunks/kfynFE08.js";import{s as Na}from"../chunks/CwPSEJ8P.js";import{a as Ma}from"../chunks/CNOJyinb.js";import{b as aa}from"../chunks/CElzeSkq.js";import{E as ir}from"../chunks/CDeN-5N4.js";import{c as Ia}from"../chunks/Fq6_ZWO_.js";import{p as Ra}from"../chunks/j9Qvi5uJ.js";import{B as Wa}from"../chunks/DjFvTp6Z.js";import{F as la}from"../chunks/COrpcmIg.js";import{g as ha}from"../chunks/DmDHphjo.js";import{E as ut}from"../chunks/yja6j_0l.js";import{P as Ba}from"../chunks/flvGgu3A.js";import{X as Tr}from"../chunks/C5KeTjzm.js";import{s as wa}from"../chunks/DxT3OYjk.js";import{I as ka}from"../chunks/BzoNmeXd.js";import{C as Gr}from"../chunks/DThU0_wh.js";import{P as $a}from"../chunks/D0pkcIV1.js";import{L as Ka}from"../chunks/dXnoXLTG.js";import{i as ca,f as _a,a as Vr}from"../chunks/DnxX_0nb.js";import{S as Ja}from"../chunks/HgcWlOK2.js";import{M as Ha}from"../chunks/bUrs1DhB.js";import{L as Ga}from"../chunks/Dig4r-B3.js";var Va=new Set(["$$slots","$$events","$$legacy"]);function Za(Se,C){sr(C,!0);let g=ga(C,Va);const de=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m15 9-6 6"}],["path",{d:"m9 9 6 6"}]];ka(Se,fa({name:"circle-x"},()=>g,{get iconNode(){return de},children:(Q,L)=>{var W=Ke(),ne=oe(W);wa(ne,()=>C.children??R),c(Q,W)},$$slots:{default:!0}})),dr()}var qa=new Set(["$$slots","$$events","$$legacy"]);function Qa(Se,C){sr(C,!0);let g=ga(C,qa);const de=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];ka(Se,fa({name:"image"},()=>g,{get iconNode(){return de},children:(Q,L)=>{var W=Ke(),ne=oe(W);wa(ne,()=>C.children??R),c(Q,W)},$$slots:{default:!0}})),dr()}var Xa=b('<button type="button"> </button>'),Ya=b('<div class="px-2 py-1.5 font-mono text-[11px] text-mid-grey">No results</div>'),eo=b('<div class="absolute left-0 top-full z-10 mt-1 min-w-[160px] overflow-hidden rounded border border-warm-grey bg-white shadow-sm"><input type="text" placeholder="Search..." class="w-full border-b border-warm-grey px-2 py-1.5 font-mono text-[11px] focus:outline-none"/> <div class="max-h-[200px] overflow-y-auto"></div></div>'),to=b('<div class="relative inline-block"><button type="button" class="inline-flex items-center gap-1 border border-warm-grey rounded px-1.5 py-0.5 font-mono text-[11px] text-dark-grey hover:border-dark-grey disabled:opacity-50 transition-colors"><span> </span> <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6l4 4 4-4"></path></svg></button> <!></div>');function ua(Se,C){sr(C,!0);let g=St(C,"options",19,()=>[]),de=St(C,"selected",3,null),Q=St(C,"placeholder",3,"Select..."),L=St(C,"disabled",3,!1),W=$(!1),ne=$(""),Ue=$(null),Fe=$(null),je=O(()=>e(ne)?g().filter(J=>J.label.toLowerCase().includes(e(ne).toLowerCase())):g()),ee=O(()=>g().find(J=>J.value===de())?.label??null);et(()=>{e(W)||F(ne,"")}),et(()=>{e(W)&&e(Fe)&&e(Fe).focus()}),ma(()=>{function J(Ge){e(Ue)&&!e(Ue).contains(Ge.target)&&F(W,!1)}return document.addEventListener("click",J,!0),()=>{document.removeEventListener("click",J,!0)}});function ce(J){C.onselect?.(J),F(W,!1)}var M=to(),d=s(M),Ce=s(d),pe=s(Ce,!0);i(Ce);var we=t(Ce,2);i(d);var o=t(d,2);{var ie=J=>{var Ge=eo(),Ee=s(Ge);Xe(Ee),Yr(Ee,ke=>F(Fe,ke),()=>e(Fe));var rt=t(Ee,2);he(rt,21,()=>e(je),ke=>ke.value,(ke,I)=>{var xe=Xa(),ye=s(xe,!0);i(xe),U(()=>{Te(xe,1,`w-full cursor-pointer px-2 py-1.5 text-left font-mono text-[11px] hover:bg-warm-grey/50 ${e(I).value===de()?"bg-warm-grey/30":""}`),j(ye,e(I).label)}),G("click",xe,()=>ce(e(I).value)),c(ke,xe)},ke=>{var I=Ya();c(ke,I)}),i(rt),i(Ge),aa(Ee,()=>e(ne),ke=>F(ne,ke)),c(J,Ge)};E(o,J=>{e(W)&&J(ie)})}i(M),Yr(M,J=>F(Ue,J),()=>e(Ue)),U(()=>{d.disabled=L(),Te(Ce,1,Aa(e(ee)?"":"text-mid-grey")),j(pe,e(ee)??Q()),Te(we,0,`h-2.5 w-2.5 shrink-0 text-mid-grey transition-transform ${e(W)?"rotate-180":""}`)}),G("click",d,()=>{L()||F(W,!e(W))}),c(Se,M),dr()}ia(["click"]);const Zr=(Se,C=R)=>{var g=co(),de=s(g,!0);i(g),U(()=>
2j(de,C())),c(Se,g)},jr=(Se,C=R,g=R,de=R,Q=R)=>{var L=na(),W=s(L),ne=s(W,!0);i(W);var Ue=t(W,2);{var Fe=ce=>{var M=_o(),d=s(M,!0),Ce=t(d);ut(Ce,{size:10,class:"shrink-0"}),i(M),U(()=>{ae(M,"href",de()),ae(M,"title",`Open on ${Q()??""} (new tab)`),j(d,g())}),c(ce,M)},je=ce=>{var M=Sa(),d=s(M,!0);i(M),U(()=>j(d,g())),c(ce,M)},ee=ce=>{var M=oa();c(ce,M)};E(Ue,ce=>{g()!=null&&g()!==""&&de()?ce(Fe):g()!=null&&g()!==""?ce(je,1):ce(ee,-1)})}i(L),U(()=>{ae(W,"title",C()),j(ne,C())}),c(Se,L)};var ro=b('<a target="_blank" rel="noopener noreferrer" class="text-[12px] text-dark-grey font-mono break-all col-span-2 inline-flex items-center gap-1 underline decoration-dotted decoration-mid-grey underline-offset-2 hover:text-black hover:decoration-solid hover:decoration-dark-grey"> <!></a>'),Sa=b('<span class="text-[12px] text-dark-grey font-mono break-all col-span-2"> </span>'),oa=b('<span class="text-[12px] text-mid-grey/50 font-mono col-span-2">â</span>'),na=b('<div class="grid grid-cols-3 gap-2 py-[3px] border-b border-warm-grey/60"><span class="text-[11px] text-mid-grey font-mono truncate"> </span> <!></div>'),qr=b('<div class="grid grid-cols-3 gap-2 py-[3px] border-b border-warm-grey/60"><span class="text-[11px] text-mid-grey font-mono truncate"> </span> <input type="text" class="col-span-2 text-[12px] text-dark-grey font-mono border border-warm-grey rounded px-1.5 py-0.5 hover:border-dark-grey focus:border-dark-grey focus:outline-none transition-colors bg-transparent"/></div>'),ao=b('<span class="text-[11px] text-mid-grey font-mono">Loading...</span>'),oo=b('<div class="grid grid-cols-3 gap-2 py-[3px] border-b border-warm-grey/60"><span class="text-[11px] text-mid-grey font-mono truncate"> </span> <div class="col-span-2"><!></div></div>'),no=b('<a target="_blank" rel="noopener noreferrer" class="text-[9px] text-dark-grey/70 font-mono break-all col-span-2 leading-tight inline-flex items-center gap-1 underline decoration-dotted decoration-mid-grey underline-offset-2 hover:text-black hover:decoration-solid hover:decoration-dark-grey"> <!></a>'),io=b('<span class="text-[9px] text-dark-grey/70 font-mono break-all col-span-2 leading-tight"> </span>'),so=b('<span class="text-[9px] text-mid-grey/50 font-mono col-span-2">â</span>'),lo=b('<div class="grid grid-cols-3 gap-2 py-[3px] border-b border-warm-grey/60"><span class="text-[11px] text-mid-grey font-mono truncate"> </span> <input type="text" class="col-span-2 text-[9px] text-dark-grey/70 font-mono border border-warm-grey rounded px-1.5 py-0.5 hover:border-dark-grey focus:border-dark-grey focus:outline-none transition-colors bg-transparent leading-tight"/></div>'),co=b('<div class="text-[10px] text-mid-grey uppercase tracking-widest mb-2 pb-1 border-b border-dark-grey"> </div>'),_o=b('<a target="_blank" rel="noopener noreferrer" class="text-[12px] text-dark-grey font-mono col-span-2 inline-flex items-center gap-1 underline decoration-dotted decoration-mid-grey underline-offset-2 hover:text-black hover:decoration-solid hover:decoration-dark-grey focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dark-grey rounded-sm"> <!></a>'),uo=b('<button class="p-1 hover:bg-warm-grey rounded transition-colors" title="Close"><!></button>'),po=b('<span class="w-2.5 h-2.5 rounded-full shrink-0"></span> <span class="text-[12px] font-medium text-dark-grey flex-1 truncate"> </span> <a target="_blank" rel="noopener noreferrer" class="text-[9px] px-1.5 py-0.5 border border-warm-grey rounded transition-colors inline-flex items-center gap-1 shrink-0 text-mid-grey hover:text-dark-grey hover:border-dark-grey no-underline"><!> Edit in Sanity</a> <button><!> <kbd> </kbd></button> <!>',1),vo=b('<p class="text-[11px] text-mid-grey font-mono py-1 mb-2"> </p>'),mo=b('<button class="absolute top-0.5 right-0.5 z-10 opacity-70 hover:opacity-100 transition-opacity" title="Remove photo"><!></button>'),fo=b('<input type="text" placeholder="caption" class="w-full text-[9px] text-mid-grey font-mono mt-1 max-w-[200px] border border-warm-grey rounded px-1 py-0.5 hover:border-dark-grey focus:border-dark-grey focus:outline-none transition-colors bg-transparent"/>'),go=b('<p class="text-[9px] text-mid-grey mt-1 truncate max-w-[200px]"> <!></p>'),xo=b('<div class="shrink-0 group max-w-[200px]"><div class="relative inline-block"><button type="button" class="block cursor-zoom-in"><img class="rounded border border-warm-grey max-h-[120px] max-w-[200px]"/></button> <!></div> <!></div>'),yo=b('<button class="shrink-0 w-[120px] h-[120px] rounded border-2 border-dashed border-warm-grey flex flex-col items-center justify-center gap-1 text-mid-grey hover:border-dark-grey hover:text-dark-grey transition-colors" title="Add photo"><!> <span class="text-[9px] font-mono">Add photo</span></button>'),bo=b('<p class="text-[10px] text-blue-500 font-mono mt-1">Drop images to upload</p>'),ho=b('<div><!> <div class="flex gap-2 overflow-x-auto pb-1"><!> <!></div> <!></div>
2'),wo=b('<!> <!> <!> <!> <div class="grid grid-cols-3 gap-2 py-[3px] border-b border-warm-grey/60"><span class="text-[11px] text-mid-grey font-mono truncate" title="location">location</span> <div class="col-span-2 flex gap-1"><input type="text" placeholder="lat" class="flex-1 text-[12px] text-dark-grey font-mono border border-warm-grey rounded px-1.5 py-0.5 hover:border-dark-grey focus:border-dark-grey focus:outline-none transition-colors bg-transparent"/> <input type="text" placeholder="lng" class="flex-1 text-[12px] text-dark-grey font-mono border border-warm-grey rounded px-1.5 py-0.5 hover:border-dark-grey focus:border-dark-grey focus:outline-none transition-colors bg-transparent"/></div></div> <!> <!> <!> <!> <!>',1),ko=b('<button disabled="" class="inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border border-warm-grey text-mid-grey cursor-not-allowed"><span class="w-3 h-3 border-[1.5px] border-mid-grey/60 border-t-dark-grey rounded-full animate-spin"></span> Fetching</button>'),So=b('<button class="text-[10px] px-1.5 py-0.5 rounded border border-warm-grey text-dark-grey hover:bg-warm-grey/50 hover:border-dark-grey transition-colors cursor-pointer">View</button>'),Fo=b('<span class="text-[10px] text-mid-warm-grey" title="No polygon found for this OSM ID">⚠</span>'),Co=b('<button class="text-[10px] px-1.5 py-0.5 rounded border border-red/30 text-red hover:border-red/50 transition-colors cursor-pointer">Retry</button>'),To=b('<button class="text-[10px] px-1.5 py-0.5 rounded border border-warm-grey text-dark-grey hover:bg-warm-grey/50 hover:border-dark-grey transition-colors cursor-pointer">Fetch</button>'),jo=b('<span class="text-[12px] text-dark-grey font-mono col-span-2 inline-flex items-center gap-1.5"><a target="_blank" rel="noopener noreferrer" class="inline-flex items-center gap-1 underline decoration-dotted decoration-mid-grey underline-offset-2 hover:text-black hover:decoration-solid hover:decoration-dark-grey"> <!></a> <!></span>'),Eo=b('<!> <!> <!> <!> <!> <!> <!> <!> <div class="grid grid-cols-3 gap-2 py-[3px] border-b border-warm-grey/60"><span class="text-[11px] text-mid-grey font-mono truncate" title="osm_way_id">osm_way_id</span> <!></div> <!>',1),Uo=b('<textarea class="w-full text-[12px] text-dark-grey leading-relaxed font-sans border border-warm-grey rounded px-2 py-1.5 hover:border-dark-grey focus:border-dark-grey focus:outline-none transition-colors bg-transparent resize-y min-h-[80px]" rows="5"></textarea>'),Lo=b('<p class="mb-1.5"> </p>'),Oo=b('<div class="text-[12px] text-dark-grey leading-relaxed font-sans"></div>'),Do=b('<span class="text-[12px] text-mid-grey/50 font-mono">No description</span>'),zo=b('<div class="flex items-center gap-2 py-[3px] border-b border-warm-grey/60"><span class="text-[12px] text-dark-grey font-mono flex-1 truncate"> </span> <button class="p-0.5 rounded hover:bg-warm-grey transition-colors shrink-0" title="Remove owner"><!></button></div>'),Ao=b('<span class="text-[11px] text-mid-grey font-mono py-1 block">Loading...</span>'),Po=b('<div class="mt-1"><!></div>'),Qr=b("<!> <!>",1),No=b('<a target="_blank" rel="noopener noreferrer" title="Open website (new tab)" class="text-[12px] text-dark-grey hover:text-black inline-flex items-center gap-1 underline decoration-dotted decoration-mid-grey underline-offset-2 hover:
2decoration-solid hover:decoration-dark-grey focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dark-grey rounded-sm"> <!></a>'),Mo=b('<span class="text-[12px] text-dark-grey"> </span>'),Io=b('<a class="text-[10px] text-mid-grey hover:text-dark-grey underline decoration-dotted decoration-mid-grey underline-offset-2 hover:decoration-solid hover:decoration-dark-grey focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-dark-grey rounded-sm"> </a>'),Ro=b('<div class="flex items-center gap-2 py-[3px] border-b border-warm-grey/60"><!> <!></div>'),Wo=b('<span class="text-[12px] text-mid-grey/50 font-mono">No owners</span>'),Bo=b('<div class="mb-5"><div class="text-[10px] text-mid-grey uppercase tracking-widest mb-2 pb-1 border-b border-dark-grey">Metadata</div> <!></div>'),$o=b('<button><!> <span class="w-2 h-2 rounded-full"></span> <span class="text-[11px] text-dark-grey truncate"> </span> <span class="text-[10px] text-mid-grey tabular-nums text-right"> </span> <!></button>'),Ko=b('<div><div class="text-[10px] text-mid-grey uppercase tracking-widest mb-2 pb-1 border-b border-dark-grey"> </div> <!></div>'),Jo=b('<!> <span class="w-2.5 h-2.5 rounded-full shrink-0"></span> <span class="text-[12px] font-medium text-dark-grey flex-1 truncate"> </span> <a target="_blank" rel="noopener noreferrer" class="text-[9px] px-1.5 py-0.5 border border-warm-grey rounded transition-colors inline-flex items-center gap-1 shrink-0 text-mid-grey hover:text-dark-grey hover:border-dark-grey no-underline"><!> Edit in Sanity</a> <button class="p-1 hover:bg-warm-grey rounded transition-colors"><!></button>',1),pa=b("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1),Ho=b('<div class="border-t border-warm-grey/40 mt-1 pt-1"></div>'),va=b("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1),Go=b('<div class="mt-3 pt-3 border-t border-warm-grey/60"><div class="text-[9px] text-mid-grey uppercase tracking-widest mb-1"> </div> <!></div>'),Vo=b('<div class="mt-3 pt-3 border-t border-warm-grey/60"><div class="text-[9px] text-mid-grey uppercase tracking-widest mb-1">Metadata</div> <!></div>'),Zo=b('<div class="flex shrink-0"><!> <div class="flex-1 flex flex-col overflow-hidden"><!> <div class="flex-1 overflow-y-auto p-4"><!> <!> <!></div></div></div>'),qo=b('<button class="absolute left-4 top-1/2 -translate-y-1/2 p-2 text-white/50 hover:text-white transition-colors pointer-events-auto"><!></button>'),Qo=b('<button class="absolute right-4 top-1/2 -translate-y-1/2 p-2 text-white/50 hover:text-white transition-colors pointer-events-auto"><!></button>'),Xo=b('<p class="text-xs text-white/70 text-center max-w-[60vw]"> <!></p>'),Yo=b('<p class="text-[10px] text-white/40"> </p>'),en=b('<div class="fixed inset-0 z-[9999] flex items-center justify-center pointer-events-none"><button class="absolute top-4 right-4 p-2 text-white/70 hover:text-white transition-colors pointer-events-auto"><!></button> <!> <div class="flex flex-col items-center gap-3 pointer-events-auto"><img class="max-h-[85vh] max-w-[90vw] object-contain rounded"/> <!> <!></div></div>'),tn=b('<div class="flex-1 flex flex-col min-h-0 transition-colors"><!> <div class="flex-1 flex min-h-0"><div class="flex-1 overflow-y-auto min-w-0"><div class="p-5"><!> <div class="mb-5"><!> <!></div> <div class="mb-5"><!> <!></div> <div class="mb-5"><!> <!></div> <!> <!></div></div> <!></div> <!> <!></div>');function rn(Se,C){sr(C,!0);const g=(r,a=R,n=R)=>{var l=na(),x=s(l),p=s(x,!0);i(x);var v=t(x,2);{var m=_=>{var u=ro(),h=s(u,!0),D=t(h);ut(D,{size:10,class:"shrink-0"}),i(u),U(()=>{ae(u,"href",n()),j(h,n())}),c(_,u)},w=O(()=>Dt(n())),k=_=>{var u=Sa(),h=s(u,!0);i(u),U(()=>j(h,n())),c(_,u)},y=_=>{var u=oa();c(_,u)};E(v,_=>{e(w)?_(m):n()!=null&&n()!==""?_(k,1):_(y,-1)})}i(l),U(()=>{ae(x,"title",a()),j(p,a())}),c(r,l)},de=(r,a=R,n=R,l=R,x=R)=>{var p=qr(),v=s(p),m=s(v,!0);i(v);var w=t(v,2);Xe(w),i(p),U(()=>{ae(v,"title",a()),j(m,a()),_t(w,n()??""),w.disabled=e(_e)}),$e("blur",w,k=>V(l(),k.currentTarget.value,x())),G("keydown",w,k=>{k.key==="Enter"&&k.currentTarget.blur()}),c(r,p)},Q=(r,a=R,n=R,l=R,x=R)=>{var p=oo(),v=s(p),m=s(v,!0);i(v);var w=t(v,2),k=s(w);{var y=u=>{var h=ao();c(u,h)},_=u=>{ua(u,{get options(){return n()},get selected(){return l()},get placeholder(){return`Select ${a()??""}`},get onselect(){return x()},get disabled(){return e(_e)}})};E(k,u=>{e(vt)?u(y):u(_,-1)})}i(w),i(p),U(()=>{ae(v,"title",a()),j(m,a())}),c(r,p)},L=(r,a=R,n=R,l=R,x=R,p=R)=>{var v=qr(),m=s(v),w=s(m,!0);i(m);var k=t(m,2);Xe(k),i(v),U(()=>{ae(m,"title",a()),j(w,a()),_t(k,n()??""),k.disabled=e(_e)}),$e("blur",k,y=>_r(l(),y.currentTarget.value,x(),p())),G("keydown",k,y=>{y.key==="Enter"&&y.currentTarget.blur()}),c(r,v)},W=(r,a=R,n=R,l=R,x=R,p=R,v=R)=>{var m=qr(),w=s(m),k=s(w,!0);i(w);var y=t(w,2);Xe(y),i(m),U(()=>{ae(w,"title",n()),j(k,n()),_t(y,l()??""),y.disabled=e(_e)}),$e("blur",y,_=>Mr(a(),x(),_.currentTarget.value,p(),v())),G("keydown",y,_=>{_.key==="Enter"&&_.currentTarget.blur()}),c(r,m)},ne=(r,a=R,n=R)=>{var l=na(),x=s(l),p=s(x,!0);i(x);
2var v=t(x,2);{var m=_=>{var u=no(),h=s(u,!0),D=t(h);ut(D,{size:10,class:"shrink-0"}),i(u),U(()=>{ae(u,"href",n()),j(h,n())}),c(_,u)},w=O(()=>Dt(n())),k=_=>{var u=io(),h=s(u,!0);i(u),U(()=>j(h,n())),c(_,u)},y=_=>{var u=so();c(_,u)};E(v,_=>{e(w)?_(m):n()!=null&&n()!==""?_(k,1):_(y,-1)})}i(l),U(()=>{ae(x,"title",a()),j(p,a())}),c(r,l)},Ue=(r,a=R,n=R,l=R,x=R,p=R)=>{var v=lo(),m=s(v),w=s(m,!0);i(m);var k=t(m,2);Xe(k),i(v),U(()=>{ae(m,"title",a()),j(w,a()),_t(k,n()??""),k.disabled=e(_e)}),$e("blur",k,y=>_r(l(),y.currentTarget.value,x(),p())),G("keydown",k,y=>{y.key==="Enter"&&y.currentTarget.blur()}),c(r,v)},Fe=ha();async function je(){const r=await Fe.instance?.session?.getToken();return r?{Authorization:`Bearer ${r}`}:{}}let ee=St(C,"selectedUnitCode",3,null),ce=St(C,"osmStatus",3,"idle"),M=O(()=>Ia(C.dataset)),d=$(Qe({})),Ce="";et(()=>{const r=C.facility?._id??"";if(r!==Ce){Ce=r;const a=Na(C.facility);if(a?.photos)for(const n of a.photos)n.caption==null&&(n.caption="");F(d,a,!0)}});const pe=ra({axis:"x",min:360,max:800,initial:480,storageKey:"cms-explorer-unit-panel-width",invert:!0});let we=O(()=>!ee()||!e(d)?.units?null:e(d).units.find(r=>r.code===ee())??null),o=$(null),ie=$(-1),J=O(()=>e(ie)>=0?e(d).photos?.[e(ie)]:null);et(()=>{e(we)&&F(o,e(we),!0)});function Ge(r){return r==null?"â":r.toLocaleString("en-AU",{maximumFractionDigits:1})}function Ee(r){return r?ea[r]||"#888":"#ccc"}const rt="https://www.sanity.io/@oWUWl4BzU/studio/41a3d18a0c474b3d11a5dc28";function ke(r,a){return`${rt}/intent/edit/id=${r};type=${a}/?dataset=${C.dataset}`}let I=$(!1),xe=$(""),ye=$(Qe([])),Ft=$(Qe([])),at=$(Qe([])),Ct=$(Qe([])),Tt=$(Qe([])),ot=$(!1),vt=$(!1),_e=$(!1),Er=O(()=>e(I)||e(_e));et(()=>{C.onbusy?.(e(Er))});let mt=$(!1),jt=$(""),nt=$(!1);function Ur(r){return r?.length?r.filter(a=>a._type==="block").map(a=>a.children?.map(n=>n.text).join("")||"").join(` 3 4`):""}function lr(r){return r.trim()?r.split(` 5 6`).filter(Boolean).map((a,n)=>({_type:"block",_key:`block-${n}`,style:"normal",children:[{_type:"span",_key:`span-${n}`,text:a.trim(),marks:[]}],markDefs:[]})):[]}function Et(){e(I)?(F(I,!1),Lr()):(F(I,!0),Or(),F(xe,Ur(e(d).description),!0))}async function Lr(){const r=lr(e(xe));e(d).description=r,C.onupdate?.(e(d)),await f("description",r)}async function Or(){if(!e(ot)){F(vt,!0);try{const a=await(await fetch("/api/cms/options",{headers:await je()})).json();F(ye,(a.regions??[]).map(n=>({label:`${n.name} (${n.code})`,value:n._id})),!0),F(Ft,(a.owners??[]).map(n=>({label:n.name||n.legal_name,value:n._id})),!0),F(at,(a.networks??[]).map(n=>({label:`${n.name} (${n.code})`,value:n._id})),!0),F(Tt,a.fuelTechnologies??[],!0),F(Ct,e(Tt).map(n=>({label:`${n.name} (${n.code})`,value:n._id})),!0),F(ot,!0)}catch(r){console.error("Failed to load options",r)}finally{F(vt,!1)}}}async function f(r,a){F(_e,!0);try{if(!(await fetch("/api/cms/facilities",{method:"PATCH",headers:{"Content-Type":"application/json",...await je()},body:JSON.stringify({facilityId:e(d)._id,patches:{[r]:a}})})).ok)throw new Error("Patch failed")}catch(n){console.error("Failed to save",n)}finally{F(_e,!1)}}async function z(r){const a=Array.from(r).filter(l=>l.type.startsWith("image/"));if(!a.length)return;F(mt,!0);const n=await je();for(let l=0;l<a.length;l++){F(jt,a.length>1?`Uploading ${l+1} of ${a.length}...`:"Uploading...",!0);const x=new FormData;x.append("file",a[l]);try{const p=await fetch("/api/cms/upload",{method:"POST",headers:n,body:x});if(!p.ok){console.error("Upload failed for",a[l].name);continue}const{assetId:v,key:m}=await p.json(),w={_type:"image",_key:m,asset:{_type:"reference",_ref:v},alt:"",caption:"",attribution:""};e(d).photos=[...e(d).photos??[],w]}catch(p){console.error("Upload error",p)}}C.onupdate?.(e(d)),await f("photos",e(d).photos),F(mt,!1),F(jt,"")}async function Y(r){e(d).photos=(e(d).photos??[]).filter((a,n)=>n!==r),C.onupdate?.(e(d)),await f("photos",e(d).photos)}async function Je(r,a){const n=a.trim();n!==(e(d).photos?.[r]?.caption??"")&&(e(d).photos[r].caption=n,C.onupdate?.(e(d)),await f("photos",e(d).photos))}async function V(r,a,n){const l=a.trim(),x=n.split(".").reduce((v,m)=>v?.[m],e(d));if(l===(x??""))return;const p=n.split(".");if(p.length===1)e(d)[p[0]]=l||null;else{let v=e(d);for(let m=0;m<p.length-1;m++)v[p[m]]||(v[p[m]]={}),v=v[p[m]];v[p[p.length-1]]=l?Number(l)||l:null}C.onupdate?.(e(d)),await f(r,l||null)}async function Le(r){const a=e(at).find(l=>l.value===r);a&&(e(d).network={_id:r,name:a.label.replace(/ \(.*\)$/,""),code:""}),C.onupdate?.(e(d)),await f("network",{_type:"reference",_ref:r})}async function Ut(r){const a=e(ye).find(l=>l.value===r);a&&(e(d).region={_id:r,name:a.label.replace(/ \(.*\)$/,""),code:""}),C.onupdate?.(e(d)),await f("region",{_type:"reference",_ref:r})}async function tt(r,a){const n=parseFloat(a);if(isNaN(n))return;const l=e(d).location?.[r];if(n===l)return;
6const x={_type:"geopoint",lat:r==="lat"?n:e(d).location?.lat??0,lng:r==="lng"?n:e(d).location?.lng??0};e(d).location=x,C.onupdate?.(e(d)),await f("location",x)}async function cr(r){if(e(d).owners?.some(l=>l._id===r))return;const a=e(Ft).find(l=>l.value===r);a&&(e(d).owners=[...e(d).owners??[],{_id:r,name:a.label}]),C.onupdate?.(e(d));const n=(e(d).owners??[]).map(l=>({_type:"reference",_ref:l._id,_key:l._id.slice(-8)}));await f("owners",n)}async function Dr(r){const a=(e(d).owners??[]).filter(l=>l._id!==r);e(d).owners=a,C.onupdate?.(e(d));const n=a.map(l=>({_type:"reference",_ref:l._id,_key:l._id.slice(-8)}));await f("owners",n)}const zr=[{label:"Operating",value:"operating"},{label:"Retired",value:"retired"},{label:"Committed",value:"committed"}],Ar=[{label:"GENERATOR",value:"GENERATOR"},{label:"LOAD",value:"LOAD"}],Pr=new Set(["_id","_type","_rev","_createdAt","_updatedAt","code","fuel_technology","dispatch_type","status","capacity_registered","capacity_maximum","storage_capacity","min_generation_capacity","grid_forming","marginal_loss_factor","emissions_factor_co2","emissions_factor_source","data_first_seen","data_last_seen","commissioning_confirmed","expected_operation_date","expected_operation_date_specificity","expected_closure_date","expected_closure_date_specificity","commencement_date","commencement_date_specificity","closure_date","closure_date_specificity","construction_start_date","construction_start_date_source","construction_start_date_specificity","construction_cost","construction_cost_source","cis_tender_recipient","epbc_id","epbc_number","expected_closure_date_source","project_approval_date","project_approval_date_source","project_approval_lodgement_date","state_approval_date","state_approval_source","state_lodgement_date","unit_types","metadata_array"]);let Lt=O(()=>e(o)?Object.keys(e(o)).filter(r=>!Pr.has(r)):[]),ft=O(()=>e(Lt).filter(r=>{const a=e(o)?.[r];return a==null||typeof a!="object"})),Ve=O(()=>e(Lt).filter(r=>{const a=e(o)?.[r];return a!=null&&typeof a=="object"}));function Ze(r){return r!=null&&typeof r=="object"&&"_ref"in r}let it=$(Qe({}));et(()=>{const r=e(Ve).map(a=>e(o)?.[a]).filter(Ze).map(a=>a._ref).filter(a=>!(a in e(it)));r.length&&(async()=>{try{const a=await fetch(`/api/cms/resolve-refs?ids=${r.join(",")}`,{headers:await je()});if(a.ok){const n=await a.json(),l={...e(it)};for(const x of r)l[x]=n[x]??null;F(it,l,!0)}}catch(a){console.error("Failed to resolve refs",a)}})()});function gt(r){if(!Ze(r))return JSON.stringify(r);const a=e(it)[r._ref];return a&&(a.name||a.title||a.code)||r._ref}function Ot(r){return r==null?"":typeof r=="object"?JSON.stringify(r):String(r)}function Dt(r){return typeof r=="string"&&(r.startsWith("http://")||r.startsWith("https://"))}function zt(r){return typeof r=="number"?"number":typeof r=="boolean"?"boolean":"text"}async function He(r,a,n){F(_e,!0);try{if(!(await fetch("/api/cms/facilities",{method:"PATCH",headers:{"Content-Type":"application/json",...await je()},body:JSON.stringify({facilityId:r,patches:{[a]:n}})})).ok)throw new Error("Unit patch failed")}catch(l){console.error("Failed to save unit field",l)}finally{F(_e,!1)}}function st(r){return e(d).units?.find(a=>a.code===r)??null}async function _r(r,a,n,l="text"){if(!ee())return;const x=st(ee());if(!x)return;const p=a.trim(),v=x[n];let m;if(l==="number"){if(m=p===""?null:parseFloat(p),m!==null&&isNaN(m))return}else l==="boolean"?m=p===""?null:p==="true":m=p||null;m!==(v??null)&&(x[n]=m,C.onupdate?.(e(d)),await He(x._id,r,m))}async function Nr(r){if(!ee())return;const a=st(ee());if(!a)return;const n=e(Tt).find(l=>l._id===r);n&&(a.fuel_technology={_id:n._id,code:n.code,name:n.name,colour:n.colour,renewable:n.renewable,dispatch_type:n.dispatch_type}),C.onupdate?.(e(d)),await He(a._id,"fuel_technology",{_type:"reference",_ref:r})}async function ur(r){if(!ee())return;const a=st(ee());a&&(a.status=r,C.onupdate?.(e(d)),await He(a._id,"status",r))}async function pr(r){if(!ee())return;const a=st(ee());a&&(a.dispatch_type=r,C.onupdate?.(e(d)),await He(a._id,"dispatch_type",r))}async function Mr(r,a,n,l,x="text"){const p=n.trim();let v;if(x==="number"){if(v=p===""?null:parseFloat(p),v!==null&&isNaN(v))return}else v=p||null;v!==(r[l]??null)&&(r[l]=v,C.onupdate?.(e(d)),await He(r._id,a,v))}var xt=tn();$e("keydown",ja,r=>{if(r.key==="Escape"){if(e(I)){Et();return}if(e(ie)>=0){F(ie,-1);return}}if(r.key==="e"&&!e(I)&&e(ie)<0&&!(r.target instanceof HTMLInputElement)&&!(r.target instanceof HTMLTextAreaElement)){Et();return}e(ie)<0||(r.key==="ArrowLeft"&&e(ie)>0?Sr(ie,-1):r.key==="ArrowRight"&&e(ie)<(e(d).photos?.length??1)-1&&Sr(ie))});let vr;var At=s(xt);{let r=O(()=>e(_e)?"saving-hatch":"");ta(At,{get class(){return e(r)},children:(a,n)=>{var l=po(),x=oe(l),p=t(x,2),v=s(p,!0);i(p);var m=t(p,2),w=s(m);ut(w,{size:8}),pt(),i(m);var k=t(m,2),y=s(k);Ba(y,{size:8});var _=t(y),u=t(_),h=s(u,!0);i(u),i(k);var D=t(k,2);{var T=N=>{var B=uo(),Z=s(B);Tr(Z,{size:12,class:"text-mid-grey"}),i(B),G("click",B,function(...S){C.onclose?.apply(this,S)}),c(N,B)};E(D,N=>{C.onclose&&N(T)})}U((N,B)=>{Ye(x,`background: ${N??""}
6`),j(v,e(d).name||"Unnamed"),ae(m,"href",B),Te(k,1,`text-[9px] px-1.5 py-0.5 border rounded transition-colors inline-flex items-center gap-1 shrink-0 ${e(I)?"border-dark-grey bg-dark-grey text-white":"border-warm-grey text-mid-grey hover:text-dark-grey hover:border-dark-grey"}`),j(_,` ${e(I)?"DONE":"EDIT"} `),Te(u,1,`text-[8px] px-0.5 rounded ${e(I)?"bg-white/20":"bg-warm-grey"}`),j(h,e(I)?"esc":"E")},[()=>Ee(e(d).units?.[0]?.fuel_technology?.code),()=>ke(e(d)._id,"facility")]),G("click",k,Et),c(a,l)},$$slots:{default:!0}})}var dt=t(At,2),yt=s(dt),mr=s(yt),bt=s(mr);{var fr=r=>{var a=ho(),n=s(a);{var l=y=>{var _=vo(),u=s(_,!0);i(_),U(()=>j(u,e(jt))),c(y,_)};E(n,y=>{e(mt)&&y(l)})}var x=t(n,2),p=s(x);he(p,19,()=>e(d).photos??[],(y,_)=>y._key||_,(y,_,u)=>{var h=xo(),D=s(h),T=s(D),N=s(T);i(T);var B=t(T,2);{var Z=te=>{var q=mo(),se=s(q);Za(se,{size:16,class:"fill-black stroke-white",strokeWidth:2}),i(q),U(()=>q.disabled=e(_e)),G("click",q,ge=>{ge.stopPropagation(),Y(e(u))}),c(te,q)};E(B,te=>{e(I)&&te(Z)})}i(D);var S=t(D,2);{var me=te=>{var q=fo();Xe(q),$e("blur",q,se=>Je(e(u),se.currentTarget.value)),G("keydown",q,se=>{se.key==="Enter"&&se.currentTarget.blur()}),aa(q,()=>e(_).caption,se=>e(_).caption=se),c(te,q)},fe=te=>{var q=go(),se=s(q,!0),ge=t(se);{var X=K=>{var le=sa();U(()=>j(le,`${e(_).caption?" â ":""}${e(_).attribution??""}`)),c(K,le)};E(ge,K=>{e(_).attribution&&K(X)})}i(q),U(()=>j(se,e(_).caption||"")),c(te,q)};E(S,te=>{e(I)?te(me):(e(_).caption||e(_).attribution)&&te(fe,1)})}i(h),U(te=>{ae(N,"src",te),ae(N,"alt",e(_).alt||e(_).caption||`${e(d).name} photo ${e(u)+1}`)},[()=>e(_).asset?e(M)(e(_)).width(400).url():e(_).url]),G("click",T,()=>F(ie,e(u),!0)),c(y,h)});var v=t(p,2);{var m=y=>{var _=yo(),u=s(_);$a(u,{size:20}),pt(2),i(_),U(()=>_.disabled=e(mt)),G("click",_,()=>{const h=document.createElement("input");h.type="file",h.accept="image/png,image/jpeg,image/gif,image/webp,image/avif",h.multiple=!0,h.onchange=()=>{h.files?.length&&z(h.files)},h.click()}),c(y,_)};E(v,y=>{e(I)&&y(m)})}i(x);var w=t(x,2);{var k=y=>{var _=bo();c(y,_)};E(w,y=>{e(I)&&e(nt)&&y(k)})}i(a),U(()=>Te(a,1,`mb-5 rounded-lg border-2 transition-colors p-2 ${e(nt)&&e(I)?"border-dashed border-blue-400 bg-blue-50/30":"border-transparent"}`)),$e("dragover",a,y=>{e(I)&&(y.preventDefault(),F(nt,!0))}),$e("dragleave",a,()=>{F(nt,!1)}),$e("drop",a,y=>{e(I)&&(y.preventDefault(),F(nt,!1),y.dataTransfer?.files?.length&&z(y.dataTransfer.files))}),c(r,a)};E(bt,r=>{(e(I)||e(d).photos?.length>0)&&r(fr)})}var Pt=t(bt,2),ht=s(Pt);Zr(ht,()=>"Facility");var gr=t(ht,2);{var Ir=r=>{var a=wo(),n=oe(a);de(n,()=>"name",()=>e(d).name,()=>"name",()=>"name");var l=t(n,2);de(l,()=>"code",()=>e(d).code,()=>"code",()=>"code");var x=t(l,2);Q(x,()=>"network",()=>e(at),()=>e(d).network?._id??null,()=>Le);var p=t(x,2);Q(p,()=>"region",()=>e(ye),()=>e(d).region?._id??null,()=>Ut);var v=t(p,2),m=t(s(v),2),w=s(m);Xe(w);var k=t(w,2);Xe(k),i(m),i(v);var y=t(v,2);de(y,()=>"website",()=>e(d).website,()=>"website",()=>"website");var _=t(y,2);de(_,()=>"wikipedia",()=>e(d).wikipedia,()=>"wikipedia",()=>"wikipedia");var u=t(_,2);de(u,()=>"wikidata_id",()=>e(d).wikidata_id,()=>"wikidata_id",()=>"wikidata_id");var h=t(u,2);de(h,()=>"osm_way_id",()=>e(d).osm_way_id,()=>"osm_way_id",()=>"osm_way_id");var D=t(h,2);de(D,()=>"npi_id",()=>e(d).npiId,()=>"npiId",()=>"npiId"),U((T,N)=>{_t(w,T),w.disabled=e(_e),_t(k,N),k.disabled=e(_e)},[()=>e(d).location?.lat?.toFixed(5)??"",()=>e(d).location?.lng?.toFixed(5)??""]),$e("blur",w,T=>tt("lat",T.currentTarget.value)),G("keydown",w,T=>{T.key==="Enter"&&T.currentTarget.blur()}),$e("blur",k,T=>tt("lng",T.currentTarget.value)),G("keydown",k,T=>{T.key==="Enter"&&T.currentTarget.blur()}),c(r,a)},Nt=r=>{var a=Eo(),n=oe(a);g(n,()=>"name",()=>e(d).name);var l=t(n,2);g(l,()=>"code",()=>e(d).code);var x=t(l,2);g(x,()=>"network",()=>e(d).network?.name);var p=t(x,2);g(p,()=>"region",()=>e(d).region?.name);var v=t(p,2);{let T=O(()=>e(d).location?.lat&&e(d).location?.lng?`${e(d).location.lat.toFixed(5)}, ${e(d).location.lng.toFixed(5)}`:null);g(v,()=>"location",()=>e(T))}var m=t(v,2);jr(m,()=>"website",()=>e(d).website?"facility website":null,()=>e(d).website,()=>"Website");var w=t(m,2);jr(w,()=>"wikipedia",()=>e(d).wikipedia,()=>e(d).wikipedia,()=>ir.wikipedia.label);var k=t(w,2);jr(k,()=>"wikidata_id",()=>e(d).wikidata_id,()=>e(d).wikidata_id?`${ir.wikidata.baseUrl}/${e(d).wikidata_id}`:null,()=>ir.wikidata.label);var y=t(k,2),_=t(s(y),2);{var u=T=>{var N=jo(),B=s(N),Z=s(B,!0),S=t(Z);
6ut(S,{size:10,class:"shrink-0"}),i(B);var me=t(B,2);{var fe=X=>{var K=ko();c(X,K)},te=X=>{var K=So();G("click",K,function(...le){C.onfetchosm?.apply(this,le)}),c(X,K)},q=X=>{var K=Fo();c(X,K)},se=X=>{var K=Co();G("click",K,function(...le){C.onfetchosm?.apply(this,le)}),c(X,K)},ge=X=>{var K=To();G("click",K,function(...le){C.onfetchosm?.apply(this,le)}),c(X,K)};E(me,X=>{ce()==="loading"?X(fe):ce()==="ok"?X(te,1):ce()==="not-found"?X(q,2):ce()==="error"?X(se,3):X(ge,-1)})}i(N),U(()=>{ae(B,"href",`${ir.openStreetMap.baseUrl}/way/${e(d).osm_way_id??""}`),ae(B,"title",`Open on ${ir.openStreetMap.label} (new tab)`),j(Z,e(d).osm_way_id)}),c(T,N)},h=T=>{var N=oa();c(T,N)};E(_,T=>{e(d).osm_way_id?T(u):T(h,-1)})}i(y);var D=t(y,2);g(D,()=>"npi_id",()=>e(d).npiId),c(r,a)};E(gr,r=>{e(I)?r(Ir):r(Nt,-1)})}i(Pt);var wt=t(Pt,2),xr=s(wt);Zr(xr,()=>"Description");var Mt=t(xr,2);{var yr=r=>{var a=Uo();Ea(a),U(()=>a.disabled=e(_e)),aa(a,()=>e(xe),n=>F(xe,n)),c(r,a)},Rr=r=>{var a=Oo();he(a,23,()=>e(d).description,(n,l)=>n._key||l,(n,l)=>{var x=Ke(),p=oe(x);{var v=m=>{var w=Lo(),k=s(w,!0);i(w),U(y=>j(k,y),[()=>e(l).children?.map(y=>y.text).join("")||""]),c(m,w)};E(p,m=>{e(l)._type==="block"&&m(v)})}c(n,x)}),i(a),c(r,a)},It=r=>{var a=Do();c(r,a)};E(Mt,r=>{e(I)?r(yr):e(d).description?.length>0?r(Rr,1):r(It,-1)})}i(wt);var kt=t(wt,2),br=s(kt);Zr(br,()=>"Owners");var Rt=t(br,2);{var hr=r=>{var a=Qr(),n=oe(a);{var l=m=>{var w=Ke(),k=oe(w);he(k,17,()=>e(d).owners,y=>y._id,(y,_)=>{var u=zo(),h=s(u),D=s(h,!0);i(h);var T=t(h,2),N=s(T);Tr(N,{size:10,class:"text-mid-grey"}),i(T),i(u),U(()=>{j(D,e(_).name||e(_).legal_name),T.disabled=e(_e)}),G("click",T,()=>Dr(e(_)._id)),c(y,u)}),c(m,w)};E(n,m=>{e(d).owners?.length>0&&m(l)})}var x=t(n,2);{var p=m=>{var w=Ao();c(m,w)},v=m=>{var w=Po(),k=s(w);{let y=O(()=>e(Ft).filter(_=>!e(d).owners?.some(u=>u._id===_.value)));ua(k,{get options(){return e(y)},selected:null,placeholder:"Add owner...",onselect:cr,get disabled(){return e(_e)}})}i(w),c(m,w)};E(x,m=>{e(vt)?m(p):m(v,-1)})}c(r,a)},Wr=r=>{var a=Ke(),n=oe(a);he(n,17,()=>e(d).owners,l=>l._id,(l,x)=>{var p=Ro(),v=s(p);{var m=_=>{var u=No(),h=s(u,!0),D=t(h);ut(D,{size:10,class:"shrink-0"}),i(u),U(()=>{ae(u,"href",e(x).website),j(h,e(x).name||e(x).legal_name)}),c(_,u)},w=_=>{var u=Mo(),h=s(u,!0);i(u),U(()=>j(h,e(x).name||e(x).legal_name)),c(_,u)};E(v,_=>{e(x).website?_(m):_(w,-1)})}var k=t(v,2);{var y=_=>{var u=Io(),h=s(u,!0);i(u),U(()=>{ae(u,"href",`mailto:${e(x).contact_email??""}`),ae(u,"title",`Send email to ${e(x).contact_email??""}`),j(h,e(x).contact_email)}),c(_,u)};E(k,_=>{e(x).contact_email&&_(y)})}i(p),c(l,p)}),c(r,a)},Wt=r=>{var a=Wo();c(r,a)};E(Rt,r=>{e(I)?r(hr):e(d).owners?.length>0?r(Wr,1):r(Wt,-1)})}i(kt);var Bt=t(kt,2);{var Br=r=>{var a=Bo(),n=t(s(a),2);he(n,17,()=>e(d).metadata_array,Xr,(l,x)=>{g(l,()=>e(x).key,()=>e(x).value)}),i(a),c(r,a)};E(Bt,r=>{e(d).metadata_array?.length>0&&r(Br)})}var wr=t(Bt,2);{var kr=r=>{var a=Ko(),n=s(a),l=s(n);i(n);var x=t(n,2);he(x,17,()=>e(d).units,p=>p._id,(p,v)=>{var m=$o(),w=s(m);{let T=O(()=>e(v).status||"operating");la(w,{get status(){return e(T)}})}var k=t(w,2),y=t(k,2),_=s(y,!0);i(y);var u=t(y,2),h=s(u,!0);i(u);var D=t(u,2);Gr(D,{size:10,class:"text-mid-grey/50"}),i(m),U((T,N)=>{Te(m,1,`w-full text-left grid grid-cols-[16px_8px_1fr_50px_14px] items-center gap-2 py-1.5 px-1 hover:bg-warm-grey/50 rounded transition-colors ${ee()===e(v).code?"bg-warm-grey/30":""}`),Ye(k,`background: ${T??""}`),j(_,e(v).code||"â"),j(h,N)},[()=>Ee(e(v).fuel_technology?.code),()=>Ge(e(v).capacity_registered)]),G("click",m,()=>C.onselectunit?.(e(v).code)),c(p,m)}),i(a),U(()=>j(l,`Units (${e(d).units.length??""})`)),c(r,a)};E(wr,r=>{e(d).units?.length>0&&r(kr)})}i(mr),i(yt);var $r=t(yt,2);{var A=r=>{var a=Zo(),n=s(a);ba(n,{axis:"x",get onstart(){return pe.start},get active(){return pe.isDragging},class:"border-l border-warm-grey"});var l=t(n,2),x=s(l);{let h=O(()=>e(_e)?"saving-hatch":"");ta(x,{get class(){return e(h)},children:(D,T)=>{var N=Jo(),B=oe(N);{let ge=O(()=>e(o)?.status||"operating");la(B,{get status(){return e(ge)}})}var Z=t(B,2),S=t(Z,2),me=s(S,!0);i(S);var fe=t(S,2),te=s(fe);ut(te,{size:8}),pt(),i(fe);var q=t(fe,2),se=s(q);Tr(se,{size:12,class:"text-mid-grey"}),i(q),U((ge,X)=>{Ye(Z,`background: ${ge??""}`),j(me,e(o)?.code),ae(fe,"href",X)},[()=>Ee(e(o)?.fuel_technology?.code),()=>ke(e(o)?._id,"unit")]),G("click",q,()=>C.onselectunit?.(null)),c(D,N)},$$slots:{default:!0}})}
6var p=t(x,2),v=s(p);{var m=h=>{var D=pa(),T=oe(D);L(T,()=>"code",()=>e(o)?.code,()=>"code",()=>"code",()=>"text");var N=t(T,2);Q(N,()=>"fuel_technology",()=>e(Ct),()=>e(o)?.fuel_technology?._id??null,()=>Nr);var B=t(N,2);g(B,()=>"ft_code",()=>e(o)?.fuel_technology?.code);var Z=t(B,2);{let H=O(()=>e(o)?.fuel_technology?.renewable!=null?String(e(o).fuel_technology.renewable):null);g(Z,()=>"renewable",()=>e(H))}var S=t(Z,2);Q(S,()=>"dispatch_type",()=>Ar,()=>e(o)?.dispatch_type??null,()=>pr);var me=t(S,2);g(me,()=>"ft_dispatch_type",()=>e(o)?.fuel_technology?.dispatch_type);var fe=t(me,2);Q(fe,()=>"status",()=>zr,()=>e(o)?.status??null,()=>ur);var te=t(fe,2);L(te,()=>"capacity_registered",()=>e(o)?.capacity_registered,()=>"capacity_registered",()=>"capacity_registered",()=>"number");var q=t(te,2);L(q,()=>"capacity_maximum",()=>e(o)?.capacity_maximum,()=>"capacity_maximum",()=>"capacity_maximum",()=>"number");var se=t(q,2);L(se,()=>"storage_capacity",()=>e(o)?.storage_capacity,()=>"storage_capacity",()=>"storage_capacity",()=>"number");var ge=t(se,2);L(ge,()=>"min_generation",()=>e(o)?.min_generation_capacity,()=>"min_generation_capacity",()=>"min_generation_capacity",()=>"number");var X=t(ge,2);{let H=O(()=>e(o)?.grid_forming!=null?String(e(o).grid_forming):"");L(X,()=>"grid_forming",()=>e(H),()=>"grid_forming",()=>"grid_forming",()=>"boolean")}var K=t(X,2);L(K,()=>"marginal_loss_factor",()=>e(o)?.marginal_loss_factor,()=>"marginal_loss_factor",()=>"marginal_loss_factor",()=>"number");var le=t(K,2);L(le,()=>"emissions_co2",()=>e(o)?.emissions_factor_co2,()=>"emissions_factor_co2",()=>"emissions_factor_co2",()=>"number");var Oe=t(le,2);L(Oe,()=>"emissions_source",()=>e(o)?.emissions_factor_source,()=>"emissions_factor_source",()=>"emissions_factor_source",()=>"text");var De=t(Oe,2);L(De,()=>"data_first_seen",()=>e(o)?.data_first_seen,()=>"data_first_seen",()=>"data_first_seen",()=>"text");var ze=t(De,2);L(ze,()=>"data_last_seen",()=>e(o)?.data_last_seen,()=>"data_last_seen",()=>"data_last_seen",()=>"text");var Ae=t(ze,2);{let H=O(()=>e(o)?.commissioning_confirmed!=null?String(e(o).commissioning_confirmed):"");L(Ae,()=>"commissioning_confirmed",()=>e(H),()=>"commissioning_confirmed",()=>"commissioning_confirmed",()=>"boolean")}var Pe=t(Ae,2);L(Pe,()=>"expected_operation",()=>e(o)?.expected_operation_date,()=>"expected_operation_date",()=>"expected_operation_date",()=>"text");var Ne=t(Pe,2);L(Ne,()=>"expected_op_specificity",()=>e(o)?.expected_operation_date_specificity,()=>"expected_operation_date_specificity",()=>"expected_operation_date_specificity",()=>"text");var Me=t(Ne,2);L(Me,()=>"expected_closure",()=>e(o)?.expected_closure_date,()=>"expected_closure_date",()=>"expected_closure_date",()=>"text");var Ie=t(Me,2);L(Ie,()=>"expected_cl_specificity",()=>e(o)?.expected_closure_date_specificity,()=>"expected_closure_date_specificity",()=>"expected_closure_date_specificity",()=>"text");var Re=t(Ie,2);L(Re,()=>"commencement_date",()=>e(o)?.commencement_date,()=>"commencement_date",()=>"commencement_date",()=>"text");var We=t(Re,2);L(We,()=>"commencement_specificity",()=>e(o)?.commencement_date_specificity,()=>"commencement_date_specificity",()=>"commencement_date_specificity",()=>"text");var qe=t(We,2);L(qe,()=>"closure_date",()=>e(o)?.closure_date,()=>"closure_date",()=>"closure_date",()=>"text");var $t=t(qe,2);L($t,()=>"closure_specificity",()=>e(o)?.closure_date_specificity,()=>"closure_date_specificity",()=>"closure_date_specificity",()=>"text");var Kt=t($t,2);L(Kt,()=>"construction_start",()=>e(o)?.construction_start_date,()=>"construction_start_date",()=>"construction_start_date",()=>"text");var Jt=t(Kt,2);L(Jt,()=>"construction_start_source",()=>e(o)?.construction_start_date_source,()=>"construction_start_date_source",()=>"construction_start_date_source",()=>"text");var Ht=t(Jt,2);L(Ht,()=>"construction_start_specificity",()=>e(o)?.construction_start_date_specificity,()=>"construction_start_date_specificity",()=>"construction_start_date_specificity",()=>"text");var Gt=t(Ht,2);L(Gt,()=>"construction_cost",()=>e(o)?.construction_cost,()=>"construction_cost",()=>"construction_cost",()=>"number");var Vt=t(Gt,2);L(Vt,()=>"construction_cost_source",()=>e(o)?.construction_cost_source,()=>"construction_cost_source",()=>"construction_cost_source",()=>"text");var Zt=t(Vt,2);{let H=O(()=>e(o)?.cis_tender_recipient!=null?String(e(o).cis_tender_recipient):"");L(Zt,()=>"cis_tender_recipient",()=>e(H),()=>"cis_tender_recipient",()=>"cis_tender_recipient",()=>"boolean")}var qt=t(Zt,2);L(qt,()=>"epbc_id",()=>e(o)?.epbc_id,()=>"epbc_id",()=>"epbc_id",()=>"text");var Qt=t(qt,2);L(Qt,()=>"epbc_number",()=>e(o)?.epbc_number,()=>"epbc_number",()=>"epbc_number",()=>"text");var Xt=t(Qt,2);L(Xt,()=>"expected_closure_source",()=>e(o)?.expected_closure_date_source,()=>"expected_closure_date_source",()=>"expected_closure_date_source",()=>"text");var Yt=t(Xt,2);L(Yt,()=>"project_approval_date",()=>e(o)?.project_approval_date,()=>"project_approval_date",()=>"project_approval_date",()=>"text");var er=t(Yt,2);L(er,()=>"project_approval_source",()=>e(o)?.project_approval_date_source,()=>"project_approval_date_source",()=>"project_approval_date_source",()=>"text");var tr=t(er,2);L(tr,()=>"project_approval_lodgement",()=>e(o)?.project_approval_lodgement_date,()=>"project_approval_lodgement_date",()=>"project_approval_lodgement_date",()=>"text");var rr=t(tr,2);L(rr,()=>"state_approval_date",()=>e(o)?.state_approval_date,()=>"state_approval_date",()=>"state_approval_date",()=>"text");var ar=t(rr,2);L(ar,()=>"state_approval_source",()=>e(o)?.state_approval_source,()=>"state_approval_source",()=>"state_approval_source",()=>"text");var or=t(ar,2);L(or,()=>"state_lodgement_date",()=>e(o)?.state_lodgement_date,()=>"state_lodgement_date",()=>"state_lodgement_date",()=>"text");var nr=t(or,2);{var Kr=H=>{var Be=Ke(),lt=oe(Be);he(lt,16,()=>e(ft),be=>be,(be,ve)=>{{let ct=O(()=>Ot(e(o)?.[ve])),Fa=O(()=>zt(e(o)?.[ve]));Ue(be,()=>ve,()=>e(ct),()=>ve,()=>ve,()=>e(Fa))}}),c(H,Be)};E(nr,H=>{e(ft).length>0&&H(Kr)})}var Jr=t(nr,2);{var Hr=H=>{var Be=Ke(),lt=oe(Be);he(lt,16,()=>e(Ve),be=>be,(be,ve)=>{{let ct=O(()=>Ze(e(o)?.[ve])?gt(e(o)[ve]):JSON.stringify(e(o)[ve]));ne(be,()=>ve,()=>e(ct))}}),c(H,Be)};E(Jr,H=>{e(Ve).length>0&&H(Hr)})}c(h,D)},w=h=>{var D=pa(),T=oe(D);g(T,()=>"code",()=>e(o)?.code);var N=t(T,2);g(N,()=>"fuel_technology",()=>e(o)?.fuel_technology?.name);var B=t(N,2);g(B,()=>"ft_code",()=>e(o)?.fuel_technology?.code);var Z=t(B,2);{let H=O(()=>e(o)?.fuel_technology?.renewable!=null?String(e(o).fuel_technology.renewable):null);g(Z,()=>"renewable",()=>e(H))}var S=t(Z,2);g(S,()=>"dispatch_type",()=>e(o)?.dispatch_type);var me=t(S,2);g(me,()=>"ft_dispatch_type",()=>e(o)?.fuel_technology?.dispatch_type);var fe=t(me,2);g(fe,()=>"status",()=>e(o)?.status);var te=t(fe,2);g(te,()=>"capacity_registered",()=>e(o)?.capacity_registered!=null?`${e(o).capacity_registered} MW`:null);var q=t(te,2);g(q,()=>"capacity_maximum",()=>e(o)?.capacity_maximum!=null?`${e(o).capacity_maximum} MW`:null);var se=t(q,2);g(se,()=>"storage_capacity",()=>e(o)?.storage_capacity!=null?`${e(o).storage_capacity} MWh`:null);var ge=t(se,2);g(ge,()=>"min_generation",()=>e(o)?.min_generation_capacity!=null?`${e(o).min_generation_capacity} MW`:null);var X=t(ge,2);{let H=O(()=>e(o)?.grid_forming!=null?String(e(o).grid_forming):null);g(X,()=>"grid_forming",()=>e(H))}var K=t(X,2);g(K,()=>"marginal_loss_factor",()=>e(o)?.marginal_loss_factor);var le=t(K,2);g(le,()=>"emissions_co2",()=>e(o)?.emissions_factor_co2);var Oe=t(le,2);g(Oe,()=>"emissions_source",()=>e(o)?.emissions_factor_source);var De=t(Oe,2);g(De,()=>"data_first_seen",()=>e(o)?.data_first_seen);var ze=t(De,2);g(ze,()=>"data_last_seen",()=>e(o)?.data_last_seen);var Ae=t(ze,2);{let H=O(()=>e(o)?.commissioning_confirmed!=null?String(e(o).commissioning_confirmed):null);g(Ae,()=>"commissioning_confirmed",()=>e(H))}var Pe=t(Ae,2);g(Pe,()=>"expected_operation",()=>e(o)?.expected_operation_date);var Ne=t(Pe,2);g(Ne,()=>"expected_op_specificity",()=>e(o)?.expected_operation_date_specificity);var Me=t(Ne,2);g(Me,()=>"expected_closure",()=>e(o)?.expected_closure_date);var Ie=t(Me,2);g(Ie,()=>"expected_cl_specificity",()=>e(o)?.expected_closure_date_specificity);var Re=t(Ie,2);g(Re,()=>"commencement_date",()=>e(o)?.commencement_date);var We=t(Re,2);g(We,()=>"commencement_specificity",()=>e(o)?.commencement_date_specificity);var qe=t(We,2);g(qe,()=>"closure_date",()=>e(o)?.closure_date);var $t=t(qe,2);g($t,()=>"closure_specificity",()=>e(o)?.closure_date_specificity);var Kt=t($t,2);g(Kt,()=>"construction_start",()=>e(o)?.construction_start_date);var Jt=t(Kt,2);g(Jt,()=>"construction_start_source",()=>e(o)?.construction_start_date_source);var Ht=t(Jt,2);g(Ht,()=>"construction_start_specificity",()=>e(o)?.construction_start_date_specificity);var Gt=t(Ht,2);g(Gt,()=>"construction_cost",()=>e(o)?.construction_cost);var Vt=t(Gt,2);g(Vt,()=>"construction_cost_source",()=>e(o)?.construction_cost_source);var Zt=t(Vt,2);{let H=O(()=>e(o)?.cis_tender_recipient!=null?String(e(o).cis_tender_recipient):null);g(Zt,()=>"cis_tender_recipient",()=>e(H))}var qt=t(Zt,2);g(qt,()=>"epbc_id",()=>e(o)?.epbc_id);var Qt=t(qt,2);g(Qt,()=>"epbc_number",()=>e(o)?.epbc_number);var Xt=t(Qt,2);g(Xt,()=>"expected_closure_source",()=>e(o)?.expected_closure_date_source);var Yt=t(Xt,2);g(Yt,()=>"project_approval_date",()=>e(o)?.project_approval_date);var er=t(Yt,2);g(er,()=>"project_approval_source",()=>e(o)?.project_approval_date_source);var tr=t(er,2);g(tr,()=>"project_approval_lodgement",()=>e(o)?.project_approval_lodgement_date);var rr=t(tr,2);g(rr,()=>"state_approval_date",()=>e(o)?.state_approval_date);var ar=t(rr,2);g(ar,()=>"state_approval_source",()=>e(o)?.state_approval_source);var or=t(ar,2);g(or,()=>"state_lodgement_date",()=>e(o)?.state_lodgement_date);var nr=t(or,2);{var Kr=H=>{var Be=Ke(),lt=oe(Be);he(lt,16,()=>e(ft),be=>be,(be,ve)=>{{let ct=O(()=>Ot(e(o)?.[ve]));ne(be,()=>ve,()=>e(ct))}}),c(H,Be)};E(nr,H=>{e(ft).length>0&&H(Kr)})}var Jr=t(nr,2);{var Hr=H=>{var Be=Ke(),lt=oe(Be);he(lt,16,()=>e(Ve),be=>be,(be,ve)=>{{let ct=O(()=>Ze(e(o)?.[ve])?gt(e(o)[ve]):JSON.stringify(e(o)[ve]));ne(be,()=>ve,()=>e(ct))}}),c(H,Be)};E(Jr,H=>{e(Ve).length>0&&H(Hr)})}c(h,D)};E(v,h=>{e(I)?h(m):h(w,-1)})}var k=t(v,2);{var y=h=>{var D=Go(),T=s(D),N=s(T);i(T);var B=t(T,2);he(B,19,()=>e(o).unit_types,(Z,S)=>Z._id||S,(Z,S,me)=>{var fe=Qr(),te=oe(fe);{var q=K=>{var le=Ho();c(K,le)};E(te,K=>{e(me)>0&&K(q)})}var se=t(te,2);{var ge=K=>{var le=va(),Oe=oe(le);W(Oe,()=>e(S),()=>"unit_number",()=>e(S).unit_number,()=>"unit_number",()=>"unit_number",()=>"number");var De=t(Oe,2);W(De,()=>e(S),()=>"unit_size",()=>e(S).unit_size,()=>"unit_size",()=>"unit_size",()=>"text");var ze=t(De,2);W(ze,()=>e(S),()=>"capacity",()=>e(S).capacity,()=>"capacity",()=>"capacity",()=>"number");var Ae=t(ze,2);W(Ae,()=>e(S),()=>"brand",()=>e(S).unit_brand,()=>"unit_brand",()=>"unit_brand",()=>"text");var Pe=t(Ae,2);W(Pe,()=>e(S),()=>"model",()=>e(S).unit_model,()=>"unit_model",()=>"unit_model",()=>"text");var Ne=t(Pe,2);W(Ne,()=>e(S),()=>"model_year",()=>e(S).unit_model_year,()=>"unit_model_year",()=>"unit_model_year",()=>"text");var Me=t(Ne,2);W(Me,()=>e(S),()=>"model_url",()=>e(S).unit_model_url,()=>"unit_model_url",()=>"unit_model_url",()=>"text");var Ie=t(Me,2);W(Ie,()=>e(S),()=>"height",()=>e(S).unit_height,()=>"unit_height",()=>"unit_height",()=>"number");var Re=t(Ie,2);W(Re,()=>e(S),()=>"weight",()=>e(S).unit_weight,()=>"unit_weight",()=>"unit_weight",()=>"number");var We=t(Re,2);W(We,()=>e(S),()=>"mounting_type",()=>e(S).mounting_type,()=>"mounting_type",()=>"mounting_type",()=>"text");var qe=t(We,2);W(qe,()=>e(S),()=>"efficiency",()=>
6e(S).unit_efficiency,()=>"unit_efficiency",()=>"unit_efficiency",()=>"number"),c(K,le)},X=K=>{var le=va(),Oe=oe(le);g(Oe,()=>"unit_number",()=>e(S).unit_number);var De=t(Oe,2);g(De,()=>"unit_size",()=>e(S).unit_size);var ze=t(De,2);g(ze,()=>"capacity",()=>e(S).capacity!=null?`${e(S).capacity} MW`:null);var Ae=t(ze,2);g(Ae,()=>"brand",()=>e(S).unit_brand);var Pe=t(Ae,2);g(Pe,()=>"model",()=>e(S).unit_model);var Ne=t(Pe,2);g(Ne,()=>"model_year",()=>e(S).unit_model_year);var Me=t(Ne,2);jr(Me,()=>"model_url",()=>e(S).unit_model_url?"model website":null,()=>e(S).unit_model_url,()=>"Manufacturer");var Ie=t(Me,2);g(Ie,()=>"height",()=>e(S).unit_height!=null?`${e(S).unit_height} m`:null);var Re=t(Ie,2);g(Re,()=>"weight",()=>e(S).unit_weight!=null?`${e(S).unit_weight} t`:null);var We=t(Re,2);g(We,()=>"mounting_type",()=>e(S).mounting_type);var qe=t(We,2);g(qe,()=>"efficiency",()=>e(S).unit_efficiency!=null?`${e(S).unit_efficiency}%`:null),c(K,le)};E(se,K=>{e(I)?K(ge):K(X,-1)})}c(Z,fe)}),i(D),U(()=>j(N,`Unit Types (${e(o).unit_types.length??""})`)),c(h,D)};E(k,h=>{e(o)?.unit_types?.length>0&&h(y)})}var _=t(k,2);{var u=h=>{var D=Vo(),T=t(s(D),2);he(T,17,()=>e(o).metadata_array,Xr,(N,B)=>{g(N,()=>e(B).key,()=>e(B).value)}),i(D),c(h,D)};E(_,h=>{e(o)?.metadata_array?.length>0&&h(u)})}i(p),i(l),i(a),U(()=>Ye(a,`width: ${pe.value??""}px;`)),xa(3,a,()=>ya,()=>({axis:"x",duration:200})),c(r,a)};E($r,r=>{e(we)&&r(A)})}i(dt);var P=t(dt,2);{let r=O(()=>!!e(J));Wa(P,{get open(){return e(r)},variant:"lightbox",onclick:()=>F(ie,-1),duration:150})}var re=t(P,2);{var ue=r=>{var a=en(),n=s(a),l=s(n);Tr(l,{size:20}),i(n);var x=t(n,2);{var p=u=>{var h=Qr(),D=oe(h);{var T=Z=>{var S=qo(),me=s(S);Gr(me,{size:24,class:"rotate-180"}),i(S),G("click",S,()=>Sr(ie,-1)),c(Z,S)};E(D,Z=>{e(ie)>0&&Z(T)})}var N=t(D,2);{var B=Z=>{var S=Qo(),me=s(S);Gr(me,{size:24}),i(S),G("click",S,()=>Sr(ie)),c(Z,S)};E(N,Z=>{e(ie)<(e(d).photos?.length??1)-1&&Z(B)})}c(u,h)};E(x,u=>{e(d).photos?.length>1&&u(p)})}var v=t(x,2),m=s(v),w=t(m,2);{var k=u=>{var h=Xo(),D=s(h,!0),T=t(D);{var N=B=>{var Z=sa();U(()=>j(Z,`${e(J)?.caption?" â ":""}${e(J)?.attribution??""}`)),c(B,Z)};E(T,B=>{e(J)?.attribution&&B(N)})}i(h),U(()=>j(D,e(J)?.caption||"")),c(u,h)};E(w,u=>{(e(J)?.caption||e(J)?.attribution)&&u(k)})}var y=t(w,2);{var _=u=>{var h=Yo(),D=s(h);i(h),U(()=>j(D,`${e(ie)+1} / ${e(d).photos.length??""}`)),c(u,h)};E(y,u=>{e(d).photos?.length>1&&u(_)})}i(v),i(a),Ma(a,u=>Ra?.(u)),U(u=>{ae(m,"src",u),ae(m,"alt",e(J)?.alt||e(J)?.caption||`${e(d).name} photo`)},[()=>e(J)?.asset?e(M)(e(J)).url():e(J)?.url]),G("click",n,()=>F(ie,-1)),c(r,a)};E(re,r=>{e(J)&&r(ue)})}i(xt),U(()=>vr=Ye(xt,"",vr,{"background-color":e(I)?"rgb(254 252 232)":""})),c(Se,xt),dr()}ia(["keydown","click"]);var an=b('<span class="animate-pulse">â¦</span>'),on=Oa('<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6l4 4 4-4"></path></svg>'),nn=b("<button> </button>"),sn=b('<div class="absolute left-0 top-full z-20 mt-1 min-w-[120px] rounded border border-warm-grey bg-white shadow-sm overflow-hidden"></div>'),dn=b('<div class="relative"><button> <!></button> <!></div>'),ln=b('<span class="text-[10px] text-mid-grey"> </span>'),cn=b('<span class="text-[10px] text-mid-grey"> </span> <button class="text-[10px] px-1.5 py-0.5 border border-warm-grey rounded text-mid-grey hover:text-dark-grey hover:border-dark-grey transition-colors inline-flex items-center gap-1"><!> SIGN OUT</button>',1),_n=b("<div><!></div>"),un=b('<span class="text-[12px] font-medium text-dark-grey flex-1 truncate">Facilities</span> <span class="text-[10px] text-mid-grey tabular-nums"> </span> <button>MAP</button>',1),pn=b('<button><span class="w-2 h-2 rounded-full"></span> <span class="text-[11px] text-dark-grey truncate"> </span> <span class="flex justify-center"><!></span> <span class="flex justify-center"><!></span> <span class="text-[10px] text-mid-grey tabular-nums text-right"> </span></button>'),vn=b('<div class="px-3 py-8 text-center text-[11px] text-mid-grey">No results</div>'),mn=b('<div class="flex-1 flex items-center justify-center text-[11px] text-mid-grey">Select a facility</div>'),fn=b('<div class="flex flex-col h-dvh overflow-hidden font-mono"><div><span class="text-[11px] font-medium text-dark-grey tracking-wide uppercase">CMS Facilities</span> <!> <span class="ml-auto"></span> <!></div> <!> <div class="flex flex-1 min-h-0"><div class="shrink-0 border-r border-warm-grey flex flex-col min-h-0"><!> <div class="px-3 py-2 border-b border-warm-grey"><div class="relative"><!> <input type="search" placeholder="Filter..." class="w-full pl-7 pr-3 py-1.5 text-[11px] font-mono border border-warm-grey rounded bg-white hover:border-dark-grey focus:border-dark-grey focus:outline-none"/></div></div> <div class="flex-1 overflow-y-auto" tabindex="0"><!> <!></div></div> <!> <div class="flex-1 flex flex-col min-h-0"><!></div></div> <div class="border-t border-warm-grey bg-light-warm-grey/50 px-4 py-1.5 flex flex-wrap items-center gap-x-4 gap-y-0.5 text-[10px] text-mid-grey"><span><strong class="text-dark-grey"> </strong> fac</span> <span><strong class="text-dark-grey"> </strong> units</span> <span class="border-l border-warm-grey pl-4">oper <strong class="text-dark-grey"> </strong></span> <span>commit <strong class="text-dark-grey"> </strong></span> <span>ret <strong class="text-dark-grey"> </strong> MW</span> <span class="border-l border-warm-grey pl-4">photos:<strong class="text-dark-grey"> </strong></span> <span>loc:<strong class="text-dark-grey"> </strong></span> <span>no-loc:<strong class="text-dark-grey"> </strong></span> <span>desc:<strong class="text-dark-grey"> </strong></span></div></div>');function oi(Se,C){sr(C,!0);const g=ha(),de=Ua("layout-fullscreen");de?.setFullscreen(!0),Ta(()=>de?.setFullscreen(!1));let Q=$(Qe([]));et(()=>{F(Q,C.data.facilities,!0)});let L=$(!1),W=$(!1),ne=$(!1),Ue=O(()=>C.data.sanity.dataset==="production"),Fe=O(()=>C.data.sanity.dataset==="staging"),je=$(""),ee=$(Qe(typeof localStorage<"u"?localStorage.getItem("cms-explorer-show-map")==="true":!1));et(()=>{typeof localStorage<"u"&&localStorage.setItem("cms-explorer-show-map",String(e(ee)))});const ce="/studio/cms-facilities";let M=O(()=>da.params.facility_code??null),d=O(()=>da.params.unit_code??null),Ce=$(null),pe=$(null),we=$(null),o=$("idle"),ie=$(!1);ma(()=>{F(ie,!0);function f(z){e(ne)&&F(ne,!1)}return document.addEventListener("pointerdown",f),()=>document.removeEventListener("pointerdown",f)});const J=ra({axis:"x",min:200,max:600,initial:250,storageKey:"cms-explorer-list-width"}),Ge=ra({axis:"y",min:150,max:600,initial:300,storageKey:"cms-explorer-map-height"});let Ee=$(null),rt=$("");function ke(f){F(je,f,!0),e(Ee)&&clearTimeout(e(Ee)),F(Ee,setTimeout(()=>{F(rt,f,!0)},150),!0)}let I=O(()=>{const f=e(rt).toLowerCase().trim();return f?e(Q).filter(z=>!!(z.name?.toLowerCase().includes(f)||z.code?.toLowerCase().includes(f)||z.network?.name?.toLowerCase().includes(f)||z.region?.name?.toLowerCase().includes(f)||z.units?.some(Y=>Y.code?.toLowerCase().includes(f))||z.units?.some(Y=>Y.fuel_technology?.name?.toLowerCase().includes(f)))):e(Q)}),xe=O(()=>e(M)?e(Q).find(f=>f.code===e(M))??null:null),ye=O(()=>{const f=e(Q).flatMap(V=>V.units||[]),z=f.filter(V=>V.status==="operating").reduce((V,Le)=>V+(Le.capacity_registered||0),0),Y=f.filter(V=>V.status==="committed").reduce((V,Le)=>V+(Le.capacity_registered||0),0),Je=f.filter(V=>V.status==="retired").reduce((V,Le)=>V+(Le.capacity_registered||0),0);return{totalFacilities:e(Q).length,totalUnits:f.length,operatingCap:z,committedCap:Y,retiredCap:Je,withPhotos:e(Q).filter(V=>V.photos?.length>0).length,withLocation:e(Q).filter(V=>V.location?.lat&&V.location?.lng).length,missingLocation:e(Q).filter(V=>!V.location?.lat||!V.location?.lng).length,withDescription:e(Q).filter(V=>V.description?.length>0).length}}),Ft=O(()=>({type:"FeatureCollection",features:e(Q).filter(f=>f.location?.lat&&f.location?.lng).map(f=>{const z=f.units?.[0]?.fuel_technology?.code,Y=z&&ea[z]||"#888";return{type:"Feature",geometry:{type:"Point",coordinates:[f.location.lng,f.location.lat]},properties:{id:f._id,name:f.name,code:f.code,colour:Y}}})}));function at(f){if(e(M)===f){Ct();return}Cr(`${ce}/${f}`,{noScroll:!0,keepFocus:!0})}function Ct(){Cr(ce,{noScroll:!0,keepFocus:!0})}function Tt(f){e(M)&&(f?Cr(`${ce}/${e(M)}/${f}`,{noScroll:!0,keepFocus:!0}):Cr(`${ce}/${e(M)}`,{noScroll:!0,keepFocus:!0}))}
6function ot(f){return f==null?"â":f.toLocaleString("en-AU",{maximumFractionDigits:1})}function vt(f){return f?ea[f]||"#888":"#ccc"}function _e(f){const z=f.features?.[0];if(!z)return;const Y=z.properties?.code;Y&&at(Y)}function Er(f){if(f.key!=="ArrowDown"&&f.key!=="ArrowUp")return;f.preventDefault();const z=e(I);if(!z.length)return;const Y=e(M)?z.findIndex(V=>V.code===e(M)):-1;let Je;f.key==="ArrowDown"?Je=Y<z.length-1?Y+1:0:Je=Y>0?Y-1:z.length-1,at(z[Je].code),Fr().then(()=>{e(Ce)?.querySelector(`[data-fid="${z[Je].code}"]`)?.scrollIntoView({block:"nearest"})})}let mt=O(()=>e(M)?["==",["get","code"],e(M)]:void 0),jt=O(()=>e(M)?"/map-styles/satellite.json":"/map-styles/positron.json");const nt={type:"FeatureCollection",features:[]};let Ur=O(()=>e(we)?{type:"FeatureCollection",features:[e(we)]}:nt);function lr(f){!f?.location?.lat||!f?.location?.lng||!e(pe)||(f.osm_way_id&&ca(f.osm_way_id)?_a(f.osm_way_id).then(z=>{if(e(M)===f.code)if(z){F(we,z,!0),F(o,"ok");const Y=Vr(z);e(pe)?.fitBounds(Y,{padding:40,maxZoom:16,duration:600})}else e(pe)?.flyTo({center:[f.location.lng,f.location.lat],zoom:14,duration:600})}):e(pe).flyTo({center:[f.location.lng,f.location.lat],zoom:14,duration:600}))}et(()=>{const f=e(xe);if(!f){F(we,null),F(o,"idle"),e(pe)&&e(pe).flyTo({center:[134,-25],zoom:3.5,duration:600});return}F(we,null),F(o,f.osm_way_id&&ca(f.osm_way_id)?"ok":"idle",!0),La(()=>e(ee))&&Fr().then(()=>lr(f))});function Et(){lr(e(xe))}function Lr(){const f=e(xe);if(!(!f?.osm_way_id||e(o)==="loading")){if(e(o)==="ok"&&e(we)){F(ee,!0),Fr().then(()=>{if(e(pe)){const z=Vr(e(we));e(pe).fitBounds(z,{padding:40,maxZoom:16,duration:600})}});return}F(o,"loading"),_a(f.osm_way_id).then(z=>{e(M)===f.code&&(F(we,z,!0),z?(F(o,"ok"),F(ee,!0),Fr().then(()=>{if(e(pe)){const Y=Vr(z);e(pe).fitBounds(Y,{padding:40,maxZoom:16,duration:600})}})):F(o,"not-found"))}).catch(()=>{e(M)===f.code&&F(o,"error")})}}function Or(f){const z=e(Q).findIndex(Y=>Y._id===f._id);z>=0&&(e(Q)[z]=f)}Ka(Se,{redirectUrl:"/studio/cms-facilities",children:(f,z)=>{var Y=Ke(),Je=oe(Y);{var V=Le=>{var Ut=fn(),tt=s(Ut),cr=t(s(tt),2);{var Dr=A=>{var P=dn(),re=s(P),ue=s(re),r=t(ue);{var a=p=>{var v=an();c(p,v)},n=p=>{var v=on();U(()=>Te(v,0,`w-2.5 h-2.5 transition-transform ${e(ne)?"rotate-180":""}`)),c(p,v)};E(r,p=>{e(L)?p(a):p(n,-1)})}i(re);var l=t(re,2);{var x=p=>{var v=sn();he(v,21,()=>C.data.sanity.availableDatasets,Xr,(m,w)=>{var k=nn(),y=s(k,!0);i(k),U(()=>{Te(k,1,`w-full text-left px-2 py-1.5 text-[10px] transition-colors ${e(w)===C.data.sanity.dataset?"bg-warm-grey/40 font-medium text-dark-grey":"text-mid-grey hover:bg-warm-grey/30 hover:text-dark-grey"}`),j(y,e(w))}),G("click",k,async()=>{F(ne,!1),e(w)!==C.data.sanity.dataset&&(F(L,!0),document.cookie=`cms-dataset=${e(w)};path=/;max-age=31536000`,await Pa(),F(L,!1))}),c(m,k)}),i(v),c(p,v)};E(l,p=>{e(ne)&&p(x)})}i(P),U(()=>{Te(re,1,`text-[10px] px-1.5 py-0.5 border rounded transition-colors flex items-center gap-1 ${e(Ue)?"text-red border-red/30 bg-red/5 hover:border-red/50":e(Fe)?"":"text-mid-grey border-warm-grey hover:border-dark-grey"}`),Ye(re,e(Fe)?"color: rgb(161 98 7); border-color: rgb(202 138 4 / 0.3); background: rgb(254 243 199 / 0.5)":""),re.disabled=e(L)||e(W),j(ue,`${C.data.sanity.dataset??""} `)}),G("pointerdown",P,p=>p.stopPropagation()),G("click",re,()=>F(ne,!e(ne))),c(A,P)},zr=A=>{var P=ln(),re=s(P,!0);i(P),U(()=>j(re,C.data.sanity.dataset)),c(A,P)};E(cr,A=>{C.data.sanity.availableDatasets.length>1?A(Dr):A(zr,-1)})}var Ar=t(cr,4);{var Pr=A=>{var P=cn(),re=oe(P),ue=s(re,!0);i(re);var r=t(re,2),a=s(r);Ga(a,{size:10}),pt(),i(r),U(()=>j(ue,g.user.primaryEmailAddress?.emailAddress)),G("click",r,()=>g.instance?.signOut({redirectUrl:window.location.href})),c(A,P)};E(Ar,A=>{g.user&&A(Pr)})}i(tt);var Lt=t(tt,2);{var ft=A=>{var P=_n(),re=s(P);Da(re,()=>Ca(()=>import("../chunks/CyqBW2sg.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),import.meta.url),null,(ue,r)=>{var a=O(()=>{var{default:p}=e(r);return{FacilityMap:p}}),n=O(()=>e(a).FacilityMap),l=Ke(),x=oe(l);za(x,()=>e(n),(p,v)=>{v(p,{get mapStyle(){return e(jt)},get geojson(){return e(Ft)}
6,get osmGeoJson(){return e(Ur)},get circleFilter(){return e(mt)},get facilityCode(){return e(M)},get mapDrag(){return Ge},onload:Et,onclickmarker:_e,get map(){return e(pe)},set map(m){F(pe,m,!0)}})}),c(ue,l)}),i(P),xa(3,P,()=>ya,()=>({duration:200})),c(A,P)};E(Lt,A=>{e(ee)&&A(ft)})}var Ve=t(Lt,2),Ze=s(Ve),it=s(Ze);ta(it,{children:(A,P)=>{var re=un(),ue=t(oe(re),2),r=s(ue);i(ue);var a=t(ue,2);U(()=>{j(r,`${e(I).length??""}/${e(Q).length??""}`),Te(a,1,`text-[10px] px-1.5 py-0.5 border rounded transition-colors ml-1 ${e(ee)?"border-dark-grey bg-dark-grey text-white":"border-warm-grey text-mid-grey hover:text-dark-grey hover:border-dark-grey"}`)}),G("click",a,()=>F(ee,!e(ee))),c(A,re)},$$slots:{default:!0}});var gt=t(it,2),Ot=s(gt),Dt=s(Ot);Ja(Dt,{class:"absolute left-2 top-1/2 -translate-y-1/2 text-mid-grey",size:12});var zt=t(Dt,2);Xe(zt),i(Ot),i(gt);var He=t(gt,2),st=s(He);he(st,17,()=>e(I),A=>A._id,(A,P)=>{const re=O(()=>e(P).units?.reduce((_,u)=>_+(u.capacity_registered||0),0));var ue=pn(),r=s(ue),a=t(r,2),n=s(a,!0);i(a);var l=t(a,2),x=s(l);{var p=_=>{Qa(_,{size:10,class:"text-mid-grey/70"})};E(x,_=>{e(P).photos?.length>0&&_(p)})}i(l);var v=t(l,2),m=s(v);{var w=_=>{Ha(_,{size:10,class:"text-mid-grey/70"})};E(m,_=>{e(P).location?.lat&&e(P).location?.lng&&_(w)})}i(v);var k=t(v,2),y=s(k,!0);i(k),i(ue),U((_,u)=>{ae(ue,"data-fid",e(P).code),Te(ue,1,`w-full text-left px-3 py-2 grid grid-cols-[8px_1fr_12px_12px_50px] items-center gap-2 border-b border-warm-grey/60 transition-colors cursor-pointer hover:bg-warm-grey/50 7 ${e(M)===e(P).code?"bg-warm-grey":""}`),Ye(r,`background: ${_??""}`),j(n,e(P).name||"Unnamed"),j(y,u)},[()=>vt(e(P).units?.[0]?.fuel_technology?.code),()=>ot(e(re))]),G("click",ue,()=>at(e(P).code)),c(A,ue)});var _r=t(st,2);{var Nr=A=>{var P=vn();c(A,P)};E(_r,A=>{e(I).length===0&&A(Nr)})}i(He),Yr(He,A=>F(Ce,A),()=>e(Ce)),i(Ze);var ur=t(Ze,2);ba(ur,{axis:"x",get onstart(){return J.start},get active(){return J.isDragging},class:"border-r border-warm-grey"});var pr=t(ur,2),Mr=s(pr);{var xt=A=>{rn(A,{get facility(){return e(xe)},get dataset(){return C.data.sanity.dataset},get selectedUnitCode(){return e(d)},get osmStatus(){return e(o)},onclose:Ct,onselectunit:Tt,onfetchosm:Lr,onupdate:Or,onbusy:P=>F(W,P,!0)})},vr=A=>{var P=mn();c(A,P)};E(Mr,A=>{e(xe)?A(xt):A(vr,-1)})}i(pr),i(Ve);var At=t(Ve,2),dt=s(At),yt=s(dt),mr=s(yt,!0);i(yt),pt(),i(dt);var bt=t(dt,2),fr=s(bt),Pt=s(fr,!0);i(fr),pt(),i(bt);var ht=t(bt,2),gr=t(s(ht)),Ir=s(gr,!0);i(gr),i(ht);var Nt=t(ht,2),wt=t(s(Nt)),xr=s(wt,!0);i(wt),i(Nt);var Mt=t(Nt,2),yr=t(s(Mt)),Rr=s(yr,!0);i(yr),pt(),i(Mt);var It=t(Mt,2),kt=t(s(It)),br=s(kt,!0);i(kt),i(It);var Rt=t(It,2),hr=t(s(Rt)),Wr=s(hr,!0);i(hr),i(Rt);var Wt=t(Rt,2),Bt=t(s(Wt)),Br=s(Bt,!0);i(Bt),i(Wt);var wr=t(Wt,2),kr=t(s(wr)),$r=s(kr,!0);i(kr),i(wr),i(At),i(Ut),U((A,P,re)=>{Te(tt,1,`flex items-center gap-3 px-4 py-2 border-b transition-colors ${e(Ue)?"border-red/20 bg-red/5":e(Fe)?"":"border-warm-grey bg-light-warm-grey/50"}`),Ye(tt,e(Fe)?"border-color: rgb(202 138 4 / 0.2); background: rgb(254 243 199 / 0.4)":""),Ye(Ze,`width: ${J.value??""}px;`),_t(zt,e(je)),j(mr,e(ye).totalFacilities),j(Pt,e(ye).totalUnits),j(Ir,A),j(xr,P),j(Rr,re),j(br,e(ye).withPhotos),j(Wr,e(ye).withLocation),j(Br,e(ye).missingLocation),j($r,e(ye).withDescription)},[()=>ot(e(ye).operatingCap),()=>ot(e(ye).committedCap),()=>ot(e(ye).retiredCap)]),G("input",zt,A=>ke(A.currentTarget.value)),G("keydown",He,Er),c(Le,Ut)};E(Je,Le=>{e(ie)&&Le(V)})}c(f,Y)},$$slots:{default:!0}}),dr()}ia(["pointerdown","click","input","keydown"]);export{oi as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.