{"version":3,"file":"main.CGSBCG.js","sources":["theme-106/virtual:theme","theme-106/discourse/components/chat-button.gjs","theme-106/discourse/connectors/above-main-container/chat-button.gjs","theme-106/virtual:entrypoint:main"],"sourcesContent":["import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(106);\n\nexport function themePrefix(key) {\n  return `theme_translations.106.${key}`;\n}\n","import Component from \"@glimmer/component\";\nimport { action } from \"@ember/object\";\nimport { service } from \"@ember/service\";\nimport { settings } from \"virtual:theme\";\nimport optionalService from \"discourse/lib/optional-service\";\nimport { defaultHomepage } from \"discourse/lib/utilities\";\nimport DButton from \"discourse/ui-kit/d-button\";\n\nexport default class ChatButton extends Component {\n  @service currentUser;\n  @service router;\n  @service siteSettings;\n\n  // the chat plugin is optional, so look the service up lazily\n  @optionalService chat;\n\n  get mustShow() {\n    return (\n      Boolean(this.chat) &&\n      Boolean(this.currentUser) &&\n      this.siteSettings.chat_enabled &&\n      settings.chatbot_username?.length > 0 &&\n      this.router.currentRouteName === `discovery.${defaultHomepage()}`\n    );\n  }\n\n  @action\n  launchBotchat() {\n    this.chat\n      .upsertDmChannel({ usernames: [settings.chatbot_username] })\n      .then((chatChannel) => {\n        this.router.transitionTo(\"chat.channel\", ...chatChannel.routeModels);\n      });\n  }\n\n  <template>\n    {{#if this.mustShow}}\n      <DButton\n        @id=\"chatbot-button\"\n        class=\"btn-floating open-new-message-btn\"\n        @action={{this.launchBotchat}}\n        @icon={{settings.chatbutton_icon}}\n      />\n    {{/if}}\n  </template>\n}\n","import ChatButton from \"../../components/chat-button\";\n\n<template>\n  <ChatButton />\n</template>\n","import * as Mod1 from \"./discourse/components/chat-button\";\nimport * as Mod2 from \"./discourse/connectors/above-main-container/chat-button.gjs\";\nconst compatModules = {\n  \"discourse/components/chat-button\": Mod1,\n  \"discourse/connectors/above-main-container/chat-button\": Mod2,\n};\nexport default compatModules;\n"],"names":["settings","getObjectForTheme","ChatButton","Component","dt7948","g","this","prototype","service","currentUser","i","router","siteSettings","optionalService","chat","mustShow","Boolean","chat_enabled","chatbot_username","length","currentRouteName","defaultHomepage","launchBotchat","upsertDmChannel","usernames","then","chatChannel","transitionTo","routeModels","n","action","setComponentTemplate","createTemplateFactory","id","block","moduleName","scope","DButton","isStrictMode","chatButton","templateOnly","compatModules","Mod1"],"mappings":"isBAEaA,EAAWC,EAAkB;ACM3B,MAAMC,UAAmBC,SAAAC,OAAAC,EAAAC,KAAAC,yBACrCC,GAAA,CAAAC,QAAAL,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,oBACAC,GAAA,CAAAG,QAAAP,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,0BACAC,GAAA,CAAAI,QAAAR,OAAAM,EAAAJ,KAAA;OAAAF,OAAAC,EAAAC,KAAAC,kBAGAM,GAAA,CAAAC,QAAAV,OAAAM,EAAAJ,KAAA;AAED,YAAIS,GACF,OACEC,QAAQV,KAAKQ,OACbE,QAAQV,KAAKG,cACbH,KAAKM,aAAaK,cAClBjB,EAASkB,kBAAkBC,OAAS,GACpCb,KAAKK,OAAOS,mBAAqB,aAAaC,KAElD,CAGAC,aAAAA,GACEhB,KAAKQ,KACFS,gBAAgB,CAAEC,UAAW,CAACxB,EAASkB,oBACvCO,KAAMC,IACLpB,KAAKK,OAAOgB,aAAa,kBAAmBD,EAAYE,cAE9D,QAAAxB,OAAAyB,EAAAvB,KAAAC,2BAPCuB,GAAA,QASDC,EAAAC,EAAA,CAAAC,GAAA,KAAAC,MAAA,wOAAAC,WAAA,4BAAAC,MAAAA,IAAA,CAAAC,EAAArC,GAAAsC,cAAA,IASAhC,KAAU,kDC1CZiC,EAAAR,EAAAC,EAAA,CAAAC,GAAA,KAAAC,MAAA,sCAAAC,WAAA,4BAAAC,MAAAA,KAAAlC,GAAAoC,cAAA,IAAAE;ACAK,MAACC,EAAgB,CACpB,mCAAoCC,EACpC;"}