"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("lodash"),u=require("fparser");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=a(e),l=a(u);exports.useFormulaFunction=function(e,u){var a=r.useState(null),o=n.default(a,2),s=o[0],f=o[1],i=r.useState(""),c=n.default(i,2),d=c[0],p=c[1];return r.useEffect((function(){if(e&&u&&u.length)try{var r=new l.default(e),a=[];a.push(t.fromPairs(u.map((function(e){return[e,Math.random()]})))),r.evaluate(a),f(r),p("")}catch(e){f(null),p(e.message)}else f(null),p("")}),[e,u]),{formulaFunction:s,error:d}};
