// source --> https://www.deinestadtklebt.de/wp-content/plugins/download-manager/assets/js/front.min.js?ver=3.3.66 
var allps,pss;let count=0,colors=[];var wpdm_pass_target="#pps_z";String.prototype.wpdm_shuffle=function(){for(var t=this.split(""),e=t.length-1;e>0;e--){var n=Math.floor(Math.random()*(e+1)),i=t[e];t[e]=t[n],t[n]=i}return t.join("")},String.prototype.wpdm_hash=function(){if(Array.prototype.reduce)return this.split("").reduce(function(t,e){return(t=(t<<5)-t+e.charCodeAt(0))&t},0);var t=0;if(0===this.length)return t;for(var e=0;e<this.length;e++){t=(t<<5)-t+this.charCodeAt(e),t&=t}return t};const WPDM={actions:{},init:function(t){},addAction:function(t,e){WPDM.actions[t]||(WPDM.actions[t]=[]),WPDM.actions[t].push(e)},doAction:async function(t,...e){void 0!==WPDM.actions[t]&&WPDM.actions[t].forEach(t=>t(...e))},copy:function(t){var e=document.getElementById(t);e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),WPDM.notify("Copied","success","top-center",1e3)},copyTxt:function(t){if(WPDM.notify("Copied","success","top-center",1e3),navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{let e=document.createElement("textarea");return e.value=t,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),new Promise((t,n)=>{document.execCommand("copy")?t():n(),e.remove()})}},beep:function(){if(null==WPDM.audio)var t=new Audio("data:audio/wav;base64,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qJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");else t=new Audio(WPDM.audio);t.play()},hash:function(t){return t.wpdm_hash()},uniqueID:function(t){var e=Date.now()+"abcdefghijklmnopqrstuvwxyz_";return e=(e=e.wpdm_shuffle()).substring(1,10),e=void 0!==t?t+e:e},fileTypeIcon:function(t){if(!colors[t]){let e="58"+"95BB".wpdm_shuffle(),n="56789A".wpdm_shuffle();colors[t]=[e,n]}return count++,`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" style="margin: 4px">\n                <defs>\n                    <linearGradient id="gradient${count}" x1="0" y1="0" x2="0" y2="1">\n                        <stop stop-color="#${colors[t][0]}" offset="0"/>\n                        <stop stop-color="var(--color-primary)" stop-opacity="0.7" offset="1"/>\n                    </linearGradient>\n                </defs>\n                <g>\n                    <rect fill="url(#gradient${count})" x="0" y="0" width="40" height="40" rx="3" ry="3"/>\n                    <text x="5" y="19" font-family="Arial, Helvetica, sans-serif" font-size="11px" letter-spacing="1" font-weight="600" text-rendering="geometricPrecision" fill="#FFFFFF">\n                        <tspan>${t}</tspan>\n                        <tspan x="6" y="28">_</tspan>\n                    </text>\n                </g>\n            </svg>`},popupWindow:function(t,e,n,i,a){var o=void 0!==window.screenLeft?window.screenLeft:screen.left,d=void 0!==window.screenTop?window.screenTop:screen.top,s=(window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width)/2-n/2+o,l=(window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height)/2-i/2+d,r=window.open(t,e,"scrollbars=yes, width="+n+", height="+i+", top="+l+", left="+s);return window.focus&&r.focus(),void 0!==a&&(r.onbeforeunload=function(){a.call()}),!1},html:function(t,e,n,i){return"<"+t+" class='"+(n=void 0!==n?n:"")+"' id='"+(i=void 0!==i?i:"")+"'>"+e+"</"+t+">"},el:function(t,e,n){var i=document.createElement(t);return i=jQuery(i),jQuery.each(e,function(t,e){i.attr(t,e)}),void 0!==n&&""!==n&&i.html(n),i[0].outerHTML},bootAlert:function(t,e,n,i,a){this.uniqueID();return(a=a||{}).width=n,"object"==typeof e?WPDM.dialog.ajax(t,e.url,a):WPDM.dialog.alert(t,e,a)},pushNotify:function(t,e,n,i,a){var o="info";(t.includes("rror")||e.includes("rror"))&&(o="error"),"Notification"in window&&"ServiceWorkerRegistration"in window?Notification.requestPermission(function(d){if("granted"===d){console.log("Notification: "+d);try{var s=new Notification(t,{body:e,icon:n||"https://cdn1.iconfinder.com/data/icons/hawcons/32/698558-icon-47-note-important-512.png",image:i||""});a&&(s.onclick=function(t){t.preventDefault(),window.open(a,"_blank")})}catch(n){WPDM.notify("<strong>"+t+"</strong><br/>"+e,o,"top-right"),console.log("Notification API error: "+n)}}else WPDM.notify("<strong>"+t+"</strong><br/>"+e,o,"top-right"),console.log("Notification: "+d)}):WPDM.notify("<strong>"+t+"</strong><br/>"+e,o,"top-right")},notify:function(t,e,n,i){WPDM.toast(t,e,n,i)},floatify:function(t,e){WPDM.toast(t,"info",e)},toast:function(t,e,n,i){var a=jQuery;e||(e="info"),n||(n="bottom-right"),void 0===i&&(i=4e3),"danger"===e&&(e="error");var o="wpdm-toast-"+n;0===a("#"+o).length&&a("body").append("<div class='w3eden' id='"+o+"' class='wpdm-toast-container'></div>");var d,s={success:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>',error:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',warning:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',info:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>'},l=a("<div class='wpdm-toast wpdm-toast-"+e+"'><span class='wpdm-toast-icon'>"+(s[e]||s.info)+"</span><span class='wpdm-toast-msg'>"+t+"</span><button class='wpdm-toast-close'>&times;</button></div>");function r(){clearTimeout(d),l.removeClass("wpdm-toast-show"),setTimeout(function(){l.remove()},300)}return a("#"+o).append(l),setTimeout(function(){l.addClass("wpdm-toast-show")},10),l.find(".wpdm-toast-close").on("click",function(){r()}),i>0&&(d=setTimeout(r,i),l.on("mouseenter",function(){clearTimeout(d)}),l.on("mouseleave",function(){d=setTimeout(r,1500)})),l},blockUI:function(t,e){jQuery(t).addClass("blockui"),e&&e.addEventListener("load",function(){jQuery(t).removeClass("blockui")})},unblockUI:function(t){void 0===t&&(t=".blockui"),jQuery(t).removeClass("blockui")},_dialogBtnType:function(t){return(t=(t||"").toLowerCase()).indexOf("danger")>-1?"danger":t.indexOf("success")>-1?"success":t.indexOf("primary")>-1||t.indexOf("info")>-1||t.indexOf("warning")>-1?"primary":"secondary"},confirm:function(t,e,n,i){var a=jQuery,o=n||[],d=WPDM.dialog||window.WPDMDialog;if(!d){var s=o[o.length-1];return window.confirm(a("<div>").html(e).text())&&s&&"function"==typeof s.callback&&s.callback.call(a()),a()}var l=o.length?o.map(function(t,e){return{text:a("<div>").html(t.label).text(),type:WPDM._dialogBtnType(t.class),action:"btn_"+e}}):[{text:"OK",type:"primary",action:"btn_0"}];return d.show({title:t,message:e,html:!0,type:"question",size:"sm",buttons:l,backdrop:"static"}).then(function(t){var e=/^btn_(\d+)$/.exec(t.action||"");e&&o[e[1]]&&"function"==typeof o[e[1]].callback&&o[e[1]].callback.call(a())}),a()},audioUI:function(t){var e,n,i,a=jQuery;t.duration!==1/0?(e=parseInt(t.duration),n=parseInt(e/60),i=e-60*n,n=n>9?n:"0"+n,i=i>9?i:"0"+i):(n="--",i="--",t.addEventListener("durationchange",function(t){console.log(this.duration),this.duration!==1/0&&(e=parseInt(this.duration),n=parseInt(e/60),i=e-60*n,n=n>9?n:"0"+n,i=i>9?i:"0"+i,a("#mins").html(n+":"+i),next(e))},!1)),0===a("#wdmapui").length&&(a("body").append('<div class="w3eden"><div style="display: none" class="wdmapui" id="wdmapui"><div id="wpdm_close_player"><svg style="width: 20px" data-name="Livello 1" viewBox="0 0 151.57 151.57" xmlns="http://www.w3.org/2000/svg"><circle cx="1038.5" cy="467.01" r="72.28" style="fill:#da2244;stroke:#f2f2f2;stroke-linecap:round;stroke-linejoin:round;stroke-width:7px" transform="translate(-988.78 479.89) rotate(-45)"/><line style="fill:#da2244;stroke:#f2f2f2;stroke-linecap:round;stroke-linejoin:round;stroke-width:7px" x1="47.57" x2="103.99" y1="103.99" y2="47.57"/><line style="fill:#da2244;stroke:#f2f2f2;stroke-linecap:round;stroke-linejoin:round;stroke-width:7px" x1="45.8" x2="105.7" y1="45.87" y2="105.77"/></svg></div><div class="card m-2"><div class="card-body text-center"><div class="mb-3 wpdm-audio-control-buttons d-block d-sm-none"><button class="btn btn-primary btn-play" id="wpdm-btn-play"><i class="fa fa-play"></i></button> <button class="btn btn-secondary btn-backward" id="wpdm-btn-backward"><i class="fa fa-backward"></i></button> <button class="btn btn-secondary btn-forward" id="wpdm-btn-forward"><i class="fa fa-forward"></i></button> <button class="btn btn-info btn-volumctrl" id="wpdm-btn-volumctrl"><i class="fa fa-volume-up"></i></button></div><div class="media"><div class="mr-3 wpdm-audio-control-buttons d-none d-sm-block"><button class="btn btn-primary btn-play" id="wpdm-btn-play"><i class="fa fa-play"></i></button> <button class="btn btn-secondary btn-backward" id="wpdm-btn-backward"><i class="fa fa-backward"></i></button> <button class="btn btn-secondary btn-forward" id="wpdm-btn-forward"><i class="fa fa-forward"></i></button></div><div class="media-body"><div class="position-relative"><div id="played">00:00</div><div id="mins">00:00</div></div><div class="progress"><div  id="wpdm-audio-progress" class="progress-bar bg-success" role="progressbar" style="width: 0%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div></div></div><div class="ml-3 wpdm-audio-control-buttons  d-none d-sm-block"> <button class="btn btn-info btn-volumctrl" id="wpdm-btn-volumctrl"><i class="fa fa-volume-up"></i></button> <div class="volumctrl"><input type="range" min="0" max="1" step="0.01" value="3" class="p-0" id="wpdm-audio-volume"></div></div></div></div></div></div></div>'),a("#wdmapui").slideDown(),a("#mins").html(n+":"+i),a("body").on("click","#wdmapui .progress",function(n){let i=100*n.offsetX/this.clientWidth;var o=parseInt(e*i/100),d=parseInt(o/60),s=o-60*d;d=d>9?d:"0"+d,s=s>9?s:"0"+s,a("#played").html(d+":"+s),t.currentTime=e*i/100,a(this).find(".progress-bar").css("width",i+"%")}),a("body").on("click",".btn-backward",function(){let n=parseInt(a("#wdmapui .progress-bar").css("width"))/parseInt(a("#wdmapui .progress").css("width"))*100-10;n<0&&(n=0);var i=parseInt(e*n/100),o=parseInt(i/60),d=i-60*o;o=o>9?o:"0"+o,d=d>9?d:"0"+d,a("#played").html(o+":"+d),t.currentTime=e*n/100,a("#wdmapui .progress-bar").css("width",n+"%")}),a("body").on("click",".btn-forward",function(){let n=parseInt(a("#wdmapui .progress-bar").css("width"))/parseInt(a("#wdmapui .progress").css("width"))*100+10;n>100&&(n=100);var i=parseInt(e*n/100),o=parseInt(i/60),d=i-60*o;o=o>9?o:"0"+o,d=d>9?d:"0"+d,a("#played").html(o+":"+d),t.currentTime=e*n/100,a("#wdmapui .progress-bar").css("width",n+"%")}),a("body").on("click",".btn-volumctrl",function(){a(this).next(".volumctrl").toggle()}),a("body").on("click",".btn-play",function(){a(this).find(".fa").hasClass("fa-play")?(a(this).find(".fa").addClass("fa-pause").removeClass("fa-play"),a(this).data("state","playing"),t.play()):(a(this).find(".fa").addClass("fa-play").removeClass("fa-pause"),a(this).data("state","paused"),t.pause())}),a("body").on("change","#wpdm-audio-volume",function(){t.volume=this.value})),a("#mins").html(n+":"+i),t.addEventListener("play",function(){a(".btn-play .fa").addClass("fa-pause").removeClass("fa-play")}),t.addEventListener("pause",function(){a(".btn-play .fa").addClass("fa-play").removeClass("fa-pause")}),t.addEventListener("timeupdate",function(e){var n=parseInt(t.duration),i=t.currentTime,o=i/n*100;o>100&&(o=100),a("#wpdm-audio-progress").css("width",o+"%");var d=parseInt(i),s=parseInt(d/60),l=d-60*s;s=s>9?s:"0"+s,l=l>9?l:"0"+l,a("#played").html(s+":"+l)})}};function _PopupCenter(t,e,n,i){var a=null!=window.screenLeft?window.screenLeft:screen.left,o=null!=window.screenTop?window.screenTop:screen.top,d=(window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width)/2-n/2+a,s=(window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height)/2-i/2+o,l=window.open(t,e,"scrollbars=yes, width="+n+", height="+i+", top="+s+", left="+d);return window.focus&&l.focus(),!1}function generatepass(t){wpdm_pass_target="#"+t,jQuery("#generatepass").modal("show")}function hideLockFrame(){jQuery("#wpdm-lock-frame").remove()}function wpdm_bootModal(t,e,n){return WPDM.bootAlert(t,e,n)}function wpdm_boot_popup(t,e,n){var i,a=jQuery;a("#w3eden__boot_popup").remove();var o="";return n&&(o='<div class="modal-footer" style="padding: 8px 15px;">\n',a.each(n,function(t,e){o+="<button id='"+("btx_"+t)+"' class='"+e.class+" btn-xs' style='font-size: 10px;padding: 3px 20px;'>"+e.label+"</button> "}),o+="</div>\n"),i='<div class="w3eden" id="w3eden__boot_popup"><div id="__boot_popup" style="z-index: 9999999 !important;" class="modal fade" tabindex="-1" role="dialog">\n  <div class="modal-dialog" role="document" style="max-width: 96%;width: 350px">\n    <div class="modal-content" style="border-radius: 3px;overflow: hidden">\n      <div class="modal-header" style="padding: 12px 15px;background: #f5f5f5;">\n        <h4 class="modal-title" style="font-size: 9pt;font-weight: 500;padding: 0;margin: 0;letter-spacing: 0.5px">'+t+'</h4>\n      </div>\n      <div class="modal-body text-center" style="letter-spacing: 0.5px;font-size: 10pt;font-weight: 300;padding: 25px;line-height: 1.5">\n        '+e+"\n      </div>\n"+o+"    </div>\n  </div>\n</div></div>",a("body").append(i),a("#__boot_popup").modal("show"),a.each(n,function(t,e){var n="btx_"+t;a("#"+n).unbind("click"),a("#"+n).bind("click",function(){return e.callback.call(a("#__boot_popup")),!1})}),a("#__boot_popup")}function wpdm_iframe_modal(t,e){var n,i=jQuery;if("close"===t)return i("#wpdm_iframe_modal").remove(),i("#ifcb").remove(),i("body").removeClass("wpdm-iframe-modal-open"),!1;var a="";void 0!==e&&!0===e&&(a="<span id='ifcb' class='w3eden'><a href='#' onclick='return wpdm_iframe_modal(\"close\");' style='border-radius: 0;position: fixed;top: 0;right: 0;z-index: 9999999999 !important;width: 40px;line-height: 40px;padding: 0' class='btn btn-danger'><i class='fas fa-times'></i></a></span>"),n='<iframe src="'+t+'" style="width: 100%;height: 100%;position: fixed;z-index: 999999999 !important;border: 0;left: 0;top: 0;right: 0;bottom: 0;background: rgba(0,0,0,0.2);display: none;" id="wpdm_iframe_modal"></iframe>'+a,i("body").append(n).addClass("wpdm-iframe-modal-open"),i("#wpdm_iframe_modal").fadeIn()}jQuery(function(t){var e=t("body");const n=localStorage.getItem("page_state_"+wpdm_url.page_code)||null,i=localStorage.getItem("page_state_container_"+wpdm_url.page_code)||null;n&&i&&t.get(n,function(e){t(i).html(t(e).find(i).html()),t(i).removeClass("blockui")}),e.on("click",".wpdm-notify, .wpdm-floatify",function(){t(this).animate({opacity:0},1e3,function(){t(this).slideUp()})}),e.on("click",".dismis-on-click",function(){t(this).slideUp()}),e.on("click",".wpdm-download-link.wpdm-download-locked",function(e){e.preventDefault(),hideLockFrame();var n=document.createElement("a");n.href=document.referrer.toString();var i="?";wpdm_url.home.indexOf("?")>0&&(i="&");let a="";void 0!==t(this).data("file")&&(a+="__wpdmfl="+t(this).data("file")),a+="&REFERRER="+encodeURIComponent(location.href).replace(/'/g,"%27"),n.hostname,window.location.hostname,t(window.parent.document.body).append("<iframe id='wpdm-lock-frame' style='left:0;top:0;width: 100%;height: 100%;z-index: 999999999;position: fixed;background: rgba(255,255,255,0.4) url("+wpdm_url.home+"wp-content/plugins/download-manager/assets/images/loader.svg) center center no-repeat;background-size: 80px 80px;border: 0;' src='"+wpdm_url.home+i+"__wpdmlo="+t(this).data("package")+"&"+a+"'></iframe>")}),e.on("click",".wpdm-download-link.download-on-click[data-downloadurl]",function(e){e.preventDefault(),"_blank"===this.target?window.open(t(this).data("downloadurl")):window.location.href=t(this).data("downloadurl")}),e.on("click",".__wpdm_playvideo",function(e){e.preventDefault(),t("#__wpdm_videoplayer").children("source").attr("src",t(this).data("video")),console.log("loading..."),document.getElementById("__wpdm_videoplayer").onloadeddata=function(){console.log("loaded....")},t("#__wpdm_videoplayer").get(0).load()}),e.on("change",".terms_checkbox",function(e){t(this).is(":checked")?t("#wpdm-filelist-"+t(this).data("pid")+" .btn.inddl, #xfilelist .btn.inddl").removeAttr("disabled"):t("#wpdm-filelist-"+t(this).data("pid")+" .btn.inddl, #xfilelist .btn.inddl").attr("disabled","disabled")}),e.on("click",".wpdm-social-lock",function(e){try{t(this).data("url")&&_PopupCenter(t(this).data("url"),"Social Lock",600,400)}catch(e){}}),e.on("click","#wdmds a.list-group-item",function(t){location.href=this.href});var a,o,d=t(".input-group input");d.on("focus",function(){t(this).parent(".input-group").find(".input-group-addon").addClass("input-group-addon-active")}),d.on("blur",function(){t(this).parent().find(".input-group-addon").removeClass("input-group-addon-active")}),e.on("click","button.btn.inddl",function(e){e.preventDefault();var n=this;void 0===t(this).data("dlurl")?t.post(wpdm_rest_url("validate-filepass"),{wpdmfileid:t(n).data("pid"),wpdmfile:t(n).data("file"),actioninddlpvr:1,filepass:t(t(n).data("pass")).val()},function(e){if(!0===e.success){var i=e.downloadurl;t(n).data("dlurl",i),wpdm_boot_popup(wpdm_strings.pass_var,"<div style='padding: 50px;'>"+wpdm_strings.pass_var_q+"<br/><br/><a href='"+i+"' class='btn btn-lg btn-success' target='_blank'>"+wpdm_strings.start_dl+"</a></div>",[{label:"Close",class:"btn btn-secondary",callback:function(){return t("#__boot_popup").modal("hide"),!1}}])}else alert(e.msg)}):location.href=t(this).data("dlurl")}),e.on("click",".wpdm-indir",function(e){e.preventDefault(),WPDM.blockUI("#xfilelist"),t("#xfilelist").load(location.href,{action:"wpdmfilelistcd",pid:t(this).data("pid"),cd:t(this).data("dir")},function(t){WPDM.unblockUI("#xfilelist")})}),e.on("click",".role-tabs a",function(e){t(".role-tabs a").removeClass("active"),t(this).addClass("active")}),e.on("click",".btn-wpdm-a2f",function(e){var n=t(this);t.post(wpdm_url.ajax,{action:"wpdm_addtofav",pid:t(this).data("package")},function(t){n.hasClass("btn-secondary")?n.removeClass("btn-secondary").addClass("btn-danger").html(n.data("rlabel")):n.removeClass("btn-danger").addClass("btn-secondary").html(n.data("alabel"))})}),e.on("click","#wpdm_close_player",function(e){t("#wdmapui").slideUp()}),e.on("click",".wpdm-btn-play",function(e){if(e.preventDefault(),0===t("#wpdm-audio-player").length){var n=document.createElement("audio");n.id="wpdm-audio-player",n.controls="controls",n.autoplay=1,n.type="audio/mpeg",t("body").append(n)}n=t("#wpdm-audio-player");var i=t(this);return"stop"!==i.data("state")&&i.data("state")||(n.css("display","none"),n.attr("src",t(this).data("song")+"&play=song.mp3")),"playing"===i.data("state")?(i.data("state","paused"),n.trigger("pause"),t(this).html("<i class='fa fa-play'></i>"),!1):"paused"===i.data("state")?(t(this).data("state","playing"),n.trigger("play"),t(".wpdm-btn-play").html("<i class='fa fa-play'></i>"),t(this).html("<i class='fa fa-pause'></i>"),t("#wdmapui").slideDown(),!1):(t(".wpdm-btn-play").data("state","stop"),t(".wpdm-btn-play").html("<i class='fa fa-play'></i>"),i.html("<i class='fas fa-sun  fa-spin'></i>"),n.unbind("loadedmetadata"),n.on("loadedmetadata",function(){console.log("Playing "+this.src+", for: "+this.duration+"seconds."),i.html("<i class='fa fa-pause'></i>"),i.data("state","playing"),WPDM.audioUI(this)}),void(document.getElementById("wpdm-audio-player").onended=function(){i.html("<i class='fa fa-redo'></i>"),i.data("state","stop")}))}),t(".wpdm_remove_empty").remove(),e.on("click",".wpdm-media-upload",function(e){e.preventDefault(),o=t(t(this).attr("rel")),a||(a=wp.media.frames.file_frame=wp.media({title:t(this).data("uploader_title"),button:{text:t(this).data("uploader_button_text")},multiple:!1})).on("select",function(){attachment=a.state().get("selection").first().toJSON(),o.val(attachment.url).trigger("change")}),a.open()}),e.on("click",".btn-image-selector",function(e){e.preventDefault(),o=t(t(this).attr("rel"));var n=t(t(this).attr("rel")+"_hidden");a||(a=wp.media.frames.file_frame=wp.media({title:t(this).data("uploader_title"),button:{text:t(this).data("uploader_button_text")},multiple:!1})).on("select",function(){attachment=a.state().get("selection").first().toJSON(),o.attr("src",attachment.url),n.val(attachment.url)}),a.open()}),e.on("click",".pagination.async a, .__wpdm_load_async",function(e){e.preventDefault();var n=t(this).data("container"),i=this.href;t(n).addClass("blockui"),localStorage.setItem("page_state_"+wpdm_url.page_code,i),localStorage.setItem("page_state_container_"+wpdm_url.page_code,n),t.get(i,function(e){t(n).html(t(e).find(n).html()),t(n).removeClass("blockui")})}),e.on("keyup",".wpdm-pack-search-file",function(){var e=t(this).val().toLowerCase(),n=t(this).data("filelist")+" tr";t(n).filter(function(){t(this).toggle(t(this).text().toLowerCase().indexOf(e)>-1)})}),t(document).on("click",".wpdm-filelist-toggle__btn",function(e){e.preventDefault();var n=t(this),i=n.closest(".wpdm-filelist-toggle"),a=i.data("target"),o=t(a),d=n.data("layout");i.find(".wpdm-filelist-toggle__btn").removeClass("active"),n.addClass("active"),"list"===d?o.addClass("wpdm-filelist-grid--list"):o.removeClass("wpdm-filelist-grid--list");try{localStorage.setItem("wpdm_filelist_layout",d)}catch(e){}}),t(function(){try{"list"===localStorage.getItem("wpdm_filelist_layout")&&t(".wpdm-filelist-toggle").each(function(){var e=t(this),n=e.data("target"),i=t(n);e.find(".wpdm-filelist-toggle__btn").removeClass("active"),e.find('[data-layout="list"]').addClass("active"),i.addClass("wpdm-filelist-grid--list")})}catch(t){}}),t(document).on("input",".wpdm-filelist-search__input",function(){var e=t(this).val().toLowerCase().trim(),n=t(this).data("filelist"),i=t(n).find(".wpdm-filelist-item, .wpdm-gallery__item");""!==e?i.each(function(){var n=t(this),i=n.data("filename")||"",a=n.find(".wpdm-filelist-item__title, .wpdm-gallery__title").text().toLowerCase();i.indexOf(e)>-1||a.indexOf(e)>-1?n.removeClass("wpdm-filelist-hidden"):n.addClass("wpdm-filelist-hidden")}):i.removeClass("wpdm-filelist-hidden")}),e.on("keydown",".wpdm-filelist-search__input",function(e){"Escape"===e.key&&t(this).val("").trigger("input")}),t("body").on("submit",".__wpdm_submit_async",function(e){e.preventDefault();var n=t(this).data("container");t(n).addClass("blockui"),t(this).ajaxSubmit({success:function(e){t(n).html(t(e).find(n).html()),t(n).removeClass("blockui")}})});var s=[];t(".wpdm-filelist-area[data-termlock]").on("mouseover",function(){try{if(1===s[t(this).data("packageid")])return}catch(t){}t("#term-panel-"+t(this).data("packageid")).fadeIn("fast")}),t(".terms_checkbox").on("click",function(){t(this).is(":checked")?(s[t(this).data("pid")]=1,t("#term-panel-"+t(this).data("pid")).fadeOut("fast"),t(".download_footer_"+t(this).data("pid")).slideDown()):t(".download_footer_"+t(this).data("pid")).slideUp()}),$formcontrol=t(".input-wrapper input"),$formcontrol.on("focus",function(){t(".input-wrapper").removeClass("input-focused"),t(this).parent(".input-wrapper").addClass("input-focused")}),$formcontrol.on("change",function(){t(".input-wrapper").removeClass("input-focused"),t(this).parent(".input-wrapper").addClass("input-focused"),""!==t(this).val()?t(this).parent(".input-wrapper").addClass("input-withvalue"):t(this).parent(".input-wrapper").removeClass("input-withvalue")})});
// source --> https://www.deinestadtklebt.de/wp-content/plugins/printshop/public/js/printshop-cookie-consent.js?ver=5.3.0-dsk 
/**
 * Printshop Cookie Consent Handler
 * Integrates with Complianz GDPR plugin for WordPress
 * 
 * Set logEnabled = true to enable debug logging to console
 * 
 * @since 1.0.0
 */

(function() {
    'use strict';

    const logEnabled = false;
    
    // Cookie consent configuration
    window.document.obilityConsentCookieConfig = {
        options: [],
    };

    // Initialize consent management
    function initCookieConsent() {
        // Hide cookie consent initially
        window.document.body.dispatchEvent(new Event("hideCookieConsent"));
        
        // Initialize consent values from existing cookies
        window.cvalue = JSON.parse(getCookie());
    }

    /**
     * Get cookie consent data
     * @returns {string} JSON string of consent data or empty array
     */
    function getCookie() {
        const name = "obility_cookie_consent" + "=";
        if (document.cookie) {
            const ca = document.cookie.split(";");
            for (let i = 0; i < ca.length; i++) {
                let c = ca[i];
                while (c.charAt(0) === " ") {
                    c = c.substring(1);
                }
                if (c.indexOf(name) === 0) {
                    return c.substring(name.length, c.length);
                }
            }
        }
        return "[]";
    }

    /**
     * Set consent item and update cookie
     * @param {string} id - Consent item ID
     * @param {boolean} value - Consent value
     * @param {number} category - Cookie category
     */
    function setConsentItem(id, value, category) {
        const d = new Date();
        d.setTime(d.getTime() + 365 * 24 * 60 * 60 * 1000); // 1 year expiry
        const expires = "expires=" + d.toUTCString();
        const path = "path=/";

        // Update or add consent item
        const pos = window.cvalue.findIndex((el) => el.id === id);
        if (pos >= 0) {
            window.cvalue.splice(pos, 1);
        }
        window.cvalue.push({ id: id, value: value, category: category });
        
        // Save to cookie
        document.cookie = "obility_cookie_consent" + "=" + JSON.stringify(window.cvalue) + ";" + expires + ";" + path;
        
        // Dispatch hide event
        document.body.dispatchEvent(new Event("hideCookieConsent"));
        
        logEnabled && console.log('Printshop: Consent updated for ' + id + ':', value);
    }

    /**
     * Handle Complianz GDPR consent events (using actual Complianz events)
     */
    function setupComplianzListener() {
        // Listen for the main Complianz cookie banner data event
        document.addEventListener('cmplz_cookie_banner_data', function(event) {
            logEnabled && console.log('Printshop: cmplz_cookie_banner_data event:', event);
            
            if (event.detail) {
                // This event fires when the banner is loaded with all the config data
                logEnabled && console.log('Printshop: Complianz data loaded:', event.detail);
                
                // Check initial consent status
                checkInitialConsentComplianz();
            }
        });

        // Listen for consent status changes
        document.addEventListener('cmplz_status_change', function(event) {
            logEnabled && console.log('Printshop: cmplz_status_change event:', event);
            
            if (event.detail) {
                const category = event.detail.category;
                const value = event.detail.value;
                const consentStatus = value === 'allow';
                
                logEnabled && console.log('Printshop: Consent changed for category', category, ':', consentStatus);
                
                // Map Complianz categories to your consent items
                switch (category) {
                    case 'marketing':
                        setConsentItem("gtm", consentStatus, 3);      // Google Tag Manager
                        setConsentItem("ts", consentStatus, 3);       // Trusted Shops
                        break;
                    case 'functional':
                        setConsentItem("recap", consentStatus, 2);    // reCaptcha
                        break;
                    case 'statistics':
                        // Add statistics tracking consent if needed
                        // setConsentItem("analytics", consentStatus, 3);
                        break;
                    case 'preferences':
                        // Add preferences consent if needed
                        // setConsentItem("preferences", consentStatus, 1);
                        break;
                    default:
                        logEnabled && console.log('Printshop: Unknown consent category:', category);
                }
            }
        });

        // Listen for service-specific consent changes
        document.addEventListener('cmplz_status_change_service', function(event) {
            logEnabled && console.log('Printshop: cmplz_status_change_service event:', event);
            
            if (event.detail) {
                const service = event.detail.service;
                const value = event.detail.value;
                const consentStatus = value === true || value === 'allow';
                
                logEnabled && console.log('Printshop: Service consent changed for', service, ':', consentStatus);
                
                // Map specific services if needed
                switch (service) {
                    case 'google-tag-manager':
                    case 'gtm':
                        setConsentItem("gtm", consentStatus, 3);
                        break;
                    case 'trusted-shops':
                    case 'trustedshops':
                        setConsentItem("ts", consentStatus, 3);
                        break;
                    case 'recaptcha':
                    case 'google-recaptcha':
                        setConsentItem("recap", consentStatus, 2);
                        break;
                    default:
                        logEnabled && console.log('Printshop: Unknown service:', service);
                }
            }
        });

        // Listen for categories fire event (when categories are enabled)
        document.addEventListener('cmplz_fire_categories', function(event) {
            logEnabled && console.log('Printshop: cmplz_fire_categories event:', event);
            
            if (event.detail && event.detail.categories) {
                const categories = event.detail.categories;
                
                // Update consent based on accepted categories
                const hasMarketing = categories.includes('marketing');
                const hasFunctional = categories.includes('functional');
                const hasStatistics = categories.includes('statistics');
                
                setConsentItem("gtm", hasMarketing, 3);
                setConsentItem("ts", hasMarketing, 3);
                setConsentItem("recap", hasFunctional, 2);
                
                logEnabled && console.log('Printshop: Updated consent from categories:', {
                    marketing: hasMarketing,
                    functional: hasFunctional,
                    statistics: hasStatistics
                });
            }
        });

        // Listen for revoke events
        document.addEventListener('cmplz_revoke', function(event) {
            logEnabled && console.log('Printshop: cmplz_revoke event:', event);
            
            // Set all consent items to false when consent is revoked
            setConsentItem("gtm", false, 3);
            setConsentItem("ts", false, 3);
            setConsentItem("recap", false, 2);
            
            logEnabled && console.log('Printshop: All consent revoked');
        });

        // Check if Complianz functions are available immediately
        if (typeof window.cmplz_has_consent === 'function') {
            logEnabled && console.log('Printshop: Complianz functions already available');
            checkInitialConsentComplianz();
        }
    }

    /**
     * Check initial consent status using Complianz functions
     */
    function checkInitialConsentComplianz() {
        if (typeof window.cmplz_has_consent === 'function') {
            // Check marketing consent (GTM, Trusted Shops)
            const marketingConsent = window.cmplz_has_consent('marketing');
            setConsentItem("gtm", marketingConsent, 3);
            setConsentItem("ts", marketingConsent, 3);
            logEnabled && console.log('Printshop: Initial marketing consent:', marketingConsent);

            // Check functional consent (reCaptcha)
            const functionalConsent = window.cmplz_has_consent('functional');
            setConsentItem("recap", functionalConsent, 2);
            logEnabled && console.log('Printshop: Initial functional consent:', functionalConsent);

            // Check other categories as needed
            const statisticsConsent = window.cmplz_has_consent('statistics');
            logEnabled && console.log('Printshop: Initial statistics consent:', statisticsConsent);

            const preferencesConsent = window.cmplz_has_consent('preferences');
            logEnabled && console.log('Printshop: Initial preferences consent:', preferencesConsent);
        } else {
            logEnabled && console.warn('Printshop: Complianz functions not available');
        }
    }

    /**
     * Fallback listener for WP Consent API and other legacy systems
     */
    function setupFallbackListener() {
        // WP Consent API support (as fallback if direct Complianz events don't work)
        document.addEventListener('wp_consent_type_defined', function() {
            logEnabled && console.log('Printshop: WP Consent API defined as fallback, consent type:', window.wp_consent_type);
            
            // Check initial consent status for all categories
            checkInitialConsentWP();
        });

        // Listen for WP Consent API changes
        document.addEventListener("wp_listen_for_consent_change", function (event) {
            logEnabled && console.log('Printshop: WP Consent API consent change event (fallback):', event);
            
            if (event.detail) {
                const changedConsent = event.detail;
                
                // Process each consent category that changed
                for (const category in changedConsent) {
                    if (changedConsent.hasOwnProperty(category)) {
                        const consentStatus = changedConsent[category] === 'allow';
                        logEnabled && console.log('Printshop: WP API consent changed for category', category, ':', consentStatus);
                        
                        // Map WP Consent API categories to your consent items
                        switch (category) {
                            case 'marketing':
                                setConsentItem("gtm", consentStatus, 3);
                                setConsentItem("ts", consentStatus, 3);
                                break;
                            case 'functional':
                                setConsentItem("recap", consentStatus, 2);
                                break;
                            case 'statistics':
                                // setConsentItem("analytics", consentStatus, 3);
                                break;
                            case 'preferences':
                                // setConsentItem("preferences", consentStatus, 1);
                                break;
                        }
                    }
                }
            }
        });

        // Legacy cmplz_cookie_data events (very old Complianz versions)
        document.addEventListener('cmplz_cookie_data', function(event) {
            logEnabled && console.log('Printshop: Legacy cmplz_cookie_data event:', event);
            
            if (event.detail) {
                const consentData = event.detail;
                
                // Process consent data based on categories
                if (consentData.marketing !== undefined) {
                    setConsentItem("gtm", consentData.marketing, 3);
                    setConsentItem("ts", consentData.marketing, 3);
                    logEnabled && console.log('Printshop: Legacy marketing consent:', consentData.marketing);
                }
                
                if (consentData.functional !== undefined) {
                    setConsentItem("recap", consentData.functional, 2);
                    logEnabled && console.log('Printshop: Legacy functional consent:', consentData.functional);
                }
                
                logEnabled && console.log('Printshop: Consent updated from legacy cmplz_cookie_data');
            }
        });

        // Very old UC_UI_CMP_EVENT events (if still present)
        window.addEventListener("UC_UI_CMP_EVENT", function (event) {
            logEnabled && console.log('Printshop: Legacy UC_UI_CMP_EVENT event:', event);

            if (event.detail && event.detail.type) {
                switch (event.detail.type) {
                    case "DENY_ALL":
                        logEnabled && console.log('Printshop: Processing legacy DENY_ALL event');
                        setConsentItem("gtm", false, 3);
                        setConsentItem("ts", false, 3);
                        setConsentItem("recap", false, 2);
                        break;

                    case "ACCEPT_ALL":
                        logEnabled && console.log('Printshop: Processing legacy ACCEPT_ALL event');
                        setConsentItem("gtm", true, 3);
                        setConsentItem("ts", true, 3);
                        setConsentItem("recap", true, 2);
                        break;

                    default:
                        logEnabled && console.log('Printshop: Unknown legacy consent event type:', event.detail.type);
                }
            }
        });

        // Borlabs Cookie event listeners
        setupBorlabsListener();

        // Check if WP Consent API functions are available immediately
        if (typeof window.wp_has_consent === 'function') {
            logEnabled && console.log('Printshop: WP Consent API already available as fallback');
            checkInitialConsentWP();
        }
    }

    /**
     * Check initial consent status using WP Consent API (fallback)
     */
    function checkInitialConsentWP() {
        if (typeof window.wp_has_consent === 'function') {
            // Check marketing consent (GTM, Trusted Shops)
            const marketingConsent = window.wp_has_consent('marketing');
            if (marketingConsent !== null) {
                setConsentItem("gtm", marketingConsent, 3);
                setConsentItem("ts", marketingConsent, 3);
                logEnabled && console.log('Printshop: WP API initial marketing consent:', marketingConsent);
            }

            // Check functional consent (reCaptcha)
            const functionalConsent = window.wp_has_consent('functional');
            if (functionalConsent !== null) {
                setConsentItem("recap", functionalConsent, 2);
                logEnabled && console.log('Printshop: WP API initial functional consent:', functionalConsent);
            }
        }
    }

    /**
     * Borlabs Cookie event listeners
     * Handles consent events from Borlabs Cookie plugin
     */
    function setupBorlabsListener() {
        // Listen for Borlabs Cookie consent changes
        document.addEventListener('borlabs-cookie-consent-saved', function(event) {
            logEnabled && console.log('Printshop: borlabs-cookie-consent-saved event:', event);
            
            if (event.detail && event.detail.consents) {
                const consents = event.detail.consents;
                
                // Map Borlabs consent groups to our consent items
                // Common Borlabs group IDs: essential, statistics, marketing, external-media
                const marketingConsent = consents.marketing === true;
                const statisticsConsent = consents.statistics === true;
                const externalMediaConsent = consents['external-media'] === true;
                const functionalConsent = consents.essential === true || consents.functional === true;
                
                // Update consent items based on Borlabs groups
                setConsentItem("gtm", marketingConsent, 3);      // Google Tag Manager
                setConsentItem("ts", marketingConsent, 3);       // Trusted Shops
                setConsentItem("recap", functionalConsent, 2);   // reCaptcha
                
                logEnabled && console.log('Printshop: Updated consent from Borlabs:', {
                    marketing: marketingConsent,
                    statistics: statisticsConsent,
                    externalMedia: externalMediaConsent,
                    functional: functionalConsent
                });
            }
        });

        // Listen for individual Borlabs service consent changes
        document.addEventListener('borlabs-cookie-service-consent-changed', function(event) {
            logEnabled && console.log('Printshop: borlabs-cookie-service-consent-changed event:', event);
            
            if (event.detail) {
                const serviceId = event.detail.serviceId;
                const consent = event.detail.consent === true;
                
                logEnabled && console.log('Printshop: Borlabs service consent changed for', serviceId, ':', consent);
                
                // Map specific Borlabs services to our consent items
                switch (serviceId) {
                    case 'google-tag-manager':
                    case 'gtm':
                        setConsentItem("gtm", consent, 3);
                        break;
                    case 'trusted-shops':
                    case 'trustedshops':
                        setConsentItem("ts", consent, 3);
                        break;
                    case 'recaptcha':
                    case 'google-recaptcha':
                        setConsentItem("recap", consent, 2);
                        break;
                    default:
                        logEnabled && console.log('Printshop: Unknown Borlabs service:', serviceId);
                }
            }
        });

        // Listen for Borlabs group consent changes
        document.addEventListener('borlabs-cookie-group-consent-changed', function(event) {
            logEnabled && console.log('Printshop: borlabs-cookie-group-consent-changed event:', event);
            
            if (event.detail) {
                const groupId = event.detail.groupId;
                const consent = event.detail.consent === true;
                
                logEnabled && console.log('Printshop: Borlabs group consent changed for', groupId, ':', consent);
                
                // Map Borlabs consent groups to our consent items
                switch (groupId) {
                    case 'marketing':
                        setConsentItem("gtm", consent, 3);
                        setConsentItem("ts", consent, 3);
                        break;
                    case 'statistics':
                    case 'analytics':
                        // Add statistics tracking consent if needed
                        // setConsentItem("analytics", consent, 3);
                        break;
                    case 'essential':
                    case 'functional':
                        setConsentItem("recap", consent, 2);
                        break;
                    case 'external-media':
                        // Add external media consent if needed
                        // setConsentItem("external-media", consent, 2);
                        break;
                    default:
                        logEnabled && console.log('Printshop: Unknown Borlabs group:', groupId);
                }
            }
        });

        // Listen for Borlabs "accept all" events
        document.addEventListener('borlabs-cookie-consent-accept-all', function(event) {
            logEnabled && console.log('Printshop: borlabs-cookie-consent-accept-all event:', event);
            
            // Set all consent items to true when "accept all" is clicked
            setConsentItem("gtm", true, 3);
            setConsentItem("ts", true, 3);
            setConsentItem("recap", true, 2);
            
            logEnabled && console.log('Printshop: All Borlabs consent accepted');
        });

        // Listen for Borlabs "refuse all" events
        document.addEventListener('borlabs-cookie-consent-refuse-all', function(event) {
            logEnabled && console.log('Printshop: borlabs-cookie-consent-refuse-all event:', event);
            
            // Set all consent items to false when "refuse all" is clicked
            setConsentItem("gtm", false, 3);
            setConsentItem("ts", false, 3);
            setConsentItem("recap", false, 2);
            
            logEnabled && console.log('Printshop: All Borlabs consent refused');
        });

        // Listen for Borlabs Cookie initialization
        document.addEventListener('borlabs-cookie-after-init', function(event) {
            logEnabled && console.log('Printshop: borlabs-cookie-after-init event:', event);
            
            // Borlabs Cookie is now fully initialized, check initial consent status
            checkInitialConsentBorlabs();
            
            logEnabled && console.log('Printshop: Borlabs Cookie initialized, checked initial consent');
        });

        // Check initial Borlabs consent status if available
        checkInitialConsentBorlabs();
    }

    /**
     * Check initial consent status using Borlabs Cookie functions
     */
    function checkInitialConsentBorlabs() {
        // Check if Borlabs Cookie v3 API is available
        if (typeof window.BorlabsCookie !== 'undefined' && 
            window.BorlabsCookie.Consents && 
            typeof window.BorlabsCookie.Consents.hasConsentForServiceGroup === 'function') {
            
            logEnabled && console.log('Printshop: Borlabs Cookie v3 API detected, checking initial consent');
            
            try {
                // Check marketing consent (GTM, Trusted Shops)
                const marketingConsent = window.BorlabsCookie.Consents.hasConsentForServiceGroup('marketing');
                if (marketingConsent !== null) {
                    setConsentItem("gtm", marketingConsent, 3);
                    setConsentItem("ts", marketingConsent, 3);
                    logEnabled && console.log('Printshop: Borlabs v3 initial marketing consent:', marketingConsent);
                }

                // Check essential/functional consent (reCaptcha)
                let functionalConsent = window.BorlabsCookie.Consents.hasConsentForServiceGroup('essential');
                if (functionalConsent === null || functionalConsent === false) {
                    // Try 'functional' group as fallback
                    functionalConsent = window.BorlabsCookie.Consents.hasConsentForServiceGroup('functional');
                }
                if (functionalConsent !== null) {
                    setConsentItem("recap", functionalConsent, 2);
                    logEnabled && console.log('Printshop: Borlabs v3 initial functional consent:', functionalConsent);
                }

                // Check statistics consent (if needed)
                const statisticsConsent = window.BorlabsCookie.Consents.hasConsentForServiceGroup('statistics');
                logEnabled && console.log('Printshop: Borlabs v3 initial statistics consent:', statisticsConsent);

                // Check external-media consent (if needed)
                const externalMediaConsent = window.BorlabsCookie.Consents.hasConsentForServiceGroup('external-media');
                logEnabled && console.log('Printshop: Borlabs v3 initial external-media consent:', externalMediaConsent);

                // Also check specific services if available
                if (typeof window.BorlabsCookie.Consents.hasConsent === 'function') {
                    // Check specific services for more granular control
                    try {
                        const gtmConsent = window.BorlabsCookie.Consents.hasConsent('google-tag-manager');
                        if (gtmConsent !== null) {
                            setConsentItem("gtm", gtmConsent, 3);
                            logEnabled && console.log('Printshop: Borlabs v3 GTM service consent:', gtmConsent);
                        }

                        const trustedShopsConsent = window.BorlabsCookie.Consents.hasConsent('trusted-shops');
                        if (trustedShopsConsent !== null) {
                            setConsentItem("ts", trustedShopsConsent, 3);
                            logEnabled && console.log('Printshop: Borlabs v3 Trusted Shops service consent:', trustedShopsConsent);
                        }

                        const recaptchaConsent = window.BorlabsCookie.Consents.hasConsent('recaptcha');
                        if (recaptchaConsent !== null) {
                            setConsentItem("recap", recaptchaConsent, 2);
                            logEnabled && console.log('Printshop: Borlabs v3 reCaptcha service consent:', recaptchaConsent);
                        }
                    } catch (serviceError) {
                        logEnabled && console.warn('Printshop: Error checking Borlabs v3 service consent:', serviceError);
                    }
                }

            } catch (error) {
                logEnabled && console.warn('Printshop: Error checking Borlabs v3 initial consent:', error);
            }
        } else if (typeof window.borlabsCookieConfig !== 'undefined') {
            // Alternative method for older Borlabs versions (v2)
            logEnabled && console.log('Printshop: Borlabs config detected (legacy v2), checking consent');
            
            try {
                const config = window.borlabsCookieConfig;
                if (config && config.consent) {
                    const consent = config.consent;
                    
                    // Map consent based on available data
                    if (consent.marketing !== undefined) {
                        setConsentItem("gtm", consent.marketing, 3);
                        setConsentItem("ts", consent.marketing, 3);
                        logEnabled && console.log('Printshop: Borlabs legacy marketing consent:', consent.marketing);
                    }
                    
                    if (consent.essential !== undefined || consent.functional !== undefined) {
                        const functionalConsent = consent.essential || consent.functional;
                        setConsentItem("recap", functionalConsent, 2);
                        logEnabled && console.log('Printshop: Borlabs legacy functional consent:', functionalConsent);
                    }
                }
            } catch (error) {
                logEnabled && console.warn('Printshop: Error checking Borlabs legacy consent:', error);
            }
        } else {
            logEnabled && console.log('Printshop: Borlabs Cookie not detected or not yet initialized');
        }
    }

    /**
     * Get current consent status for a specific item
     * @param {string} id - Consent item ID
     * @returns {boolean|null} Consent status or null if not found
     */
    function getConsentStatus(id) {
        const item = window.cvalue.find(el => el.id === id);
        return item ? item.value : null;
    }

    /**
     * Expose public API for other scripts
     */
    window.ObilityPrintshopConsent = {
        getConsentStatus: getConsentStatus,
        setConsentItem: setConsentItem,
        getCookie: getCookie
    };

    // Initialize when DOM is ready
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', function() {
            initCookieConsent();
            setupComplianzListener();
            setupFallbackListener();
        });
    } else {
        initCookieConsent();
        setupComplianzListener();
        setupFallbackListener();
    }

})();