{"version":3,"file":"confirmation_controller-CHkZ9bNY.js","sources":["../../../app/javascript/controllers/campaign/confirmation_controller.js"],"sourcesContent":["import ApplicationController from '../application_controller'\n\nexport default class extends ApplicationController {\n static targets = ['backButton', 'submit', 'form', 'compose']\n\n updateBackButtonHref(event) {\n const { params } = event\n document.cookie = `preview=${params.type};path=/`\n }\n\n submit(e) {\n if(this.composeSnapshot.template && ['low', 'medium'].includes(this.composeSnapshot.template.quality) && !this.composeSnapshot.templateChanged) {\n this.dispatch('show', {\n target: this.element,\n detail: this.composeSnapshot.template.quality,\n })\n\n e.preventDefault()\n e.stopPropagation()\n }\n }\n\n sync({ detail: composeSnapshot }) {\n this.submitTarget.disabled = composeSnapshot.string.length === 0 || composeSnapshot.overflow\n\n if(composeSnapshot.overflow) {\n this.showToast({\n message: t.compose.submit.blocked_by_overflow.replace('%{max_length}', composeSnapshot.technology.max_message_length),\n type: 'error',\n })\n }\n\n this.composeSnapshot = composeSnapshot\n }\n\n submitAnyway() {\n this.formTarget.requestSubmit()\n }\n\n editTemplate() {\n this.nextTick(() => {\n this.dispatch('focus', {\n target: this.composeTarget\n })\n })\n }\n}\n"],"names":["confirmation_controller","ApplicationController","event","params","composeSnapshot","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAGjD,qBAAqBC,EAAO,CAC1B,KAAM,CAAE,OAAAC,CAAM,EAAKD,EACnB,SAAS,OAAS,WAAWC,EAAO,IAAI,SAC5C,CAEE,OAAO,EAAG,CACL,KAAK,gBAAgB,UAAY,CAAC,MAAO,QAAQ,EAAE,SAAS,KAAK,gBAAgB,SAAS,OAAO,GAAK,CAAC,KAAK,gBAAgB,kBAC7H,KAAK,SAAS,OAAQ,CACpB,OAAQ,KAAK,QACb,OAAQ,KAAK,gBAAgB,SAAS,OACvC,CAAA,EAED,EAAE,eAAc,EAChB,EAAE,gBAAe,EAEvB,CAEE,KAAK,CAAE,OAAQC,GAAmB,CAChC,KAAK,aAAa,SAAWA,EAAgB,OAAO,SAAW,GAAKA,EAAgB,SAEjFA,EAAgB,UACjB,KAAK,UAAU,CACb,QAAS,EAAE,QAAQ,OAAO,oBAAoB,QAAQ,gBAAiBA,EAAgB,WAAW,kBAAkB,EACpH,KAAM,OACP,CAAA,EAGH,KAAK,gBAAkBA,CAC3B,CAEE,cAAe,CACb,KAAK,WAAW,cAAa,CACjC,CAEE,cAAe,CACb,KAAK,SAAS,IAAM,CAClB,KAAK,SAAS,QAAS,CACrB,OAAQ,KAAK,aACd,CAAA,CACF,CAAA,CACL,CACA,CA3CEC,EADkBL,EACX,UAAU,CAAC,aAAc,SAAU,OAAQ,SAAS"}