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,CAEA,MAAM,yBAA4B,IAC9B,IAAI,EAAS,CAAC,EACd,GAAI,EAAS,OACT,GAAI,EAAS,OAAQ,CACjB,MAAM,EAAQ,IAAI,WAAW,EAAS,QAChC,EAAS,OAAO,aAAa,GACnC,EAAS,IAAI,EAAU,UACvB,EAAO,eAAiB,EAAO,MACnC,OAEA,EAAS,EAAS,OAEtB,OAAO,GAGL,IAAM,CACR,QAAS,eACT,KAAM,YACN,kBAAI,GACA,OAAO,gBAAgB,gBAC3B,EACA,WAAI,GACA,MAAM,EAAU,gBAAgB,cAChC,OAAO,GAAW,EAAQ,OAC9B,EACA,WAAY,gBAAgB,WAC5B,SAAU,gBAAgB,SAC1B,WAAY,gBAAgB,WAC5B,gBAAiB,gBAAgB,gBACjC,UAAW,gBAAgB,UAC3B,kDACA,gBAAiB,gBAAgB,iBAGrC,OAAO,OAAS,IAChB,OAAO,QAAU","file":"/npm/@waves/ride-js@2.2.9/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@waves/ride-js@2.2.9/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","require('./interop');\nconst crypto = require('@waves/ts-lib-crypto');\nconst scalaJsCompiler = require('./lang-opt.js');\nconst replJs = require('./repl-opt.js');\n\nfunction wrappedCompile(code, estimatorVersion = 3, needCompaction = false, removeUnusedCode = false, libraries = {}) {\n    if (typeof code !== 'string') {\n        return {\n            error: 'Type error: contract should be string'\n        }\n    }\n    try {\n        const result = scalaJsCompiler.compile(code, estimatorVersion, needCompaction, removeUnusedCode, libraries);\n        if (result.error) {\n            try {\n                result.size = new Uint8Array(result.result).length;\n            } catch (e) {\n            }\n            return result;\n        } else {\n            const bytes = new Uint8Array(result.result);\n            const {\n                ast,\n                complexity,\n                verifierComplexity,\n                callableComplexities,\n                userFunctionComplexities,\n                globalVariableComplexities\n            } = result;\n            return {\n                result: {\n                    bytes,\n                    base64: crypto.base64Encode(bytes),\n                    size: bytes.byteLength,\n                    ast,\n                    complexity,\n                    verifierComplexity,\n                    callableComplexities,\n                    userFunctionComplexities,\n                    globalVariableComplexities\n                }\n            }\n        }\n    } catch (e) {\n        console.log(e)\n        return typeof e === 'object' ?\n            {error: e.message} :\n            {error: e}\n    }\n}\n\nfunction wrappedRepl(opts) {\n    const repl = (opts != null)\n        ? replJs.repl(new replJs.NodeConnectionSettings(opts.nodeUrl, opts.chainId.charCodeAt(0), opts.address))\n        : replJs.repl();\n\n    const wrapReconfigure = (repl) => {\n        let reconfigureFn = repl.reconfigure.bind(repl);\n        return (opts) => {\n            const settings = new replJs.NodeConnectionSettings(opts.nodeUrl, opts.chainId.charCodeAt(0), opts.address);\n            const newRepl = reconfigureFn(settings);\n            newRepl.reconfigure = wrapReconfigure(newRepl);\n            return newRepl;\n        }\n    };\n\n    repl.reconfigure = wrapReconfigure(repl);\n\n    return repl\n}\n\nconst flattenCompilationResult = (compiled) => {\n    let result = {};\n    if (compiled.error) {\n        if (compiled.result) {\n            const bytes = new Uint8Array(compiled.result);\n            const base64 = crypto.base64Encode(bytes);\n            result = {...compiled, base64};\n            result.result && delete result.result\n        }\n    } else {\n        result = compiled.result\n    }\n    return result\n}\n\nconst api = {\n    compile: wrappedCompile,\n    repl: wrappedRepl,\n    get contractLimits() {\n        return scalaJsCompiler.contractLimits()\n    },\n    get version() {\n        const version = scalaJsCompiler.nodeVersion();\n        return version && version.version\n    },\n    scriptInfo: scalaJsCompiler.scriptInfo,\n    getTypes: scalaJsCompiler.getTypes,\n    getVarsDoc: scalaJsCompiler.getVarsDoc,\n    getFunctionsDoc: scalaJsCompiler.getFunctionsDoc,\n    decompile: scalaJsCompiler.decompile,\n    flattenCompilationResult,\n    parseAndCompile: scalaJsCompiler.parseAndCompile\n}\n\nglobal.RideJS = api;\nmodule.exports = api;\n"]}