(()=>{function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}!function(){var e=XMLHttpRequest.prototype,r=e.open,a=e.send,n=e.setRequestHeader;function s(e){try{var r=JSON.parse(e);if(r&&r.data&&r.data.xdt_fbsearch__top_serp_graphql){var a=r.data.xdt_fbsearch__top_serp_graphql,n=[];return a.edges&&a.edges.forEach((function(t){var e=t.node;e&&e.items&&e.items.forEach((function(t){n.push({media:t})}))})),n.length>0&&localStorage.setItem("ins-data",JSON.stringify(n)),a.page_info&&a.page_info.has_next_page&&localStorage.setItem("ins-has_next_page",a.page_info.has_next_page),!0}if(r&&r.media_grid){if(r.media_grid.has_more&&localStorage.setItem("ins-has_next_page",r.media_grid.has_more),r.media_grid.sections){var s=[];r.media_grid.sections.forEach((function(e){var r;e.layout_content&&e.layout_content.medias&&s.push.apply(s,function(e){if(Array.isArray(e))return t(e)}(r=e.layout_content.medias)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?t(e,r):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())})),s.length>0&&localStorage.setItem("ins-data",JSON.stringify(s))}return!0}}catch(t){}return!1}e.open=function(t,e){return this._method=t,this._url=e,this._requestHeaders={},this._startTime=(new Date).toISOString(),this._previous=Date.parse(Date().toString()),r.apply(this,arguments)},e.setRequestHeader=function(t,e){return this._requestHeaders[t]=e,n.apply(this,arguments)},e.send=function(){return this.addEventListener("load",(function(){var t=this._url?this._url.toLowerCase():this._url;t&&null!==t.match("/top_serp/")&&localStorage.setItem("search-url","https://www.instagram.com".concat(this._url)),s(this.responseText);var e=this._requestHeaders["X-IG-WWW-Claim"],r=this._requestHeaders["X-CSRFToken"],a=this._requestHeaders["X-ASBD-ID"],n=this._requestHeaders["X-IG-App-ID"];e&&localStorage.setItem("ins-claim",e),r&&localStorage.setItem("ins-csrfToken",r),a&&localStorage.setItem("ins-X_ASBD_ID",a),n&&localStorage.setItem("ins-X_IG_App_ID",n)})),a.apply(this,arguments)};var i=window.fetch;i&&(window.fetch=function(){return i.apply(this,arguments).then((function(t){try{t.clone().text().then((function(t){s(t)})).catch((function(){}))}catch(t){}return t}))})}(XMLHttpRequest)})();
//# sourceMappingURL=injected.js.map