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]=`8cf585b8-b0b6-4a46-b83d-9489fe580c9d`,e._sentryDebugIdIdentifier=`sentry-dbid-8cf585b8-b0b6-4a46-b83d-9489fe580c9d`)}catch{}import"./rolldown-runtime-nx40z1zs.js";import{Bc as e,Jd as t}from"./entry.client-mpghtlrl.js";var n=class{async readValue(n){let i=r(await t(`getStoredValue`,{key:n}),n);if(i.success===!1)throw a(i.error,n);if(i.value===void 0||i.value===null)throw new e(`not-found`,n);return i.value}async writeValue(e,n){let i=r(await t(`setStoredValue`,{key:e,value:n}),e);if(i.success===!1)throw a(i.error,e)}};function r(e,t){if(i(e))return e;if(typeof e==`string`)try{let t=JSON.parse(e);if(i(t))return t}catch{}throw a(`Invalid response from Kepler storage`,t)}function i(e){return typeof e==`object`&&e&&!Array.isArray(e)?`success`in e&&typeof e.success==`boolean`:!1}function a(t,n){return t instanceof e?t:t instanceof Error?new e(`unknown`,n,t):new e(`unknown`,n,Error(typeof t==`string`?t:String(t)))}export{n as KeplerNativePlatformStorageAdaptor};