(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[6645],{77249:(t,s,e)=>{"use strict";e.r(s),e.d(s,{default:()=>l});vara=e(74692);functionr(t){returnfunction(t){if(Array.isArray(t))returni(t)}(t)||function(t){if("undefined"!=typeofSymbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])returnArray.from(t)}(t)||function(t,s){if(!t)return;if("string"==typeoft)returni(t,s);vare=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)returnArray.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))returni(t,s)}(t)||function(){thrownewTypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}functioni(t,s){(null==s||s>t.length)&&(s=t.length);for(vare=0,a=newArray(s);e<s;e++)a[e]=t[e];returna}constl={props:["query","profileId"],data:function(){return{loading:!0,networkError:!1,results:{hashtags:[],profiles:[],statuses:[],places:[]},filters:{hashtags:!0,profiles:!0,statuses:!0},analysis:"profile",showPlaces:!1,placesCursor:1,placesCache:[],placesSearchEnabled:!1,searchVersion:2}},beforeMount:function(){this.bootSearch()},mounted:function(){a(".search-bar input").val(this.query)},updated:function(){a('[data-toggle="tooltip"]').tooltip()},methods:{bootSearch:function(){vart=this.searchLexer();this.analysis=t,this.fetchSearchResults(),axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()}))},fetchSearchResults:function(){if("remote"==this.analysis){vart=this.query;if(newURL(t).host===window.location.host)returnvoid(window.location.href=t)}this.searchContext(this.analysis)},searchLexer:function(){vart=this.query;returnt.startsWith("#")?"hashtag":2==(t.match(/@/g)||[]).length?"webfinger":t.startsWith("@")?"profile":t.startsWith("https://")?"remote":"all"},buildUrl:function(){vart=arguments.length>1?arguments[1]:void0;switch(arguments.length>0&&void0!==arguments[0]?arguments[0]:"hashtag"){case"hashtag":default:returnt.url+"?src=search";case"profile":return1==t.entity.local?t.url:"/i/web/profile/_/"+t.entity.id}},searchContext:function(t){vars=this;switch(t){case"all":axios.get("/api/search",{params:{q:this.query,src:"metro",v:this.searchVersion,scope:"all"}}).then((function(t){vare=t.data;s.results.hashtags=e.hashtags?e.hashtags:[],s.results.profiles=e.profiles?e.profiles:[],s.results.statuses=e.posts?e.posts:[],s.results.places=e.places?e.places:[],s.placesCache=e.places,s.results.placesPagination=e.placesPagination?e.placesPagination:[],s.loading=!1})).catch((function(t){s.loading=!1,s.networkError=!0}));break;case"remote":axios.get("/api/search",{params:{q:this.query,src:"metro",v:this.searchVersion,scope:"remote"}}).then((function(t){vare=t.data;s.results.hashtags=e.hashtags?e.hashtags:[],s.results.profiles=e.profiles?e.profiles:[],s.results.statuses=e.posts?e.posts:[],s.results.profiles.length&&(s.analysis="profile"),s.results.statuses.length&&(s.analysis="remotePost"),s.loading=!1})).catch((function(t){s.loading=!1,s.networkError=!0}));break;case"hashtag":axios.get("/api/search",{params:{q:this.query.slice(1),src:"metro",v:this.searchVersion,scope:"hashtag"}}).then((function(t){vare=t.data;s.results.hashtags=e.hashtags?e.hashtags:[],s.results.profiles=e.profiles?e.profiles:[],s.results.statuses=e.posts?e.posts:[],s.loading=!1})).catch((function(t){s.loading=!1,s.networkError=!0}));break;case"profile":axios.get("/api/search",{params:{q:this.query,src:"metro",v:this.searchVersion,scope:"profile"}}).then((function(t){vare=t.data;s.results.hashtags=e.hashtags?e.hashtags:[],s.results.profiles=e.profiles?e.profiles:[],s.results.statuses=e.posts?e.posts:[],s.loading=!1})).catch((function(t){s.loading=!1,s.networkError=!0}));break;case"webfinger":axios.get("/api/search",{params:{q:this.query,src:"metro",v:this.searchVersion,scope:"webfinger"}}).then((function(t){vare=t.data;s.results.hashtags=[],s.results.profiles=e.profiles,