{"version":3,"file":"assignment_controller-6pioJ5k3.js","sources":["../../../app/javascript/controllers/automation/assignment_controller.js"],"sourcesContent":["import MessageController from \"../step/message_controller\"\n\nexport default class extends MessageController {\n static targets = [\n 'template',\n 'item',\n 'description',\n 'notice',\n 'title',\n ]\n\n connect() {\n this.paneSnapshot = this.paneTarget.cloneNode(true)\n super.connect()\n }\n\n togglePane() {\n if (window.paneId) {\n return window.dispatchEvent(\n new CustomEvent(\"pane:alert\", {detail: this.element.id})\n )\n }\n\n this.paneTarget.classList.toggle(\"-right-full\")\n this.paneTarget.classList.toggle(\"right-0\")\n\n this.triggerTarget.classList.toggle(\"halo--active\")\n\n if(this.paneIsInvisible) return\n\n this.dispatch('focus', {\n target: this.paneTarget,\n })\n\n if(!this.persistedValue) {\n this.delayed(() => {\n this.dispatch('show', {\n target: this.paneTarget.querySelector('[data-automation--property-value-target=\"propertiesPopover\"]'),\n })\n }, 300)\n }\n }\n\n save({ detail }) {\n if(window.paneId === this.paneTarget.id) {\n window.paneId = null\n }\n\n this.paneSnapshot = this.paneTarget.cloneNode(true)\n\n this.paneTarget.classList.toggle(\"-right-full\")\n this.paneTarget.classList.toggle(\"right-0\")\n\n this.paneSnapshot.classList.toggle(\"-right-full\")\n this.paneSnapshot.classList.toggle(\"right-0\")\n\n this.triggerTarget.classList.toggle(\"halo--active\")\n\n this.persistedValue = true\n\n const { sentence, name } = detail\n\n if(sentence) {\n if(this.hasNoticeTarget) {\n this.noticeTarget.remove()\n }\n\n this.descriptionTarget.innerHTML = sentence\n }\n\n this.titleTarget.innerHTML = name || t.journeys.new.assignment\n }\n\n abortChanges() {\n if(!this.persistedValue) {\n return this.remove()\n }\n\n this.paneTarget.classList.toggle(\"-right-full\")\n this.paneTarget.classList.toggle(\"right-0\")\n\n this.triggerTarget.classList.remove(\"halo--active\")\n\n this.delayed(() => {\n this.paneTarget.replaceWith(this.paneSnapshot.cloneNode(true))\n this.paneTarget.querySelector('input.form-control')?.remove()\n }, 300)\n }\n\n remove() {\n this.dropzone.remove()\n\n if (this.hasRemovedInputTarget && document.getElementById('drawing_container')) {\n this.removedInputTarget.disabled = false\n document.getElementById(\"drawing_container\").appendChild(this.removedInputTarget)\n }\n\n this.paneTarget.classList.replace(\"right-0\", \"-right-full\")\n this.triggerTarget.classList.remove(\"halo--active\")\n\n this.nextTick(() => {\n this.paneTarget.remove()\n this.element.remove()\n }, 300)\n }\n\n get paneIsInvisible() {\n return this.paneTarget.classList.contains(\"-right-full\")\n }\n\n get paneIsVisible() {\n return this.paneTarget.classList.contains(\"right-0\")\n }\n\n get paneTarget() {\n return document.getElementById(`${this.element.id}_pane`)\n }\n}\n"],"names":["assignment_controller","MessageController","detail","sentence","name","_a","__publicField"],"mappings":"yNAEe,MAAKA,UAASC,CAAkB,CAS7C,SAAU,CACR,KAAK,aAAe,KAAK,WAAW,UAAU,EAAI,EAClD,MAAM,QAAO,CACjB,CAEE,YAAa,CACX,GAAI,OAAO,OACT,OAAO,OAAO,cACZ,IAAI,YAAY,aAAc,CAAC,OAAQ,KAAK,QAAQ,EAAE,CAAC,CAC/D,EAGI,KAAK,WAAW,UAAU,OAAO,aAAa,EAC9C,KAAK,WAAW,UAAU,OAAO,SAAS,EAE1C,KAAK,cAAc,UAAU,OAAO,cAAc,EAE/C,MAAK,kBAER,KAAK,SAAS,QAAS,CACrB,OAAQ,KAAK,UACd,CAAA,EAEG,KAAK,gBACP,KAAK,QAAQ,IAAM,CACjB,KAAK,SAAS,OAAQ,CACpB,OAAQ,KAAK,WAAW,cAAc,8DAA8D,CACrG,CAAA,CACT,EAAS,GAAG,EAEZ,CAEE,KAAK,CAAE,OAAAC,GAAU,CACZ,OAAO,SAAW,KAAK,WAAW,KACnC,OAAO,OAAS,MAGlB,KAAK,aAAe,KAAK,WAAW,UAAU,EAAI,EAElD,KAAK,WAAW,UAAU,OAAO,aAAa,EAC9C,KAAK,WAAW,UAAU,OAAO,SAAS,EAE1C,KAAK,aAAa,UAAU,OAAO,aAAa,EAChD,K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