{"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","selectedTagObject","NO_TAG_ID","name","find","tag","id","n","computed","filteredReplies","filterTitle","toLowerCase","map","template","score","title","includes","content","filter","tags","length","sort","a","b","usages","load","results","ajax","templates","tagging_enabled","values","reduce","forEach","count","prevSelectedTag","get","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","admin","setAdminPluginIcon","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/initializers/templates-admin-plugin-configuration-nav.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 selectedTagObject() {\n      if (!this.selectedTag || this.selectedTag === _tagDrop.ALL_TAGS_ID) {\n        return null;\n      }\n      if (this.selectedTag === _tagDrop.NO_TAG_ID) {\n        return {\n          name: _tagDrop.NO_TAG_ID\n        };\n      }\n      return this.availableTags.find(tag => tag.id === this.selectedTag) || {\n        name: this.selectedTag\n      };\n    }\n    static {\n      dt7948.n(this.prototype, \"selectedTagObject\", [(0, _object.computed)(\"availableTags.[]\", \"selectedTag\")]);\n    }\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        <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                @tag={{this.selectedTagObject}}\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        \"id\": \"T5Zh1MZg\",\n        \"block\": \"[[[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\\\",\\\"@tag\\\",\\\"@onChangeSelectedTag\\\"],[[30,0,[\\\"availableTags\\\"]],[30,0,[\\\"selectedTagObject\\\"]],[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]],[\\\"r\\\",\\\"@model\\\"],[\\\"if\\\",\\\"each\\\",\\\"-track-array\\\"]]\",\n        \"moduleName\": \"/root/prime/srv/discourse/app/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    <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    \"id\": \"a2pQrsuF\",\n    \"block\": \"[[[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]],[\\\"@template\\\"],[]]\",\n    \"moduleName\": \"/root/prime/srv/discourse/app/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        <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        \"id\": \"HMxSC9DP\",\n        \"block\": \"[[[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]],[\\\"@template\\\"],[]]\",\n        \"moduleName\": \"/root/prime/srv/discourse/app/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        <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        \"id\": \"SJ7ZlObJ\",\n        \"block\": \"[[[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  \\\"]],[]]]]]],[\\\"@closeModal\\\",\\\"@model\\\"],[]]\",\n        \"moduleName\": \"/root/prime/srv/discourse/app/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        {{#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        \"id\": \"jILGEVNS\",\n        \"block\": \"[[[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]],[],[\\\"if\\\"]]\",\n        \"moduleName\": \"/root/prime/srv/discourse/app/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        {{#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        \"id\": \"O8k8l8JS\",\n        \"block\": \"[[[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]],[],[\\\"if\\\"]]\",\n        \"moduleName\": \"/root/prime/srv/discourse/app/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        <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        \"id\": \"JYDZFuzF\",\n        \"block\": \"[[[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]],[],[\\\"if\\\"]]\",\n        \"moduleName\": \"/root/prime/srv/discourse/app/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/initializers/templates-admin-plugin-configuration-nav\", [\"exports\", \"discourse/lib/plugin-api\"], function (_exports, _pluginApi) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const PLUGIN_ID = \"discourse-templates\";\n  var _default = _exports.default = {\n    name: \"templates-admin-plugin-configuration-nav\",\n    initialize(container) {\n      const currentUser = container.lookup(\"service:current-user\");\n      if (!currentUser?.admin) {\n        return;\n      }\n      (0, _pluginApi.withPluginApi)(api => {\n        api.setAdminPluginIcon(PLUGIN_ID, \"far-clipboard\");\n      });\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,E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