(function(){
  var srcScript = document.currentScript.getAttribute('src');
  var paramsSrcScript = new URL(srcScript).searchParams;
  var target = paramsSrcScript.get("target") ? paramsSrcScript.get("target") : "js-audio"; 
  var targetAudio = document.getElementById(target);

  if(targetAudio.hasChildNodes()) return;

  var theme_files_css = [];
  var files_css = ["https://audio-assets.cnevids.com/1741095847/stylesheets/episode-style.css"];
  var iframe = document.createElement('iframe');

  iframe.onload = function() {
    var head = iframe.contentWindow.document.getElementsByTagName('head')[0];

    [...theme_files_css, ...files_css].forEach(el => {
      var s = document.createElement('link');
      s.type = 'text/css';
      s.rel = 'stylesheet';
      s.href = el;
      head.appendChild(s);
    });

    var body = iframe.contentWindow.document.getElementsByTagName('body')[0];
    var globalScript = document.createElement('script');
    var varInit = "\n      var data = {\"player_type\":\"episode\",\"title\":\"Have A Nice Future | WIRED \",\"platforms\":[{\"name\":\"Apple Podcast\",\"value\":\"https://listen.wired.com/hanfapple\"},{\"name\":\"Spotify\",\"value\":\"https://listen.wired.com/hanfspotify\"}],\"summary\":\"The future. It’s exciting; it’s discomforting. We don’t know what’s happening next— in the next four minutes on Twitter or in the next four years of democracy. Have a Nice Future is a new podcast from WIRED, where each week, Wired’s Senior Writer Lauren Goode &amp; Contributor Gideon Lichfield speak with the top technologists, thinkers, and creators who are shaping this future we’re racing into. Every episode, we’ll ask each guest—and ourselves—the same question: Is this the future we want? And if not, where do we go from here?Love this podcast? Click here to shop our special edition tote bag featuring the stand-out artwork.\",\"image\":{\"publicUrl\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/v1712570050/cneaudio/462b240854c5f66133827c2f9c14bfde.jpg\",\"patternUrl\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_HEIGHT,w_WIDTH/v1726394741769/cneaudio/462b240854c5f66133827c2f9c14bfde\",\"assets\":{\"220x220\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_220,w_220/v1726394741769/cneaudio/462b240854c5f66133827c2f9c14bfde\",\"width\":220,\"height\":220},\"mediaSession96\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_96,w_96/v1726394741769/cneaudio/462b240854c5f66133827c2f9c14bfde.png\",\"width\":96,\"height\":96},\"mediaSession128\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_128,w_128/v1726394741769/cneaudio/462b240854c5f66133827c2f9c14bfde.png\",\"width\":128,\"height\":128},\"mediaSession192\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_192,w_192/v1726394741769/cneaudio/462b240854c5f66133827c2f9c14bfde.png\",\"width\":192,\"height\":192},\"mediaSession256\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_256,w_256/v1726394741769/cneaudio/462b240854c5f66133827c2f9c14bfde.png\",\"width\":256,\"height\":256},\"mediaSession384\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_384,w_384/v1726394741769/cneaudio/462b240854c5f66133827c2f9c14bfde.png\",\"width\":384,\"height\":384},\"mediaSession512\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_512,w_512/v1726394741769/cneaudio/462b240854c5f66133827c2f9c14bfde.png\",\"width\":512,\"height\":512}}},\"country\":\"US\",\"brand\":\"wired\",\"producer\":\"in-house\",\"audios\":[{\"id\":\"1ec00521-d112-458d-b951-a8f812183480\",\"title\":\"A Very Online Government\",\"summary\":\"Gideon Lichfield and Lauren Goode talk to the Chief Intelligence Officer of Estonia, Luukas Ilves, about the country’s completely online government. In Estonia, citizens can access any government service, including voting, online. What would it take to create that kind of digital infrastructure in the United States?\",\"image\":{\"publicUrl\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/v1712570051/cneaudio/f6b4186fe95609cb3d9a9d809ab23746.jpg\",\"patternUrl\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_HEIGHT,w_WIDTH/v1712570052334/cneaudio/f6b4186fe95609cb3d9a9d809ab23746\",\"assets\":{\"220x220\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_220,w_220/v1712570052334/cneaudio/f6b4186fe95609cb3d9a9d809ab23746\",\"width\":220,\"height\":220},\"mediaSession96\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_96,w_96/v1712570052334/cneaudio/f6b4186fe95609cb3d9a9d809ab23746.png\",\"width\":96,\"height\":96},\"mediaSession128\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_128,w_128/v1712570052334/cneaudio/f6b4186fe95609cb3d9a9d809ab23746.png\",\"width\":128,\"height\":128},\"mediaSession192\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_192,w_192/v1712570052334/cneaudio/f6b4186fe95609cb3d9a9d809ab23746.png\",\"width\":192,\"height\":192},\"mediaSession256\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_256,w_256/v1712570052334/cneaudio/f6b4186fe95609cb3d9a9d809ab23746.png\",\"width\":256,\"height\":256},\"mediaSession384\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_384,w_384/v1712570052334/cneaudio/f6b4186fe95609cb3d9a9d809ab23746.png\",\"width\":384,\"height\":384},\"mediaSession512\":{\"url\":\"https://dwgyu36up6iuz.cloudfront.net/heru80fdn/image/upload/b_auto,c_fill_pad,g_auto,h_512,w_512/v1712570052334/cneaudio/f6b4186fe95609cb3d9a9d809ab23746.png\",\"width\":512,\"height\":512}}},\"duration\":1974,\"files\":[\"https://dovetail.prxu.org/7056/563780e3-fcbd-4040-b6f7-6fa7a61e3294/57._A_Very_Online_Government.mp3\"],\"pubDate\":\"2023-10-18T16:00:00.000Z\",\"seasonNumber\":null,\"episodeNumber\":null,\"provider\":{\"name\":\"prx\",\"internalId\":\"6aa2ea5a-6d55-11ee-addc-4b678a131639\"}}]};\n      var skin = \"\";\n      var episode = \"1\";\n      var playerType =\"episode\";\n      var environment = \"prod\";\n      var audio_source_org_id = \"4gKgcErvvpkwWft3fSWg7c2niGQB\";\n    " + `var target = "${target}"`;
    globalScript.textContent = varInit;
    body.appendChild(globalScript);
    var divAudio = document.createElement('div');
    divAudio.setAttribute('id', target);
    body.appendChild(divAudio);

    ['https://audio-assets.cnevids.com/1741095847/javascripts/script.js'].forEach(el => {
      var s = document.createElement('script');
      s.src = el;
      body.appendChild(s);
    });

  }

  iframe.setAttribute('frameborder', '0');
  iframe.setAttribute('width', '100%');
  iframe.setAttribute('height', 244);
  targetAudio.appendChild(iframe);
})();