{"version":3,"file":"automatewoo-referrals.min.js","mappings":"AACAA,OAAQC,UAAWC,OAAO,SAAWC,GACpC,MAAMC,EAAUC,mCAehB,GALAF,EAAG,mCAAoCG,GAAI,SAAS,SAAWC,GAR/D,IAAkBC,EASjBD,EAAEE,iBATeD,EAURL,EAAGO,MAAOC,KAAM,QATzBC,OAAOC,KACNL,EACA,2BACA,sEAOF,IAEKJ,EAAQU,cAAgB,CAyB5B,MAAMC,EAtBN,WACC,MAAMC,EAAO,GACPC,EAASL,OAAOM,SAASC,KAC7BC,MAAOR,OAAOM,SAASC,KAAKE,QAAS,KAAQ,GAC7CC,MAAO,KACT,IAAM,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IAAM,CACzC,MAAME,EAAOR,EAAQM,GAAID,MAAO,KAChCN,EAAKU,KAAMD,EAAM,IAEjB,MAAME,OAA2B,IAAdF,EAAM,GAAsB,EAAI,EAG7CG,EAAIH,EAAME,GAAMN,QAAS,KAC/BI,EAAME,GAAQF,EAAME,GAAME,UACzB,GACO,IAAPD,EAAWA,EAAIH,EAAME,GAAMH,QAE5BR,EAAMS,EAAM,IAAQA,EAAME,EAC3B,CACA,OAAOX,CACR,CAEYc,GAAgB1B,EAAQ2B,iBAEhB,IAARhB,GACXiB,QAAQC,IAAK,kBAAmBlB,EAAK,CACpCmB,QAASC,SAAU/B,EAAQgC,eAAgB,IAC3CC,KAAM,KAGT,CACD","sources":["webpack://automatewoo-referrals/./assets/js/automatewoo-referrals.js"],"sourcesContent":["/* global automatewooReferralsLocalizeScript, Cookies */\njQuery( document ).ready( function ( $ ) {\n\tconst options = automatewooReferralsLocalizeScript;\n\n\tfunction openBox( url ) {\n\t\twindow.open(\n\t\t\turl,\n\t\t\t'automatewoo_social_share',\n\t\t\t'titlebar=no,toolbar=no,height=300,width=550,resizable=yes,status=no'\n\t\t);\n\t}\n\n\t$( 'a.js-automatewoo-open-share-box' ).on( 'click', function ( e ) {\n\t\te.preventDefault();\n\t\topenBox( $( this ).attr( 'href' ) );\n\t} );\n\n\tif ( options.is_link_based ) {\n\t\t// save advocate key from url as cookie\n\n\t\tfunction getQueryVars() {\n\t\t\tconst vars = [];\n\t\t\tconst hashes = window.location.href\n\t\t\t\t.slice( window.location.href.indexOf( '?' ) + 1 )\n\t\t\t\t.split( '&' );\n\t\t\tfor ( let i = 0; i < hashes.length; i++ ) {\n\t\t\t\tconst hash = hashes[ i ].split( '=' );\n\t\t\t\tvars.push( hash[ 0 ] );\n\n\t\t\t\tconst key = typeof hash[ 1 ] === 'undefined' ? 0 : 1;\n\n\t\t\t\t// Remove fragment identifiers\n\t\t\t\tconst n = hash[ key ].indexOf( '#' );\n\t\t\t\thash[ key ] = hash[ key ].substring(\n\t\t\t\t\t0,\n\t\t\t\t\tn !== -1 ? n : hash[ key ].length\n\t\t\t\t);\n\t\t\t\tvars[ hash[ 0 ] ] = hash[ key ];\n\t\t\t}\n\t\t\treturn vars;\n\t\t}\n\n\t\tconst ref = getQueryVars()[ options.link_param ];\n\n\t\tif ( typeof ref !== 'undefined' ) {\n\t\t\tCookies.set( 'aw_referral_key', ref, {\n\t\t\t\texpires: parseInt( options.cookie_expires, 10 ),\n\t\t\t\tpath: '/',\n\t\t\t} );\n\t\t}\n\t}\n} );\n"],"names":["jQuery","document","ready","$","options","automatewooReferralsLocalizeScript","on","e","url","preventDefault","this","attr","window","open","is_link_based","ref","vars","hashes","location","href","slice","indexOf","split","i","length","hash","push","key","n","substring","getQueryVars","link_param","Cookies","set","expires","parseInt","cookie_expires","path"],"sourceRoot":""}