{"version":3,"sources":["webpack:///webpack/bootstrap b91d2cee364b5e101d43","webpack:///external \"@0xproject/utils\"","webpack:///./src/ts/configs.ts","webpack:///external \"lodash\"","webpack:///./src/ts/error_reporter.ts","webpack:///external \"0x.js\"","webpack:///./src/ts/rpc_urls.ts","webpack:///./src/ts/server.ts","webpack:///external \"body-parser\"","webpack:///external \"express\"","webpack:///external \"rollbar\"","webpack:///./src/ts/handler.ts","webpack:///external \"web3\"","webpack:///external \"@0xproject/subproviders\"","webpack:///external \"web3-provider-engine\"","webpack:///external \"web3-provider-engine/subproviders/rpc\"","webpack:///./src/ts/dispatch_queue.ts","webpack:///./src/ts/dispense_asset_tasks.ts","webpack:///./src/ts/parameter_transformer.ts"],"names":[],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;AC7DA,6C;;;;;;;;;ACAa,eAAO,GAAG;IACnB,iBAAiB,EAAG,OAAO,CAAC,GAAG,CAAC,iBAA4B,CAAC,WAAW,EAAE;IAC1E,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;IACxD,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;IAC3C,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;IAC1C,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB;CAC5D,CAAC;;;;;;;ACNF,mC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,qCAA4C;AAE5C,sCAAoC;AAEp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AAC,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAChC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAC/C,MAAM,CAAC;QACX,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QACjC,IAAI,EAAE,CAAC;IACX,CAAC;CACJ,CAAC","file":"server.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b91d2cee364b5e101d43","module.exports = require(\"@0xproject/utils\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@0xproject/utils\"\n// module id = 0\n// module chunks = 0","export const configs = {\n DISPENSER_ADDRESS: (process.env.DISPENSER_ADDRESS as string).toLowerCase(),\n DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY,\n ENVIRONMENT: process.env.FAUCET_ENVIRONMENT,\n INFURA_API_KEY: process.env.INFURA_API_KEY,\n ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY,\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/configs.ts","module.exports = require(\"lodash\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"lodash\"\n// module id = 2\n// module chunks = 0","import { logUtils } from '@0xproject/utils';\nimport * as express from 'express';\nimport rollbar = require('rollbar');\n\nimport { configs } from './configs';\n\nexport const errorReporter = {\n setup() {\n rollbar.init(configs.ROLLBAR_ACCESS_KEY, {\n environment: configs.ENVIRONMENT,\n });\n rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY);\n process.on('unhandledRejection', async (err: Error) => {\n logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`);\n await this.reportAsync(err);\n process.exit(1);\n });\n },\n async reportAsync(err: Error, req?: express.Request): Promise {\n if (configs.ENVIRONMENT === 'development') {\n return; // Do not log development environment errors\n }\n return new Promise((resolve, reject) => {\n rollbar.handleError(err, req, (rollbarErr: Error) => {\n if (rollbarErr) {\n logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);\n reject(rollbarErr);\n } else {\n resolve();\n }\n });\n });\n },\n errorHandler() {\n return rollbar.errorHandler(configs.ROLLBAR_ACCESS_KEY);\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/error_reporter.ts","module.exports = require(\"0x.js\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"0x.js\"\n// module id = 4\n// module chunks = 0","import { configs } from './configs';\n\nconst productionRpcUrls = {\n '3': `https://ropsten.infura.io/${configs.INFURA_API_KEY}`,\n '4': `https://rinkeby.infura.io/${configs.INFURA_API_KEY}`,\n '42': `https://kovan.infura.io/${configs.INFURA_API_KEY}`,\n};\n\nconst developmentRpcUrls = {\n '50': 'http://127.0.0.1:8545',\n};\n\nexport const rpcUrls = configs.ENVIRONMENT === 'development' ? developmentRpcUrls : productionRpcUrls;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/rpc_urls.ts","import * as bodyParser from 'body-parser';\nimport * as express from 'express';\n\nimport { errorReporter } from './error_reporter';\nimport { Handler } from './handler';\nimport { parameterTransformer } from './parameter_transformer';\n\n// Setup the errorReporter to catch uncaught exceptions and unhandled rejections\nerrorReporter.setup();\n\nconst app = express();\napp.use(bodyParser.json()); // for parsing application/json\napp.use((req, res, next) => {\n res.header('Access-Control-Allow-Origin', '*');\n res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');\n next();\n});\n\nconst handler = new Handler();\napp.get('/ping', (req: express.Request, res: express.Response) => {\n res.status(200).send('pong');\n});\napp.get('/info', handler.getQueueInfo.bind(handler));\napp.get('/ether/:recipient', parameterTransformer.transform, handler.dispenseEther.bind(handler));\napp.get('/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRX.bind(handler));\napp.get('/order/weth/:recipient', parameterTransformer.transform, handler.dispenseWETHOrder.bind(handler));\napp.get('/order/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRXOrder.bind(handler));\n\n// Log to rollbar any errors unhandled by handlers\napp.use(errorReporter.errorHandler());\nconst port = process.env.PORT || 3000;\napp.listen(port);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/server.ts","module.exports = require(\"body-parser\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"body-parser\"\n// module id = 8\n// module chunks = 0","module.exports = require(\"express\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"express\"\n// module id = 9\n// module chunks = 0","module.exports = require(\"rollbar\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"rollbar\"\n// module id = 10\n// module chunks = 0","import { Order, SignedOrder, ZeroEx } from '0x.js';\nimport { BigNumber, logUtils } from '@0xproject/utils';\nimport * as express from 'express';\nimport * as _ from 'lodash';\nimport * as Web3 from 'web3';\n\n// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest\n// to know whether it is running in a browser or node environment. We need it to be undefined since\n// we are not running in a browser env.\n// Filed issue: https://github.com/ethereum/web3.js/issues/844\n(global as any).XMLHttpRequest = undefined;\nimport { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0xproject/subproviders';\nimport ProviderEngine = require('web3-provider-engine');\nimport RpcSubprovider = require('web3-provider-engine/subproviders/rpc');\n\nimport { configs } from './configs';\nimport { DispatchQueue } from './dispatch_queue';\nimport { dispenseAssetTasks } from './dispense_asset_tasks';\nimport { rpcUrls } from './rpc_urls';\n\ninterface NetworkConfig {\n dispatchQueue: DispatchQueue;\n web3: Web3;\n zeroEx: ZeroEx;\n}\n\ninterface ItemByNetworkId {\n [networkId: string]: T;\n}\n\nenum RequestedAssetType {\n ETH = 'ETH',\n WETH = 'WETH',\n ZRX = 'ZRX',\n}\n\nconst FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable\n\nexport class Handler {\n private _networkConfigByNetworkId: ItemByNetworkId = {};\n private static _createProviderEngine(rpcUrl: string) {\n if (_.isUndefined(configs.DISPENSER_PRIVATE_KEY)) {\n throw new Error('Dispenser Private key not found');\n }\n const engine = new ProviderEngine();\n engine.addProvider(new NonceTrackerSubprovider());\n engine.addProvider(new PrivateKeyWalletSubprovider(configs.DISPENSER_PRIVATE_KEY));\n engine.addProvider(\n new RpcSubprovider({\n rpcUrl,\n }),\n );\n engine.start();\n return engine;\n }\n constructor() {\n _.forIn(rpcUrls, (rpcUrl: string, networkId: string) => {\n const providerObj = Handler._createProviderEngine(rpcUrl);\n const web3 = new Web3(providerObj);\n const zeroExConfig = {\n networkId: +networkId,\n };\n const zeroEx = new ZeroEx(web3.currentProvider, zeroExConfig);\n const dispatchQueue = new DispatchQueue();\n this._networkConfigByNetworkId[networkId] = {\n dispatchQueue,\n web3,\n zeroEx,\n };\n });\n }\n public getQueueInfo(req: express.Request, res: express.Response) {\n res.setHeader('Content-Type', 'application/json');\n const queueInfo = _.mapValues(rpcUrls, (rpcUrl: string, networkId: string) => {\n const dispatchQueue = this._networkConfigByNetworkId[networkId].dispatchQueue;\n return {\n full: dispatchQueue.isFull(),\n size: dispatchQueue.size(),\n };\n });\n const payload = JSON.stringify(queueInfo);\n res.status(200).send(payload);\n }\n public dispenseEther(req: express.Request, res: express.Response) {\n this._dispenseAsset(req, res, RequestedAssetType.ETH);\n }\n public dispenseZRX(req: express.Request, res: express.Response) {\n this._dispenseAsset(req, res, RequestedAssetType.ZRX);\n }\n public async dispenseWETHOrder(req: express.Request, res: express.Response) {\n await this._dispenseOrder(req, res, RequestedAssetType.WETH);\n }\n public async dispenseZRXOrder(req: express.Request, res: express.Response, next: express.NextFunction) {\n await this._dispenseOrder(req, res, RequestedAssetType.ZRX);\n }\n private _dispenseAsset(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n const networkId = req.params.networkId;\n const recipient = req.params.recipient;\n const networkConfig = this._networkConfigByNetworkId[networkId];\n let dispenserTask;\n switch (requestedAssetType) {\n case RequestedAssetType.ETH:\n dispenserTask = dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3);\n break;\n case RequestedAssetType.WETH:\n case RequestedAssetType.ZRX:\n dispenserTask = dispenseAssetTasks.dispenseTokenTask(\n recipient,\n requestedAssetType,\n networkConfig.zeroEx,\n );\n break;\n default:\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const didAddToQueue = networkConfig.dispatchQueue.add(dispenserTask);\n if (!didAddToQueue) {\n res.status(503).send('QUEUE_IS_FULL');\n return;\n }\n logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);\n res.status(200).end();\n }\n private async _dispenseOrder(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n const networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId);\n if (_.isUndefined(networkConfig)) {\n res.status(400).send('UNSUPPORTED_NETWORK_ID');\n return;\n }\n const zeroEx = networkConfig.zeroEx;\n res.setHeader('Content-Type', 'application/json');\n const makerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(requestedAssetType);\n if (_.isUndefined(makerToken)) {\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const takerTokenSymbol =\n requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH;\n const takerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(takerTokenSymbol);\n if (_.isUndefined(takerToken)) {\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), makerToken.decimals);\n const takerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), takerToken.decimals);\n const order: Order = {\n maker: configs.DISPENSER_ADDRESS,\n taker: req.params.recipient,\n makerFee: new BigNumber(0),\n takerFee: new BigNumber(0),\n makerTokenAmount,\n takerTokenAmount,\n makerTokenAddress: makerToken.address,\n takerTokenAddress: takerToken.address,\n salt: ZeroEx.generatePseudoRandomSalt(),\n exchangeContractAddress: zeroEx.exchange.getContractAddress(),\n feeRecipient: ZeroEx.NULL_ADDRESS,\n expirationUnixTimestampSec: new BigNumber(Date.now() + FIVE_DAYS_IN_MS),\n };\n const orderHash = ZeroEx.getOrderHashHex(order);\n const signature = await zeroEx.signOrderHashAsync(orderHash, configs.DISPENSER_ADDRESS, false);\n const signedOrder = {\n ...order,\n ecSignature: signature,\n };\n const signedOrderHash = ZeroEx.getOrderHashHex(signedOrder);\n const payload = JSON.stringify(signedOrder);\n logUtils.log(`Dispensed signed order: ${payload}`);\n res.status(200).send(payload);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/handler.ts","module.exports = require(\"web3\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3\"\n// module id = 12\n// module chunks = 0","module.exports = require(\"@0xproject/subproviders\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@0xproject/subproviders\"\n// module id = 13\n// module chunks = 0","module.exports = require(\"web3-provider-engine\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3-provider-engine\"\n// module id = 14\n// module chunks = 0","module.exports = require(\"web3-provider-engine/subproviders/rpc\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3-provider-engine/subproviders/rpc\"\n// module id = 15\n// module chunks = 0","import { intervalUtils, logUtils } from '@0xproject/utils';\nimport * as _ from 'lodash';\n\nimport { errorReporter } from './error_reporter';\n\nconst MAX_QUEUE_SIZE = 500;\nconst DEFAULT_QUEUE_INTERVAL_MS = 1000;\n\nexport class DispatchQueue {\n private _queueIntervalMs: number;\n private _queue: Array<() => Promise>;\n private _queueIntervalIdIfExists?: NodeJS.Timer;\n constructor() {\n this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;\n this._queue = [];\n this._start();\n }\n public add(taskAsync: () => Promise): boolean {\n if (this.isFull()) {\n return false;\n }\n this._queue.push(taskAsync);\n return true;\n }\n public size(): number {\n return this._queue.length;\n }\n public isFull(): boolean {\n return this.size() >= MAX_QUEUE_SIZE;\n }\n public stop() {\n if (!_.isUndefined(this._queueIntervalIdIfExists)) {\n intervalUtils.clearAsyncExcludingInterval(this._queueIntervalIdIfExists);\n }\n }\n private _start() {\n this._queueIntervalIdIfExists = intervalUtils.setAsyncExcludingInterval(\n async () => {\n const taskAsync = this._queue.shift();\n if (_.isUndefined(taskAsync)) {\n return Promise.resolve();\n }\n await taskAsync();\n },\n this._queueIntervalMs,\n (err: Error) => {\n logUtils.log(`Unexpected err: ${err} - ${JSON.stringify(err)}`);\n // tslint:disable-next-line:no-floating-promises\n errorReporter.reportAsync(err);\n },\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/dispatch_queue.ts","import { ZeroEx } from '0x.js';\nimport { BigNumber, logUtils, promisify } from '@0xproject/utils';\nimport * as _ from 'lodash';\nimport * as Web3 from 'web3';\n\nimport { configs } from './configs';\nimport { errorReporter } from './error_reporter';\n\nconst DISPENSE_AMOUNT_ETHER = 0.1;\nconst DISPENSE_AMOUNT_TOKEN = 0.1;\nconst DISPENSE_MAX_AMOUNT_TOKEN = 2;\nconst DISPENSE_MAX_AMOUNT_ETHER = 2;\n\nexport const dispenseAssetTasks = {\n dispenseEtherTask(recipientAddress: string, web3: Web3) {\n return async () => {\n logUtils.log(`Processing ETH ${recipientAddress}`);\n const userBalance = await promisify(web3.eth.getBalance)(recipientAddress);\n const maxAmountInWei = new BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether'));\n if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) {\n logUtils.log(\n `User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,\n );\n return;\n }\n const sendTransactionAsync = promisify(web3.eth.sendTransaction);\n const txHash = await sendTransactionAsync({\n from: configs.DISPENSER_ADDRESS,\n to: recipientAddress,\n value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),\n });\n logUtils.log(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);\n };\n },\n dispenseTokenTask(recipientAddress: string, tokenSymbol: string, zeroEx: ZeroEx) {\n return async () => {\n logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);\n const amountToDispense = new BigNumber(DISPENSE_AMOUNT_TOKEN);\n const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol);\n if (_.isUndefined(token)) {\n throw new Error(`Unsupported asset type: ${tokenSymbol}`);\n }\n const baseUnitAmount = ZeroEx.toBaseUnitAmount(amountToDispense, token.decimals);\n const userBalanceBaseUnits = await zeroEx.token.getBalanceAsync(token.address, recipientAddress);\n const maxAmountBaseUnits = ZeroEx.toBaseUnitAmount(\n new BigNumber(DISPENSE_MAX_AMOUNT_TOKEN),\n token.decimals,\n );\n if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) {\n logUtils.log(\n `User exceeded token balance maximum (${maxAmountBaseUnits}) ${recipientAddress} ${userBalanceBaseUnits} `,\n );\n return;\n }\n const txHash = await zeroEx.token.transferAsync(\n token.address,\n configs.DISPENSER_ADDRESS,\n recipientAddress,\n baseUnitAmount,\n );\n logUtils.log(`Sent ${amountToDispense} ZRX to ${recipientAddress} tx: ${txHash}`);\n };\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/dispense_asset_tasks.ts","import { addressUtils } from '@0xproject/utils';\nimport { NextFunction, Request, Response } from 'express';\nimport * as _ from 'lodash';\n\nimport { configs } from './configs';\nimport { rpcUrls } from './rpc_urls';\n\nconst DEFAULT_NETWORK_ID = 42; // kovan\n\nexport const parameterTransformer = {\n transform(req: Request, res: Response, next: NextFunction) {\n const recipientAddress = req.params.recipient;\n if (_.isUndefined(recipientAddress) || !addressUtils.isAddress(recipientAddress)) {\n res.status(400).send('INVALID_RECIPIENT_ADDRESS');\n return;\n }\n const lowerCaseRecipientAddress = recipientAddress.toLowerCase();\n req.params.recipient = lowerCaseRecipientAddress;\n const networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID);\n const rpcUrlIfExists = _.get(rpcUrls, networkId);\n if (_.isUndefined(rpcUrlIfExists)) {\n res.status(400).send('UNSUPPORTED_NETWORK_ID');\n return;\n }\n req.params.networkId = networkId;\n next();\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/parameter_transformer.ts"],"sourceRoot":""}