import{c as p}from"./AppLayout-5c633aaa.js";import{q as d,u as h,v as e,y as i,J as c,K as m,P as b,D as _,_ as v}from"./vue-0d7ee8e8.js";import{_ as f}from"./_plugin-vue_export-helper-b15b4a05.js";const y={props:{isPart:{type:Boolean,default:!1},strings:Object,regex:String,params:{type:Object,default(){return{}}}},data(){return{letters:this.params.hasOwnProperty("letters")&&this.params.letters?this.params.letters:"",pattern:this.params.hasOwnProperty("pattern")&&this.params.pattern?this.params.pattern:"",joker:this.params.hasOwnProperty("joker")&&this.params.joker?this.params.joker:"",dictionary:this.params.hasOwnProperty("dictionary")&&this.params.dictionary?this.params.dictionary:"all",clearIcon:p,lang:document.documentElement.lang}},methods:{clear(o){this[o]=""},formValidate(o){document.querySelectorAll(".scrabble-search-form-error").forEach(n=>{n.remove()});var s=!0,t=!1;return o.forEach((n,a)=>{var l=n.dataset.maxlength;l?l=`{0,${l}}`:l="*";var r=n.value,u=new RegExp(`^[${n.dataset.allowed}]${l}$`,"g");u.test(r)||(s=!1,n.closest("div").insertAdjacentHTML("afterend",`<p class="scrabble-search-form-error text-red-600 font-bold text-sm mt-1">${this.strings["field-validation-error"]}</p>`)),r!==""&&(t=!0)}),s*t},submit(){this.formValidate(document.querySelectorAll("#scrabble-search-form .search-box-input"))&&document.getElementById("scrabble-search-form").submit()}}},g=["action"],x=["innerHTML"],k={class:"search-box"},j=["placeholder","data-allowed"],w=["src"],M={class:"search-box"},L=["placeholder","data-allowed"],T=["src"],H={class:"relative w-full"},P=["innerHTML"],S=["innerHTML"],V=["innerHTML"],C=e("div",{class:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-4"},[e("div",{class:"icon icon-chevron-down"})],-1),E=["innerHTML"],O={class:"mx-4 radio-box"},B=["checked"],I=e("div",{class:"radio-label"},[e("span",null,"0")],-1),q={class:"radio-box"},A=["checked"],U=e("div",{class:"radio-label"},[e("span",null,"1")],-1),D={class:"mx-4 radio-box"},F=["checked"],N=e("div",{class:"radio-label"},[e("span",null,"2")],-1),z={class:"flex pt-3 px-3 justify-center"},J=["aria-label","innerHTML"];function K(o,s,t,n,a,l){return d(),h("form",{class:i("form "+(t.isPart?"transparent":"")+" scrabble-search-form amp"),id:"scrabble-search-form",method:"get",action:o.route("scrabble.search"),onSubmit:s[5]||(s[5]=v((...r)=>l.submit&&l.submit(...r),["prevent"]))},[e("label",{class:i("form-label "+(t.isPart?"":"text-center")),innerHTML:t.strings.label},null,10,x),e("div",{class:i(t.isPart?"pb-3":"md:p-3 py-3")},[e("div",k,[c(e("input",{type:"text",class:"search-box-input pe-10",placeholder:t.strings.letters,name:"letters","data-allowed":t.regex,"onUpdate:modelValue":s[0]||(s[0]=r=>a.letters=r)},null,8,j),[[m,a.letters]]),e("button",{type:"button",class:"mr-4 typeahead-clear mr-4","aria-label":"clear",onClick:s[1]||(s[1]=r=>l.clear("letters"))},[e("img",{src:a.clearIcon,width:"13.5",height:"18.4",alt:"clear"},null,8,w)])])],2),e("div",{class:i(t.isPart?"pb-3":"md:p-3 py-3")},[e("div",M,[c(e("input",{type:"text",class:"search-box-input pe-10",placeholder:t.strings.pattern,name:"pattern","data-maxlength":"15","data-allowed":t.regex+"?","onUpdate:modelValue":s[2]||(s[2]=r=>a.pattern=r)},null,8,L),[[m,a.pattern]]),e("button",{type:"button",class:"mr-4 typeahead-clear mr-4","aria-label":"clear",onClick:s[3]||(s[3]=r=>l.clear("pattern"))},[e("img",{src:a.clearIcon,width:"13.5",height:"18.4",alt:"clear"},null,8,T)])])],2),a.lang==="en"?(d(),h("div",{key:0,class:i(t.isPart?"pb-3":"md:p-3 py-3")},[e("div",H,[c(e("select",{class:"search-form-selection",name:"dictionary","onUpdate:modelValue":s[4]||(s[4]=r=>a.dictionary=r)},[e("option",{value:"all",innerHTML:t.strings["all-dictionaries"]},null,8,P),e("option",{value:"uk",innerHTML:t.strings["scrabble-uk"]},null,8,S),e("option",{value:"us",innerHTML:t.strings["scrabble-us"]},null,8,V)],512),[[b,a.dictionary]]),C])],2)):_("",!0),e("div",{class:i((t.isPart?"":"md:p-3 py-3")+" flex")},[e("p",{innerHTML:t.strings["joker-label"]},null,8,E),e("div",O,[e("input",{type:"radio",class:"radio-input",name:"joker",value:"0",checked:a.joker==="0","aria-label":"joker 0"},null,8,B),I]),e("div",q,[e("input",{type:"radio",class:"radio-input",name:"joker",value:"1",checked:a.joker==="1","aria-label":"joker 1"},null,8,A),U]),e("div",D,[e("input",{type:"radio",class:"radio-input",name:"joker",value:"2",checked:a.joker==="2","aria-label":"joker 2"},null,8,F),N])],2),e("div",z,[e("button",{type:"submit",class:"button search","aria-label":t.strings.search,innerHTML:t.strings.search},null,8,J)])],42,g)}const W=f(y,[["render",K]]);export{W as S};