1const n="https://boards-api.greenhouse.io/v1/boards/awin/jobs?content=true";Alpine.store("vacancies",{vacancies:[],filtered:[],visible:[],departments:[],offices:[],loading:!1,loaded:!1,error:"",search:"",department:"all",office:"all",page:1,hasMore:!0,observer:null,get isFiltered(){return this.search.trim()!==""||this.department!=="all"||this.office!=="all"},resetFilters(){this.search="",this.department="all",this.office="all",this.page=1,this.filter()},async fetch(){if(!this.loaded){this.loading=!0,this.error="";try{const e=await window.fetch(n);if(!e.ok)throw new Error(`Failed to fetch vacancies: ${e.status}`);const a=await e.json();this.vacancies=a.jobs.map(t=>({...t,office:t.location?.name?.split(",")[0]?.trim()??"Unknown"})).sort((t,i)=>new Date(i.updated_at).getTime()-new Date(t.updated_at).getTime());const s=new Map;for(const t of this.vacancies)for(const i of t.departments)s.has(i.id)||s.set(i.id,i);this.departments=[...s.values()].sort((t,i)=>t.name.localeCompare(i.name)),this.offices=[...new Set(this.vacancies.map(t=>t.office))].sort(),this.loadSearchParams(),this.filter(),this.loaded=!0}catch(e){console.error(e),this.error="Unable to load vacancies"}finally{this.loading=!1}}},loadSearchParams(){const e=new URLSearchParams(window.location.search),a=e.get("search"),s=e.get("department"),t=e.get("office");if(a&&(this.search=a),s){const i=this.departments.find(r=>r.name===s);i&&(this.department=`${i.id}`)}t&&this.offices.includes(t)&&(this.office=t)},updateSearchParams(){const e=new URLSearchParams;if(this.search.trim()&&e.set("search",this.search.trim()),this.department!=="all"){const s=this.departments.find(t=>`${t.id}`===this.department);s&&e.set("department",s.name)}this.office!=="all"&&e.set("office",this.office);const a=e.toString();window.history.replaceState({},"",a?`${window.location.pathname}?${a}`:window.location.pathname)},filter(){const e=this.search.toLowerCase().trim();this.filtered=this.vacancies.filter(a=>{const s=!e||a.title.toLowerCase().includes(e)||a.office.toLowerCase().includes(e),t=this.department==="all"||a.departments.some(r=>`${r.id}`===this.department),i=this.office==="all"||a.office===this.office;return s&&t&&i}),this.page=1,this.updateVisible(),this.updateSearchParams()},updateVisible(){const e=this.page*12;this.visible=this.filtered.slice(0,e),this.hasMore=e<this.filtered.length},loadMore(){this.hasMore&&(this.page++,this.updateVisible())},initInfiniteScroll(e){this.observer?.disconnect(),this.observer=new IntersectionObserver(a=>{a.some(s=>s.isIntersecting)&&this.loadMore()},{rootMargin:"400px"}),this.observer.observe(e)}});const o={4037316003:"departmentB2B",4037317003:"departmentCSPM",4037318003:"departmentFinance",4037319003:"departmentHR",4037320003:"departmentIT",4037321003:"departmentLegal",4037322003:"departmentMarketing",4037323003:"departmentOfficeManagement",4037324003:"departmentOperations",4037325003:"departmentProductResearchDevelopment",4037436003:"departmentTechnicalSupp
1ort"};function c(){return{labels:{},getDepartmentLabel(e){const a=o[e.id];return(a?this.labels[a]:void 0)||e.name},async init(){this.labels=JSON.parse(this.$root.dataset.labels),await Alpine.store("vacancies").fetch()}}}export{c as default};
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.