/**
-
@license ng-prettyjson - v0.1.2
-
© 2013 Julien VALERY github.com/darul75/ng-prettyjson
-
License: MIT
**/ angular.module(“ngPrettyJson”,[]).directive(“prettyJson”,[“ngPrettyJsonFunctions”,function(a){“use strict”;var b=angular.isDefined;return{restrict:“AE”,scope:{json:“=”,prettyJson:“=”},replace:!0,template:'<div><button ng-click=“edit()” ng-show=“edition && !editActivated”>Edit</button><button ng-click=“edit()” ng-show=“edition && editActivated”>Cancel</button><button ng-click=“update()” ng-show=“editActivated && parsable”>Update</button><pre id=“prettyjson”></pre></div>',function(c,d,e){var f={},g=“prettyjson”,h=null;c.editActivated=!1,c.edition=e.edition;// prefer the “json” attribute over the “prettyJson” one. // the value on the scope might not be defined yet, so look at the markup. var i,j=b(e.json)?“json”:“prettyJson”,k=function©{return b©?d.find(“pre”).html(a.syntaxHighlight©):d.empty()};i=c.$watch(j,function(a){// BACKWARDS COMPATIBILITY: // if newValue is an object, and we find a `json` property, // then stop watching on `exp`. angular.isObject(a)&&b(a.json)?(i(),c.$watch(j+“.json”,function(a){k(a),f=a},!0)):(k(a),f=a)},!0);var l=function(){try{c.currentValue=JSON.parse(h.getValue()),c.parsable=!0}catch(a){c.parsable=!1}// trigger update c.$apply(function(){})};c.edit=function(){c.editActivated?(h&&(document.getElementById(g).env=null),k(f)):(h=ace.edit(g),h.on(“change”,l),h.getSession().setMode(“ace/mode/json”)),c.editActivated=!c.editActivated},c.update=function(){c.$emit(“json-updated”,c.newValue)}}}}]).factory(“ngPrettyJsonFunctions”,function(){// cache some regular expressions var a={entities:/((&)|(<)|(>))/g,json:/“(\u{4}|\[^u]|)*”(s*:)?|b(true|false|(null))b|-?d+(?:.d*)?(?:[eE][+-]?d+)?/g},b=,c=,d=function(){var a=arguments.length-2;do a–;while(!arguments);return a},e=function(a){var b;// the final two arguments are the length, and the entire string itself; // we don't care about those. if(arguments.length<7)throw new Error(“markup() must be called from String.prototype.replace()”);return b=d.apply(null,arguments),'<span class=“‘c[b]
'”>'a
“</span>”},f=function(){var a;if(arguments.length<5)throw new Error(“makeEntities() must be called from String.prototype.replace()”);return a=d.apply(null,arguments),b},g=function(b){return angular.isString(b)||(b=JSON.stringify(b,null,2)),angular.isDefined(b)?b.replace(a.entities,f).replace(a.json,e):void 0};return{syntaxHighlight:g,makeEntities:f,markup:e,rx:a}});