// source --> https://web-frame.com/wp-content/plugins/wp-social/assets/js/front-main.js?ver=3.2.0 
function check_instagram_cache(){jQuery.ajax({data:{route:"",_token:""},type:"post",url:window.rest_config.rest_url+"wslu/v1/check_cache/instagram/",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",rest_config.nonce)},success:function(e){e.success&&e.expired&&fetch_and_cache_instagram_count(e.unm),console.log("Instagram data cache was initiated - ",e)},error:function(e){},complete:function(){}})}function fetch_and_cache_instagram_count(e){jQuery.get("https://www.instagram.com/"+e+"/?__a=1",(function(t){console.log(t.graphql.user.edge_followed_by),console.log(t);var s=0;t.graphql.user.edge_followed_by&&(s=t.graphql.user.edge_followed_by),jQuery.ajax({type:"POST",url:window.rest_config.rest_url+"wslu/v1/save_cache/instagram/",data:{content:s},success:function(t){console.log("Instagram data fetch for user - "+e,t)},error:function(t){console.log("Instagram data fetch failed for user - "+e,t)}})}))}jQuery(document).ready((function(e){var t;e(window).on("resize.wslu",(function(){let s=(t=e(".xs_social_share_widget.wslu-share-horizontal.wslu-main_content")).parent(),a=t.find(".wslu-share-count"),n=s.width(),o=t.find("ul").outerWidth(!0)||null;if(a.length&&(o=a.outerWidth(!0)||null),o&&o>n){let s=a.length?a.outerWidth(!0):0;temLength=s||0;let o,r=t.find("ul li");for(let t=0;t<=r.length;t++)if(temLength+=e(r).eq(t).outerWidth(!0),temLength>n){temLength-=e(r).eq(t).outerWidth(!0),o=e(r).eq(t-2).outerWidth(!0);break}shareBTN=76;let l=Math.floor((temLength-s)/o),c=shareBTN>o?Math.ceil(shareBTN/o):1;t.find("ul li").slice(l-c).wrapAll("<div class='wslu-share-more'><ul></ul></div>")}})).trigger("resize.wslu"),t.find(".wslu-share-more").prepend('<span class="wslu-share-more-btn-close met-social met-social-cross"></span><h3 class="wslu-share-more-btn-title">Share this with:</h3>').before('<li class="wslu-share-more-btn"><a href="#"><div class="wslu-both-counter-text"><span class="wslu-share-more-btn--icon met-social met-social-share-1"></span> Share</div></a></li>'),e(".xs_social_share_widget").on("click",".wslu-share-more-btn",(function(){e(this).addClass("active").next().addClass("active")})),e(".xs_social_share_widget").on("click",".wslu-share-more-btn-close",(function(){e(this).parent().removeClass("active").prev().removeClass("active")})),"1"==rest_config.insta_enabled&&setTimeout((function(e){}),1200)}));
// source --> https://web-frame.com/wp-content/plugins/digital-license-manager-pro/vendor/gdarko/digital-license-manager/assets/js/shared/http.js?ver=1.8.3 
/**
 * Copyright (C) 2020-present Darko Gjorgjijoski <https://darkog.com>
 * Copyright (C) 2020-present IDEOLOGIX MEDIA DOOEL <https://ideologix.com>
 * All Rights Reserved.
 * Licensed under GPLv3.
 */

window.DLM = window.hasOwnProperty('DLM') ? window.DLM : {};

document.addEventListener("DOMContentLoaded", function (event) {

    /**
     * A simple Vanilla Javascript Http client.
     * @author Darko Gjorgjioski <dg@darkog.com>
     * @copyright 2023
     *
     * @param params
     * @constructor
     */
    const Http = function (params) {
        this.params = params;
    }

    /**
     * Sends a http request
     * @param type
     * @param url
     * @param params
     */
    Http.prototype.request = function (type, url, params) {
        let self = this;
        let request = new XMLHttpRequest();
        let formData = null;
        let data = params.hasOwnProperty('data') && params.data ? params.data : {};
        switch (type.toUpperCase()) {
            case 'GET':
                let query = new URLSearchParams(data).toString();
                url = url.indexOf('?') === -1 ? url + '?' + query : url + '&' + query;
                request.open(type, url, true);
                break;
            case 'POST':
                if (!(data instanceof FormData)) {
                    formData = new FormData();
                    for (let key in data) {
                        formData.append(key, data[key]);
                    }
                } else {
                    formData = data;
                }
                request.open(type, url, true);
                break;
        }
        let headers = params.hasOwnProperty('headers') && params.headers ? params.headers : {};
        for (let key in headers) {
            request.setRequestHeader(key, headers[key]);
        }
        request.onreadystatechange = function () {
            if (request.readyState === request.DONE) {
                let headers = self.parseHeaders(request);
                if (request.status >= 200 && request.status <= 299) {
                    if (params.hasOwnProperty('success')) {
                        const response = headers.hasOwnProperty('content-type') && headers['content-type'].substring('application/json') !== -1
                            ? JSON.parse(request.responseText) : request.responseText;
                        params.success(response, request.status, headers);
                    }
                } else {
                    if (params.hasOwnProperty('error')) {
                        params.error(request.responseText, request.status, headers);
                    }
                }
                if(params.hasOwnProperty('complete')) {
                    params.complete(request.responseText, request.status, headers)
                }
            }
        };
        if (params.hasOwnProperty('beforeStart')) {
            params.beforeStart();
        }
        if (null !== formData) {
            request.send(formData);
        } else {
            request.send();
        }
    }

    /**
     * Sends a GET request
     * @param url
     * @param params
     */
    Http.prototype.get = function (url, params) {
        this.request('GET', url, params);
    }

    /**
     * Sends a GET request
     * @param url
     * @param params
     */
    Http.prototype.post = function (url, params) {
        this.request('POST', url, params);
    }

    /**
     * Parses the headers
     * @param request
     * @returns {{}}
     */
    Http.prototype.parseHeaders = function (request) {
        const headers = request.getAllResponseHeaders();
        const arr = headers.trim().split(/[\r\n]+/);
        const headerMap = {};
        arr.forEach((line) => {
            let parts = line.split(': ');
            let header = parts.shift();
            headerMap[header.toLowerCase()] = parts.join(': ');
        });
        return headerMap
    }

    window.DLM.Http = Http;

});