{"version":3,"file":"prospect_controller-Cp587nk9.js","sources":["../../../app/javascript/controllers/prospect_controller.js"],"sourcesContent":["import { Controller } from \"@hotwired/stimulus\"\n\nimport {useMoveCursorToEndOfInput} from \"./mixins/useMoveCursorToEndOfInput\"\n\nexport default class extends Controller {\n static targets = [\n \"industriesSelect\",\n \"customIndustry\",\n \"customIndustryInput\",\n \"customIndustryButton\",\n \"resetIndustrySelectButton\",\n \"utmInput\",\n ]\n\n connect() {\n useMoveCursorToEndOfInput(this)\n super.connect()\n\n this.setUTMFields()\n }\n\n showCustomIndustryField() {\n this.industriesSelectTarget.classList.add(\"hidden\")\n\n this.customIndustryTarget.classList.remove(\"hidden\")\n this.customIndustryInputTarget.disabled = false\n this.moveCursorToEndOfInput(this.customIndustryInputTarget, { focus: true })\n\n this.resetIndustrySelectButtonTarget.click()\n }\n\n hideCustomIndustryField() {\n this.industriesSelectTarget.classList.remove(\"hidden\")\n\n this.customIndustryTarget.classList.add(\"hidden\")\n this.customIndustryInputTarget.disabled = true\n this.customIndustryInputTarget.value = \"\"\n }\n\n setUTMFields() {\n const cookie = document.cookie.replace(/(?:(?:^|.*;\\s*)utm_params\\s*=\\s*([^;]*).*$)|^.*$/, \"$1\")\n\n if (!cookie) {\n return\n }\n\n const storedUTMValue = JSON.parse(cookie)\n\n Object.entries(storedUTMValue).forEach(([key, value]) => {\n if(this.utmInputTargets.find(input => input.dataset.kind === key)) {\n this.utmInputTargets.find(input => input.dataset.kind === key).value = value\n }\n })\n }\n}\n"],"names":["prospect_controller","Controller","useMoveCursorToEndOfInput","cookie","storedUTMValue","key","value","input","__publicField"],"mappings":"wQAIe,MAAKA,UAASC,CAAW,CAUtC,SAAU,CACRC,EAA0B,IAAI,EAC9B,MAAM,QAAO,EAEb,KAAK,aAAY,CACrB,CAEE,yBAA0B,CACxB,KAAK,uBAAuB,UAAU,IAAI,QAAQ,EAElD,KAAK,qBAAqB,UAAU,OAAO,QAAQ,EACnD,KAAK,0BAA0B,SAAW,GAC1C,KAAK,uBAAuB,KAAK,0BAA2B,CAAE,MAAO,EAAM,CAAA,EAE3E,KAAK,gCAAgC,MAAK,CAC9C,CAEE,yBAA0B,CACxB,KAAK,uBAAuB,UAAU,OAAO,QAAQ,EAErD,KAAK,qBAAqB,UAAU,IAAI,QAAQ,EAChD,KAAK,0BAA0B,SAAW,GAC1C,KAAK,0BAA0B,MAAQ,EAC3C,CAEE,cAAe,CACb,MAAMC,EAAS,SAAS,OAAO,QAAQ,mDAAoD,IAAI,EAE/F,GAAI,CAACA,EACH,OAGF,MAAMC,EAAiB,KAAK,MAAMD,CAAM,EAExC,OAAO,QAAQC,CAAc,EAAE,QAAQ,CAAC,CAACC,EAAKC,CAAK,IAAM,CACpD,KAAK,gBAAgB,KAAKC,GAASA,EAAM,QAAQ,OAASF,CAAG,IAC9D,KAAK,gBAAgB,KAAKE,GAASA,EAAM,QAAQ,OAASF,CAAG,EAAE,MAAQC,EAE1E,CAAA,CACL,CACA,CAjDEE,EADkBR,EACX,UAAU,CACf,mBACA,iBACA,sBACA,uBACA,4BACA,UACJ"}