define("editor/assert/js/widget/exercise/jsonUtil",[],function(){function a(a,b,c){var d=b.split("="),e=d[0];return">"==e[0]&&(e=e.substr(1)),c=c||d[1],void 0==a[e]||void 0!=c&&a[e]!=c?!1:!0}JSON.setValueByAttrName=function(a,b,c,d){if(void 0!=d){var e=this.getObjectByAttrName(a,b,c);if(e){var f=b.split(",");if(f=f[f.length-1],">"==f[0]&&(f=f.substr(1)),f=f.split("&")[0].split("=")[0],e instanceof Array)for(var g=0,h=e.length;h>g;++g)d instanceof Function?d(e[g]):e[g][f]=d;else e[f]=d;return e}return!1}},JSON.getObjectByAttrName=function(){function b(b,c,d,e){if(!b||!c)return null;var f=[],g=c.split(","),_self=arguments.callee;if(1===g.length){var h=!0;g[0]=g[0].split("&");for(var i=0,j=g[0].length;j>i;++i){var k=a(b,g[0][i],e);if(!k)break;i==j-1&&(f=f.concat(b),h=d)}if(h)if(b instanceof Array)for(var i=0,j=b.length;j>i;++i){var l=b[i];if("object"==typeof l){var m=_self.apply(this,[l,c,d,e]);if(m&&(f=f.concat(m),!d))break}}else if(b instanceof Object)for(var n in b){var l=b[n];if("object"==typeof l){var m=_self.apply(this,[l,c,d,e]);if(m&&(f=f.concat(m),!d))break}}}else for(var o=[[b]],i=0,j=g.length;j>i&&o[i];++i)for(var p=0,q=o[i].length;q>p&&(!f||!f.length||d);++p){var n,b=o[i][p];n=g[i];var m=_self.apply(this,[b,n,d,i==j-1?e:void 0]);if(m)if(i!=j-1){o[i+1]=[],o[i+1]=o[i+1].concat(m);for(var r=0,s=o[i+1].length;s>r;++r){var t=">"==g[i+1][0]?!0:!1;t&&(">"==n[0]&&(n=n.substr(1)),n=n.split("&")[0].split("=")[0],o[i+1][r]=o[i+1][r][n],g[i+1]=g[i+1].substr(1))}}else f=f.concat(m)}return f&&f.length?d?f:f[0]:null}return function(a,c,d){return b(a,c,d)}}(),JSON.getValueByAttrName=function(a,b,c){var a=this.getObjectByAttrName(a,b,c);if(a){var d=b.split(",");if(d=d[d.length-1],">"==d[0]&&(d=d.substr(1)),d=d.split("&")[0].split("=")[0],c){for(var e=[],f=0,g=a.length;g>f;++f)e[f]=a[f][d];a=e}else a=a[d]}return a}});