{"version":3,"file":"unsafeEvalSupported.mjs","sources":["../../../src/shader/utils/unsafeEvalSupported.ts"],"sourcesContent":["// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n    if (typeof unsafeEval === 'boolean')\n    {\n        return unsafeEval;\n    }\n\n    try\n    {\n        /* eslint-disable no-new-func */\n        const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n        /* eslint-enable no-new-func */\n\n        unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n    }\n    catch (e)\n    {\n        unsafeEval = false;\n    }\n\n    return unsafeEval;\n}\n"],"names":[],"mappings":"AACA,IAAI;AAQG,SAAS,sBAChB;AACI,MAAI,OAAO,cAAe;AAEf,WAAA;AAIX,MAAA;AAKI,iBAHa,IAAI,SAAS,UAAU,UAAU,UAAU,mCAAmC,EAGzE,EAAE,GAAG,IAAA,GAAO,KAAK,GAAG,MAAM;AAAA,EAAA,QAGhD;AACiB,iBAAA;AAAA,EACjB;AAEO,SAAA;AACX;"}