import f from"./BO68gtrV.js";import{_}from"./DhtwWfYD.js";import{_ as h,o as r,b as a,f as m,U as p,V as x,c as n,z as L,A as g,t as k,B,E as y}from"./Btao4aSW.js";import"./C1EMyjZw.js";import"./DZ3sZauA.js";const b={props:{facet:{type:Object,required:!0},selected:{type:Array,default:()=>[]},openByDefault:{type:Boolean,default:!1}},emits:["update:selected"],data(){return{showFullList:!1}},computed:{facetLengthLimit(){return this.facet.values.length<12||!this.openByDefault}},methods:{isSelected(c){var t;let o=!1;return(t=this.selected)==null||t.forEach(l=>{l===c&&(o=!0)}),o},toggleValue(c,o){var i;let t=!1;const l=((i=this.selected)==null?void 0:i.filter(s=>s===c?(t=!0,!1):!0))||[];!t&&!o||(t||l.push(c),this.$emit("update:selected",l))},toggleList(){this.showFullList=!this.showFullList}}},C={class:"checkbox-facet"};function F(c,o,t,l,i,s){const d=f,u=_;return r(),a("div",C,[m("ul",{class:B(["checkbox-facet__list",{"checkbox-facet__list--full":i.showFullList||s.facetLengthLimit}])},[(r(!0),a(p,null,x(t.facet.values,e=>(r(),n(d,{key:e.id||e.text,text:e.id||e.text,"is-selected":s.isSelected(e.id||e.text),"is-disabled":!e.count,onClick:w=>s.toggleValue(e.id||e.text,e.count)},{default:L(()=>[g(k(e.text),1)]),_:2},1032,["text","is-selected","is-disabled","onClick"]))),128))],2),s.facetLengthLimit?y("",!0):(r(),n(u,{key:0,expanded:i.showFullList,onClick:s.toggleList},null,8,["expanded","onClick"]))])}const z=h(b,[["render",F]]);export{z as default};