{"version":3,"file":"virtual_main.js","sources":["theme-2/virtual:init-settings","theme-2/virtual:theme","theme-2/discourse/components/search-banner.hbs","theme-2/discourse/components/search-banner.js","theme-2/discourse/api-initializers/init-search-banner.js","theme-2/discourse/components/search-icon.gjs","theme-2/virtual:main"],"sourcesContent":["import { registerSettings } from \"discourse/lib/theme-settings-store\";\n\nregisterSettings(2, {\n  \"show_on\": \"top_menu\",\n  \"plugin_outlet\": \"above-main-container\",\n  \"background_image_light\": null,\n  \"background_image_dark\": null,\n  \"tile_background_image\": false,\n  \"show_for\": \"everyone\",\n  \"special_style\": \"basic style (default)\"\n});\n","import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(2);\n\nexport function themePrefix(key) {\n  return `theme_translations.2.${key}`;\n}\n","{{#if this.shouldDisplay}}\n  <div\n    class=\"{{concat (theme-setting 'plugin_outlet') '-outlet'}} search-banner\"\n  >\n    <div\n      class=\"custom-search-banner\"\n      {{did-insert this.didInsert}}\n      {{will-destroy this.willDestroy}}\n    >\n      <div class=\"wrap custom-search-banner-wrap\">\n        <h1>{{html-safe (theme-i18n \"search_banner.headline\")}}</h1>\n        <PluginOutlet @name=\"search-banner-below-headline\" />\n        <p>{{html-safe (theme-i18n \"search_banner.subhead\")}}</p>\n        <div class=\"search-menu\">\n          {{#unless this.buttonText}}\n            <SearchIcon />\n          {{/unless}}\n          <SearchMenu />\n          {{#if this.buttonText}}\n            <SearchIcon\n              @buttonText={{this.buttonText}}\n              @buttonClass=\"has-search-button-text\"\n            />\n          {{/if}}\n        </div>\n        <PluginOutlet @name=\"search-banner-below-input\" />\n      </div>\n    </div>\n  </div>\n{{/if}}","import Component from \"@glimmer/component\";\nimport { action } from \"@ember/object\";\nimport { service } from \"@ember/service\";\nimport { defaultHomepage } from \"discourse/lib/utilities\";\nimport { i18n } from \"discourse-i18n\";\n\nexport default class SearchBanner extends Component {\n  @service router;\n  @service siteSettings;\n  @service currentUser;\n\n  @action\n  willDestroy() {\n    super.willDestroy(...arguments);\n    document.documentElement.classList.remove(\"display-search-banner\");\n  }\n\n  get displayForRoute() {\n    const showOn = settings.show_on;\n    const currentRouteName = this.router.currentRouteName;\n\n    if (showOn === \"homepage\") {\n      return currentRouteName === `discovery.${defaultHomepage()}`;\n    } else if (showOn === \"top_menu\") {\n      return this.siteSettings.top_menu\n        .split(\"|\")\n        .any((m) => `discovery.${m}` === currentRouteName);\n    } else if (showOn === \"discovery\") {\n      return currentRouteName.startsWith(\"discovery.\");\n    } else {\n      // \"all\"\n      return (\n        currentRouteName !== \"full-page-search\" &&\n        !currentRouteName.startsWith(\"admin.\")\n      );\n    }\n  }\n\n  get displayForUser() {\n    const showFor = settings.show_for;\n    return (\n      showFor === \"everyone\" ||\n      (showFor === \"logged_out\" && !this.currentUser) ||\n      (showFor === \"logged_in\" && this.currentUser)\n    );\n  }\n\n  get buttonText() {\n    const buttonText = i18n(themePrefix(\"search_banner.search_button_text\"));\n    // this is required for when the English (US) locale is empty\n    // and the site locale is set to another language\n    // otherwise the English (US) fallback key is rendered as the button text\n    // https://meta.discourse.org/t/bug-with-search-banner-search-button-text-shown-in-search-banner-theme-component/273628\n    if (buttonText.includes(\"theme_translations\")) {\n      return false;\n    }\n\n    return buttonText;\n  }\n\n  get shouldDisplay() {\n    return this.displayForRoute && this.displayForUser;\n  }\n\n  @action\n  didInsert() {\n    // Setting a class on <html> from a component is not great\n    // but we need it for backwards compatibility\n    document.documentElement.classList.add(\"display-search-banner\");\n  }\n}\n","import { apiInitializer } from \"discourse/lib/api\";\nimport SearchBanner from \"../components/search-banner\";\n\nexport default apiInitializer(\"1.14.0\", (api) => {\n  api.renderInOutlet(\n    settings.plugin_outlet === \"above-main-container\"\n      ? \"above-main-container\"\n      : \"below-site-header\",\n    SearchBanner\n  );\n\n  api.forceDropdownForMenuPanels(\"search-menu-panel\");\n});\n","import Component from \"@glimmer/component\";\nimport DButton from \"discourse/components/d-button\";\nimport concatClass from \"discourse/helpers/concat-class\";\n\nexport default class SearchIcon extends Component {\n  get advancedSearchButtonHref() {\n    return \"/search?expanded=true\";\n  }\n\n  <template>\n    <DButton\n      @icon=\"magnifying-glass\"\n      @translatedLabel={{@buttonText}}\n      @title=\"search.open_advanced\"\n      class={{concatClass \"btn search-icon\" @buttonClass}}\n      @href={{this.advancedSearchButtonHref}}\n    />\n  </template>\n}\n","import \"virtual:init-settings\";\n\nconst themeCompatModules = {};\nimport * as Mod1 from \"./discourse/api-initializers/init-search-banner\";\nthemeCompatModules[\"discourse/api-initializers/init-search-banner\"] = Mod1;\n\nimport * as Mod2 from \"./discourse/components/search-banner\";\nthemeCompatModules[\"discourse/components/search-banner\"] = Mod2;\n\nimport * as Mod3 from \"./discourse/components/search-banner\";\nthemeCompatModules[\"discourse/components/search-banner\"] = Mod3;\n\nimport * as Mod4 from \"./discourse/components/search-icon\";\nthemeCompatModules[\"discourse/components/search-icon\"] = Mod4;\n\nexport default themeCompatModules;\n"],"names":["registerSettings","show_on","plugin_outlet","background_image_light","background_image_dark","tile_background_image","show_for","special_style","settings","getObjectForTheme","createTemplateFactory","id","block","moduleName","isStrictMode","SearchBanner","Component","static","dt7948","g","this","prototype","service","router","i","siteSettings","currentUser","willDestroy","super","arguments","document","documentElement","classList","remove","n","action","displayForRoute","showOn","currentRouteName","defaultHomepage","top_menu","split","any","m","startsWith","displayForUser","showFor","buttonText","i18n","includes","shouldDisplay","didInsert","add","_setComponentTemplate","__COLOCATED_TEMPLATE__","initSearchBanner","apiInitializer","api","renderInOutlet","forceDropdownForMenuPanels","SearchIcon","advancedSearchButtonHref","setComponentTemplate","scope","DButton","concatClass","themeCompatModules","Mod1","Mod2","Mod3","Mod4"],"mappings":";AAEAA,EAAiB,EAAG,CAClBC,QAAW,WACXC,cAAiB,uBACjBC,uBAA0B,KAC1BC,sBAAyB,KACzBC,uBAAyB,EACzBC,SAAY,WACZC,cAAiB;ACPZ,MAAMC,EAAWC,EAAkB;QCA5BC,EAAA,CAAAC,GAAA,KAAAC,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