{"version":3,"file":"link_controller-CJhBMAR7.js","sources":["../../../app/javascript/controllers/inbox/link_controller.js"],"sourcesContent":["import ApplicationController from '../application_controller'\n\nexport default class extends ApplicationController {\n static targets = ['unreadCountContainer']\n\n onClick(e) {\n if (this.onMobile && window.location.href.includes(\"inbox/\")) {\n e.stopPropagation()\n e.preventDefault()\n\n let event = new CustomEvent(\"inbox:toggle\", {\n bubbles: true,\n cancelable: true,\n })\n event.data = this.element.dataset\n\n window.dispatchEvent(event)\n }\n }\n\n updateUnreadCountContainer() {\n const count = parseInt(this.unreadCountContainerTarget.textContent) - 1\n\n if(count === 0) {\n this.unreadCountContainerTarget.classList.add(\"hidden\")\n } else {\n this.unreadCountContainerTarget.textContent = count\n this.unreadCountContainerTarget.classList.remove(\"hidden\")\n }\n }\n\n unreadCountContainerTargetDisconnected() {\n if(!document.location.href.endsWith('inbox')) return\n\n const count = parseInt(this.unreadCountContainerTarget.textContent) || 0\n\n if(count === 1) {\n document.title = t.conversations.unread_messages.one + ' | Hellotext'\n } else if(count > 1) {\n document.title = t.conversations.unread_messages.other.replace('%{count}', count) + ' | Hellotext'\n } else {\n document.title = t.inbox.inbox + '| Hellotext'\n }\n }\n}\n"],"names":["link_controller","ApplicationController","event","count","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAGjD,QAAQ,EAAG,CACT,GAAI,KAAK,UAAY,OAAO,SAAS,KAAK,SAAS,QAAQ,EAAG,CAC5D,EAAE,gBAAe,EACjB,EAAE,eAAc,EAEhB,IAAIC,EAAQ,IAAI,YAAY,eAAgB,CAC1C,QAAS,GACT,WAAY,EACb,CAAA,EACDA,EAAM,KAAO,KAAK,QAAQ,QAE1B,OAAO,cAAcA,CAAK,CAChC,CACA,CAEE,4BAA6B,CAC3B,MAAMC,EAAQ,SAAS,KAAK,2BAA2B,WAAW,EAAI,EAEnEA,IAAU,EACX,KAAK,2BAA2B,UAAU,IAAI,QAAQ,GAEtD,KAAK,2BAA2B,YAAcA,EAC9C,KAAK,2BAA2B,UAAU,OAAO,QAAQ,EAE/D,CAEE,wCAAyC,CACvC,GAAG,CAAC,SAAS,SAAS,KAAK,SAAS,OAAO,EAAG,OAE9C,MAAMA,EAAQ,SAAS,KAAK,2BAA2B,WAAW,GAAK,EAEpEA,IAAU,EACX,SAAS,MAAQ,EAAE,cAAc,gBAAgB,IAAM,eAC/CA,EAAQ,EAChB,SAAS,MAAQ,EAAE,cAAc,gBAAgB,MAAM,QAAQ,WAAYA,CAAK,EAAI,eAEpF,SAAS,MAAQ,EAAE,MAAM,MAAQ,aAEvC,CACA,CAzCEC,EADkBJ,EACX,UAAU,CAAC,sBAAsB"}