"use strict";function getMaskFunction(e){const t=e.toLowerCase();return t.includes("email")?MASK_PATTERNS.email:t.includes("phone")||t.includes("mobile")?MASK_PATTERNS.phone:t.includes("address")||t.includes("walletaddress")?MASK_PATTERNS.address:t.includes("txid")||t.includes("transactionid")||t.includes("txhash")?MASK_PATTERNS.txId:t.includes("password")||t.includes("secret")||t.includes("key")?MASK_PATTERNS.password:t.includes("accountid")||t.includes("account_id")?MASK_PATTERNS.accountId:t.includes("script")?MASK_PATTERNS.script:(t.includes("broker"),MASK_PATTERNS.default)}function maskAtPath(e,t,n){if(!e||"object"!=typeof e||0===t.length)return;const[s,...i]=t;if(Array.isArray(e))for(const s of e)maskAtPath(s,t,n);else if(s in e)if(0===i.length){const t=e[s];if("string"==typeof t){const i=getMaskFunction(n);e[s]=i(t)}}else{const t=e[s];if(Array.isArray(t))for(const e of t)maskAtPath(e,i,n);else t&&"object"==typeof t&&maskAtPath(t,i,n)}}function applyDemoMask(e,t){if(!isDemo||!e||!t||0===t.length)return e;for(const n of t){const t=n.split("."),s=t[t.length-1];if(Array.isArray(e))for(const n of e)maskAtPath(n,t,s);else maskAtPath(e,t,s)}return e}function isDemoMode(){return isDemo}Object.defineProperty(exports,"__esModule",{value:!0});exports.applyDemoMask=applyDemoMask;exports.isDemoMode=isDemoMode;const isDemo="true"===process.env.NEXT_PUBLIC_DEMO_STATUS,MASK_PATTERNS={email:e=>{if(!e||"string"!=typeof e)return e;const[t,n]=e.split("@");if(!n)return"***@***.***";const s=t.length>2?t[0]+"*".repeat(Math.min(t.length-2,5))+t[t.length-1]:"**",i=n.split(".");return`${s}@${i.map((e,t)=>t===i.length-1?e:"*".repeat(Math.min(e.length,4))).join(".")}`},phone:e=>{if(!e||"string"!=typeof e)return e;return e.replace(/\D/g,"").length<4?"***":e.slice(0,3)+"*".repeat(Math.max(e.length-6,3))+e.slice(-3)},mobile:e=>MASK_PATTERNS.phone(e),address:e=>e&&"string"==typeof e?e.length<=10?"*".repeat(e.length):e.slice(0,6)+"*".repeat(Math.min(e.length-10,12))+e.slice(-4):e,txId:e=>e&&"string"==typeof e?e.length<=12?"*".repeat(e.length):e.slice(0,8)+"*".repeat(Math.min(e.length-12,16))+e.slice(-4):e,password:e=>e&&"string"==typeof e?"*".repeat(Math.min(e.length,12)):e,accountId:e=>e&&"string"==typeof e?e.length<=4?"*".repeat(e.length):"*".repeat(e.length-4)+e.slice(-4):e,script:e=>e&&"string"==typeof e?e.length<=10?"*".repeat(e.length):e.slice(0,10)+"..."+"*".repeat(8):e,default:e=>e&&"string"==typeof e?e.length<=4?"*".repeat(e.length):e[0]+"*".repeat(Math.min(e.length-2,8))+e[e.length-1]:e};