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N,YAAYoB,GACtB9B,EAAKgC,SACEhB,GAGLoB,6BAA+B,SAAsCT,EAAkBC,GACzF,IAAIS,EAAYhD,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,GAAmBA,UAAU,GAAK,sBAChFiD,EAAgBjD,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,GAAmBA,UAAU,GAAKY,SAAS8B,KAC7FQ,EAAsBlD,UAAUC,OAAS,EAAID,UAAU,QAAKE,EAC5DiD,EAASzB,aAAauB,EAAeD,EAAW,sBAAuB,IAAK,IAAKE,GAGrF,OAFEb,cAAcC,EAAkBC,EAAmBY,GAE9CA,GAGT,SAASC,MAAMC,GACX,MAAMC,EAAOC,KAAKC,MAClB,IAAIC,EAAc,KAClB,GACIA,EAAcF,KAAKC,YAChBC,EAAcH,EAAOD,GAGhC,IAAIK,uCAAyC,SAAgDb,EAAQC,GACnG,IAAI/C,EAAsBC,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,GAAmBA,UAAU,GAAK,KAC1FgD,EAAYhD,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,GAAmBA,UAAU,GAAK,oBAChFiD,EAAgBjD,UAAUC,OAAS,QAAsBC,IAAjBF,UAAU,GAAmBA,UAAU,GAAKY,SAAS8B,KAC7FQ,EAAsBlD,UAAUC,OAAS,EAAID,UAAU,QAAKE,EAC5DyD,EAAa7D,cAAcC,GAC3BoD,EAASzB,aAAauB,EAAeD,EAAW,oBAAqBW,EAAW,GAAIA,EAAW,GAAIT,GAEvG,OADAN,wBAAwBC,EAAQC,EAAUK,GACnCA,GAOLS,aAAe,GAenBA,aAAab,6BAA+BA,6BAa5Ca,aAAavB,cAAgBA,cAY7BuB,aAAahB,wBAA0BA,wBAmBvCgB,aAAaF,uCAAyCA,uCACtDG,OAAOD,aAAeA","sources":["projects\\paymentpage\\assets\\nca-3ds-web-sdk.js"],"sourcesContent":["\"use strict\";\r\n\r\nfunction _instanceof(left, right) { if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } }\r\n\r\n/**\r\n * Returns the EMVCo-specified window sizes depending on the challengeWindowSize value.\r\n *\r\n * @param challengeWindowSize - EMVCo-specified window size\r\n * @returns {string[]} - window size\r\n */\r\nvar getWindowSize = function getWindowSize() {\r\n var challengeWindowSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '05';\r\n\r\n switch (challengeWindowSize) {\r\n case '01':\r\n return ['250px', '400px'];\r\n\r\n case '02':\r\n return ['390px', '400px'];\r\n\r\n case '03':\r\n return ['500px', '600px'];\r\n\r\n case '04':\r\n return ['600px', '400px'];\r\n\r\n case '05':\r\n return ['100%', '100%'];\r\n\r\n default:\r\n throw Error(\"Selected window size \".concat(challengeWindowSize, \" is not supported\"));\r\n }\r\n};\r\n/**\r\n * Creates a form element with one input field and sets the input value.\r\n *\r\n * @param formName - the name of the form element\r\n * @param formAction - the endpoint where the form will be submitted\r\n * @param formTarget - the iFrame name where the form will be appended to\r\n * @param inputName - the name of the field\r\n * @param inputValue - the value of the field\r\n * @throws {Error} - throws an error if there is a validation error\r\n * @returns {HTMLFormElement} - the generated form element\r\n */\r\n\r\n\r\nvar createForm = function createForm(formName, formAction, formTarget, inputName, inputValue) {\r\n if (!formName || !formAction || !formTarget || !inputName || !inputValue) {\r\n throw Error('All fields must be present');\r\n }\r\n\r\n var form = document.createElement('form');\r\n form.name = formName;\r\n form.action = formAction;\r\n form.method = 'POST';\r\n form.target = formTarget;\r\n form.enctype = \"application/x-www-form-urlencoded\";\r\n var input = document.createElement('input');\r\n input.name = inputName;\r\n input.value = inputValue;\r\n form.appendChild(input);\r\n form.style.display = 'none';\r\n console.log('form created');\r\n return form;\r\n};\r\n/**\r\n * Creates an iframe component and attaches it to the provided container.\r\n *\r\n * @param container - HTML element to attach the iframe\r\n * @param name - name of the iframe container. It will be used when attaching the form element\r\n * @param id - id of the iframe container\r\n * @param width - width of the container. Default is 0.\r\n * @param height - height of the container. Default is 0.\r\n * @param onLoadCallback - callback that will be executed when the frame loads. This is optional\r\n * @returns {HTMLIFrameElement} generated iframe\r\n */\r\n\r\n\r\nvar createIFrame = function createIFrame(container, name, id) {\r\n var width = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '0';\r\n var height = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '0';\r\n var onLoadCallback = arguments.length > 5 ? arguments[5] : undefined;\r\n\r\n if (!container || !name || !id) {\r\n throw Error('Not all required fields have value');\r\n }\r\n\r\n if (_instanceof(container, HTMLElement) === false) {\r\n throw Error('Container must be a HTML element');\r\n }\r\n\r\n var iframe = document.createElement('iframe');\r\n iframe.width = width;\r\n iframe.height = height;\r\n iframe.name = name;\r\n iframe.setAttribute('id', id);\r\n iframe.setAttribute('frameborder', '0');\r\n iframe.setAttribute('border', '0');\r\n iframe.setAttribute('style', 'overflow:hidden; position:absolute');\r\n\r\n if (onLoadCallback && typeof onLoadCallback === 'function') {\r\n if (iframe.attachEvent) {\r\n iframe.attachEvent('onload', onLoadCallback);\r\n } else {\r\n iframe.onload = onLoadCallback;\r\n }\r\n }\r\n\r\n container.appendChild(iframe);\r\n return iframe;\r\n};\r\n\r\nvar init3DSMethod = function init3DSMethod(threeDSMethodUrl, threeDSMethodData, container) {\r\n if (!threeDSMethodUrl || !threeDSMethodData || !container) {\r\n throw Error('Not all fields have value');\r\n }\r\n\r\n if (_instanceof(container, HTMLIFrameElement) === false) {\r\n throw Error('Container is not an iFrame element');\r\n }\r\n\r\n if (!container.name) {\r\n throw Error('Container must have a name attribute');\r\n }\r\n\r\n var html = document.createElement('html');\r\n var body = document.createElement('body');\r\n var form = createForm('threeDSMethodForm', threeDSMethodUrl, container.name, \"threeDSMethodData\", threeDSMethodData);\r\n body.appendChild(form);\r\n html.appendChild(body);\r\n container.appendChild(html);\r\n container.style.display = 'none';\r\n form.submit();\r\n return container;\r\n};\r\n\r\nvar init3DSChallengeRequest = function init3DSChallengeRequest(acsUrl, creqData, container) {\r\n if (!acsUrl || !creqData || !container) {\r\n throw Error('Not all required fields have value');\r\n }\r\n\r\n if (_instanceof(container, HTMLIFrameElement) === false) {\r\n throw Error('Container is not of type iframe');\r\n }\r\n\r\n if (!container.name) {\r\n throw Error('Container must have a name attribute');\r\n }\r\n\r\n var html = document.createElement('html');\r\n var body = document.createElement('body');\r\n var form = createForm('challengeRequestForm', acsUrl, container.name, \"creq\", creqData);\r\n body.appendChild(form);\r\n html.appendChild(body);\r\n container.appendChild(html);\r\n form.submit();\r\n return container;\r\n};\r\n\r\nvar createIframeAndInit3DSMethod = function createIframeAndInit3DSMethod(threeDSMethodUrl, threeDSMethodData) {\r\n var frameName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'threeDSMethodIFrame';\r\n var rootContainer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document.body;\r\n var onFrameLoadCallback = arguments.length > 4 ? arguments[4] : undefined;\r\n var iFrame = createIFrame(rootContainer, frameName, 'threeDSMethodIframe', '0', '0', onFrameLoadCallback);\r\n init3DSMethod(threeDSMethodUrl, threeDSMethodData, iFrame);\r\n //sleep(7000); \r\n return iFrame;\r\n};\r\n\r\nfunction sleep(millisecond) {\r\n const date = Date.now();\r\n let currentDate = null;\r\n do {\r\n currentDate = Date.now();\r\n }while(currentDate - date < millisecond)\r\n}\r\n\r\nvar createIFrameAndInit3DSChallengeRequest = function createIFrameAndInit3DSChallengeRequest(acsUrl, creqData) {\r\n var challengeWindowSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '05';\r\n var frameName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : \"threeDSCReqIFrame\";\r\n var rootContainer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : document.body;\r\n var onFrameLoadCallback = arguments.length > 5 ? arguments[5] : undefined;\r\n var windowSize = getWindowSize(challengeWindowSize);\r\n var iFrame = createIFrame(rootContainer, frameName, 'threeDSCReqIframe', windowSize[0], windowSize[1], onFrameLoadCallback);\r\n init3DSChallengeRequest(acsUrl, creqData, iFrame);\r\n return iFrame;\r\n};\r\n/**\r\n * Attach all methods to window.\r\n */\r\n\r\n\r\nvar nca3DSWebSDK = {}; // START SNIPPET: websdk-documentation\r\n\r\n/**\r\n * Creates an iframe, attach it to the rootContainer and submit 3DS Method form.\r\n *\r\n * @param threeDSMethodUrl - a FQDN endpoint to submit the 3DS Method request\r\n * @param threeDSMethodData - Base64-encoded 3DS Method Data value\r\n * @param frameName - name of the frame container. if not set it will be set to 'threeDSMethodIFrame'\r\n * @param rootContainer - the container where the iframe will be attached to.\r\n * If not set defaults to the JavaScript document.body object\r\n * @param onFrameLoadCallback - callback function attached to the iframe.onload event\r\n * @throws {Error} - throws error if there is a validation error\r\n * @returns {HTMLIFrameElement} - returns the generated iframe element\r\n */\r\n\r\nnca3DSWebSDK.createIframeAndInit3DSMethod = createIframeAndInit3DSMethod;\r\n/**\r\n * Initiates a 3DS Method request and submits the form the the 3DS Method URL. It will automatically hide the container\r\n * when initiating a 3DS Method request.\r\n *\r\n * @param threeDSMethodUrl - a FQDN endpoint to submit the 3DS Method request\r\n * @param threeDSMethodData - Base64-encoded 3DS Method Data value.\r\n * @param container - the iframe container where the form will be attached to. The container must have the 'name'\r\n * attribute set\r\n * @throws {Error} - throws error if there is a validation error\r\n * @returns {HTMLIFrameElement} - the container\r\n */\r\n\r\nnca3DSWebSDK.init3DSMethod = init3DSMethod;\r\n/**\r\n * Initiates a 3DS Challenge request and submits the form the the ACS URL.\r\n *\r\n * @param acsUrl - the FQDN URL to submit the Challenge Request\r\n * @param creqData - Base64-encoded Challenge Request\r\n * @param container - the iframe container where the form will be attached to. The container must have the 'name'\r\n * attribute set\r\n * @throws {Error} - throws error if there is a validation error\r\n * @returns {HTMLIFrameElement} - the container\r\n */\r\n\r\nnca3DSWebSDK.init3DSChallengeRequest = init3DSChallengeRequest;\r\n/**\r\n * Creates an iframe, attach it to the rootContainer and submits 3DS Challenge Request.\r\n * @param acsUrl - the FQDN URL to submit the Challenge Request\r\n * @param creqData - Base64-encoded Challenge Request\r\n * @param challengeWindowSize - EMVCo assigned window size.\r\n * '01' -> 250px x 400px,\r\n * '02' -> 390px x 400px,\r\n * '03' -> 500px x 600px,\r\n * '04' -> 600px x 400px,\r\n * '05' -> Full screen, or full container content\r\n * @param frameName - name of the frame container. if not set it will be set to 'threeDSCReqIFrame'\r\n * @param rootContainer - the container where the iframe will be attached to.\r\n * If not set defaults to the JavaScript document.body object\r\n * @param onFrameLoadCallback - callback function attached to the iframe.onload event\r\n * @throws {Error} - throws error if there is a validation error\r\n * @returns {HTMLIFrameElement} - returns the generated iframe element\r\n */\r\n\r\nnca3DSWebSDK.createIFrameAndInit3DSChallengeRequest = createIFrameAndInit3DSChallengeRequest;\r\nwindow.nca3DSWebSDK = nca3DSWebSDK; // END SNIPPET: websdk-documentation"],"names":["_instanceof","left","right","Symbol","hasInstance","getWindowSize","challengeWindowSize","arguments","length","undefined","Error","concat","createForm","formName","formAction","formTarget","inputName","inputValue","form","document","createElement","name","action","method","target","enctype","input","value","appendChild","style","display","console","log","createIFrame","container","id","width","height","onLoadCallback","HTMLElement","iframe","setAttribute","attachEvent","onload","init3DSMethod","threeDSMethodUrl","threeDSMethodData","HTMLIFrameElement","html","body","submit","init3DSChallengeRequest","acsUrl","creqData","createIframeAndInit3DSMethod","frameName","rootContainer","onFrameLoadCallback","iFrame","sleep","millisecond","date","Date","now","currentDate","createIFrameAndInit3DSChallengeRequest","windowSize","nca3DSWebSDK","window"],"sourceRoot":"webpack:///"}