define("discourse/plugins/discourse-narrative-bot/initializers/new-user-narrative",["exports","discourse/lib/plugin-api","discourse/lib/ajax"],function(e,t,s){"use strict";function i(e){var t=e.container.lookup("message-bus:main"),i=e.getCurrentUser(),r=e.container.lookup("service:app-events");e.modifyClass("component:site-header",{didInsertElement:function(){this._super.apply(this,arguments),this.dispatch("header:search-context-trigger","header")}}),e.modifyClass("model:post",{toggleBookmark:function(){var t=this;return-2!==this.user_id||this.bookmarked?this._super():(0,s.ajax)("/bookmarks",{type:"POST",data:{post_id:this.id}}).then(function(e){t.setProperties({"topic.bookmarked":!0,bookmarked:!0,bookmark_id:e.id}),t.appEvents.trigger("post-stream:refresh",{id:t.id})})}}),e.attachWidgetAction("header","headerSearchContextTrigger",function(){this.site.mobileView?this.state.skipSearchContext=!1:(this.state.contextEnabled=!0,this.state.searchContextType="topic")}),t&&i&&t.subscribe("/new_user_narrative/tutorial_search",function(){r.trigger("header:search-context-trigger")})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r={name:"new-user-narratve",initialize:function(e){e.lookup("site-settings:main").discourse_narrative_bot_enabled&&(0,t.withPluginApi)("0.8.7",i)}};e.default=r});