try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`2bf758b8-9176-465b-aad2-966e1b5bdae5`,e._sentryDebugIdIdentifier=`sentry-dbid-2bf758b8-9176-465b-aad2-966e1b5bdae5`)}catch{}import"./rolldown-runtime-eb2nym32.js";import{Ri as e,Yi as t,aa as n,ia as r,na as i,xi as a}from"./entry.client-dr7r6s9a.js";import{F as o,P as s}from"./workspace-leaf-files-mc5sghv7.js";import{t as c}from"./selectors-jy7eaal3.js";import{t as l}from"./BasePlugin-nelnyp3q.js";import{t as u}from"./dist-gisqjxt7.js";var d=a(),f=u();e();var p=class extends l{feedService;stateKey=o;actions=f.FeedAction;feedSelectors=(0,f.promoteFeedSelectors)(e=>c(e,this.stateKey));feedSagaManager;xblTokenProvider;acceptableLanguageProvider;cVProvider;contentRestrictionProvider;interceptors;logger;constructor(e,t,n,r,i,a,o,c){super(e,s,c),this.xblTokenProvider=t,this.acceptableLanguageProvider=n,this.cVProvider=r,this.contentRestrictionProvider=i,this.interceptors=a,this.logger=o,this.reduxEnvironment.registerReducer(this.stateKey,f.feedReducer),this.feedService=new f.XblFeedService(this.xblTokenProvider,this.acceptableLanguageProvider,this.cVProvider,this.contentRestrictionProvider,this.interceptors,this.logger),this.feedSagaManager=new f.FeedSagaManager(this.feedService,this.feedSelectors,this.logger)}destroy(){this.reduxEnvironment.removeReducer(this.stateKey)}*handleActions(){yield t([this.feedSagaManager.watchForActions()])}fetchLinkPreview(e,a){let o=this;return new Promise((s,c)=>o.reduxEnvironment.sagaMiddleware.run(o.name,function*(){let l=!1,u=yield r(o.feedSelectors.getLinkPreviewLCE,e);if(u){let e=(0,d.getDataOrPrevious)(u);if(e?.anonymous===a){s(e.item);return}else l=!0}yield t([i(o.actions.getLinkPreview.start(e,a,l)),n(t=>t.type===f.FeedActionType.GetLinkPreviewCompleted&&t.locator===e)]);let p=yield r(o.feedSelectors.getLinkPreviewLCE,e);if((0,d.isError)(p)){o.logger.error(`Failed to get link preview in FeedPlugin`,p.error),c(p.error);return}let m=(0,d.getDataOrPrevious)(p);if(!m){let e=`feedSelectors.getLinkPreviewLCE returned undefined but did not have an error. This should never happen and is most likely an error on xbl-feed.`;o.logger.error(e),c(Error(e));return}s(m.item)}))}};export{p as FeedPlugin};