1import{_ as g}from"./Djn93nbf.js";import{_ as m,o as i,c as n,e as o,t as c,b as p,F as T,Z as _,n as f,q as d,S as k,bC as S,m as y}from"./Bv6rD22K.js";import{u}from"./C7yT8Dih.js";const w={name:"TagPicker",props:{forumTags:{type:Array,required:!0},truncation:{type:Boolean,default:!1},withinForm:{type:Boolean,default:!0}},data(){return{search:"",limit:3,truncationLimit:8,expanded:!1,isDesktop:!1}},computed:{...y(u,["selectedTags"]),truncatedTagCount(){return this.forumTags?this.forumTags.length-this.filteredTags.length:0},filteredTags(){if(!this.forumTags)return[];if(!this.search)return this.truncateTags(this.forumTags);const e=this.forumTags.filter(t=>t.name.toLowerCase().includes(this.search.toLowerCase()));return this.truncateTags(e)},promptForTagSelection(){return this.withinForm?"Select a category below to help other community members find your discussion":"Select a category to find topics that interest you."},showTruncationButton(){return this.showTruncated&&this.truncatedTagCount>0},showTruncated(){return this.truncation&&!this.expanded&&!this.isDesktop}},mounted(){this.isDesktop=S()},methods:{expandTruncation(){this.expanded=!0},truncateTags(e){return this.showTruncated?e.slice(0,this.truncationLimit):e},searchTags(e){this.search=e},selectTag(e){let t="setSelectedTags";const a=this.selectedTags;if(this.selectedTags.length>=this.limit&&!a.includes(e.id)){k().addToastNotification({toastType:"error",description:`You may only select up to ${this.limit} tags`,type:"Forum"});return}a.includes(e.id)&&(t="removeSelectedTag",a.splice(a.indexOf(e.id),1)),a.push(e.id),t==="setSelectedTags"&&u().setSelectedTags(a),t==="removeSelectedTag"&&u().removeSelectedTag(a),this.$emit("tagsSelected",a)},tagIsSelected(e){return this.selectedTags.includes(e.id)}}},x={class:"tag-picker"},b={class:"tag-picker__instructions"},C={class:"tag-picker__tag-list inline-list"},F=["onClick"],B={key:0,class:"tag-picker__no-tags"};function v(e,t,a,D,l,s){const h=g;return i(),n("div",x,[t[1]||(t[1]=o("h2",{class:"tag-picker__heading heading--4"}," Categories ",-1)),o("p",b,c(s.promptForTagSelection),1),p(h,{id:"tagPickerSearch",term:l.search,placeholder:"Search categories","aria-label":"Search categories","wrapper-attrs":{role:"searchbox"},"is-form":!1,"data-test-id":"tag-picker-search-form",onInput:s.searchTags},null,8,["term","onInput"]),o("ol",C,[(i(!0),n(T,null,_(s.filteredTags,r=>(i(),n("li",{key:`tag-${r.id}`},[o("button",{type:"button",class:f(["tag-picker__tag",{"tag-picker__tag--selected":s.tagIsSelected(r)}]),"data-test-id":"tag-picker-tag",onClick:I=>s.selectTag(r)},c(r.name),11,F)]))),128))]),s.filteredTags.length===0?(i(),n("p",B," Sorry, we couldnât find any categories that match. ")):d("",!0),s.showTruncationButton?(i(),n("button",{key:1,class:"tag-picker__expand-button",onClick:t[0]||(t[0]=(...r)=>s.expandTruncation&&s.expandTruncation(...r))},"Show "+c(s.truncatedTagCount)+" more",1)):d("",!0)])}const V=Object.assign(m(w,[["render",v],["__scopeId","data-v-38be53f3"]]),{__name:"TagPicker"});export{V as _};
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.