{"version":3,"file":"replied_message_controller-Da7vsGeZ.js","sources":["../../../app/javascript/controllers/replied_message_controller.js"],"sourcesContent":["import ApplicationController from \"./application_controller\"\n\nexport default class extends ApplicationController {\n static targets = [\"input\", \"creator\", \"content\", \"locationIcon\", \"listIcon\", \"subscriberIcon\", \"mediaIcon\", \"attachmentIcon\", \"attachmentContainer\", \"voiceIcon\", \"videoIcon\"]\n\n show({ detail }) {\n this.reset()\n\n const { id, body, creator, element } = detail\n\n this.inputTarget.value = id\n this.creatorTarget.innerHTML = creator\n this.contentTarget.innerHTML = body || this.translations.message.replies.default_location_message\n\n if(detail.attachedLocation) {\n super.show(this.locationIconTarget)\n }\n\n if(detail.type === \"vcard\") {\n if(detail.isMultiple) {\n super.show(this.listIconTarget)\n } else {\n super.show(this.subscriberIconTarget)\n }\n }\n\n if(detail.type === \"voice\") {\n super.show(this.voiceIconTarget)\n this.contentTarget.innerHTML = body || this.translations.message.replies.default_voice_message\n }\n\n if(detail.type === \"media\") {\n const attachment = element.querySelectorAll(\"[data-message-attachment]\")[0]\n\n if(attachment.querySelector(\"[data-attachment-image]\")) {\n super.show(this.mediaIconTarget)\n const image = attachment.querySelector(\"[data-attachment-image]\").cloneNode(true)\n image.style.objectFit = \"contain\"\n\n this.attachmentContainerTarget.append(image)\n } else {\n super.show(this.attachmentIconTarget)\n\n this.contentTarget.innerHTML = Array.from(element.querySelectorAll(\"[data-message-attachment]\"))\n .map(attachment => attachment.querySelector(\"[data-attachment-name]\").title)\n .join(\", \")\n }\n }\n\n if(detail.type === \"video\") {\n super.show(this.videoIconTarget)\n this.contentTarget.innerHTML = body || this.translations.message.replies.default_video_message\n }\n\n this.enable(this.inputTarget)\n super.show()\n\n this.dispatch(\"focus\", {\n target: document.documentElement\n })\n }\n\n hide() {\n super.hide()\n\n this.disable(this.inputTarget, { clear: true })\n this.reset()\n }\n\n reset() {\n this.contentTarget.innerHTML = \"\"\n this.attachmentContainerTarget.innerHTML = \"\"\n\n this.icons.forEach(icon => super.hide(icon))\n\n this.dispatch(\"blur\", {\n target: document.documentElement\n })\n }\n\n // private\n\n get icons() {\n return [\n this.locationIconTarget,\n this.listIconTarget,\n this.subscriberIconTarget,\n this.mediaIconTarget,\n this.attachmentIconTarget,\n this.voiceIconTarget,\n this.videoIconTarget,\n ]\n }\n}\n"],"names":["replied_message_controller","ApplicationController","detail","id","body","creator","element","attachment","image","icon","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAGjD,KAAK,CAAE,OAAAC,GAAU,CACf,KAAK,MAAK,EAEV,KAAM,CAAE,GAAAC,EAAI,KAAAC,EAAM,QAAAC,EAAS,QAAAC,CAAO,EAAKJ,EAuBvC,GArBA,KAAK,YAAY,MAAQC,EACzB,KAAK,cAAc,UAAYE,EAC/B,KAAK,cAAc,UAAYD,GAAQ,KAAK,aAAa,QAAQ,QAAQ,yBAEtEF,EAAO,kBACR,MAAM,KAAK,KAAK,kBAAkB,EAGjCA,EAAO,OAAS,UACdA,EAAO,WACR,MAAM,KAAK,KAAK,cAAc,EAE9B,MAAM,KAAK,KAAK,oBAAoB,GAIrCA,EAAO,OAAS,UACjB,MAAM,KAAK,KAAK,eAAe,EAC/B,KAAK,cAAc,UAAYE,GAAQ,KAAK,aAAa,QAAQ,QAAQ,uBAGxEF,EAAO,OAAS,QAAS,CAC1B,MAAMK,EAAaD,EAAQ,iBAAiB,2BAA2B,EAAE,CAAC,EAE1E,GAAGC,EAAW,cAAc,yBAAyB,EAAG,CACtD,MAAM,KAAK,KAAK,eAAe,EAC/B,MAAMC,EAAQD,EAAW,cAAc,yBAAyB,EAAE,UAAU,EAAI,EAChFC,EAAM,MAAM,UAAY,UAExB,KAAK,0BAA0B,OAAOA,CAAK,CACnD,MACQ,MAAM,KAAK,KAAK,oBAAoB,EAEpC,KAAK,cAAc,UAAY,MAAM,KAAKF,EAAQ,iBAAiB,2BAA2B,CAAC,EAC5F,IAAIC,GAAcA,EAAW,cAAc,wBAAwB,EAAE,KAAK,EAC1E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