drill.define(async e=>{await e("./p-selector.css"),$.register({tag:"p-option",data:{selected:0,value:""},attrs:["selected","value"],temp:"\n            <div xv-content></div>\n        ",inited(){this.value||(this.value=this.text)}}),$.register({tag:"p-selector",temp:'\n        <div xv-content></div>\n        <div class="p_selector_jiao">\n        ▾\n            <select xv-tar="inSelector" xv-module="value"></select>\n        </div>\n        ',attrs:["showcount"],data:{showcount:"auto"},watch:{value(e){let t=this.que('[selected="1"]');t&&(t.selected=0);let i=this.seek(`[value=${e.val}]`)[0];if(i){i.selected=1;let e=i;for(;e.position.top>10;)e=e.prev;e.ele!=i.ele&&e.before(i)}},showcount(e){let{val:t}=e;if(/\D/.test(t))switch(t){case"hide":case"auto":break;default:this.showcount="auto"}else;}},inited(){this.on("click",e=>{let{target:t}=e,i=t;t.is("p-option")||(i=t.parentsUntil("p-option")),i&&1!=i.selected&&(this.value=i.value)}),this.$inSelector.on("click",e=>{e.bubble=!1}),this.forEach((e,t)=>{this.$inSelector.push(`<option value="${e.value}">${e.text}</option>`)}),this.on("update",e=>{"arrayMethod"==e.modify.genre&&(this.$inSelector.empty(),this.forEach((e,t)=>{this.$inSelector.push(`<option value="${e.value}">${e.text}</option>`)}),this.$inSelector.ele.value=this.value)}),this.watch("[selected=1]",e=>{let{val:t}=e;switch(t.length){case 0:this.value="";break;case 1:let e=t[0];this.value=e.value}})}})});