{"version":3,"file":"LocalRedirectUrlStorage.mjs","names":["SessionStorageKey","invalidPaths","ignoredParams","storeInitialPath","window","sessionStorage","getItem","includes","params","URLSearchParams","location","search","forEach","param","delete","queryString","toString","path","pathname","setItem","storeCurrentPath","storeRedirectPath","storePath","getStoredPath","clearStoredPath","removeItem"],"sources":["../../../src/utilities/redirect/LocalRedirectUrlStorage.js"],"sourcesContent":["const SessionStorageKey = 'local-url';\n// list of paths to ignore when storing the path\nconst invalidPaths = ['/null', '/sso/entra', '/aad_callback', '/aad_redirect'];\n// list of parameters to ignore when storing the path\nconst ignoredParams = ['id_token_hint'];\n\nexport const storeInitialPath = () => {\n\n  if (\n    !window.sessionStorage.getItem(SessionStorageKey) ||\n    invalidPaths.includes(window.sessionStorage.getItem(SessionStorageKey))\n  ) {\n    const params = new URLSearchParams(window.location.search);\n    ignoredParams.forEach(param => params.delete(param));\n    const queryString = params.toString();\n    const path = window.location.pathname + (queryString ? `?${queryString}` : '');\n\n    window.sessionStorage.setItem(\n      SessionStorageKey,\n      window.location.pathname === '/null' ? '/' : path\n    );\n  }\n};\n\nexport const storeCurrentPath = () => {\n  window.sessionStorage.setItem(SessionStorageKey, window.location.pathname);\n};\n\nexport const storeRedirectPath = (pathname = window.location.pathname, search = window.location.search) => {\n  if (!pathname || invalidPaths.includes(pathname)) {\n    return;\n  }\n  const params = new URLSearchParams(search);\n  ignoredParams.forEach(param => params.delete(param));\n  const queryString = params.toString();\n  const path = pathname + (queryString ? `?${queryString}` : '');\n  window.sessionStorage.setItem(\n    SessionStorageKey,\n    pathname === '/null' ? '/' : path\n  );\n};\n\nexport const storePath = pathname => {\n  window.sessionStorage.setItem(SessionStorageKey, pathname);\n};\n\nexport const getStoredPath = () => {\n  return window.sessionStorage.getItem(SessionStorageKey);\n};\n\nexport const clearStoredPath = () => {\n  window.sessionStorage.removeItem(SessionStorageKey);\n};\n"],"mappings":";AAAA,MAAMA,oBAAoB;AAE1B,MAAMC,eAAe;CAAC;CAAS;CAAc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