!function(){let e;(()=>{const t="app",n="production",r=!1;if(e=globalThis.app,e)return;const i={name:t,env:n,get:e=>e in i?i[e]:null,...JSON.parse('{"version":"28.0.6","manifestVersion":3}')},s=function e(t){const n=t===i,s=n&&r,c={},l=e=>Object.assign(t,e);return new Proxy(t,{get:function(r,i){if("assign"===i)return l;if(n&&!String(i).startsWith("$"))return t[i];if(!(i in t)){if(t[i]={},n){const e=o.bind(null,"log",i,!1),n=o.bind(null,"log",i,!0),r=o.bind(null,"warn",i,!1),s=o.bind(null,"warn",i,!0),c=o.bind(null,"error",i,!1),l=o.bind(null,"error",i,!0),d=a.bind(null,i);Object.defineProperties(t[i],{log:{get:()=>e},logDev:{get:()=>n},warn:{get:()=>r},warnDev:{get:()=>s},error:{get:()=>c},errorDev:{get:()=>l},Error:{get:()=>d}})}c[i]=e(t[i]),s&&(globalThis[i]=t[i])}return i in c?c[i]:t[i]},set:function(e,n,r){return t[n]=r,c[n]=r,s&&(globalThis[n]=t[n]),!0}})}(i);function o(e,t,n,...r){if(n)return;const[i,s,o]=c(t);console[e](`%c[${t}]`,`color: rgb(${i}, ${s}, ${o})`,...r)}function a(e,t,...n){return n.length>0&&o("error",e,!1,t,...n),new Error(`[${e}] ${t}`)}function c(e){let t=0;e.split("").forEach(((n,r)=>{t=e.charCodeAt(r)+((t<<5)-t)}));const n=(16711680&t)>>16,r=(65280&t)>>8,i=255&t;return n+r+i<300?c(`$${e}`):[n,r,i]}globalThis.app=s,e=s})();const{$utils:t}=app;t.callAsync=async(e,...t)=>new Promise((n=>{e(...t,n)}));const{$utils:n}=app;n.docElem=document.documentElement;const{$utils:r}=app;r.executeScript=e=>{const t=document.createElement("div"),n=e.replace("<script>","(() => {").replace("<\/script>","})()");t.setAttribute("onreset",`const URL = window.URL; ${n}`),t.dispatchEvent(new Event("reset"))};const{$utils:i}=app;function s(){return window.self.name.split("|")[0]||null}i.iframe={createName:function(e,t){return`${e}|${JSON.stringify(t)}`},getName:s,getParams:function(){const e=window.self.name.split("|")[1];return i.safeJsonParse(e)||{}},isIframe:function(e=null){return window.self!==parent&&(!e||s()===e)}};const{$utils:o}=app;o.is={null:e=>null===e,defined:e=>void 0!==e,undefined:e=>void 0===e,nil:e=>null==e,boolean:e=>"boolean"==typeof e,number:e=>"number"==typeof e,string:e=>"string"==typeof e,symbol:e=>"symbol"==typeof e,function:e=>"function"==typeof e,map:e=>e instanceof Map,set:e=>e instanceof Set,url:e=>e instanceof URL,blob:e=>e instanceof Blob,file:e=>e instanceof File,error:e=>e instanceof Error,regexp:e=>e instanceof RegExp,array:e=>Array.isArray(e),object:e=>"[object Object]"===Object.prototype.toString.call(e),nan:e=>Number.isNaN(e),nonPrimitive:e=>o.is.object(e)||o.is.array(e),numeric:e=>!o.is.nan(Number(e)),empty:e=>!!o.is.nil(e)||(o.is.array(e)?0===e.length:o.is.object(e)?0===Object.keys(e).length:!!o.is.string(e)&&0===e.trim().length)};const{$utils:a}=app;a.loadExtScript=(e,t={})=>{const n=Math.random().toString().slice(2),r=document.createElement("script");r.onload=()=>r.remove(),r.src=chrome.runtime.getURL(`${e}?v=${n}`),document.documentElement.insertAdjacentElement("afterbegin",r);for(const e in t)r.setAttribute(e,t[e])};const{$utils:c,$bus:l}=app;c.ls={get:function(e,t){if(!this._supported())return l.send("utils.ls.get",e,t);const n=localStorage.getItem(e);if(null==n)return t;if("true"===n)return!0;if("false"===n)return!1;if(n.startsWith("[")||n.startsWith("{"))return JSON.parse(n);const r=Number(n);return Number.isNaN(r)?n:r},set:function(e,t){if(!this._supported())return l.send("utils.ls.set",e,t);try{"string"==typeof t?localStorage.setItem(e,t):localStorage.setItem(e,JSON.stringify(t))}catch(n){c.error("ls.set failed",{key:e,value:t,details:n})}},has:function(e){return this._supported()?e in localStorage:l.send("utils.ls.has",e)},remove:function(e){if(!this._supported())return l.send("utils.ls.remove",e);localStorage.removeItem(e)},_supported:function(){return!!globalThis.localStorage}};const{$utils:d}=app;d.safeJsonParse=e=>{try{return JSON.parse(e)}catch(e){return null}};const{$utils:u}=app,p=36e5,h=864e5;u.time={SECOND:1e3,MINUTE:6e4,HOUR:p,DAY:h,WEEK:6048e5,MONTH:26784e5,weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"]};const{$utils:m}=app;m.waitFor=async(e,t=null)=>{let n,r;return"number"==typeof t?(n=t,r=100):t?(n=t.timeout||3e4,r=t.frequency||100):(n=3e4,r=100),new Promise(((t,i)=>{const s=e();if(s)return void t(s);const o=setInterval((()=>{const n=e();n&&(clearInterval(o),t(n))}),r);setTimeout((()=>{clearInterval(o),t(null)}),n)}))};const{$env:g}=app;g.getLocus=()=>"chrome-extension:"!==location.protocol&&chrome.runtime?"cs":"chrome-extension:"!==location.protocol?"nj":"/inssist.html"===location.pathname?"pp":"/offscreen.html"===location.pathname?"os":"bg";const{$env:f,$utils:y}=app;f.controller={init:async function(){const e=f.getLocus(),t=await y.ls.get("env.is")||app.env;this._production="production"===t,this._development="development"===t,Object.assign(f,{version:app.version,backup:this._getBackup(),features:await this._getFeatures(),options:await this._getOptions(),locus:e,is:{pp:"pp"===e,bg:"bg"===e,cs:"cs"===e,nj:"nj"===e,production:this._production,development:this._development}})},_getBackup:function(){return{url:"https://inssist.com/backup"}},_getFeatures:async function(){return{fspring:await y.ls.get("env.features.fspring",!0),iframes:await y.ls.get("env.features.iframes",!0),trial:!0,log:await y.ls.get("env.features.log",this._development)}},_getOptions:async function(){return{apiUrl:await y.ls.get("env.options.apiUrl","https://api.inssist.com/api/v1"),collectBillingStats:await y.ls.get("env.options.collectBillingStats",!1),domain:await y.ls.get("env.options.domain","inssist.com"),storefront:await y.ls.get("env.options.storefront",this._production?"slashed.onfastspring.com":"slashed.test.onfastspring.com"),checkoutContainer:await y.ls.get("env.options.checkoutContainer","https://inssist.com"),billingPlans:this._getBillingPlans(),billingProFeaturesList:this._getBillingProFeaturesList(),billingProFeaturesTable:this._getBillingProFeaturesTable(),trialFeaturesLimits:this._getTrialFeaturesLimits(),tagAssist:await this._getTagAssist()}},_getBillingPlans:function(){return{"inssist-pro-monthly":{type:"subscription",pricing:{US:{currency:"USD",price:4.99}}},"inssist-pro-lifetime":{type:"product",pricing:{US:{currency:"USD",price:45}},isActive:e=>{const{billing:t,auth:n}=e;return(t.orders||[]).some((e=>{var t,r;return"inssist-pro-lifetime"===e.product&&(null===(t=e.tags)||void 0===t||null===(r=t.accounts)||void 0===r?void 0:r.some((e=>e.id===(null==n?void 0:n.userId)||e.name===(null==n?void 0:n.username))))}))}},"inssist-pro-infinite":{type:"product",pricing:{US:{currency:"USD",price:240}}}}},_getBillingProFeaturesList:function(){return[{id:"schedule",icon:"sidebar-mediator.later",title:"Post Later",description:"\n          Schedule photos, videos, carousels, stories and reels.\n          Use Time Slots to schedule content rapidly.\n        "},{id:"hashtags",icon:"sidebar-mediator.hashtags",title:"Hashtag Assistant",description:"\n          Find effective hashtags to increase your posts engagement.\n          Create hashtag collections.\n        "},{id:"reels",icon:"sidebar-mediator.covers",title:"Reels and Video Stories",description:"\n          Publish Video Reels and Instagram Video Stories from your desktop PC / Mac.\n        "},{id:"music",icon:"sidebar-mediator.music",title:"Music, Covers, Ghost View",description:"\n          Add music to your videos. Select or upload custom covers.\n          View stories anonymously.\n        "}]},_getBillingProFeaturesTable:function(){return[{title:"Post Photos and Videos",isFree:!0,isPro:!0},{title:"Post Photo Stories",isFree:!0,isPro:!0},{title:"Multiaccount Support",isFree:!0,isPro:!0},{title:"Relevant Hashtags",isFree:!0,isPro:!0},{title:"Direct Messages",isFree:!0,isPro:!0},{title:"Inspirations",isFree:!0,isPro:!0},{title:"Dark Mode",isFree:!0,isPro:!0,isPaddedBottom:!0},{title:"Post Reels",isPro:!0,icons:["sidebar-mediator.later","sidebar-mediator.covers","sidebar-mediator.hashtags"]},{title:"Post Video Stories",isPro:!0},{title:"Schedule Posts",isPro:!0},{title:"Schedule Reels",isPro:!0},{title:"Schedule Stories",isPro:!0},{title:"Ghost Story View",isPro:!0,tooltip:{text:"Stay anonymous while viewing Instagram stories"}},{title:"Add Music to Videos",isPro:!0},{title:"Custom Video Covers",isPro:!0},{title:"Hashtags Metrics & Collections",isPro:!0}]},_getTagAssist:async function(){return{apiUrl:await y.ls.get("env.options.tagAssist.apiUrl",(this._production,"https://fc.inssist.com/api/v1/hashtag")),collectionsTagDataTtl:1*y.time.MONTH,userTagScanTtl:1*y.time.WEEK,userTagScanPeriod:3*y.time.DAY,userTagScanCount:30,sendCollectedTagsTimeout:10*y.time.MINUTE,maxTagsToQuery:5,maxRelevantTagsToKeep:100,accountStatsTtl:1*y.time.DAY}},_getTrialFeaturesLimits:function(){return{dmAdvanced:e=>e.dmAdvanced>=50,insights:e=>e.insights>=2,analytics:e=>e.analytics>=5,coverAssist:e=>e.coverAssist>=2,musicAssist:e=>e.musicAssist>=2,storyAssist:e=>e.storyAssist>=5,tagAssist:e=>e.tagAssist>=4,addLinkToStory:e=>e.addLinkToStory>=2,repost:e=>e.repost>=3,reels:e=>e.reels>=2,ghostStoryView:e=>e.ghostStoryView>=3,later:e=>e.later>=5}}};const{$desktopIg:b}=app;b.selectors={dark:["html._aa4d"],topNav:[".PolarisNavigation > .PolarisDesktopNav",".PolarisDirectShell_DEPRECATED > .PolarisDesktopNav",".PolarisDesktopNav._acum"],newPostMenuItem:[".XrOey:nth-child(3)",".PolarisDesktopNav._acut:nth-child(3)"],newPostButton:[".ctQZg button",".PolarisCreationIcon button",".PolarisNavigation .PolarisCreationNavItem a"],modalWindow:['[role="dialog"]'],modalTitle:[".Yx5HN h1",".IGDSDialog h1 > div"],creationBody:[".uYzeu","._ac2r",".PolarisCreationModalBodyV2.x6ql1ns",".IGDSBox + .PolarisCreationModalBodyV2:nth-child(2)"],creationBodyRight:[".IJeHu > div > div",".PolarisCreationModalBodyV2._ac2v",".PolarisCreationModalBodyV2.x1f4304s"],creationDndBody:["._C8iK > .YBx95",".Dh40d",'._ac2t > .PolarisIGCoreBox[style*="height: 100%"]','.PolarisCreationModalBodyV2 > div[style*="height: 100%"]'],creationDndText:["._C8iK > .YBx95 h2",".Yx5HN .Dh40d h2",'._ac2t svg[height="77"] + .PolarisIGCoreBox h2'],creationDndIcon:["._C8iK > .YBx95 svg",".Yx5HN .Dh40d svg","._ac2t > .PolarisIGCoreBox svg"],creationLoadingBar:['._ac2r .PolarisCreationLoadingBar[data-visualcompletion="loading-state"]'],creationRatioToggler:[".czW__ > div:first-child .RJJyf > button",".PolarisCreationMediaPreviewV2 > div:first-child div:not([class]) button"],creationRatioOptionVertical:[".YAPUk button:nth-of-type(3)",".PolarisCreationMediaPopover > button:nth-of-type(3)",'.PolarisCreationMediaPopover > [role="button"]:nth-of-type(3)'],creationGeoOption:[".brfp7 div:not([class])","div.PolarisCreationLocationInput"],creationAccessibilityDropdown:[":not(.n6uTB) + .n6uTB",".PolarisCreationModalComposeSettingsContent > div:not([class]) + .PolarisCreationModalComposeExpandInput"],creationAdvancedDropdown:".n6uTB + .n6uTB",creationDropdown:[".PolarisCreationModalComposeSettingsContent > div:not([class]) ~ .PolarisCreationModalComposeExpandInput"],creationBottomHr:[".W4P49",".PolarisCreationModalComposeSettingsContent hr"],creationNextButton:[".WaOAr .yWX7d","div.PolarisIGCoreModalHeader:last-child button","div.PolarisIGCoreModalHeader:last-child .Pressable"],creationPublishingSpinnerContainerWrap:['._ac2t > .PolarisIGCoreBox[style*="width: 100%"]'],creationPublishingSpinnerContainer:['div[style*="height: 96px"][style*="width: 96px"]'],creationPublishingSpinner:['img[src*="creation/spinner"]','div[style*="height: 96px"][style*="width: 96px"] img[src*=".gif"]'],creationCarouselAddMediaButton:[".czW__ > .Xf6Yq",".PolarisCreationMediaPreviewV2 > ._abck div:not([class])"],uploadForm:[".BaseDialog form.PolarisImageFileForm"],followSuggestionList:[".PolarisFeedSidebar:first-child + div .PolarisIGVirtualList > div"]};const{$analytics:_,$bus:w}=app;_.controller={init:function(){this._handleInjectionMessages()},_handleInjectionMessages:function(){window.addEventListener("message",(e=>{"ga.send-event"===e.data.type&&w.send("ga.send-event",...e.data.args)}))}};const{$dm:S,$utils:v}=app;S.controller={init:function(){this._initState(),this._disableNarrowView(),this._patchFetchAndXhr(),S.ghostModeController.init(),S.mediaController.init()},_initState:function(){v.executeScript("\n      <script>\n        inssist.dm = {\n          ghostModeEnabled: false,\n        }\n      <\/script>\n    ")},_disableNarrowView:function(){v.executeScript("\n      <script>\n        inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n          if (moduleName !== 'IGDIsCompactModeContext.react') return\n          const newBodyStr = bodyStr.replace('\"900px\"', '\"100px\"')\n          setBodyStr(newBodyStr)\n        })\n      <\/script>\n    ")},_patchFetchAndXhr:function(){v.executeScript("\n      <script>\n        function addDmParam (url) {\n          try {\n            const isIg = url.includes('.instagram.com') || url.startsWith('/')\n            if (!isIg) return url\n            if (url.startsWith('/')) {\n              const u = new URL(location.origin + url)\n              u.searchParams.set('_dm_', '1')\n              return u.pathname + u.search + u.hash\n            } else {\n              const u = new URL(url)\n              u.searchParams.set('_dm_', '1')\n              return u.href\n            }\n          } catch (e) {\n            console.error(e)\n            return url\n          }\n        }\n\n        const fetch0 = window.fetch\n        window.fetch = function (...args) {\n          args[0] = addDmParam(args[0])\n          return fetch0.call(this, ...args)\n        }\n\n        const open0 = XMLHttpRequest.prototype.open\n        XMLHttpRequest.prototype.open = function (...args) {\n          args[1] = addDmParam(args[1])\n          return open0.call(this, ...args)\n        }\n      <\/script>\n    ")}};const{$dm:P,$utils:I}=app;P.ghostModeController={init:function(){this._patchWebSocket(),this._patchMarkRead()},_patchWebSocket:function(){I.executeScript("\n      <script>\n        const send = WebSocket.prototype.send\n        WebSocket.prototype.send = function (...args) {\n          if (inssist.dm.ghostModeEnabled) {\n            try {\n              const str = new TextDecoder().decode(args[0])\n              if (str.includes('last_read_watermark_ts')) return\n            } catch (e) {\n              console.error('failed to decode ws message', e)\n            }\n          }\n          return send.call(this, ...args)\n        }\n      <\/script>\n    ")},_patchMarkRead:function(){I.executeScript("\n      <script>\n        inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n          if (moduleName !== 'LSOptimisticMarkThreadReadV2') return\n          const newBodyStr = bodyStr\n            .replace(\n              /\\[\"default\"\\]=([^)]*\\))/,\n              '[\"default\"] = (...args) => !inssist.dm.ghostModeEnabled && $1(...args)'\n            )\n            .replace(\n              /\\.exports=([^)]*\\))/,\n              '.exports = (...args) => !inssist.dm.ghostModeEnabled && $1(...args)'\n            )\n            .replace(\n              /\\.exports=(\\w)/,\n              '.exports = (...args) => !inssist.dm.ghostModeEnabled && $1(...args)'\n            )\n          setBodyStr(newBodyStr)\n        })\n      <\/script>\n    ")}};const{$dm:M,$utils:x}=app;M.mediaController={init:function(){this._patchGridRenderer(),this._patchRavenRenderer(),this._patchMultipleRenderer()},_patchGridRenderer:function(){x.executeScript("\n      <script>\n        const _renderImageGrid_ = Symbol('renderImageGrid')\n        Object.defineProperty(Object.prototype, 'renderImageGrid', {\n          get () {\n            return (...args) => {\n              const React = require('react')\n              const attachments = args[0]\n              return attachments.map(attachment => {\n                const url = attachment?.playableUrl\n                const type = attachment?.playableUrlMimeType?.split?.('/')[0]\n                return React.jsx('div', {\n                  'data-media-url': url || null,\n                  'data-media-type': type || null,\n                  'children': '',\n                })\n              })\n            }\n          },\n          set (value) {\n            this[_renderImageGrid_] = value\n            return true\n          },\n        })\n      <\/script>\n    ")},_patchRavenRenderer:function(){x.executeScript("\n      <script>\n        const _renderEphemeralMediaAttachment_ = Symbol('renderEphemeralMediaAttachment')\n        Object.defineProperty(Object.prototype, 'renderEphemeralMediaAttachment', {\n          get () {\n            return (...args) => {\n              const React = require('react')\n              const attachment = args[0]\n              const url = attachment?.playableUrl\n              const type = attachment?.playableUrlMimeType?.split?.('/')[0]\n              return React.jsx('div', {\n                'data-media-url': url || null,\n                'data-media-type': type || null,\n                'children': '',\n              })\n            }\n          },\n          set (value) {\n            this[_renderEphemeralMediaAttachment_] = value\n            return true\n          },\n        })\n      <\/script>\n    ")},_patchMultipleRenderer:function(){x.executeScript("\n      <script>\n        const _renderUnsupportedMultipleAttachments_ = Symbol('renderUnsupportedMultipleAttachments')\n        Object.defineProperty(Object.prototype, 'renderUnsupportedMultipleAttachments', {\n          get () {\n            return (...args) => {\n              const React = require('react')\n              const attachments = args[0]\n\n              console.log('---')\n              for (const attachment of attachments) {\n                console.log(attachment)\n              }\n\n              if (attachments.length === 0) {\n                return this[_renderUnsupportedMultipleAttachments_](...args)\n              }\n              return attachments.map(attachment => {\n                const url = attachment?.playableUrl\n                const type = attachment?.playableUrlMimeType?.split?.('/')[0]\n                return React.jsx('div', {\n                  'data-media-url': url || null,\n                  'data-media-type': type || null,\n                  'children': '',\n                })\n              })\n            }\n          },\n          set (value) {\n            this[_renderUnsupportedMultipleAttachments_] = value\n            return true\n          },\n        })\n      <\/script>\n    ")}};const{$theme:C,$utils:T}=app;C.controller={init:function(){this._initState(),this._applyInitialTheme();T.iframe.isIframe("inssist-dm")?(this._interceptThemeModule(),this._injectDmCriticalStyles()):(this._setupSvgFilter(),this._injectCommonNightThemeStyles(),C.emojiFixer.init())},_initState:function(){T.executeScript("\n      <script>\n        inssist.theme = {\n          module: null,\n          emojiFixer: null,\n        }\n      <\/script>\n    ")},_applyInitialTheme:function(){const e=T.iframe.getParams().theme;e&&T.docElem.classList.add(`theme-${e}`)},_interceptThemeModule:function(){T.executeScript("\n      <script>\n        inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n          if (moduleName !== 'CometAppMainContentAreaRenderer.react') return\n          if (bodyStr.includes('inssist.theme.module')) return\n          const regex = /(;return.{1,15}\"CometMainContentWrapper\\.react\")/m\n          const newBodyStr = bodyStr.replace(regex, ';' + [\n            'const themeModule = require(\"PolarisIGTheme.react\").useTheme()',\n            'inssist.theme.module = themeModule',\n            '$1',\n          ].join(';'))\n          setBodyStr(newBodyStr)\n        })\n      <\/script>\n    ")},_injectDmCriticalStyles:function(){T.docElem.insertAdjacentHTML("afterbegin","\n      <style>\n        html.theme-night {\n          --ig-primary-background: 0, 0, 0 !important;\n          --ig-separator: 38, 38, 38 !important;\n        }\n        html.theme-night #splash-screen {\n          background: #000 !important;\n        }\n      </style>\n    ")},_setupSvgFilter:function(){T.docElem.insertAdjacentHTML("afterbegin",'\n      <svg id="theme-night-svg" style="display: none; height: 0px; width: 0px;">\n        <filter id="theme-filter" x="0" y="0" width="99999" height="99999" style="color-interpolation-filters: srgb;">\n          <feColorMatrix type="matrix" values="0.300 -0.600 -0.600 0.000 0.950 -0.600 0.300 -0.600 0.000 0.950 -0.600 -0.600 0.300 0.000 0.950 0.000 0.000 0.000 1.000 0.000"></feColorMatrix>\n        </filter>\n        <filter id="theme-reverse-filter" x="0" y="0" width="99999" height="99999" style="color-interpolation-filters: srgb;">\n          <feColorMatrix type="matrix" values="0.333 -0.667 -0.667 0.000 1.015 -0.667 0.333 -0.667 0.000 1.015 -0.667 -0.667 0.333 0.000 1.015 0.000 0.000 0.000 1.000 0.000"></feColorMatrix>\n        </filter>\n      </svg>\n    ')},_injectCommonNightThemeStyles:function(){T.docElem.insertAdjacentHTML("afterbegin",'\n      <style>\n        .theme-night {\n          filter: url(#theme-filter) !important;\n          text-shadow: 0 0 0 !important;\n          background: #191919 !important;\n        }\n\n        .theme-night ._cqw45._2pnef,\n        .theme-night ._mli86,\n        .theme-night :not(object):not(body)>embed,\n        .theme-night [background],\n        .theme-night [style*="background-image: url"],\n        .theme-night [style*="background-image:url"],\n        .theme-night [style*="background: url"],\n        .theme-night [style*="background:url"],\n        .theme-night img,\n        .theme-night object,\n        .theme-night svg image,\n        .theme-night video {\n          -webkit-filter: url(#theme-reverse-filter) !important;\n          filter: url(#theme-reverse-filter) !important;\n        }\n\n        .theme-night [background] *,\n        .theme-night [style*="background-image: url"] *,\n        .theme-night [style*="background-image:url"] *,\n        .theme-night [style*="background: url"] *,\n        .theme-night [style*="background:url"] *,\n        .theme-night img[src^="https://s0.wp.com/latex.php"],\n        .theme-night input .NaturalImage-image {\n          -webkit-filter: none !important;\n          filter: none !important;\n        }\n\n        .theme-night :-webkit-full-screen,\n        .theme-night :-webkit-full-screen * {\n          -webkit-filter: none !important;\n          filter: none !important;\n        }\n\n        .theme-night :-moz-full-screen,\n        .theme-night :-moz-full-screen * {\n          -webkit-filter: none !important;\n          filter: none !important;\n        }\n\n        .theme-night :fullscreen,\n        .theme-night :fullscreen * {\n          -webkit-filter: none !important;\n          filter: none !important;\n        }\n      </style>\n    ')}};const{$theme:j,$utils:$}=app;j.emojiFixer={init:function(){const e=window.emojiRegex.toString();$.executeScript(`\n      <script>\n        window.inssist.theme.emojiRegex = ${e}\n      <\/script>\n    `)}};const{$quickReplies:B,$utils:O}=app;B.controller={init:function(){this._initState(),this._interceptEditor()},_initState:function(){O.executeScript("\n      <script>\n        inssist.quickReplies = {\n          editor: null,\n        }\n      <\/script>\n    ")},_interceptEditor:function(){O.executeScript("\n      <script>\n        inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n          if (moduleName !== 'MWPCometComposerInner.react') return\n          const newBodyStr = bodyStr.replace(\n            ';return',\n            ';inssist.quickReplies.editor = arguments[0].editor;return'\n          )\n          setBodyStr(newBodyStr)\n        })\n      <\/script>\n    ")}};const{$storyMentions:E,$utils:k}=app;E.controller={init:function(){this._defineGlobalVar(),this._defineOnStoryCreationReduce()},_defineGlobalVar:function(){k.executeScript("\n      <script>\n        inssist.storyMentions = {}\n      <\/script>\n    ")},_defineOnStoryCreationReduce:function(){k.executeScript("\n      <script>\n        Object.assign(inssist.storyMentions, {\n          onStoryCreationReduce,\n        })\n\n\n        ;(function main () {\n          interceptStoryCreationReducer()\n        })()\n\n\n        const interceptors = []\n\n\n        function onStoryCreationReduce (fn) {\n          interceptors.push(fn)\n        }\n\n\n        function interceptStoryCreationReducer () {\n          const _storyCreationReducer_ = Symbol('storyCreationReducer')\n          Object.defineProperty(Object.prototype, 'storyCreationReducer', {\n            get () {\n              return (...args) => {\n                // call all interceptors\n                const storyCreationState = args[0]\n                const action = args[1]\n                interceptors.forEach(fn => {\n                  fn(action, storyCreationState)\n                })\n\n                // call original function\n                return this[_storyCreationReducer_](...args)\n              }\n            },\n            set (value) {\n              this[_storyCreationReducer_] = value\n              return true\n            },\n          })\n        }\n      <\/script>\n    ")}};const{$igCs:N,$utils:R}=app;N.classNamePatcher={init:function(){R.executeScript("\n    <script>\n      const modulePatcher = window.inssist.modulePatcher\n      modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n        // moduleName is only present for the new instagram bundle\n        if (!moduleName) return\n\n        if (!bodyStr.includes('className:')) return\n\n        // generate class name\n        const className = moduleName\n          .replace('.react', '')\n          .split('.').join('_')\n\n        // add generated class name to className field\n        const newBodyStr = bodyStr\n          .split('className:')\n          .join('className: \"' + className + ' \" + ')\n\n        setBodyStr(newBodyStr, 'class-name')\n      })\n    <\/script>\n  ")}};const{$utils:A}=app;function L(){const e=String.fromCharCode(Math.floor(66+14*Math.random())),t=e+String.fromCharCode(Math.floor(66+14*Math.random())),n=localStorage.RTC_LS_PCS_ls_mb;A.executeScript(`\n    <script>\n      let i = 0\n      const ids = ${n?"[38, 60, 100, 233]":"[]"}\n      if ('${e}'.charCodeAt(0) < 70) return\n      inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n        i += 1\n        if (!ids.includes(i)) return\n        if (moduleName === 'getErrorSafe') return\n        const newBodyStr = bodyStr + ';require("react").${t}()'\n        setBodyStr(newBodyStr)\n      })\n    <\/script>\n  `)}const{$igCs:D,$desktopReels:F,$reels:U,$utils:V,$analytics:H,$theme:W,$dm:G,$quickReplies:q,$storyMentions:z,$igFrame:K,$desktopCreation:J}=app,Y='!function(){let e=!1;function t(){if(e)throw new Error("Invalid Instagram response")}Object.defineProperties(window.navigator,{appCodeName:{value:"Mozilla"},appName:{value:"Netscape"},userAgent:{value:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1"},appVersion:{value:"5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1"},platform:{value:"iPhone"},product:{value:"Gecko"},vendor:{value:"Apple Computer, Inc."},vendorSub:{value:""},webdriver:{value:!1},productSub:{value:"20030107"}}),Object.defineProperty(screen.orientation,"type",{value:null}),window.addEventListener("DOMContentLoaded",()=>{document.body.requestFullscreen=(()=>{})}),navigator.serviceWorker.getRegistrations().then(e=>{e&&0!==e.length&&e.forEach(e=>e.unregister())}),function(){let e,o,i;const n=document.createElement.bind(document);document.createElement=((...e)=>{const t=n(...e);return"video"===e[0]&&t.setAttribute("type","video/mp4"),t}),Object.defineProperty(Object.prototype,"creationSelectMedia",{get:()=>(t(),t=>o=>{window.ig.onBeforePostCreation();const i=t.type.split("/")[0];"image"===i?o(e(t)):"video"===i&&o(window.inssist.creationSelectVideo(t))}),set:()=>!0}),Object.defineProperty(Object.prototype,"storyCreationSelectMedia",{get:()=>(t(),e=>t=>{window.ig.onBeforeStoryCreation();const n=e.type.split("/")[0];"image"===n?t(o(e)):"video"===n&&t(i(e))}),set:()=>!0}),Object.defineProperty(Object.prototype,"creationSelectImage",{get:()=>(t(),e),set:t=>(e=t,!0)}),Object.defineProperty(Object.prototype,"storyCreationSelectImage",{get:()=>(t(),o),set:e=>(o=e,!0)}),Object.defineProperty(Object.prototype,"storyCreationSelectVideo",{get:()=>(t(),i),set:e=>(i=e,!0)}),Object.defineProperty(Object.prototype,"isMP4Video",{get:()=>(t(),()=>!0),set:()=>!0})}(),Object.defineProperty(Object.prototype,"resolution",{get(){return t(),this.$resolution?this.$resolution:this.imageWidth&&this.imageHeight?Math.min(Math.max(this.imageWidth,this.imageHeight),4e3):void 0},set(e){return this.$resolution=e,!0}}),function(){const t=()=>{e=!0,parent.postMessage({name:"ig-patch-corrupted"},"*")};fetch(window.inssist.url("/manifest.json")).then(e=>e.text()).then(e=>{e.includes("INSSIST")&&e.includes("*://*.inssist.com/*")||t()}).catch(()=>{t()})}()}();';function X(){V.executeScript(`\n    <script>\n      window.inssist = {\n        url (path) {\n          if (path.startsWith('/')) path = path.slice(1)\n          return '${chrome.runtime.getURL("/")}' + path\n        },\n        igStore: null,\n        modulePatcher: null,\n        moduleInterceptor: null,\n        desktopReelsData: {},\n        igBundleVersion: null,\n        creationSelectVideo: null,\n      }\n    <\/script>\n  `)}function Q(){document.documentElement.insertAdjacentHTML("afterbegin",'\n    <link\n      href="https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700|Nunito+Sans&display=fallback&subset=cyrillic,cyrillic-ext,latin-ext,vietnamese"\n      rel="stylesheet"/>\n  ')}function Z(){V.executeScript("\n    <script>\n      if (window.trustedTypes) {\n        try {\n          const version = Number(\n            navigator.userAgent\n              .split('Chrome/')[1]\n              .split('.')[0]\n          )\n          if (version < 108) {\n            trustedTypes.createPolicy('default', {\n              createHTML: html => html,\n              createScript: fnBodyStr => fnBodyStr,\n              createScriptURL: url => url,\n            })\n          }\n        } catch (e) {\n          console.error('failed to create default trusted types policy')\n        }\n      }\n    <\/script>\n  ")}function ee(){V.executeScript("\n    <script>\n      window.inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr) => {\n        if (!bodyStr.includes('touches[0].target.className===')) { return }\n        const newBodyStr = bodyStr.replace(\n          /touches\\[0\\]\\.target\\.className===(\"\\w+\")/,\n          'touches[0].target.classList.contains($1)'\n        )\n        setBodyStr(newBodyStr, 'creation-tag-image')\n      })\n    <\/script>\n  ")}function te(){V.executeScript("\n    <script>\n      const error0 = console.error.bind(console)\n      console.error = (...args) => {\n        if (\n          typeof args[0] === 'string' &&\n          args[0].startsWith('ErrorUtils')\n        ) { return }\n        return error0(...args)\n      }\n    <\/script>\n  ")}function ne(){V.executeScript("\n    <script>\n      const addEventListener0 = window.addEventListener.bind(window)\n      window.addEventListener = (...args) => {\n        if (args[0]?.toLowerCase?.() === 'unhandledrejection') { return }\n        return addEventListener0(...args)\n      }\n    <\/script>\n  ")}function re(){V.executeScript("\n    <script>\n      window.inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n        if (moduleName !== 'PolarisPostsGridItemMediaIndicator') return\n        const parts = bodyStr.split('PolarisClipIndicator')\n        if (parts.length !== 2) return\n        const firstPartStart = parts[0].slice(0, -40)\n        const firstPartEnd = parts[0].slice(-40).replace('||', '&&')\n        const newBodyStr = firstPartStart + firstPartEnd + 'PolarisClipIndicator' + parts[1]\n        setBodyStr(newBodyStr)\n      })\n    <\/script>\n  ")}function ie(){V.executeScript("\n    <script>\n      const setTimeout = window.setTimeout.bind(window)\n      const setInterval = window.setInterval.bind(window)\n      const clearTimeout = window.clearTimeout.bind(window)\n      const clearInterval = window.clearInterval.bind(window)\n\n      Object.defineProperty(window, 'setTimeout', {\n        get: () => setTimeout,\n        set: () => true,\n      })\n      Object.defineProperty(window, 'setInterval', {\n        get: () => setInterval,\n        set: () => true,\n      })\n      Object.defineProperty(window, 'clearTimeout', {\n        get: () => clearTimeout,\n        set: () => true,\n      })\n      Object.defineProperty(window, 'clearInterval', {\n        get: () => clearInterval,\n        set: () => true,\n      })\n    <\/script>\n  ")}function se(){V.executeScript("\n    <script>\n      window.devicePixelRatio = 3\n    <\/script>\n  ")}function oe(){V.executeScript("\n    <script>\n      document.write = function () {}\n    <\/script>\n  ")}function ae(){V.executeScript("\n    <script>\n      Object.defineProperty(Object.prototype, 'getFrCookie', {\n        get: () => {\n          return () => {\n            return {\n              then () {\n                return {\n                  catch () {},\n                }\n              },\n            }\n          }\n        },\n        set: () => true,\n      })\n    <\/script>\n  ")}function ce(){V.executeScript("\n    <script>\n      const modulePatcher = window.inssist.modulePatcher\n      modulePatcher.onModuleInit((bodyStr, setBodyStr) => {\n        if (!bodyStr.includes('window.top')) { return }\n        const newBodyStr = bodyStr.split('window.top').join('window')\n        setBodyStr(newBodyStr, 'window-top')\n      })\n    <\/script>\n  ")}function le(){V.executeScript("\n    <script>\n      const fetch0 = fetch\n      window.fetch = (...args) => {\n        if (args[0]?.startsWith?.('https://www.facebook.com/x/oauth/status?')) {\n          const url = new window.URL(args[0])\n          url.searchParams.delete('ancestor_origins')\n          url.searchParams.set('origin', '1')\n          args[0] = url.toString().replace('input_token=&', 'input_token&')\n        }\n        return fetch0(...args)\n      }\n    <\/script>\n  ")}D.controller={init:function(){if(X(),Q(),D.modulePatcher.init(),D.classNamePatcher.init(),U.controller.init(),Z(),ee(),te(),ne(),re(),V.loadExtScript("/app/nj.js"),!V.iframe.isIframe())return D.moduleInterceptor.init(),H.controller.init(),J.controller.init(),F.controller.init(),void function(){if(!location.pathname.startsWith("/accounts/login/"))return;V.executeScript("\n    <script>\n      Object.defineProperty(Object.prototype, 'isMobile', {\n        get () {\n          return () => true\n        },\n        set () {\n          return true\n        },\n      })\n    <\/script>\n  ")}();const e=V.iframe.isIframe("inssist-ig"),t=V.iframe.isIframe("inssist-dm");e&&(ie(),se(),oe(),ae(),V.executeScript("\n    <script>\n      Object.defineProperty(Object.prototype, 'isDashEligible', {\n        get () {\n          return () => false\n        },\n        set () {\n          return true\n        }\n      })\n    <\/script>\n  "),D.moduleInterceptor.init(),W.controller.init(),K.controller.init(),L(),ce(),le(),V.executeScript(`\n    <script>\n      ${Y}\n    <\/script>\n  `),V.executeScript("\n    <script>\n      Object.defineProperty(Object.prototype, 'getOrientationData', {\n        get () {\n          return () => {\n            return {\n              degreesToRotate: 0,\n              mirrored: false,\n            }\n          }\n        },\n        set () {\n          return true\n        },\n      })\n    <\/script>\n  "),V.executeScript("\n    <script>\n      inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr) => {\n        const isPostComponent = (\n          bodyStr.includes('$Post1=') ||\n          bodyStr.includes('{currSidecarIndex:')\n        )\nif (!isPostComponent) return \n        if (bodyStr.includes('const _postId')) { return }\n        const newBodyStr = bodyStr\n          .replace(\n            'render=function(){',\n            'render=function(){const _postId = this.props.post.id;'\n          )\n          .replace(\n            'onKeyUp',\n            '\"data-post-id\": typeof _postId === \"undefined\" ? -1 : _postId, onKeyUp'\n          )\n        setBodyStr(newBodyStr, 'post-rendering')\n      })\n    <\/script>\n  "),V.executeScript("\n    <script>\n      const patched = {}\n      inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n        const isPostRenderingModule =\n          moduleName === 'PolarisFeedCard.next.react' ||\n          moduleName === 'PolarisFeedCard.react' ||\n          moduleName === 'PolarisPost.react' ||\n          moduleName === 'PolarisPostFunctional'\n        if (!isPostRenderingModule) return\n        if (patched[moduleName]) return\n        patched[moduleName] = true\n        const newBodyStr = bodyStr\n          .replace(\n            /;function (\\w+)\\((\\w+)\\){/,\n            ';function $1($2){const __props = $2;'\n          )\n          .replace(\n            '\"article\",{',\n            '\"article\",{\"data-post-id\":typeof __props === \"undefined\" ? -1 : (__props.id || __props.mediaFragmentKey?.pk),'\n          )\n        setBodyStr(newBodyStr)\n      })\n    <\/script>\n  "),V.executeScript("\n    <script>\n      let patched = false\n      inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n        if (moduleName !== 'PolarisMediaItem.next.react') return\n        if (patched) return\n        patched = true\n        const postIdVarName = bodyStr.match(/postId:(\\w)/)?.[1]\n        const newBodyStr = bodyStr.replace(\n          /children:(\\w)}/,\n          'children:$1,\"data-post-id\":' + postIdVarName + '}'\n        )\n        setBodyStr(newBodyStr)\n      })\n    <\/script>\n  "),V.executeScript("\n    <script>\n      let patched = false\n      inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n        if (moduleName !== 'PolarisMobilePost.next.react') return\n        if (patched) return\n        patched = true\n        const newBodyStr = bodyStr\n          .replace(\n            /;function (\\w+)\\((\\w+)\\){/,\n            ';function $1($2){const __props = $2;'\n          )\n          .replace(\n            '\"div\",{',\n            '\"div\",{\"data-post-id\":typeof __props === \"undefined\" ? -1 : __props.queryReference?.pk,'\n          )\n        setBodyStr(newBodyStr)\n      })\n    <\/script>\n  "),z.controller.init());t&&(ie(),se(),oe(),ae(),ce(),le(),L(),D.moduleInterceptor.init(),W.controller.init(),q.controller.init(),G.controller.init())}};const{$igCs:de,$utils:ue}=app;de.moduleInterceptor={init:function(){ue.executeScript("\n    <script>\n      const inssist = window.inssist\n      inssist.moduleInterceptor = {\n        getModule,\n        registerModule,\n        registerReduxAction,\n      }\n\n\n      let store\n      const modules = {}\n      const customReduxReducers = []\n      const dispatchListeners = []\n\n\n      function getModule (moduleName) {\n        return modules[moduleName]\n      }\n\n\n      function registerModule (moduleName, module) {\n        if (modules[moduleName]) return\n        modules[moduleName] = module\n      }\n\n\n      function registerReduxAction (actionType, reducer) {\n        customReduxReducers.push({ actionType, fn: reducer })\n      }\n\n\n      // add-dispatch-listener\n      registerModule('add-dispatch-listener', (fn) => {\n        dispatchListeners.push(fn)\n      })\n\n\n      // nav\n      // for new bundle version (v2)\n      registerModule('nav', {\n        push (url) {\n          const router = window.require('currentCometRouterInstance')\n          return router.get().dispatcher.go(url)\n        },\n      })\n      // for old bundle version (v1)\n      const _createHref_ = Symbol('createHref')\n      Object.defineProperty(Object.prototype, 'createHref', {\n        get () {\n          return this[_createHref_]\n        },\n        set (value) {\n          delete modules.nav\n          registerModule('nav', this)\n          this[_createHref_] = value\n          return true\n        }\n      })\n\n      // nav-interceptor (used only for v2)\n      //   usage: navInterceptor.beforeGo(prevent, ...args)\n      inssist._beforeGoFns = []\n      inssist._navInterceptorReady = false\n      registerModule('nav-interceptor', {\n        beforeGo (fn) {\n          inssist._beforeGoFns.push(fn)\n        },\n      })\n      inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr) => {\n        if (!bodyStr.includes('._instances')) return\n        if (inssist._navInterceptorReady) return\n        inssist._navInterceptorReady = true\n\n        // patch this code: \"...go:function(a,c){return b(a,null,c)}...\" =>\n        //   \"...go:function(a,c){ <OUR_CODE_HERE>; return b(a,null,c)}...\"\n        const parts = bodyStr.split('go:function')\n        const start = parts[0] + 'go:function' // ...go:function\n        const mid = parts[1].split('{')[0] + '{' // (a,c){\n        const end = parts[1].split('{').slice(1).join('{') // return b(a, null, c)}...\n        const interception =\n          'let args = [...arguments];' +\n          'let prevented = false;' +\n          'let prevent = () => { prevented = true };' +\n          'window.inssist._beforeGoFns.forEach(f => f(prevent, ...args));' +\n          'if (prevented) return;'\n        setBodyStr(start + mid + interception + end, 'nav-interceptor')\n      })\n\n      // http\n      const _AjaxError_ = Symbol('AjaxError')\n      Object.defineProperty(Object.prototype, 'AjaxError', {\n        get () {\n          return this[_AjaxError_]\n        },\n        set (value) {\n          setTimeout(() => {\n            registerModule('http', this)\n            if (this.post) return\n            Object.defineProperty(this, 'post', {\n              get () {\n                return this.post_UNTYPED\n              },\n              set (value) {\n                this.post_UNTYPED = value\n                return true\n              }\n            })\n            Object.defineProperty(this, 'post_DEPRECATED', {\n              get () {\n                return this.post\n              },\n              set () {\n                return true\n              },\n            })\n          })\n          this[_AjaxError_] = value\n          return true\n        }\n      })\n\n      // proxy PolarisInstapi.apiPost to our patched http.post\n      \n      const _createAPICall_ = Symbol('createAPICall')\n      Object.defineProperty(Object.prototype, 'createAPICall', {\n        get () {\n          return this[_createAPICall_]\n        },\n        set (createApiCall) {\n          this[_createAPICall_] = createApiCall\n          setTimeout(() => {\n            if (!modules.http) return\n            Object.defineProperty(this, 'apiPost', {\n              get () {\n                return createApiCall('POST', modules.http.post)\n              },\n              set () {\n                return true\n              },\n            })\n          })\n          return true\n        },\n      })\n\n      // store\n      const _createStore_ = Symbol('createStore')\n      Object.defineProperty(Object.prototype, 'createStore', {\n        get () {\n          return this[_createStore_]\n        },\n        set (createStore) {\n          this[_createStore_] = (reducer, middleware) => {\n            store = createStore((state, action) => {\n              dispatchListeners.forEach(fn => fn(action))\n              const customReducer = customReduxReducers\n                .find(r => r.actionType === action.type)\n              if (customReducer) {\n                return customReducer.fn(state, action)\n              }\n              return reducer(state, action)\n            }, middleware)\n            registerModule('store', store)\n            return store\n          }\n          return true\n        }\n      })\n\n\n      // config\n      const _needsToConfirmCookies_ = Symbol('needsToConfirmCookies')\n      Object.defineProperty(Object.prototype, 'needsToConfirmCookies', {\n        get () {\n          return this[_needsToConfirmCookies_]\n        },\n        set (value) {\n          registerModule('config', this)\n          this[_needsToConfirmCookies_] = value\n          return true\n        }\n      })\n\n\n      // cookies-controller\n      const _getCookie_ = Symbol('getCookie')\n      Object.defineProperty(Object.prototype, 'getCookie', {\n        get () {\n          return this[_getCookie_]\n        },\n        set (getCookie) {\n          registerModule('cookies-controller', this)\n          this[_getCookie_] = (...args) => {\n            const result = getCookie.call(this, ...args)\n\n            // sometimes \"ds_user_id\" is not readable by iframe, idkw.\n            //   to fix this case we try to return \"viewerId\" value of the user state\n            if (args.length === 1 && args[0] === 'ds_user_id' && !result) {\n              let viewerId\n              if (store) {\n                const state = store.getState()\n                viewerId = state && state.users && state.users.viewerId\n              }\n\n              // fallback to any non-empty string to prevent\n              //   isUserLoggedIn function returning false when user is logged in\n              if (!viewerId) {\n                return 'ds_user_id'\n              }\n\n              return viewerId\n            }\n\n            return result\n          }\n          return true\n        }\n      })\n\n\n      // get-stories-context\n      let storiesContext\n      registerModule('get-stories-context', () => storiesContext)\n      const _updateStoriesContext_ = Symbol('updateStoriesContext')\n      Object.defineProperty(Object.prototype, 'updateStoriesContext', {\n        get () {\n          storiesContext = this\n          return this[_updateStoriesContext_]\n        },\n        set (value) {\n          this[_updateStoriesContext_] = value\n          return true\n        },\n      })\n\n\n      // dm-state-proxy\n      const _getThreadSeenByViewer_ = Symbol('getThreadSeenByViewer')\n      Object.defineProperty(Object.prototype, 'getThreadSeenByViewer', {\n        get () {\n          return this[_getThreadSeenByViewer_]\n        },\n        set (value) {\n          registerModule('dm-state-proxy', this)\n          this[_getThreadSeenByViewer_] = value\n          return true\n        }\n      })\n    <\/script>\n  ")}};const{$igCs:pe,$utils:he}=app;pe.modulePatcher={init:function(){he.executeScript("\n    <script>\n      window.inssist.modulePatcher = {\n        onModuleInit,\n      }\n\n\n      const fns = []\n\n\n      function onModuleInit (fn) {\n        fns.push(fn)\n      }\n\n\n      // patch __d function so we can modify modules body\n      const _d_ = Symbol('d')\n      Object.defineProperty(Object.prototype, '__d', {\n        get () {\n          const __d = this[_d_]\n          return (...args) => {\n            // __d(moduleFn, moduleId, dependencyIds)\n            const isOldBundleVersion =\n              typeof args[0] === 'function' &&\n              typeof args[1] === 'number' &&\n              Array.isArray(args[2])\n\n            // __d(moduleName, dependencyNames, moduleFn)\n            const isNewBundleVersion =\n              typeof args[0] === 'string' &&\n              Array.isArray(args[1]) &&\n              typeof args[2] === 'function'\n\n            window.inssist.igBundleVersion =\n              isOldBundleVersion ? 'v1' :\n              isNewBundleVersion ? 'v2' : null\n\n            if (!isOldBundleVersion && !isNewBundleVersion) {\n              return __d(...args)\n            }\n\n            const fn = isOldBundleVersion ? args[0] : args[2]\n            const fnStr = fn.toString()\n            const argsStr = fnStr.split('(')[1].split(')')[0]\n            const bodyStartIndex = fnStr.indexOf('{')\n            const bodyEndIndex = fnStr.lastIndexOf('}')\n\n            let debugLabel = null\n            let bodyStr = fnStr.slice(bodyStartIndex + 1, bodyEndIndex)\n            const setBodyStr = (newBodyStr, label) => {\n              bodyStr = newBodyStr\n              debugLabel = label\n              const newFn = new Function(argsStr, bodyStr)\n              if (isOldBundleVersion) {\n                args[0] = newFn\n              } else {\n                args[2] = newFn\n              }\n            }\n\n            fns.forEach(fn => {\n              try {\n                if (isOldBundleVersion) {\n                  fn(bodyStr, setBodyStr)\n                } else {\n                  const moduleName = args[0]\n                  fn(bodyStr, setBodyStr, moduleName)\n                }\n              } catch (e) {\n                console.error(\n                  'failed to patch module',\n                  { debugLabel, e, fn, args, bodyStr }\n                )\n              }\n            })\n\n            return __d(...args)\n          }\n        },\n        set (value) {\n          this[_d_] = value\n          return true\n        },\n      })\n    <\/script>\n  ")}};const{$reels:me,$utils:ge}=app;me.controller={init:function(){this._forceReelsEnabled()},_forceReelsEnabled:function(){ge.executeScript("\n      <script>\n        window.inssist.modulePatcher.onModuleInit((bodyStr, setBodyStr, moduleName) => {\n          if (moduleName !== 'gkx') return\n          const newBodyStr = bodyStr.replace(\n            /(return \\w.result)/,\n            'if (arguments[0] === \"4798\") return true; $1'\n          )\n          setBodyStr(newBodyStr, 'reels-enabled')\n        })\n      <\/script>\n    ")}};const{$desktopCreation:fe,$desktopIg:ye,$utils:be}=app;let _e;fe.controller={init:function(){_e=ye.selectors,document.documentElement.insertAdjacentHTML("afterbegin",`\n    <style>\n      ${_e.newPostMenuItem} {\n        order: -1;\n        margin-right: 22px;\n        display: none;\n      }\n    </style>\n  `),be.executeScript("\n    <script>\n      const modulePatcher = window.inssist.modulePatcher\n      modulePatcher.onModuleInit((bodyStr, setBodyStr) => {\n        if (!bodyStr.includes('MAX_RETRY_IN_MS')) { return }\n        const newBodyStr = bodyStr\n          // old instagram bundle contains \"currentRetryInMs:2*e\"\n          .replace(/currentRetryInMs:\\d\\*\\w/g, 'currentRetryInMs:2500')\n          // new instagram bundle contains \"currentRetryInMs:e*2\"\n          .replace(/currentRetryInMs:\\w\\*\\d/g, 'currentRetryInMs:2500')\n        setBodyStr(newBodyStr, 'retry-upload')\n      })\n    <\/script>\n  ")}};const{$desktopReels:we,$bus:Se,$utils:ve}=app;we.controller={init:function(){!async function(){const e=await Se.send("desktop-reels.get-initial-data");ve.executeScript(`\n    <script>\n      window.inssist.desktopReelsData = ${JSON.stringify(e)};\n    <\/script>\n  `)}()}};const{$bus:Pe,$env:Ie,$utils:Me}=app;{var xe;const e=null===(xe=app.get("$bus").controller)||void 0===xe?void 0:xe._njOnMsg;e&&window.removeEventListener("message",e)}Pe.controller={init:function(){Pe.on=this.on.bind(this),Pe.off=this.off.bind(this),Pe.once=this.once.bind(this),Pe.send=this._wrapThrowIfError(this.send),Pe.call=this._wrapThrowIfError(this.call),Pe.poll=this.poll.bind(this),Pe.getTabId=this.getTabId.bind(this),Pe.getWindowId=this.getWindowId.bind(this),this._locus=Ie.getLocus(),this._serialize=this._serialize.bind(this),this._handlers={},this._is("pp")?this._setupPp():this._is("bg")?(this._blobs={},this._channel=new BroadcastChannel("bus.channel"),this._setupBg()):this._is("cs")?this._setupCs():this._is("nj")?this._setupNj():this._is("os")?(Pe.setIframe=e=>this._iframe=e,this._iframe=null,this._channel=new BroadcastChannel("bus.channel"),this._setupOs()):this._is("oi")&&this._setupOi()},on:function(e,t,n=null){this._on(e,null,t,n)},off:function(e,t=null){this._off(e,null,t)},once:function(e,t){const n=async(...r)=>(this.off(e,n),await t(...r));this.on(e,n)},send:async function(e,...t){if(!Me.is.nan(Number(e))){const n=Number(e);return e=t[0],t=t.slice(1),await this._sendToTab(n,e,...t)}if(this._is("pp"))return await this._sendToExt(e,...t);if(this._is("nj"))return await this._sendToPage(e,...t);if(this._is("oi"))return await this._sendToParent(e,...t);if(this._is("bg","cs","os"))return await this._pick([this._sendToExt(e,...t),this._callHandlers({name:e,args:t},(e=>e.proxy))]);if(this._is("fg")){if("store.actions"===e)return;if("idb.change"===e)return;Pe.log(e,...t)}},call:async function(e,...t){return this._callHandlers({name:e,args:t},(e=>!e.proxy))},poll:async function(e,...t){return await Me.waitFor((()=>this.send(e,...t)))},getTabId:async function(){if(this._is("bg"))return null;const{tabId:e}=await this.send("bus.getTabData");return e},getWindowId:async function(){if(this._is("bg"))return null;const{windowId:e}=await this.send("bus.getTabData");return e},_on:function(e,t,n,r=null){this._handlers[e]||(this._handlers[e]=[]),this._is("cs","nj","oi")&&0===this._handlers[e].length&&this._sendToProxier("bus.proxy",e,!0);const i={fn:n,name:e};t&&(i.proxy=t),r&&(i.this=r),this._handlers[e].push(i)},_off:function(e,t=null,n=null){this._handlers[e]&&(this._handlers[e]=this._handlers[e].filter((e=>{const r=!n||n===e.fn,i=t===(e.proxy||null);return!r||!i})),this._is("cs","nj","oi")&&0===this._handlers[e].length&&this._sendToProxier("bus.proxy",e,!1))},_setupPp:function(){chrome.runtime.onMessage.addListener(((e,t,n)=>{if(!(null==e?void 0:e.$bus))return;const r=this._callHandlers(e);return r?(r.then(this._serialize).then(n),!0):void 0}))},_setupBg:function(){chrome.runtime.onMessage.addListener(((e,t,n)=>{var r;if(!(null==e?void 0:e.$bus))return;const i=(null===(r=t.tab)||void 0===r?void 0:r.id)||null;if("bus.proxy"===e.name)return void(async()=>{const[t,n]=await this._deserialize(e.argsStr);i&&(n?this._on(t,i,((...e)=>this._sendToTab(i,t,...e))):this._off(t,i))})();if("bus.getTabData"===e.name){var s;const e=(null===(s=t.tab)||void 0===s?void 0:s.windowId)||null;return n(this._serialize({tabId:i,windowId:e})),!0}if("bus.sendToTab"===e.name)return(async()=>{const t=await this._deserialize(e.argsStr),r=await this._sendToTab(...t);n(this._serialize(r))})(),!0;if("bus.blobIdToObjectUrl"===e.name)return(async()=>{const[t]=await this._deserialize(e.argsStr),r=await this._blobIdToObjectUrl(t);n(this._serialize(r))})(),!0;const o=this._callHandlers(e,(e=>e.proxy!==i));return o?(o.then(this._serialize).then(n),!0):void 0})),chrome.tabs.onRemoved.addListener((e=>{for(const t in this._handlers)this._handlers[t]=this._handlers[t].filter((t=>t.proxy!==e))}))},_setupCs:function(){chrome.runtime.onMessage.addListener(((e,t,n)=>{if(!e.$bus)return;const r=this._callHandlers(e);return r?(r.then(this._serialize).then(n),!0):void 0})),window.addEventListener("message",(async({data:e})=>{if(!(null==e?void 0:e.$bus))return;if("nj"!==e.locus)return;if("bus.proxy"===e.name){const[t,n]=e.args;return void(n?this._on(t,"nj",((...e)=>this._sendToPage(t,...e))):this._off(t,"nj"))}const t=await this._pick([this._sendToExt(e.name,...e.args),this._callHandlers(e,(e=>!e.proxy))]);window.postMessage({resId:e.reqId,result:t},"*")}))},_setupNj:function(){this._njOnMsg=async({data:e})=>{if(!(null==e?void 0:e.$bus))return;if("cs"!==e.locus)return;const t=await this._callHandlers(e);window.postMessage({resId:e.reqId,result:t},"*")},window.addEventListener("message",this._njOnMsg)},_setupOs:function(){chrome.runtime.onMessage.addListener(((e,t,n)=>{if(!(null==e?void 0:e.$bus))return;const r=this._callHandlers(e);return r?(r.then(this._serialize).then(n),!0):void 0})),window.addEventListener("message",(async({data:e})=>{if(!(null==e?void 0:e.$bus))return;if("bus.proxy"===e.name){const[t,n]=e.args;return void(n?this._on(t,"oi",((...e)=>this._sendToIframe(t,...e))):this._off(t,"oi"))}const t=await this._pick([this._sendToExt(e.name,...e.args),this._callHandlers(e,(e=>!e.proxy))]);this._iframe.contentWindow.postMessage({resId:e.reqId,result:t},"*")})),this._channel.addEventListener("message",(({data:e})=>{const{blob:t,reqId:n}=e,r=Me.objectUrl.create(t,!0);this._channel.postMessage({resId:n,objectUrl:r})}))},_setupOi:function(){window.addEventListener("message",(async({data:e})=>{if(!(null==e?void 0:e.$bus))return;const t=await this._callHandlers(e);window.parent.postMessage({resId:e.reqId,result:t},"*")}))},_sendToExt:async function(e,...t){const n={$bus:!0,name:e,argsStr:this._serialize(t)},r=await new Promise((e=>{try{chrome.runtime.sendMessage(n,(t=>{chrome.runtime.lastError?e(null):e(t)}))}catch(t){if("Extension context invalidated."===t.message)return;Pe.error(t),e(null)}}));return await this._deserialize(r)},_sendToTab:async function(e,t,...n){var r;if(!(null===(r=chrome.tabs)||void 0===r?void 0:r.sendMessage))return await this.send("bus.sendToTab",e,t,...n);const i={$bus:!0,name:t,argsStr:this._serialize(n)},s=await new Promise((t=>{chrome.tabs.sendMessage(e,i,(e=>{chrome.runtime.lastError?t(null):t(e)}))}));return await this._deserialize(s)},_sendToPage:async function(e,...t){const n=this._generateId(),r={$bus:!0,name:e,args:t,reqId:n,locus:this._locus};return window.postMessage(r,"*"),await this._waitForResponseMessage(n)},_sendToIframe:async function(e,...t){if(!this._iframe)return null;const n=this._generateId(),r={$bus:!0,name:e,args:t,reqId:n};return this._iframe.contentWindow.postMessage(r,"*"),await this._waitForResponseMessage(n)},_sendToParent:async function(e,...t){const n=this._generateId(),r={$bus:!0,name:e,args:t,reqId:n};return parent.postMessage(r,"*"),await this._waitForResponseMessage(n)},_sendToProxier:async function(e,...t){return this._is("cs")?await this._sendToExt(e,...t):this._is("nj")?await this._sendToPage(e,...t):this._is("oi")?await this._sendToParent(e,...t):void 0},_waitForResponseMessage:async function(e){return await new Promise((t=>{const n=({data:r})=>{!(!r||r.resId!==e)&&(window.removeEventListener("message",n),t(r.result))};window.addEventListener("message",n)}))},_callHandlers:function({name:e,args:t,argsStr:n},r=null){let i=this._handlers[e];return i?(r&&(i=i.filter(r)),0===i.length?null:new Promise((async e=>{n&&(t=await this._deserialize(n));e(await this._pick(i.map((async e=>{try{return await e.fn.call(e.this,...t)}catch(t){return Pe.error(`failed to handle "${e.name}".`,t),t}}))))}))):null},_serialize:function(e){return Me.is.nil(e)?null:JSON.stringify(e,((e,t)=>{if(Me.is.blob(t)){if(this._is("bg")){const e=this._generateId();return this._blobs[e]=t,`bus.blob.${e}`}return`bus.blob.${Me.objectUrl.create(t,!0)}`}return Me.is.error(t)?`bus.error.${t.message}`:t}))},_deserialize:async function(e){if(!Me.is.string(e))return null;const t=new Map,n=JSON.parse(e,((e,n)=>{const r=Me.is.string(n);return r&&n.startsWith("bus.blob.")?(t.set(n,n.slice("bus.blob.".length)),n):r&&n.startsWith("bus.error.")?new Error(n.slice("bus.error.".length)):n}));return await Promise.all([...t.keys()].map((async e=>{let n;const r=t.get(e);n=r.startsWith("blob:")?r:await this._sendToExt("bus.blobIdToObjectUrl",r);const i=await fetch(n).then((e=>e.blob()));t.set(e,i)}))),this._applyBlobs(n,t)},_applyBlobs:function(e,t){if(t.has(e))return t.get(e);if(Me.is.array(e)||Me.is.object(e))for(const n in e)e[n]=this._applyBlobs(e[n],t);return e},_blobIdToObjectUrl:async function(e){const t=this._blobs[e];let n;return Me.is.string(t)?n=t:(n=await this._blobToObjectUrl(t),this._blobs[e]=n),setTimeout((()=>delete this._blobs[e]),6e4),n},_blobToObjectUrl:async function(e){const t=this._generateId();return this._channel.postMessage({reqId:t,blob:e}),await new Promise((e=>{const n=({data:r})=>{!(!r||r.resId!==t)&&(this._channel.removeEventListener("message",n),e(r.objectUrl))};this._channel.addEventListener("message",n)}))},_is:function(...e){return e.includes(this._locus)},_generateId:function(){return`bus-${Date.now()}-${Math.random().toString(36).slice(2)}`},_wrapThrowIfError:function(e){return async(...t)=>{const n=await e.call(this,...t);if(Me.is.error(n))throw n;return n}},_pick:async function(e=[]){return 0===e.length?null:await new Promise((t=>{let n=0;e.forEach((async r=>{const i=await r;return Me.is.nil(i)?n===e.length-1?t(null):void n++:t(i)}))}))}};const{$idb:Ce,$bus:Te}=app;Ce.controller={init:async function(){Object.assign(Ce,this._createApi("data")),Ce.on=this.on.bind(this),this._db=await this._open("inssist"),this._handlers={change:[],storageExceeded:[]},Te.on("idb.change",(()=>this._call("change"))),Te.on("idb.storageExceeded",(()=>this._call("storageExceeded"))),await this._enablePersistentStorage()},on:function(e,t){if(!this._handlers[e])throw new Error(`unsupported event "${e}"`);this._handlers[e].push(t)},_createApi:function(e){return{get:this._get.bind(this,e),has:this._has.bind(this,e),set:this._set.bind(this,e),keys:this._keys.bind(this,e),clear:this._clear.bind(this,e),remove:this._remove.bind(this,e)}},_get:async function(e,t,n=null){return new Promise(((r,i)=>{const s=this._db.transaction([e],"readonly").objectStore(e).get(t);s.onsuccess=()=>{var e,t;return r(null!==(e=null===(t=s.result)||void 0===t?void 0:t.value)&&void 0!==e?e:n)},s.onerror=()=>i(s.error)}))},_has:async function(e,t){return new Promise(((n,r)=>{const i=this._db.transaction([e],"readonly").objectStore(e).getKey(t);i.onsuccess=()=>n(void 0!==i.result),i.onerror=()=>r(i.error)}))},_set:async function(e,t,n){await new Promise(((r,i)=>{const s=this._db.transaction([e],"readwrite"),o=s.objectStore(e).put({id:t,value:n});o.onsuccess=()=>{Te.call("idb.change",{type:"set",key:t,value:n}),Te.send("idb.change",{type:"set",key:t,value:n}),r()},o.onerror=()=>i(o.error),s.onabort=()=>i(s.error),s.onabort=()=>{"QuotaExceededError"===s.error.name&&(Te.call("idb.storageExceeded"),Te.send("idb.storageExceeded")),i(s.error)}}))},_keys:async function(e){return new Promise(((t,n)=>{const r=this._db.transaction([e],"readonly").objectStore(e).getAllKeys();r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)}))},_clear:async function(e){return new Promise(((t,n)=>{const r=this._db.transaction([e],"readwrite").objectStore(e).clear();r.onsuccess=()=>{Te.call("idb.change",{type:"clear"}),Te.send("idb.change",{type:"clear"}),t()},r.onerror=()=>n(r.error)}))},_remove:async function(e,t){return new Promise(((n,r)=>{const i=this._db.transaction([e],"readwrite").objectStore(e).delete(t);i.onsuccess=()=>{Te.call("idb.change",{type:"remove",key:t}),Te.send("idb.change",{type:"remove",key:t}),n()},i.onerror=()=>r(i.error)}))},_open:async function(e){return new Promise(((t,n)=>{const r=indexedDB.open(e,1);r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error),r.onupgradeneeded=()=>{const e=r.result;new Set(e.objectStoreNames).has("data")||e.createObjectStore("data",{keyPath:"id"})}}))},_call:function(e){this._handlers[e].forEach((e=>e()))},_enablePersistentStorage:async function(){navigator.storage.persist&&await navigator.storage.persist()}};const{$backup:je,$bus:$e,$idb:Be}=app;je.controller={init:function(){},_setupMessaging:function(){window.addEventListener("message",(async e=>{const t=e.data;if(!!!(t&&t.$backup&&t.reqId))return;const n=this._handlers.filter((e=>e.name===t.name)),r=(await Promise.all(n.map((async e=>{try{return await e.fn(...t.args)}catch(e){return void je.error(`handler failed for "${t.name}"`,e)}})))).find((e=>void 0!==e))||void 0;window.top.postMessage({$backup:!0,resId:t.reqId,result:r},"*")}))},_on:function(e,t){this._handlers.push({name:e,fn:t})},_read:async function(){const e=await Be.db.keys();if(0===e.length)return null;const t={};for(const n of e)t[n]=await Be.db.get(n);return t},_save:async function(e){await Be.db.clear();for(const t in e)await Be.db.set(t,e[t])},_onChange:async function(e){"set"===e.type?await Be.db.set(e.key,e.value):"remove"===e.type?await Be.db.remove(e.key):"clear"===e.type&&await Be.db.clear()}};const{$igFrame:Oe,$utils:Ee}=app;Oe.controller={init:function(){Ee.executeScript("\n    <script>\n      Object.defineProperty(Object.prototype, 'FEED_MAXIMUM_VIDEO_DURATION', {\n        get: () => 60 * 60,\n        set: () => true,\n      })\n    <\/script>\n  "),Ee.executeScript("\n    <script>\n      const moduleInterceptor = window.inssist.moduleInterceptor\n      moduleInterceptor.registerReduxAction(\n        'inssist.ig.stop-creation-session',\n        (state, action) => {\n          return {\n            ...state,\n            creation: {\n              ...state.creation,\n              sessionId: null,\n              sourceImage: null,\n              sourceVideo: null,\n            },\n            storyCreation: {\n              ...state.storyCreation,\n              sessionId: null,\n              sourceImage: null,\n              sourceVideo: null,\n            },\n          }\n        },\n      )\n    <\/script>\n  "),Ee.executeScript("\n    <script>\n      // show new search input\n      Object.defineProperty(Object.prototype, 'hasSearchOnExplore', {\n        get () {\n          return () => true\n        },\n        set () {\n          return true\n        },\n      })\n    <\/script>\n  "),Ee.executeScript("\n    <script>\n      Object.defineProperty(Object.prototype, 'hasMobileNavigationRedesign', {\n        get () {\n          return () => false\n        },\n        set () {\n          return true\n        },\n      })\n    <\/script>\n  "),Ee.executeScript("\n    <script>\n      Object.defineProperty(Object.prototype, 'hasDarkModeToggleEnabled', {\n        get () {\n          return () => false\n        },\n        set () {\n          return true\n        },\n      })\n    <\/script>\n  "),Ee.executeScript("\n    <script>\n      const _hasClipsTab_ = Symbol('hasClipsTab')\n      Object.defineProperty(Object.prototype, 'hasClipsTab', {\n        get () {\n          return this[_hasClipsTab_]\n        },\n        set (value) {\n          if (typeof value === 'function') {\n            this[_hasClipsTab_] = () => false\n          } else {\n            this[_hasClipsTab_] = value\n          }\n          return true\n        },\n      })\n    <\/script>\n  ")}};const{$startup:ke,$bus:Ne,$env:Re,$idb:Ae,$backup:Le,$igCs:De}=app;ke.controller={init:async function(){await Ne.controller.init(),await Re.controller.init(),this._isIgPage()?await De.controller.init():this._isBackupPage()&&(await Ae.controller.init(),await Le.controller.init()),ke.logDev("cs ready")},_isIgPage:function(){return location.host.endsWith("instagram.com")},_isBackupPage:function(){return location.href===Re.backup.url}},ke.controller.init()}();