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]=`c4f8c2aa-74d2-4b85-877a-0a8c091be729`,e._sentryDebugIdIdentifier=`sentry-dbid-c4f8c2aa-74d2-4b85-877a-0a8c091be729`)}catch{}import"./rolldown-runtime-eb2nym32.js";import{p as e}from"./vendor-misc-hfpbxrii.js";import{Hi as t,Mi as n,Ri as r,Yi as i,Zi as a,ia as o,na as s}from"./entry.client-dr7r6s9a.js";import{b as c,x as l}from"./workspace-leaf-files-mc5sghv7.js";import{t as u}from"./selectors-jy7eaal3.js";import{t as d}from"./BasePlugin-nelnyp3q.js";r();var f=n(),p={locale:void 0},m=(t=p,n)=>{switch(n.type){case f.CommonActionType.InternationalizationStateChanged:return e(t,e=>{e.locale=n.language??t.locale});default:return t}},h=e=>u(e,l),g={getLocale:e=>h(e).locale},_=class extends d{stateKey=l;internationalizationSelectors=g;constructor(e,t){super(e,c,t),this.reduxEnvironment.registerReducer(this.stateKey,m)}destroy(){this.reduxEnvironment.removeReducer(this.stateKey)}updateLocale(e){let t=this;return new Promise((n,r)=>t.reduxEnvironment.sagaMiddleware.run(c,function*(){try{if((yield o(t.internationalizationSelectors.getLocale))===e){n(!1);return}yield s(f.CommonAction.internationalizationStateChanged({language:e})),n(!0)}catch(e){r(e)}}))}*handleActions(){let e=this;yield i([t([f.CommonAction.internationalizationStateChanged],function*(){yield a([e,e.handleLocaleChanges])})])}*handleLocaleChanges(){let e=yield a([this,this.getPlugins],c),t=yield o(this.internationalizationSelectors.getLocale);e.forEach(e=>e.dispatchLocaleChangedAction(f.CommonAction.internationalizationStateChanged({language:t})))}};export{_ as InternationalizationPlugin};