1import{b9 as S,cy as I,ca as c}from"./Bl3OJams.js";import{o as k}from"./Cm4lzhd8.js";import{u as P}from"./BxBDZzMd.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new r.Error().stack;n&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[n]="cfb57b2f-57e8-44c9-b9a5-620e7585ff8b",r._sentryDebugIdIdentifier="sentry-dbid-cfb57b2f-57e8-44c9-b9a5-620e7585ff8b")}catch{}})();const $=12,b={pertinence:{orderBy:"startsAt",order:"ASC"},recent:{orderBy:"startsAt",order:"ASC"},ancien:{orderBy:"startsAt",order:"DESC"}};function q(r="auth"){const n=r==="public"?"workshops:public":"workshops",{apiFetch:y}=S(),{publicFetch:g}=P(),{user:p,waitForAuthReady:m}=I();function v(){return r==="auth"||p.value?y:g}const u=c(`${n}:list`,()=>[]),s=c(`${n}:loading`,()=>!1),l=c(`${n}:hasMore`,()=>!1),f=c(`${n}:endCursor`,()=>null),d=c(`${n}:totalCount`,()=>0);let o=0;function h(e){const t={first:String($)};e.q?.trim()&&(t.q=e.q.trim()),e.cycleIds?.length&&(t.cycleIds=e.cycleIds.join(",")),e.format&&(t.format=e.format),r==="auth"&&e.registration&&e.registration!==k.ALL&&(t.registration=e.registration);const i=b[e.sortBy??"pertinence"]??b.pertinence;return t.orderBy=i.orderBy,t.order=i.order,e.after&&(t.after=e.after),new URLSearchParams(t).toString()}async function w(e){await m();const t=++o;s.value=!0;try{const i=h(e),a=await v()(`/ateliers?${i}`);if(t!==o)return;u.value=a.items,l.value=a.hasNextPage,f.value=a.endCursor,d.value=a.totalCount}finally{t===o&&(s.value=!1)}}async function A(e){if(!l.value||s.value||!f.value)return;const t=++o;s.value=!0;try{const i=h({...e,after:f.value}),a=await v()(`/ateliers?${i}`);if(t!==o)return;u.value=[...u.value,...a.items],l.value=a.hasNextPage,f.value=a.endCursor,d.value=a.totalCount}finally{t===o&&(s.value=!1)}}function C(){o++,u.value=[],l.value=!1,f.value=null,d.value=0,s.value=!1}return{workshops:u,loading:s,hasMore:l,totalCount:d,fetchWorkshops:w,loadMore:A,reset:C}}export{q 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.