File: /home/shrsglobal/www/wp-content/plugins/woocommerce/assets/client/blocks/dependency-detection.js
(()=>{"use strict";const e=["client/","assets/","build/","vendor/"],n=/\/plugins\/woocommerce\/(client|assets|build|vendor)\//;function t(t,r=""){if(!t)return!1;if(!r)return n.test(t);if(!t.startsWith(r))return!1;const s=t.substring(r.length);for(let n=0;n<e.length;n++)if(s.startsWith(e[n]))return!0;return!1}function r(e){if(!e)return"unknown";const n=e.split("/").pop();if(!n)return"unknown";return n.split("?")[0].split("#")[0]||"unknown"}function s(e,n){return!!e.includes(n+":")||!!e.includes("webpack://")}function i(e){if(!e||"string"!=typeof e)return"v8";const n=e.split("\n");for(let e=0;e<n.length;e++){const t=n[e];if(/@https?:\/\//.test(t))return"spidermonkey";if(/^\s*at\s/.test(t))return"v8"}return"v8"}function c(e=""){if("string"!=typeof e)return null;const n=e.match(/(https?:\/\/[^\s)]+?\.js)(?:[?:#]|$)/);if(n)return n[1];const t=e.match(/\(([^()\s]+\.js)(?:[?:#]|$)/);return t?t[1]:null}function o(e=""){if("string"!=typeof e)return null;const n=e.match(/@(https?:\/\/[^\s]+?\.js)(?:[?:#]|$)/);return n?n[1]:null}function u(e="",n="v8"){return"string"!=typeof e?null:"spidermonkey"===n?o(e):c(e)}function l(e,n){if(!e||"string"!=typeof e)return null;const t=i(e),r=e.split("\n");for(let e="v8"===t?1:0;e<r.length;e++){const i=r[e];if(s(i,n))continue;const c=u(i,t);if(c)return c}return null}function d(e,n,t,s,i=r){if(!e)return{type:"inline",message:`[WooCommerce] An inline or unknown script accessed wc.${n} without proper dependency declaration. This script should declare "${t}" as a dependency.`};const c=s&&"object"==typeof s?s[e]:void 0;return c&&c.handle&&Array.isArray(c.deps)?-1===c.deps.indexOf(t)?{type:"missing-dependency",message:`[WooCommerce] Script "${c.handle}" accessed wc.${n} without declaring "${t}" as a dependency. Add "${t}" to the script's dependencies array.`}:null:{type:"unregistered",message:`[WooCommerce] Unregistered script "${i(e)}" accessed wc.${n}. This script should be registered with wp_enqueue_script() and declare "${t}" as a dependency.`}}function p(e,n,t,r){let s=!1;function i(e,i){if(s)return e[i];if((e=>e in n)(i)){s=!0;try{const s=t();return r(s,i,n[i]),e[i]}finally{s=!1}}return e[i]}return new Proxy(e,{get:i})}!function(){let e=window.wc||{},n={},s=!1;const i={};let c=[];const WC_GLOBAL_EXPORTS=__WC_GLOBAL_EXPORTS_PLACEHOLDER__,WC_PLUGIN_URL=__WC_PLUGIN_URL_PLACEHOLDER__;function o(){const e=document.currentScript?.src;if(e&&"string"==typeof e)return e.replace(/\?.*$/,"");const n=(new Error).stack;return l(null!=n?n:null,window.location.pathname)}function u(e,t,s){const c=(e||"inline")+":"+t;if(i[c])return;const o=d(e,t,s,n,r);o&&(console.warn(o.message),i[c]=!0)}function a(e,n,r){e?t(e,WC_PLUGIN_URL)||(s?u(e,n,r):c.push({callerUrl:e,wcGlobalKey:n,requiredDependencyHandle:r})):u(e,n,r)}let f=p(e,WC_GLOBAL_EXPORTS,o,a);Object.defineProperty(window,"wc",{get:()=>f,set(n){e=n||{},f=p(e,WC_GLOBAL_EXPORTS,o,a)},configurable:!0,enumerable:!0}),window.wc.wcUpdateDependencyRegistry=function(e){n=e||{},s=!0;for(let e=0;e<c.length;e++){const n=c[e];u(n.callerUrl,n.wcGlobalKey,n.requiredDependencyHandle)}c=[]},console.info("[WooCommerce] Dependency detection enabled. Warnings will be shown for scripts that access wc.* globals without proper dependencies.")}()})();