1import{cH as w,eR as g,ep as m,dV as C,c$ as d,bt as f,at as p,ew as F,dI as K}from"./BQpWByWK.js";import{u as M}from"./BDYPYTBS.js";import{b as L}from"./DXbo10_u.js";import{u as $}from"./4ocfwtbW.js";import{u as U}from"./CUadyxDe.js";import{c as E}from"./C18WhYeR.js";const h=()=>F().public.apiBase||void 0;function D(e,a={}){const t=typeof e=="string"?d(e):e,n=d(""),{data:s,pending:u,error:i}=$(`channel-detail-${t.value}`,async()=>{if(!t.value)return n.value="",null;const l=t.value;try{return await $fetch(`/api/app/channels/${l}`,{baseURL:h(),credentials:"include",headers:f()})}catch{return null}finally{n.value=l}},{watch:[t],default:()=>null}),r=async()=>{if(!t.value)return;const l=t.value;try{const o=await $fetch(`/api/app/channels/${l}`,{baseURL:h(),credentials:"include",headers:f()});if(l!==t.value)return;s.value=o,n.value=l}catch{}};return w(r),g(t,r),{data:s,isLoading:u,error:i,refetch:r,fetchedId:n}}function G(){return M({mutationFn:async e=>await $fetch(`/api/app/channels/${e}/subscribe`,{method:"POST",baseURL:h(),credentials:"include",headers:f()})})}function x(e){const a=typeof e=="string"?d(e):e,{region:t}=U();return m({queryKey:["channel-products",a,L,t],queryFn:async()=>await $fetch(`/api/app/channels/${a.value}/products`,{baseURL:h(),credentials:"include",headers:f(),query:{region:t.value}}),placeholderData:n=>n,enabled:p(()=>!!a.value),retry:!1})}const q=30;function N(e,a,t){const n=typeof e=="string"?d(e):e;return m({queryKey:["channel-aggregate-paged",n,a,t],queryFn:async()=>{const s=a.value??{},u=Math.max(0,t.value-1)*q;return await $fetch(`/api/app/channels/${n.value}/aggregate`,{baseURL:h(),credentials:"include",headers:f(),params:{skip:u,take:q,country:s.country||"",state:s.state||"",city:s.city||"",q:s.q||"",cats:s.cats||""}})},enabled:p(()=>!!n.value),placeholderData:s=>s,retry:!1})}function H(e,a){const t=typeof e=="string"?d(e):e;return m({queryKey:["channel-cat-about",t,a],queryFn:async()=>await $fetch(`/api/app/channels/${t.value}/category-about`,{baseURL:h(),credentials:"include",headers:f(),params:{path:JSON.stringify(a.value?.path||[])}}),enabled:p(()=>!!t.value&&(a.value?.path?.length||0)>0),retry:!1})}function T(e){const a=typeof e=="string"?d(e):e,t=()=>({identity:null,installed:[],modulesOk:!1}),n=async()=>{const i=a.value;if(!i)return t();const r={baseURL:h(),credentials:"include",headers:f()},[l,o]=await Promise.all([$fetch(`/api/app/channels/${i}`,r).catch(()=>null),$fetch(`/api/app/channels/${i}/modules`,r).catch(()=>null)]);return{identity:l,installed:o?.installed||[],modulesOk:!!o}},{data:s}=$(()=>`channel-rail-${a.value}`,n,{watch:[a],default:t}),u=async()=>{if(a.value)try{s.value=await n()}catch{}};{const i=C();let r="";const l=()=>{if(!i.resolved.value||!i.isAuthenticated.value)return;const o=a.value;!o||r===o||(r=o,u())};w(l),g([i.resolved,i.isAuthenticated],l),g(a,u)}return{data:s,refetchRail:u}}function B(e){const a=typeof e=="string"?d(e):e,t=async()=>{const u=a.value;return u?await $fetch(`/api/app/channels/${u}`,{baseURL:h(),credentials:"include",headers:f()}).catch(()=>null):null},{data:n}=$(()=>`channel-rail-identity-${a.value}`,t,{watch:[a],default:()=>null}),s=async()=>{if(a.value)try{n.value=await t()}catch{}};return w(s),g(a,s),n}function J(e){const a=typeof e=="string"?d(e):e,t=async()=>{const c=a.value;if(!c)return null;try{return await $fetch(`/api/app/channels/${c}/modules`,{baseURL:h(),credentials:"include",headers:f()})}catch{return null}},n=d(0),s=async()=>{const c=await t();return c?n.value=0:n.value++,c},{data:u,pending:i}=$(()=>`channel-modules-ssr-${a.value}`,s,{default:()=>null}),r=async()=>{if(!a.value)return;const c=await s();if(c){u.value=c;return}if(!u.value&&n.value<2){await new Promise(y=>setTimeout(y,1200));const v=await s();v&&(u.value=v)}};{const c=C();let v="";const y=()=>{const b=a.value;!b||v===b||c.resolved.value&&(!c.isAuthenticated.value&&u.value||(v=b,r()))};w(y),g([c.resolved,c.isAuthenticated],y),g(a,r),g(E,r)}const l=p(()=>!u.value&&n.value>=2),o=p(()=>!l.value&&(i.value||!u.value));return{data:u,pending:o,failed:l,refetch:r}}function Q(e){const a=typeof e=="string"?d(e):e;return m({queryKey:["channel-modules",a],queryFn:async()=>await $fetch(`/api/app/channels/${a.value}/modules`,{baseURL:h(),credentials:"include",headers:f()}),enabled:p(()=>!!a.value),refetchOnMount:"always",retry:1})}const A=24;function V(e,a,t,n,s,u){const i=typeof e=="string"?d(e):e,r=typeof a=="str
1ing"?d(a):a,l=p(()=>(u?.value||"").trim()),o=p(()=>s?.value==="members"?"members":""),c=p(()=>{const y=n?.value;return y&&y.length?JSON.stringify(y):""}),{region:v}=U();return m({queryKey:["channel-module-items",i,r,o,c,l,t,L,v],queryFn:async()=>{const y=Math.max(0,(t.value||1)-1)*A;return await $fetch(`/api/app/channels/${i.value}/module`,{baseURL:h(),credentials:"include",headers:f(),query:{module:r.value,take:A,startIndex:y,...c.value?{cat:c.value}:{},...o.value?{source:o.value}:{},...l.value?{scopeColumnId:l.value}:{},region:v.value}})},enabled:p(()=>!!i.value&&!!r.value),placeholderData:(y,b)=>{const R=b?.queryKey;if(R)return R[1]===i.value&&R[2]===r.value&&R[3]===o.value&&R[4]===c.value&&R[5]===l.value?y:void 0},retry:!1})}function Y(e){const a=typeof e=="string"?d(e):e;return m({queryKey:["channel-children",a],queryFn:async()=>await $fetch(`/api/app/channels/${a.value}/children`,{baseURL:h(),credentials:"include",headers:f()}),enabled:p(()=>!!a.value),retry:!1})}function Z(e){const a=typeof e=="string"?d(e):e,{data:t}=$(()=>`channel-seo-links-${a.value}`,async()=>({links:[],probeFailed:!0}),{watch:[a],default:()=>({links:[],probeFailed:!0})});return t}function j(e,a,t){const n=typeof e=="string"?d(e):e,s=typeof a=="string"?d(a):a;return m({queryKey:["channel-members",n,s],queryFn:async()=>await $fetch(`/api/app/channels/${n.value}/${s.value}`,{baseURL:h(),credentials:"include",headers:f()}),enabled:p(()=>!!n.value&&K(t)),retry:!1})}export{q as A,A as C,N as a,Y as b,D as c,J as d,j as e,V as f,Q as g,x as h,T as i,B as j,Z as k,G as l,H as u};
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.