function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}(function(a,b){"function"==typeof define&&define.amd?define([],b):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?module.exports=b():a.InstagramFeed=b()})(this,function(){var a={host:"https://www.instagram.com/",username:"",tag:"",container:"",display_profile:!0,display_biography:!0,display_gallery:!0,display_igtv:!1,get_data:!1,callback:null,styling:!0,items:8,items_per_row:4,margin:.5,image_size:640},b={150:0,240:1,320:2,480:3,640:4};return function(c){this.options=Object.assign({},a),this.options=Object.assign(this.options,c),this.is_tag=""==this.options.username,this.valid=!0,""==this.options.username&&""==this.options.tag?(console.error("InstagramFeed: Error, no username or tag defined."),this.valid=!1):this.options.get_data||""!=this.options.container?this.options.get_data&&"function"!=typeof this.options.callback&&(console.error("InstagramFeed: Error, invalid or undefined callback for get_data"),this.valid=!1):(console.error("InstagramFeed: Error, no container found."),this.valid=!1),this.get=function(a){var b=this.is_tag?this.options.host+"explore/tags/"+this.options.tag:this.options.host+this.options.username,c=new XMLHttpRequest,d=this;c.onload=function(){if(4===c.readyState)if(200===c.status){var e=c.responseText.split("window._sharedData = ")[1].split("")[0];e=JSON.parse(e.substr(0,e.length-1)),e=e.entry_data.ProfilePage||e.entry_data.TagPage||null,null===e?(console.log(b),console.error("InstagramFeed: Request error. No data retrieved: "+c.statusText)):(e=e[0].graphql.user||e[0].graphql.hashtag,a(e,d))}else console.error("InstagramFeed: Request error. Response: "+c.statusText)},c.open("GET",b,!0),c.send()},this.parse_caption=function(a,b){return"undefined"!=typeof a.node.edge_media_to_caption.edges[0]&&0!=a.node.edge_media_to_caption.edges[0].node.text.length?a.node.edge_media_to_caption.edges[0].node.text:"undefined"!=typeof a.node.title&&0!=a.node.title.length?a.node.title:"undefined"!=typeof a.node.accessibility_caption&&0!=a.node.accessibility_caption.length?a.node.accessibility_caption:(this.is_tag?b.name:b.username)+" image "},this.display=function(a){if(this.options.styling)var c=(100-2*this.options.margin*this.options.items_per_row)/this.options.items_per_row,d={profile_container:" style='text-align:center;'",profile_image:" style='border-radius:10em;width:15%;max-width:125px;min-width:50px;'",profile_name:" style='font-size:1.2em;'",profile_biography:" style='font-size:1em;'",gallery_image:" style='margin:"+this.options.margin+"% "+this.options.margin+"%;width:"+c+"%;float:left;'"};else var d={profile_container:"",profile_image:"",profile_name:"",profile_biography:"",gallery_image:""};var e="";if(this.options.display_profile&&(e+="
@"+a.full_name+" (@"+this.options.username+")
",!this.is_tag&&this.options.display_biography&&(e+=""+a.biography+"
"),e+="This profile is private
";else{var g=(a.edge_owner_to_timeline_media||a.edge_hashtag_to_media).edges;o=g.length>this.options.items?this.options.items:g.length,e+="