// document.currentScript polyfill by Adam Miller
// MIT license
(function (document) {
  var currentScript = 'currentScript';

  // If browser needs currentScript polyfill, add get currentScript() to the document object
  if (!(currentScript in document)) {
    Object.defineProperty(document, currentScript, {
      get: function () {
        // IE 8-10 support script readyState
        // IE 11+ support stack trace
        try {
          throw new Error();
        }
        catch (err) {
          // Find the second match for the "at" string to get file src url from stack.
          // Specifically works with the format of stack traces in IE.
          var i = 0,
            stackDetails = (/.*at [^(]*\((.*):(.+):(.+)\)$/ig).exec(err.stack),
            scriptLocation = (stackDetails && stackDetails[1]) || false,
            line = (stackDetails && stackDetails[2]) || false,
            currentLocation = document.location.href.replace(document.location.hash, ''),
            pageSource,
            inlineScriptSourceRegExp,
            inlineScriptSource,
            scripts = document.getElementsByTagName('script'); // Live NodeList collection

          if (scriptLocation === currentLocation) {
            pageSource = document.documentElement.outerHTML;
            inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
            inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
          }

          for (; i < scripts.length; i++) {
            // If ready state is interactive, return the script tag
            if (scripts[i].readyState === 'interactive') {
              return scripts[i];
            }

            // If src matches, return the script tag
            if (scripts[i].src === scriptLocation) {
              return scripts[i];
            }

            // If inline source matches, return the script tag
            if (
              scriptLocation === currentLocation &&
              scripts[i].innerHTML &&
              scripts[i].innerHTML.trim() === inlineScriptSource
            ) {
              return scripts[i];
            }
          }

          // If no match, return null
          return null;
        }
      }
    });
  }
})(document);


function sfGetUrlParamValue(paramName) {
    const query = window.location.search.substring(1);
    const vars = query.split('&');
    for (var i = 0; i < vars.length; i++) {
      var pair = vars[i].split('=');
      if (pair[0] == paramName) {
        return pair[1] || null;
      }
    }
    return null;
}

function sf964() {
    return {
        defaultData: {
            'domain_uuid': 'S-u-20120228-000025-818073','wtiPrefix': '504c','landingPage': window.location.href,'referer': window.document.referrer || null,'owWID': '446',        },
        defaultRenderSettings: {
            'fullFormLink': '/get-started','brandName': 'PersonalLoans.com','domainName': 'personalloans.com','maxAmount': '35000','minAmount': '100','phoneNumber': '1-800-772-2274','privacyLink': '/privacy-policy','termsLink': '/terms-of-use','thirdPartiesLink': '/third-parties','disclosureLink': '/disclosure','creditAuthLink': '/credit-authorization-agreement','econsentLink': '/e-consent','siteTheme': 'personalloanscom','cdn': '/p/cdn/smartform','trackerOnly': '',        },
        experiment: 'ABCMini',                theme: 'personalloanscom',
        cdn: '/p/cdn/smartform',
            };
}

function loadSF() {
    const currentScriptElement = document.currentScript;
    
        
                const script0 = document.createElement('script');
    script0.setAttribute('src', '/p/cdn/smartform/js/chunk-common.js?v=1778800264');
            script0.id = 'chunk';
                                script0.dataset.url = '/p/v1/';
                script0.dataset.user = 'betatester';
                script0.dataset.key = '12345';
                script0.dataset.settingsFunctionName = 'sf964';
                        currentScriptElement.parentNode.insertBefore(script0, currentScriptElement.nextSibling);
                        const script1 = document.createElement('script');
    script1.setAttribute('src', '/p/cdn/smartform/js/personalloanscom-experiment.js?v=1778800264');
                    script0.parentNode.insertBefore(script1, script0.nextSibling);
            }

loadSF();
