{"version":3,"file":"input_controller-kBrn5kxz.js","sources":["../../../app/javascript/controllers/compose/models/links_manager.js","../../../app/javascript/controllers/compose/models/tags_manager.js","../../../app/javascript/controllers/input_controller.js"],"sourcesContent":["import { AttachmentManager } from './attachment_manager'\n\nclass LinksManager extends AttachmentManager {\n insert(event) {\n const attachment = this.constructAttachmentElementForLink(event.detail.linkPartial)\n super.insert(attachment)\n }\n\n replace({ detail }) {\n const { id, linkPartial } = detail\n\n this.editor.setSelectedRange(this.oldPosition)\n\n this.trixDocument.getPieces().forEach((piece, index) => {\n if(!piece.attachment) return\n\n const elementId = new DOMParser()\n .parseFromString(piece.attachment.attributes.values.content, 'text/html')\n .querySelector('[data-id]')\n .dataset\n .id\n\n if(id === elementId) {\n const contentLengthBeforeReplacedPiece = this.contentLengthBeforePiece(index)\n this.editor.setSelectedRange([contentLengthBeforeReplacedPiece, contentLengthBeforeReplacedPiece + 1])\n\n this.editor.deleteInDirection('forward')\n this.insert({ detail: { linkPartial } })\n\n this.inputController.afterAttachmentReplacement(id)\n }\n })\n }\n\n constructAttachmentElementForLink(linkPartial) {\n const htmlFromPartial = new DOMParser().parseFromString(linkPartial, 'text/html')\n\n const element = htmlFromPartial.querySelector('[data-sgid]')\n const { destination, link, sgid, id } = element.dataset\n\n return new Trix.Attachment({\n content: linkPartial,\n contentType: 'shortlink',\n sgid,\n id,\n destination,\n link\n })\n }\n}\n\nexport { LinksManager }\n","class TagsManager {\n constructor(inputController) {\n this.inputController = inputController\n }\n\n setup() {\n Trix.config.textAttributes.background = {\n styleProperty: 'backgroundColor',\n inheritable: false,\n }\n\n Trix.config.textAttributes.padding = {\n styleProperty: 'padding',\n inheritable: false,\n }\n\n Trix.config.textAttributes.rounded = {\n styleProperty: 'borderRadius',\n inheritable: false,\n }\n }\n\n activate() {\n this.editor.activateAttribute('background', 'rgb(231, 229, 234)')\n this.editor.activateAttribute('padding', '0.125rem')\n this.editor.activateAttribute('rounded', '0.375rem')\n }\n\n deactivate() {\n this.editor.deactivateAttribute('background', 'rgb(231, 229, 234)')\n this.editor.deactivateAttribute('padding', '0.125rem')\n this.editor.deactivateAttribute('rounded', '0.375rem')\n }\n\n insert(event) {\n const pieceAtCursor = this.cursor.pieceAtCaret()\n const pieceBeforeCursor = this.cursor.pieceBeforeCaret()\n\n if(pieceBeforeCursor.isTag) {\n return this.insertTagAfterTagElement(event.detail)\n }\n\n if(pieceAtCursor.string === pieceBeforeCursor.string || (pieceAtCursor.isLineFeed && pieceBeforeCursor)) {\n return this.insertTagBetweenCharacters(event.detail)\n }\n\n if(pieceAtCursor.isWhitespace || pieceAtCursor.endsWithWhitespace) {\n return this.moveToRightAndInsertTag(event.detail)\n }\n\n if(pieceAtCursor.isLineFeed) {\n this.manuallyInsertTag(event.detail)\n }\n }\n\n insertTagAfterTagElement(tag) {\n const pieceAtCursor = this.cursor.pieceAtCaret()\n\n if(pieceAtCursor.isWhitespace) {\n this.moveToRightOfWhitespaceAndInsertTag(tag)\n }\n\n if(pieceAtCursor.isLineFeed) {\n this.moveToRightOfLineFeedAndInsertTag(tag)\n }\n }\n\n insertTagBetweenCharacters(tag) {\n const characterAtCursor = this.cursor.characterAtCaret()\n const characterBeforeCursor = this.cursor.characterBeforeCaret()\n\n if(characterBeforeCursor.isWhitespace) {\n return this.insertWhitespaceMoveToBackwardAndInsertTag(tag)\n }\n\n if(characterAtCursor.isWhitespace) {\n return this.insertWhitespaceAndTag(tag)\n }\n\n if(!characterBeforeCursor.isWhitespace && !characterAtCursor.isWhitespace) {\n return this.insertWhitespaceTwiceAndTag(tag)\n }\n }\n\n moveToRightOfWhitespaceAndInsertTag(tag) {\n this.cursor.moveToRight()\n\n this.inputController.nextTick(() => {\n this.editor.insertString(tag)\n })\n }\n\n moveToRightOfLineFeedAndInsertTag(tag) {\n this.inputController.isParsing = true\n\n this.inputController.insertWhitespace()\n this.cursor.moveToRight()\n this.inputController.isParsing = false\n\n this.inputController.nextTick(() => {\n this.editor.insertString(tag)\n })\n }\n\n insertWhitespaceMoveToBackwardAndInsertTag(tag) {\n this.inputController.isParsing = true\n\n this.inputController.insertWhitespace()\n this.cursor.moveToLeft()\n\n this.manuallyInsertTag(tag)\n }\n\n insertWhitespaceAndTag(tag) {\n this.inputController.isParsing = true\n\n this.inputController.insertWhitespace()\n return this.manuallyInsertTag(tag)\n }\n\n insertWhitespaceTwiceAndTag(tag) {\n this.inputController.isParsing = true\n\n // when the input is not empty, insert whitespaces\n if(this.trixDocument.toString().length !== 1) {\n this.inputController.insertWhitespace()\n this.inputController.insertWhitespace()\n\n this.cursor.moveToLeft()\n }\n\n return this.manuallyInsertTag(tag)\n }\n\n moveToRightAndInsertTag(tag) {\n this.cursor.moveToRight()\n this.manuallyInsertTag(tag)\n }\n\n manuallyInsertTag(tag) {\n this.inputController.isParsing = true\n\n this.inputController.nextTick(() => {\n this.editor.recordUndoEntry('insert tag')\n this.editor.insertString(tag)\n\n const [_, tagEndsAt] = this.editor.getSelectedRange()\n const tagStartsAt = tagEndsAt - tag.length\n\n this.editor.setSelectedRange([tagStartsAt, tagEndsAt])\n this.activate()\n\n this.editor.setSelectedRange([tagEndsAt, tagEndsAt])\n this.inputController.isParsing = false\n })\n }\n\n get cursor() {\n return this.inputController.cursor\n }\n\n get editor() {\n return this.inputController.editor\n }\n\n get trixDocument() {\n return this.editor.getDocument()\n }\n}\n\nexport { TagsManager }\n","import ComposeController from './compose/base_controller'\n\nimport {\n KeyboardKey,\n Piece,\n TagsManager,\n LinksManager,\n Coupon,\n Contact\n} from './compose/models'\n\nimport data from '@emoji-mart/data'\nimport { init, SearchIndex } from 'emoji-mart'\n\nexport default class extends ComposeController {\n static targets = [\n 'inputContainer',\n 'templatesIcon',\n 'templatesMenu',\n 'templateIdInput',\n 'toolbar',\n 'technologies',\n 'noteToolIcon',\n 'couponIdInput',\n 'focus',\n 'linkInputsList',\n 'disableNotice',\n 'mediaContainer',\n 'mediaContainerList',\n 'voiceContainer',\n 'locationContainer',\n 'footer',\n 'mediaAttachmentTool',\n ]\n\n static values = {\n allowedProfileTags: Array,\n allowedCouponTags: Array,\n name: String,\n technology: Object,\n window: Object,\n submitOnEnter: { type: Boolean, default: false },\n editTemplateUrl: String,\n footer: String,\n latitude: Number,\n longitude: Number,\n smsOnly: Boolean,\n buttonsSnapshot: Array,\n }\n\n initialize() {\n super.initialize()\n\n this.state = {\n templatesVisible: false,\n links: {}\n }\n\n this.templatesToolMutationObserver = new MutationObserver(this.templatesToolMutationObserverCallback.bind(this))\n\n this.tagsManager = new TagsManager(this)\n this.linksManager = new LinksManager(this)\n\n this.attachments = Array.from(this.element.querySelectorAll('[data-controller=\"editor--attached-media\"]')) || []\n }\n\n connect() {\n init({ data })\n\n super.connect()\n\n this.tagsManager.setup()\n\n if (this.hasTemplatesMenuTarget) {\n this.templatesToolMutationObserver.observe(this.templatesMenuTarget, {attributes: true})\n }\n\n if(this.autoFocusValue) {\n // When the user clicks on the conversation card on the Inbox, the container is focused but no cursor is visible\n // This way we force the cursor to show itself.\n\n this.trixTarget.blur()\n this.focus()\n }\n\n if(this.inTemplateCreationMode && this.smsOnlyValue) {\n this.nextTick(() => {\n if(this.hasFooterTarget) {\n this.dispatch('footer:disable', {\n target: this.footerTarget\n })\n }\n\n this.dispatch('toolbar:disable', {\n target: this.element,\n detail: ['attachment', 'voice', 'location', 'button']\n })\n })\n }\n }\n\n disconnect() {\n this.templatesToolMutationObserver.disconnect()\n super.disconnect()\n }\n\n onClick({target}) {\n if (target === this.inputContainerTarget) {\n this.focus()\n }\n }\n\n onWindowClick({target}) {\n if(!this.element.contains(target) && document.activeElement === this.trixTarget) {\n this.forceBlur()\n }\n }\n\n // Focus and Blur Methods\n\n onTrixSelectionChange() {\n if (this.restoringSelection) return\n super.onTrixSelectionChange()\n }\n\n focus() {\n if (!this.editor || document.activeElement === this.trixTarget) return\n\n if (this.trixPosition) {\n this.restoreSelectionTo(this.trixPosition)\n }\n\n this.trixTarget.focus()\n }\n\n focusAndMoveToEnd() {\n if (!this.editor) return\n\n this.cursor.moveToEnd()\n this.focus()\n }\n\n onTrixFocus() {\n if (this.isBlurring) return\n\n // Give Trix time to load the updated content before we do this\n this.nextTick(() => this.cursor.ensureCaretVisibility())\n }\n\n forceBlur() {\n // When the user clicks a button in the toolbar, trix will blur, but the cursor will still be visible,\n // allowing the user to type. This way, we force Trix to blur.\n const input = window.document.createElement('input')\n input.classList.add('absolute', '-left-[20rem]', '-top-[20rem]')\n\n document.body.appendChild(input)\n\n input.focus()\n input.remove()\n }\n\n onTrixBlur() {\n const documentString = this.trixDocument.toString()\n\n if ((documentString.length === 2 && documentString.charCodeAt(0) === 8204)) {\n this.isBlurring = true\n\n this.resetContent()\n this.nextTick(() => {\n this.isBlurring = false\n })\n\n return this.trixTarget.blur()\n }\n }\n\n // Focus and Blur Methods\n\n restoreSnapshot({detail: snapshot}) {\n if(snapshot) {\n this.editor.loadSnapshot(snapshot.trixSnapshot)\n\n if (this.technologies) {\n this.technologies.restoreSnapshot(snapshot)\n }\n\n this.footerValue = snapshot.footer\n this.dispatch('footer:restore', {\n target: this.footerTarget,\n detail: snapshot.footer,\n })\n\n this.dispatch('map:restore', {\n target: this.locationContainerTarget,\n detail: {\n latitude: snapshot.location?.lat,\n longitude: snapshot.location?.lng,\n },\n })\n\n this.dispatch('buttons:restore', {\n detail: snapshot.buttons,\n target: this.element.closest('[data-controller*=\"compose--template\"]')\n })\n\n this.nextTick(() => {\n this.cursor.moveToEnd()\n })\n }\n\n this.dispatch('templates:toggle', {\n target: this.templatesMenuTarget,\n detail: this.state.templatesVisible = false\n })\n }\n\n onTrixBeforePaste(event) {\n if (event.paste.hasOwnProperty('html')) {\n let div = document.createElement(\"div\");\n div.innerHTML = event.paste.html;\n event.paste.html = div.textContent;\n }\n }\n\n onTrixPaste(event) {\n this.nextTick(() => {\n this.onTrixContentChange()\n\n const documentLength = this.trixDocument.toString().length\n const {range: [_, end]} = event.paste\n\n if (documentLength === end) {\n // When pasting the content and the document starts with a zero width non joiner space,\n // Cursor will not be moved to the end of pasted content correctly. Because the zero\n // width non joiner space Is removed before the onTrixPaste event is triggered\n // inside onTrixContentChange.\n this.cursor.moveTo(end - 1)\n } else {\n this.cursor.moveTo(end)\n }\n })\n }\n\n onTrixInitialize() {\n super.onTrixInitialize()\n\n this.nextTick(() => {\n if (this.hasContent) {\n this.cursor.moveToEnd()\n }\n })\n\n if(this.disabledWhatsapp) {\n this.disable()\n }\n\n this.dispatchInitializeEvent()\n this.attachEventListenersToFigures()\n\n this.savePositionAfterContentLoad()\n }\n\n savePositionAfterContentLoad() {\n this.nextTick(this.onTrixSelectionChange, 10)\n }\n\n onTrixKeydown(event) {\n const key = KeyboardKey.fromKeyboardEvent(event)\n\n if(this.hasReachedMaxMessageLength && (this.inTemplateCreationMode || !key.isEnter) && !key.isBackspace && !key.hasAnyModifier) {\n return event.preventDefault()\n }\n\n this.syncTagsToolActiveStatus()\n\n if (key.isHotkey) {\n return this.handleHotkey(event)\n }\n\n if (key.isBackspace && this.cursor.pieceBeforeCaret().isShortlink) {\n return this.linksManager.deleteAttachmentInPosition()\n }\n\n if (key.isArrow) {\n return this.handleArrowNavigation(event)\n }\n\n if (this.noSelection && key.isAlphanumeric && this.cursor.pieceBeforeCaretIsShortLink()) {\n this.ensureWhitespaceBeforeCursor()\n }\n\n if (this.noSelection && key.isAlphanumeric && this.cursor.pieceBeforeCaretIsTag()) {\n this.ensureWhitespaceBeforeCursor()\n }\n }\n\n onTrixKeyup(event) {\n this.syncTagsToolActiveStatus()\n this.syncTemplatesMenuStatus()\n\n const key = KeyboardKey.fromKeyboardEvent(event)\n\n if (this.noSelection && key.isAlphanumeric && this.cursor.pieceAtCaretIsShortLink()) {\n this.ensureWhitespaceAfterCursor()\n }\n\n if (this.noSelection && key.isAlphanumeric && this.cursor.pieceAtCaretIsTag()) {\n this.ensureWhitespaceAfterCursor()\n }\n }\n\n handleHotkey(event) {\n const key = KeyboardKey.fromKeyboardEvent(event)\n\n if(key.activateBold || key.activateItalic && this.cursor.pieceAtCaretIsTag()) {\n event.preventDefault()\n }\n\n if (key.activateLink) {\n this.toggleLinkTool()\n }\n\n if (key.isShiftEnter) {\n event.preventDefault()\n this.editor.insertLineBreak()\n this.cursor.moveToRight()\n }\n\n if (key.isEnter && this.hasContent && !key.isShift && !this.state.templatesVisible) {\n event.preventDefault()\n this.submit()\n }\n\n if(key.isPasting) {\n if(this.cursor.pieceBeforeCaretIsTag()) {\n const characterAtCaret = this.cursor.characterAtCaret()\n\n if(characterAtCaret.isLineFeed || !characterAtCaret.isWhitespace) {\n this.insertWhitespace()\n this.cursor.moveToRight(false)\n }\n\n if(characterAtCaret.isWhitespace) {\n this.cursor.moveToRight(false)\n }\n }\n }\n }\n\n handleArrowNavigation(event) {\n const key = KeyboardKey.fromKeyboardEvent(event)\n\n if (key.isLeftArrow && this.cursor.pieceBeforeCaretIsShortLink()) {\n this.cursor.moveToLeft()\n } else if (key.isRightArrow && this.cursor.pieceAtCaretIsShortLink()) {\n this.cursor.moveToRight()\n }\n }\n\n onTrixContentChange() {\n if (this.isBlurring) return\n\n this.dispatch('content:change', {\n detail: this.snapshot\n })\n\n if (this.hasTrixJsonInputTarget) {\n this.trixJsonInputTarget.value = JSON.stringify(this.editor)\n }\n\n if (this.isParsing) return\n\n this.isParsing = true\n\n const trixPosition = this.trixPosition\n\n this.cursor.ensureCaretVisibility()\n\n if (this.empty) return\n\n if (this.documentStartsWithZeroWidthNonJoinerSpace) {\n this.deleteStartingZeroWidthNonJoinerSpace()\n }\n\n this.attachEventListenersToFigures()\n\n this.parser.tokens.forEach((token) => {\n this.applyTagExtensionForWordObject(token, trixPosition)\n })\n\n this.isParsing = false\n }\n\n applyTagExtensionForWordObject(token, trixPosition) {\n this.isParsing = true\n\n if(token.valid && !this.editor.attributeIsActive('background')) {\n // When pasting content, Trix does not apply the styles on valid tags.\n // Doing so on the next tick fixes this issue.\n this.nextTick(() => {\n if(token.shouldAddWhitespaceBefore) {\n this.editor.setSelectedRange(token.start)\n this.insertWhitespace()\n return this.nextTick(() => {\n this.editor.setSelectedRange(token.end + 1)\n })\n }\n\n this.editor.setSelectedRange(token.range)\n this.tagsManager.activate()\n this.editor.setSelectedRange(trixPosition)\n })\n }\n\n if(token.invalid) {\n this.editor.setSelectedRange(token.range)\n this.tagsManager.deactivate()\n this.editor.setSelectedRange(trixPosition)\n }\n\n this.isParsing = false\n }\n\n removeInvalidTagStyles() {\n const pieces = this.trixDocument.getPieces()\n\n pieces.forEach((p, index) => {\n const piece = Piece.wrap(p)\n\n if (piece.isTag && !Contact.isValidTag(piece.string) && !Coupon.isValidTag(piece.string)) {\n const rangeStart = this.contentLengthBeforePiece(index)\n const rangeEnd = rangeStart + parseInt(piece.string.length)\n\n const [currentStart, _] = this.editor.getSelectedRange()\n this.editor.setSelectedRange([rangeStart, rangeEnd].map((i) => parseInt(i)))\n\n this.isParsing = true\n\n this.tagsManager.deactivate()\n this.editor.setSelectedRange(currentStart)\n\n this.isParsing = false\n }\n })\n\n this.onTrixContentChange()\n }\n\n // Link Tool and Link Edit methods\n\n removeLink({ detail: attachmentId }) {\n const attachment = this.trixDocument.getAttachments().find(a => a.id.toString() === attachmentId.toString())\n\n this.editor.recordUndoEntry(\"Delete Attachment\")\n\n const range = this.editor.getDocument().getRangeOfAttachment(attachment)\n this.editor.setSelectedRange(range)\n this.editor.deleteInDirection(\"backward\")\n\n // Collapse the selection once the link is removed\n const currentPosition = this.editor.getSelectedRange()[0]\n this.editor.setSelectedRange([currentPosition, currentPosition])\n\n this.focus()\n }\n\n onLinkEditCancellation() {\n // When a link is selected for being edited, Trix updated the position in onSelectionChange.\n // In the case the user cancels the edit, we need to restore the position to the previous one.\n // If we focus the trixPosition, Trix will focus next to the link, instead of the correct position.\n\n this.editor.setSelectedRange(this.oldPosition)\n this.focus()\n }\n\n handleLinkReceived(event) {\n const linkPartial = event.detail.linkPartial\n const htmlFromPartial = new DOMParser().parseFromString(linkPartial, 'text/html')\n\n const element = htmlFromPartial.querySelector('[data-sgid]')\n const {destination: url, id} = element.dataset\n\n this.state.links[id] = {url}\n\n this.linksManager.insert(event)\n this.attachEventListenersToFigures()\n }\n\n afterAttachmentInsertion() {\n this.attachEventListenersToFigures()\n }\n\n replaceLink(event) {\n this.linksManager.replace(event)\n }\n\n afterAttachmentReplacement(id) {\n delete this.state.links[id]\n }\n\n attachEventListenersToFigures() {\n this.nextTick(() => {\n this.trixTarget.querySelectorAll('figure').forEach(figure => {\n figure.removeEventListener('click', this.onFigureClicked.bind(this))\n figure.addEventListener('click', this.onFigureClicked.bind(this))\n\n const { id, url } = JSON.parse(figure.dataset.trixAttachment)\n\n if(url) {\n this.state.links[id] = {url}\n }\n })\n })\n }\n\n // Link Tool and Link Edit methods\n\n onFigureClicked(event) {\n event.preventDefault()\n event.stopPropagation()\n\n const figure = event.currentTarget\n const element = figure.firstElementChild\n\n let { link: clientUrl, id } = JSON.parse(figure.dataset.trixAttachment)\n\n const controller = this.application.getControllerForElementAndIdentifier(this.linkEditTool, 'link--edit')\n\n if (id in this.state.links) {\n clientUrl = this.state.links[id].url\n } else {\n this.state.links[id] = {\n url: clientUrl\n }\n }\n\n const detail = {\n figureElement: figure,\n linkElement: element,\n clientUrl,\n id\n }\n\n controller.editLink({detail})\n }\n\n onLinkUpdated({detail}) {\n const {id, url} = detail\n this.state.links[id] = {url}\n\n this.editor.setSelectedRange(this.oldPosition)\n this.focus()\n\n this.linkInputsListTarget.innerHTML = ''\n\n Object.entries(this.state.links).forEach(([id, {url}], index) => {\n const object = { id, url }\n\n Object.entries(object).forEach(([key, value]) => {\n const inputElement = document.createElement('input')\n inputElement.type = 'hidden'\n inputElement.name = `${this.nameValue}[links][${index}][${key}]`\n inputElement.value = value\n\n this.linkInputsListTarget.appendChild(inputElement)\n })\n })\n }\n\n\n insertTag(event) {\n this.tagsManager.insert(event)\n }\n\n toggleLinkTool() {\n this.element.querySelector(`[data-tool='link'] [data-cancel-button]`).click()\n }\n\n toggleVCardTool() {\n this.element.querySelector(`[data-tool='vcard'] [data-launcher]`).click()\n }\n\n showNoteForm() {\n this.noteToolIconTarget.click()\n }\n\n syncTagsToolActiveStatus() {\n const eventName = this.editor.attributeIsActive('background') ? 'toolbar:disable' : 'toolbar:enable'\n\n this.dispatch(eventName, {\n target: this.element,\n detail: ['tag', 'link', 'coupon']\n })\n }\n\n // Templates Tool Methods\n\n templatesToolMutationObserverCallback(mutations) {\n mutations.forEach((mutation) => {\n if (mutation.type === 'attributes') {\n this.state.templatesVisible = mutation.target.hasAttribute('data-visible')\n this.onTemplatesVisibilityChange()\n }\n })\n }\n\n toggleTemplatesMenu() {\n this.dispatch('templates:toggle', {\n target: this.templatesMenuTarget,\n detail: this.state.templatesVisible = !this.state.templatesVisible\n })\n\n if (this.state.templatesVisible) {\n this.forceBlur()\n } else {\n this.focus()\n }\n\n this.onTemplatesVisibilityChange()\n }\n\n onTemplatesVisibilityChange() {\n if (!this.hasTemplatesMenuTarget) return\n\n if (this.state.templatesVisible) {\n this.addClass(this.templatesIconTarget, 'text-tiger',)\n } else {\n this.removeClass(this.templatesIconTarget, 'text-tiger',)\n }\n }\n\n syncTemplatesMenuStatus() {\n if (!this.hasTemplatesMenuTarget) return\n\n const event = this.shouldOpenTemplatesMenu ? 'templates:open' : 'templates:close'\n\n this.dispatch(event, {\n target: this.templatesMenuTarget,\n detail: this.documentStringWithoutZeroWidthNonJoinerAndLineFeed.split('/')[1]?.trim()\n })\n }\n\n templatesTechnologyChanged({detail}) {\n if(this.editor) {\n this.dispatch('content:change', {\n detail: this.snapshot\n })\n }\n\n const { ids, names } = detail\n\n if(ids.length === 1 && names[0] === 'sms') {\n if(this.hasFooterTarget) {\n this.dispatch('footer:disable', {\n target: this.footerTarget\n })\n }\n\n this.dispatch('toolbar:disable', {\n target: this.element,\n detail: ['attachment', 'voice', 'location', 'button']\n })\n } else {\n if(this.hasFooterTarget) {\n this.dispatch('footer:enable', {\n target: this.footerTarget\n })\n }\n\n let tools = ['attachment', 'voice', 'location', 'button']\n\n if(this.hasLocation) {\n tools = tools.filter(tool => tool !== 'attachment')\n }\n\n if(this.hasMediaAttachments) {\n tools = tools.filter(tool => tool !== 'location')\n }\n\n this.dispatch('toolbar:enable', {\n target: this.element,\n detail: tools\n })\n }\n\n if (!this.hasTemplatesMenuTarget) return\n\n this.dispatch('template:technologies:changed', {\n detail: detail.ids,\n target: this.templatesMenuTarget\n })\n }\n\n saveTemplateId({detail: template}) {\n if (!template.id || (template.selectionMethod === 'enter' && this.hasTextContent)) return\n\n this.templateIdInputTarget.value = template.id\n this.template = template\n\n this.editor.loadHTML(template.body)\n\n if(['whatsapp', 'instagram'].includes(this.technologyValue.name) && !this.technologyValue.enabled && !this.inTemplateCreationMode) {\n return this.dispatch('toolbar:show-send-button', {\n target: this.element,\n })\n }\n\n this.focus()\n this.onTrixContentChange()\n\n this.nextTick(() => this.cursor.moveToEnd())\n\n this.dispatch('toolbar:coupon:change', {\n target: this.element,\n detail: template.coupon\n })\n\n if(this.hasFooterTarget) {\n this.dispatch('footer:change', {\n target: this.footerTarget,\n detail: template.footer\n })\n }\n\n this.dispatch('map:restore', {\n target: this.locationContainerTarget,\n detail: {\n latitude: template.location?.latitude,\n longitude: template.location?.longitude\n }\n })\n\n this.dispatch('buttons:change', {\n detail: {\n buttons: template.buttons,\n element: template.element\n }\n })\n\n this.dispatch('attachment:set', {\n detail: template.attachment,\n target: this.mediaAttachmentToolTarget\n })\n }\n\n clipForwardSlashAtStartOfContent() {\n this.focus()\n\n const characterAtFirstPosition = this.cursor.characterAtCaret(0)\n\n if(characterAtFirstPosition.isForwardSlash) {\n const currentPosition = this.oldPosition\n\n this.editor.setSelectedRange([0, 1])\n this.editor.deleteInDirection('forward')\n\n this.editor.setSelectedRange(currentPosition)\n }\n }\n\n submit() {\n this.inputTarget.disabled = this.documentStringWithoutZeroWidthNonJoinerAndLineFeed.length === 0\n\n if(document.querySelectorAll(\"[data-uploading]\").length > 0) {\n return this.showToast({\n message: this.translations.compose.submit.blocked_by_attachments_uploading,\n })\n }\n\n if(document.querySelectorAll(\"[data-upload-error]\").length > 0) {\n return this.showToast({\n message: this.translations.compose.submit.blocked_by_uploaded_attachment_error,\n })\n }\n\n if(this.hasReachedMaxMessageLength && this.technologyValue.name !== 'sms') {\n return this.showToast({\n message: this.translations.compose.submit.blocked_by_overflow.replace('%{max_length}', this.technologyValue.max_message_length),\n })\n }\n\n this.dispatch('keydown:enter', {\n detail: this.snapshot\n })\n }\n\n insertEmoji({ detail: emoji }) {\n this.editor.insertString(emoji.native)\n }\n\n // Templates Tool Methods\n\n onAttachmentAdded({ detail: element }) {\n this.attachments.push(element)\n\n this.dispatch('content:change', {\n detail: this.snapshot\n })\n\n this.focus()\n }\n\n onAttachmentRemoved({ detail: element }) {\n this.attachments = Array.from(this.attachments).filter((attachment) => attachment !== element)\n\n this.dispatch('content:change', {\n detail: this.snapshot\n })\n\n this.focus()\n }\n\n onCouponSet({detail}) {\n this.couponIdInputTarget.value = detail.token\n }\n\n onCouponUnset() {\n this.couponIdInputTarget.value = ''\n }\n\n onSourceChannelChange({ detail }) {\n this.technologyValue = detail\n }\n\n onTechnologyChange({ detail }) {\n this.technologyValue = {\n ...detail.technology,\n enabled: detail.technology.name === 'sms' ? true : detail.window?.open\n }\n\n this.windowValue = detail.window\n\n if(detail.window?.open || detail.technology.name === 'sms') {\n this.enableCompose()\n } else {\n this.disable()\n }\n }\n\n editTemplate() {\n if(this.isEnabled) {\n return this.focus()\n }\n\n let url = this.editTemplateUrlValue\n\n if(this.template.source === 'broadcast') {\n url = url.replace(':id', `/campaigns/${this.template.id}`)\n } else if(this.template.source === 'message') {\n url = url.replace(':id', `/journeys/${this.template.id}`)\n } else {\n url = url.replace(':id', this.template.id)\n }\n\n const hiddenAnchor = document.createElement('a')\n hiddenAnchor.href = url\n hiddenAnchor.target = '_blank'\n\n hiddenAnchor.click()\n }\n\n // private\n\n enableCompose() {\n this.enable()\n this.focus()\n this.nextTick(() => this.cursor.moveToEnd())\n\n this.templatesIconTarget.classList.replace('bg-transparent', 'bg-white')\n }\n\n disable() {\n super.disable()\n this.templatesIconTarget.classList.replace('bg-white', 'bg-transparent')\n }\n\n onTrixClick() {\n if(this.isDisabled) {\n this.templatesIconTarget.click()\n }\n }\n\n dispatchInitializeEvent() {\n this.attachments = Array.from(this.element.querySelectorAll('[data-controller=\"editor--attached-media\"]')) || []\n\n this.dispatch('initialize', {\n detail: this.snapshot\n })\n }\n\n toString() {\n return this.trixDocument.getPieces().map(piece => {\n if (piece.attachment) {\n return piece.attachment.attributes.values.caption\n }\n\n return piece.string\n }).join('')\n }\n\n onMapClick({ detail: { latitude, longitude } }) {\n this.latitudeValue = latitude\n this.longitudeValue = longitude\n\n this.dispatch('content:change', {\n detail: this.snapshot,\n })\n }\n\n unsetLocationCoordinates() {\n this.latitudeValue = null\n this.longitudeValue = null\n\n this.dispatch('content:change', {\n detail: this.snapshot,\n })\n }\n\n onFooterChange({ detail: footer }) {\n this.footerValue = footer\n\n this.dispatch('content:change', {\n detail: this.snapshot,\n })\n }\n\n saveButtonsSnapshot({ detail: types }) {\n this.buttonsSnapshotValue = types\n\n this.dispatch('content:change', {\n detail: this.snapshot,\n })\n }\n\n clearAttributesFromSnapshot() {\n this.latitudeValue = this.longitudeValue = null\n this.footerValue = null\n\n this.attachments.forEach(attachment => attachment.remove())\n this.mediaContainerTarget.classList.add('hidden')\n this.attachments = []\n this.buttonsSnapshotValue = null\n\n this.dispatch('map:clear', { target: this.locationContainerTarget })\n this.dispatch('footer:clear', { target: this.footerTarget })\n this.dispatch('buttons:clear', { target: this.element.closest('[data-controller*=\"compose--template\"]') })\n }\n\n clearLocationValue() {\n this.latitudeValue = null\n this.longitudeValue = null\n }\n\n get snapshot() {\n const string = this.trixDocument.toString().replace(/\\u200C/g, '')\n\n return {\n string: string.length > 1 ? this.toString() : '',\n pieces: this.trixDocument.getPieces(),\n trixSnapshot: this.editor.getSnapshot(),\n ...this.technologies.snapshot,\n html: this.trixTarget.innerHTML,\n overflow: this.inTemplateCreationMode && this.hasReachedMaxMessageLength,\n technology: this.technologyValue,\n template: this.template,\n templateChanged: this.template && this.template.plain_text.trim() !== string.trim(),\n location: this.hasLocation ? { lat: this.latitudeValue, lng: this.longitudeValue } : null,\n footer: this.footerValue,\n buttons: this.buttonsSnapshotValue,\n attachments: this.attachments,\n links: this.state.links,\n }\n }\n\n get technologies() {\n if (!this.hasTechnologiesTarget) return {}\n\n return this.application.getControllerForElementAndIdentifier(this.technologiesTarget, 'compose--technologies')\n }\n\n resetTargetConnected() {\n this.resetContent()\n this.templateIdInputTarget.value = ''\n\n this.resetTarget.remove()\n\n this.mediaContainerTarget.classList.add('hidden')\n this.mediaContainerListTarget.innerHTML = ''\n\n if(this.hasTemplatesMenuTarget && this.state.templatesVisible) {\n this.templatesIconTarget.click()\n }\n\n if(this.windowValue?.open || this.technologyValue.name === 'sms') {\n this.enableCompose()\n } else {\n this.disable()\n }\n }\n\n focusTargetConnected() {\n this.nextTick(() => this.focus(), 500)\n }\n\n contentLengthBeforePiece(index) {\n return this.trixDocument\n .getPieces()\n .filter((piece, position) => position < index)\n .map(piece => piece.attachment ? 1 : piece.string.length)\n .reduce((a, b) => a + b, 0)\n }\n\n get hasContent() {\n return this.hasTextContent || this.hasAttachments\n }\n\n get hasTextContent() {\n return this.documentStringWithoutZeroWidthNonJoinerAndLineFeed.length >= 1\n }\n\n get hasAttachments() {\n return this.hasVoiceMessage || this.hasMediaAttachments || this.hasLocation\n }\n\n get hasVoiceMessage() {\n return this.hasVoiceContainerTarget && this.voiceContainerTarget.querySelector('audio')\n }\n\n get hasMediaAttachments() {\n return this.hasMediaContainerListTarget && this.mediaContainerListTarget.children.length > 0\n }\n\n get hasLocation() {\n return this.hasLocationContainerTarget && !this.locationContainerTarget.classList.contains('hidden')\n }\n\n get linkEditTool() {\n return this.element.querySelector(`[data-tool='link-edit']`)\n }\n\n get shouldOpenTemplatesMenu() {\n return this.trixDocument.toString().startsWith('/')\n }\n\n get empty() {\n return this.trixDocument.toString().length === 1\n }\n\n isOlderThanOneDay(date) {\n const now = new Date();\n const twentyFourHoursAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);\n\n return date < twentyFourHoursAgo;\n }\n\n get hasReachedMaxMessageLength() {\n return this.trixDocument.toString().trim().length >= this.technologyValue.max_message_length\n }\n}\n"],"names":["LinksManager","AttachmentManager","event","attachment","detail","id","linkPartial","piece","index","elementId","contentLengthBeforeReplacedPiece","element","destination","link","sgid","TagsManager","inputController","pieceAtCursor","pieceBeforeCursor","tag","characterAtCursor","characterBeforeCursor","_","tagEndsAt","tagStartsAt","input_controller","ComposeController","init","data","target","input","documentString","snapshot","_a","_b","div","documentLength","end","key","KeyboardKey","characterAtCaret","trixPosition","token","p","Piece","Contact","Coupon","rangeStart","rangeEnd","currentStart","i","attachmentId","range","currentPosition","url","figure","clientUrl","controller","value","inputElement","eventName","mutations","mutation","ids","names","tools","tool","template","emoji","hiddenAnchor","latitude","longitude","footer","types","string","position","a","b","date","now","twentyFourHoursAgo","__publicField"],"mappings":"4XAEA,MAAMA,UAAqBC,CAAkB,CAC3C,OAAOC,EAAO,CACZ,MAAMC,EAAa,KAAK,kCAAkCD,EAAM,OAAO,WAAW,EAClF,MAAM,OAAOC,CAAU,CAC3B,CAEE,QAAQ,CAAE,OAAAC,GAAU,CAClB,KAAM,CAAE,GAAAC,EAAI,YAAAC,GAAgBF,EAE5B,KAAK,OAAO,iBAAiB,KAAK,WAAW,EAE7C,KAAK,aAAa,UAAS,EAAG,QAAQ,CAACG,EAAOC,IAAU,CACtD,GAAG,CAACD,EAAM,WAAY,OAEtB,MAAME,EAAY,IAAI,UAAS,EAC5B,gBAAgBF,EAAM,WAAW,WAAW,OAAO,QAAS,WAAW,EACvE,cAAc,WAAW,EACzB,QACA,GAEH,GAAGF,IAAOI,EAAW,CACnB,MAAMC,EAAmC,KAAK,yBAAyBF,CAAK,EAC5E,KAAK,OAAO,iBAAiB,CAACE,EAAkCA,EAAmC,CAAC,CAAC,EAErG,KAAK,OAAO,k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