%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/admin/remote-logging/
Upload File :
Create Path :
Current File : /home/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/admin/remote-logging/index.js

/*! For license information please see index.js.LICENSE.txt */
(()=>{var e={13253:(e,n,t)=>{n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let r=0,o=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))})),n.splice(o,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=t(22988)(n);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},22988:(e,n,t)=>{e.exports=function(e){function n(e){let t,o,i,s=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),i=o-(t||o);r.diff=i,r.prev=t,r.curr=o,t=o,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,o)=>{if("%%"===t)return"%";s++;const i=n.formatters[o];if("function"==typeof i){const n=e[s];t=i.call(r,n),e.splice(s,1),s--}return t})),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return a.namespace=e,a.useColors=n.useColors(),a.color=n.selectColor(e),a.extend=r,a.destroy=n.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==n.namespaces&&(o=n.namespaces,i=n.enabled(e)),i),set:e=>{s=e}}),"function"==typeof n.init&&n.init(a),a}function r(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){const e=[...n.names.map(o),...n.skips.map(o).map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.namespaces=e,n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(t=0;t<o;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.slice(1)+"$")):n.names.push(new RegExp("^"+e+"$")))},n.enabled=function(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=t(44247),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n}},44247:e=>{var n=1e3,t=60*n,r=60*t,o=24*r;function i(e,n,t,r){var o=n>=1.5*t;return Math.round(e/t)+" "+r+(o?"s":"")}e.exports=function(e,s){s=s||{};var a,c,l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(i){var s=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*r;case"minutes":case"minute":case"mins":case"min":case"m":return s*t;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===l&&isFinite(e))return s.long?(a=e,(c=Math.abs(a))>=o?i(a,c,o,"day"):c>=r?i(a,c,r,"hour"):c>=t?i(a,c,t,"minute"):c>=n?i(a,c,n,"second"):a+" ms"):function(e){var i=Math.abs(e);return i>=o?Math.round(e/o)+"d":i>=r?Math.round(e/r)+"h":i>=t?Math.round(e/t)+"m":i>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},62763:(e,n,t)=>{var r,o,i;!function(t,s){if(t){var a={},c=t.TraceKit,l=[].slice,u="?",f=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;a.noConflict=function(){return t.TraceKit=c,a},a.wrap=function(e){return function(){try{return e.apply(this,arguments)}catch(e){throw a.report(e),e}}},a.report=function(){var e,n,r,o,i=[],s=null,c=null;function l(e,n,t){var r=null;if(!n||a.collectWindowErrors){for(var o in i)if(d(i,o))try{i[o](e,n,t)}catch(e){r=e}if(r)throw r}}function u(n,t,r,o,i){if(c)a.computeStackTrace.augmentStackTraceWithInitialElement(c,t,r,n),m();else if(i)l(a.computeStackTrace(i),!0,i);else{var s,u={url:t,line:r,column:o},d=n;if("[object String]"==={}.toString.call(n)){var g=n.match(f);g&&(s=g[1],d=g[2])}u.func=a.computeStackTrace.guessFunctionName(u.url,u.line),u.context=a.computeStackTrace.gatherContext(u.url,u.line),l({name:s,message:d,mode:"onerror",stack:[u]},!0,null)}return!!e&&e.apply(this,arguments)}function g(e){l(a.computeStackTrace(e.reason),!0,e.reason)}function m(){var e=c,n=s;c=null,s=null,l(e,!1,n)}function p(e){if(c){if(s===e)return;m()}var n=a.computeStackTrace(e);throw c=n,s=e,setTimeout((function(){s===e&&m()}),n.incomplete?2e3:0),e}return p.subscribe=function(s){!0!==n&&(e=t.onerror,t.onerror=u,n=!0),!0!==o&&(r=t.onunhandledrejection,t.onunhandledrejection=g,o=!0),i.push(s)},p.unsubscribe=function(s){for(var a=i.length-1;a>=0;--a)i[a]===s&&i.splice(a,1);0===i.length&&(n&&(t.onerror=e,n=!1),o&&(t.onunhandledrejection=r,o=!1))},p}(),a.computeStackTrace=function(){var e=!1,n={};function r(e){if("string"!=typeof e)return[];if(!d(n,e)){var r="",o="";try{o=t.document.domain}catch(e){}var i=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(e);i&&i[2]===o&&(r=function(e){if(!a.remoteFetching)return"";try{var n=function(){try{return new t.XMLHttpRequest}catch(e){return new t.ActiveXObject("Microsoft.XMLHTTP")}}();return n.open("GET",e,!1),n.send(""),n.responseText}catch(e){return""}}(e)),n[e]=r?r.split("\n"):[]}return n[e]}function o(e,n){var t,o=/function ([^(]*)\(([^)]*)\)/,i=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,s="",a=r(e);if(!a.length)return u;for(var c=0;c<10;++c)if(!g(s=a[n-c]+s)){if(t=i.exec(s))return t[1];if(t=o.exec(s))return t[1]}return u}function i(e,n){var t=r(e);if(!t.length)return null;var o=[],i=Math.floor(a.linesOfContext/2),s=i+a.linesOfContext%2,c=Math.max(0,n-i-1),l=Math.min(t.length,n+s-1);n-=1;for(var u=c;u<l;++u)g(t[u])||o.push(t[u]);return o.length>0?o:null}function s(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function c(e){return s(e).replace("<","(?:<|&lt;)").replace(">","(?:>|&gt;)").replace("&","(?:&|&amp;)").replace('"','(?:"|&quot;)').replace(/\s+/g,"\\s+")}function l(e,n){for(var t,o,i=0,s=n.length;i<s;++i)if((t=r(n[i])).length&&(t=t.join("\n"),o=e.exec(t)))return{url:n[i],line:t.substring(0,o.index).split("\n").length,column:o.index-t.lastIndexOf("\n",o.index)-1};return null}function f(e,n,t){var o,i=r(n),a=new RegExp("\\b"+s(e)+"\\b");return t-=1,i&&i.length>t&&(o=a.exec(i[t]))?o.index:null}function m(e){if(!g(t&&t.document)){for(var n,r,o,i,a=[t.location.href],u=t.document.getElementsByTagName("script"),f=""+e,d=0;d<u.length;++d){var m=u[d];m.src&&a.push(m.src)}if(o=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(f)){var p=o[1]?"\\s+"+o[1]:"",h=o[2].split(",").join("\\s*,\\s*");n=s(o[3]).replace(/;$/,";?"),r=new RegExp("function"+p+"\\s*\\(\\s*"+h+"\\s*\\)\\s*{\\s*"+n+"\\s*}")}else r=new RegExp(s(f).replace(/\s+/g,"\\s+"));if(i=l(r,a))return i;if(o=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(f)){var w=o[1];if(n=c(o[2]),i=l(r=new RegExp("on"+w+"=[\\'\"]\\s*"+n+"\\s*[\\'\"]","i"),a[0]))return i;if(i=l(r=new RegExp(n),a))return i}return null}}function p(e){if(!e.stack)return null;for(var n,t,r,s=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,c=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,l=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,d=/\((\S*)(?::(\d+))(?::(\d+))\)/,m=e.stack.split("\n"),p=[],h=/^(.*) is undefined$/.exec(e.message),w=0,C=m.length;w<C;++w){if(t=s.exec(m[w])){var y=t[2]&&0===t[2].indexOf("native");t[2]&&0===t[2].indexOf("eval")&&(n=d.exec(t[2]))&&(t[2]=n[1],t[3]=n[2],t[4]=n[3]),r={url:y?null:t[2],func:t[1]||u,args:y?[t[2]]:[],line:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}else if(t=c.exec(m[w]))r={url:t[2],func:t[1]||u,args:[],line:+t[3],column:t[4]?+t[4]:null};else{if(!(t=a.exec(m[w])))continue;t[3]&&t[3].indexOf(" > eval")>-1&&(n=l.exec(t[3]))?(t[3]=n[1],t[4]=n[2],t[5]=null):0!==w||t[5]||g(e.columnNumber)||(p[0].column=e.columnNumber+1),r={url:t[3],func:t[1]||u,args:t[2]?t[2].split(","):[],line:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}!r.func&&r.line&&(r.func=o(r.url,r.line)),r.context=r.line?i(r.url,r.line):null,p.push(r)}return p.length?(p[0]&&p[0].line&&!p[0].column&&h&&(p[0].column=f(h[1],p[0].url,p[0].line)),{mode:"stack",name:e.name,message:e.message,stack:p}):null}function h(e,n,t,r){var s={url:n,line:t};if(s.url&&s.line){e.incomplete=!1,s.func||(s.func=o(s.url,s.line)),s.context||(s.context=i(s.url,s.line));var a=/ '([^']+)' /.exec(r);if(a&&(s.column=f(a[1],s.url,s.line)),e.stack.length>0&&e.stack[0].url===s.url){if(e.stack[0].line===s.line)return!1;if(!e.stack[0].line&&e.stack[0].func===s.func)return e.stack[0].line=s.line,e.stack[0].context=s.context,!1}return e.stack.unshift(s),e.partial=!0,!0}return e.incomplete=!0,!1}function w(e,n){for(var t,r,i,s=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,c=[],l={},d=!1,g=w.caller;g&&!d;g=g.caller)if(g!==C&&g!==a.report){if(r={url:null,func:u,args:[],line:null,column:null},g.name?r.func=g.name:(t=s.exec(g.toString()))&&(r.func=t[1]),void 0===r.func)try{r.func=t.input.substring(0,t.input.indexOf("{"))}catch(e){}if(i=m(g)){r.url=i.url,r.line=i.line,r.func===u&&(r.func=o(r.url,r.line));var p=/ '([^']+)' /.exec(e.message||e.description);p&&(r.column=f(p[1],i.url,i.line))}l[""+g]?d=!0:l[""+g]=!0,c.push(r)}n&&c.splice(0,n);var y={mode:"callers",name:e.name,message:e.message,stack:c};return h(y,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),y}function C(n,s){var a=null;s=null==s?0:+s;try{if(a=function(e){var n=e.stacktrace;if(n){for(var t,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,s=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,a=n.split("\n"),c=[],l=0;l<a.length;l+=2){var u=null;if((t=r.exec(a[l]))?u={url:t[2],line:+t[1],column:null,func:t[3],args:[]}:(t=s.exec(a[l]))&&(u={url:t[6],line:+t[1],column:+t[2],func:t[3]||t[4],args:t[5]?t[5].split(","):[]}),u){if(!u.func&&u.line&&(u.func=o(u.url,u.line)),u.line)try{u.context=i(u.url,u.line)}catch(e){}u.context||(u.context=[a[l+1]]),c.push(u)}}return c.length?{mode:"stacktrace",name:e.name,message:e.message,stack:c}:null}}(n),a)return a}catch(n){if(e)throw n}try{if(a=p(n))return a}catch(n){if(e)throw n}try{if(a=function(e){var n=e.message.split("\n");if(n.length<4)return null;var s,a=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,u=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,f=/^\s*Line (\d+) of function script\s*$/i,g=[],m=t&&t.document&&t.document.getElementsByTagName("script"),p=[];for(var h in m)d(m,h)&&!m[h].src&&p.push(m[h]);for(var w=2;w<n.length;w+=2){var C=null;if(s=a.exec(n[w]))C={url:s[2],func:s[3],args:[],line:+s[1],column:null};else if(s=u.exec(n[w])){C={url:s[3],func:s[4],args:[],line:+s[1],column:null};var y=+s[1],v=p[s[2]-1];if(v){var F=r(C.url);if(F){var x=(F=F.join("\n")).indexOf(v.innerText);x>=0&&(C.line=y+F.substring(0,x).split("\n").length)}}}else if(s=f.exec(n[w])){var b=t.location.href.replace(/#.*$/,""),S=l(new RegExp(c(n[w+1])),[b]);C={url:b,func:"",args:[],line:S?S.line:s[1],column:null}}if(C){C.func||(C.func=o(C.url,C.line));var E=i(C.url,C.line),_=E?E[Math.floor(E.length/2)]:null;E&&_.replace(/^\s*/,"")===n[w+1].replace(/^\s*/,"")?C.context=E:C.context=[n[w+1]],g.push(C)}}return g.length?{mode:"multiline",name:e.name,message:n[0],stack:g}:null}(n),a)return a}catch(n){if(e)throw n}try{if(a=w(n,s+1))return a}catch(n){if(e)throw n}return{name:n.name,message:n.message,mode:"failed"}}return C.augmentStackTraceWithInitialElement=h,C.computeStackTraceFromStackProp=p,C.guessFunctionName=o,C.gatherContext=i,C.ofCaller=function(e){e=1+(null==e?0:+e);try{throw new Error}catch(n){return C(n,e+1)}},C.getSource=r,C}(),a.extendToAsynchronousCallbacks=function(){var e=function(e){var n=t[e];t[e]=function(){var e=l.call(arguments),t=e[0];return"function"==typeof t&&(e[0]=a.wrap(t)),n.apply?n.apply(this,e):n(e[0],e[1])}};e("setTimeout"),e("setInterval")},a.remoteFetching||(a.remoteFetching=!0),a.collectWindowErrors||(a.collectWindowErrors=!0),(!a.linesOfContext||a.linesOfContext<1)&&(a.linesOfContext=11),o=[],void 0===(i="function"==typeof(r=a)?r.apply(n,o):r)||(e.exports=i)}function d(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function g(e){return void 0===e}}("undefined"!=typeof window?window:t.g)}},n={};function t(r){var o=n[r];if(void 0!==o)return o.exports;var i=n[r]={exports:{}};return e[r](i,i.exports,t),i.exports}t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";t.r(r),t.d(r,{REMOTE_LOGGING_ERROR_DATA_FILTER:()=>m,REMOTE_LOGGING_JS_ERROR_ENDPOINT_FILTER:()=>h,REMOTE_LOGGING_LOG_ENDPOINT_FILTER:()=>p,REMOTE_LOGGING_SHOULD_SEND_ERROR_FILTER:()=>g,captureException:()=>_,init:()=>S,log:()=>E});var e=t(13253),n=t.n(e);const o=window.wc.wcSettings;var i=t(62763),s=t.n(i);const a=window.wp.hooks,c=window.wc.tracks;function l(e,n){const t={...e};for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const o=r;"extra"===o||"properties"===o?t[o]={...e[o],...n[o]}:"tags"===o&&Array.isArray(n[o])?t[o]=[...Array.isArray(e[o])?e[o]:[],...n[o]]:t[o]=n[o]}return t}const u=n()("wc:remote-logging"),f=e=>{console.warn("RemoteLogger: "+e)},d=(e,...n)=>{console.error("RemoteLogger: "+e,...n)},g="woocommerce_remote_logging_should_send_error",m="woocommerce_remote_logging_error_data",p="woocommerce_remote_logging_log_endpoint",h="woocommerce_remote_logging_js_error_endpoint",w=["path","page","step","task","tab","section","status","post_type","taxonomy","action"],C=e=>{const n=new URLSearchParams(e),t=(0,a.applyFilters)("woocommerce_remote_logging_request_uri_whitelist",w);for(const[e]of n)t.includes(e)||n.set(e,"xxxxxx");return n.toString()},y="wc_remote_logging_last_error_sent_time",v={message:"",feature:"woocommerce_core",host:window.location.hostname,tags:["woocommerce","js"],properties:{wp_version:(0,o.getSetting)("wpVersion"),wc_version:(0,o.getSetting)("wcVersion")}};class F{constructor(e){this.lastErrorSentTime=0,this.config=e,this.lastErrorSentTime=parseInt(localStorage.getItem(y)||"0",10)}async log(e,n,t){if(!n)return u("Empty message"),!1;const r=l(v,{message:n,severity:e,...t});return u("Logging:",r),await this.sendLog(r)}async error(e,n){if(this.isRateLimited())return;const t={...l(v,{message:e.message,severity:"error",...n,properties:{...null==n?void 0:n.properties,request_uri:window.location.pathname+C(window.location.search)}}),trace:this.getFormattedStackFrame(s().computeStackTrace(e))};u("Logging error:",t),await this.sendError(t)}initializeErrorHandlers(){window.addEventListener("error",(e=>{u("Caught error event:",e),this.handleError(e.error).catch((e=>{u("Failed to handle error:",e)}))})),window.addEventListener("unhandledrejection",(async e=>{u("Caught unhandled rejection:",e);try{const n="string"==typeof e.reason?new Error(e.reason):e.reason;await this.handleError(n)}catch(e){u("Failed to handle unhandled rejection:",e)}}))}async sendLog(e){const n=new window.FormData;n.append("params",JSON.stringify(e));try{u("Sending log to API:",e);const t=(0,a.applyFilters)(p,"https://public-api.wordpress.com/rest/v1.1/logstash"),r=await window.fetch(t,{method:"POST",body:n});if(!r.ok)throw new Error(`response body: ${r.body}`);return!0}catch(e){return console.error("Failed to send log to API:",e),!1}}async handleError(e){const n=s().computeStackTrace(e);if(!this.shouldHandleError(e,n.stack))return void u("Irrelevant error. Skipping handling.",e);if((0,c.bumpStat)("error","unhandled-js-errors"),this.isRateLimited())return;const t={...l(v,{message:e.message,severity:"critical",tags:["js-unhandled-error"],properties:{request_uri:window.location.pathname+C(window.location.search)}}),trace:this.getFormattedStackFrame(n)},r=(0,a.applyFilters)(m,t);try{await this.sendError(r)}catch(e){console.error("Failed to send error:",e)}}async sendError(e){const n=new window.FormData;n.append("error",JSON.stringify(e));try{const t=(0,a.applyFilters)(h,"https://public-api.wordpress.com/rest/v1.1/js-error");u("Sending error to API:",e),await window.fetch(t,{method:"POST",body:n})}catch(e){console.error("Failed to send error to API:",e)}finally{this.lastErrorSentTime=Date.now(),localStorage.setItem(y,this.lastErrorSentTime.toString())}}getFormattedStackFrame(e){const n=e.stack.slice(0,10).map(this.getFormattedFrame).join("\n\n");return n.length>8192?n.substring(0,8192):n}getFormattedFrame(e,n){const t="?"!==e.func?e.func.replace(/"/g,""):"anonymous",r=e.url.replace(/"/g,""),o=e.context?e.context.map((e=>e.replace(/^"|"$/g,"").replace(/\\"/g,'"'))).filter((e=>""!==e.trim())).join("\n    ").substring(0,256):"";return`#${n+1} at ${t} (${r}:${e.line}:${e.column})`+(o?`\n${o}`:"")}shouldHandleError(e,n){const t=n.some((e=>e.url&&e.url.startsWith((0,o.getSetting)("wcAssetUrl"))));return(0,a.applyFilters)(g,t,e,n)}isRateLimited(){return Date.now()-this.lastErrorSentTime<this.config.errorRateLimitMs&&(u("Rate limit reached. Skipping send error"),!0)}}let x=null;function b(e){var n;return(null===(n=window.wcSettings)||void 0===n?void 0:n.isRemoteLoggingEnabled)?!!e||(f("RemoteLogger is not initialized. Call init() first."),!1):(u("Remote logging is disabled."),!1)}function S(e){var n;if(null===(n=window.wcSettings)||void 0===n?void 0:n.isRemoteLoggingEnabled)if(x)f("RemoteLogger is already initialized.");else try{x=new F(e),x.initializeErrorHandlers(),u("RemoteLogger initialized.")}catch(e){d("Failed to initialize RemoteLogger:",e)}else u("Remote logging is disabled.")}async function E(e,n,t){if(!b(x))return!1;try{return await x.log(e,n,t)}catch(e){return d("Failed to send log:",e),!1}}async function _(e,n){if(!b(x))return!1;try{await x.error(e,n)}catch(e){d("Failed to send log:",e)}}})(),(window.wc=window.wc||{}).remoteLogging=r})();

Zerion Mini Shell 1.0