PageSourceSearch

https://www.kapwing.com/assets/SafeLocalStorage-D5FbXAxu.js

js kapwing.com collected 2026-09-24 09:13:15 UTC 3,041 bytes, 5 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/amplitude-BxliWipm.js","assets/vendor-7FYv43lO.js","assets/vendor-radix-7wwiYcv7.js","assets/rolldown-runtime-BgUFPplA.js","assets/vendor-legcy4jI.css","assets/amplitude-BImStEgY.js","assets/util-CwJhy4uq.js","assets/utils-C32JQUwF.js"])))=>i.map(i=>d[i]);
2import{s}from"./rolldown-runtime-BgUFPplA.js";import{Lw as l,Mw as i}from"./vendor-7FYv43lO.js";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]="f3ac6e25-0f21-4a69-b13e-de435808bf50",e._sentryDebugIdIdentifier="sentry-dbid-f3ac6e25-0f21-4a69-b13e-de435808bf50")}catch{}{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=Object.assign({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:kapwing-app-key":!0})}var n=s(l()),d=class{storageEvictionAttempts=0;supported;constructor(){if(typeof window>"u"){this.supported=!1;return}let e;try{e=typeof localStorage}catch(t){console.error(t)}this.supported=!!e}get(e,t){if(!this.supported)return t.disabled||null;const o=localStorage.getItem(e);if(o===null)return null;try{return JSON.parse(o)}catch{return null}}set(e,t){if(!this.supported)return;const o=JSON.stringify(t);try{localStorage.setItem(e,o);return}catch(a){console.warn("localStorage.setItem failed with: ",a,"setting key",e,"with value",o,`
3trying again...`)}this.evictOldSessionsFromStorage(),this.evictOldVideoUsageKeys();try{localStorage.setItem(e,o)}catch(a){console.warn(`Failed to write ${e} in localstorage`,a)}}getAndUnset(e){const t=this.get(e,{disabled:null});return this.remove(e),t}remove(e){this.supported&&localStorage.removeItem(e)}evictOldVideoUsageKeys=(0,n.throttle)(()=>{const e=Date.now(),t=1e3*60*60*24*5;try{for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a.startsWith("video_usage_")){const r=this.get(a,{disabled:null});r&&e-r.lastUpdated>t&&this.remove(a)}}}catch{}},1e3*60*60*6,{leading:!0,trailing:!1});evictOldSessionsFromStorage(){this.storageEvictionAttempts+=1;const e=[];for(let t=0;t<localStorage.length;t+=1){const o=localStorage.key(t);o&&o.startsWith("session_")&&e.push(o)}(this.storageEvictionAttempts===1||Math.random()<.1)&&setTimeout(async()=>{const{logAmplitudeEvent:t}=await i(async()=>{const{logAmplitudeEvent:o}=await import("./amplitude-BxliWipm.js");return{logAmplitudeEvent:o}},__vite__mapDeps([0,1,2,3,4,5,6,7]));t("Localstorage Quota Exceeded",{"Cached Sessions":e.length,"Storage Size (MB)":this.getLocalStorageSizeMB(),"Eviction Attempts":this.storageEvictionAttempts})},0);for(const t of e)Math.random()<.3&&localStorage.removeItem(t)}getLocalStorageSizeMB(){return new Blob(Object.values(localStorage)).size/1e3/1e3}},u=new d;export{u as t};
4
5//# sourceMappingURL=SafeLocalStorage-D5FbXAxu.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.