var INSTANCES_PROPERTY_NAME="INSTANCES",_allViewModels={};function updateViewModel(a,b,c,d,g){var e=null,f=null;null==_allViewModels[a]?(f={},_allViewModels[a]=f):f=_allViewModels[a];var h=null!=b&&""!=b;h||(b=a);null==f[b]?(e={},h&&(e.Key=b),f[b]=e):e=f[b];null==d||""==d?e[c]=g:(null==e[c]&&(e[c]={}),e[c][d]=g)}function getViewModels(a){if(null==a||""==a)throw"The argument 'modelName' its required!";return _allViewModels[a]}
function getViewModel(a,b){var c=null;if(null==b||""==b)b=a;var d=getViewModels(a);null!=d&&(c=d[b]);return c}function getViewModelsJSON(a){var b=[];if(null==a||""==a)for(viewModels in _allViewModels)collectModelsJSON(b,viewModels,_allViewModels[viewModels]);else collectModelsJSON(b,a,_allViewModels[a]);return 0<b.length?JSON.stringify(b):""}function getViewModelJSON(a,b){var c="",d=getViewModel(a,b);null!=d&&(c=getModelJSON(a,d));return c}
function collectModelsJSON(a,b,c){if(null!=c)for(viewModel in c)a.push(getModelJSON(b,c[viewModel]))}function getModelJSON(a,b){return a.concat(":",JSON.stringify(b))}function clearViewModels(){_allViewModels={}}function clearViewModelsByName(a,b){b?delete _allViewModels[a][b]:_allViewModels[a]={}};
