var t;let e="*";"undefined"!=typeof __DEV__&&__DEV__&&(e=sessionStorage.getItem("ctc_debug")||"*",window.ctcDebug=t=>{e="string"==typeof t?t:"*",sessionStorage.setItem("ctc_debug",e)}),"undefined"!=typeof __DEV__&&__DEV__;const o=["__proto__","prototype","constructor","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],n=t=>"string"==typeof t&&t.length>0&&/^[a-zA-Z0-9_-]+$/.test(t)&&!o.includes(t),c=("undefined"!=typeof document&&document.createElement("div"),"undefined"!=typeof DOMParser&&new DOMParser,"undefined"!=typeof document&&document.createElement("textarea"),(t,e,o)=>!(!t||"object"!=typeof t||!n(e)||!Object.prototype.hasOwnProperty.call(t,e)&&e in t||(t[e]=o,0)));window.ht_ctc_admin_var,null===(t=window.ht_ctc_admin_var)||void 0===t||null===(t=t.initialSettings)||void 0===t||t.ht_ctc_chat_options;let r=!1;const a={clearPluginFieldsLocalStorage:()=>{let t=0;for(let e=localStorage.length-1;e>=0;e--){const o=localStorage.key(e);o&&o.startsWith("ht_ctc_")&&(localStorage.removeItem(o),t++)}document.dispatchEvent(new CustomEvent("ht_ctc_show_toast",{detail:{title:"Success",description:`Cleared ${t} cached items. Refreshing page...`,iconClass:"dashicons dashicons-yes-alt",iconColor:"green"}})),setTimeout(()=>{window.location.reload()},1500)},updateNotificationBadgeLS:()=>{(t=>{try{if(["__proto__","constructor","prototype"].includes(t))return;if(!/^[a-zA-Z0-9_-]+$/.test(t))return;const e="ht_ctc_storage";let o={};const n=localStorage.getItem(e);if(n)try{o=JSON.parse(n)}catch(t){o={}}("object"!=typeof o||null===o||Array.isArray(o))&&(o={}),c(o,t,"admin_start"),localStorage.setItem(e,JSON.stringify(o))}catch(t){}})("n_badge")}},i=(t,e)=>{document.addEventListener(t,o=>{const c=o.target.closest(`[${e}]`);if(!c)return;const r=c.getAttribute(e),i=function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return t&&"object"==typeof t&&n(e)&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:o}(a,r);"function"==typeof i&&("click"===t&&o.preventDefault(),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Feature";try{return t(),!0}catch(t){return document.dispatchEvent(new CustomEvent("ht_ctc_error",{detail:{context:e,error:t}})),!1}}(()=>i(o,c),`Action: ${r}`))})},_=()=>{r||(r=!0,i("click","data-action-onclick"),i("change","data-action-onchange"))};export{_ as initActions};