var diffstudio;
/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ "./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/constants.ts":
/*!****************************************************************************************************************!*\
  !*** ./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/constants.ts ***!
  \****************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DIFF_GROK_OUT_IDX: () => (/* binding */ DIFF_GROK_OUT_IDX),
/* harmony export */   DOCK_RATIO: () => (/* binding */ DOCK_RATIO),
/* harmony export */   FIRST_ROW_IDX: () => (/* binding */ FIRST_ROW_IDX),
/* harmony export */   HELP_LINK: () => (/* binding */ HELP_LINK),
/* harmony export */   LAST_ROW_IDX: () => (/* binding */ LAST_ROW_IDX),
/* harmony export */   LOCAL_HELP: () => (/* binding */ LOCAL_HELP),
/* harmony export */   NULL_RAW: () => (/* binding */ NULL_RAW),
/* harmony export */   ROW_HEIGHT: () => (/* binding */ ROW_HEIGHT),
/* harmony export */   STARTING_HELP: () => (/* binding */ STARTING_HELP)
/* harmony export */ });
/* eslint-disable max-len */
// Specific sensitivity analysis constants
/** Dock ratios */
var DOCK_RATIO;
(function (DOCK_RATIO) {
    DOCK_RATIO[DOCK_RATIO["COR_PLOT"] = 0.5] = "COR_PLOT";
    DOCK_RATIO[DOCK_RATIO["PC_PLOT"] = 0.6] = "PC_PLOT";
    DOCK_RATIO[DOCK_RATIO["GRAPH"] = 0.6] = "GRAPH";
    DOCK_RATIO[DOCK_RATIO["BAR_CHART"] = 0.2] = "BAR_CHART";
})(DOCK_RATIO || (DOCK_RATIO = {}));
/** Size constants */
const ROW_HEIGHT = 25;
var HELP_ITEMS;
(function (HELP_ITEMS) {
    HELP_ITEMS["METHOD"] = "`Method`";
    HELP_ITEMS["SAMPLES"] = "`Samples`";
})(HELP_ITEMS || (HELP_ITEMS = {}));
;
const LOCAL_HELP = '/help/compute/function-analysis#sensitivity-analysis';
const HELP_LINK = `https://datagrok.ai${LOCAL_HELP}`;
/** Starting help markdown */
const STARTING_HELP = `# Sensitivity Analysis

Sensitivity Analysis runs the computation multiple times with varying inputs, 
and analyzes the relationship between inputs and outputs.

Use one of the following methods:

* **Monte Carlo** explores a function 
at randomly taken points

* **Sobol** decomposes output variance into fractions, which can be attributed to inputs

* **Grid** studies a function at the points of a grid with the specified step

## Monte Carlo

Once you've chosen it in ${HELP_ITEMS.METHOD}

* Set in ${HELP_ITEMS.SAMPLES} the number of random points 

* Use switchers to specify varied inputs and outputs to be analyzed

* Press **Run** or <i class="fas fa-play"></i> on the top panel. You will get 

  * [Correlation plot](https://datagrok.ai/help/visualize/viewers/correlation-plot) for exploring
correlations between varied inputs and the specified outputs

  * [PC plot](https://datagrok.ai/help/visualize/viewers/pc-plot) visualizing multivariate data
and providing variations of the selected inputs & outputs

  * [Line chart](https://datagrok.ai/help/visualize/viewers/line-chart) or 
[Scatterplot](https://datagrok.ai/help/visualize/viewers/scatter-plot) (dependently on the varied
inputs count) showing a behavior of each output separately

  * [Grid](https://datagrok.ai/help/visualize/viewers/grid) containing inputs and outputs values 
of each function evaluation

* Press **?** on the top panel to learn more about [Sensitivity Analysis](${HELP_LINK})

## Sobol

This method performs 
[variance-based sensitivity analysis](https://en.wikipedia.org/wiki/Variance-based_sensitivity_analysis). 
It provides the same visualizations 
as **Monte Carlo** and [bar charts](https://datagrok.ai/help/visualize/viewers/bar-chart) showing 
Sobol' indices:

* First-order indices indicate the contribution to the output variance of varying each input alone

* Total-order indices measure the contribution to the output variance of each input,
 including all variance caused by its interactions with any other inputs
 
 ## Grid
 
 This method provides the same visualization as the previous ones. Unlike them, it evaluates a function 
 at the points of uniform grid within the specified ranges.`;
const DIFF_GROK_OUT_IDX = 0;
const LAST_ROW_IDX = -1;
const FIRST_ROW_IDX = 0;
const NULL_RAW = -2;


/***/ }),

/***/ "./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/defs.ts":
/*!***********************************************************************************************************************!*\
  !*** ./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/defs.ts ***!
  \***********************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DEFAULT_NUM: () => (/* binding */ DEFAULT_NUM),
/* harmony export */   MIN_WORKERS_COUNT: () => (/* binding */ MIN_WORKERS_COUNT),
/* harmony export */   NO_ERRORS: () => (/* binding */ NO_ERRORS),
/* harmony export */   RESULT_CODE: () => (/* binding */ RESULT_CODE),
/* harmony export */   WORKERS_COUNT_DOWNSHIFT: () => (/* binding */ WORKERS_COUNT_DOWNSHIFT)
/* harmony export */ });
// Sensitivity Analysis definitions for Diff Studio models
const DEFAULT_NUM = -10;
const MIN_WORKERS_COUNT = 1;
const WORKERS_COUNT_DOWNSHIFT = 2;
var RESULT_CODE;
(function (RESULT_CODE) {
    RESULT_CODE[RESULT_CODE["SUCCEED"] = 0] = "SUCCEED";
    RESULT_CODE[RESULT_CODE["FAILED"] = 1] = "FAILED";
})(RESULT_CODE || (RESULT_CODE = {}));
;
const NO_ERRORS = 'Success';


/***/ }),

/***/ "./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/sens-analysis-utils.ts":
/*!**************************************************************************************************************************************!*\
  !*** ./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/sens-analysis-utils.ts ***!
  \**************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getAnalysis: () => (/* binding */ getAnalysis)
/* harmony export */ });
/* harmony import */ var _datagrok_diff_grok__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @datagrok/diff-grok */ "./node_modules/@datagrok/diff-grok/index.ts");
/* harmony import */ var _defs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./defs */ "./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/defs.ts");
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants */ "./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/constants.ts");
// Sensitivity analysis routine for Diff Studio models



function getSolutionRow(solution, rowIdx) {
    const outputsCount = solution.length;
    const result = new Float64Array(outputsCount);
    for (let i = 0; i < outputsCount; ++i)
        result[i] = solution[i][rowIdx];
    return result;
}
function getIndexOfClosestValue(args, targetVal) {
    let targetIdx = 0;
    let deviation = Math.abs(args[targetIdx] - targetVal);
    let current;
    for (let curIdx = 1; curIdx < args.length; ++curIdx) {
        current = Math.abs(args[curIdx] - targetVal);
        if (current < deviation) {
            deviation = current;
            targetIdx = curIdx;
        }
    }
    return targetIdx;
}
function getAnalysis(task) {
    // evaluate model
    const solution = _datagrok_diff_grok__WEBPACK_IMPORTED_MODULE_0__.applyPipeline(task.pipeline, task.ivp2ww, task.inputVec);
    const solutionTableRowCount = solution[0].length;
    const rowIdx = task.rowIdx;
    // extract target row
    if (rowIdx !== _defs__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_NUM) {
        switch (rowIdx) {
            case _constants__WEBPACK_IMPORTED_MODULE_2__.FIRST_ROW_IDX:
                return getSolutionRow(solution, 0);
            case _constants__WEBPACK_IMPORTED_MODULE_2__.LAST_ROW_IDX:
                return getSolutionRow(solution, solutionTableRowCount - 1);
            default:
                throw new Error(`Incorrect row idx: ${rowIdx}`);
        }
    }
    // extract row by the target argument
    const index = getIndexOfClosestValue(solution[task.argColIdx], task.argVal);
    return getSolutionRow(solution, index);
}


/***/ }),

/***/ "./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/workers/analysis.ts":
/*!***********************************************************************************************************************************!*\
  !*** ./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/workers/analysis.ts ***!
  \***********************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _defs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../defs */ "./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/defs.ts");
/* harmony import */ var _sens_analysis_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sens-analysis-utils */ "./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/sens-analysis-utils.ts");
// Worker for sensitivity analysis of Diff Studio model
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};


onmessage = function (evt) {
    return __awaiter(this, void 0, void 0, function* () {
        try {
            const task = evt.data.task;
            const batchSize = task.pipelines.length;
            const rowVals = new Array(batchSize);
            const analysisRes = new Array(batchSize);
            for (let idx = 0; idx < batchSize; ++idx) {
                try {
                    rowVals[idx] = (0,_sens_analysis_utils__WEBPACK_IMPORTED_MODULE_1__.getAnalysis)({
                        ivp2ww: task.ivp2ww,
                        pipeline: task.pipelines[idx],
                        inputVec: task.inputVecs[idx],
                        rowIdx: task.rowIdx,
                        argColIdx: task.argColIdx,
                        argVal: task.argVal,
                    });
                    analysisRes[idx] = _defs__WEBPACK_IMPORTED_MODULE_0__.NO_ERRORS;
                }
                catch (e) {
                    analysisRes[idx] = e instanceof Error ? e.message : 'Platform issue: in-webworker analysis failed';
                }
            }
            postMessage({
                'callResult': _defs__WEBPACK_IMPORTED_MODULE_0__.RESULT_CODE.SUCCEED,
                'rowVals': rowVals,
                'analysisRes': analysisRes,
            });
        }
        catch (e) {
            postMessage({
                'callResult': _defs__WEBPACK_IMPORTED_MODULE_0__.RESULT_CODE.FAILED,
                'msg': e instanceof Error ? e.message : 'Platform issue: in-webworker analysis failed',
            });
        }
    });
};


/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = __webpack_modules__;
/******/ 	
/******/ 	// the startup function
/******/ 	__webpack_require__.x = () => {
/******/ 		// Load entry module and return exports
/******/ 		// This entry module depends on other loaded chunks and execution need to be delayed
/******/ 		var __webpack_exports__ = __webpack_require__.O(undefined, ["vendors-node_modules_datagrok_diff-grok_index_ts"], () => (__webpack_require__("./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/workers/analysis.ts")))
/******/ 		__webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/ 		return __webpack_exports__;
/******/ 	};
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/chunk loaded */
/******/ 	(() => {
/******/ 		var deferred = [];
/******/ 		__webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ 			if(chunkIds) {
/******/ 				priority = priority || 0;
/******/ 				for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ 				deferred[i] = [chunkIds, fn, priority];
/******/ 				return;
/******/ 			}
/******/ 			var notFulfilled = Infinity;
/******/ 			for (var i = 0; i < deferred.length; i++) {
/******/ 				var [chunkIds, fn, priority] = deferred[i];
/******/ 				var fulfilled = true;
/******/ 				for (var j = 0; j < chunkIds.length; j++) {
/******/ 					if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ 						chunkIds.splice(j--, 1);
/******/ 					} else {
/******/ 						fulfilled = false;
/******/ 						if(priority < notFulfilled) notFulfilled = priority;
/******/ 					}
/******/ 				}
/******/ 				if(fulfilled) {
/******/ 					deferred.splice(i--, 1)
/******/ 					var r = fn();
/******/ 					if (r !== undefined) result = r;
/******/ 				}
/******/ 			}
/******/ 			return result;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/ensure chunk */
/******/ 	(() => {
/******/ 		__webpack_require__.f = {};
/******/ 		// This file contains only the entry chunk.
/******/ 		// The chunk loading function for additional chunks
/******/ 		__webpack_require__.e = (chunkId) => {
/******/ 			return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ 				__webpack_require__.f[key](chunkId, promises);
/******/ 				return promises;
/******/ 			}, []));
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/get javascript chunk filename */
/******/ 	(() => {
/******/ 		// This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ 		__webpack_require__.u = (chunkId) => {
/******/ 			// return url for filenames based on template
/******/ 			return "" + chunkId + ".js";
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/global */
/******/ 	(() => {
/******/ 		__webpack_require__.g = (function() {
/******/ 			if (typeof globalThis === 'object') return globalThis;
/******/ 			try {
/******/ 				return this || new Function('return this')();
/******/ 			} catch (e) {
/******/ 				if (typeof window === 'object') return window;
/******/ 			}
/******/ 		})();
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/publicPath */
/******/ 	(() => {
/******/ 		var scriptUrl;
/******/ 		if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ 		var document = __webpack_require__.g.document;
/******/ 		if (!scriptUrl && document) {
/******/ 			if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
/******/ 				scriptUrl = document.currentScript.src;
/******/ 			if (!scriptUrl) {
/******/ 				var scripts = document.getElementsByTagName("script");
/******/ 				if(scripts.length) {
/******/ 					var i = scripts.length - 1;
/******/ 					while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
/******/ 				}
/******/ 			}
/******/ 		}
/******/ 		// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ 		// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ 		if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ 		scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ 		__webpack_require__.p = scriptUrl;
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/importScripts chunk loading */
/******/ 	(() => {
/******/ 		// no baseURI
/******/ 		
/******/ 		// object to store loaded chunks
/******/ 		// "1" means "already loaded"
/******/ 		var installedChunks = {
/******/ 			"node_modules_datagrok-libraries_compute-utils_function-views_src_variance-based-analysis_diff-33514a": 1
/******/ 		};
/******/ 		
/******/ 		// importScripts chunk loading
/******/ 		var installChunk = (data) => {
/******/ 			var [chunkIds, moreModules, runtime] = data;
/******/ 			for(var moduleId in moreModules) {
/******/ 				if(__webpack_require__.o(moreModules, moduleId)) {
/******/ 					__webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ 				}
/******/ 			}
/******/ 			if(runtime) runtime(__webpack_require__);
/******/ 			while(chunkIds.length)
/******/ 				installedChunks[chunkIds.pop()] = 1;
/******/ 			parentChunkLoadingFunction(data);
/******/ 		};
/******/ 		__webpack_require__.f.i = (chunkId, promises) => {
/******/ 			// "1" is the signal for "already loaded"
/******/ 			if(!installedChunks[chunkId]) {
/******/ 				if(true) { // all chunks have JS
/******/ 					importScripts(__webpack_require__.p + __webpack_require__.u(chunkId));
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 		
/******/ 		var chunkLoadingGlobal = self["webpackChunkdiffstudio"] = self["webpackChunkdiffstudio"] || [];
/******/ 		var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);
/******/ 		chunkLoadingGlobal.push = installChunk;
/******/ 		
/******/ 		// no HMR
/******/ 		
/******/ 		// no HMR manifest
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/startup chunk dependencies */
/******/ 	(() => {
/******/ 		var next = __webpack_require__.x;
/******/ 		__webpack_require__.x = () => {
/******/ 			return __webpack_require__.e("vendors-node_modules_datagrok_diff-grok_index_ts").then(next);
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// run startup
/******/ 	var __webpack_exports__ = __webpack_require__.x();
/******/ 	diffstudio = __webpack_exports__;
/******/ 	
/******/ })()
;
//# sourceMappingURL=node_modules_datagrok-libraries_compute-utils_function-views_src_variance-based-analysis_diff-33514a.js.map