{"version":3,"file":"source_controller-CvjnLww3.js","sources":["../../../app/javascript/controllers/artifact/entity/source_controller.js"],"sourcesContent":["import ItemController from './item_controller'\n\nexport default class extends ItemController {\n edit() {\n super.edit()\n\n if(this.optionTargets.some(option => option.classList.contains('bg-lavender-light')) || !this.valueValue) {\n this.showPopover()\n }\n }\n\n search() {\n this.optionTargets.filter(result => {\n if(!result.dataset.source.toLowerCase().startsWith(this.inputTarget.value.toLowerCase())) {\n result.classList.add('hidden')\n } else {\n result.classList.remove('hidden')\n }\n })\n\n if(this.optionTargets.every(option => option.classList.contains('hidden'))) {\n this.hidePopover()\n } else {\n this.showPopover()\n }\n }\n\n save() {\n super.save()\n this.hidePopover()\n\n this.optionTargets.forEach(option => {\n if(option.dataset.source === this.valueValue) {\n option.classList.add('bg-lavender-light')\n } else {\n option.classList.add('hidden')\n option.classList.remove('bg-lavender-light')\n }\n })\n }\n\n setSource({ currentTarget }) {\n this.inputTarget.value = currentTarget.dataset.source\n this.save()\n }\n\n valueValueChanged() {\n super.valueValueChanged()\n }\n}\n"],"names":["source_controller","ItemController","option","result","currentTarget"],"mappings":"kDAEe,MAAKA,UAASC,CAAe,CAC1C,MAAO,CACL,MAAM,KAAI,GAEP,KAAK,cAAc,KAAKC,GAAUA,EAAO,UAAU,SAAS,mBAAmB,CAAC,GAAK,CAAC,KAAK,aAC5F,KAAK,YAAW,CAEtB,CAEE,QAAS,CACP,KAAK,cAAc,OAAOC,GAAU,CAC9BA,EAAO,QAAQ,OAAO,YAAa,EAAC,WAAW,KAAK,YAAY,MAAM,YAAa,CAAA,EAGrFA,EAAO,UAAU,OAAO,QAAQ,EAFhCA,EAAO,UAAU,IAAI,QAAQ,CAIhC,CAAA,EAEE,KAAK,cAAc,MAAMD,GAAUA,EAAO,UAAU,SAAS,QAAQ,CAAC,EACvE,KAAK,YAAW,EAEhB,KAAK,YAAW,CAEtB,CAEE,MAAO,CACL,MAAM,KAAI,EACV,KAAK,YAAW,EAEhB,KAAK,cAAc,QAAQA,GAAU,CAChCA,EAAO,QAAQ,SAAW,KAAK,WAChCA,EAAO,UAAU,IAAI,mBAAmB,GAExCA,EAAO,UAAU,IAAI,QAAQ,EAC7BA,EAAO,UAAU,OAAO,mBAAmB,EAE9C,CAAA,CACL,CAEE,UAAU,CAAE,cAAAE,GAAiB,CAC3B,KAAK,YAAY,MAAQA,EAAc,QAAQ,OAC/C,KAAK,KAAI,CACb,CAEE,mBAAoB,CAClB,MAAM,kBAAiB,CAC3B,CACA"}