UNPKG

next

Version:

The React Framework

49 lines (48 loc) 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "parseInstantNavCookieValue", { enumerable: true, get: function() { return parseInstantNavCookieValue; } }); function parseInstantNavCookieValue(raw) { try { const parsed = JSON.parse(raw); if (Array.isArray(parsed) && parsed.length >= 3) { const rawState = parsed[2]; if (rawState === null) { return { state: 'mpa' }; } // SPA capture: rawState is { from, to } if (typeof rawState === 'object' && rawState !== null) { const fromTree = rawState.from ?? [ '', {} ]; const toTree = rawState.to ?? null; return { state: 'spa', fromTree, toTree }; } return { state: 'spa', fromTree: [ '', {} ], toTree: null }; } } catch {} return { state: 'pending' }; } //# sourceMappingURL=instant-nav-cookie.js.map