{"version":3,"file":"layout_controller-DbIXPiNX.js","sources":["../../../app/javascript/controllers/popup/layout_controller.js"],"sourcesContent":["import { Controller } from \"@hotwired/stimulus\"\nimport { get } from \"@rails/request.js\"\n\nexport default class extends Controller {\n setActiveStep({ detail }) {\n this.activeStepIdValue = detail\n window.activePopupStepId = this.activeStepIdValue\n }\n\n change(e) {\n this.changeEveryLayoutOfSteps(e)\n window.mobileLayout = e.currentTarget.dataset.kind\n }\n\n changeDesktopLayout(e) {\n this.changeEveryLayoutOfSteps(e)\n window.desktopLayout = e.currentTarget.dataset.kind\n }\n\n setButtonStyles({ detail: { state } }) {\n this.buttonStyles = state\n }\n\n // private\n\n changeEveryLayoutOfSteps({ currentTarget }) {\n const overlayBackgroundColor = document.querySelector(\n \"input[name='popup[overlay][background_color]']\"\n ).value\n Object.entries(window.popupSteps).forEach(([k, _]) => {\n const hero = document\n .getElementById(k)\n .querySelector(\"[data-controller*='popup--step--hero'] trix-editor\")\n const notice = document\n .getElementById(k)\n .querySelector(\"[data-controller*='popup--step--notice'] trix-editor\")\n get(currentTarget.dataset.url, {\n query: {\n within: k,\n fields: JSON.stringify(window.popupSteps[k].fields),\n button: JSON.stringify(this.buttonStyles),\n hero: hero.value,\n notice: notice.value,\n overlayBackgroundColor,\n },\n responseKind: \"turbo-stream\",\n })\n })\n }\n}\n"],"names":["layout_controller","Controller","detail","e","state","currentTarget","overlayBackgroundColor","k","_","hero","notice","get"],"mappings":"2FAGe,MAAKA,UAASC,CAAW,CACtC,cAAc,CAAE,OAAAC,GAAU,CACxB,KAAK,kBAAoBA,EACzB,OAAO,kBAAoB,KAAK,iBACpC,CAEE,OAAOC,EAAG,CACR,KAAK,yBAAyBA,CAAC,EAC/B,OAAO,aAAeA,EAAE,cAAc,QAAQ,IAClD,CAEE,oBAAoBA,EAAG,CACrB,KAAK,yBAAyBA,CAAC,EAC/B,OAAO,cAAgBA,EAAE,cAAc,QAAQ,IACnD,CAEE,gBAAgB,CAAE,OAAQ,CAAE,MAAAC,CAAO,CAAA,EAAI,CACrC,KAAK,aAAeA,CACxB,CAIE,yBAAyB,CAAE,cAAAC,GAAiB,CAC1C,MAAMC,EAAyB,SAAS,cACtC,gDACN,EAAM,MACF,OAAO,QAAQ,OAAO,UAAU,EAAE,QAAQ,CAAC,CAACC,EAAGC,CAAC,IAAM,CACpD,MAAMC,EAAO,SACV,eAAeF,CAAC,EAChB,cAAc,oDAAoD,EAC/DG,EAAS,SACZ,eAAeH,CAAC,EAChB,cAAc,sDAAsD,EACvEI,EAAIN,EAAc,QAAQ,IAAK,CAC7B,MAAO,CACL,OAAQE,EACR,OAAQ,KAAK,UAAU,OAAO,WAAWA,CAAC,EAAE,MAAM,EAClD,OAAQ,KAAK,UAAU,KAAK,YAAY,EACxC,KAAME,EAAK,MACX,OAAQC,EAAO,MACf,uBAAAJ,CACD,EACD,aAAc,cACf,CAAA,CACF,CAAA,CACL,CACA"}