(function () {
  //Inject code v4.0

  var highcharts = document.createElement('script');

  var cdn = 'https://code.highcharts.com/';
  var loaded = 0;  
  var encodedUrl = encodeURI('https://https://app.everviz.com//show/AzMBdpkHj');
  var chartCreated = false;
  var delayGen = 0;
  var scripts = [
    "highcharts.js",
    "modules/stock.js",
    "highcharts-more.js",
    "highcharts-3d.js",
    "modules/data.js",
    "modules/exporting.js",
    "modules/funnel.js",
    "modules/solid-gauge.js",
    "modules/export-data.js",
    "modules/accessibility.js"
  ];

  var externalCSS = [
    "https://app.everviz.com/fonts/-kdRxC3Ef/font.css",
    "https://app.everviz.com/fonts/mIQoHgFro/font.css",
    "https://app.everviz.com/fonts/b7ssKVeRa/font.css",
    "https://app.everviz.com/static/fonts/gordita/style.css",
    "https://app.everviz.com/resources/css/highcharts-data-table.css"
  ];

  var extraScripts = [
  "https://app.everviz.com/resources/js/highcharts-scroll-animation.js",
  "https://app.everviz.com/resources/js/everviz-utils.js",
  "https://app.everviz.com/resources/js/highcharts-overrides.js"
  ];

  var options = {"chart":{"type":"line","polar":false,"style":{"fontFamily":"Telesans Agate-Regular","fontSize":"14px"},"parallelAxes":{"stackLabels":{"style":{"fontSize":"14px"}}}},"title":{"text":"Factories are leading the jobs recovery","align":"left","x":10,"style":{"fontFamily":"Austin News Deck-Semibold","color":"#333333","fontSize":"22px","fontWeight":"normal","fontStyle":"normal","fill":"#333333","width":"566px"},"margin":15,"useHTML":true},"subtitle":{"text":"Hospitality companies remain much more cautious","align":"left","x":10,"style":{"fontFamily":"Austin News Deck-Italic","color":"#666666","fontSize":"22px","fontWeight":"normal","fontStyle":"normal","fill":"#666666","width":"566px"},"useHTML":true},"plotOptions":{"series":{"allowPointSelect":true,"states":{"select":{"color":"#EFFFEF","borderColor":"black","dashStyle":"dot"}},"marker":{"enabled":false},"lineWidth":3,"label":{"style":{"font-weight":"bold","fontFamily":"Telesans Agate-Regular","fontSize":"14px"}},"events":{}},"area":{"fillOpacity":0.2,"marker":{"enabled":false,"symbol":"diamond"},"dataLabels":{"style":{"fontSize":"14px"}},"label":{"style":{"font-weight":"bold","fontFamily":"Telesans Agate-Regular","fontSize":"14px"}}},"line":{"marker":{"symbol":"diamond"}}},"exporting":{"enabled":false},"credits":{"text":"Source: ONS/Adzuna","href":"","position":{"x":-7,"y":-3},"style":{"cursor":"pointer","color":"#999999","fontSize":"10px","fontFamily":"Telesans Agate-Regular"}},"colors":["#0021af","#17e698","#2f114f","#fff7b3","#ff77b7","#96efff","#f43939"],"legend":{"align":"left","verticalAlign":"top","itemMarginBottom":10,"x":-10,"symbolRadius":0,"floating":false,"itemStyle":{"fontFamily":"Telesans Agate-Regular","color":"#333333","fontSize":"14px","fontWeight":"normal","fontStyle":"normal","cursor":"pointer","textOverflow":"ellipsis"},"borderRadius":0,"squareSymbol":true,"shadow":false,"rtl":false,"reversed":false,"symbolPadding":4,"symbolHeight":12,"padding":8},"series":[{"data":[],"turboThreshold":0,"_colorIndex":0,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":1,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":2,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":3,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":4,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":5,"_symbolIndex":0,"type":"line"}],"tooltip":{"pointFormat":"<span style=\"color:{point.color}\"></span> {series.name}: <b>{point.y}</b><br/>","borderRadius":0,"borderWidth":1,"enabled":true,"headerFormat":"","shadow":false,"style":{"color":"#333333","cursor":"default","fontSize":"12px","pointerEvents":"none","whiteSpace":"nowrap","fontFamily":"Telesans Agate-Regular"},"padding":6},"caption":{"style":{"fontFamily":"Telesans Agate-Regular","color":"#666666","fontSize":"18px","fontWeight":"normal","fontStyle":"normal","fill":"#666666","width":"610px"}},"stockTools":{"gui":{"enabled":false}},"navigation":{"bindingsClassName":"tools-container","events":{}},"labels":{"items":[],"style":{"color":"#333333","position":"absolute","fontFamily":"Telesans Agate-Regular","fontSize":"14px"}},"pane":{"background":[]},"responsive":{"rules":[]},"yAxis":{"title":{"useHTML":true,"text":"Vacancies index, February 2020 = 100"}},"xAxis":{"lineColor":"black","tickColor":"black"},"annotations":[],"data":{"csv":"Date;All industries;Healthcare and social care;Education;Wholesale and retail;Catering and hospitality;Manufacturing\n7/2/2020;102.1;103.6;106.4;98.6;103.3;106.9\n13/2/2020;104.5;102.8;105;101.5;100.5;107.1\n21/2/2020;94.7;95.9;93.1;97;97.6;83.1\n27/2/2020;98.6;97.7;95.5;103;98.7;102.9\n6/3/2020;104.7;103.7;108.8;107.1;98.4;113.1\n12/3/2020;94.5;91.4;101.4;93.4;90;91.4\n20/3/2020;91.8;94.8;101;89.3;62.8;100.5\n27/3/2020;80.2;92.6;96.6;67.6;43.6;85.5\n3/4/2020;67.8;98.9;88.9;59.8;36.7;68.7\n9/4/2020;61.7;95.9;89;44.3;28.6;58.1\n17/4/2020;52.2;85.2;81.8;34.6;20.7;49.8\n24/4/2020;44.5;85.4;66.1;30.9;17.8;37.2\n1/5/2020;41.1;87.4;64;27.1;17.2;33.9\n7/5/2020;41.3;89.1;64.4;28.8;16.9;34.2\n15/5/2020;37.9;81.1;58.2;27.2;15.4;32.8\n22/5/2020;39.3;81.8;64.9;29.8;14.8;35.8\n29/5/2020;39.9;82.7;63.7;28.4;13.4;38.5\n5/6/2020;40.5;80.1;60.2;28.2;12.8;36\n12/6/2020;45;82.7;65.6;41.1;14.6;40.5\n19/6/2020;44.5;77.9;72.3;38.3;22;42.6\n26/6/2020;46.5;79.2;73.6;35.5;23.5;44.5\n3/7/2020;42.8;75.6;67.2;36.6;24;43.9\n10/7/2020;43.9;74.2;66.3;38.9;24.9;44.6\n17/7/2020;47.9;78.6;70.1;38.5;25.9;52.3\n24/7/2020;47.4;74.7;66.2;38.4;27.3;51.9\n31/7/2020;49.2;76.8;63.8;40.5;28.8;54.9\n7/8/2020;58.2;83.8;63.7;48.7;32.7;93.2\n14/8/2020;58.5;84.4;59.3;52.8;36.2;96.9\n21/8/2020;58.7;81.7;55.4;52.4;37;97.2\n28/8/2020;59.3;81.7;54.7;49.9;38.4;105.6\n4/9/2020;54;73;50.9;41.2;35.6;94.9\n11/9/2020;57.5;76.4;53.5;46.5;36;100.7\n18/9/2020;59.4;77.2;57.9;49.3;37.6;110.2\n25/9/2020;64;82.9;65.7;54;39.5;121.1\n2/10/2020;65.9;78.8;71.5;63.4;36.6;130.5\n9/10/2020;67.6;81.8;74.8;64.7;32;134.9\n16/10/2020;70.6;82.5;76;64.6;31.4;138.6\n23/10/2020;75;91.6;82.3;76.1;32.6;132.5\n30/10/2020;75.1;90.7;72.8;75.5;29.7;144.6\n6/11/2020;71.9;82.2;70.5;63.5;29.5;134.9\n13/11/2020;73.5;84.2;75.7;63;28.2;137.2\n20/11/2020;74.4;84.4;76.8;64.1;28.4;138.8\n27/11/2020;79.1;93.2;84.3;66.3;30.4;147.7\n4/12/2020;77.2;88.3;82.2;68.5;30.2;142.1\n11/12/2020;71.8;86.6;78.6;62;32.8;114.9\n18/12/2020;74.8;88.4;82.8;66.6;31.4;130.6\n24/12/2020;76.6;95.6;82.9;62;31.3;132.9\n31/12/2020;67.6;83.4;70.3;56.3;28.7;110.6\n8/1/2021;65.8;80.4;65.5;57.1;25.8;108.5\n15/1/2021;64.4;89.7;66.3;50.9;22.9;95.4\n22/1/2021;73.5;91.8;65.8;55.1;23.5;116.9\n29/1/2021;78.9;90.6;66.9;63.4;24.6;131.4\n5/2/2021;81.4;98.9;74.4;56.2;23;130\n12/2/2021;84.5;100.7;71.9;54.7;22.9;137.4\n19/2/2021;84.6;98.8;72.2;55.2;25.2;145.3\n26/2/2021;84.7;96.9;72.5;55.7;27.6;153.3\n5/3/2021;88.4;102.2;74;58.8;28.1;147\n12/3/2021;93.3;105.3;83.2;63.8;32.4;152.9\n19/3/2021;94.1;96.1;89.8;65.2;36.5;159.7","seriesMapping":[{"x":0,"y":1},{"x":0,"y":2},{"x":0,"y":3},{"x":0,"y":4},{"x":0,"y":5},{"x":0,"y":6}]}};
  var optionsStub;
  
  var templateDataSettings = {};

  var pluginCode = {};;

  function isScriptAlreadyIncluded(src){
    var scripts = document.getElementsByTagName("script");
    for (var i = 0; i < scripts.length; i++) {
      if (scripts[i].hasAttribute('src')) {
        const scriptTag = scripts[i].getAttribute('src') || '';
        if ((scriptTag.indexOf(src) >= 0) || 
            (scriptTag.indexOf('highcharts.src.js') > -1 && src === 'highcharts.js') ||
            ((scriptTag.indexOf('stock/highstock.js') > -1) && src === 'modules/highstock.js')) {
          return true;
        }
      }
    }
    return false;
  }

  function loadCSS() {
    var cssLength = externalCSS.length;
    for(var i=0; i < cssLength; i++) {
      var css = document.createElement('link');
      css.rel  = 'stylesheet';
      css.type = "text/css";
      css.href = externalCSS[i];
      document.body.appendChild(css);
    }
  }

  function allScriptsIncluded(){
    var allScripts = scripts.concat(extraScripts);
    var haveAllScriptsBeenIncluded = true;
    var scriptsToUse = document.getElementsByTagName("script");
    for(var n=0;n<allScripts.length;n++) {
      if (!isScriptAlreadyIncluded(allScripts[n], scriptsToUse)) {
        haveAllScriptsBeenIncluded = false;
        break;
      }
    }
    return haveAllScriptsBeenIncluded;
  }

  function modifyOptions(){
    if (options.data) {
      options.data.complete = function(options) {
        const keys = Object.keys(templateDataSettings || {});
        keys.forEach(function(key) {
          const serie = options.series[key];
          (serie.data || []).forEach(function(d, i) {
            if (templateDataSettings[key].data && templateDataSettings[key].data[i]) {
              window["everviz"].merge(d, templateDataSettings[key].data[i]);
            }
          })
        })  
        return options;
      }
    }
    
    optionsStub = window["everviz"].createStub(options);
    window["everviz"].merge(options, pluginCode);
    if ('Chart' === 'Map') window["everviz"].modifyMapType(options);
  }

  function createChart() {
    if(chartCreated) return;

    var hasProj4 = extraScripts.indexOf('https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js') > -1;

    if (!allScriptsIncluded() || 
      (hasProj4 && !window.proj4) || 
      !window["everviz"].merge ||
      !window["everviz"].createStub) {
      setTimeout(createChart, 200);
      return;
    }  

    modifyOptions();

    if (hasProj4) delayGen = 100;

    if (typeof window['Highcharts'] !== 'undefined') {
      

    if (options.yAxis && options.yAxis.length === 1) options.yAxis = options.yAxis[0];
    if (options.xAxis && options.xAxis.length === 1) options.xAxis = options.xAxis[0];
    if (options.zAxis && options.zAxis.length === 1) options.zAxis = options.zAxis[0];

    /*
// Sample of extending options:
Highcharts.merge(true, options, {
    chart: {
        backgroundColor: "#bada55"
    },
    plotOptions: {
        series: {
            cursor: "pointer",
            events: {
                click: function(event) {
                    alert(this.name + " clicked\n" +
                          "Alt: " + event.altKey + "\n" +
                          "Control: " + event.ctrlKey + "\n" +
                          "Shift: " + event.shiftKey + "\n");
                }
            }
        }
    }
});
*/


      if (options && (options.lang || options.global)) {
        Highcharts.setOptions({
          global: options.global || {},
          lang: options.lang || {}
        });
      }

      if (Highcharts.Annotation) {
        Highcharts.Annotation.ControlPoint.prototype.redraw = function (animation) {
          this.graphic[animation ? 'animate' : 'attr'](
              this.options.positioner ? this.options.positioner.call(this, this.target) : null
          );
        };
      }
      
      chartCreated = true;
      window.HighchartsCloud.hasLoaded = true; 
      setTimeout(function(){
        if (window["everviz"] && window["everviz"].pendingAnim) {

          var chart = new Highcharts.Chart('highcharts-AzMBdpkHj', optionsStub); 
          window["everviz"].pendingAnim({
            id: 'highcharts-AzMBdpkHj', 
            loaded: false,
            options: options,
            appear:function(){
              chart.destroy();
              chart = new Highcharts.Chart('highcharts-AzMBdpkHj', options); 
            },
            element: document.querySelector('#highcharts-AzMBdpkHj')
          });
        } else {
          new Highcharts.Chart('highcharts-AzMBdpkHj', options);   
        }
      }, delayGen);
    }
  }

  function check(scripts, cb) {
    if (loaded === scripts.length) {
      if (cb) {
        cb();
      } else {


        //Create first project
        if (!window.HighchartsCloud.versions ||
           (window.HighchartsCloud.versions && window.HighchartsCloud.versions.length !== window.HighchartsCloud.ondone.length)) {
             
          for (var i = 0; i < window.HighchartsCloud.ondone.length; i++) {
            try {
              window.HighchartsCloud.ondone[i]();
            } catch(e) {
              console.error(e);
            }
          }
        } else {
          if (window.HighchartsCloud.stack.length) {
            window.HighchartsCloud.stack[0]();
            window.HighchartsCloud.stack.shift();
            const shouldRenderNextChart = window.HighchartsCloud.stack.length > 0;
            if (shouldRenderNextChart) {
              window.HighchartsCloud.stack[0](true);
            }
          }
        }


/*
        for (var i = 0; i < window.HighchartsCloud.ondone.length; i++) {
          try {
            window.HighchartsCloud.ondone[i]();
          } catch(e) {
            console.error(e);
          }
        }*/



      }
    }
  }

  function loadScript(s, scripts, cb) {
    if (!s) next();
    
    function next() {
      ++loaded;
      if (loaded < scripts.length) {
        loadScript(scripts[loaded], scripts, cb);
      }
      check(scripts, cb);
    }

    if (isScriptAlreadyIncluded(s)) {
      return next();
    }

    var n = document.createElement('script');

    n.onload = function () {
      next();
    };

    if (s.indexOf('https') >= 0) {
      n.src = s;
    } else {
      n.src = cdn + s;
    }
    document.body.appendChild(n);
  }

  function loadExtraScripts(){
    if (extraScripts.length > 0) {
      loaded = 0;
      loadScript(extraScripts[0], extraScripts);
    } else {
      check(scripts);
    }
  }

  function loadExtraScriptsAndMakeChart(isUsingStack){
    loaded = 0;
    loadCSS();
    if (extraScripts.length > 0) {
      if (isUsingStack) {
        window.HighchartsCloud.stack[0] = createChart;
        loadScript(extraScripts[0], extraScripts);
      }
      else loadScript(extraScripts[0], extraScripts, createChart);
    } else {
      check(extraScripts);
    }
  }

  function getAllScripts(){
    var allScripts = scripts.map(function(script) {
      return 'highcharts/'+ script.replace('highcharts/highcharts.js', 'highcharts.js').replace('.js', '');
    }).concat(
      extraScripts.map(function(script) {
        if (script.indexOf('https://code.highcharts.com/') > -1) {
          return 'highcharts/'+ script.replace('https://code.highcharts.com/', '').replace('.js', '');
        } else return script;
      })
    );

    allScripts.forEach(function(script) {
      if (window.HighchartsCloud.allScripts)
        window.HighchartsCloud.allScripts[script] = 1
    });

    return allScripts;
  }

  function loadRequireJSScript(){
    require.config({
      packages: [{
        name: 'highcharts',
        main: 'highcharts'
      }],
      paths: {
        'highcharts': 'https://code.highcharts.com'
      }
    });

    const allScripts = getAllScripts();

    require(
      allScripts,
      function (Highcharts) {
        //Attach highcharts to the window for use in the everviz scripts
        window.Highcharts = Highcharts;
        createChart();
    });
  }

  function loadInitialScript(){
    if (window['require'] && typeof require === "function" && typeof require.specified === "function") {
      loadRequireJSScript();
    } else {
      getAllScripts()
      loadScript(scripts[0], scripts, loadExtraScripts);
      loadCSS();
    }
  }

  if (typeof window['HighchartsCloud'] === 'undefined') {
    window.HighchartsCloud = {
      ondone: [createChart],
      stack: [createChart],
      hasWrapped: false,
      hasLoaded: false,
      externalCSS: externalCSS,
      versions: [4],
      types: ['chart'],
      allScripts: {}
    };

    loadInitialScript();

  } else {
    if (window.HighchartsCloud.externalCSS) window.HighchartsCloud.externalCSS.push(externalCSS);
    if (!window.HighchartsCloud.hasLoaded) {
      window.HighchartsCloud.ondone.push(loadExtraScriptsAndMakeChart);
      if (window.HighchartsCloud.stack) {
        window.HighchartsCloud.stack.push(loadExtraScriptsAndMakeChart);
        window.HighchartsCloud.versions.push(4);
        window.HighchartsCloud.types.push('chart');
      }
      if (window['require'] && typeof require === "function" && typeof require.specified === "function") {
        getAllScripts()
        loadRequireJSScript();
      }
    }
    else {
      if (window['require'] && typeof require === "function" && typeof require.specified === "function") {
        loadRequireJSScript();
      } else {
        getAllScripts()
        loadExtraScriptsAndMakeChart();
      }
    }
  }

}());
