{"version":3,"file":"static/js/npm.jss-plugin-rule-value-function.9be787cc.js","mappings":"0IAGIA,EAAMC,KAAKD,MACXE,EAAa,WAAaF,EAC1BG,EAAW,aAAcH,EA2D7B,QAzDqB,WACnB,MAAO,CACLI,aAAc,SAAsBC,EAAMC,EAAMC,GAC9C,GAAoB,mBAATD,EAAqB,OAAO,KACvC,IAAIE,GAAO,QAAWH,EAAM,CAAC,EAAGE,GAEhC,OADAC,EAAKL,GAAYG,EACVE,CACT,EACAC,eAAgB,SAAwBC,EAAOF,GAK7C,GAAIN,KAAcM,GAAQL,KAAYK,EAAM,OAAOE,EACnD,IAAIC,EAAW,CAAC,EAEhB,IAAK,IAAIC,KAAQF,EAAO,CACtB,IAAIG,EAAQH,EAAME,GACG,mBAAVC,WACJH,EAAME,GACbD,EAASC,GAAQC,EACnB,CAGA,OADAL,EAAKN,GAAcS,EACZD,CACT,EACAI,SAAU,SAAkBC,EAAMP,EAAMQ,EAAOT,GAC7C,IAAIU,EAAYT,EACZU,EAASD,EAAUd,GAGnBe,IAGFD,EAAUP,MAAQQ,EAAOH,IAAS,CAAC,GAYrC,IAAIJ,EAAWM,EAAUf,GAEzB,GAAIS,EACF,IAAK,IAAIQ,KAASR,EAChBM,EAAUL,KAAKO,EAAOR,EAASQ,GAAOJ,GAAOR,EAGnD,EAEJ,C","sources":["webpack://drbinaryweb/./node_modules/jss-plugin-rule-value-function/dist/jss-plugin-rule-value-function.esm.js"],"sourcesContent":["import warning from 'tiny-warning';\nimport { createRule } from 'jss';\n\nvar now = Date.now();\nvar fnValuesNs = \"fnValues\" + now;\nvar fnRuleNs = \"fnStyle\" + ++now;\n\nvar functionPlugin = function functionPlugin() {\n return {\n onCreateRule: function onCreateRule(name, decl, options) {\n if (typeof decl !== 'function') return null;\n var rule = createRule(name, {}, options);\n rule[fnRuleNs] = decl;\n return rule;\n },\n onProcessStyle: function onProcessStyle(style, rule) {\n // We need to extract function values from the declaration, so that we can keep core unaware of them.\n // We need to do that only once.\n // We don't need to extract functions on each style update, since this can happen only once.\n // We don't support function values inside of function rules.\n if (fnValuesNs in rule || fnRuleNs in rule) return style;\n var fnValues = {};\n\n for (var prop in style) {\n var value = style[prop];\n if (typeof value !== 'function') continue;\n delete style[prop];\n fnValues[prop] = value;\n }\n\n rule[fnValuesNs] = fnValues;\n return style;\n },\n onUpdate: function onUpdate(data, rule, sheet, options) {\n var styleRule = rule;\n var fnRule = styleRule[fnRuleNs]; // If we have a style function, the entire rule is dynamic and style object\n // will be returned from that function.\n\n if (fnRule) {\n // Empty object will remove all currently defined props\n // in case function rule returns a falsy value.\n styleRule.style = fnRule(data) || {};\n\n if (process.env.NODE_ENV === 'development') {\n for (var prop in styleRule.style) {\n if (typeof styleRule.style[prop] === 'function') {\n process.env.NODE_ENV !== \"production\" ? warning(false, '[JSS] Function values inside function rules are not supported.') : void 0;\n break;\n }\n }\n }\n }\n\n var fnValues = styleRule[fnValuesNs]; // If we have a fn values map, it is a rule with function values.\n\n if (fnValues) {\n for (var _prop in fnValues) {\n styleRule.prop(_prop, fnValues[_prop](data), options);\n }\n }\n }\n };\n};\n\nexport default functionPlugin;\n"],"names":["now","Date","fnValuesNs","fnRuleNs","onCreateRule","name","decl","options","rule","onProcessStyle","style","fnValues","prop","value","onUpdate","data","sheet","styleRule","fnRule","_prop"],"sourceRoot":""}