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E5C,EAAO,yBAAc,GAAe,IAAK,OAAO,SAAS,QAC/D,EAAQ,QAAQ,CAAE,KAAI,K,YAO5B,EAAS,QAGT,IAAM,EAAe,eAAW,EAAS,iBAAiB,gBAK1D,EAAS,iBAAiB,WAJI,SAAe,G,4FAC3C,EAAa,MAAQ,EACrB,eAAW,G,aAKsB,oBAAxB,sBAA+D,IAAxB,qBAChD,EAAI,MAAM,CACR,SAAU,CACR,UAAS,WACP,OAAO,EAAa,K,KAM5B,EAAI,QAAQ,iBAAkB,GAG9B,OAAO,OAAO,EAAS,QAAS,CAC9B,eAAc,EACd,aAAY,IAId,EAAI,OAAO,iBAAiB,MAAQ,CACtC,C,SAEgB,UACd,IAAK,UACH,MAAM,IAAI,wBAAa,0CAGzB,OAAO,SACT,CAEA,IAAA,QAAe,CAAE,QAAO,SCzIxB,OAAe,CACb,MAAK,SAAC,EAAY,GAAlB,IAyBA,EAAA,KAzBoB,EAAM,EAAA,MAClB,EAAQ,QAAmB,MAC3B,EAAQ,UAiBd,OAhBA,mBAAc,kBAAA,UAAA,OAAA,qB,0EAEV,O,sBAAA,GAAM,EAAM,uB,cAAZ,EAAA,O,aAGA,O,YADmC,EAAM,4BAA8B,EAAM,IAAI,4BAClD,KACvB,EAAmC,EAAM,QAAvC,EAAY,EAAA,aAAE,EAAa,EAAA,eAC7B,EAAa,GAAgB,IAEjC,EAAW,GACL,MAGV,EAAM,MAAQ,EAAE,W,2BAEnB,OACM,WACL,OAAI,EAAM,MACD,MAAE,MAAO,EAAM,MAAM,CAAE,MAAO,EAAM,SAEtC,EAAM,KACf,C","file":"/npm/@okta/okta-vue@5.8.0/bundles/okta-vue.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@okta/okta-vue@5.8.0/bundles/okta-vue.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*!\n * Copyright (c) 2017-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { App, shallowRef, triggerRef, version } from 'vue'\nimport { Router, RouteLocationNormalized } from 'vue-router'\nimport { AuthSdkError, OktaAuth, AuthState, toRelativeUrl } from '@okta/okta-auth-js'\nimport { compare } from 'compare-versions';\nimport { OktaVueOptions, OnAuthRequiredFunction, OktaAuthVue } from './types'\n\n// constants are defined in webpack.config.js\ndeclare const PACKAGE: {\n  name: string;\n  version: string;\n}\n\ndeclare const AUTH_JS: {\n  minSupportedVersion: string;\n}\n\nlet _oktaAuth: OktaAuthVue\nlet _onAuthRequired: OnAuthRequiredFunction | undefined\nlet originalUriTracker: string\n\nconst guardSecureRoute = async (authState: AuthState | null) => {\n  if (authState && !authState.isAuthenticated) {\n    _oktaAuth.setOriginalUri(originalUriTracker)\n    if (_onAuthRequired) {\n      await _onAuthRequired(_oktaAuth)\n    } else {\n      await _oktaAuth.signInWithRedirect()\n    }\n  }\n}\n\nexport const navigationGuard = async (to: RouteLocationNormalized) => {\n  // clear any subscribed guardSecureRoute\n  _oktaAuth.authStateManager.unsubscribe(guardSecureRoute)\n\n  if (to.matched.some(record => record.meta.requiresAuth)) {\n    // track the originalUri for guardSecureRoute\n    originalUriTracker = to.fullPath\n\n    // subscribe to authState change to protect secure routes when authState change\n    // all secure routes should subscribe before enter the route\n    _oktaAuth.authStateManager.subscribe(guardSecureRoute)\n\n    // guard the secure route based on the authState when enter\n    const isAuthenticated = await _oktaAuth.isAuthenticated()\n    if (!isAuthenticated) {\n      const authState = _oktaAuth.authStateManager.getAuthState()\n      await guardSecureRoute(authState)\n      return false\n    }\n\n    return true\n  }\n    \n  return true\n}\n\n\nfunction install (app: App, {\n  oktaAuth,\n  onAuthRequired,\n  onAuthResume\n} = {} as OktaVueOptions) {\n  if (!oktaAuth) {\n    throw new AuthSdkError('No oktaAuth instance passed to OktaVue.')\n  }\n\n  _oktaAuth = oktaAuth\n  _onAuthRequired = onAuthRequired\n\n  if (oktaAuth._oktaUserAgent) {\n    const isAuthJsSupported = compare(oktaAuth._oktaUserAgent.getVersion(), AUTH_JS.minSupportedVersion, '>=');\n    if (!isAuthJsSupported) {\n      throw new AuthSdkError(`\n      Passed in oktaAuth is not compatible with the SDK,\n      minimum supported okta-auth-js version is ${AUTH_JS.minSupportedVersion}.\n    `);\n    }\n\n    // customize user agent\n    oktaAuth._oktaUserAgent.addEnvironment(`${PACKAGE.name}/${PACKAGE.version}`);\n  } else {\n    // TODO: just throw based on the minimum supported auth-js version in the next major version\n    console.warn('_oktaUserAgent is not available on auth SDK instance. Please use okta-auth-js@^5.3.1 .');\n  }\n\n  // add default restoreOriginalUri callback\n  if (!oktaAuth.options.restoreOriginalUri) {\n    oktaAuth.options.restoreOriginalUri = async (oktaAuth: OktaAuth, originalUri: string) => {\n      // If a router is available, provide a default implementation\n      const $router: Router = app.config.globalProperties.$router;\n      if ($router) {\n        const path = toRelativeUrl(originalUri || '/', window.location.origin);\n        $router.replace({ path })\n      }\n    }\n  }\n\n  // Calculates initial auth state and fires change event for listeners\n  // Also starts services\n  oktaAuth.start();\n\n  // Subscribe to the latest authState\n  const authStateRef = shallowRef(oktaAuth.authStateManager.getAuthState())\n  const handleAuthStateUpdate = async function(authState: AuthState) {\n    authStateRef.value = authState\n    triggerRef(authStateRef)\n  }\n  oktaAuth.authStateManager.subscribe(handleAuthStateUpdate)\n\n  // Use mixin to support Options API\n  if (typeof __VUE_OPTIONS_API__ === 'undefined' || __VUE_OPTIONS_API__ === true) {\n    app.mixin({\n      computed: {\n        authState() {\n          return authStateRef.value\n        }\n      }\n    })\n  }\n  // Provide ref to authState to support Composition API\n  app.provide('okta.authState', authStateRef)\n\n  // add additional options to oktaAuth options\n  Object.assign(oktaAuth.options, {\n    onAuthRequired,\n    onAuthResume\n  })\n\n  // add oktaAuth instance to Vue\n  app.config.globalProperties.$auth = oktaAuth\n}\n\nexport function useAuth() {\n  if (!_oktaAuth) {\n    throw new AuthSdkError('No oktaAuth instance has instantiated.')\n  }\n\n  return _oktaAuth\n}\n\nexport default { install }\n","/*!\n * Copyright (c) 2017-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n<script lang=\"ts\">\nimport { h, ref, onBeforeMount, Slot } from 'vue'\nimport { useAuth } from '../okta-vue'\n\nexport default {\n  setup(_props: {}, { slots }: { slots: { error?: Slot } }) {\n    const error = ref<string | null>(null);\n    const $auth = useAuth();\n    onBeforeMount(async () => {\n      try {\n        await $auth.handleLoginRedirect();\n      } catch (e) {\n        const isInteractionRequiredError = $auth.isInteractionRequiredError || $auth.idx.isInteractionRequiredError;\n        if (isInteractionRequiredError(e)) {\n          const { onAuthResume, onAuthRequired } = $auth.options;\n          const callbackFn = onAuthResume || onAuthRequired;\n          if (callbackFn) {\n            callbackFn($auth);\n            return;\n          }\n        }\n        error.value = e.toString();\n      }\n    });\n    return () => {\n      if (slots.error) {\n        return h('div', slots.error({ error: error.value }));\n      }\n      return error.value;\n    }\n  }\n}\n</script>\n"]}