{"version":3,"file":"steps_controller-BcR1Lhwk.js","sources":["../../../app/javascript/entrypoints/controllers/steps_controller.js"],"sourcesContent":["import { Controller } from \"@hotwired/stimulus\";\nimport _ from \"lodash\";\n\nexport default class extends Controller {\n static targets = [\"step\", \"stepContainer\"];\n currentStep = 0;\n\n connect() {\n this.stepTargets.forEach((step, index) => {\n if (step.classList.contains(\"active\")) {\n this.currentStep = index;\n\n this.handlePreviousStep(0);\n this.handleCurrentStep();\n }\n });\n }\n\n update = (event) => {\n const previousStep = parseInt(this.currentStep);\n this.currentStep = parseInt(event.params.index);\n\n this.handlePreviousStep(previousStep);\n this.handleCurrentStep(this.currentStep);\n\n const stepsUpdateEvent = new CustomEvent(\"step-update\", { detail: { step: this.currentStep } })\n window.dispatchEvent(stepsUpdateEvent)\n };\n\n handlePreviousStep = (previousStep) => {\n this.stepTargets[previousStep].classList.remove(\"active\");\n this.stepContainerTargets[previousStep].classList.add(\"hidden\");\n };\n\n handleCurrentStep = () => {\n this.stepTargets[this.currentStep].classList.add(\"active\");\n this.stepContainerTargets[this.currentStep].classList.remove(\"hidden\");\n };\n}\n"],"names":["steps_controller","Controller","__publicField","event","previousStep","stepsUpdateEvent","step","index"],"mappings":"uRAGe,MAAKA,UAASC,CAAW,CAAzB,kCAEbC,EAAA,mBAAc,GAadA,EAAA,cAAUC,GAAU,CAClB,MAAMC,EAAe,SAAS,KAAK,WAAW,EAC9C,KAAK,YAAc,SAASD,EAAM,OAAO,KAAK,EAE9C,KAAK,mBAAmBC,CAAY,EACpC,KAAK,kBAAkB,KAAK,WAAW,EAEvC,MAAMC,EAAmB,IAAI,YAAY,cAAe,CAAE,OAAQ,CAAE,KAAM,KAAK,WAAW,EAAI,EAC9F,OAAO,cAAcA,CAAgB,CACzC,GAEEH,EAAA,0BAAsBE,GAAiB,CACrC,KAAK,YAAYA,CAAY,EAAE,UAAU,OAAO,QAAQ,EACxD,KAAK,qBAAqBA,CAAY,EAAE,UAAU,IAAI,QAAQ,CAClE,GAEEF,EAAA,yBAAoB,IAAM,CACxB,KAAK,YAAY,KAAK,WAAW,EAAE,UAAU,IAAI,QAAQ,EACzD,KAAK,qBAAqB,KAAK,WAAW,EAAE,UAAU,OAAO,QAAQ,CACzE,GA9BE,SAAU,CACR,KAAK,YAAY,QAAQ,CAACI,EAAMC,IAAU,CACpCD,EAAK,UAAU,SAAS,QAAQ,IAClC,KAAK,YAAcC,EAEnB,KAAK,mBAAmB,CAAC,EACzB,KAAK,kBAAiB,EAE9B,CAAK,CACF,CAsBH,CAlCEL,EADkBF,EACX,UAAU,CAAC,OAAQ,eAAe"}