{"version":3,"sources":["jsdelivr-header.js","/npm/@dintero/checkout-web-sdk@0.12.1/dist/dintero-checkout-web-sdk.esm.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,4CCJA,IAAI,EAEM,SAkDV,IAAI,EAA8B,SAAU,GAa1C,OAZA,EAAgC,gBAAI,kBACpC,EAA8B,cAAI,gBAClC,EAA+B,eAAI,iBACnC,EAA8B,cAAI,gBAClC,EAAqC,qBAAI,uBACzC,EAAyC,yBAAI,2BAC7C,EAAoC,oBAAI,sBACxC,EAA8B,cAAI,gBAClC,EAAkC,kBAAI,oBACtC,EAAyC,yBAAI,2BAC7C,EAAgC,gBAAI,kBACpC,EAAgC,gBAAI,kBAC7B,CACT,CAdkC,CAchC,IACE,EAAsC,SAAU,GAOlD,OANA,EAAsC,cAAI,gBAC1C,EAAwC,gBAAI,kBAC5C,EAAoC,YAAI,cACxC,EAAyC,iBAAI,mBAC7C,EAAyC,iBAAI,mBAC7C,EAA2C,mBAAI,qBACxC,CACT,CAR0C,CAQxC,IAQF,MAiHM,EAAmB,GAAY,EAAS,SAAS,KAAO,EAAW,GAAG,KAwBtE,EAAc,KAClB,IACE,MAAM,SACJ,GACE,OAAO,SACX,OAAO,CACX,CAAI,MAAO,GACP,MACJ,GAEM,EAAgB,KACpB,IACE,GAAI,OAAO,OAAS,OAAO,IACzB,OAAO,EAET,MAAM,EAAW,IACX,EAAc,OAAO,IAAI,SAAS,SACxC,OAAO,GAAe,GAAY,IAAa,CACnD,CAAI,MAAO,GACP,OAAO,CACX,GAEM,EA7Ce,EACnB,MACA,WACA,WACA,gCAEA,MAAM,EAAS,IAAI,gBACnB,EAAO,OAAO,KAAM,cACpB,EAAO,OAAO,OAAQ,mBACtB,EAAO,OAAO,MAAO,GACrB,EAAO,OAAO,MAAO,GACjB,GACF,EAAO,OAAO,WAAY,GAExB,GACF,EAAO,OAAO,SAAU,QAE1B,MAAM,EAAW,IAIjB,OAHI,GACF,EAAO,OAAO,eAA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4II,yBACA,8BACA,QAAS,EACT,WACA,aAAS,EACT,kBAAc,GAEhB,IAAK,MAAM,QACT,EAAO,WACP,KACG,EACC,GACF,EAAc,KAAK,EAAU,CAC3B,MACA,WACA,UACA,aACA,WACA,OAAQ,EAAS,OAAO,iBAQ9B,aAFM,IAEC,CAAQ,EAMX,EAAW,IACf,MAAM,IACJ,EAAG,SACH,EAAQ,SACR,EAAW,gCACT,EAEJ,EAAyB,EAAkB,CACzC,MACA,WACA,WACA,2BAA2B,EAC3B,2BAA2B,EAC3B,UAAU,IACT,S","file":"/npm/@dintero/checkout-web-sdk@0.12.1/dist/dintero-checkout-web-sdk.esm.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/@dintero/checkout-web-sdk@0.12.1/dist/dintero-checkout-web-sdk.esm.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import 'native-promise-only';\n\nvar pkg = {\n\tname: \"@dintero/checkout-web-sdk\",\n\tversion: \"0.12.1\",\n\tdescription: \"Dintero Checkout SDK for web frontends\",\n\tmain: \"dist/dintero-checkout-web-sdk.cjs.js\",\n\tmodule: \"dist/dintero-checkout-web-sdk.esm.js\",\n\t\"umd:main\": \"dist/dintero-checkout-web-sdk.umd.min.js\",\n\tunpkg: \"dist/dintero-checkout-web-sdk.umd.min.js\",\n\ttypes: \"dist/dintero-checkout-web-sdk.cjs.d.ts\",\n\tfiles: [\n\t\t\"dist\"\n\t],\n\tpreconstruct: {\n\t\tumdName: \"dintero\"\n\t},\n\tscripts: {\n\t\tbuild: \"yarn tsc --noEmit && preconstruct build\",\n\t\tlint: \"biome check\",\n\t\ttest: \"vitest --config .vitest.config.mts\",\n\t\t\"semantic-release\": \"semantic-release\",\n\t\tprepublishOnly: \"yarn run build\"\n\t},\n\t\"private\": false,\n\trepository: {\n\t\ttype: \"git\",\n\t\turl: \"git+https://github.com/Dintero/Dintero.Checkout.Web.SDK.git\"\n\t},\n\thomepage: \"https://github.com/Dintero/Dintero.Checkout.Web.SDK#readme\",\n\tauthor: \"Sven Nicolai Viig <sven@dintero.com> (http://dintero.com)\",\n\tlicense: \"MIT\",\n\tbugs: {\n\t\turl: \"https://github.com/Dintero/Dintero.Checkout.Web.SDK/issues\"\n\t},\n\tdevDependencies: {\n\t\t\"@babel/core\": \"7.28.6\",\n\t\t\"@babel/preset-typescript\": \"7.28.5\",\n\t\t\"@biomejs/biome\": \"2.3.13\",\n\t\t\"@preconstruct/cli\": \"2.8.12\",\n\t\t\"@semantic-release/exec\": \"7.1.0\",\n\t\t\"@semantic-release/git\": \"10.0.1\",\n\t\t\"@vitest/browser\": \"4.0.18\",\n\t\t\"@vitest/browser-webdriverio\": \"^4.0.4\",\n\t\t\"semantic-release\": \"25.0.2\",\n\t\ttypescript: \"5.9.3\",\n\t\tvitest: \"4.0.18\",\n\t\twebdriverio: \"9.23.2\"\n\t},\n\tdependencies: {\n\t\t\"native-promise-only\": \"0.8.1\"\n\t}\n};\n\nlet CheckoutEvents = /*#__PURE__*/function (CheckoutEvents) {\n  CheckoutEvents[\"SessionNotFound\"] = \"SessionNotFound\";\n  CheckoutEvents[\"SessionLoaded\"] = \"SessionLoaded\";\n  CheckoutEvents[\"SessionUpdated\"] = \"SessionUpdated\";\n  CheckoutEvents[\"SessionCancel\"] = \"SessionCancel\";\n  CheckoutEvents[\"SessionPaymentOnHold\"] = \"SessionPaymentOnHold\";\n  CheckoutEvents[\"SessionPaymentAuthorized\"] = \"SessionPaymentAuthorized\";\n  CheckoutEvents[\"SessionPaymentError\"] = \"SessionPaymentError\";\n  CheckoutEvents[\"SessionLocked\"] = \"SessionLocked\";\n  CheckoutEvents[\"SessionLockFailed\"] = \"SessionLockFailed\";\n  CheckoutEvents[\"ActivePaymentProductType\"] = \"ActivePaymentProductType\";\n  CheckoutEvents[\"ValidateSession\"] = \"ValidateSession\";\n  CheckoutEvents[\"AddressCallback\"] = \"AddressCallback\";\n  return CheckoutEvents;\n}({});\nlet InternalCheckoutEvents = /*#__PURE__*/function (InternalCheckoutEvents) {\n  InternalCheckoutEvents[\"HeightChanged\"] = \"HeightChanged\";\n  InternalCheckoutEvents[\"LanguageChanged\"] = \"LanguageChanged\";\n  InternalCheckoutEvents[\"ScrollToTop\"] = \"ScrollToTop\";\n  InternalCheckoutEvents[\"ShowPopOutButton\"] = \"ShowPopOutButton\";\n  InternalCheckoutEvents[\"HidePopOutButton\"] = \"HidePopOutButton\";\n  InternalCheckoutEvents[\"TopLevelNavigation\"] = \"TopLevelNavigation\";\n  return InternalCheckoutEvents;\n}({});\n\n/**\n * Creates an iframe and adds it to the container.\n *\n * Returns a promise that resolves to the iframe when the iframe has loaded.\n * Rejects the promise if there is a problem loading the iframe.\n */\nconst createIframeAsync = (container, url) => {\n  if (!container || !container.appendChild) {\n    throw new Error(\"Invalid container\");\n  }\n  const iframe = document.createElement(\"iframe\");\n\n  // No border, transparent and stretch to 100% of the container width.\n  iframe.setAttribute(\"frameborder\", \"0\");\n  iframe.setAttribute(\"allowTransparency\", \"true\");\n  iframe.setAttribute(\"style\", \"width:100%; height:0;\");\n\n  // TODO: Get this to work as expected, might be tricky with current\n  // tests since they will require the csp to be \"unsafe-inline\".\n  // The server needs to add the same property in the Content Security\n  // Policy headers in the response for this to work. A CSP header set by\n  //  a meta tag in the iframe target will not be detected as a valid\n  // CSP from the iframe host.\n  // Content Security Policy, should be limited to \"endpoint\".\n  // iframe.setAttribute(\"csp\", `default-src  ${endpoint}`);\n\n  // Apply extra restrictions to the content in the iframe.\n  // allow popups is needed to open terms in new window\n  iframe.setAttribute(\"sandbox\", \"allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation\");\n\n  // Needed for to allow apple pay from iframe\n  iframe.setAttribute(\"allow\", \"payment; clipboard-write *\");\n\n  // The download priority of the resource in the <iframe>'s src attribute.\n  iframe.setAttribute(\"importance\", \"high\");\n\n  // Set the iframe source to the url.\n  iframe.setAttribute(\"src\", url);\n\n  // Resolve or reject promise when iframe loads.\n\n  // // Add iframe to the container.\n  // container.appendChild(iframe);\n  return {\n    iframe,\n    initiate: async () => {\n      return new Promise((resolve, reject) => {\n        iframe.onload = () => resolve();\n        iframe.onerror = () => reject();\n        container.appendChild(iframe);\n      });\n    }\n  };\n};\n\n/**\n * Wraps window.location.assign()\n */\nconst windowLocationAssign = url => {\n  window.location.assign(url);\n};\n\n/**\n * Get the url for the session\n */\n\nconst getSessionUrl = options => {\n  const {\n    sid,\n    endpoint,\n    language,\n    ui,\n    shouldCallValidateSession,\n    shouldCallAddressCallback,\n    popOut,\n    redirect\n  } = options;\n  if (!endpoint) {\n    throw new Error(\"Invalid endpoint\");\n  }\n  const params = new URLSearchParams();\n  params.append(\"sdk\", pkg.version);\n  if (ui) {\n    params.append(\"ui\", ui);\n  }\n  if (language) {\n    params.append(\"language\", language);\n  }\n  if (shouldCallValidateSession) {\n    params.append(\"client_side_validation\", \"true\");\n  }\n  if (shouldCallAddressCallback) {\n    params.append(\"client_side_address_callback\", \"true\");\n  }\n  if (popOut) {\n    params.append(\"role\", \"pop_out_launcher\");\n  }\n  if (\n  // biome-ignore lint/suspicious/noPrototypeBuiltins: test\n  options.hasOwnProperty(\"hideTestMessage\") && options.hideTestMessage !== undefined && options.hideTestMessage === true) {\n    params.append(\"hide_test_message\", \"true\");\n  }\n  const hostname = getHostname();\n  if (hostname) {\n    params.append(\"sdk_hostname\", hostname);\n  }\n  if (!redirect && !hostnameIsTop()) {\n    params.append(\"sdk_not_top_level\", \"true\");\n  }\n  if (endpoint === \"https://checkout.dintero.com\") {\n    // Default endpoint will redirect via the view endpoint\n    return `${endpoint}/v1/view/${sid}?${params.toString()}`;\n  }\n  // When a custom endpoint is set skip the view redirect endpoint since\n  // custom endpoints like localhost and PR builds does not support the\n  // serverside view flow.\n  params.append(\"sid\", sid);\n  return `${padTrailingSlash(endpoint)}?${params.toString()}`;\n};\nconst padTrailingSlash = endpoint => endpoint.endsWith(\"/\") ? endpoint : `${endpoint}/`;\nconst getPopOutUrl = ({\n  sid,\n  endpoint,\n  language,\n  shouldCallValidateSession\n}) => {\n  const params = new URLSearchParams();\n  params.append(\"ui\", \"fullscreen\");\n  params.append(\"role\", \"pop_out_payment\");\n  params.append(\"sid\", sid);\n  params.append(\"sdk\", pkg.version);\n  if (language) {\n    params.append(\"language\", language);\n  }\n  if (shouldCallValidateSession) {\n    params.append(\"loader\", \"true\");\n  }\n  const hostname = getHostname();\n  if (hostname) {\n    params.append(\"sdk_hostname\", hostname);\n  }\n  return `${padTrailingSlash(endpoint)}?${params.toString()}`;\n};\nconst getHostname = () => {\n  try {\n    const {\n      hostname\n    } = window.location;\n    return hostname;\n  } catch (_) {\n    return undefined;\n  }\n};\nconst hostnameIsTop = () => {\n  try {\n    if (window.self === window.top) {\n      return true;\n    }\n    const hostname = getHostname();\n    const topHostname = window.top.location.hostname;\n    return topHostname && hostname && hostname === topHostname;\n  } catch (_) {\n    return false;\n  }\n};\nconst url = {\n  getPopOutUrl,\n  getSessionUrl,\n  windowLocationAssign\n};\n\nconst createPopOutWindow = (sid, url, width, height) => {\n  return new Promise(resolve => {\n    try {\n      // Creates a centered pop up window\n      const left = window.screenX + (window.outerWidth - width) / 2;\n      const top = window.screenY + (window.outerHeight - height) / 2;\n      const features = `width=${width},height=${height},left=${left},top=${top},location=no,menubar=no,toolbar=no,status=no`;\n      let popOut;\n      let timeout = -1;\n      // Set up listener for application loaded message from pop out window\n      const handleAppLoaded = event => {\n        const correctSource = event.source === popOut;\n        const correctOrigin = event.origin === new URL(url).origin;\n        const correctMessage = event.data && event.data.type === \"AppLoaded\";\n        const correctContext = event.data.context === \"popOut\";\n        const correctSid = event.data.sid === sid;\n        if (correctSource && correctOrigin && correctMessage && correctContext && correctSid) {\n          clearTimeout(timeout);\n          resolve(popOut);\n          window.removeEventListener(\"message\", handleAppLoaded);\n        }\n      };\n      window.addEventListener(\"message\", handleAppLoaded);\n      // Open pop out\n      popOut = window.open(url, \"dintero-checkout\", features);\n      // Check that pop out was opened\n      if (!popOut) {\n        console.log(\"createPopOutWindow no popOut\");\n        resolve(undefined);\n        return;\n      }\n      // Trigger timeout if pop out is not loaded\n      timeout = window.setTimeout(() => {\n        console.log(\"createPopOutWindow timeout\");\n        resolve(undefined);\n      }, 10000);\n    } catch (_err) {\n      resolve(undefined);\n    }\n  });\n};\nconst openPopOut = async options => {\n  let unsubscribe;\n  let intervalId = -1;\n  let popOutWindow;\n  if (popOutWindow && !popOutWindow.closed) {\n    // Skip if already open.\n    return;\n  }\n\n  // Open popup window\n  const popOutUrl = url.getPopOutUrl(options);\n  popOutWindow = await createPopOutWindow(options.sid, popOutUrl, Math.min(480, window.screen.width), Math.min(840, window.screen.height));\n  const focusPopOut = () => {\n    if (popOutWindow) {\n      popOutWindow.focus();\n    }\n  };\n  const cleanUpClosed = () => {\n    window.clearInterval(intervalId);\n    intervalId = -1;\n    window.removeEventListener(\"beforeunload\", closePopOut);\n    popOutWindow = undefined;\n    options.onClose();\n    if (unsubscribe) {\n      unsubscribe();\n    }\n  };\n  const closePopOut = () => {\n    if (popOutWindow) {\n      popOutWindow.close();\n    }\n    cleanUpClosed();\n  };\n  const checkIfPopupClosed = () => {\n    if (popOutWindow?.closed) {\n      cleanUpClosed();\n    }\n  };\n\n  // Close pop out if current window is closed\n  window.addEventListener(\"beforeunload\", closePopOut);\n\n  // Check if checkout is still open\n  intervalId = window.setInterval(checkIfPopupClosed, 200);\n\n  // Set up pub/sub of messages from pop out to SDK\n  unsubscribe = options.onOpen(popOutWindow);\n  return {\n    close: closePopOut,\n    focus: focusPopOut,\n    popOutWindow\n  };\n};\nconst postPopOutSessionLock = (popOutWindow, sid) => {\n  try {\n    if (popOutWindow) {\n      popOutWindow.postMessage({\n        type: \"LockSession\",\n        sid\n      }, \"*\");\n    }\n  } catch (e) {\n    console.error(e);\n  }\n};\nconst postPopOutSessionRefresh = (popOutWindow, sid) => {\n  try {\n    if (popOutWindow) {\n      popOutWindow.postMessage({\n        type: \"RefreshSession\",\n        sid\n      }, \"*\");\n    }\n  } catch (e) {\n    console.error(e);\n  }\n};\nconst postPopOutActivePaymentProductType = (popOutWindow, sid, paymentProductType) => {\n  try {\n    if (popOutWindow) {\n      popOutWindow.postMessage({\n        type: \"SetActivePaymentProductType\",\n        sid,\n        payment_product_type: paymentProductType\n      }, \"*\");\n    }\n  } catch (e) {\n    console.error(e);\n  }\n};\nconst popOutModule = {\n  openPopOut,\n  postPopOutSessionLock,\n  postPopOutSessionRefresh,\n  postPopOutActivePaymentProductType\n};\n\nconst getBackdropZIndex = () => {\n  // Iterate all DOM items to get current highest element.\n  const elements = document.getElementsByTagName(\"*\");\n  const highest = Array.from(elements).reduce((acc, element) => {\n    try {\n      const zIndexStr = document.defaultView.getComputedStyle(element, null).getPropertyValue(\"z-index\");\n      const zIndex = Number.parseInt(zIndexStr || \"0\", 10);\n      if (!Number.isNaN(zIndex) && zIndex > acc) {\n        return zIndex;\n      }\n    } catch (e) {\n      // Ignore errors when getting z-index\n      console.error(e);\n    }\n    return acc;\n  }, 0);\n  if (highest < 9999) {\n    return \"9999\";\n  }\n  return (highest + 1).toString();\n};\nconst STYLE_ID = \"dintero-checkout-sdk-style\";\nconst BACKDROP_ID = \"dintero-checkout-sdk-backdrop\";\nconst BACKDROP_DESCRIPTION = \"dintero-checkout-sdk-backdrop-description\";\nconst FOCUS_CHECKOUT_BUTTON_ID = \"dintero-checkout-sdk-backdrop-focus\";\nconst CLOSE_BACKDROP_BUTTON_ID = \"dintero-checkout-sdk-backdrop-close\";\nconst wrapPreventDefault = fn => {\n  // Creates a wrapped function that will invoke preventDefault() to stop\n  // the event from bubbling up the DOM tree.\n  return e => {\n    e.preventDefault();\n    e.stopPropagation();\n    fn();\n    return false;\n  };\n};\nconst appendBackdropStyles = () => {\n  // Check if exists before appending to DOM\n  if (document.getElementById(STYLE_ID)) {\n    return;\n  }\n  // Add style to DOM\n  const style = document.createElement(\"style\");\n  style.setAttribute(\"id\", STYLE_ID);\n  style.innerHTML = `\n        @keyframes ${BACKDROP_ID}-fade-in {\n            from {opacity: 0;}\n            to {opacity: 1;}\n        }\n\n        #${BACKDROP_ID} {\n            position: fixed;\n            top: 0;\n            bottom: 0;\n            left: 0;\n            right: 0;\n            height: 100vh;\n            width: 100vw;\n            background-color: rgba(0,0,0,0.9);\n            background: radial-gradient(rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.8) 100%);\n            cursor: pointer;\n            animation:  20ms ease-out ${BACKDROP_ID}-fade-in;\n            display: flex;\n            flex-direction: column;\n            justify-content: center;\n            align-items: center;\n            gap: 20px;\n            color: #ffffff;\n            font-family:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n            font-size: 18px;\n            font-weight: 400;\n            line-height: normal;\n            text-rendering: geometricPrecision;\n            margin: 0;\n            padding: 0;\n            border: 0;\n            vertical-align: baseline;\n            line-height: normal;\n        }\n\n        #${BACKDROP_ID} p {\n            padding: 0;\n            margin: 0;\n            border: 0;\n            user-select: none;\n        }\n\n        #${FOCUS_CHECKOUT_BUTTON_ID} {\n            background-color: #efefef !important;\n            color: #000000 !important;\n            font-size: 16px !important;\n            font-weight: 600 !important;\n            border-radius: 200px !important;\n            margin: 0 !important;\n            line-height: normal !important;\n            border: none !important;\n            padding: 10px 20px !important;\n            user-select: none !important;\n            cursor: pointer !important;\n        }\n        #${FOCUS_CHECKOUT_BUTTON_ID}:hover,\n        #${FOCUS_CHECKOUT_BUTTON_ID}:focus {\n            outline: none !important;\n            background-color: #ffffff !important;\n            border: none !important;\n            color: #000000 !important;\n            padding: 10px 20px !important;\n            margin: 0 !important;\n        }\n        #${FOCUS_CHECKOUT_BUTTON_ID}:focus{\n            outline-offset: 2px;\n            outline: 1px #ffffff solid !important;\n        }\n\n        #${CLOSE_BACKDROP_BUTTON_ID} {\n            background: transparent !important;\n            padding: 0 !important;\n            margin: 0 !important;\n            border: none !important;\n            border-radius: 4px !important;\n            height: 24px !important;\n            width: 24px !important;\n            color: #efefef !important;\n            position: absolute !important;\n            top: 16px !important;\n            right: 24px !important;\n            transition: all 200ms ease-out !important;\n            cursor: pointer !important;\n        }\n\n        #${CLOSE_BACKDROP_BUTTON_ID}:hover,\n        #${CLOSE_BACKDROP_BUTTON_ID}:focus {\n            outline: none !important;\n            color: #ffffff !important;\n            border: none !important;\n            background: transparent !important;\n            padding: 0 !important;\n            margin: 0 !important;\n            position: absolute;\n            top: 16px;\n            right: 24px;\n        }\n        #${CLOSE_BACKDROP_BUTTON_ID}:focus{\n            outline: 1px #ffffff solid !important;\n        }\n\n        #${BACKDROP_ID}:before,\n        #${BACKDROP_ID}:after,\n        #${BACKDROP_ID} > *:before,\n        #${BACKDROP_ID} > *:after {\n            content: '';\n            content: none;\n        }\n    `;\n  document.head.appendChild(style);\n};\nconst createBackdropDOM = () => {\n  // Dark translucent backdrop element\n  const backdrop = document.createElement(\"div\");\n  backdrop.setAttribute(\"id\", BACKDROP_ID);\n  backdrop.setAttribute(\"role\", \"dialog\");\n  backdrop.style.zIndex = getBackdropZIndex();\n  return backdrop;\n};\nconst createCloseButtonDOM = label => {\n  // Close button for the top right corner\n  const button = document.createElement(\"button\");\n  button.setAttribute(\"id\", CLOSE_BACKDROP_BUTTON_ID);\n  button.setAttribute(\"type\", \"button\");\n  button.setAttribute(\"aria-label\", label);\n  button.innerHTML = `\n        <svg\n            xmlns=\"http://www.w3.org/2000/svg\"\n            width=\"24\"\n            height=\"24\"\n            viewBox=\"0 0 24 24\"\n            fill=\"none\"\n            stroke=\"currentColor\"\n            stroke-width=\"2\"\n            stroke-linecap=\"round\"\n            stroke-linejoin=\"round\"\n            alt=\"close icon\"\n        >\n            <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n            <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n        </svg>`;\n  return button;\n};\nconst createDinteroLogoDOM = () => {\n  // Close button for the top right corner\n  const div = document.createElement(\"div\");\n  div.innerHTML = `\n        <svg width=\"120px\" height=\"22px\" viewBox=\"0 0 630 111\" version=\"1.1\" >\n            <g id=\"Page-1\" stroke=\"none\" strokeWidth=\"1\" fill=\"none\" fillRule=\"evenodd\">\n                <g id=\"Dintero\" fill=\"#ffffff\" fillRule=\"nonzero\">\n                    <path d=\"M376.23,60.48 L376.23,73.54 L454.13,73.54 C456.31,41.55 435.85,23.71 410.61,23.71 C385.37,23.71 367.09,41.77 367.09,66.79 C367.09,92.03 386.02,110.31 411.91,110.31 C433.02,110.31 448.9,97.25 453.25,82.24 L436.5,82.24 C432.37,89.42 423.88,95.51 411.91,95.51 C395.16,95.51 382.75,83.11 382.75,66.79 C382.75,50.69 394.72,38.5 410.6,38.5 C426.48,38.5 438.45,50.68 438.45,66.79 L444.54,60.48 L376.23,60.48 Z M154.29,17.83 L171.7,17.83 L171.7,0.42 L154.29,0.42 L154.29,17.83 Z M120.34,108.13 L191.27,108.13 L191.27,93.77 L120.34,93.77 L120.34,108.13 Z M156.46,40.24 L156.46,108.13 L171.69,108.13 L171.69,45.47 C171.69,32.85 165.82,25.89 151.89,25.89 L120.34,25.89 L120.34,40.25 L156.46,40.25 L156.46,40.24 Z M499.17,25.88 L464.36,25.88 L464.36,40.24 L483.94,40.24 L484.16,108.13 L499.39,108.13 L499.17,62.44 C499.17,48.51 508.53,40.25 521.58,40.25 L535.29,40.25 L535.29,25.89 L524.41,25.89 C509.18,25.89 501.78,31.33 497.65,41.56 L495.47,47 L499.17,47.65 L499.17,25.88 Z M288.76,25.88 L310.52,25.88 L310.52,6.3 L325.75,6.3 L325.75,25.88 L359.69,25.88 L359.69,40.24 L325.75,40.24 L325.75,93.77 L359.69,93.77 L359.69,108.13 L332.49,108.13 C318.56,108.13 310.51,98.99 310.51,86.37 L310.51,40.24 L288.75,40.24 L288.75,25.88 L288.76,25.88 Z M464.35,108.13 L535.28,108.13 L535.28,93.77 L464.35,93.77 L464.35,108.13 Z M108.6,54.17 C108.6,23.06 85.54,0.43 53.77,0.43 L0.9,0.43 L0.9,108.14 L53.77,108.14 C85.53,108.13 108.6,85.5 108.6,54.17 M248.07,23.71 C234.58,23.71 223.92,31.98 220,41.55 L220,25.88 L204.77,25.88 L204.77,108.13 L220,108.13 L220,66.35 C220,53.08 224.79,38.93 243.72,38.93 C259.39,38.93 267.44,48.07 267.44,67.43 L267.44,108.12 L282.67,108.12 L282.67,64.6 C282.67,35.02 265.91,23.71 248.07,23.71 M586.2,110.31 C611.22,110.31 629.72,92.03 629.72,67.01 C629.72,41.99 611.23,23.71 586.2,23.71 C560.96,23.71 542.68,41.99 542.68,67.01 C542.68,92.03 560.96,110.31 586.2,110.31 M586.2,95.51 C570.32,95.51 558.35,83.33 558.35,67.01 C558.35,50.69 570.32,38.51 586.2,38.51 C602.08,38.51 614.05,50.69 614.05,67.01 C614.05,83.33 602.08,95.51 586.2,95.51 M16.99,92.9 L16.99,15.66 L51.8,15.66 C75.3,15.66 92.05,31.98 92.05,54.61 C92.05,76.8 75.3,92.91 51.8,92.91 L16.99,92.91 L16.99,92.9 Z\" id=\"Shape\"></path>\n                </g>\n            </g>\n        </svg>`;\n  return div;\n};\nconst createLabelDOM = text => {\n  // Text about the pop out\n  const p = document.createElement(\"p\");\n  p.setAttribute(\"id\", BACKDROP_DESCRIPTION);\n  p.innerText = text;\n  return p;\n};\nconst createFocusButtonDOM = text => {\n  // Mock button to give the user a call to action element to click, even\n  // though the entire backdrop (except the close button) returns focus to the\n  // checkout.\n  const button = document.createElement(\"button\");\n  button.setAttribute(\"id\", FOCUS_CHECKOUT_BUTTON_ID);\n  button.setAttribute(\"type\", \"button\");\n  button.innerText = text;\n  return button;\n};\nconst focusTrap = e => {\n  // Prevent the user focusing outside of the backdrop while it is visible\n  const focusButton = document.getElementById(FOCUS_CHECKOUT_BUTTON_ID);\n  const closeButton = document.getElementById(CLOSE_BACKDROP_BUTTON_ID);\n  if (e.key === \"Tab\" || e.code === \"Tab\") {\n    if (document.activeElement === focusButton) {\n      closeButton.focus();\n      e.preventDefault();\n    } else {\n      // Tab\n      focusButton.focus();\n      e.preventDefault();\n    }\n  }\n};\nconst createBackdropView = options => {\n  // Add styles needed for the backdrop;\n  appendBackdropStyles();\n  // Create DOM nodes\n  const backdrop = createBackdropDOM();\n  const closeButton = createCloseButtonDOM(options.event.closeLabel);\n  const dinteroLogo = createDinteroLogoDOM();\n  const label = createLabelDOM(options.event.descriptionLabel);\n  const focusButton = createFocusButtonDOM(options.event.focusLabel);\n\n  // Add click handlers\n  backdrop.onclick = wrapPreventDefault(options.focus);\n  focusButton.onclick = wrapPreventDefault(options.focus);\n  closeButton.onclick = wrapPreventDefault(options.close);\n\n  // Add focus trap when backdrop is visible\n  document.addEventListener(\"keydown\", focusTrap);\n\n  // Append to document\n  backdrop.appendChild(closeButton);\n  backdrop.appendChild(dinteroLogo);\n  backdrop.appendChild(label);\n  backdrop.appendChild(focusButton);\n  document.body.appendChild(backdrop);\n  backdrop.focus();\n  return backdrop;\n};\nconst setBackdropLabels = event => {\n  const focusButton = document.getElementById(FOCUS_CHECKOUT_BUTTON_ID);\n  if (focusButton) {\n    focusButton.innerText = event.focusLabel;\n  }\n  const description = document.getElementById(BACKDROP_DESCRIPTION);\n  if (description) {\n    description.innerText = event.descriptionLabel;\n  }\n  const closeButton = document.getElementById(CLOSE_BACKDROP_BUTTON_ID);\n  if (closeButton) {\n    closeButton.setAttribute(\"aria-label\", event.descriptionLabel);\n  }\n};\nconst createBackdrop = options => {\n  try {\n    // Check if backdrop already exists\n    const backdrop = document.getElementById(BACKDROP_ID);\n    if (backdrop) {\n      return;\n    }\n    return createBackdropView(options);\n  } catch (e) {\n    // Ignore errors when creating backdrop. If it fails we should not\n    // block the payment.\n    console.error(e);\n  }\n};\nconst removeBackdrop = () => {\n  try {\n    const backdrop = document.getElementById(BACKDROP_ID);\n    if (backdrop) {\n      document.body.removeChild(backdrop);\n    }\n    document.removeEventListener(\"keydown\", focusTrap);\n  } catch (e) {\n    // Ignore errors when closing backdrop. If it fails we should not stop\n    // the rest of the application from working.\n    console.error(e);\n  }\n};\n\nconst OPEN_POP_OUT_BUTTON_ID = \"dintero-checkout-sdk-launch-pop-out\";\nconst configureButton = (button, {\n  label,\n  disabled,\n  top,\n  left,\n  right,\n  styles,\n  onClick,\n  stylesHover,\n  stylesFocusVisible\n}) => {\n  button.setAttribute(\"id\", OPEN_POP_OUT_BUTTON_ID);\n  button.setAttribute(\"type\", \"button\");\n\n  // Is clickable\n  if (disabled === \"true\") {\n    button.setAttribute(\"disabled\", disabled);\n  } else {\n    button.removeAttribute(\"disabled\");\n  }\n\n  // Click handler\n  button.onclick = event => {\n    // Do not submit any form on the page using the SDK\n    event.preventDefault();\n    event.stopPropagation();\n\n    // Update look\n    button.style.boxShadow = \"inset 0 0 10px rgba(34, 84, 65, 0.9)\";\n\n    // Invoke handler\n    onClick();\n\n    // Reset look\n    window.setTimeout(() => {\n      button.style.boxShadow = \"none\";\n    }, 200);\n  };\n\n  // Label\n  button.innerText = label;\n\n  // Position\n  button.style.position = \"absolute\";\n  button.style.top = `${top}px`;\n  button.style.left = `${left}px`;\n  button.style.right = `${right}px`;\n\n  // Appearance from checkout\n  const {\n    ...directStyles\n  } = styles;\n  for (const [key, value] of Object.entries(directStyles)) {\n    button.style[key] = value;\n  }\n\n  // Add hover and focus-visible styles\n  try {\n    addHoverAndFocusVisibleStyles(stylesHover, stylesFocusVisible);\n  } catch (e) {\n    console.error(e);\n  }\n};\nconst addHoverAndFocusVisibleStyles = (stylesHover, stylesFocusVisible) => {\n  if (!stylesHover && !stylesFocusVisible) {\n    return;\n  }\n  const styleId = `${OPEN_POP_OUT_BUTTON_ID}-styles`;\n  const hasStyles = document.getElementById(styleId);\n  if (hasStyles) {\n    return;\n  }\n  const style = document.createElement(\"style\");\n  style.setAttribute(\"id\", styleId);\n  const content = [];\n  if (stylesHover) {\n    content.push(toCssEntity(`#${OPEN_POP_OUT_BUTTON_ID}:hover:not(:disabled)`, stylesHover));\n  }\n  if (stylesFocusVisible) {\n    content.push(toCssEntity(`#${OPEN_POP_OUT_BUTTON_ID}:focus-visible`, stylesFocusVisible));\n  }\n  style.textContent = content.join(\"\\n\");\n  document.head.appendChild(style);\n};\nconst toCssEntity = (selector, keyValues) => {\n  return [`${selector} {`, toCssParameters(keyValues), `}`].join(\"\\n\");\n};\nconst toCssParameters = keyValues => {\n  return Object.entries(keyValues).map(([key, value]) => `    ${slugify(key)}: ${value} !important;`).join(\"\\n\");\n};\nconst slugify = str => {\n  return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n};\nconst addPopOutButton = options => {\n  // Will add or update existing button\n  const {\n    container\n  } = options;\n  const exists = document.getElementById(OPEN_POP_OUT_BUTTON_ID);\n  const button = exists || document.createElement(\"button\");\n  configureButton(button, options);\n  if (!exists) {\n    container.appendChild(button);\n  }\n};\nconst setPopOutButtonDisabled = disabled => {\n  try {\n    const button = document.getElementById(OPEN_POP_OUT_BUTTON_ID);\n    if (button) {\n      if (disabled) {\n        button.setAttribute(\"disabled\", disabled.toString());\n      } else {\n        button.removeAttribute(\"disabled\");\n      }\n    }\n  } catch (e) {\n    // Ignore error and continue\n    console.error(e);\n  }\n};\nconst removePopOutButton = () => {\n  try {\n    const button = document.getElementById(OPEN_POP_OUT_BUTTON_ID);\n    if (button) {\n      button.remove();\n    }\n  } catch (e) {\n    // Ignore error and continue\n    console.error(e);\n  }\n};\n\n/**\n * Unsubscribe handler from event(s).\n */\n\n/**\n * Post a message acknowledgement to the checkout iframe.\n */\nconst postAck = (source, event) => {\n  if (event.data.mid && source) {\n    source.postMessage({\n      ack: event.data.mid\n    }, event.origin || \"*\");\n  }\n};\n\n/**\n * Post a SessionLock-event to the checkout iframe.\n */\nconst postSessionLock = (iframe, sid) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"LockSession\",\n      sid\n    }, \"*\");\n  }\n};\n\n/**\n * Post the validation result to the checkout iframe\n */\nconst postValidationResult = (iframe, sid, result) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"ValidationResult\",\n      sid,\n      ...result\n    }, \"*\");\n  }\n};\n\n/**\n * Post the address call back result to the checkout iframe\n */\nconst postAddressCallbackResult = (iframe, sid, result) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"AddressCallbackResult\",\n      sid,\n      ...result\n    }, \"*\");\n  }\n};\n\n/**\n * Post RefreshSession-event to the checkout iframe.\n */\nconst postSessionRefresh = (iframe, sid) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"RefreshSession\",\n      sid\n    }, \"*\");\n  }\n};\n\n/**\n * Post SetActivePaymentProductType-event to the checkout iframe.\n */\nconst postActivePaymentProductType = (iframe, sid, paymentProductType) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"SetActivePaymentProductType\",\n      sid,\n      payment_product_type: paymentProductType\n    }, \"*\");\n  }\n};\n\n/**\n * Post ClosePopOut-event to the checkout iframe.\n */\nconst postValidatePopOutEvent = (iframe, sid) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"ValidatingPopOut\",\n      sid\n    }, \"*\");\n  }\n};\n\n/**\n * Post OpenPopOutFailed-event to the checkout iframe.\n */\nconst postOpenPopOutFailedEvent = (iframe, sid) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"OpenPopOutFailed\",\n      sid\n    }, \"*\");\n  }\n};\n\n/**\n * Post OpenedPopOut-event to the checkout iframe.\n */\nconst postOpenPopOutEvent = (iframe, sid) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"OpenedPopOut\",\n      sid\n    }, \"*\");\n  }\n};\n\n/**\n * Post ClosePopOut-event to the checkout iframe.\n */\nconst postClosePopOutEvent = (iframe, sid) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"ClosedPopOut\",\n      sid\n    }, \"*\");\n  }\n};\n\n/**\n * Post SetLanguage-event to the checkout iframe.\n */\nconst postSetLanguage = (iframe, sid, language) => {\n  if (iframe.contentWindow) {\n    iframe.contentWindow.postMessage({\n      type: \"SetLanguage\",\n      sid,\n      language\n    }, \"*\");\n  }\n};\n\n/**\n * Subscribe to events from an iframe given a handler and a set\n * of event types.\n */\nconst subscribe = options => {\n  const {\n    sid,\n    endpoint,\n    handler,\n    eventTypes,\n    checkout\n  } = options;\n\n  // Wrap event handler in a function that checks for correct origin and\n  // filters on event type(s) in the event data.\n  const endpointUrl = new URL(endpoint);\n  const wrappedHandler = event => {\n    const correctOrigin = event.origin === endpointUrl.origin;\n    const correctWindow = event.source === checkout.iframe.contentWindow;\n    const correctSid = event.data && event.data.sid === sid;\n    const correctMessageType = eventTypes.indexOf(event.data?.type) !== -1;\n    if (correctOrigin && correctWindow && correctSid && correctMessageType) {\n      postAck(checkout.iframe.contentWindow, event);\n      handler(event.data, checkout);\n    }\n  };\n\n  // Add event listener to the iframe.\n  window.addEventListener(\"message\", wrappedHandler, false);\n\n  // Function to remove the event listener from the iframe.\n  const unsubscribe = () => {\n    window.removeEventListener(\"message\", wrappedHandler, false);\n  };\n\n  // Return object with unsubscribe function.\n  return {\n    unsubscribe\n  };\n};\n\n/**\n * An event handler that navigates to the href in the event.\n */\nconst followHref = (event, checkout) => {\n  cleanUpPopOut(checkout);\n  if (event.href) {\n    url.windowLocationAssign(event.href);\n  }\n};\n\n/**\n * An event handler that sets height of the iframe.\n */\nconst setIframeHeight = (event, checkout) => {\n  if (event.height || event.height === 0) {\n    checkout.iframe.setAttribute(\"style\", `width:100%; height:${event.height}px;`);\n  }\n};\n\n/**\n * An event handler that scrolls to the top of the iframe. This is useful when the user\n * is navigated to another page.\n */\nconst scrollToIframeTop = (_event, checkout) => {\n  try {\n    checkout.iframe.scrollIntoView({\n      block: \"start\",\n      behavior: \"smooth\"\n    });\n  } catch (e) {\n    // Ignore error silently bug log it to the console.\n    console.error(e);\n  }\n};\n\n/**\n * An event handler that sets language in the iframe.\n */\nconst setLanguage = (event, checkout) => {\n  if (event.language) {\n    checkout.language = event.language;\n  }\n};\n\n/**\n * Wrap function with try catch so an error in a single function won't short circuit other code in the current context.\n */\nconst safelyInvoke = fn => {\n  try {\n    fn();\n  } catch (e) {\n    console.error(e);\n  }\n};\n\n/**\n *  Handle messages sendt to the SDK from the pop out.\n */\nconst createPopOutMessageHandler = (source, checkout) => {\n  // Change language in embed if changed in pop out\n  const popOutChangedLanguageHandler = {\n    internalPopOutHandler: true,\n    eventTypes: [InternalCheckoutEvents.LanguageChanged],\n    handler: (eventData, checkout) => {\n      // Tell the embedded checkout to change language.\n      postSetLanguage(checkout.iframe, checkout.options.sid, eventData.language);\n    }\n  };\n\n  // Close pop out, and remove SDK rendered button when payment is completed.\n  const paymentCompletedEvents = [CheckoutEvents.SessionCancel, CheckoutEvents.SessionPaymentOnHold, CheckoutEvents.SessionPaymentAuthorized, CheckoutEvents.SessionPaymentError];\n  const popOutCompletedHandler = {\n    internalPopOutHandler: true,\n    eventTypes: paymentCompletedEvents,\n    handler: (eventData, _checkout) => {\n      if (eventData.href) {\n        // Remove open pop out button rendered by SDK\n        removePopOutButton();\n\n        // Close checkout\n        try {\n          source.close();\n        } catch (e) {\n          console.error(e);\n        }\n      } else {\n        console.error(\"Payment Complete event missing href property\");\n      }\n    }\n  };\n\n  // Listens to messages from pop out window and routes the events to dedicated handlers\n  const messageRouter = event => {\n    // Check that we should handle the message\n    if (event.source === source && event.data.context === \"popOut\" && event.data.sid === checkout.options.sid) {\n      // Check if handler matches incoming event and trigger the handler if so.\n      for (const handlerObject of [\n      // SDK events for managing the pop out flow.\n      popOutChangedLanguageHandler, popOutCompletedHandler,\n      // Events configured when the checkout was embedded.\n      ...checkout.handlers]) {\n        if (handlerObject.eventTypes.includes(event.data.type) && handlerObject.handler) {\n          // Invoking the handler function if the event type matches the handler.\n          safelyInvoke(() => {\n            handlerObject.handler(event.data, checkout);\n          });\n        }\n      }\n    }\n  };\n  // Add messageRouter event listener to the Pop Out\n  window.addEventListener(\"message\", messageRouter);\n\n  // Return unsubscribe function\n  return () => {\n    window.removeEventListener(\"message\", messageRouter);\n  };\n};\n\n/**\n * Configures and shows the pop out with the payment options.\n */\nconst showPopOut = async (event, checkout) => {\n  const {\n    close,\n    focus,\n    popOutWindow\n  } = await popOutModule.openPopOut({\n    sid: checkout.options.sid,\n    endpoint: checkout.options.endpoint,\n    shouldCallValidateSession: Boolean(checkout.options.onValidateSession),\n    shouldCallAddressCallback: false,\n    // handled by embedded checkout not the pop out window\n    language: event.language,\n    onOpen: popOutWindow => createPopOutMessageHandler(popOutWindow, checkout),\n    onClose: () => {\n      removeBackdrop();\n      postClosePopOutEvent(checkout.iframe, checkout.options.sid);\n      setPopOutButtonDisabled(false);\n      checkout.popOutWindow = undefined;\n    }\n  });\n  if (popOutWindow) {\n    postOpenPopOutEvent(checkout.iframe, checkout.options.sid);\n    // Add pop out window to checkout instance\n    checkout.popOutWindow = popOutWindow;\n    createBackdrop({\n      focus,\n      close,\n      event\n    });\n    return true;\n  } else {\n    postOpenPopOutFailedEvent(checkout.iframe, checkout.options.sid);\n    return false;\n  }\n};\n\n/**\n * Create callback function for the client side validation flow. It allows the\n * host application to validate the content of the payment session before the\n * pop out is opened.\n */\nconst createPopOutValidationCallback = (event, checkout) => {\n  return result => {\n    // Tell the embedded iframe about the validation result so it can show an error message if\n    // the validation failed.\n    postValidationResult(checkout.iframe, checkout.options.sid, result);\n    if (result.success && checkout.popOutWindow) {\n      // Redirect user to session in pop out window\n      checkout.popOutWindow.location.href = url.getPopOutUrl({\n        sid: checkout.options.sid,\n        endpoint: checkout.options.endpoint,\n        shouldCallValidateSession: false,\n        shouldCallAddressCallback: false,\n        language: event.language\n      });\n    } else {\n      // Close pop out\n      if (checkout.popOutWindow) {\n        checkout.popOutWindow.close();\n      }\n      // Log validation error to console log.\n      console.error(result.clientValidationError);\n    }\n  };\n};\n\n/**\n * Handle click event on the SDK rendered pop out button\n */\nconst handlePopOutButtonClick = async (event, checkout) => {\n  // Disable button while pop out is open\n  const opened = await showPopOut(event, checkout);\n  if (opened && checkout.options.onValidateSession) {\n    // Let the host application validate the payment session before opening checkout.\n\n    // Tell the embedded iframe that we are validating the session\n    postValidatePopOutEvent(checkout.iframe, checkout.options.sid);\n\n    // Create callback function added to the SDK event and onValidateSession attributes\n    const callback = createPopOutValidationCallback(event, checkout);\n\n    // Invoke onValidateSession function defined in checkout options\n    try {\n      checkout.options.onValidateSession({\n        type: CheckoutEvents.ValidateSession,\n        session: checkout.session,\n        callback\n      }, checkout, callback);\n    } catch (e) {\n      console.error(e);\n      postValidationResult(checkout.iframe, checkout.options.sid, {\n        success: false,\n        clientValidationError: \"Validation runtime error\"\n      });\n    }\n  }\n};\n\n/**\n * Type guard for ShowPopOutButton\n */\nconst isShowPopOutButton = event => {\n  return event && event.type === InternalCheckoutEvents.ShowPopOutButton;\n};\n\n/**\n * Display the SDK rendered pop out button on top of the embedded iframe\n */\nconst handleShowButton = (event, checkout) => {\n  if (isShowPopOutButton(event)) {\n    if (event.session) {\n      // Update checkout instance session\n      checkout.session = event.session;\n    }\n    addPopOutButton({\n      container: checkout.options.innerContainer,\n      label: event.openLabel,\n      top: event.top,\n      left: event.left,\n      right: event.right,\n      styles: event.styles,\n      stylesHover: event.stylesHover,\n      stylesFocusVisible: event.stylesFocusVisible,\n      disabled: event.disabled,\n      onClick: () => handlePopOutButtonClick(event, checkout)\n    });\n    setBackdropLabels(event);\n  }\n};\n\n/**\n * Remove the pop out button above the embedded iframe\n */\nconst handleRemoveButton = (event, _checkout) => {\n  if (event.type === InternalCheckoutEvents.HidePopOutButton) {\n    removePopOutButton();\n  }\n};\nconst cleanUpPopOut = checkout => {\n  // Ensures that the pop out is no longer open when the payment is completed or the checkout is destroyed.\n  removePopOutButton();\n  removeBackdrop();\n  if (checkout.popOutWindow) {\n    try {\n      checkout.popOutWindow.close();\n      // Pop out message handlers will be removed when the pop out window is closed\n      // via the interval created by openPopOut.\n    } catch (e) {\n      console.error(e);\n    }\n  }\n};\nconst composeUrl = (base, path, query) => {\n  const slash = base.endsWith(\"/\") ? \"\" : \"/\";\n  return `${base}${slash}${path}?${query}`;\n};\n\n/**\n * Show a dintero payment session in an embedded iframe.\n */\nconst embed = async options => {\n  // Create inner container to offset any styling on the container.\n  const innerContainer = document.createElement(\"div\");\n  innerContainer.style.position = \"relative\";\n  innerContainer.style[\"box-sizing\"] = \"border-box\";\n  const internalOptions = {\n    endpoint: \"https://checkout.dintero.com\",\n    innerContainer: innerContainer,\n    ...options\n  };\n  const {\n    container,\n    sid,\n    language,\n    endpoint,\n    onSession,\n    onSessionCancel,\n    onPayment,\n    onPaymentAuthorized,\n    onPaymentError,\n    onSessionNotFound,\n    onSessionLocked,\n    onSessionLockFailed,\n    onActivePaymentType,\n    onValidateSession,\n    onAddressCallback,\n    popOut\n  } = internalOptions;\n  let checkout;\n  const subscriptions = [];\n  let has_delivered_final_event = false;\n\n  // Create iframe\n  container.appendChild(innerContainer);\n  const {\n    iframe,\n    initiate\n  } = createIframeAsync(innerContainer, url.getSessionUrl({\n    sid,\n    endpoint,\n    language,\n    ui: options.ui || \"inline\",\n    shouldCallValidateSession: onValidateSession !== undefined,\n    shouldCallAddressCallback: onAddressCallback !== undefined,\n    popOut,\n    // biome-ignore lint/suspicious/noPrototypeBuiltins: test\n    ...(options.hasOwnProperty(\"hideTestMessage\") && {\n      hideTestMessage: options.hideTestMessage\n    })\n  }));\n\n  /**\n   * Function that removes the iframe, pop out and all event listeners.\n   */\n  const destroy = () => {\n    cleanUpPopOut(checkout);\n    if (iframe) {\n      if (internalOptions.popOut) {\n        // Try to remove backdrop if it exists\n        removeBackdrop();\n      }\n      for (const sub of subscriptions) {\n        sub.unsubscribe();\n      }\n      if (iframe.parentElement) {\n        innerContainer.removeChild(iframe);\n      }\n    }\n    if (innerContainer.parentElement) {\n      container.removeChild(innerContainer);\n    }\n  };\n\n  /**\n   * Turn an action into a promise by specifying resolve and\n   * reject events.\n   */\n  const promisifyAction = (action, resolveEvent, rejectEvent) => {\n    if (!checkout) {\n      throw new Error(\"Unable to create action promise: checkout is undefined\");\n    }\n    return new Promise((resolve, reject) => {\n      const eventSubscriptions = [];\n      eventSubscriptions.push(subscribe({\n        sid,\n        endpoint,\n        handler: sessionEvent => {\n          for (const sub of eventSubscriptions) {\n            sub.unsubscribe();\n          }\n          resolve(sessionEvent);\n        },\n        eventTypes: [resolveEvent],\n        checkout,\n        source: checkout.iframe.contentWindow\n      }));\n      eventSubscriptions.push(subscribe({\n        sid,\n        endpoint,\n        handler: () => {\n          for (const sub of eventSubscriptions) {\n            sub.unsubscribe();\n          }\n          reject(`Received unexpected event: ${rejectEvent}`);\n        },\n        eventTypes: [rejectEvent],\n        checkout,\n        source: checkout.iframe.contentWindow\n      }));\n      action();\n    });\n  };\n  const lockSession = () => {\n    return promisifyAction(() => {\n      postSessionLock(iframe, sid);\n      popOutModule.postPopOutSessionLock(checkout?.popOutWindow, sid);\n    }, CheckoutEvents.SessionLocked, CheckoutEvents.SessionLockFailed);\n  };\n  const refreshSession = () => {\n    return promisifyAction(() => {\n      postSessionRefresh(iframe, sid);\n      popOutModule.postPopOutSessionRefresh(checkout?.popOutWindow, sid);\n    }, CheckoutEvents.SessionUpdated, CheckoutEvents.SessionNotFound);\n  };\n  const setActivePaymentProductType = paymentProductType => {\n    // Send to either embed or pop out\n    if (options.popOut) {\n      popOutModule.postPopOutActivePaymentProductType(checkout?.popOutWindow, sid, paymentProductType);\n    } else {\n      postActivePaymentProductType(iframe, sid, paymentProductType);\n    }\n  };\n  const submitValidationResult = result => {\n    postValidationResult(iframe, sid, result);\n    // For pop out we do validation when opening the pop out\n  };\n  const submitAddressCallbackResult = result => {\n    postAddressCallbackResult(iframe, sid, result);\n    // For pop out we do validation when opening the pop out\n  };\n\n  /**\n   *  Internal result event message handler wrapper, to replace the content of the iframe with a success/or\n   *  error message. Only used when the embed function in the SDK has a dedicated handler for onPayment, onError etc.\n   *  If no custom handler is set the followHref handler is used instead.\n   */\n  const handleWithResult = (_sid, endpoint, handler) => {\n    return (event, checkout) => {\n      if (!has_delivered_final_event) {\n        has_delivered_final_event = true;\n        cleanUpPopOut(checkout);\n        const eventKeys = [\"sid\", \"merchant_reference\", \"transaction_id\", \"error\"];\n        const pairs = eventKeys.map(key => [key, event[key]]);\n        if (event.type === CheckoutEvents.SessionCancel && !event.error) {\n          pairs.push([\"error\", \"cancelled\"]);\n        }\n        pairs.push([\"language\", checkout.language]);\n        pairs.push([\"sdk\", pkg.version]);\n        const urlQuery = pairs.filter(([_key, value]) => value).map(([key, value]) => `${key}=${value}`).join(\"&\");\n        checkout.iframe.setAttribute(\"src\", composeUrl(endpoint, \"embedResult/\", urlQuery));\n        handler(event, checkout);\n      }\n    };\n  };\n  const wrappedOnValidateSession = (event, checkout) => {\n    if (onValidateSession) {\n      try {\n        onValidateSession({\n          ...event,\n          callback: submitValidationResult\n        }, checkout, submitValidationResult);\n      } catch (e) {\n        console.error(e);\n        submitValidationResult({\n          success: false,\n          clientValidationError: \"Validation runtime error\"\n        });\n      }\n    }\n  };\n  const wrappedOnAddressCallback = (event, checkout) => {\n    if (onAddressCallback) {\n      try {\n        onAddressCallback({\n          ...event,\n          callback: submitAddressCallbackResult\n        }, checkout, submitAddressCallbackResult);\n      } catch (e) {\n        console.error(e);\n        submitAddressCallbackResult({\n          success: false,\n          error: \"Address callback runtime error\"\n        });\n      }\n    }\n  };\n  const wrappedOnSessionLocked = (event, checkout) => {\n    if (onSessionLocked) {\n      onSessionLocked(event, checkout, refreshSession);\n    }\n  };\n  const wrappedOnLoadedOrUpdated = (event, checkout) => {\n    // Update the checkout instance to include the session object\n    checkout.session = event.session;\n    if (onSession) {\n      onSession(event, checkout);\n    }\n  };\n\n  // Add event handlers (or in some cases add a fallback href handler).\n  const handlers = [{\n    handler: setLanguage,\n    eventTypes: [InternalCheckoutEvents.LanguageChanged]\n  }, {\n    handler: setIframeHeight,\n    eventTypes: [InternalCheckoutEvents.HeightChanged]\n  }, {\n    handler: scrollToIframeTop,\n    eventTypes: [InternalCheckoutEvents.ScrollToTop]\n  }, {\n    handler: followHref,\n    eventTypes: [InternalCheckoutEvents.TopLevelNavigation]\n  }, {\n    handler: wrappedOnLoadedOrUpdated,\n    eventTypes: [CheckoutEvents.SessionLoaded, CheckoutEvents.SessionUpdated]\n  }, {\n    eventTypes: [CheckoutEvents.SessionPaymentOnHold],\n    handler: handleWithResult(sid, endpoint, onPayment || followHref)\n  }, {\n    eventTypes: [CheckoutEvents.SessionPaymentAuthorized],\n    handler: handleWithResult(sid, endpoint, onPaymentAuthorized || onPayment || followHref)\n  }, {\n    handler: handleWithResult(sid, endpoint, onSessionCancel || followHref),\n    eventTypes: [CheckoutEvents.SessionCancel]\n  }, {\n    handler: handleWithResult(sid, endpoint, onPaymentError || followHref),\n    eventTypes: [CheckoutEvents.SessionPaymentError]\n  }, {\n    handler: onSessionNotFound,\n    eventTypes: [CheckoutEvents.SessionNotFound]\n  }, {\n    handler: wrappedOnSessionLocked,\n    eventTypes: [CheckoutEvents.SessionLocked]\n  }, {\n    handler: onSessionLockFailed,\n    eventTypes: [CheckoutEvents.SessionLockFailed]\n  }, {\n    handler: onActivePaymentType,\n    eventTypes: [CheckoutEvents.ActivePaymentProductType]\n  }, {\n    handler: wrappedOnValidateSession,\n    eventTypes: [CheckoutEvents.ValidateSession]\n  }, {\n    handler: wrappedOnAddressCallback,\n    eventTypes: [CheckoutEvents.AddressCallback]\n  }, {\n    handler: handleShowButton,\n    eventTypes: [InternalCheckoutEvents.ShowPopOutButton]\n  }, {\n    handler: handleRemoveButton,\n    eventTypes: [InternalCheckoutEvents.HidePopOutButton]\n  }];\n  // Create checkout object that wraps the destroy function.\n  checkout = {\n    destroy,\n    iframe,\n    language,\n    lockSession,\n    refreshSession,\n    setActivePaymentProductType,\n    submitValidationResult,\n    submitAddressCallbackResult,\n    options: internalOptions,\n    handlers,\n    session: undefined,\n    popOutWindow: undefined\n  };\n  for (const {\n    handler,\n    eventTypes\n  } of handlers) {\n    if (handler) {\n      subscriptions.push(subscribe({\n        sid,\n        endpoint,\n        handler,\n        eventTypes,\n        checkout,\n        source: checkout.iframe.contentWindow\n      }));\n    }\n  }\n\n  // Add iframe to DOM\n  await initiate();\n  // Return object with function to destroy the checkout.\n  return checkout;\n};\n\n/**\n * Redirect the customer to a payment session in the Dintero Checkout.\n */\nconst redirect = options => {\n  const {\n    sid,\n    language,\n    endpoint = \"https://checkout.dintero.com\"\n  } = options;\n  // Redirect the current browser window to the checkout session url.\n  url.windowLocationAssign(url.getSessionUrl({\n    sid,\n    endpoint,\n    language,\n    shouldCallValidateSession: false,\n    shouldCallAddressCallback: false,\n    redirect: true\n  }));\n};\n\nexport { embed, redirect };\n"]}