import{dp as w,U as m,P as l,Y as g,O as y,Z as $,R as h,cW as T,u as F,dq as v,aw as r,cI as I,D as b,dr as j,ds as S,d4 as x,N as C}from"./index-m7Z9H1b_.js";const U=w("browse",{state:()=>({groups:[{id:"opportunities",icon:["fal","cloud-rainbow"],to:"/browse/vacancies",visible:["home","detail"],class:m,canUseShortcuts:!0,active:e=>m.types.map(s=>m.typePlural(s)).includes(e.params.browseType),types:[...m.types.map(e=>{const s=m.typePlural(e);return{id:s,hasFeatured:!1,icon:m.typeIcon(e),count:0,theme:"noImage",active:i=>i.params.browseType===s}}),{id:"calls-for-projects",hasFeatured:!1,icon:["fal","megaphone"],count:0,theme:"noImage",active:e=>e.params.browseType==="calls-for-projects"}],classes:"col-lg-4"},{id:"profiles",icon:["fal","id-card-clip"],to:"/browse/individuals",visible:["home","detail"],class:l,active:e=>l.typesPlural.includes(e.params.browseType),types:[{id:"individuals",hasFeatured:!1,icon:["fal","street-view"],sortActions:(e,s)=>l.browseSorts(e,s),active:e=>e.params.browseType==="individuals",cover:"/images/bg/individual.png",theme:"hasImage"},{id:"ensembles",hasFeatured:!1,icon:["fal","draw-circle"],sortActions:(e,s)=>l.browseSorts(e,s),active:e=>e.params.browseType==="ensembles",cover:"/images/bg/individual.png",theme:"hasImage"},{id:"promoters",hasFeatured:!1,icon:["fal","microphone-alt"],sortActions:(e,s)=>l.browseSorts(e,s),active:e=>e.params.browseType==="promoters",cover:"/images/bg/individual.png",theme:"hasImage"},{id:"foundations",hasFeatured:!1,icon:["fal","landmark-alt"],sortActions:(e,s)=>l.browseSorts(e,s),active:e=>e.params.browseType==="foundations",cover:"/images/bg/individual.png",theme:"hasImage"},{id:"associations",hasFeatured:!1,icon:["fal","users"],sortActions:(e,s)=>l.browseSorts(e,s),active:e=>e.params.browseType==="associations",cover:"/images/bg/individual.png",theme:"hasImage"},{id:"agencies",hasFeatured:!1,icon:["fal","user-secret"],sortActions:(e,s)=>l.browseSorts(e,s),active:e=>e.params.browseType==="agencies",cover:"/images/bg/individual.png",theme:"hasImage"},{id:"institutions",hasFeatured:!1,icon:["fal","landmark"],sortActions:(e,s)=>l.browseSorts(e,s),active:e=>e.params.browseType==="institutions",cover:"/images/bg/individual.png",theme:"hasImage"},{id:"companies",hasFeatured:!1,icon:["fal","building"],sortActions:(e,s)=>l.browseSorts(e,s),active:e=>e.params.browseType==="companies",cover:"/images/bg/individual.png",theme:"hasImage"}],classes:"col-lg-4 col-xl-3"},{id:"formats",label:"event-formats",icon:["fal","brackets-curly"],to:"/browse/festivals-concert-series",visible:["home","detail"],class:g,active:e=>g.browseTypes.includes(e.params.browseType),types:[{id:"festivals-concert-series",hasFeatured:!1,icon:["fal","list-music"],active:e=>e.params.browseType==="festivals-concert-series",cover:"/images/bg/individual.png",theme:"hasImage"},{id:"conferences",hasFeatured:!1,icon:["fal","keynote"],active:e=>e.params.browseType==="conferences",cover:"/images/bg/individual.png",theme:"hasImage"}]},{id:"projects",icon:["fal","lightbulb-on"],to:"/browse/concerts",visible:["detail"],class:y,active:e=>y.types.includes(e.params.browseType),types:[{id:"concerts",hasFeatured:!1,label:"concert-performance",active:e=>e.params.browseType==="concerts"},{id:"workshops",hasFeatured:!1,active:e=>e.params.browseType==="workshops"}]},{id:"venues",icon:["fal","map-marker-alt"],to:"/browse/venues",visible:["detail"],hasFeatured:!1,class:$,active:e=>e.params.browseType==="venues",types:[]},{id:"other",icon:null,to:null,visible:["home"],types:[{id:"projects",to:"concerts",icon:["fal","lightbulb-on"],cover:"/images/bg/individual.png",theme:"hasImage"},{id:"venues",icon:["fal","map-marker-alt"],cover:"/images/bg/individual.png",theme:"hasImage"}]}]}),getters:{appliedFilters:e=>{const s=h(e.$router.currentRoute.value.query);return delete s.query,s},hasAppliedFilter:e=>s=>Object.keys(e.filters).includes(s),months:()=>T(),searchQuery:e=>e.$router.currentRoute.value.query.query??"",isFiltered:e=>e.hasFilters||e.searchQuery!=="",hasFilters:e=>Object.keys(e.filters).length>0,filters:e=>{const s=F(),i=h(e.appliedFilters);return Object.keys(i).forEach(n=>{if(n==="languageSkills"&&(i.languageSkills=i.languageSkills.split(",").map(a=>s.allLanguages.find(o=>o.code===decodeURIComponent(a)))),n==="experiences"&&(i.experiences=i.experiences.split(",").map(a=>`experiences.${decodeURIComponent(a)}`)),n==="specialisations"&&(i.specialisations=i.specialisations.split(",").map(a=>`specialisations.${decodeURIComponent(a)}`)),n==="audiences"&&(i.audiences=i.audiences.split(",").map(a=>`audience.${decodeURIComponent(a)}`)),n==="monthsActive"&&(i.monthsActive=i.monthsActive.split(",").map(a=>parseInt(decodeURIComponent(a)))),n==="durations"&&(i.durations=i.durations.split(",").map(a=>decodeURIComponent(a))),n==="venueLayout"&&(i.venueLayout=i.venueLayout.split(",").map(a=>decodeURIComponent(a))),n==="oppCategories"&&(i.oppCategories=i.oppCategories.split(",").map(a=>decodeURIComponent(a))),n==="oppSubTypes"&&(i.oppSubTypes=i.oppSubTypes.split(",").map(a=>decodeURIComponent(a))),n==="location"){let[a,o]=i.location.split(";");a=parseInt(decodeURIComponent(a)),o=JSON.parse(v.decompressFromEncodedURIComponent(o)),i.location={radius:a,place:o}}if(n==="foundation"){let[a,o,t]=i.foundation.split(";");i.foundation={foundingYear:decodeURIComponent(a)},i.foundation.foundingYear==="null"&&(i.foundation.foundingYear=null),o!=null&&(i.foundation.minFoundingYear=parseInt(decodeURIComponent(o))),t!=null&&(i.foundation.maxFoundingYear=parseInt(decodeURIComponent(t)))}if(["expertises","expertisesEnsemble"].includes(n)){let[a,o]=i[n].split(";");i[n]={expertise:a,subExpertises:JSON.parse(v.decompressFromEncodedURIComponent(o))}}["yearlyEvents","premiere","projectStatus","venueType"].includes(n)&&(i[n]=decodeURIComponent(i[n]))}),i},filterType:e=>s=>["experiences","specialisations","audiences","languageSkills","monthsActive","durations","venueLayout","oppCategories","oppSubTypes"].includes(s)?"array":["foundation","location","expertises","expertisesEnsemble"].includes(s)?"object":"string",filterValue:e=>s=>{if(["experiences","specialisations","audiences"].includes(s))return e.filters[s].map(i=>r(i,{$capitalize:!0})).join(", ");if(s==="monthsActive")return e.filters[s].map(i=>r(`months.short.${i}`,{$capitalize:!0})).join(", ");if(s==="languageSkills")return e.filters[s].map(i=>i.name).join(", ");if(s==="durations")return e.filters[s].map(i=>r(`itemTypes.project-duration.${i}`)).join(", ");if(s==="premiere")return r(`itemTypes.${decodeURIComponent(e.filters[s])}`,{$capitalize:!0});if(s==="projectStatus")return r(y.browseStatusOptions.find(i=>i.value===e.filters[s]).label,{$capitalize:!0});if(s==="venueType")return r(`itemTypes.venueTypes.${decodeURIComponent(e.filters[s])}`,{$capitalize:!0});if(s==="venueLayout")return e.filters[s].map(i=>r(`forms.venues.${i}`,{$capitalize:!0})).join(", ");if(s==="oppCategories")return e.filters[s].map(i=>r(`oppCategories.${i}`,{$capitalize:!0})).join(", ");if(s==="oppSubTypes")return e.filters[s].map(i=>r(`occupationTypes.${i}`,{$capitalize:!0})).join(", ");if(s==="location")return r("general.location-around-radius",{radius:e.filters[s].radius,city:e.filters[s].place.city,country:r(`countries.${e.filters[s].place.countryCode}`,{$capitalize:!0})});if(s==="foundation"){let i=decodeURIComponent(e.filters[s].foundingYear)==="null"?null:decodeURIComponent(e.filters[s].foundingYear);if(i===null)return r("forms.years.any",{$capitalize:!0});if(i!=="specific")return r(l.foundingYearOptions.find(n=>n.value===e.filters[s].foundingYear).label,{$capitalize:!0});if(i==="specific")return r("forms.years.between",{min:e.filters[s].minFoundingYear,max:e.filters[s].maxFoundingYear},{$capitalize:!0})}return s==="yearlyEvents"?r("titles.yearly-events-count",{count:decodeURIComponent(e.filters[s])},{$capitalize:!0}):["expertises","expertisesEnsemble"].includes(s)?e.filters[s].subExpertises.length>0?e.filters[s].subExpertises.length===1&&e.filters[s].subExpertises[0].instruments.length===0?e.filters[s].expertise.endsWith("-ensemble")?`${r(e.filters[s].expertise,{$capitalize:!0})}: ${r(e.filters[s].subExpertises[0].value,{$capitalize:!0})}`:r(e.filters[s].subExpertises[0].value,{$capitalize:!0}):e.filters[s].subExpertises.map(i=>i.instruments.map(n=>r(n,{$capitalize:!0}))).flat().join(", "):r(`${e.filters[s].expertise==="any-expertise"?"titles.":""}${e.filters[s].expertise}`,{$capitalize:!0}):e.filterType(s)==="string"?decodeURIComponent(e.filters[s]):""}},actions:{updateGroups(e=null){return new Promise((s,i)=>{I.get("/browse",{}).then(n=>{if(n.status===200){const a=this.groups.find(t=>t.id==="opportunities");typeof a<"u"&&n.data.data.counts.forEach(t=>{if(t.type==="calls-for-projects"){const u=a.types.find(c=>c.id===t.type);typeof u<"u"&&(u.count=t.count)}else{const u=m.typePlural(t.type),c=a.types.find(p=>p.id===u);typeof c<"u"&&(c.count=t.count)}});const o=n.data.data.settings??{};Object.keys(o).forEach(t=>{const u=this.groups.find(c=>c.id===t);if(typeof u<"u"&&(e!==null&&u.id===e.id||e===null)){if(Object.keys(o[t]).some(c=>typeof o[t][c]=="object"&&!Array.isArray(o[t][c]))){if(Object.keys(o[t]).forEach(c=>{const p=u.types.find(d=>d.id===c);typeof p<"u"&&typeof o[t][p.id].cover<"u"&&(p.cover=`${b.assetsEndpoint}${o[t][p.id].cover}`),typeof p<"u"&&typeof o[t][p.id].hasFeatured<"u"&&(p.hasFeatured=o[t][p.id].hasFeatured)}),t==="projects"){const p=this.groups.find(f=>f.id==="other").types.find(f=>f.id==="projects"),d=Object.keys(o[t]).flatMap(f=>typeof o[t][f].cover>"u"?[]:[o[t][f].cover]);d.length>0&&(p.cover=`${b.assetsEndpoint}${d[j(0,d.length)]}`)}}else if(u.id==="venues"){typeof o[t].hasFeatured<"u"&&(u.hasFeatured=o[t].hasFeatured);const p=this.groups.find(d=>d.id==="other").types.find(d=>d.id==="venues");typeof o[t].cover<"u"&&(p.cover=`${b.assetsEndpoint}${o[t].cover}`)}}}),s()}else i("An error occurred.")})})},getItems(e,s=null){const i=S.get("authToken"),n=i===null?{}:{headers:{"x-access-token":i}};return new Promise((a,o)=>{const t=x(h(this.$router.currentRoute.value.query));I.get(`/browse/${e}${s!==null?`/${s}`:""}${t!==""?`?${t}`:""}`,n).then(u=>{if(u.status===200){const c={opportunities:m,profiles:l,formats:g,projects:y,venues:$};a({items:u.data.data.items.map(p=>s==="calls-for-projects"?new C(p):new c[e](p)),moreItems:u.data.data.moreItems})}else o("An error occurred.")}).catch(u=>{o(u)})})},setSearchQuery(e){const s=this.appliedFilters;e===""?delete s.query:s.query=e,(typeof s.query>"u"||s.query===""||s.query.length>1)&&this.$router.push({query:s})},clearFilters(){this.$router.push({query:typeof this.searchQuery<"u"&&this.searchQuery!==""&&this.searchQuery.length>1?{query:this.searchQuery}:{}})},removeFilter(e){const s=h(this.appliedFilters);delete s[e];const i=this.searchQuery,n=i!==""&&i.length>1?{query:i}:{};this.$router.push({query:{...n,...s}})},addFilter(e){const s={...this.filters},i=Object.keys(e)[0];delete s[i],this.setFilters({...s,...e})},setFilters(e){e.languageSkills!=null&&(e.languageSkills=e.languageSkills.map(n=>n.code)),e.experiences!=null&&(e.experiences=e.experiences.map(n=>n.replace("experiences.",""))),e.specialisations!=null&&(e.specialisations=e.specialisations.map(n=>n.replace("specialisations.",""))),e.audiences!=null&&(e.audiences=e.audiences.map(n=>n.replace("audience.",""))),e.premiere!=null&&(e.premiere==null||e.premiere==="")&&delete e.premiere,e.projectStatus!=null&&(e.projectStatus==null||e.projectStatus==="")&&delete e.projectStatus,e.venueType!=null&&(e.venueType==null||e.venueType==="")&&delete e.venueType;const s=this.searchQuery,i=s!==""&&s.length>1?{query:s}:{};Object.keys(e).forEach(n=>{if(this.filterType(n)==="array"&&(i[n]=e[n].map(a=>encodeURIComponent(a)).join(",")),this.filterType(n)==="object"){const a=h(e[n]);i[n]=Object.keys(a).map(o=>["number","string"].includes(typeof a[o])||a[o]===null?encodeURIComponent(a[o]):v.compressToEncodedURIComponent(JSON.stringify(a[o]))).join(";")}this.filterType(n)==="string"&&(i[n]=encodeURIComponent(e[n]))}),this.$router.push({query:i})}},debounce:{setSearchQuery:400}});export{U as u};