{"version":3,"file":"discourse-templates.js","names":["define","_exports","_component","_tracking","_object","_didInsert","_runloop","_service","_conditionalLoadingSpinner","_textField","_ajax","_ajaxError","_decorators","_tagDrop","_discourseI18n","_item","_tagDrop2","_component2","_templateFactory","Object","defineProperty","value","default","PREV_TEMPLATE_TAG_ID","DTemplatesFilterableList","dt7948","g","this","prototype","service","siteSettings","i","keyValueStore","tracked","loading","listFilter","replies","ALL_TAGS_ID","selectedTag","availableTags","filteredReplies","filterTitle","toLowerCase","map","template","score","title","includes","content","filter","NO_TAG_ID","tags","length","sort","a","b","usages","n","computed","load","results","ajax","templates","tagging_enabled","values","reduce","forEach","tag","count","id","name","prevSelectedTag","get","find","t","remove","e","popupAjaxError","schedule","document","querySelector","focus","bind","changeSelectedTag","tagId","set","key","action","insertTemplate","args","onBeforeInsertTemplate","onInsertTemplate","onAfterInsertTemplate","setComponentTemplate","createTemplateFactory","block","moduleName","scope","i18n","isStrictMode","_helper","_routing","_cookText","_dIcon","_templateOnly","ItemContent","LinkTo","array","undefined","_dButton","_itemContent","DTemplatesItem","apply","type","catch","_dModal","_filterableList","Form","appEvents","constructor","super","arguments","closeModal","on","willDestroy","off","DTemplatesTagDrop","topTags","search","defaultItem","tagFilter","onChange","onChangeSelectedTag","_form","DTemplatesModalContainer","dTemplatesModal","SELECTOR_EDITOR_PREVIEW","DTemplatesEditorPreview","c","shouldRender","context","site","mobileView","templatesVisible","show","elemEditorPreview","style","display","hide","classNames","_concatClass","_debounce","DiscourseTemplatesButton","outletArgs","helper","model","is_template","currentUser","can_create_topic","composer","copyConfirm","fetchRaw","topic","dataType","createNewTopic","text","openNewTopic","body","copy","navigator","clipboard","writeText","resetCopyButton","_pluginApi","_keyboardShortcuts","_variablesChatChannel","_variablesChatThread","initialize","container","lookup","discourse_templates_enabled","can_use_templates","withPluginApi","api","dTemplates","addComposerToolbarPopupMenuOption","icon","label","showComposerUI","addOptionsMenuItem","addKeyboardShortcut","PLATFORM_KEY_MODIFIER","event","preventDefault","isComposerFocused","target","_templateShortcutTargets","isTextAreaFocused","isFocused","activeElement","showTextAreaUI","variables","global","help","category","definition","keys1","keysDelimiter","userCanChat","channelVariablesExtractor","chat","activeChannel","currentMessage","draft","router","threadVariablesExtractor","activeThread","registerChatComposerButton","position","contextVariablesExtractor","textarea","displayed","push","element","addChatIntegration","DTemplatesModalService","_owner","_textareaTextManipulation","_replaceVariables","_variablesComposer","DTemplatesService","modal","insertTemplateIntoComposer","isPreviewVisible","showModal","showComposerPreviewUI","variablesExtractor","isTextArea","insertTemplateIntoTextArea","extractVariables","contains","classList","modalModel","activeModal","opts","composerModel","getOwner","composerElement","nodeName","trigger","replaceTemplateVariables","insertBlock","templateVariables","replaceVariables","my_username","username","my_name","displayName","_user","TEMPLATES_ALLOWED_VARIABLES","modelVariables","current","replace","RegExp","freeze","channel","message","inReplyTo","channelVariables","chat_channel_name","chat_channel_url","routeModels","urlFor","reply_to_username","user","reply_to_name","context_title","context_url","thread","originalMessage","threadVariables","chat_thread_name","chat_thread_url","composerVariables","topic_title","topic_url","url","original_poster_username","details","created_by","original_poster_name","post","last_poster_username","reply_to_or_last_poster_username"],"sources":["discourse/plugins/discourse-templates/discourse/components/d-templates/filterable-list.js","discourse/plugins/discourse-templates/discourse/components/d-templates/item-content.js","discourse/plugins/discourse-templates/discourse/components/d-templates/item.js","discourse/plugins/discourse-templates/discourse/components/d-templates/modal/form.js","discourse/plugins/discourse-templates/discourse/components/d-templates/tag-drop.js","discourse/plugins/discourse-templates/discourse/connectors/below-footer/d-templates-modal-container.js","discourse/plugins/discourse-templates/discourse/connectors/editor-preview/d-templates.js","discourse/plugins/discourse-templates/discourse/connectors/topic-above-posts/discourse-templates-button.js","discourse/plugins/discourse-templates/discourse/initializers/d-templates.js","discourse/plugins/discourse-templates/discourse/services/d-templates-modal.js","discourse/plugins/discourse-templates/discourse/services/d-templates.js","discourse/plugins/discourse-templates/lib/replace-variables.js","discourse/plugins/discourse-templates/lib/variables-chat-channel.js","discourse/plugins/discourse-templates/lib/variables-chat-thread.js","discourse/plugins/discourse-templates/lib/variables-composer.js"],"sourcesContent":["define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/filterable-list\", [\"exports\", \"@glimmer/component\", \"@glimmer/tracking\", \"@ember/object\", \"@ember/render-modifiers/modifiers/did-insert\", \"@ember/runloop\", \"@ember/service\", \"discourse/components/conditional-loading-spinner\", \"discourse/components/text-field\", \"discourse/lib/ajax\", \"discourse/lib/ajax-error\", \"discourse/lib/decorators\", \"discourse/select-kit/components/tag-drop\", \"discourse-i18n\", \"discourse/plugins/discourse-templates/discourse/components/d-templates/item\", \"discourse/plugins/discourse-templates/discourse/components/d-templates/tag-drop\", \"@ember/component\", \"@ember/template-factory\"], function (_exports, _component, _tracking, _object, _didInsert, _runloop, _service, _conditionalLoadingSpinner, _textField, _ajax, _ajaxError, _decorators, _tagDrop, _discourseI18n, _item, _tagDrop2, _component2, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const PREV_TEMPLATE_TAG_ID = \"template-selected-tag\";\n  class DTemplatesFilterableList extends _component.default {\n    static {\n      dt7948.g(this.prototype, \"siteSettings\", [_service.service]);\n    }\n    #siteSettings = (dt7948.i(this, \"siteSettings\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"keyValueStore\", [_service.service]);\n    }\n    #keyValueStore = (dt7948.i(this, \"keyValueStore\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"loading\", [_tracking.tracked], function () {\n        return true;\n      });\n    }\n    #loading = (dt7948.i(this, \"loading\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"listFilter\", [_tracking.tracked], function () {\n        return \"\";\n      });\n    }\n    #listFilter = (dt7948.i(this, \"listFilter\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"replies\", [_tracking.tracked], function () {\n        return [];\n      });\n    }\n    #replies = (dt7948.i(this, \"replies\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"selectedTag\", [_tracking.tracked], function () {\n        return _tagDrop.ALL_TAGS_ID;\n      });\n    }\n    #selectedTag = (dt7948.i(this, \"selectedTag\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"availableTags\", [_tracking.tracked], function () {\n        return [];\n      });\n    }\n    #availableTags = (dt7948.i(this, \"availableTags\"), void 0);\n    get filteredReplies() {\n      const filterTitle = this.listFilter.toLowerCase();\n      return this.replies.map(template => {\n        /* Give a relevant score to each template. */template.score = 0;\n        if (template.title.toLowerCase().includes(filterTitle)) {\n          template.score += 2;\n        } else if (template.content.toLowerCase().includes(filterTitle)) {\n          template.score += 1;\n        }\n        return template;\n      }) // Filter irrelevant replies.\n      .filter(template => template.score !== 0) // Filter only replies tagged with the selected tag.\n      .filter(template => {\n        if (this.selectedTag === _tagDrop.ALL_TAGS_ID) {\n          return true;\n        }\n        if (this.selectedTag === _tagDrop.NO_TAG_ID && template.tags.length === 0) {\n          return true;\n        }\n        return template.tags.includes(this.selectedTag);\n      }).sort((a, b) => {\n        /* Sort replies by relevance, usage, and title. */if (a.score !== b.score) {\n          return a.score > b.score ? -1 : 1; /* descending */\n        } else if (a.usages !== b.usages) {\n          return a.usages > b.usages ? -1 : 1; /* descending */\n        } else if (a.title !== b.title) {\n          return a.title < b.title ? -1 : 1; /* ascending */\n        }\n        return 0;\n      });\n    }\n    static {\n      dt7948.n(this.prototype, \"filteredReplies\", [(0, _object.computed)(\"replies\", \"selectedTag\", \"listFilter\")]);\n    }\n    async load() {\n      try {\n        this.loading = true;\n        const results = await (0, _ajax.ajax)(\"/discourse_templates\");\n        this.replies = results.templates;\n        if (this.siteSettings.tagging_enabled) {\n          this.availableTags = Object.values(this.replies.reduce((availableTags, template) => {\n            template.tags.forEach(tag => {\n              if (availableTags[tag]) {\n                availableTags[tag].count += 1;\n              } else {\n                availableTags[tag] = {\n                  id: tag,\n                  name: tag,\n                  count: 1\n                };\n              }\n            });\n            return availableTags;\n          }, {}));\n          const prevSelectedTag = this.keyValueStore.get(PREV_TEMPLATE_TAG_ID);\n          if (prevSelectedTag && (prevSelectedTag === _tagDrop.NO_TAG_ID || this.availableTags.find(t => t.id === prevSelectedTag))) {\n            this.selectedTag = prevSelectedTag;\n          } else {\n            this.keyValueStore.remove(PREV_TEMPLATE_TAG_ID);\n          }\n        }\n      } catch (e) {\n        this.loading = false;\n        (0, _ajaxError.popupAjaxError)(e);\n      } finally {\n        this.loading = false;\n        (0, _runloop.schedule)(\"afterRender\", () => document.querySelector(\".templates-filter\")?.focus());\n      }\n    }\n    static {\n      dt7948.n(this.prototype, \"load\", [_decorators.bind]);\n    }\n    changeSelectedTag(tagId) {\n      this.selectedTag = tagId;\n      if (tagId === _tagDrop.ALL_TAGS_ID) {\n        this.keyValueStore.remove(PREV_TEMPLATE_TAG_ID);\n        return;\n      }\n      this.keyValueStore.set({\n        key: PREV_TEMPLATE_TAG_ID,\n        value: tagId\n      });\n    }\n    static {\n      dt7948.n(this.prototype, \"changeSelectedTag\", [_object.action]);\n    }\n    insertTemplate(template) {\n      this.args.onBeforeInsertTemplate?.();\n      this.args.onInsertTemplate?.(template);\n      this.args.onAfterInsertTemplate?.();\n    }\n    static {\n      dt7948.n(this.prototype, \"insertTemplate\", [_object.action]);\n    }\n    static {\n      (0, _component2.setComponentTemplate)((0, _templateFactory.createTemplateFactory)(\n      /*\n        \n          <div class=\"templates-filterable-list\" {{didInsert this.load}}>\n      \n            <ConditionalLoadingSpinner @condition={{this.loading}}>\n              <div class=\"templates-filter-bar\">\n                {{#if this.siteSettings.tagging_enabled}}\n                  <TagDrop\n                    @availableTags={{this.availableTags}}\n                    @tagId={{this.selectedTag}}\n                    @onChangeSelectedTag={{this.changeSelectedTag}}\n                  />\n                {{/if}}\n                <TextField\n                  class=\"templates-filter\"\n                  @value={{this.listFilter}}\n                  placeholder={{i18n \"templates.filter_hint\"}}\n                />\n              </div>\n              <div class=\"templates-list\">\n                {{#each this.filteredReplies as |r|}}\n                  <Item\n                    @template={{r}}\n                    @model={{@model}}\n                    @onInsertTemplate={{this.insertTemplate}}\n                  />\n                {{/each}}\n              </div>\n            </ConditionalLoadingSpinner>\n          </div>\n        \n      */\n      {\n        \"id\": \"WzcN1ZPc\",\n        \"block\": \"[[[1,\\\"\\\\n    \\\"],[11,0],[24,0,\\\"templates-filterable-list\\\"],[4,[32,0],[[30,0,[\\\"load\\\"]]],null],[12],[1,\\\"\\\\n\\\\n      \\\"],[8,[32,1],null,[[\\\"@condition\\\"],[[30,0,[\\\"loading\\\"]]]],[[\\\"default\\\"],[[[[1,\\\"\\\\n        \\\"],[10,0],[14,0,\\\"templates-filter-bar\\\"],[12],[1,\\\"\\\\n\\\"],[41,[30,0,[\\\"siteSettings\\\",\\\"tagging_enabled\\\"]],[[[1,\\\"            \\\"],[8,[32,2],null,[[\\\"@availableTags\\\",\\\"@tagId\\\",\\\"@onChangeSelectedTag\\\"],[[30,0,[\\\"availableTags\\\"]],[30,0,[\\\"selectedTag\\\"]],[30,0,[\\\"changeSelectedTag\\\"]]]],null],[1,\\\"\\\\n\\\"]],[]],null],[1,\\\"          \\\"],[8,[32,3],[[24,0,\\\"templates-filter\\\"],[16,\\\"placeholder\\\",[28,[32,4],[\\\"templates.filter_hint\\\"],null]]],[[\\\"@value\\\"],[[30,0,[\\\"listFilter\\\"]]]],null],[1,\\\"\\\\n        \\\"],[13],[1,\\\"\\\\n        \\\"],[10,0],[14,0,\\\"templates-list\\\"],[12],[1,\\\"\\\\n\\\"],[42,[28,[31,2],[[28,[31,2],[[30,0,[\\\"filteredReplies\\\"]]],null]],null],null,[[[1,\\\"            \\\"],[8,[32,5],null,[[\\\"@template\\\",\\\"@model\\\",\\\"@onInsertTemplate\\\"],[[30,1],[30,2],[30,0,[\\\"insertTemplate\\\"]]]],null],[1,\\\"\\\\n\\\"]],[1]],null],[1,\\\"        \\\"],[13],[1,\\\"\\\\n      \\\"]],[]]]]],[1,\\\"\\\\n    \\\"],[13],[1,\\\"\\\\n  \\\"]],[\\\"r\\\",\\\"@model\\\"],[\\\"if\\\",\\\"each\\\",\\\"-track-array\\\"]]\",\n        \"moduleName\": \"/var/www/discourse/frontend/discourse/discourse/plugins/discourse-templates/discourse/components/d-templates/filterable-list.js\",\n        \"scope\": () => [_didInsert.default, _conditionalLoadingSpinner.default, _tagDrop2.default, _textField.default, _discourseI18n.i18n, _item.default],\n        \"isStrictMode\": true\n      }), this);\n    }\n  }\n  _exports.default = DTemplatesFilterableList;\n});","define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/item-content\", [\"exports\", \"@ember/helper\", \"@ember/routing\", \"discourse/components/cook-text\", \"discourse/helpers/d-icon\", \"discourse-i18n\", \"@ember/component\", \"@ember/template-factory\", \"@ember/component/template-only\"], function (_exports, _helper, _routing, _cookText, _dIcon, _discourseI18n, _component, _templateFactory, _templateOnly) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const ItemContent = (0, _component.setComponentTemplate)((0, _templateFactory.createTemplateFactory)(\n  /*\n    \n    <div class=\"templates-content\">\n      <LinkTo\n        class=\"template-item-source-link\"\n        @route=\"topic\"\n        @models={{array @template.slug @template.id}}\n      >\n        {{icon \"crosshairs\"}}\n        {{i18n \"templates.source\"}}\n      </LinkTo>\n      <CookText @rawText={{@template.content}} />\n    </div>\n  \n  */\n  {\n    \"id\": \"/mgr2JxR\",\n    \"block\": \"[[[1,\\\"\\\\n  \\\"],[10,0],[14,0,\\\"templates-content\\\"],[12],[1,\\\"\\\\n    \\\"],[8,[32,0],[[24,0,\\\"template-item-source-link\\\"]],[[\\\"@route\\\",\\\"@models\\\"],[\\\"topic\\\",[28,[32,1],[[30,1,[\\\"slug\\\"]],[30,1,[\\\"id\\\"]]],null]]],[[\\\"default\\\"],[[[[1,\\\"\\\\n      \\\"],[1,[28,[32,2],[\\\"crosshairs\\\"],null]],[1,\\\"\\\\n      \\\"],[1,[28,[32,3],[\\\"templates.source\\\"],null]],[1,\\\"\\\\n    \\\"]],[]]]]],[1,\\\"\\\\n    \\\"],[8,[32,4],null,[[\\\"@rawText\\\"],[[30,1,[\\\"content\\\"]]]],null],[1,\\\"\\\\n  \\\"],[13],[1,\\\"\\\\n\\\"]],[\\\"@template\\\"],[]]\",\n    \"moduleName\": \"/var/www/discourse/frontend/discourse/discourse/plugins/discourse-templates/discourse/components/d-templates/item-content.js\",\n    \"scope\": () => [_routing.LinkTo, _helper.array, _dIcon.default, _discourseI18n.i18n, _cookText.default],\n    \"isStrictMode\": true\n  }), (0, _templateOnly.default)(undefined, \"item-content:ItemContent\"));\n  var _default = _exports.default = ItemContent;\n});","define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/item\", [\"exports\", \"@glimmer/component\", \"@ember/object\", \"discourse/components/d-button\", \"discourse/lib/ajax\", \"discourse/lib/ajax-error\", \"discourse/plugins/discourse-templates/discourse/components/d-templates/item-content\", \"@ember/component\", \"@ember/template-factory\"], function (_exports, _component, _object, _dButton, _ajax, _ajaxError, _itemContent, _component2, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesItem extends _component.default {\n    apply() {\n      // run parametrized action to insert the template\n      this.args.onInsertTemplate?.(this.args.template);\n      (0, _ajax.ajax)(`/discourse_templates/${this.args.template.id}/use`, {\n        type: \"POST\"\n      }).catch(_ajaxError.popupAjaxError);\n    }\n    static {\n      dt7948.n(this.prototype, \"apply\", [_object.action]);\n    }\n    static {\n      (0, _component2.setComponentTemplate)((0, _templateFactory.createTemplateFactory)(\n      /*\n        \n          <details class=\"template-item\" id=\"template-item-{{@template.id}}\">\n            <summary class=\"template-item-title\">\n              <div class=\"template-item-title-text\">{{@template.title}}</div>\n      \n              <div class=\"actions\">\n                <DButton\n                  @action={{this.apply}}\n                  @icon=\"far-clipboard\"\n                  class=\"templates-apply\"\n                />\n              </div>\n            </summary>\n      \n            <ItemContent @template={{@template}} />\n          </details>\n        \n      */\n      {\n        \"id\": \"9oYSJLO3\",\n        \"block\": \"[[[1,\\\"\\\\n    \\\"],[10,\\\"details\\\"],[14,0,\\\"template-item\\\"],[15,1,[29,[\\\"template-item-\\\",[30,1,[\\\"id\\\"]]]]],[12],[1,\\\"\\\\n      \\\"],[10,\\\"summary\\\"],[14,0,\\\"template-item-title\\\"],[12],[1,\\\"\\\\n        \\\"],[10,0],[14,0,\\\"template-item-title-text\\\"],[12],[1,[30,1,[\\\"title\\\"]]],[13],[1,\\\"\\\\n\\\\n        \\\"],[10,0],[14,0,\\\"actions\\\"],[12],[1,\\\"\\\\n          \\\"],[8,[32,0],[[24,0,\\\"templates-apply\\\"]],[[\\\"@action\\\",\\\"@icon\\\"],[[30,0,[\\\"apply\\\"]],\\\"far-clipboard\\\"]],null],[1,\\\"\\\\n        \\\"],[13],[1,\\\"\\\\n      \\\"],[13],[1,\\\"\\\\n\\\\n      \\\"],[8,[32,1],null,[[\\\"@template\\\"],[[30,1]]],null],[1,\\\"\\\\n    \\\"],[13],[1,\\\"\\\\n  \\\"]],[\\\"@template\\\"],[]]\",\n        \"moduleName\": \"/var/www/discourse/frontend/discourse/discourse/plugins/discourse-templates/discourse/components/d-templates/item.js\",\n        \"scope\": () => [_dButton.default, _itemContent.default],\n        \"isStrictMode\": true\n      }), this);\n    }\n  }\n  _exports.default = DTemplatesItem;\n});","define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/modal/form\", [\"exports\", \"@glimmer/component\", \"@ember/service\", \"discourse/components/d-modal\", \"discourse-i18n\", \"discourse/plugins/discourse-templates/discourse/components/d-templates/filterable-list\", \"@ember/component\", \"@ember/template-factory\"], function (_exports, _component, _service, _dModal, _discourseI18n, _filterableList, _component2, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class Form extends _component.default {\n    static {\n      dt7948.g(this.prototype, \"appEvents\", [_service.service]);\n    }\n    #appEvents = (dt7948.i(this, \"appEvents\"), void 0);\n    constructor() {\n      super(...arguments);\n      if (this.args.closeModal) {\n        this.appEvents.on(\"page:changed\", this, this.args.closeModal);\n      }\n    }\n    willDestroy() {\n      super.willDestroy(...arguments);\n      if (this.args.closeModal) {\n        this.appEvents.off(\"page:changed\", this, this.args.closeModal);\n      }\n    }\n    static {\n      (0, _component2.setComponentTemplate)((0, _templateFactory.createTemplateFactory)(\n      /*\n        \n          <DModal\n            @closeModal={{@closeModal}}\n            @title={{i18n \"templates.insert_template\"}}\n            class=\"d-templates d-templates-modal\"\n          >\n            <:body>\n              <FilterableList\n                @textarea={{@model.textarea}}\n                @onInsertTemplate={{@model.onInsertTemplate}}\n                @onAfterInsertTemplate={{@closeModal}}\n              />\n            </:body>\n          </DModal>\n        \n      */\n      {\n        \"id\": \"9kYFWE6x\",\n        \"block\": \"[[[1,\\\"\\\\n    \\\"],[8,[32,0],[[24,0,\\\"d-templates d-templates-modal\\\"]],[[\\\"@closeModal\\\",\\\"@title\\\"],[[30,1],[28,[32,1],[\\\"templates.insert_template\\\"],null]]],[[\\\"body\\\"],[[[[1,\\\"\\\\n        \\\"],[8,[32,2],null,[[\\\"@textarea\\\",\\\"@onInsertTemplate\\\",\\\"@onAfterInsertTemplate\\\"],[[30,2,[\\\"textarea\\\"]],[30,2,[\\\"onInsertTemplate\\\"]],[30,1]]],null],[1,\\\"\\\\n      \\\"]],[]]]]],[1,\\\"\\\\n  \\\"]],[\\\"@closeModal\\\",\\\"@model\\\"],[]]\",\n        \"moduleName\": \"/var/www/discourse/frontend/discourse/discourse/plugins/discourse-templates/discourse/components/d-templates/modal/form.js\",\n        \"scope\": () => [_dModal.default, _discourseI18n.i18n, _filterableList.default],\n        \"isStrictMode\": true\n      }), this);\n    }\n  }\n  _exports.default = Form;\n});","define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/tag-drop\", [\"exports\", \"@ember/object\", \"discourse/select-kit/components/tag-drop\"], function (_exports, _object, _tagDrop) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesTagDrop extends _tagDrop.default {\n    get topTags() {\n      // sort tags descending by count and ascending by name\n      return (this.availableTags || []).sort((a, b) => {\n        if (a.count !== b.count) {\n          return b.count - a.count;\n        } // descending\n        if (a.name !== b.name) {\n          return a.name < b.name ? -1 : 1;\n        } // ascending\n        return 0;\n      });\n    }\n    static {\n      dt7948.n(this.prototype, \"topTags\", [(0, _object.computed)(\"availableTags.[]\")]);\n    }\n    search(filter) {\n      return (this.content || []).map(tag => {\n        if (tag.id && tag.name) {\n          return tag;\n        }\n        return this.defaultItem(tag, tag);\n      }).filter(tag => {\n        if (filter == null) {\n          return true;\n        }\n        const tagFilter = filter.toLowerCase();\n        return tag.id.toLowerCase().includes(tagFilter) || tag.name.toLowerCase().includes(tagFilter);\n      });\n    }\n    onChange(tagId, tag) {\n      // overrides the action onChange of the parent with the value received in\n      // the property onChangeSelectedTag in the handlebars template\n      this.onChangeSelectedTag?.(tagId, tag);\n    }\n    static {\n      dt7948.n(this.prototype, \"onChange\", [_object.action]);\n    }\n  }\n  _exports.default = DTemplatesTagDrop;\n});","define(\"discourse/plugins/discourse-templates/discourse/connectors/below-footer/d-templates-modal-container\", [\"exports\", \"@glimmer/component\", \"@ember/service\", \"discourse/plugins/discourse-templates/discourse/components/d-templates/modal/form\", \"@ember/component\", \"@ember/template-factory\"], function (_exports, _component, _service, _form, _component2, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesModalContainer extends _component.default {\n    static {\n      dt7948.g(this.prototype, \"dTemplatesModal\", [_service.service]);\n    }\n    #dTemplatesModal = (dt7948.i(this, \"dTemplatesModal\"), void 0);\n    static {\n      (0, _component2.setComponentTemplate)((0, _templateFactory.createTemplateFactory)(\n      /*\n        \n          {{#if this.dTemplatesModal.model}}\n            <div class=\"modal-container d-templates-modal-container\">\n              <DTemplatesModalForm\n                @closeModal={{this.dTemplatesModal.hide}}\n                @model={{this.dTemplatesModal.model}}\n              />\n            </div>\n          {{/if}}\n        \n      */\n      {\n        \"id\": \"7dVTuQbs\",\n        \"block\": \"[[[1,\\\"\\\\n\\\"],[41,[30,0,[\\\"dTemplatesModal\\\",\\\"model\\\"]],[[[1,\\\"      \\\"],[10,0],[14,0,\\\"modal-container d-templates-modal-container\\\"],[12],[1,\\\"\\\\n        \\\"],[8,[32,0],null,[[\\\"@closeModal\\\",\\\"@model\\\"],[[30,0,[\\\"dTemplatesModal\\\",\\\"hide\\\"]],[30,0,[\\\"dTemplatesModal\\\",\\\"model\\\"]]]],null],[1,\\\"\\\\n      \\\"],[13],[1,\\\"\\\\n\\\"]],[]],null],[1,\\\"  \\\"]],[],[\\\"if\\\"]]\",\n        \"moduleName\": \"/var/www/discourse/frontend/discourse/discourse/plugins/discourse-templates/discourse/connectors/below-footer/d-templates-modal-container.js\",\n        \"scope\": () => [_form.default],\n        \"isStrictMode\": true\n      }), this);\n    }\n  }\n  _exports.default = DTemplatesModalContainer;\n});","define(\"discourse/plugins/discourse-templates/discourse/connectors/editor-preview/d-templates\", [\"exports\", \"@ember/component\", \"@ember/object\", \"@ember/service\", \"@ember-decorators/component\", \"discourse/components/d-button\", \"discourse/plugins/discourse-templates/discourse/components/d-templates/filterable-list\", \"@ember/template-factory\"], function (_exports, _component, _object, _service, _component2, _dButton, _filterableList, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  /* eslint-disable ember/no-classic-components */\n\n  const SELECTOR_EDITOR_PREVIEW = \"#reply-control .d-editor-preview-wrapper > .d-editor-preview\";\n  const DTemplatesEditorPreview = dt7948.c(class DTemplatesEditorPreview extends _component.default {\n    static shouldRender(args, context) {\n      return !context.site.mobileView;\n    }\n    static {\n      dt7948.g(this.prototype, \"appEvents\", [_service.service]);\n    }\n    #appEvents = (dt7948.i(this, \"appEvents\"), void 0);\n    templatesVisible = false;\n    onInsertTemplate;\n    constructor() {\n      super(...arguments);\n      this.appEvents.on(\"discourse-templates:show\", this, \"show\");\n      this.appEvents.on(\"discourse-templates:hide\", this, \"hide\");\n    }\n    willDestroy() {\n      super.willDestroy(...arguments);\n      this.appEvents.off(\"discourse-templates:show\", this, \"show\");\n      this.appEvents.off(\"discourse-templates:hide\", this, \"hide\");\n    }\n    show({\n      onInsertTemplate\n    }) {\n      const elemEditorPreview = document.querySelector(SELECTOR_EDITOR_PREVIEW);\n      if (elemEditorPreview) {\n        elemEditorPreview.style.display = \"none\";\n      }\n      this.set(\"onInsertTemplate\", onInsertTemplate);\n      this.set(\"templatesVisible\", true);\n    }\n    static {\n      dt7948.n(this.prototype, \"show\", [_object.action]);\n    }\n    hide() {\n      const elemEditorPreview = document.querySelector(SELECTOR_EDITOR_PREVIEW);\n      if (elemEditorPreview) {\n        elemEditorPreview.style.display = \"\";\n      }\n      this.set(\"templatesVisible\", false);\n    }\n    static {\n      dt7948.n(this.prototype, \"hide\", [_object.action]);\n    }\n    static {\n      (0, _component.setComponentTemplate)((0, _templateFactory.createTemplateFactory)(\n      /*\n        \n          {{#if this.templatesVisible}}\n            <div class=\"d-templates-container\">\n              <DButton\n                @action={{this.hide}}\n                @icon=\"xmark\"\n                class=\"modal-close close btn-flat\"\n              />\n              <FilterableList\n                @onInsertTemplate={{this.onInsertTemplate}}\n                @onAfterInsertTemplate={{this.hide}}\n              />\n            </div>\n          {{/if}}\n        \n      */\n      {\n        \"id\": \"8KLJ1h1D\",\n        \"block\": \"[[[1,\\\"\\\\n\\\"],[41,[30,0,[\\\"templatesVisible\\\"]],[[[1,\\\"      \\\"],[10,0],[14,0,\\\"d-templates-container\\\"],[12],[1,\\\"\\\\n        \\\"],[8,[32,0],[[24,0,\\\"modal-close close btn-flat\\\"]],[[\\\"@action\\\",\\\"@icon\\\"],[[30,0,[\\\"hide\\\"]],\\\"xmark\\\"]],null],[1,\\\"\\\\n        \\\"],[8,[32,1],null,[[\\\"@onInsertTemplate\\\",\\\"@onAfterInsertTemplate\\\"],[[30,0,[\\\"onInsertTemplate\\\"]],[30,0,[\\\"hide\\\"]]]],null],[1,\\\"\\\\n      \\\"],[13],[1,\\\"\\\\n\\\"]],[]],null],[1,\\\"  \\\"]],[],[\\\"if\\\"]]\",\n        \"moduleName\": \"/var/www/discourse/frontend/discourse/discourse/plugins/discourse-templates/discourse/connectors/editor-preview/d-templates.js\",\n        \"scope\": () => [_dButton.default, _filterableList.default],\n        \"isStrictMode\": true\n      }), this);\n    }\n  }, [(0, _component2.classNames)(\"d-templates\")]);\n  var _default = _exports.default = DTemplatesEditorPreview;\n});","define(\"discourse/plugins/discourse-templates/discourse/connectors/topic-above-posts/discourse-templates-button\", [\"exports\", \"@glimmer/component\", \"@glimmer/tracking\", \"@ember/object\", \"@ember/service\", \"discourse/components/d-button\", \"discourse/helpers/concat-class\", \"discourse/lib/ajax\", \"discourse/lib/debounce\", \"@ember/component\", \"@ember/template-factory\"], function (_exports, _component, _tracking, _object, _service, _dButton, _concatClass, _ajax, _debounce, _component2, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DiscourseTemplatesButton extends _component.default {\n    static shouldRender(outletArgs, helper) {\n      return outletArgs.model.is_template && helper.currentUser?.can_create_topic;\n    }\n    static {\n      dt7948.g(this.prototype, \"composer\", [_service.service]);\n    }\n    #composer = (dt7948.i(this, \"composer\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"copyConfirm\", [_tracking.tracked], function () {\n        return false;\n      });\n    }\n    #copyConfirm = (dt7948.i(this, \"copyConfirm\"), void 0);\n    async fetchRaw() {\n      const topic = this.args.outletArgs.model;\n      return await (0, _ajax.ajax)(`/raw/${topic.id}/1`, {\n        dataType: \"text\"\n      });\n    }\n    async createNewTopic() {\n      const text = await this.fetchRaw();\n      this.composer.openNewTopic({\n        body: text\n      });\n    }\n    static {\n      dt7948.n(this.prototype, \"createNewTopic\", [_object.action]);\n    }\n    async copy() {\n      const text = await this.fetchRaw();\n      navigator.clipboard.writeText(text);\n      this.copyConfirm = true;\n      (0, _debounce.default)(this.resetCopyButton, 2000);\n    }\n    static {\n      dt7948.n(this.prototype, \"copy\", [_object.action]);\n    }\n    resetCopyButton() {\n      this.copyConfirm = false;\n    }\n    static {\n      dt7948.n(this.prototype, \"resetCopyButton\", [_object.action]);\n    }\n    static {\n      (0, _component2.setComponentTemplate)((0, _templateFactory.createTemplateFactory)(\n      /*\n        \n          <div class=\"template-topic-controls\">\n            <DButton\n              @icon={{if this.copyConfirm \"check\" \"copy\"}}\n              @action={{this.copy}}\n              @label=\"templates.copy\"\n              class={{concatClass\n                \"btn-default\"\n                \"template-copy\"\n                (if this.copyConfirm \"ok\")\n              }}\n            />\n            <DButton\n              @action={{this.createNewTopic}}\n              @label=\"templates.new_topic\"\n              @icon=\"plus\"\n              class=\"template-new-topic\"\n            />\n          </div>\n        \n      */\n      {\n        \"id\": \"PX1JXwFJ\",\n        \"block\": \"[[[1,\\\"\\\\n    \\\"],[10,0],[14,0,\\\"template-topic-controls\\\"],[12],[1,\\\"\\\\n      \\\"],[8,[32,0],[[16,0,[28,[32,1],[\\\"btn-default\\\",\\\"template-copy\\\",[52,[30,0,[\\\"copyConfirm\\\"]],\\\"ok\\\"]],null]]],[[\\\"@icon\\\",\\\"@action\\\",\\\"@label\\\"],[[52,[30,0,[\\\"copyConfirm\\\"]],\\\"check\\\",\\\"copy\\\"],[30,0,[\\\"copy\\\"]],\\\"templates.copy\\\"]],null],[1,\\\"\\\\n      \\\"],[8,[32,0],[[24,0,\\\"template-new-topic\\\"]],[[\\\"@action\\\",\\\"@label\\\",\\\"@icon\\\"],[[30,0,[\\\"createNewTopic\\\"]],\\\"templates.new_topic\\\",\\\"plus\\\"]],null],[1,\\\"\\\\n    \\\"],[13],[1,\\\"\\\\n  \\\"]],[],[\\\"if\\\"]]\",\n        \"moduleName\": \"/var/www/discourse/frontend/discourse/discourse/plugins/discourse-templates/discourse/connectors/topic-above-posts/discourse-templates-button.js\",\n        \"scope\": () => [_dButton.default, _concatClass.default],\n        \"isStrictMode\": true\n      }), this);\n    }\n  }\n  _exports.default = DiscourseTemplatesButton;\n});","define(\"discourse/plugins/discourse-templates/discourse/initializers/d-templates\", [\"exports\", \"discourse/lib/plugin-api\", \"discourse/services/keyboard-shortcuts\", \"discourse/plugins/discourse-templates/lib/variables-chat-channel\", \"discourse/plugins/discourse-templates/lib/variables-chat-thread\"], function (_exports, _pluginApi, _keyboardShortcuts, _variablesChatChannel, _variablesChatThread) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  var _default = _exports.default = {\n    name: \"discourse-templates-add-ui-builder\",\n    initialize(container) {\n      const siteSettings = container.lookup(\"service:site-settings\");\n      const currentUser = container.lookup(\"service:current-user\");\n      if (siteSettings.discourse_templates_enabled && currentUser?.can_use_templates) {\n        (0, _pluginApi.withPluginApi)(api => {\n          addOptionsMenuItem(api);\n          addKeyboardShortcut(api, container);\n          addChatIntegration(api, container);\n        });\n      }\n    }\n  };\n  function addOptionsMenuItem(api) {\n    const dTemplates = api.container.lookup(\"service:d-templates\");\n    api.addComposerToolbarPopupMenuOption({\n      icon: \"far-clipboard\",\n      label: \"templates.insert_template\",\n      action: () => {\n        dTemplates.showComposerUI();\n      }\n    });\n  }\n  const _templateShortcutTargets = [];\n  function addKeyboardShortcut(api, container) {\n    api.addKeyboardShortcut(`${_keyboardShortcuts.PLATFORM_KEY_MODIFIER}+shift+i`, event => {\n      event.preventDefault();\n      const dTemplates = container.lookup(\"service:d-templates\");\n      if (dTemplates.isComposerFocused) {\n        dTemplates.showComposerUI();\n        return;\n      }\n      for (const target of _templateShortcutTargets) {\n        if (dTemplates.isTextAreaFocused && target?.isFocused?.(document.activeElement)) {\n          dTemplates.showTextAreaUI(target?.variables);\n          return;\n        }\n      }\n      if (dTemplates.isTextAreaFocused) {\n        dTemplates.showTextAreaUI();\n      }\n    }, {\n      global: true,\n      help: {\n        category: \"templates\",\n        name: \"templates.insert_template\",\n        definition: {\n          keys1: [_keyboardShortcuts.PLATFORM_KEY_MODIFIER, \"shift\", \"i\"],\n          keysDelimiter: \"plus\"\n        }\n      }\n    });\n  }\n  function addChatIntegration(api, container) {\n    if (!container.lookup(\"service:chat\")?.userCanChat) {\n      return;\n    }\n    const channelVariablesExtractor = function () {\n      const chat = container.lookup(\"service:chat\");\n      const activeChannel = chat?.activeChannel;\n      const currentMessage = activeChannel?.draft;\n      const router = container.lookup(\"service:router\");\n      return (0, _variablesChatChannel.default)(activeChannel, currentMessage, router);\n    };\n    const threadVariablesExtractor = function () {\n      const chat = container.lookup(\"service:chat\");\n      const activeThread = chat?.activeChannel?.activeThread;\n      const currentMessage = activeThread?.draft;\n      const router = container.lookup(\"service:router\");\n      return (0, _variablesChatThread.default)(activeThread, currentMessage, router);\n    };\n\n    // add a custom chat composer button\n    api.registerChatComposerButton({\n      id: \"d-templates-chat-insert-template-btn\",\n      icon: \"far-clipboard\",\n      label: \"templates.insert_template\",\n      position: \"dropdown\",\n      action: function () {\n        let contextVariablesExtractor;\n        switch (this.context) {\n          case \"channel\":\n            contextVariablesExtractor = channelVariablesExtractor.bind(this);\n            break;\n          case \"thread\":\n            contextVariablesExtractor = threadVariablesExtractor.bind(this);\n            break;\n          default:\n            contextVariablesExtractor = null;\n        }\n        const textarea = this.composer?.textarea?.textarea; // this.composer.textarea is a TextareaInteractor instance\n\n        container.lookup(\"service:d-templates\").showTextAreaUI(contextVariablesExtractor, textarea);\n      },\n      displayed() {\n        return this.composer?.textarea && (this.context === \"channel\" || this.context === \"thread\");\n      }\n    });\n\n    // add custom keyboard shortcut handlers for the chat channel composer and chat thread composer\n    _templateShortcutTargets.push({\n      isFocused: element => element?.id === \"channel-composer\",\n      variables: channelVariablesExtractor\n    }, {\n      isFocused: element => element?.id === \"thread-composer\",\n      variables: threadVariablesExtractor\n    });\n  }\n});","define(\"discourse/plugins/discourse-templates/discourse/services/d-templates-modal\", [\"exports\", \"@glimmer/tracking\", \"@ember/object\", \"@ember/service\"], function (_exports, _tracking, _object, _service) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesModalService extends _service.default {\n    static {\n      dt7948.g(this.prototype, \"model\", [_tracking.tracked], function () {\n        return null;\n      });\n    }\n    #model = (dt7948.i(this, \"model\"), void 0);\n    show(model) {\n      this.model = model;\n    }\n    static {\n      dt7948.n(this.prototype, \"show\", [_object.action]);\n    }\n    hide() {\n      // return the focus back to the textarea\n      this.model?.textarea?.focus();\n\n      // clear the model\n      this.model = null;\n    }\n    static {\n      dt7948.n(this.prototype, \"hide\", [_object.action]);\n    }\n  }\n  _exports.default = DTemplatesModalService;\n});","define(\"discourse/plugins/discourse-templates/discourse/services/d-templates\", [\"exports\", \"@ember/owner\", \"@ember/service\", \"discourse/lib/textarea-text-manipulation\", \"discourse/plugins/discourse-templates/lib/replace-variables\", \"discourse/plugins/discourse-templates/lib/variables-composer\"], function (_exports, _owner, _service, _textareaTextManipulation, _replaceVariables, _variablesComposer) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesService extends _service.default {\n    static {\n      dt7948.g(this.prototype, \"appEvents\", [_service.service]);\n    }\n    #appEvents = (dt7948.i(this, \"appEvents\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"modal\", [_service.service]);\n    }\n    #modal = (dt7948.i(this, \"modal\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"site\", [_service.service]);\n    }\n    #site = (dt7948.i(this, \"site\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"currentUser\", [_service.service]);\n    }\n    #currentUser = (dt7948.i(this, \"currentUser\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"dTemplatesModal\", [_service.service]);\n    }\n    #dTemplatesModal = (dt7948.i(this, \"dTemplatesModal\"), void 0);\n    static {\n      dt7948.g(this.prototype, \"composer\", [_service.service]);\n    }\n    #composer = (dt7948.i(this, \"composer\"), void 0);\n    showComposerUI() {\n      const onInsertTemplate = this.#insertTemplateIntoComposer.bind(this);\n      if (this.site.mobileView || !this.composer.isPreviewVisible) {\n        this.#showModal(null, onInsertTemplate); // textarea must be empty when targeting the composer\n      } else {\n        this.#showComposerPreviewUI(onInsertTemplate);\n      }\n    }\n    showTextAreaUI(variablesExtractor = null, textarea = document.activeElement) {\n      if (!this.#isTextArea(textarea)) {\n        return;\n      }\n      const modal = document.querySelector(\".d-modal\");\n      const onInsertTemplate = this.#insertTemplateIntoTextArea.bind(this);\n      const extractVariables = model => variablesExtractor?.(model);\n      if (modal?.contains(textarea)) {\n        if (!modal.classList.contains(\"d-templates\")) {\n          this.#showModal(textarea, template => {\n            const modalModel = this.modal.activeModal?.opts?.model;\n            onInsertTemplate(textarea, template, extractVariables(modalModel));\n          });\n        }\n      } else {\n        this.#showModal(textarea, template => onInsertTemplate(textarea, template, extractVariables()));\n      }\n    }\n    get isComposerFocused() {\n      const activeElement = document.activeElement;\n      const composerModel = (0, _owner.getOwner)(this).lookup(\"service:composer\").model;\n      const composerElement = document.querySelector(\".d-editor\");\n      return composerModel && composerElement?.contains(activeElement);\n    }\n    get isTextAreaFocused() {\n      return this.#isTextArea(document.activeElement);\n    }\n    #isTextArea(element) {\n      return element?.nodeName === \"TEXTAREA\";\n    }\n    #showModal(textarea, onInsertTemplate) {\n      this.dTemplatesModal.show({\n        textarea,\n        onInsertTemplate\n      });\n    }\n    #showComposerPreviewUI(onInsertTemplate) {\n      this.appEvents.trigger(\"composer-messages:close\");\n      this.appEvents.trigger(\"composer:show-preview\");\n      this.appEvents.trigger(\"discourse-templates:show\", {\n        onInsertTemplate\n      });\n    }\n    #insertTemplateIntoTextArea(textarea, template, variables) {\n      template = this.#replaceTemplateVariables(template.title, template.content, variables);\n      new _textareaTextManipulation.default((0, _owner.getOwner)(this), {\n        textarea\n      }).insertBlock(template.content);\n    }\n    #insertTemplateIntoComposer(template) {\n      const composerModel = (0, _owner.getOwner)(this).lookup(\"service:composer\").model;\n      const templateVariables = (0, _variablesComposer.default)(composerModel);\n      template = this.#replaceTemplateVariables(template.title, template.content, templateVariables);\n\n      // insert the title if blank\n      if (composerModel && !composerModel.title) {\n        composerModel.set(\"title\", template.title);\n      }\n\n      // insert the content of the template in the composer\n      this.appEvents.trigger(\"composer:insert-block\", template.content);\n    }\n    #replaceTemplateVariables(title, content, variables = {}) {\n      return (0, _replaceVariables.replaceVariables)(title, content, {\n        ...variables,\n        my_username: this.currentUser?.username,\n        my_name: this.currentUser?.displayName\n      });\n    }\n  }\n  _exports.default = DTemplatesService;\n});","define(\"discourse/plugins/discourse-templates/lib/replace-variables\", [\"exports\", \"discourse/models/user\"], function (_exports, _user) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.TEMPLATES_ALLOWED_VARIABLES = void 0;\n  _exports.replaceVariables = replaceVariables;\n  // keep this list synchronized with the list in spec/plugin_helper.rb\n  const TEMPLATES_ALLOWED_VARIABLES = _exports.TEMPLATES_ALLOWED_VARIABLES = Object.freeze([\"my_username\", \"my_name\", \"chat_channel_name\", \"chat_channel_url\", \"chat_thread_name\", \"chat_thread_url\", \"context_title\", \"context_url\", \"topic_title\", \"topic_url\", \"original_poster_username\", \"original_poster_name\", \"reply_to_username\", \"reply_to_name\", \"last_poster_username\", \"reply_to_or_last_poster_username\"]);\n  function replaceVariables(title, content, modelVariables) {\n    const currentUser = _user.default.current();\n    const variables = {\n      ...(modelVariables || {}),\n      my_username: currentUser?.username,\n      my_name: currentUser?.displayName\n    };\n    if (variables && typeof variables === \"object\") {\n      for (const key of TEMPLATES_ALLOWED_VARIABLES) {\n        if (variables[key]) {\n          title = title.replace(new RegExp(`%{${key}(,fallback:.[^}]*)?}`, \"g\"), variables[key]);\n          content = content.replace(new RegExp(`%{${key}(,fallback:.[^}]*)?}`, \"g\"), variables[key]);\n        } else {\n          title = title.replace(new RegExp(`%{${key},fallback:(.[^}]*)}`, \"g\"), \"$1\");\n          title = title.replace(new RegExp(`%{${key}}`, \"g\"), \"\");\n          content = content.replace(new RegExp(`%{${key},fallback:(.[^}]*)}`, \"g\"), \"$1\");\n          content = content.replace(new RegExp(`%{${key}}`, \"g\"), \"\");\n        }\n      }\n    }\n    return {\n      title,\n      content\n    };\n  }\n});","define(\"discourse/plugins/discourse-templates/lib/variables-chat-channel\", [\"exports\"], function (_exports) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = extractVariablesFromChatChannel;\n  function extractVariablesFromChatChannel(channel, message, router) {\n    if (!channel && !message) {\n      return {};\n    }\n    const inReplyTo = message?.inReplyTo;\n    const channelVariables = {\n      chat_channel_name: channel?.title,\n      chat_channel_url: channel?.routeModels ? router?.urlFor(\"chat.channel\", ...channel.routeModels) : null,\n      reply_to_username: inReplyTo?.user?.username,\n      reply_to_name: inReplyTo?.user?.name\n    };\n    return {\n      ...channelVariables,\n      context_title: channelVariables.chat_channel_name,\n      context_url: channelVariables.chat_channel_url\n    };\n  }\n});","define(\"discourse/plugins/discourse-templates/lib/variables-chat-thread\", [\"exports\", \"discourse/plugins/discourse-templates/lib/variables-chat-channel\"], function (_exports, _variablesChatChannel) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = extractVariablesFromChatThread;\n  function extractVariablesFromChatThread(thread, message, router) {\n    if (!thread && !message) {\n      return {};\n    }\n    const channel = thread?.channel;\n    const inReplyTo = thread?.originalMessage;\n    const channelVariables = (0, _variablesChatChannel.default)(channel, message, router);\n    const threadVariables = {\n      chat_thread_name: thread?.title,\n      chat_thread_url: thread?.routeModels ? router?.urlFor(\"chat.channel.thread\", ...thread.routeModels) : null,\n      reply_to_username: inReplyTo?.user?.username,\n      reply_to_name: inReplyTo?.user?.name\n    };\n    return {\n      ...channelVariables,\n      ...threadVariables,\n      context_title: threadVariables.chat_thread_name || channelVariables.chat_channel_name,\n      context_url: threadVariables.chat_thread_url || channelVariables.chat_channel_url\n    };\n  }\n});","define(\"discourse/plugins/discourse-templates/lib/variables-composer\", [\"exports\"], function (_exports) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = extractVariablesFromComposerModel;\n  function extractVariablesFromComposerModel(model) {\n    if (!model) {\n      return {};\n    }\n    const composerVariables = {\n      topic_title: model.topic?.title,\n      topic_url: model.topic?.url,\n      original_poster_username: model.topic?.details.created_by.username,\n      original_poster_name: model.topic?.details.created_by.name,\n      reply_to_username: model.post?.username,\n      reply_to_name: model.post?.name,\n      last_poster_username: model.topic?.last_poster_username,\n      reply_to_or_last_poster_username: model.post?.username || model.topic?.last_poster_username\n    };\n    return {\n      ...composerVariables,\n      context_title: composerVariables.topic_title,\n      context_url: composerVariables.topic_url\n    };\n  }\n});"],"mappings":"AAAAA,OAAA,iqBAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,GACA;AAEAC,OAAAC,eAAAnB,EAAA,cACAoB,OAAA,IAEApB,EAAAqB,aAAA;AACA,MAAAC,EAAA;AACA,MAAAC,UAAAtB,EAAAoB,eAEAG,OAAAC,EAAAC,KAAAC,UAAA,gBAAArB,EAAAsB,SACA,CACAC,QAAAL,OAAAM,EAAAJ,KAAA;OAEAF,OAAAC,EAAAC,KAAAC,UAAA,iBAAArB,EAAAsB,SACA,CACAG,QAAAP,OAAAM,EAAAJ,KAAA;OAEAF,OAAAC,EAAAC,KAAAC,UAAA,WAAAzB,EAAA8B,SAAA,WACA,QACA,EACA,CACAC,QAAAT,OAAAM,EAAAJ,KAAA;OAEAF,OAAAC,EAAAC,KAAAC,UAAA,cAAAzB,EAAA8B,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