var fluid_1_4=fluid_1_4||{};var fluid=fluid||fluid_1_4;(function($){fluid.model=fluid.model||{};fluid.model.transform=fluid.model.transform||{};fluid.model.transform.value=function(model,expandSpec,recurse){var val;if(expandSpec.path){val=fluid.get(model,expandSpec.path);if(typeof (val)!=="undefined"){return val}}return typeof (expandSpec.value)==="object"?recurse(model,expandSpec.value):expandSpec.value};fluid.model.transform.arrayValue=function(model,expandSpec,recurse){return fluid.makeArray(fluid.model.transform.value(model,expandSpec))};fluid.model.transform.count=function(model,expandSpec,recurse){var value=fluid.get(model,expandSpec.path);return fluid.makeArray(value).length};fluid.model.transform.firstValue=function(model,expandSpec,recurse){var result;for(var i=0;i<expandSpec.values.length;i++){var value=expandSpec.values[i];if(typeof (value)==="string"){value=fixupExpandSpec(value)}result=fluid.model.transform.value(model,value.expander,recurse);if(typeof (result)!=="undefined"){break}}return result};var getOrRecurse=function(model,value,recurse){return typeof (value)==="string"?fluid.get(model,value):recurse(model,value,recurse)};fluid.model.transform.merge=function(model,expandSpec,recurse){var left=getOrRecurse(model,expandSpec.left,recurse);var right=getOrRecurse(model,expandSpec.right,recurse);if(typeof (left)!=="object"||typeof (right)!=="object"){return left}return fluid.merge(expandSpec.policy?expandSpec.policy:null,{},left,right)};var fixupExpandSpec=function(expandSpec){return{expander:{type:"fluid.model.transform.value",path:expandSpec}}};var expandRule=function(model,targetPath,rule){var expanded={};for(var key in rule){var value=rule[key];if(key==="expander"){var expanderFn=fluid.getGlobalValue(value.type);if(expanderFn){expanded=expanderFn.call(null,model,value,fluid.model.transformWithRules)}}else{expanded[key]=fluid.model.transformWithRules(model,value)}}return expanded};fluid.model.transformWithRules=function(model,rules){var transformed;rules=fluid.makeArray(rules);fluid.each(rules,function(rulesObj){transformed={};for(var targetPath in rulesObj){var rule=rulesObj[targetPath];if(typeof (rule)==="string"){rule=fixupExpandSpec(rule)}var expanded=expandRule(model,targetPath,rule);if(typeof (expanded)!=="undefined"){fluid.set(transformed,targetPath,expanded)}}model=transformed});return transformed}})(jQuery,fluid_1_4);