forked from nodee-apps/angular-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ne-modules.min.js
7 lines (6 loc) · 137 KB
/
ne-modules.min.js
1
2
3
4
5
6
7
angular.module("neContentEditors",[]).factory("neMarkdown",["$document","NeRemarked","neMarked",function(e,t,n){function r(e,t,n){var r=e.inputValue.substring(e.start-t.length,e.start),i=e.inputValue.substring(e.end,e.end+n.length);return r===t&&i===n}function i(e,t,n,i){return i=i||"toggle",function(s){var o="";return e=e||"",t=t||"",s&&s.end>s.start&&"replace"!==i?"remove"===i||"toggle"===i&&r(s,e,t)?(o=s.inputValue.substring(0,s.start-e.length)+s.value+s.inputValue.substring(s.end+t.length,s.inputValue.length),s.select(s.start-e.length,s.end-e.length)):(o=e+s.value+t,o=s.inputValue.substring(0,s.start)+o+s.inputValue.substring(s.end,s.inputValue.length),s.select(s.start+e.length,s.end+e.length)):s&&(n||""===n)&&(o=s.inputValue.substring(0,s.start)+e+n+t+s.inputValue.substring(s.end,s.inputValue.length),s.select(s.start+e.length,s.start+n.length+e.length)),o}}function s(e,t){var n,r,i="\n";for(n=1;t+3>n;n++)for(r=1;e+1>r;r++)i+=1===r?"\n":" | ",i+=1===n?"col "+r:2===n?"-----":"row "+(n-2);return i+"\n"}var o,a={},l={link_list:!1,h1_setext:!1,h2_setext:!1,h_atx_suf:!1,gfm_code:!1,li_bullet:"*",hr_char:"-",indnt_str:" ",bold_char:"*",emph_char:"_",gfm_del:!0,gfm_tbls:!0,tbl_edges:!1,hash_lnks:!1,br_only:!1},u=new t(l);return a.parseHTML=function(e){return u.render(e||"")},o={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!0,smartypants:!1},n.setOptions(o),a.renderHTML=function(e){return n(e||"")},a.editor={bold:i("**","**","bold text"),italic:i("*","*","italic text"),strikethrough:i("~~","~~","strikethrough text"),h1:i("\n# ","","headline 1"),h2:i("\n## ","","headline 2"),h3:i("\n### ","","headline 3"),h4:i("\n#### ","","headline 4"),h5:i("\n##### ","","headline 5"),h6:i("\n###### ","","headline 6"),ol:i("\n1. ","","numbered list"),ul:i("\n- ","","bulleted list"),indent:i(" ","","","replace"),dedent:i(" ","","","remove"),blocquote:i("\n> ","","blocquote text"),hr:i("\n\n-----\n\n","","","replace"),link:function(e,t,n){return t||""===t||(t=prompt("Please enter link url","http://")),t?i("","[ "+(n||"link text")+" ]( "+t+" )","","replace")(e):""},image:function(e,t){return t||""===t||(t=prompt("Please enter image url","http://")),t?i("","![]( "+t+' "")',"","replace")(e):""},table:function(e,t,n){return t=parseInt(t,10),n=parseInt(n,10),t>0&&n>0?i("",s(t,n),"","add")(e):e.inputValue}},a}]).controller("NeMdCtrl",["$scope","neMarkdown",function(e,t){e.editor=t.editor}]).controller("NeWsCtrl",["$scope","neWysiwyg",function(e,t){e.editor=t.editor}]).factory("neWysiwyg",["$document","neModals",function(e){function t(e,t){var n,r,i,s,o,a,l,u,d=window.getSelection(),c=e.range;d.removeAllRanges(),c.deleteContents(),n=c.startContainer,r=c.startOffset,c=document.createRange(),3===n.nodeType&&3===t.nodeType?(n.insertData(r,t.nodeValue),c.setEnd(n,r+t.length),c.setStart(n,r+t.length)):(3===n.nodeType?(s=n,n=s.parentNode,o=s.nodeValue,a=o.substr(0,r),l=o.substr(r),u=document.createTextNode(a),i=document.createTextNode(l),n.insertBefore(i,s),n.insertBefore(t,i),n.insertBefore(u,t),n.removeChild(s)):(i=n.childNodes[r],n.insertBefore(t,i)),c.setEnd(i,0),c.setStart(i,0)),d.addRange(c)}function n(t,n){return function(r){return e[0].execCommand(t,!1,n),r.parent.html()}}var r=["#ffffff","#ffccc9","#ffce93","#fffc9e","#ffffc7","#9aff99","#96fffb","#cdffff","#cbcefb","#cfcfcf","#fd6864","#fe996b","#fffe65","#fcff2f","#67fd9a","#38fff8","#68fdff","#9698ed","#c0c0c0","#fe0000","#f8a102","#ffcc67","#f8ff00","#34ff34","#68cbd0","#34cdf9","#6665cd","#9b9b9b","#cb0000","#f56b00","#ffcb2f","#ffc702","#32cb00","#00d2cb","#3166ff","#6434fc","#656565","#9a0000","#ce6301","#cd9934","#999903","#009901","#329a9d","#3531ff","#6200c9","#343434","#680100","#963400","#986536","#646809","#036400","#34696d","#00009b","#303498","#000000","#330001","#643403","#663234","#343300","#013300","#003532","#010066","#340096"],i=[{name:"Extra Small",css:"xx-small",value:"1"},{name:"Small",css:"x-small",value:"2"},{name:"Medium",css:"small",value:"3"},{name:"Large",css:"medium",value:"4"},{name:"Extra Large",css:"large",value:"5"},{name:"Huge",css:"x-large",value:"6"}],s={undo:n("undo"),redo:n("redo"),bold:n("bold"),italic:n("italic"),strikethrough:n("strikeThrough"),underline:n("underline"),quote:n("quote"),h1:n("formatblock","<h1>"),h2:n("formatblock","<h2>"),h3:n("formatblock","<h3>"),h4:n("formatblock","<h4>"),h5:n("formatblock","<h5>"),h6:n("formatblock","<h6>"),fontSizes:i,fontSize:function(e,t){return n("fontsize",t)(e)},colors:r,color:function(e,t){return n("forecolor",t)(e)},bgColor:function(e,t){return n("hilitecolor",t)(e)},justifyLeft:n("justifyleft"),justifyCenter:n("justifycenter"),justifyRight:n("justifyright"),justifyFull:n("justifyfull"),ol:n("insertorderedlist"),ul:n("insertunorderedlist"),indent:n("indent"),outdent:n("outdent"),unlink:n("unlink"),link:function(e,n,r){if(n||""===n||(n=prompt("Please enter link url","http://")),n){var i=angular.element('<a href="'+n+'">'+(r||n)+"</a>");return t(e,i[0]),e.parent.html()}return""},image:function(e,n){if(n||""===n||(n=prompt("Please enter image url","http://")),n){var r=angular.element('<img src="'+n+'">');return t(e,r[0]),e.parent.html()}return""},table:function(n,r,i){var s,o,a,l,u,d,c,f,h,p;if(i=parseInt(i,10),r=parseInt(r,10),s=e[0],i>0&&r>0){for(o=s.createElement("table"),a=s.createElement("thead"),l=s.createElement("tbody"),d=s.createElement("tr"),h=0;r>h;h++)u=s.createElement("th"),u.innerHTML="col "+(h+1),f=s.createElement("br"),u.appendChild(f),d.appendChild(u);for(a.appendChild(d),p=0;i>p;p++){for(d=s.createElement("tr"),h=0;r>h;h++)c=s.createElement("td"),c.innerHTML="row "+(p+1),f=s.createElement("br"),c.appendChild(f),d.appendChild(c);l.appendChild(d)}o.appendChild(a),o.appendChild(l),t(n,o)}return n.parent.html()},hr:n("inserthorizontalrule")};return this.editor=s,this}]).directive("neContenteditable",["$sce",function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){function i(e){var i=t.html();n.stripBr&&"<br>"===i&&(i=""),(e&&i||!e)&&r.$setViewValue(i)}r&&(n.contenteditable||t.attr("contenteditable","true"),r.$render=function(){t.html(r.$viewValue||"")},t.on("blur keyup change",function(){e.$apply(i)}),i(!0))}}}]).directive("neSelectionModel",[function(){return{restrict:"A",require:"^ngModel",scope:{neSelectionModel:"="},link:function(e,t,n){function r(){function t(e,t,n){e.focus(),e.setSelectionRange?e.setSelectionRange(t,n):e.createTextRange&&(e=e.createTextRange(),e.collapse(!0),e.moveEnd("character",n),e.moveStart("character",t),e.select())}function n(){var r=this,i=r.selectionStart,s=r.selectionEnd;e.$apply(function(){e.neSelectionModel={parent:angular.element(r),value:r.value.substring(i,s),inputValue:r.value,start:i,end:s,select:function(e,i){setTimeout(function(){t(r,e,i),n.call(r)},0)}}})}this.setSelection=t,this.getSelection=n}function i(e,t){for(;e;){if(t(e))return e;e=e.parentNode}}function s(){function t(){}function n(){var n=this,r=i(angular.element(n)[0],function(e){return"HTML"===e.tagName}).parentNode,s=r.getSelection(),o=s.getRangeAt(0).startOffset,a=s.getRangeAt(0).endOffset,l=angular.element(n);e.$apply(function(){e.neSelectionModel={range:s.getRangeAt(0),parent:l,value:l.html().substring(o,a),inputValue:l.html(),start:o,startElement:s.getRangeAt(0).startContainer,end:a,endElement:s.getRangeAt(0).endContainer,select:function(e,r,i,s){var o=i||this.startElement,a=s||this.endElement;setTimeout(function(){t(n,e,r,o,a)},0)}}})}this.setSelection=t,this.getSelection=n}if("TEXTAREA"!==t[0].nodeName&&"true"!==n.contenteditable)throw new Error('neSelectionModel directive can be used only on <textarea> or contentEditable="true" element');var o="TEXTAREA"===t[0].nodeName?new r:new s;t.on("mouseup keyup",o.getSelection),e.$on("$destroy",function(){t.unbind("mouseup keyup",o.getSelection),e.neSelectionModel=null})}}}]).factory("NeRemarked",[function(){var e=function(e){function t(e,r){if(!r)return e;for(var i in e)"Object"==n(r[i])?t(e[i],r[i]):"undefined"!=typeof r[i]&&(e[i]=r[i])}function n(e){return Object.prototype.toString.call(e).slice(8,-1)}function r(e,t){for(var n="";t-->0;)n+=e;return n}function i(e){for(var e=e.replace(/^\s\s*/,""),t=/\s/,n=e.length;t.test(e.charAt(--n)););return e.slice(0,n+1)}function s(e,t){var n,r,i;if(!e)return"";for(n="<"+e,i=0;i<t.attributes.length;i++)r=t.attributes.item(i),n+=" "+r.nodeName+'="'+r.nodeValue+'"';return n+">"}function o(e){return e?"</"+e+">":""}function a(e,t){return e.replace(/^/gm,t)}function l(e){return("#text"==e.nodeName?"txt":e.nodeName).toLowerCase()}function u(e,t){var n,r;return t instanceof Array?(n=t[0],r=t[1]):n=r=t,n=n instanceof Function?n.call(this,e):n,r=r instanceof Function?r.call(this,e):r,n+e+r}function d(e){return e.outerHTML||function(e){var t,n=document.createElement("div");return n.appendChild(e.cloneNode(!0)),t=n.innerHTML,n=null,t}(e)}var c,f,h=[],p={link_list:!1,h1_setext:!0,h2_setext:!0,h_atx_suf:!1,gfm_code:!1,li_bullet:"*-+"[0],hr_char:"-_*"[0],indnt_str:[" "," "," "][0],bold_char:"*_"[0],emph_char:"*_"[1],gfm_del:!0,gfm_tbls:!0,tbl_edges:!1,hash_lnks:!1,br_only:!1,col_pre:"col ",unsup_tags:{ignore:"script style noscript",inline:"span sup sub i u b center big",block2:"div form fieldset dl header footer address article aside figure hgroup section",block1c:"dt dd caption legend figcaption output",block2c:"canvas audio video iframe"},tag_remap:{i:"em",b:"strong"}};t(p,e),this.render=function(e){var t,n,i,s,o,a,u,d;if(h=[],"string"==typeof e&&(t=e,e=document.createElement("div"),e.innerHTML=t),n=new c.tag(e,null,0),i=n.rend().replace(/^[\t ]+\n/gm,"\n"),p.link_list&&h.length>0){for(i+="\n\n",s=0,o=0;o<h.length;o++)h[o].e.title&&(a=h[o].e.href.length,a&&a>s&&(s=a));for(u=0;u<h.length;u++)d=h[u].e.title?r(" ",s+2-h[u].e.href.length)+'"'+h[u].e.title+'"':"",i+=" ["+(+u+1)+"]: "+("a"==l(h[u].e)?h[u].e.href:h[u].e.src)+d+"\n"}return i.replace(/^[\t ]+\n/gm,"\n")},c={},c.tag=klass({wrap:"",lnPfx:"",lnInd:0,init:function(e,t,n){this.e=e,this.p=t,this.i=n,this.c=[],this.tag=l(e),this.initK()},initK:function(){var e,t,n,r,i,s,o,a,u,d,f,g,m,y,v,b;if(this.e.hasChildNodes()){if(t=p.unsup_tags.inline,"table"==l(this.e)&&this.e.hasChildNodes()&&!this.e.tHead){if(i=document.createElement("thead"),s=this.e.tBodies[0],o=s.rows[0],a=o.cells[0],"th"==l(a))i.appendChild(o);else for(e=0,d=o.cells.length,f=i.insertRow();e++<d;)u=document.createElement("th"),u.textContent=p.col_pre+e,f.appendChild(u);this.e.insertBefore(i,s)}for(e in this.e.childNodes)if(/\d+/.test(e)&&(n=this.e.childNodes[e],r=l(n),r in p.tag_remap&&(r=p.tag_remap[r]),!p.unsup_tags.ignore.test(r))){if("txt"==r&&/^\s+$/.test(n.textContent)){if(0==e||e==this.e.childNodes.length-1)continue;if(g=this.e.childNodes[e-1],m=this.e.childNodes[e+1],g&&!l(g).match(t)||m&&!l(m).match(t))continue}y=null,c[r]||(v=p.unsup_tags,v.inline.test(r)?r="tinl":v.block2.test(r)?r="tblk":v.block1c.test(r)?r="ctblk":v.block2c.test(r)?(r="ctblk",y=["\n\n",""]):r="rawhtml"),b=new c[r](n,this,this.c.length),y&&(b.wrap=y),(b instanceof c.a&&n.href||b instanceof c.img)&&(b.lnkid=h.length,h.push(b)),this.c.push(b)}}},rend:function(){return this.rendK().replace(/\n{3,}/gm,"\n\n")},rendK:function(){var e,t,n="";for(t=0;t<this.c.length;t++)e=this.c[t],n+=(e.bef||"")+e.rend()+(e.aft||"");return n.replace(/^\n+|\n+$/,"")}}),c.blk=c.tag.extend({wrap:["\n\n",""],wrapK:null,tagr:!1,lnInd:null,init:function(e,t,n){this.supr(e,t,n),null===this.lnInd&&(this.lnInd=this.p&&this.tagr&&this.c[0]instanceof c.blk?4:0),null===this.wrapK&&(this.wrapK=this.tagr&&this.c[0]instanceof c.blk?"\n":"")},rend:function(){return u.call(this,(this.tagr?s(this.tag,this.e):"")+u.call(this,a(a(this.rendK(),this.lnPfx),r(" ",this.lnInd)),this.wrapK)+(this.tagr?o(this.tag):""),this.wrap)},rendK:function(){var e,t,n,r=this.supr();if(this.p instanceof c.li){if(e=null,t=r.match(/^[\t ]+/gm),!t)return r;for(n=0;n<t.length;n++)(null===e||t[n][0].length<e.length)&&(e=t[n][0]);return r.replace(new RegExp("^"+e),"")}return r}}),c.tblk=c.blk.extend({tagr:!0}),c.cblk=c.blk.extend({wrap:["\n",""]}),c.ctblk=c.cblk.extend({tagr:!0}),c.inl=c.tag.extend({rend:function(){return u.call(this,this.rendK(),this.wrap)}}),c.tinl=c.inl.extend({tagr:!0,rend:function(){return s(this.tag,this.e)+u.call(this,this.rendK(),this.wrap)+o(this.tag)}}),c.p=c.blk.extend({rendK:function(){return this.supr().replace(/^\s+/gm,"")}}),c.list=c.blk.extend({expn:!1,wrap:[function(){return this.p instanceof c.li?"\n":"\n\n"},""]}),c.ul=c.list.extend({}),c.ol=c.list.extend({}),c.li=c.cblk.extend({wrap:["\n",function(e){return this.p.expn||e.match(/\n{2}/gm)?"\n":""}],wrapK:[function(){return"ul"==this.p.tag?p.li_bullet+" ":this.i+1+". "},""],rendK:function(){return this.supr().replace(/\n([^\n])/gm,"\n"+p.indnt_str+"$1")}}),c.hr=c.blk.extend({wrap:["\n\n",r(p.hr_char,3)]}),c.h=c.blk.extend({}),c.h_setext=c.h.extend({}),p.h1_setext&&(c.h1=c.h_setext.extend({wrapK:["",function(e){return"\n"+r("=",e.length)}]})),p.h2_setext&&(c.h2=c.h_setext.extend({wrapK:["",function(e){return"\n"+r("-",e.length)}]})),c.h_atx=c.h.extend({wrapK:[function(){return r("#",this.tag[1])+" "},function(){return p.h_atx_suf?" "+r("#",this.tag[1]):""}]}),!p.h1_setext&&(c.h1=c.h_atx.extend({})),!p.h2_setext&&(c.h2=c.h_atx.extend({})),c.h3=c.h_atx.extend({}),c.h4=c.h_atx.extend({}),c.h5=c.h_atx.extend({}),c.h6=c.h_atx.extend({}),c.a=c.inl.extend({lnkid:null,rend:function(){var e=this.rendK(),t=this.e.getAttribute("href"),n=this.e.title?' "'+this.e.title+'"':"";return!t||t==e||"#"==t[0]&&!p.hash_lnks?e:p.link_list?"["+e+"] ["+(this.lnkid+1)+"]":"["+e+"]("+t+n+")"}}),c.img=c.inl.extend({lnkid:null,rend:function(){var e,t=this.e.alt,n=this.e.getAttribute("src");return p.link_list?"!["+t+"] ["+(this.lnkid+1)+"]":(e=this.e.title?' "'+this.e.title+'"':"","!["+t+"]("+n+e+")")}}),c.em=c.inl.extend({wrap:p.emph_char}),c.del=p.gfm_del?c.inl.extend({wrap:"~~"}):c.tinl.extend(),c.br=c.inl.extend({wrap:["",function(){var e=p.br_only?"<br>":" ";return this.p instanceof c.h?"<br>":e+"\n"}]}),c.strong=c.inl.extend({wrap:r(p.bold_char,2)}),c.blockquote=c.blk.extend({lnPfx:"> ",rend:function(){return this.supr().replace(/>[ \t]$/gm,">")}}),c.pre=c.blk.extend({tagr:!0,wrapK:"\n",lnInd:0}),c.code=c.blk.extend({tagr:!1,wrap:"",wrapK:function(e){return-1!==e.indexOf("`")?"``":"`"},lnInd:0,init:function(e,t,n){if(this.supr(e,t,n),this.p instanceof c.pre)if(this.p.tagr=!1,p.gfm_code){var r=this.e.getAttribute("class");r=(r||"").split(" ")[0],0===r.indexOf("lang-")&&(r=r.substr(5)),this.wrapK=["```"+r+"\n","\n```"]}else this.wrapK="",this.p.lnInd=4}}),c.table=p.gfm_tbls?c.blk.extend({cols:[],init:function(e,t,n){this.supr(e,t,n),this.cols=[]},rend:function(){var e,t,n;for(e=0;e<this.c.length;e++)for(t=0;t<this.c[e].c.length;t++)for(n=0;n<this.c[e].c[t].c.length;n++)this.c[e].c[t].c[n].prep();return this.supr()}}):c.tblk.extend(),c.thead=p.gfm_tbls?c.cblk.extend({wrap:["\n",function(){var e,t,n,s,o="";for(e=0;e<this.p.cols.length;e++)t=this.p.cols[e],n="c"==t.a[0]?":":" ",s="r"==t.a[0]||"c"==t.a[0]?":":" ",o+=(0==e&&p.tbl_edges?"|":"")+n+r("-",t.w)+s+(e<this.p.cols.length-1||p.tbl_edges?"|":"");return"\n"+i(o)}]}):c.ctblk.extend(),c.tbody=p.gfm_tbls?c.cblk.extend():c.ctblk.extend(),c.tfoot=p.gfm_tbls?c.cblk.extend():c.ctblk.extend(),c.tr=p.gfm_tbls?c.cblk.extend({wrapK:[p.tbl_edges?"| ":"",p.tbl_edges?" |":""]}):c.ctblk.extend(),c.th=p.gfm_tbls?c.inl.extend({guts:null,wrap:[function(){var e,t=this.p.p.p.cols[this.i],n=0==this.i?"":" ",i=t.w-this.guts.length;switch(t.a[0]){case"r":e=r(" ",i);break;case"c":e=r(" ",Math.floor(i/2));break;default:e=""}return n+e},function(){var e,t=this.p.p.p.cols[this.i],n=this.i==this.p.c.length-1?"":" |",i=t.w-this.guts.length;switch(t.a[0]){case"r":e="";break;case"c":e=r(" ",Math.ceil(i/2));break;default:e=r(" ",i)}return e+n}],prep:function(){var e,t;this.guts=this.rendK(),this.rendK=function(){return this.guts},e=this.p.p.p.cols,e[this.i]||(e[this.i]={w:null,a:""}),t=e[this.i],t.w=Math.max(t.w||0,this.guts.length),this.e.align&&(t.a=this.e.align)}}):c.ctblk.extend(),c.td=c.th.extend(),c.txt=c.inl.extend({initK:function(){this.c=this.e.textContent.split(/^/gm)},rendK:function(){var e=this.c.join("").replace(/\r/gm,"");return this.p instanceof c.code||this.p instanceof c.pre||(e=e.replace(/^\s*#/gm,"\\#").replace(/\*/gm,"\\*")),0==this.i&&(e=e.replace(/^\n+/,"")),this.i==this.p.c.length-1&&(e=e.replace(/\n+$/,"")),e}}),c.rawhtml=c.blk.extend({initK:function(){this.guts=d(this.e)},rendK:function(){return this.guts}});for(f in p.unsup_tags)p.unsup_tags[f]=new RegExp("^(?:"+("inline"==f?"a|em|strong|img|code|del|":"")+p.unsup_tags[f].replace(/\s/g,"|")+")$")};return e}]).factory("neMarked",[function(){return function(){function e(e){this.tokens=[],this.tokens.links={},this.options=e||l.defaults,this.rules=d.normal,this.options.gfm&&(this.rules=this.options.tables?d.tables:d.gfm)}function t(e,t){if(this.options=t||l.defaults,this.links=e,this.rules=u.normal,this.renderer=this.options.renderer||new n,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.rules=this.options.breaks?u.breaks:u.gfm:this.options.pedantic&&(this.rules=u.pedantic)}function n(){}function r(e){this.tokens=[],this.token=null,this.options=e||l.defaults,this.options.renderer=this.options.renderer||new n,this.renderer=this.options.renderer}function i(e,encode){return e.replace(encode?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function s(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function o(){}function a(e){for(var t,n,r=1;r<arguments.length;r++){t=arguments[r];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}function l(t,n,s){var o,u,d,c,f;if(s||"function"==typeof n){s||(s=n,n=null),n=a({},l.defaults,n||{}),o=n.highlight,c=0;try{u=e.lex(t,n)}catch(h){return s(h)}return d=u.length,(f=function(){var e,t;try{e=r.parse(u,n)}catch(i){t=i}return n.highlight=o,t?s(t):s(null,e)})()}try{return n&&(n=a({},l.defaults,n)),r.parse(e.lex(t,n),n)}catch(h){if(h.message+="\nPlease report this to https://github.com/chjj/marked.",(n||l.defaults).silent)return"<p>An error occured:</p><pre>"+i(h.message+"",!0)+"</pre>";throw h}}var u,d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:o,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:o,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:o,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/,d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,d.item=s(d.item,"gm")(/bull/g,d.bullet)(),d.list=s(d.list)(/bull/g,d.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),d._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b",d.html=s(d.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,d._tag)(),d.paragraph=s(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)(),d.normal=a({},d),d.gfm=a({},d.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/}),d.gfm.paragraph=s(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=a({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=d,e.lex=function(t,n){var r=new e(n);return r.lex(t)},e.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},e.prototype.token=function(e,t){for(var n,r,i,s,o,a,l,u,c,e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(t&&(i=this.rules.nptable.exec(e))){for(e=e.substring(i[0].length),a={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/\n$/,"").split("\n")},u=0;u<a.align.length;u++)a.align[u]=/^ *-+: *$/.test(a.align[u])?"right":/^ *:-+: *$/.test(a.align[u])?"center":/^ *:-+ *$/.test(a.align[u])?"left":null;for(u=0;u<a.cells.length;u++)a.cells[u]=a.cells[u].split(/ *\| */);this.tokens.push(a)}else if(i=this.rules.lheading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:"="===i[2]?1:2,text:i[1]});else if(i=this.rules.hr.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"hr"});else if(i=this.rules.blockquote.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"blockquote_start"}),i=i[0].replace(/^ *> ?/gm,""),this.token(i,t),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),s=i[2],this.tokens.push({type:"list_start",ordered:s.length>1}),i=i[0].match(this.rules.item),n=!1,c=i.length,u=0;c>u;u++)a=i[u],l=a.length,a=a.replace(/^ *([*+-]|\d+\.) +/,""),~a.indexOf("\n ")&&(l-=a.length,a=this.options.pedantic?a.replace(/^ {1,4}/gm,""):a.replace(new RegExp("^ {1,"+l+"}","gm"),"")),this.options.smartLists&&u!==c-1&&(o=d.bullet.exec(i[u+1])[0],s===o||s.length>1&&o.length>1||(e=i.slice(u+1).join("\n")+e,u=c-1)),r=n||/\n\n(?!\s*$)/.test(a),u!==c-1&&(n="\n"===a.charAt(a.length-1),r||(r=n)),this.tokens.push({type:r?"loose_item_start":"list_item_start"}),this.token(a,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:"pre"===i[1]||"script"===i[1]||"style"===i[1],text:i[0]});else if(t&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),this.tokens.links[i[1].toLowerCase()]={href:i[2],title:i[3]};else if(t&&(i=this.rules.table.exec(e))){for(e=e.substring(i[0].length),a={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u<a.align.length;u++)a.align[u]=/^ *-+: *$/.test(a.align[u])?"right":/^ *:-+: *$/.test(a.align[u])?"center":/^ *:-+ *$/.test(a.align[u])?"left":null;for(u=0;u<a.cells.length;u++)a.cells[u]=a.cells[u].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(a)}else if(t&&(i=this.rules.paragraph.exec(e)))e=e.substring(i[0].length),this.tokens.push({type:"paragraph",text:"\n"===i[1].charAt(i[1].length-1)?i[1].slice(0,-1):i[1]});else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"text",text:i[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens},u={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:o,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:o,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/},u._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,u._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,u.link=s(u.link)("inside",u._inside)("href",u._href)(),u.reflink=s(u.reflink)("inside",u._inside)(),u.normal=a({},u),u.pedantic=a({},u.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),u.gfm=a({},u.normal,{escape:s(u.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(u.text)("]|","~]|")("|","|https?://|")()}),u.breaks=a({},u.gfm,{br:s(u.br)("{2,}","*")(),text:s(u.gfm.text)("{2,}","*")()}),t.rules=u,t.output=function(e,n,r){var i=new t(n,r);return i.output(e)},t.prototype.output=function(e){for(var t,n,r,s,o="";e;)if(s=this.rules.escape.exec(e))e=e.substring(s[0].length),o+=s[1];else if(s=this.rules.autolink.exec(e))e=e.substring(s[0].length),"@"===s[2]?(n=this.mangle(":"===s[1].charAt(6)?s[1].substring(7):s[1]),r=this.mangle("mailto:")+n):(n=i(s[1]),r=n),o+=this.renderer.link(r,null,n);else if(s=this.rules.url.exec(e))e=e.substring(s[0].length),n=i(s[1]),r=n,o+=this.renderer.link(r,null,n);else if(s=this.rules.tag.exec(e))e=e.substring(s[0].length),o+=this.options.sanitize?i(s[0]):s[0];else if(s=this.rules.link.exec(e))e=e.substring(s[0].length),o+=this.outputLink(s,{href:s[2],title:s[3]});else if((s=this.rules.reflink.exec(e))||(s=this.rules.nolink.exec(e))){if(e=e.substring(s[0].length),t=(s[2]||s[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){o+=s[0].charAt(0),e=s[0].substring(1)+e;continue}o+=this.outputLink(s,t)}else if(s=this.rules.strong.exec(e))e=e.substring(s[0].length),o+=this.renderer.strong(this.output(s[2]||s[1]));else if(s=this.rules.em.exec(e))e=e.substring(s[0].length),o+=this.renderer.em(this.output(s[2]||s[1]));else if(s=this.rules.code.exec(e))e=e.substring(s[0].length),o+=this.renderer.codespan(i(s[2],!0));else if(s=this.rules.br.exec(e))e=e.substring(s[0].length),o+=this.renderer.br();else if(s=this.rules.del.exec(e))e=e.substring(s[0].length),o+=this.renderer.del(this.output(s[1]));else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),o+=i(this.smartypants(s[0]));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return o},t.prototype.outputLink=function(e,t){var n=i(t.href),r=t.title?i(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,i(e[1]))},t.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/--/g,"—").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},t.prototype.mangle=function(e){for(var t,n="",r=e.length,i=0;r>i;i++)t=e.charCodeAt(i),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},n.prototype.code=function(e,t){return t?'<pre><code class="lang-'+t+'">'+i(e)+"\n</code></pre>\n":"<pre><code>"+i(e,!0)+"\n</code></pre>"},n.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},n.prototype.html=function(e){return e},n.prototype.heading=function(e,t){return"<h"+t+">"+e+"</h"+t+">\n"},n.prototype.hr=function(){return"<hr>\n"},n.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},n.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},n.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},n.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},n.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},n.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+"</"+n+">\n"},n.prototype.strong=function(e){return"<strong>"+e+"</strong>"},n.prototype.em=function(e){return"<em>"+e+"</em>"},n.prototype.codespan=function(e){return"<code>"+e+"</code>"},n.prototype.br=function(){return"<br>"},n.prototype.del=function(e){return"<del>"+e+"</del>"},n.prototype.link=function(e,t,n){var r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"},n.prototype.image=function(e,t,n){var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=">"},r.parse=function(e,t,n){var i=new r(t,n);return i.parse(e)},r.prototype.parse=function(e){this.inline=new t(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var n="";this.next();)n+=this.tok();return n},r.prototype.next=function(){return this.token=this.tokens.pop()},r.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},r.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},r.prototype.tok=function(){var e,t,n,r,i,s,o,a,l;switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth);case"code":return this.renderer.code(this.token.text,this.token.lang);case"table":for(e="",t="",i="",n=0;n<this.token.header.length;n++)s={header:!0,align:this.token.align[n]},i+=this.renderer.tablecell(this.inline.output(this.token.header[n]),{header:!0,align:this.token.align[n]});for(e+=this.renderer.tablerow(i),n=0;n<this.token.cells.length;n++){for(r=this.token.cells[n],i="",o=0;o<r.length;o++)i+=this.renderer.tablecell(this.inline.output(r[o]),{header:!1,align:this.token.align[o]});t+=this.renderer.tablerow(i)}return this.renderer.table(e,t);case"blockquote_start":for(t="";"blockquote_end"!==this.next().type;)t+=this.tok();return this.renderer.blockquote(t);case"list_start":for(t="",a=this.token.ordered;"list_end"!==this.next().type;)t+=this.tok();return this.renderer.list(t,a);case"list_item_start":for(t="";"list_item_end"!==this.next().type;)t+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(t);case"loose_item_start":for(t="";"list_item_end"!==this.next().type;)t+=this.tok();return this.renderer.listitem(t);case"html":return l=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text),this.renderer.html(l);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},o.exec=o,l.options=l.setOptions=function(e){return a(l.defaults,e),l},l.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,smartypants:!1,renderer:new n},l.Parser=r,l.parser=r.parse,l.Renderer=n,l.Lexer=e,l.lexer=e.lex,l.InlineLexer=t,l.inlineLexer=t.output,l.parse=l,"object"==typeof exports?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):this.marked=l}.call(function(){return this||("undefined"!=typeof window?window:global)}()),marked}]),!function(e,t){"function"==typeof define?define(t):"undefined"!=typeof module?module.exports=t():this[e]=t()}("klass",function(){function e(e){return i.call(t(e)?e:function(){},e,1)}function t(e){return typeof e===a}function n(e,t,n){return function(){var r,i=this.supr;return this.supr=n[u][e],r=t.apply(this,arguments),this.supr=i,r}}function r(e,r,i){for(var s in r)r.hasOwnProperty(s)&&(e[s]=t(r[s])&&t(i[u][s])&&l.test(r[s])?n(s,r[s],i):r[s])}function i(e,n){function i(){}function s(){this.init?this.init.apply(this,arguments):(n||l&&o.apply(this,arguments),d.apply(this,arguments))}i[u]=this[u];var o=this,a=new i,l=t(e),d=l?e:this,c=l?{}:e;return s.methods=function(e){return r(a,e,o),s[u]=a,this},s.methods.call(s,c).prototype.constructor=s,s.extend=arguments.callee,s[u].implement=s.statics=function(e,t){return e="string"==typeof e?function(){var n={};return n[e]=t,n}():e,r(this,e,o),this},s}var s=this,o=s.klass,a="function",l=/xyz/.test(function(){xyz})?/\bsupr\b/:/.*/,u="prototype";return e.noConflict=function(){return s.klass=o,this},s.klass=e,e}),angular.module("neDirectives",["neObject"]).directive("neInitData",[function(){return{priority:1e3,restrict:"AE",
compile:function(){return{pre:function(e,t,n){n.neInitData?e.$eval((n.neInitAs?n.neInitAs+"=":"")+n.neInitData):t.html()&&e.$eval((n.neInitAs?n.neInitAs+"=":"")+t.html()),n.neInitDone&&e.$eval(n.neInitDone)}}}}}]).service("neKeyPressHandler",[function(){return function(e,t,n){return function(r,i,s){function o(i){i.which===t&&(r.$apply(function(){r.$eval(s[e])}),n&&i.preventDefault())}var a;a="INPUT"===i[0].nodeName?i:angular.element(document),a.bind("keydown keypress",o),r.$on("$destroy",function(){a.unbind("keydown keypress",o)})}}}]).directive("neKeypressEnter",["neKeyPressHandler",function(e){return e("neKeypressEnter",13,!0)}]).directive("neKeypressEscape",["neKeyPressHandler",function(e){return e("neKeypressEscape",27,!0)}]).directive("neKeypressRight",["neKeyPressHandler",function(e){return e("neKeypressRight",39)}]).directive("neKeypressLeft",["neKeyPressHandler",function(e){return e("neKeypressLeft",37)}]).directive("neKeypressUp",["neKeyPressHandler",function(e){return e("neKeypressUp",38)}]).directive("neKeypressDown",["neKeyPressHandler",function(e){return e("neKeypressDown",40)}]).directive("neKeypressBackspace",["neKeyPressHandler",function(e){return e("neKeypressBackspace",8)}]).directive("neLoadingStart",["$timeout",function(e){return function(t,n,r){"IMG"===n[0].nodeName&&r.$observe("src",function(){e(function(){t.$eval(r.neLoadingStart)})})}}]).directive("neLoadingEnd",["$timeout",function(e){return function(t,n,r){function i(n){e(function(){t.$eval(r.neLoadingEnd)},5),n.preventDefault()}"IMG"===n[0].nodeName&&(n.bind("load",i),t.$on("$destroy",function(){n.unbind("load",i)}))}}]).directive("neStatusIcon",[function(){return{restrict:"A",compile:function(e,t){var n='<div class="right-inner-addon">'+("reverse"!==t.neStatusIcon?'<i class="fa fa-check text-success" ng-show="'+e.attr("ng-model")+'"></i>':"")+("reverse"===t.neStatusIcon?'<i class="fa fa-times text-danger" ng-show="!'+e.attr("ng-model")+'"></i>':"")+"</div>";e.wrap(n),e.removeAttr("status-icon")}}}]).directive("neMatchHrefPath",["$window","$location",function(e,t){return{priority:-100,link:function(n,r,i){function s(){(t.path()+"/").match(new RegExp("^"+o+"[/#?].*"))?r.addClass(l):r.removeClass(l)}var o,a,l=n.$eval(i.neMatchHrefPath)||i.neMatchHrefPath;if(l){if(i.href)try{o=n.$eval(i.href)}catch(u){o=i.href}else if(a=r.find("a")[0],o=a?a.getAttribute("href"):null,a&&o)try{o=n.$eval(o.replace("{{","").replace("}}",""))}catch(u){o=o}o&&-1===o.indexOf("#")?(o=o.replace(/^http:/g,"").replace(/^https:/g,"").replace(e.location.hostname,"").replace(/\/+/g,"/"),(e.location.pathname+"/").match(new RegExp("^"+o+"[/#?].*"))?r.addClass(l):r.removeClass(l)):o&&(o=o.match(/^([^\#]*)\#([^\#\?]*).*$/),o=o?o[o.length-1]:null,o&&n.$on("$locationChangeSuccess",s),s())}}}}]).directive("neFile",[function(){return{restrict:"E",template:'<input type="file" />',replace:!0,require:"ngModel",link:function(e,t,n,r){var i=function(){e.$apply(function(){var e,i;if(n.multiple||""===n.multiple){for(e=[],i=0;i<t[0].files.length;i++)e.push(t[0].files[i]);r.$setViewValue(e)}else r.$setViewValue(t[0].files[0])})};t.attr("accept",n.accept),t.bind("change",i)}}}]).service("neFileDropArea",[function(){return this.bind=function(e,t,n){function r(e){e.stopPropagation(),e.preventDefault()}function i(t){r(t),l||(e.addClass("ne-dragover"),l=!0)}function s(t){r(t),e.removeClass("ne-dragover"),l=!1}function o(e){var r,i,o,a;s(e),r=0,i=e.dataTransfer.files,o=i[0],o&&(r+=o.fileSize,n?(a=new FileReader,a.onerror=function(e){alert("Cannot read file: "+e.target.error)},a.onload=function(){return function(e){t(e.target.result)}}(o),a[n](o)):t(i))}var a=e[0],l=!1;return a.addEventListener("dragenter",i,!1),a.addEventListener("dragover",i,!1),a.addEventListener("dragleave",s,!1),a.addEventListener("drop",o,!1),{unbind:function(){l=null,a.removeEventListener("dragenter",i,!1),a.removeEventListener("dragover",i,!1),a.removeEventListener("dragleave",s,!1),a.removeEventListener("drop",o,!1)}}},this}]).directive("neFileDropArea",["neFileDropArea",function(e){return{restrict:"A",link:function(t,n,r){var i,s=r.neFileDropArea?new RegExp(r.neFileDropArea):null;n.on("load",function(){t.setNaturalHeight(this.naturalHeight),t.setNaturalWidth(this.naturalWidth)}),i=e.bind(n,function(e){var n,i=[],o=r.neFileDrop||r.neFilesDrop||r.ondrop;for(n=0;n<e.length;n++)(!s||e[n].type.match(s))&&i.push(e[n]);t.files=i,i.length&&o&&t.$apply(o)}),t.$on("$destroy",i.unbind)}}}]).directive("neCopy",[function(){return{restrict:"A",link:function(e,t,n){function r(){e[o]=angular.copy(s)}function i(){var t,n=e[o];for(t in n)!n.hasOwnProperty(t)||"$"===t[0]&&"$"===t[1]||(s[t]=n[t])}var s=e.$eval(n.neCopy),o=e.alias||n.neCopyAlias||"$copy";e.$rollback=r,e.$commit=i,s.$commit=i,s.$rollback=r,e.$rollback()}}}]).directive("neFormChange",[function(){return{restrict:"A",require:"^form",link:function(e,t,n,r){e.$watch(function(){return r.$valid},function(t){e.$valid=e.$isValid=t,e.$eval(n.neFormChange)})}}}]).directive("neBindHtml",["$sce",function(){return{restrict:"A",link:function(e,t,n){n.$observe("neBindHtml",function(e){t.html(e)})}}}]).filter("html",["$sce",function(e){return function(t){return e.trustAsHtml(t)}}]).filter("trusted",["$sce",function(e){return function(t){return e.trustAsHtml(t)}}]),angular.module("neDragdrop",[]).directive("draggable",[function(){return function(e,t,n){function r(e){return e.preventDefault(),!1}function i(t){return t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("Text",this.id),this.classList.add("dragged"),n.drag&&e.$apply(n.drag),!1}function s(){return this.classList.remove("dragged"),!1}var o=t[0];"false"===n.draggable?(o.addEventListener("dragstart",r),e.$on("$destroy",function(){o.removeEventListener("dragstart",r)})):(o.draggable=!0,o.addEventListener("dragstart",i),o.addEventListener("dragend",s),e.$on("$destroy",function(){o.removeEventListener("dragstart",r),o.removeEventListener("dragend",s)}))}}]).directive("droppable",[function(){return function(e,t,n){function r(e){return e.dataTransfer.dropEffect="move",e.preventDefault&&e.preventDefault(),this.classList.add("dragover"),!1}function i(){return this.classList.add("dragover"),!1}function s(){return this.classList.remove("dragover"),!1}function o(t){return t.stopPropagation&&t.stopPropagation(),t.preventDefault(),this.classList.remove("dragover"),n.drop&&e.$apply(n.drop),!1}var a=t[0];a.addEventListener("dragover",r),a.addEventListener("dragenter",i),a.addEventListener("dragleave",s),a.addEventListener("drop",o),e.$on("$destroy",function(){a.removeEventListener("dragover",r),a.removeEventListener("dragenter",i),a.removeEventListener("dragleave",s),a.removeEventListener("drop",o)})}}]),angular.module("neGrid",["neObject","neLocal"]).run(["$templateCache",function(e){e.put("neGrid/pagination.html",'<div ng-if="!paginationDisabled" class="row text-{{fontSize}}"> <div class="col-xs-12 col-sm-9 col-md-10 text-center"> <div class="btn-group btn-group-{{size}}"> <button class="btn btn-default" ng-disabled="grid.prevDisabled" ng-click="grid.setPage(\'first\')"><span class="fa fa-fast-backward"></span></button> <button class="btn btn-default" ng-disabled="grid.prevDisabled" ng-click="grid.setPage(\'prev\')"><span class="fa fa-backward"></span></button> </div> <span> <span ng-if="grid.pagesCount"> {{\'page\'|translate}} </span> <input type="number" class="input-{{size}} width-sm" ng-model="grid.pagination.page" min="1" max="{{grid.pagination.pages||\'\'}}" ne-keypress-enter="grid.setPage(grid.pagination.page)"> <span ng-if="grid.pagesCount"> {{\'of\'|translate}} {{grid.pagesCount}} </span> <span ng-if="grid.pagesCount" class="hidden-xs">({{grid.pagination.count}} {{\'items\'|translate}})</span> </span> <div class="btn-group btn-group-{{size}}"> <button class="btn btn-default" ng-disabled="grid.nextDisabled" ng-click="grid.setPage(\'next\')"><span class="fa fa-forward"></span></button> <button class="btn btn-default" ng-disabled="grid.nextDisabled || !grid.pagesCount" ng-click="grid.setPage(\'last\')"><span class="fa fa-fast-forward"></span></button> </div> </div> <div class="col-sm-3 col-md-2 text-right hidden-xs"> <div class="input-group"> <input class="input-{{size}} width-sm" type="number" ng-model="grid.limit" ne-keypress-enter="grid.setPage(\'first\')" min="1" max="{{grid.maxLimit}}"> <span class="input-group-btn"> <button class="btn btn-default btn-{{size}}" ng-click="grid.setPage(\'first\')"><span class="fa fa-refresh"></span></button> </span> </div> </div></div>')}]).directive("neGridPagination",[function(){return{templateUrl:"neGrid/pagination.html",scope:{grid:"=neGridPagination"},link:function(e,t,n){e.size=n.neGridPaginationSize||"sm",e.fontSize="base","xs"===e.size&&(e.fontSize="sm"),"lg"===e.size&&(e.fontSize="lg")}}}]).directive("neGridUpdateBlur",["$timeout","neObject",function(e,t){return{restrict:"A",require:"?ngModel",link:function(e,n,r,i){function s(e){p=e,p?n.addClass(l):n.removeClass(l)}function o(){a(),r.afterUpdate&&e.$eval(r.gridAfterUpdate)}function a(){s(!1),g=i.$viewValue}var l,u,d,c,f,h,p,g;if(i){if(l=r.dirtyClass||"is-dirty","ng-dirty"===l)throw new Error('dirtyClass cannot be equal to "ng-dirty", it is angular reserved class name');if(u=(r.gridUpdateBlur||"").split(","),d=u[0]||"grid",c=u[1]||"item",f=t.deepGet(e,d),h=t.deepGet(e,c),!f)throw new Error('Scope has not grid with name "'+d+'"');if(!h)throw new Error('Scope has not grid item with name "'+c+'"');p=!1,n.on("blur",function(){p&&f.updateItem(h,o)}),n.bind("keydown keypress",function(e){13===e.which&&p&&"INPUT"===n[0].nodeName&&(f.updateItem(h,o),e.preventDefault())}),g="",e.$watch(i.$viewValue,function(){g=i.$viewValue}),i.$viewChangeListeners.push(function(){s(g!==i.$viewValue?!0:!1)})}}}}]).factory("NeGrid",["$timeout","neObject",function(e,t){function n(e){var t,q=[{},n.defaults];for(t=0;t<arguments.length;t++)q.push(arguments[t]);return e=angular.merge.apply(angular,q),this.id=e.id,this.idKey=e.idKey||"id",this.defaultLimit=e.defaultLimit||10,this.limit=e.limit||this.defaultLimit,this.maxLimit=e.maxLimit||100,this.defaultQuery=e.defaultQuery||{},this.defaultSort=e.defaultSort||{},this.interceptLoad=e.interceptLoad||e.beforeLoad||e.loadInterceptor,this.onQuery=e.onQueryChange||e.onQuery||e.onFilter,this.onLoad=e.onLoad,this.onFill=e.onFill||e.onData,this.onSelect=e.onSelect,this.onFocus=e.onFocus,this.onUpdate=e.onUpdate,this.onCreate=e.onCreate,this.onRemove=e.onRemove,this.resource=e.restResource||e.resource,this.getResourceMethod=e.getResourceMethod||e.resourceMethod||("function"==typeof this.resource?this.resource:null)||i,this.autoLoad=e.autoLoad||e.loadOnChange,this.multiSelect=e.multiSelect||e.multiselect||!1,this.silentMode=!1,this.pagination={page:e.page||this.defaultQuery.$page||1},this.page=this.pagination.page,this.pagesCount=1,this.query=angular.merge({},e.query||{},{$page:this.page,$limit:this.limit},this.defaultQuery),this.sort=angular.merge({},this.defaultSort||{},e.sort||{}),this.items=[],this.disabled=!0,this.doSilent=this.doSilent,this.fillItems=s,this.addItems=o,this.addItem=o,this.appendItems=o,this.appendItem=o,this.prependItems=a,this.prependItem=a,this.setSort=l,this.setSortSilent=r("setSort"),this.setSortBy=u,this.setSortBySilent=r("setSortBy"),this.updateQuery=h,this.updateQuerySilent=r("updateQuery"),this.setQuery=f,this.setQuerySilent=r("setQuery"),this.setFilter=f,this.setFilterSilent=r("setQuery"),this.setPage=c,this.setPageSilent=r("setPage"),this.load=d,this.refresh=d,this.createItem=p,this.updateItem=g,this.refreshItem=m,this.removeItem=y,this.selectItem=$,this.selectAll=w,this.toggleItemSelection=x,this.toggleSelection=k,this.focusItem=v,this.getFocusedItem=b,this.getSelectedItems=S,this.clearSelection=_,this}function r(e){return function(){var t=this;return t.silentMode=!0,t[e].apply(t,arguments),t.silentMode=!1,t}}function i(e){if(!this.resource)throw new Error("NeGrid: resource is undefined");return this.resource[e]}function s(e,t){var n=this;return t=t||{},n.items=e,n.pagination=t,n.pagesCount=Math.ceil(t.count/n.limit),n.prevDisabled=t.page<=1?!0:!t.prev,n.nextDisabled=t.spage>=n.pagesCount?!0:!t.next,"function"!=typeof n.onFill||n.silentMode||n.onFill(n.items,n.pagination,n.query),this}function o(e){return e=Array.isArray(e)?e:[e],Array.prototype.push.apply(this.items,e),this}function a(e){return e=Array.isArray(e)?e:[e],Array.prototype.unshift.apply(this.items,e),this}function l(e,t){var n=this;return n.sort=e,n.setPage("first",t)}function u(e,t){if(e){var n={};return n[e]=t||this.sortDir,this.setSort(n)}}function d(e){var t=this;return(!t.interceptLoad||t.interceptLoad&&t.interceptLoad(t.query)!==!1)&&(t.disabled=!0,t.getResourceMethod("find")(t.query,function(n,r){"function"==typeof t.onLoad&&t.onLoad(n,r),t.fillItems(n,r),e&&e(),t.disabled=!1})),t}function c(e,t,n){var r,i;return"function"==typeof arguments[0]&&(t=arguments[0],e=null),r=this,i="number"==typeof e?e:"first"===e?1:"next"===e?r.pagination.page+1:"last"===e?r.pagesCount:"prev"===e?r.pagination.page-1:"refresh"===e||null===e?r.pagination.page||1:1,r.pagesCount&&i>r.pagesCount&&"number"!=typeof e&&(i=r.pagesCount+0),0>=i&&(i=1),r.page=i,r.updateQuery(n),r.autoLoad&&!r.silentMode?r.load(t):(t&&t(),r)}function f(e,t){var n=this;return n.query=angular.merge({},n.defaultQuery||{},e||{}),n.setPage(n.query.$page||"first",t,e),n}function h(e){var t,n=this;return e=e||{},n.page=e.$page||n.page,n.limit=e.$limit||n.limit,n.sort=e.$sort||n.sort,n.page&&("number"!=typeof n.page||n.page<=0)&&(n.page=1),!n.limit||n.limit<0?n.limit=n.defaultLimit:n.limit>n.maxLimit&&(n.limit=n.maxLimit),t=angular.merge({},e,{$limit:n.limit,$sort:{},$page:n.page}),n.sort&&(t.$sort=n.sort),t.$sort=angular.merge({},n.defaultSort||{},t.$sort||{}),0===Object.keys(t.$sort).length&&delete t.$sort,delete n.query.$page,delete n.query.$sort,delete n.query.$limit,n.query=angular.merge(t,n.query||{}),n.onQuery&&!n.silentMode&&n.onQuery(n.query),n}function p(e,t){var n=this;return n.getResourceMethod("create",e)(e,function(){n.setPage("first",t),"function"==typeof n.onCreate&&n.onCreate(e),n.autoLoad||n.load(t)}),n}function g(e,t){var n=this;return n.getResourceMethod("update",e)(e,function(r){var i=n.items.indexOf(e),s=angular.copy(e);n.items[i]=angular.extend(n.items[i],r),n.onUpdate&&n.onUpdate(n.items[i],s),t&&t(n.items[i])}),n}function m(e,n){var r=this,i=r.idKey,s={};return s[i]=t.deepGet(e,i),r.getResourceMethod("find",e)(s,function(t){var i=r.items.indexOf(e);r.items[i]=angular.extend(r.items[i],t[0]),n&&n(r.items[i])}),r}function y(e,t){var n=this;return n.getResourceMethod("remove",e)(e,function(){n.items.splice(n.items.indexOf(e),1),n.onRemove&&n.onRemove(e),t&&t(e)}),n}function v(e){var t,n=this;if(e.$focused===!0)return n;for(t=0;t<n.items.length;t++)n.items[t].$focused=!1;return e.$focused=!0,n.focusedItem=e,"function"==typeof n.onFocus&&n.onFocus(e),n}function b(){var e,t=this;for(e=0;e<t.items.length;e++)if(t.items[e].$focused===!0)return t.items[e]}function $(e,t){var n,r=this;if(!r.multiSelect)for(n=0;n<r.items.length;n++)delete r.items[n].$selected;return e.$selected="boolean"==typeof t?t:!e.$selected,"function"==typeof r.onSelect&&r.onSelect(e),r}function x(e){return this.selectItem(e)}function w(e){var t,n=this;if(!n.multiSelect)return n;for(t=0;t<n.items.length;t++)n.selectItem(n.items[t],e);return n}function k(){return this.selectAll()}function _(){var e,t=this;for(e=0;e<t.items.length;e++)delete t.items[e].$selected;return t}function S(){var e,t=this,n=[];for(e=0;e<t.items.length;e++)t.items[e].$selected===!0&&n.push(t.items[e]);return n}return n.defaults={},n.define=n.create=function(e){return new n(e)},n}]),angular.module("neLoading",[]).constant("neLoadingDebounce",350).constant("neLoadingEndDelay",300).factory("neLoading",["$timeout","neLoadingDebounce","neLoadingEndDelay",function(e,t,n){function r(e){var t=0,n=e/100;return t=n>=0&&.25>n?(3*Math.random()+3)/100:n>=.25&&.65>n?3*Math.random()/100:n>=.65&&.9>n?2*Math.random()/100:n>=.9&&.99>n?.005:0,e+Math.ceil(100*t)}var i={requestCount:0,isLoading:function(){return i.requestCount>0},statusTimeout:null,status:0,prevStatus:0,lastStart:(new Date).getTime(),statusListeners:[],fireStatusListeners:function(){for(var t=0;t<i.statusListeners.length;t++)!function(t){e(function(){i.statusListeners[t](i.status)},0,!1)}(t)},setStatus:function(s){if(i.statusTimeout&&e.cancel(i.statusTimeout),!(0>s)){i.prevStatus=i.status+0,i.status=s;var o=(new Date).getTime();0===i.prevStatus&&s>0&&(i.lastStart=o),o-i.lastStart>t&&i.fireStatusListeners(),i.status>0&&i.status<99?i.statusTimeout=e(function(){i.setStatus(r(i.status))},t,!1):i.status>=100&&(o-i.lastStart>t?i.statusTimeout=e(function(){i.setStatus(0),i.fireStatusListeners()},n,!1):(i.status=0,i.prevStatus=0))}},reqStarted:function(e){0===i.status&&i.setStatus(1),i.requestCount++,e&&console.log(e,i.requestCount,i.status)},reqEnded:function(e){i.requestCount>0&&i.requestCount--,e&&console.log(e,i.requestCount,i.status),0===i.requestCount&&i.setStatus(100)}};return i}]).factory("neLoadingInterceptor",["$q","$cacheFactory","neLoading",function(e,t,n){function r(e){var n,r;return e?"GET"!==e.method||e.cache===!1?(e.cached=!1,!1):(n=e.cache===!0?t.get("$http"):e.cache,r=void 0!==n?void 0!==n.get(e.url):!1,void 0!==e.cached&&r!==e.cached?e.cached:(e.cached=r,r)):!1}return{request:function(e){return e.ignoreLoading||r(e)||n.reqStarted(),e},response:function(e){return e.config.ignoreLoading||r(e.config)||n.reqEnded(),e},responseError:function(t){return t.config.ignoreLoading||r(t.config)||n.reqEnded(),e.reject(t)}}}]).config(["$httpProvider",function(e){e.interceptors.push("neLoadingInterceptor")}]).controller("NeLoadingCtrl",["$scope","neLoading",function(e,t){t.statusListeners.push(function(t){e.status=t,e.loading=t>0,e.$digest()})}]),angular.module("neLocal",[]).provider("neLocal",[function(){var e="default",t={"default":{common:{}}},n="/";return this.translate=function(r){var i,s;return void 0===r||null===r?"":(i=r+"",s=t[e]||{},s.common=s.common||{},(s[n]?s[n][i]:null)||s.common[i]||(t["default"][n]?t["default"][n][i]:null)||t["default"].common[i]||i||"")},this.setPath=function(e){n=e},this.language=function(t){return t&&(e=t),e},this.languages=function(e){return e?t[e]:t},this.getLanguageId=function(){return e},this.getLanguagePath=function(){return n},this.set=this.translations=function(e,n,r,i){if(t[e]=t[e]||{},t[e].common=t[e].common||{},4===arguments.length)t[e][n]=t[e][n]||{},t[e][n][r]=i;else if(3===arguments.length&&angular.isObject(r))t[e][n]=t[e][n]||{},angular.extend(t[e][n],r);else if(3===arguments.length)i=arguments[2],r=arguments[1],t[e].common[r]=i;else{if(2!==arguments.length)throw new Error("Wrong arguments");r=arguments[1];var s=angular.isObject(r.common);angular.extend(s?t[e]:t[e].common,r)}},this.$get=function(){return this},this}]).run(["$rootScope","$location","neLocal",function(e,t,n){e.$on("$routeChangeStart",function(){n.setPath(t.path())})}]).filter("neTranslate",["neLocal",function(e){return function(t){return e.translate(t)}}]).filter("translate",["neLocal",function(e){return function(t){return e.translate(t)}}]),angular.module("neMenu",[]).factory("NeMenu",["$document","$timeout",function(e,t){function n(e,t){var n,r;if("string"!=typeof e)throw new Error("NeMenu: menu ID is required !");return i[e]?i[e]:(n={id:e},r=angular.merge(this,n,t||{}),r.items=[],i[e]=r,r)}function r(n){t(function(){function r(){t(function(){n.selected=!1,e.unbind("click",r)})}e.bind("click",r)},0,!1)}var i={};return n.prototype.set=function(e,t){var n=this;return n[e]=t,n.onChange&&n.onChange(e,t),n},n.prototype.toggle=function(e){var t=this;return t[e]=!t[e],t.onChange&&t.onChange(e,t[e]),t},n.prototype.select=n.prototype.selectItem=function(e,t){var n,i,s=this;for(t&&(e.onSelect||e.children&&e.children.length)&&(t.preventDefault(),e.selected||r(e)),i=0;i<s.items.length;i++)s.items[i].selected&&(n=s.items[i]),s.items[i].selected=s.items[i]===e?!s.items[i].selected:!1;return s.onSelect&&s.onSelect(e,n),e.onSelect&&e.onSelect(e,n),s},n.prototype.get=n.prototype.getItem=function s(e,t){var n,r,i=this,o=(t?t.children:i.items)||[];for(r=0;r<o.length;r++)if(o[r].id===e)return o[r];for(r=0;r<o.length;r++)if(o[r].children&&(n=s(e,o[r])))return n},n.get=function(e){return i[e]},n}]),angular.module("neModals",[]).factory("neModals",["$timeout","$sce",function(e,t){function n(e){e=e||r.defaults;for(var n in e)this[n]=e[n];return this.id=e.id||"modal_"+Object.keys(r.items).length,this.backdrop=!0,e.backdrop===!1&&(this.backdrop=!1),this.backdropOpacity=this.backdropOpacity||r.defaults.backdropOpacity,this.css=this.css||r.defaults.css,this.zIndex=r.defaults.zIndex,this.showAfterCreate=void 0===this.showAfterCreate?!0:this.showAfterCreate,this.removeOnClose=void 0===this.removeOnClose?!0:this.removeOnClose,this.destroyOnClose=void 0===this.destroyOnClose?!0:this.destroyOnClose,this.html=this.html?t.trustAsHtml(this.html):"",this.include=this.include||this.templateUrl||this.bodyTemplateUrl,this.show=this.open=function(){this.visible||(this.visible=!0,0===r.opened&&angular.element(document.getElementsByTagName("body")).addClass("modal-open"),r.opened++,this.zIndex=r.defaults.zIndex+11*r.opened,r.fireChangeListeners())},this.hide=this.close=function(){this.visible&&(this.visible=!1,r.opened--,this.removeOnClose&&this.destroyOnClose&&r.remove(this.id),0===r.opened&&angular.element(document.getElementsByTagName("body")).removeClass("modal-open"),r.fireChangeListeners(),"function"==typeof this.onClose&&this.onClose())},r.items[this.id]=this,this.showAfterCreate?this.show():r.fireChangeListeners(),this}var r={items:{},defaults:{visible:!1,backdrop:!0,backdropOpacity:.4,css:"",removeOnClose:!1,destroyOnClose:!1,showAfterCreate:!0,title:"modal title",zIndex:1040,text:"",html:"",include:"",buttons:[{text:"Cancel",disabled:!1,css:"btn-default",click:function(){}},{text:"Ok",disabled:!1,css:"btn-primary",click:function(){}}]},opened:0,changeListeners:[],fireChangeListeners:function(){for(var t=0;t<this.changeListeners.length;t++)!function(t){e(function(){r.changeListeners[t](r.items)},0,!1)}(t)}};return r.create=function(e){return new n(e)},r.get=function(e){return r.items[e]},r.remove=function(e){delete r.items[e]},r}]).controller("NeModalsCtrl",["$scope","neModals",function(e,t){t.changeListeners.push(function(t){e.modals=t,e.$digest()})}]).directive("neModalsContainer",[function(){return{templateUrl:"neModals/container.html"}}]).run(["$templateCache",function(e){e.put("neModals/container.html",'<div ng-controller="NeModalsCtrl"> <div ng-repeat="(id,modal) in modals"> <div class="modal ng-hide" ng-show="modal.visible" style="z-index:{{modal.zIndex}};"> <div class="modal-dialog {{modal.css}}" ng-class="{\'modal-full\':modal.wide,\'modal-lg\':modal.large||modal.lg,\'modal-xs\':modal.small||modal.xs}"> <div class="modal-content"> <div class="modal-header"> <button class="close" ng-click="modal.hide()"><i class="fa fa-times fa-fw fa-lg"></i></button> <button class="close" ng-click="modal.wide = !modal.wide"> <i style="font-size:15px;margin-right:5px;" class="fa fa-fw" ng-class="{\'fa-expand\':!modal.wide,\'fa-compress\':modal.wide}"></i> </button> <h4 class="modal-title">{{modal.title|translate}}</h4> </div> <div class="modal-body"> {{modal.text|translate}} <div ng-bind-html="modal.html"></div> <div ng-include="modal.include"></div> </div> <div class="modal-footer" ng-show="modal.buttons"> <button ng-repeat="button in modal.buttons" type="button" ng-disabled="button.disabled" class="{{button.css}}" ng-click="button.click()">{{button.text|translate}}</button> </div> </div> </div> </div> <div class="modal-backdrop in" ng-show="modal.visible && modal.backdrop" ng-style="{\'z-index\':modal.zIndex-10,\'opacity\':modal.opacity}"></div> </div></div>')}]),angular.module("neNotifications",["neLoading"]).factory("neNotifications",["$timeout",function(e){function t(e,t,n,r){2===r.length&&"string"!=typeof r[1]&&(n=r[1],t=r[0],e="")}var n=this;return n.timeout=3e3,n.queue=[],n.changeListeners=[],n.fireListeners=function(){for(var t=0;t<n.changeListeners.length;t++)!function(t){e(function(){n.changeListeners[t](n.queue)},0,!1)}(t)},n.add=n.show=n.create=function(t,r,i,s,o){function a(){n.remove(this.id)}function l(e){e=e||{},delete e.id;var t=n.getIndex(this.id);return t>-1&&(n.queue[t]=angular.merge(this,e)),n.fireListeners(),this}function u(t){var r,i=this;i.timeoutPromise&&e.cancel(i.timeoutPromise),i.fixed||"number"!=typeof t||(r=i.timeout-((new Date).getTime()-i.showTime),r=0>r?0:r,i.showTime=(new Date).getTime(),i.timeout=r+t,i.timeoutPromise=e(function(){n.remove(i.id)},i.timeout,!1))}var d,c,f,h={};return 4===arguments.length&&"string"!=typeof arguments[3]?(o=arguments[3],s=""):3===arguments.length&&"string"!=typeof arguments[2]?(o=arguments[2],i=arguments[1],r=""):2===arguments.length&&"string"!=typeof arguments[2]?(o=arguments[1],i=arguments[0],r="",t="info"):2===arguments.length&&"string"==typeof arguments[2]?(i=arguments[1],r=""):1===arguments.length&&angular.isObject(arguments[0])&&(h=arguments[0],t=h.type,r=h.title,s=h.icon,i=h.text,o=h.timeout),("error"===t||"danger"===t)&&(t="danger"),d=(new Date).getTime()+Math.floor(100*Math.random()+1),c=angular.merge(h,{id:h.id||d,type:t,title:r,icon:s,text:i,timeout:0,fixed:!1,close:a,hide:a,destroy:a,update:l,postpone:u}),c.include=h.bodyTemplateUrl||h.include,f=n.getIndex(c.id),f>-1?n.queue[f]=c:n.queue.push(c),n.fireListeners(),o!==!1&&0!==o?(c.timeout=parseInt(o,10),c.showTime=(new Date).getTime(),c.timeoutPromise=e(function(){n.remove(c.id)},c.timeout||n.timeout,!1)):c.fixed=!0,c},n.error=n.danger=n.danger=function(e,r,i){return t(e,r,i,arguments),this.show("error",e,r,"fa fa-exclamation-circle fa-2x",void 0!==i?i:2*n.timeout)},n.success=function(e,n,r){return t(e,n,r,arguments),this.show("success",e,n,"fa fa-check-circle fa-2x",r)},n.warning=function(e,n,r){return t(e,n,r,arguments),this.show("warning",e,n,"fa fa-warning fa-2x",r)},n.info=function(e,n,r){return t(e,n,r,arguments),this.show("info",e,n,"fa fa-info-circle fa-2x",r)},n.getIndex=function(e){for(var t=0;t<n.queue.length;t++)if(n.queue[t].id===e)return t},n.get=function(e){return n.queue[n.getIndex(e)]},n.remove=n.hide=function(e){var t=n.getIndex(e);-1!==t&&(n.queue.splice(t,1),n.fireListeners())},n}]).controller("NeNotificationsCtrl",["$scope","neNotifications",function(e,t){t.changeListeners.push(function(t){e.notifications=t,e.$digest()})}]).directive("neNotificationsContainer",[function(){return{templateUrl:"neNotifications/container.html"}}]).run(["$templateCache",function(e){e.put("neNotifications/container.html",'<div class="notification-container" ng-controller="NeNotificationsCtrl"> <div ng-show="true" class="ng-hide"> <div ng-repeat="n in notifications" class="alert alert-{{n.type}}" ng-click="n.fixed=true;n.postpone()" ng-mouseenter="n.postpone()" ng-mouseleave="n.postpone(1000)"> <i class="alert-pin fa fa-thumb-tack" ng-if="n.fixed"></i> <table style="width:100%;word-wrap:break-word" class="table-fixed"> <tr> <td style="width:15%"> <i class="{{n.icon}}"></i> </td> <td style="padding:0px 5px"> <div ng-if="!n.include" style="overflow:auto;max-height:200px"> <strong ng-if="n.title"><span ne-bind-html="{{n.title|translate}}"></span><br></strong> <span ne-bind-html="{{n.text|translate}}"></span> </div> <div ng-if="n.include" ng-include="n.include"></div> </td> <td style="width:20px"> <a href="" ng-click="n.close()"><i class="fa fa-fw fa-times"></i></a> </td> </tr> </table> </div> <div class="alert alert-default" ng-show="loading" ng-controller="NeLoadingCtrl"> <table style="width:100%"> <tr> <td style="width:15%"> <i class="fa fa-fw fa-spinner fa-spin fa-2x"></i> </td> <td style="padding:0px 5px"> <strong>{{::\'Loading...\'|translate}}</strong> </td> </tr> </table> </div> </div></div>')}]),angular.module("neObject",[]).factory("neObject",["$timeout",function(e){function t(e){var t,n,r;if(!e||"[object Object]"!==Object.prototype.toString.call(e)||e.nodeType||e.setInterval)return!1;if(t=hasOwnProperty.call(e,"constructor"),n=hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"),e.constructor&&!t&&!n)return!1;for(r in e);return void 0===r||w.call(e,r)}function n(){var e,n,i,s,o,a,l=this.extendReservedInstances,u=this,d=arguments[0]||{},c=1,f=arguments.length,h=!1;for("boolean"==typeof d&&(h=d,d=arguments[1]||{},c=2),"object"!=typeof d&&"function"!=typeof d&&(d={});f>c;c++){if(e=arguments[c],r(e,l))return d=e;if(null!==e)for(n in e)i=d[n],s=e[n],r(s,l)?d[n]=s:d!==s&&(h&&s&&(t(s)||(o=Array.isArray(s)))?(o?(o=!1,a=i&&Array.isArray(i)?i:[]):a=i&&t(i)?i:{},d[n]=u.extend(h,a,s)):void 0!==s&&(d[n]=s))}return d}function r(e,t){for(var n=0;n<t.length;n++)if(e instanceof t[n])return!0;return!1}function i(e,t,n){var r,s;if(angular.isObject(e)){n=n||"";for(s in e)angular.isObject(e[s])&&i(e[s],t,""===n?s:n+"."+s),r=t(""===n?s:n+"."+s,s,e[s]),void 0===r?delete e[s]:e[s]=r}}function s(e,t,n,r){var i,s=t.split("."),o=e;if("this"===t)"push"===r?e.push(n):e=n.toString();else for(i=0;i<s.length;i++)i>=s.length-1?"push"===r?o[s[i]].push(n):o[s[i]]=n:o[s[i]]=void 0===o[s[i]]||null===o[s[i]]?{}:o[s[i]],o=o[s[i]];return e}function o(e,t){var n,r,i;if(!e&&e!==!1&&0!==e||"function"==typeof e)return void 0;if("this"===t)return e;for(n=t.split("."),r=e,i=0;i<n.length;i++){if(!r[n[i]]&&r[n[i]]!==!1&&0!==r[n[i]])return void 0;r=r[n[i]]}return"function"==typeof r?void 0:r}function a(e,t){var n,r;if(e=e||{},t=t||"",n=t.split("."),0!==n.length){if(1===n.length)return void delete e[n[0]];for(r=0;r<n.length-1;r++)if(e=e[n[r]],!e)return;delete e[n[n.length-1]]}}function l(e,t,n){return 2===arguments.length&&(n=arguments[1],t=1),"asc"===t&&(t=1),"desc"===t&&(t=-1),n.sort(function(n,r){return n[e]>r[e]?t:n[e]<r[e]?-t:0}),n}function u(e,t,n){var r,i=[];for(r in e)"$key"!==r&&"$sortIndex"!==r&&e.hasOwnProperty(r)&&(e.$key=r,t&&(e.$sortIndex=o(e[r],t)),i.push(e[r]));return t?l("$sortIndex",n||"asc",i):i}function d(e,t){var n,r,i;if(!angular.isArray(e)||!t)return{};for(n={},i=0;i<e.length;i++)r=o(e[i],t),n[r]=e[i];return n}function c(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function f(e){return e&&e.window===e}function h(e){return e&&e.$evalAsync&&e.$watch}function p(e){return"$"===e[0]&&"$"===e[1]?!0:void 0}function g(e,t,n){if(n=n||p,e===t)return!0;if(null===e||null===t)return!1;if(e!==e&&t!==t)return!0;var r,i,s,o=typeof e,a=typeof t;if(o==a&&"object"==o){if(!angular.isArray(e)){if(angular.isDate(e))return angular.isDate(t)?g(e.getTime(),t.getTime(),n):!1;if(c(e))return c(t)?e.toString()==t.toString():!1;if(h(e)||h(t)||f(e)||f(t)||angular.isArray(t)||angular.isDate(t)||c(t))return!1;s=Object.create(null);for(i in e)if(!n(i)&&!angular.isFunction(e[i])){if(!g(e[i],t[i],n))return!1;s[i]=!0}for(i in t)if(!(i in s||n(i)||!angular.isDefined(t[i])||angular.isFunction(t[i])))return!1;
return!0}if(!angular.isArray(t))return!1;if((r=e.length)==t.length){for(i=0;r>i;i++)if(!g(e[i],t[i],n))return!1;return!0}}return!1}function m(t,n,r){n=angular.isUndefined(n)?0:n,r=angular.isUndefined(r)?!0:r;var i;return function(){var s,o;return i&&e.cancel(i),s=this,o=arguments,i=e(function(){i=null,t.apply(s,o)},n,r)}}function y(e,t){var n,r,i,s;if(void 0===t&&(t=!0),"string"==typeof e&&(r=e.match(t?_:k)))return i=Date.parse(r[0]),isNaN(i)||(e=new Date(i)),e;if("object"!=typeof e)return e;for(s in e)n=e[s],"string"==typeof n&&(r=n.match(t?_:k))?(i=Date.parse(r[0]),isNaN(i)||(e[s]=new Date(i))):"object"==typeof n&&y(n,t);return e}function v(e,t){var n;try{n=JSON.parse(e)}catch(r){}return y(n,t)}function b(e,t){var n,r;if("object"!=typeof e||!t)return e;for(n in e)e.hasOwnProperty(n)&&(r=e[n],0===n.indexOf(t)?delete e[n]:"object"==typeof r&&b(r,t))}function $(e){return"[object Object]"===Object.prototype.toString.call(e)}function x(e){return Array.isArray(e)}var w=Object.prototype.hasOwnProperty,k=/^(\d{4}|\+\d{6})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})\.(\d{1,})(Z|([\-+])(\d{2}):(\d{2}))?)?)?)?$/,_=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;return{isObject:$,isArray:x,extendReservedInstances:[File,FileList,Blob],extend:n,setObjValue:s,deepSet:s,getObjValue:o,deepGet:o,deepReplace:i,deepRemove:a,deepEquals:g,deepEqual:g,objectToArray:u,arrayToObject:d,dateStringsToDates:y,fromJson:v,fromJSON:v,removePrefixedProps:b,debounce:m}}]),angular.module("neQuery",["neLocal","neObject"]).config(["neLocalProvider",function(e){e.set("default",{$eq:"=",$lt:"<",$lte:"<=",$gt:">",$gte:">=",$regex_exact:"exact match",$regex_contains:"contains",$regex_begins:"begins with",$regex_ends:"ends with",$in:"is in",$ne:"not equal to",$regex_ncontains:"not contains",$regex_nbegins:"not begins with",$regex_nends:"not ends with",$nin:"is not in",$regex:"custom regex",$size:"items count",$exists:"exists",$and:"and",$or:"or",OR:"OR",AND:"AND",choose:"(choose)",qtype_short_number:"0-9",qtype_short_date:"Date",qtype_short_datetime:"Time",qtype_short_boolean:"Y/N",qtype_short_string:"A-Z",qtype_short_array:"[A]",qtype_short_object:"{O}",qtype_number:"Number",qtype_date:"Date",qtype_datetime:"Date & Time",qtype_boolean:"Boolean",qtype_string:"Text",qtype_array:"Array",qtype_object:"Object",qvalue_true:"True",qvalue_false:"False",Search:"Search","Order By":"Order By","choose field":"choose field","type value":"type value","empty value":"empty value"})}]).run(["$templateCache",function(e){e.put("neQuery/query.html",'<div class="visible-inline-block"><div ng-repeat-start="query in query track by $index" class="visible-inline-block" style="position:relative;margin:2px" ng-style="{\'margin-top\':$first ? \'0px\' : \'2px\'}"> <small ng-if="!$first && query.logical===\'OR\' && !query.length">{{query.logical | translate}}<br></small> <div ng-if="!query.length" class="visible-inline-block"> <div class="dropdown visible-inline-block" uib-dropdown keyboard-nav> <button ng-if="query.onlyPredefinedFields" class="btn btn-sm btn-default" uib-dropdown-toggle style="width:142px;height:30px"> <span class="nowrap" ng-if="query.fieldName">{{query.fieldName}}</span><span class="nowrap" ng-if="!query.fieldName">{{::\'choose field\'|translate}}</span> </button> <input ng-if="!query.onlyPredefinedFields" type="text" placeholder="{{::\'choose field\'|translate}}" class="input-sm" uib-dropdown-toggle ng-change="query.setFieldByName(query.fieldName);onChange()" ng-model="query.fieldName"/> <ul ng-if="query.fields.filterByName(query.fieldName, query.field.name).length" class="dropdown-menu" style="max-height:220px;overflow:auto"> <li ng-repeat="field in query.fields.filterByName(query.fieldName, query.field.name)" ng-class="{\'active\':(field.name===query.fieldName)}"> <a href="" ng-click="query.setField(field);onChange()"> {{field.name}} </a> </li> </ul> </div> <div class="dropdown visible-inline-block" uib-dropdown keyboard-nav> <button ng-disabled="query.field.disableOperator" class="btn btn-default btn-sm" uib-dropdown-toggle style="width:120px;height:30px"> <span class="class="nowrap"">{{query.operator | translate}} </span> </button> <ul class="dropdown-menu" style="min-width:210px;overflow:auto"> <li ng-if="!query.field.disableType" class="text-center"> <div class="btn-group btngroup-xs"> <button class="btn btn-default btn-xs" ng-class="{\'btn-success\':(query.type.name===type)}" style="padding:2px;" uib-tooltip="{{\'qtype_\'+type | translate}}" ng-repeat="type in query.types" ng-click="query.setType(type);$event.stopPropagation();"> {{\'qtype_short_\'+type | translate}} </button> </div> </li> <li ng-if="!query.field.disableType" class="divider"></li> <li ng-repeat="operator in query.type.operators" ng-if="!query.field.allowedOperatorIndexes || query.field.allowedOperatorIndexes.indexOf($index)>-1" ng-class="{\'active\':(query.operator===operator)}"> <a href="" ng-click="query.setOperator(operator);onChange()"> <span>{{operator | translate}}</span> </a> </li> </ul> </div> <div class="visible-inline-block" ne-query-value="query"></div> <div class="btn-group btn-group-xs"> <button class="btn btn-default" ng-click="query.next(\'AND\');onChange()">{{::\'AND\' | translate}}</button> <button class="btn btn-default" ng-click="query.next(\'OR\');onChange()">{{::\'OR\' | translate}}</button> <button class="btn btn-default" ng-click="query.levelDown();onChange()"><i class="fa fa-fw fa-level-down"></i></button> <button class="btn btn-default" ng-click="close();query.remove();onChange()"><i class="fa fa-fw fa-minus"></i></button> </div> </div> <div ng-if="query.length" class="visible-inline-block" style="position:relative;"> <small>{{ ($first ? \' \' : query.logical) | translate}}<br></small> <div class="btn-group btn-group-xs" style="position:absolute;right:0px;top:1px"> <button class="btn btn-default" style="border:1px dashed #999;border-right:none;color:#999;border-bottom: 1px solid transparent;" ng-click="query.next(\'AND\')">{{::\'AND\' | translate}}</button> <button class="btn btn-default" style="border:none;border-top:1px dashed #999;color:#999;border-bottom: 1px solid transparent;" ng-click="query.next(\'OR\')">{{::\'OR\' | translate}}</button> <button class="btn btn-default" style="border:1px dashed #999;border-left:none;color:#999;border-bottom: 1px solid transparent;" ng-click="close();query.remove()"><i class="fa fa-minus"></i></button> </div> <div class="query-subquery visible-inline-block" ng-include="\'neQuery/query.html\'" style="border:1px dashed #999;padding:8px;margin:2px 0px;"></div> </div></div><br ng-repeat-end></div>'),e.put("neQuery/date.html",'<input type="text" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" uib-datepicker-popup is-open="query.value_opened" ng-click="query.value_opened=!query.value_opened" ng-model="query.value" ng-change="onChange()"/>'),e.put("neQuery/datetime.html",'<input type="text" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" uib-datetimepicker-popup show-seconds="true" is-open="query.value_opened" ng-click="query.value_opened=!query.value_opened" ng-model="query.value" ng-change="onChange()"/>'),e.put("neQuery/number.html",'<input type="number" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" ng-model="query.value" ng-change="onChange()" style="width:142px;"/>'),e.put("neQuery/list.html",'<select class="input-sm" ng-model="query.value" ng-options="(value | translate) for value in query.field.values" ng-change="onChange()" style="width:142px;"></select>'),e.put("neQuery/boolean.html",'<select class="input-sm" ng-model="query.value" ng-options="(\'qvalue_\'+value | translate) for value in [true,false]" ng-change="onChange()" style="width:142px;"></select>'),e.put("neQuery/string.html",'<input type="text" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" ng-model="query.value" ng-change="onChange()"/>'),e.put("neQuery/string-suggestions.html",'<div class="dropdown visible-inline-block" uib-dropdown keyboard-nav> <input type="text" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" uib-dropdown-toggle ng-model="query.suggestion" ng-change="query.field.onlySuggestedValues ? query.value=null : query.value=query.suggestion;query.field.createSuggestions(query, query.suggestion);onChange()"> <ul ng-if="query.suggestions.length" class="dropdown-menu" style="max-height:220px;overflow:auto"> <li ng-repeat="value in query.suggestions" ng-class="{\'active\':(value===query.value)}"> <a href="" ng-click="query.value=value;query.suggestion=value;onChange()"> {{value}} </a> </li> </ul></div>'),e.put("neQuery/disabled.html",'<input type="text" disabled="disabled" class="input-sm" ng-model="query.value"/>'),e.put("neQuery/sort.html",'<div class="visible-inline-block"><div ng-repeat-start="sort in query.sortBy track by $index" style="display:inline-block;position:relative;margin:2px" ng-style="{\'margin-top\':$first ? \'0px\' : \'2px\'}"> <small>{{::\'Order By\'|translate}}</small> <div class="visible-inline-block"> <div class="dropdown visible-inline-block" uib-dropdown keyboard-nav> <button ng-if="query.onlyPredefinedFields" class="btn btn-sm btn-default" uib-dropdown-toggle style="width:142px;height:30px"> <span class="nowrap" ng-if="sort.fieldName">{{sort.fieldName}}</span><span class="nowrap" ng-if="!sort.fieldName">{{::\'choose field\'|translate}}</span> </button> <input ng-if="!query.onlyPredefinedFields" type="text" placeholder="{{::\'choose field\'|translate}}" class="input-sm" uib-dropdown-toggle ng-change="query.setSortByName(sort.fieldName, $index);onChange()" ng-model="sort.fieldName" /> <ul ng-if="query.fields.filterByName(sort.fieldName, sort.name).length" class="dropdown-menu" style="max-height:220px;overflow:auto"> <li ng-repeat="field in query.fields.filterByName(sort.fieldName, sort.name)" ng-class="{\'active\':(field.name===sort.fieldName)}"> <a href="" ng-click="query.setSortField(field,$parent.$index);onChange()"> {{field.name}} </a> </li> </ul> </div> <div class="btn-group btn-group-xs"> <button class="btn btn-default" ng-click="query.toggleSortDirection($index);onChange()"> <i class="fa fa-fw" ng-class="{\'fa-sort-amount-asc\':sort.direction===1,\'fa-sort-amount-desc\':sort.direction===-1}"></i> </button> <button class="btn btn-default" ng-click="query.addSort($index);onChange()"><i class="fa fa-fw fa-plus"></i></button> <button class="btn btn-default" ng-click="query.removeSort($index);onChange()"><i class="fa fa-fw fa-minus"></i></button> </div> </div></div><br ng-repeat-end><button ng-if="!query.sortBy.length" class="btn btn-default btn-sm" ng-click="query.addSort();onChange()"><i class="fa fa-fw fa-signal"></i> <span class="hidden-sm">{{::\'Order By\'|translate}}</span></button></div>')}]).directive("neQueryValue",[function(){return{restrict:"A",template:'<div ng-include="query.field.template||query.type.templates[query.operator]||query.type.template||query.templates[query.type.name]||query.templates.disabled"></div>',link:function(){}}}]).directive("neQuerySearch",[function(){return{restrict:"A",template:'<div class="pull-left" ne-query="query" ne-query-change="onChange()"></div><div class="pull-left hidden-xs" style="width:20px"> </div><div class="pull-left" ne-query-sort="query" ne-query-sort-change="onChange()"></div><button class="btn btn-primary btn-sm" ng-click="searchClick()" style="margin-left:2px"> <i class="fa fa-fw fa-search"></i> <span class="hidden-sm">{{::\'Search\' | translate}}</span></button>',scope:{query:"=neQuerySearch",searchClick:"&neQuerySearchClick",onQuerySearchChange:"&neQuerySearchChange",querySearchEmpty:"=neQuerySearchEmpty"},link:function(e,t,n){var r=!!n.neQuerySearchEmpty;e.onChange=function(){e.query.setDirty(),r&&(e.querySearchEmpty=e.query.isEmpty()),e.onQuerySearchChange&&e.onQuerySearchChange()},r&&(e.querySearchEmpty=e.query.isEmpty())}}}]).directive("neQuery",[function(){return{restrict:"A",templateUrl:"neQuery/query.html",scope:{query:"=neQuery",onQueryChange:"&neQueryChange",queryEmpty:"=neQueryEmpty"},link:function(e,t,n){var r=!!n.neQueryEmpty;e.onChange=function(){e.query.setDirty(),r&&(e.queryEmpty=e.query.isQueryEmpty()),e.onQueryChange&&e.onQueryChange()},r&&(e.queryEmpty=e.query.isQueryEmpty())}}}]).directive("neQuerySort",[function(){return{restrict:"A",templateUrl:"neQuery/sort.html",scope:{query:"=neQuerySort",onQuerySortChange:"&neQuerySortChange",querySortEmpty:"=neQuerySortEmpty"},link:function(e,t,n){var r=!!n.neQuerySortEmpty;e.onChange=function(){e.query.setDirty(),r&&(e.querySortEmpty=e.query.isSortEmpty()),e.onQuerySortChange&&e.onQuerySortChange()},r&&(e.querySortEmpty=e.query.isSortEmpty())}}}]).factory("NeQuery",["neLocal","neObject",function(e,t){function n(e){return(e||"").replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function r(e){return(e||"").replace(/\\(?!\\)/g,"")}function i(e){var t,n,r;if(!e)return{};for(t=this,n={},n[I]={},r=0;r<e.length;r++)n[I][e[r].key]=e[r].direction;return n}function s(e){var t,n=this,r=[];if(n.sortBy=[],"[object Object]"===Object.prototype.toString.call(e))for(t in e)n.addSort(),n.setSortByName(t,n.sortBy.length-1).direction=e[t];return r}function o(e,t){if(["string","number","boolean"].indexOf(typeof e)>-1)return!0;if(null===t||void 0===t||"function"==typeof t)return!1;if(["string","number","boolean"].indexOf(typeof t)>-1)return!0;for(var n in t)if(void 0!==e[n]&&null!==e[n])return!0;return!1}function a(e,n){var r,s,l,u,d,c,f,h,p,g={};if(g=t.extend(!0,g,e.options),e.length){for(s=[],l=0,u=0;u<e.length;u++)u>0&&"OR"===e[u].logical&&l++,s[l]=s[l]||[],s[l].push(e[u]);if(0===l)for(c=!1,f=s[l],u=0;u<f.length;u++){d=a(f[u],!0);for(h in d)if(void 0!==g[h]&&null!==g[h])if(f[u].field.merge)g=f[u].field.merge(h,d,g);else{if(o(g[h],d[h])){delete g[h],g=R.AND.build(f),c=!0;break}g[h]=t.extend(!0,g[h],d[h])}else g[h]=d[h];if(c)break}else g=t.extend(!0,g,R.OR.build(s))}else e.operator&&e.field&&e.field.key&&(r=angular.copy(e.value),e.type.onBuild&&(r=e.type.onBuild(r)),e.field.isEmptyValue&&e.field.isEmptyValue(r)||(r=R[e.operator].build("function"==typeof e.field.onBuild?e.field.onBuild(r):r),void 0!==r&&null!==r&&(e.field.build?(p=e.field.build(e.field.key,r,e),g[p.key||e.field.key]=p.key?p.value:p):g[e.field.key]=r)));return n||(g=t.extend(!0,g,i.call(e,e.sortBy))),g}function l(e,t){function n(e,t,n){i=e.append(n),i.type=T[t.typeName],i.value=t.value,i.setFieldByName(t.fieldName,!0),i.operator=t.operator}var r,i,o,a,u,d,c,f,h,p=this,g=[];for(o in e)-1===["AND","OR","VALUE"].indexOf(o)&&(o===I?s.call(p,e[o]):R[o]||o[0]!==D&&-1===P.indexOf(o)?g.push(o):p.options[o]=e[o]);for(a=0;a<g.length;a++){for(o=g[a],u=null,d=0;d<p.fields.length;d++)if((p.fields[d].field===o||p.fields[d].match&&o.match(p.fields[d].match))&&p.fields[d].parse){u=p.fields[d].parse;break}if(c={},u&&(c=u(o,e[o],t),c&&c.key?(o=c.key,e[o]=c.value):c&&(e[o]=c),Array.isArray(e[o])))for(f in e[o])l.call(p,e[o][f].value,e[o][f].logical||t);else if(r=(R[o]||R.VALUE).parse(o,e[o])){if(Array.isArray(r))for(h=0;h<r.length;h++)n(p,r[h],0===a&&0===h?t:"AND");else if(r.queries)for(i=null,h=0;h<r.queries.length;h++)1!==g.length||t?i?i.parse(r.queries[h],r.logical):(i=p.append(t),i.parse(r.queries[h],r.logical)):p.parse(r.queries[h],0===h&&t?t:r.logical);else 0===a?n(p,r,t):n(p,r,"AND");c.key&&delete e[c.key]}else c.key&&delete e[c.key]}return p}function u(e){var t,n,r;return"boolean"==typeof e?t="boolean":"number"==typeof e?t="number":e instanceof Date?t=0===e.getHours()&&0===e.getMinutes()&&0===e.getSeconds()&&0===e.getMilliseconds()?"date":"datetime":"string"==typeof e&&(n=e.match(M),n&&(r=Date.parse(n[0])),isNaN(r)?t="string":(e=new Date(r),t=0===e.getHours()&&0===e.getMinutes()&&0===e.getSeconds()&&0===e.getMilliseconds()?"date":"datetime")),{type:t,value:e}}function d(e){var t,n=[];return n.options={},n.sortBy=[],n.build=function(e){return a.call(this,this,e)},n.parse=function(e,t){return l.call(this,e,t)},n.fill=function(e){return this.splice(0,this.length),this.parse(e),this.parent&&this.parent()||0!==this.length||this.append("AND"),n},n.isEmpty=y,n.isQueryEmpty=v,n.isSortEmpty=b,n.isDirty=x,n.setDirty=$,n.clear=m,n.newQuery=d,n.templates=j,n.fields=this.fields,n.types=this.types,n.onlyPredefinedFields=this.onlyPredefinedFields,n.logical=e||"AND",n.append=c,n.next=h,n.levelDown=f,n.remove=p,n.reset=g,n.setFieldByName=w,n.setField=k,n.setOperator=_,n.setType=S,n.addSort=q,n.removeSort=L,n.toggleSortDirection=C,n.setSortByName=O,n.setSortField=E,n.parent=n.getParent=function(){return t},n.setParent=function(e){t=e},n.reset(),n}function c(e){var t=this.newQuery(e);return t.setParent(this),this.push(t),t}function f(){var e,t,n=this;if(n.parent()&&!(n.parent().length<=1))return e=n.parent().indexOf(n),t=n.next(n.logical),n.parent().splice(e,1),n.logical="AND",n.setParent(t),t.push(n),t}function h(e){var t,n,r=this;if(r.parent())return t=r.parent().indexOf(r),n=this.newQuery(e),n.setParent(r.parent()),r.parent().splice(t+1,0,n),n}function p(){var e,t=this;if(t.parent()){if(!t.parent().parent()&&1===t.parent().length)return t.reset();if(1===t.parent().length)return t.parent().remove();e=t.parent().indexOf(t),t.parent().splice(e,1),t=null}}function g(){var e=this;if(e.fields.length){if(e.field=e.fields[0],e.type=T[e.field.type],!e.type)throw new Error('Field type "'+e.field.type+'" not recognized, please choose one from "'+Object.keys(T).join(", ")+'"');e.fieldName=e.field.name,e.operator=e.type.operators[e.field.operatorIndex||0]}else e.field=e.field||{},e.type=T[e.type||e.types[0]],e.operator=e.type.operators[0];e.value=null}function m(){return this.splice(0,this.length),this.setDirty(!1),this}function y(e){return e=e||this.build(),this.isQueryEmpty(e)&&this.isSortEmpty(e)}function v(e){e=e||this.build();var t=Object.keys(e).length;return 0===t||1===t&&e.hasOwnProperty("$sort")}function b(e){return e=e||this.build(),0===Object.keys(e.$sort||{}).length}function $(e){return this.$dirty=e=!0,this.$touched=e=!0,this}function x(){return this.$dirty}function w(e,t){var n,r;if(t&&delete this.field,e)for(n=e.toLowerCase(),r=0;r<this.fields.length;r++){if(this.fields[r].key===e||this.fields[r].nameLower===n)return this.setField(this.fields[r]);if(this.fields[r].match&&(e.match(this.fields[r].match)||n.match(this.fields[r].match)))return this.field&&this.field.field===this.fields[r].field?void 0:this.setField(this.fields[r],e)}this.fieldName=e,this.field={key:e}}function k(e,t){if(this.type.name!==e.type){if(this.type=T[e.type],!this.type)throw new Error('Field type "'+e.type+'" not recognized, please choose one from "'+Object.keys(T).join(", ")+'"');this.value=null}var n=this.field;this.field=angular.copy(e||{}),this.fieldName=t||this.field.name,this.operator=this.type.operators[this.field.operatorIndex||0],e.onSet&&e.onSet(this,n)}function _(e){this.type.templates&&this.type.templates[this.operator]!==this.type.templates[e]&&(this.value=null),this.operator=e}function S(e){this.type=T[e],this.operator=this.type.operators[0],this.value=null}function q(e){var t={};this.fields.length&&(t.fieldName=this.fields[0].name,t.name=this.fields[0].name,t.key=this.fields[0].key,t.direction=1),isNaN(e)?this.sortBy.push(t):this.sortBy.splice(e+1,0,t)}function L(e){this.sortBy.splice(isNaN(e)?this.sortBy.length-1:e,1)}function C(e){e=e||0,this.sortBy[e].direction=1===this.sortBy[e].direction?-1:1}function O(e,t){var n,r;if(t=t||0,e)for(n=e.toLowerCase(),r=0;r<this.fields.length;r++)if(this.fields[r].key===e||this.fields[r].nameLower===n)return this.sortBy[t].fieldName=this.fields[r].name,this.sortBy[t].name=this.fields[r].name,this.sortBy[t].key=this.fields[r].key,this.sortBy[t];return this.sortBy[t].fieldName=e,this.sortBy[t].key=e,this.sortBy[t]}function E(e,t){t=t||0,this.sortBy[t].fieldName=e.name,this.sortBy[t].name=e.name,this.sortBy[t].key=e.key}function N(e,t){var n,r=[],i=this,s=(e||"").toLowerCase();if(!e||e===t)return i;for(n=0;n<i.length;n++)i[n].nameLower&&i[n].nameLower.match(new RegExp(".*"+s+".*"))&&r.push(i[n]);return r}function A(n,r){var i,s,o,a,l,u,c,f,h={};for(1===arguments.length&&(Array.isArray(arguments[0])?(r=arguments[0],n=null):angular.isObject(arguments[0])&&(h=arguments[0],r=h.fields,n=h.name)),r=r||[],i=0;i<r.length;i++){if(r[i].key=r[i].key||r[i].field||r[i].property,r[i].name=e.translate(r[i].name||r[i].key),r[i].nameLower=(r[i].name||"").toLowerCase(),r[i].behaviour&&(s=null,o={},a=null,"string"==typeof r[i].behaviour?s=r[i].behaviour:(s=Object.keys(r[i].behaviour)[0],o=r[i].behaviour[s]),l=Q[s])){u=l.call(r[i],o);for(c in u)r[i][c]=u[c]}r[i].type&&(r[i].disableType=!0),r[i].type=r[i].type||r[i].defaultType||K,r[i].allowedOperatorIndexes=r[i].allowedOperatorIndexes,r[i].operatorIndex>=0&&(r[i].disableOperator=!0),r[i].operatorIndex=r[i].operatorIndex||r[i].defaultOperatorIndex,r[i].values&&!r[i].template&&(r[i].template=j.list),r[i].emptyValues=r[i].emptyValues||r[i].ignoreValues,r[i].isEmptyValue=r[i].isEmptyValue||function(e){return null===e||void 0===e?!0:this.emptyValues||this.type.emptyValues?(this.emptyValues||this.type.emptyValues).indexOf(e)>-1:!1},r[i].loadSuggestions=r[i].loadSuggestions||r[i].getSuggestions||r[i].suggestions,r[i].onlySuggestedValues=r[i].onlySuggestedValues,r[i].loadSuggestions&&(r[i].resetOnFieldChange=!0,r[i].onSet=r[i].onSet||function(e,t){t?(e.value=null,e.suggestion="",e.suggestions=[]):e.suggestion=e.suggestion||e.value},r[i].template=r[i].template||j.suggestions,r[i].createSuggestions=function(e){var n=e.suggestionMinLength||e.suggestionMinSearchLength||3;return t.debounce(function(t,r){r=r||"",r.length>=n&&e.loadSuggestions(r,function(e){t.suggestions=e})},e.suggestionDebounce>=0?e.suggestionDebounce:350)}(r[i]))}return r.filterByName=N,f=d.call({fields:r,types:Object.keys(T)},"AND"),f.name=n,f.onlyPredefinedFields=h.onlyPredefinedFields,f.append("AND"),f}var j={query:"neQuery/query.html",sort:"neQuery/sort.html",disabled:"neQuery/disabled.html",number:"neQuery/number.html",string:"neQuery/string.html","boolean":"neQuery/boolean.html",date:"neQuery/date.html",datetime:"neQuery/datetime.html",list:"neQuery/list.html",suggestions:"neQuery/string-suggestions.html"},I="$sort",P=["$limit","$page","$skip","$sort"],D="$",K="string",T={string:{name:"string",operators:["$regex_exact","$regex_contains","$regex_begins","$regex_ends","$in","$ne","$regex_ncontains","$regex_nbegins","$regex_nends","$nin","$regex"],template:j.string},number:{name:"number",operators:["$eq","$lt","$lte","$gt","$gte"],template:j.number},"boolean":{name:"boolean",operators:["$eq"],template:j["boolean"],onBuild:function(e){return-1!==[!0,"true","True",1,"yes","Yes"].indexOf(e)?!0:!1}},date:{name:"date",operators:["$eq","$lt","$lte","$gt","$gte"],template:j.date},datetime:{name:"datetime",operators:["$eq","$lt","$lte","$gt","$gte"],template:j.datetime},object:{name:"object",operators:["$exists"],template:j["boolean"]},array:{name:"array",operators:["$size"],template:j.string,templates:{$size:j.number}}},M=/^(\d{4}|\+\d{6})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})\.(\d{1,})(Z|([\-+])(\d{2}):(\d{2}))?)?)?)?$/,R={AND:{build:function(e){var t,n,r=[];for(n=0;n<(e.length||0);n++)t=a(e[n],!0),Object.keys(t).length&&r.push(t);return r.length?{$and:r}:{}}},OR:{build:function(e){var t,n,r=[];for(n=0;n<(e.length||0);n++)t=a(e[n],!0),Object.keys(t).length&&r.push(t);return r.length?{$or:r}:{}}},VALUE:{parse:function(e,t){var n,r,i=[],s=u(t),o=s.type;if(t=s.value,"[object Object]"===Object.prototype.toString.call(t)){for(r in t)n=(R[r]||R.VALUE).parse(e,t[r]),n&&i.push(n);return i}return o?{fieldName:e,typeName:o,operator:"string"===o?"$regex_exact":"$eq",value:t}:void 0}},$and:{parse:function(e,t){return Array.isArray(t)?{logical:"AND",queries:t}:null}},$or:{parse:function(e,t){return Array.isArray(t)?{logical:"OR",queries:t}:null}},$eq:{build:function(e){return e},parse:function(e,t){var n=u(t),r=n.type;return t=n.value,r?{fieldName:e,typeName:r,operator:"string"===r?"$regex_exact":"$eq",value:t}:void 0}},$exists:{build:function(e){return{$exists:e}},parse:function(e,t){return"boolean"==typeof t?{fieldName:e,typeName:"object",operator:"$exists",value:t}:void 0}},$size:{build:function(e){return{$size:e}},parse:function(e,t){return"number"==typeof t?{fieldName:e,typeName:"array",operator:"$size",value:t}:void 0}},$lt:{build:function(e){return{$lt:e}},parse:function(e,t){var n=u(t),r=n.type;return t=n.value,"number"===r||"date"===r||"datetime"===r?{fieldName:e,typeName:r,operator:"$lt",value:t}:void 0}},$lte:{build:function(e){return{$lte:e}},parse:function(e,t){var n=u(t),r=n.type;return t=n.value,"number"===r||"date"===r||"datetime"===r?{fieldName:e,typeName:r,operator:"$lte",value:t}:void 0}},$gt:{build:function(e){return{$gt:e}},parse:function(e,t){var n=u(t),r=n.type;return t=n.value,"number"===r||"date"===r||"datetime"===r?{fieldName:e,typeName:r,operator:"$gt",value:t}:void 0}},$gte:{build:function(e){return{$gte:e}},parse:function(e,t){var n=u(t),r=n.type;return t=n.value,"number"===r||"date"===r||"datetime"===r?{fieldName:e,typeName:r,operator:"$gte",value:t}:void 0}},$regex:{build:function(e){return{$regex:e}},parse:function(e,t){var n,r,i,s;for(s=0;s<T.string.operators.length;s++)if(r=T.string.operators[s],R[r]&&R[r].check&&void 0!==(i=R[r].check(t))){n=r,t=i;break}return{fieldName:e,typeName:"string",operator:n||"$regex",value:t}}},$regex_exact:{build:function(e){return e}},$regex_contains:{build:function(e){return e=n(e),{$regex:".*"+e+".*"}},check:function(e){return e=(e.match(/^\.\*(.*)\.\*$/)||[])[1],void 0===e?void 0:r(e)}},$regex_ncontains:{build:function(e){return e=e=n(e),{$regex:"^((?!"+e+").)*$"}},check:function(e){return e=(e.match(/^\^\(\(\?\!(.*)\)\.\)\*\$$/)||[])[1],void 0===e?void 0:r(e)}},$regex_begins:{build:function(e){return e=n(e),{$regex:"^"+e+".*"}},check:function(e){return e=(e.match(/^\^(.*)\.\*$/)||[])[1],void 0===e?void 0:r(e)}},$regex_nbegins:{build:function(e){return e=n(e),{$regex:"^(?!"+e+").*$"}},check:function(e){return e=(e.match(/^\^\(\?\!(.*)\)\.\*\$$/)||[])[1],void 0===e?void 0:r(e)}},$regex_ends:{build:function(e){return e=n(e),{$regex:".*"+e+"$"}},check:function(e){return e=(e.match(/^\.\*(.*)\$$/)||[])[1],void 0===e?void 0:r(e)}},$regex_nends:{build:function(e){return e=n(e),{$regex:"^(?!.*"+e+"$)"}},check:function(e){return e=(e.match(/^\^\(\?\!\.\*(.*)\$\)$/)||[])[1],void 0===e?void 0:r(e)}},$ne:{build:function(e){return{$ne:e}},parse:function(e,t){var n=u(t),r=n.type;return t=n.value,r?{fieldName:e,typeName:r,operator:"$ne",value:t}:void 0}},$in:{build:function(e){return"string"==typeof e&&(e=e.replace(/,\s+/g,",").replace(/\s+,/g,",").replace(/^,/,"").replace(/,$/,"").split(",")),{$in:e}},parse:function(e,t){return Array.isArray(t)?{fieldName:e,typeName:"string",operator:"$in",value:t.join(", ")}:void 0}},$nin:{build:function(e){return"string"==typeof e&&(e=e.replace(/,\s+/g,",").replace(/\s+,/g,",").replace(/^,/,"").replace(/,$/,"").split(",")),{$nin:e}},parse:function(e,t){return Array.isArray(t)?{fieldName:e,typeName:"string",operator:"$nin",value:t.join(", ")}:void 0}}},Q={keyValueArray:function(e){var t=this,n=t.field,r=e.prefix||e.keyPrefix||"",i=e.key||e.idKey,s=e.value||e.valueKey;if(!i||!s)throw new Error('neQuery: Cannot set field behaviour, "idKey" or "valueKey" not defined');return{match:new RegExp(n+".*"),build:function(e,t,o){var a={};return a[i]=o.fieldName.replace(n+".",""),a[s]=t,{key:r+n,value:{$elemMatch:a}}},merge:function(e,t,n){return t[e].$elemMatch&&(n[e].$all?n[e].$all.push(t[e]):n[e]={$all:[n[e],t[e]]}),n},parse:function(e,t,o){var a,l,u;if(t.$elemMatch)return a=e+"."+t.$elemMatch[i],{key:a.replace(r,""),value:t.$elemMatch[s]};if(Array.isArray(t.$all)){for(l=[],u=0;u<t.$all.length;u++)t.$all[u].$elemMatch&&(l[u]={value:{},logical:u>0?"AND":o},l[u].value[n+"."+t.$all[u].$elemMatch[i]]=t.$all[u].$elemMatch[s]);return l}}}}};return A.templates=j,A.fieldBehaviours=Q,A}]).factory("neQueryTests",["NeQuery","neObject",function(e,t){return function(){function n(e,n,i){var s=r.fill(n).build(),o=t.deepEqual(i||n,s,function(e){return"$sort"===e});o?console.log('Query test "'+e+'" - OK'):console.warn('Query test failed "'+e+'", input query do not match built one',i||n,s)}var r=new e;n("simple range query",{field1:{$gte:1,$lte:2}}),n("simple and[1,2]",{field1:"value1",field2:"value2"}),n("simple and[1,2] with $and operator",{$and:[{field1:"value1"},{field2:"value2"}]},{field1:"value1",field2:"value2"}),n("simple or[1,2] with $or operator",{$or:[{field1:"value1"},{field2:"value2"}]}),n("or[ and[1,2], or[1,2], and[1,2] ]",{$and:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]}),n("or[ or[1,2], and[1,2], or[1,2] ]",{$or:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{$and:[{field1_and1:"value1_and1"},{field2_and1:"value2_and1"}]},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]},{$or:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{field1_and1:"value1_and1",field2_and1:"value2_and1"},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]}),n("and[ or[1,2], and[1,2], or[1,2] ]",{$and:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{$and:[{field1_and1:"value1_and1"},{field2_and1:"value2_and1"}]},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]},{$and:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{field1_and1:"value1_and1",field2_and1:"value2_and1"},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]}),n("and[ or[1,2], or[1,2] ]",{$and:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]}),n("or[ and[1,2], and[1,2] ]",{$or:[{$and:[{field1_and1:"value1_and1"},{field2_and1:"value2_and1"}]},{$and:[{field1_and2:"value1_and2"},{field2_and2:"value2_and2"}]}]},{$or:[{field1_and1:"value1_and1",field2_and1:"value2_and1"},{field1_and2:"value1_and2",field2_and2:"value2_and2"}]}),n("or[ or[1,range], and[range,1,2], or[range,range] ]",{$or:[{$or:[{field1_or1:"value1_or1"},{field2_or1:{$gt:1,$lt:100}}]},{$and:[{field1_and1:{$gt:1,$lt:100}},{field1_and1:"value1_and1"},{field2_and1:"value2_and1"},{$or:[{field1_and1_or:{$gte:1,$lte:100}},{field2_and1_or:"value2_and1_or"}]}]},{$or:[{field1_or2:{$gte:1,$lte:100}},{field2_or2:{$gte:1,$lte:100}}]}]},{$or:[{$or:[{field1_or1:"value1_or1"},{
field2_or1:{$gt:1,$lt:100}}]},{$and:[{field1_and1:{$gt:1}},{field1_and1:{$lt:100}},{field1_and1:"value1_and1"},{field2_and1:"value2_and1"},{$or:[{field1_and1_or:{$gte:1,$lte:100}},{field2_and1_or:"value2_and1_or"}]}]},{$or:[{field1_or2:{$gte:1,$lte:100}},{field2_or2:{$gte:1,$lte:100}}]}]})}}]),angular.module("neRest",["neObject","neNotifications","neLoading"]).config(["$httpProvider",function(e){e.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}]).factory("NeResourceTransformators.dateStringsToDates",["neObject",function(e){return e.dateStringsToDates}]).factory("NeResourceTransformators.removePrefixedProps",["neObject",function(e){return e.removePrefixedProps}]).factory("NeRestResource",["$http","$timeout","neObject","neNotifications","neLoading","NeResourceTransformators.dateStringsToDates","NeResourceTransformators.removePrefixedProps",function(e,t,n,r,i,s,o){function a(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function l(e,t,n){var r=new RegExp(a(t),"g");return e.replace(r,n)}function u(e,t){if(t)return e.replace(/\/$/,"");var n="";return e.match(/^http:/)&&(n="http:/",e=e.substring(6)),e.match(/^https:/)&&(n="https:/",e=e.substring(7)),e.match(/^\/\//)&&(n="/",e=e.substring(1)),e=("/"+e+"/").replace(/\/\/+/g,"/"),n+e.substring(0,e.length-1)}function d(e){return!!e.match(/^http:/)||!!e.match(/^https:/)||!!e.match(/^\/\//)}function c(e){var t,n=(e||"").match(/\{([^\{\}]+)/g)||[];for(t=0;t<n.length;t++)n[t]=n[t].substring(1);return n}function f(e){return void 0===e||null===e?"":JSON.stringify(e).replace(/^"/,"").replace(/"$/,"")}function h(e,t,r,i){var s,o,a,c,h,p=this;for(t=u(t||"",!0),s=d(t)?t:e+("/"===t[0]||""===e?"":"/")+t,o=p.options.commands[i].urlParams,h=0;h<o.length;h++)c=n.deepGet(r,o[h]),a="_command"===o[h]?i:void 0===c?"":c,"string"==typeof a&&(a=encodeURIComponent(a).replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/#/g,"%23")),s=l(s,"{"+o[h]+"}",f(a));return s=u(s,!0),s.indexOf("?")>-1?s.replace(/([^\/])\?/,"$1/?"):s+"/"}function p(e,t){var n,r,i=this,s="",o=i.options.commands[t],a=i.options,l=o.queryKey||a.queryKey,u=o.urlParams;if(l)return Object.keys(e).length?"?"+l+"="+JSON.stringify(e):"";for(n in e)if(e.hasOwnProperty(n)&&-1===u.indexOf(n))if(Array.isArray(e[n]))for(r=0;r<e[n].length;r++)s+="&"+n+"="+f(e[n][r]);else void 0!==e[n]&&(s+="&"+n+"="+f(e[n]));return s?"?"+s.substring(1):""}function g(e,t,r,i){var s,o,a=e.commands[t],l=a.dataKey||e.dataKey,u=a.resourceKey||e.resourceKey,d=a.idKey||e.idKey;return i?i=n.deepGet(i,u):r&&(s=n.deepGet(r,l),i=n.deepGet(s,u)),i&&(o=n.deepGet(i,d),void 0!==o&&(i.id=o)),i}function m(e,t,r){var i,s,o=e.commands[t],a=(o.isList,o.dataKey||e.dataKey),l=o.resourceListKey||e.resourceListKey,u=n.deepGet(r,a);if(l&&(u=n.deepGet(u,l)),i=[],Array.isArray(u))for(s=0;s<u.length;s++)i.push(g(e,t,null,u[s]));return i}function y(e,t,r,i){var s=e.commands[t],o=s.queryPageKey||e.queryPageKey,a={count:n.deepGet(r,s.paginationCountKey||e.paginationCountKey)||0,page:n.deepGet(r,s.paginationPageKey||e.paginationPageKey)||n.deepGet(i,o)||0,pages:n.deepGet(r,s.paginationPagesCountKey||e.paginationPagesCountKey)||0,next:n.deepGet(r,s.paginationHasNextKey||e.paginationHasNextKey),prev:n.deepGet(r,s.paginationHasPrevKey||e.paginationHasPrevKey)};return void 0===a.page||void 0===a.pages||void 0!==a.next&&void 0!==a.prev||(a.next=a.page<a.pages,a.prev=a.page>1),a}function v(e,t,r,i){var s,o,a=e.commands[t],l=a.additionalDataKeys||e.additionalDataKeys;for(o in l)s=n.deepGet(r,o),void 0!==s&&n.deepSet(i,l[o],s);return i}function b(e){var t,n=[];for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=0;t<e.length;t++)if("function"==typeof e[t]&&e[t].apply(this,n)===!0)return}function $(e,t,n,r){return function(i){var s,o=(i.config,t.commands[n]),a=S(i.data,o.transformResponse),l=i.status,u=(i.headers,o.isList);u?(s=m(t,n,a)||[],s.pagination=y(t,n,a,e)):s=g(t,n,a),s=v(t,n,a,s),b([o.onData,t.onData],s,(s||{}).pagination,a,l,u,n),b(r,s,(s||{}).pagination,a,l)}}function x(e,t,r,i){return function(e){var s=(e.config,t.commands[r]),o=S(e.data,s.transformResponse),a=e.status,l=e.headers,u=i.concat([(s.responseErrors||{})[a]||(s.responseErrors||{})["default"],t.responseErrors[a]||t.responseErrors["default"]]),d=s.errorKey||t.errorKey,c=n.deepGet(o,d);b(u,c,a,l)}}function w(e,n,r,s,o,a){function l(t){var r,a,l,u;if(t=t||{},r=t.getResponseHeader("content-type"),a=t.responseText,l=t.status?parseInt(t.status):0,r&&"application/json"===r.substring(0,16))try{a=JSON.parse(t.responseText)}catch(d){l=0}u={data:a,status:l,headers:t.headers,httpOpts:{}},h("removeEventListener"),v||i.reqEnded(),l>=200&&299>=l?$(n,g,e,s)(u):x(n,g,e,o)(u)}function u(e){l(e.target,"load")}function d(e){l(e.target,"error")}function c(e){l(e.target,"abort")}function f(e){a&&(e.lengthComputable?b(a,Math.ceil(100*e.loaded/e.total)):b(a,50))}function h(e){L[e]("load",u,!1),L[e]("error",d,!1),L[e]("abort",c,!1),L.upload[e]("progress",f,!1)}var p,g=this.options,m=r.url,y=(r.headers,r.data),v=r.ignoreLoading,w=new FormData;for(p in y)y[p]instanceof Blob||y[p]instanceof File?w.append(p,y[p],y[p].name):w.append(p,y[p]);t(function(){h("addEventListener"),v||i.reqStarted(),L.open("POST",m,!0),L.send(w)})}function k(){var e,t,n,r,i=[{},k.defaults];for(e=0;e<arguments.length;e++)i.push(arguments[e]);t=angular.merge.apply(angular,i),t.baseUrl=u(t.baseUrl,!0),n=this,n.options=t;for(r in t.commands)t.commands[r].transformRequest=angular.merge({},t.transformRequest,t.commands[r].transformRequest||{}),t.commands[r].transformResponse=angular.merge({},t.transformResponse,t.commands[r].transformResponse||{}),n[r]=function(e){return function(){var t,r=[e];for(t=0;t<arguments.length;t++)r.push(arguments[t]);return n.command.apply(n,r)}}(r);return n}function _(e,t,n,r,i){return"$page"!==t&&(e=i.deepSet(e,t,e.$page),delete e.$page),"$limit"!==n&&(e=i.deepSet(e,n,e.$limit),delete e.$limit),"$sort"!==r&&(e=i.deepSet(e,r,e.$sort),delete e.$sort),e}function S(e,t){var r,i;t=t||{},r=e,"[object Object]"===Object.prototype.toString.call(e)&&(r=n.extend(!0,{},e)),Array.isArray(e)&&(r=n.extend(!0,[],e));for(i in t)k.dataTransformators[i]&&k.dataTransformators[i](r,t[i]);return r}var q={baseUrl:"/yoururl",urlEndSlash:!1,headers:{"Content-Type":"application/json"},dataKey:"data",resourceListKey:"this",resourceKey:"this",idKey:"id",errorKey:"data",paginationCountKey:"pagination.count",paginationPageKey:"pagination.page",paginationPagesCountKey:"pagination.pages",paginationHasNextKey:"pagination.next",paginationHasPrevKey:"pagination.prev",additionalDataKeys:{},responseErrors:{400:function(e){var t,n=e;if(angular.isObject(e)){n="";for(t in e)n+=t+": "+e[t]+", "}r.error("Validation Failed",n)},403:function(){r.error("Access Denied","Try logout and login again, please")},404:function(){r.error("Document or his version not found","Try refresh page, please")},409:function(e){r.error(e)},"default":function(){r.error("Connection Failed","Try later, please")}},defaultQuery:{},urlBuilder:h,queryStringBuilder:p,queryKey:null,queryPageKey:"$page",queryLimitKey:"$limit",querySortKey:"$sort",transformRequest:{removePrefixedProps:"$"},transformResponse:{dateStringsToDates:!0},commands:{one:{method:"GET",url:"/{id}"},all:{method:"GET",isList:!0},find:{method:"GET",isList:!0},create:{method:"POST",url:"/{id}"},update:{method:"PUT",url:"/{id}"},remove:{method:"DELETE",url:"/{id}"}}},L=function(){try{return new XMLHttpRequest}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(n){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(r){}throw new Error("This browser does not support XMLHttpRequest.")}();return k.defaults=q,k.define=k.create=function(e){return new k(e)},k.dataTransformators={dateStringsToDates:s,removePrefixedProps:o},k.prototype.command=function(t,r,i,s,o,a){var l,u,d,f,h,p,g,m,y,v,b,k,q,L,C,O,E,N,A,j,I,P,D,K,T,M=this;if(!M.options.commands[t])throw new Error('This resource has no command "'+t+'" defined');if("function"==typeof arguments[1]?(a=arguments[3],o=arguments[2],s=arguments[1],r={},i=null):"function"==typeof arguments[2]&&(a=arguments[4],o=arguments[3],s=arguments[2],r=arguments[1],i=null),u=M.options,d=u.commands[t],f=("string"==typeof d.baseUrl?d.baseUrl:u.baseUrl)||"",h=(d.method||"GET").toLowerCase(),p="boolean"==typeof d.body?d.body:["options","post","post-multipart","upload","put","delete"].indexOf(h)>-1,g=d.headers||u.headers,m=("string"==typeof d.url?d.url:u.url)||"",y=d.urlBuilder||u.urlBuilder,v=d.urlEndSlash||u.urlEndSlash,b=d.queryStringBuilder||u.queryStringBuilder,k=d.defaultQuery||u.defaultQuery,q=void 0!==d.ignoreLoading?d.ignoreLoading:u.ignoreLoading,L=d.transformRequest,C=d.idKey||u.idKey,O=d.queryPageKey||u.queryPageKey,E=d.queryLimitKey||u.queryLimitKey,N=d.querySortKey||u.querySortKey,u.commands[t].urlParams=d.urlParams||c(m),null===i&&p&&angular.isObject(r)?(i=arguments[1],r=null,l={}):(l={},l=!r||"string"!=typeof r&&"number"!=typeof r?r:n.deepSet(l,C,r),l=angular.merge({},k,l||{})),0===l.$page)throw new Error("NeRestResource: query.$page is equal to zero, must be greater");l=_(l,O,E,N,n),i&&(i=_(i,O,E,N,n)),A=[s,d.onSuccess,u.onSuccess],j=[o,d.onError,u.onError],I=[a,d.onProgress,u.onProgress],P=angular.merge({},i||{},l||{}),D=y.call(M,f,m,P,t),v&&-1===D.indexOf("?")&&(D+="/"),K=b.call(M,l,t),D.indexOf("?")>-1&&0===K.indexOf("?")&&(K="&"+K.substring(1)),T={url:D+K,method:h,data:S(i,L),headers:g,ignoreLoading:q},"post-multipart"===h||"upload"===h?w.call(M,t,l,T,A,j,I):e(T).then($(l,u,t,A),x(l,u,t,j))},k}]),angular.module("neState",["ngCookies"]).factory("NeStateService",["$timeout","$location","$rootScope","$cookies","neObject",function(e,t,n,r,i){function s(e){return window.btoa(e)}function o(e){return window.atob(e)}function a(e){return e=e||{},angular.merge(this,{},c,e),this.history={},this.changeListeners=[],this}function l(e){return function(t){var n,r;if(!this.history[t])throw new Error('StateService: there is no registered state with id "'+t+'"');return n=this.getCurrentState(t),r=this.history[t].currentStateIndex+e,0>r&&(r=0),r>=this.history[t].length&&(r=this.history[t].length?this.history[t].length-1:0),this.history[t].currentStateIndex=r,n===this.getCurrentState(t)?this:this.fireChange(t,n)}}var u={encrypt:!1,prefix:"q",parser:function(e){var n=this.prefix,r=this.encrypt;e=e||t.search()[n];try{return r&&(e=o(e)),i.fromJson(e||"{}")||{}}catch(s){}return{}},builder:function(e){function t(t,n){return e[t]?Object.keys(e[t]).length?n:void 0:n}var n=(this.prefix,this.encrypt),r=JSON.stringify(e,t);return n&&(r=s(r)),r},autoUpdate:!1,autoFill:!1,sync:!1,_unbinders:{},init:function(e,t){var r=this;(r.autoFill||r.sync)&&(t&&(r._unbinders[t]={routeUpdate:n.$on("$routeUpdate",function(){r.fill(e,t)}),routeChangeSuccess:n.$on("$routeChangeSuccess",function(){r.fill(e,t)})}),r.fill(e,t))},destroy:function(e,t){return this.unbind(e,t)},unbind:function(e,t){var n,r,i=this,s=t?[t]:Object.keys(i._unbinders);for(n=0;n<s.length;n++)r=s[n],i._unbinders[r]&&(i._unbinders[r].routeUpdate(),i._unbinders[r].routeChangeSuccess())},fill:function(n,r){var i=this,s=t.search()[i.prefix],o=i.parser(s)||{};e(function(){if(r)n.change(r,o[r]||{},!0);else for(var e in n.history)n.change(e,o[e]||{},!0)})},update:function(e){var n,r=this;(r.autoUpdate||r.sync)&&(n=r.builder(e.getCurrentState()),t.search(r.prefix,n))}},d={prefix:"appState",path:"/",secure:!1,autoUpdate:!1,autoFill:!1,sync:!1,init:function(){},destroy:function(){},unbind:function(){},fill:function(t,n){var i=this,s=r.getObject(i.prefix)||{};e(function(){if(n)t.change(n,s[n]||{},!0);else for(var e in t.history)t.change(e,s[e]||{},!0)})},update:function(e){var t=this;(t.autoUpdate||t.sync)&&r.putObject(t.prefix,e.getCurrentState(),{domain:t.domain,expires:t.expires,path:t.path,secure:t.secure})}},c={maxHistoryStates:5,store:u};return a.locationStore=u,a.cookiesStore=d,a.prototype.create=a.prototype.register=function(e,t){var n,r;return t=t||{},n=this,n.history[e]?n.history[e]:(r=[],r.maxHistoryStates=t.maxHistoryStates||n.maxHistoryStates,"location"===t.store&&(t.store=u),"cookies"===t.store&&(t.store=d),r.store=angular.merge({},n.store,t.store||{}),r.changeListeners=[],r.currentStateIndex=-1,n.history[e]=r,n.history[e].store.init(n,e),n.history[e])},a.prototype.changeState=a.prototype.change=function(e,t,n){var r,s,o,a;if(!angular.isObject(t))throw new Error('StateService: cannot change state, value have to be object and is "'+t+'"');return r=this,r.history[e]=r.history[e]||r.register(e),s=r.history[e].currentStateIndex,o=r.history[e].length?r.history[e].length-1-s:0,r.history[e].length>0&&i.deepEquals(r.history[e][s],t)?r:(r.history[e].splice(s+1,o),r.history[e].push(angular.merge({},t)),r.history[e].length>r.history[e].maxHistoryStates?r.history[e].splice(0,1):r.history[e].currentStateIndex++,n||r.history[e].store.update(r,e),a=n,r.fireChange(e,null,a))},a.prototype.updateState=a.prototype.update=function(e,t){var n,r;if(!angular.isObject(t))throw new Error('StateService: cannot change state, value have to be object and is "'+t+'"');return n=this,n.history[e]=n.history[e]||n.register(e),n.history[e].length?(r=n.history[e].currentStateIndex,n.history[e][r]=angular.merge({},t),n):n},a.prototype.fireChange=function(e,t,n){var r,i,s,o;if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');for(r=this.history[e].currentStateIndex,i=this.history[e].changeListeners,t=t||this.getPrevState(e)||{},s=this.getCurrentState(e)||{},o=0;o<i.length;o++)i[o](s,t,n,r);for(o=0;o<this.changeListeners.length;o++)this.changeListeners[o](e,s,t,n,r);return this},a.prototype.watch=a.prototype.onChange=function(e,t){var n=this;return 1===arguments.length&&(t=arguments[0],e=null),e?(n.history[e]=n.history[e]||n.register(e),n.history[e].changeListeners.push(t)):n.changeListeners.push(t),n},a.prototype.unWatch=a.prototype.unbindChange=a.prototype.offChange=function(e,t){1===arguments.length&&(t=arguments[0],e=null);var n;if(e){if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');n=this.history[e].changeListeners.indexOf(t),n>=0&&this.history[e].changeListeners.splice(n,1)}else n=this.changeListeners.indexOf(t),n>=0&&this.changeListeners.splice(n,1);return this},a.prototype.clear=function(e){return e?(this.history[e].splice(0,this.history[e].length),this.history[e].changeListeners=[],this.history[e].currentStateIndex=-1):(this.history={},this.changeListeners=[]),this},a.prototype.destroy=function(e){if(e)this.history[e].store.unbind(this,e),this.store.unbind(this,e),this.clear(e),delete this.history[e];else{this.history={},this.changeListeners=[],this.store.unbind(this,e);for(var t in this.history)this.history[t].store.unbind(this,t)}return this},a.prototype.getCurrentState=function(e){var t;if(0===arguments.length){t={};for(e in this.history)t[e]=this.history[e][this.history[e].currentStateIndex];return t}if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');return this.history[e][this.history[e].currentStateIndex]},a.prototype.getPrevState=function(e){if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');var t=this.history[e].currentStateIndex-1;return 0>t?{}:this.history[e][t]},a.prototype.getNextState=function(e){if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');var t=this.history[e].currentStateIndex+1;return t>=this.history[e].length&&(t=this.history[e].length?this.history[e].length-1:0),this.history[e][t]},a.prototype.getFutureState=function(e,t){var n={};return 2===arguments.length?(n[e]=t,n=angular.merge({},this.getCurrentState(),n)):n=this.getCurrentState(),n},a.prototype.undo=l(-1),a.prototype.redo=l(1),a.prototype.undoAll=function(){for(var e in stateObj)this.undo(e)},a.prototype.redoAll=function(){for(var e in stateObj)this.redo(e)},a}]),angular.module("neTree",["neObject"]).run(["$templateCache",function(e){e.put("neTree/item.html","<div>{{item}}</div>"),e.put("neTree/child.html",'<div ng-include="tree.itemTemplate"></div><ul ng-show="item.$expanded"> <li ng-repeat="item in item.$children" ng-include="\'neTree/child.html\'"></li></ul>'),e.put("neTree/tree.html",'<div class="tree"> <ul> <li ng-repeat="item in tree.items" ng-include="\'neTree/child.html\'"></li> </ul> <div class="tree-backdrop" ng-show="tree.disabled"></div></div>'),e.put("neTree/tree-item-pagination.html",'<div ng-if="item.$expanded" class="tree-item-pagination" ng-class="{\'tree-item-pagination-border\':item.$children.length}"> <div ng-if="item.$pagination && !item.$paginationDisabled" class="btn-group btn-group-xs"> <button class="btn btn-light btn-xs" ng-click="tree.setPage(item, \'prev\')" ng-disabled="item.$prevDisabled"> <i class="fa fa-backward"></i> </button> <button class="btn btn-light btn-xs" ng-click="tree.addPage(item)" ng-disabled="item.$nextDisabled"> {{item.$pagination.page}} <span ng-if="item.$pagination.pagesCount">{{::\'of\'|translate}} {{item.$pagination.pagesCount}}</span> </button> <button class="btn btn-light btn-xs" ng-click="tree.setPage(item, \'next\')" ng-disabled="item.$nextDisabled"> <i class="fa fa-forward"></i> </button> </div></div>')}]).directive("neTreeUpdateBlur",["$timeout",function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){function i(e){d=e,d?t.addClass(o):t.removeClass(o)}function s(){i(!1),c=r.$viewValue}var o,a,l,u,d,c;if(r){if(o=n.dirtyClass||"is-dirty","ng-dirty"===o)throw new Error('dirtyClass cannot be equal to "ng-dirty", it is angular reserved class name');if(a=(n.treeUpdateBlur||"").split(","),l=a[0]||"item",u=a[1]||"tree",!e[u])throw new Error('Scope has not grid with name "'+u+'"');if(!e[l])throw new Error('Scope has not grid item with name "'+l+'"');d=!1,t.on("blur",function(){d&&e[u].updateItem(e[l],s)}),t.bind("keydown keypress",function(n){13===n.which&&d&&"INPUT"===t[0].nodeName&&(e[u].updateItem(e[l],s),n.preventDefault())}),c="",e.$watch(r.$viewValue,function(){c=r.$viewValue}),r.$viewChangeListeners.push(function(){i(c!==r.$viewValue?!0:!1)})}}}}]).directive("neTree",[function(){return{restrict:"EA",templateUrl:"neTree/tree.html",scope:{tree:"=neTree"},replace:!0,link:function(e){e.tree.itemTemplate=e.tree.itemTemplate||"neTree/item.html"}}}]).directive("neTreeItemPagination",[function(){return{restrict:"EA",templateUrl:"neTree/tree-item-pagination.html",link:function(){}}}]).factory("NeTree",["$timeout","neObject",function(e,t){function n(e){var t,f=[{},n.defaults];for(t=0;t<arguments.length;t++)f.push(arguments[t]);return e=angular.merge.apply(angular,f),this.id=e.id,this.idKey=e.idKey||"id",this.childrenKey=e.childrenKey,this.childrenCountKey=e.childrenCountKey,this.childrenReferenceKey=e.childrenReferenceKey,this.parentReferenceKey=e.parentReferenceKey,this.ancestorsReferenceKey=e.ancestorsReferenceKey,this.getChildrenQuery=e.getChildrenQuery||d,this.maintainReferences=e.maintainReferences||c,this.defaultLimit=e.defaultLimit||10,this.$limit=e.limit||this.defaultLimit,this.maxLimit=e.maxLimit||100,this.defaultQuery=e.defaultQuery||{},this.defaultSort=e.defaultSort||{},this.interceptLoad=e.interceptLoad||e.beforeLoad||e.loadInterceptor,this.onQuery=e.onQueryChange||e.onQuery||e.onFilter,this.onFill=e.onFill||e.onData||e.onLoad,this.onSelect=e.onSelect,this.onFocus=e.onFocus,this.onMove=e.onMove,this.onUpdate=e.onUpdate,this.onCreate=e.onCreate,this.resource=e.restResource||e.resource,this.getResourceMethod=e.getResourceMethod||e.resourceMethod||("function"==typeof this.resource?this.resource:null)||i,this.onRemove=e.onRemove,this.autoLoad=e.autoLoad||e.loadOnChange,this.multiSelect=e.multiSelect||e.multiselect||!1,this.silentMode=!1,this.$query=angular.merge({},{$page:this.$page,$limit:this.$limit},this.defaultQuery),this.items=[],this.itemTemplate=e.itemTemplate||e.include||"neTree/item.html",this.disabled=!0,this.fillItems=h,this.fill=h,this.addItems=x,this.addItem=x,this.appendItems=x,this.appendItem=x,this.prependItems=w,this.prependItem=w,this.setSort=g,this.setSortSilent=r("setSort"),this.setSortBy=m,this.setSortBySilent=r("setSortBy"),this.updateQuery=k,this.updateQuerySilent=r("updateQuery"),this.setQuery=b,this.setQuerySilent=r("setQuery"),this.setFilter=b,this.setFilterSilent=r("setQuery"),this.setPage=v,this.setPageSilent=r("setPage"),this.addPage=$,this.addPageSilent=r("addPage"),this.appendPage=$,this.appendPageSilent=r("addPage"),this.load=y,this.loadItems=y,this.refresh=y,this.refreshItems=y,this.refreshItem=L,this.createItem=S,this.copyItem=_,this.updateItem=q,this.removeItem=O,this.moveItem=C,this.selectItem=A,this.focusItem=E,this.getFocusedItem=N,this.getSelectedItems=j,this.selectedItems=[],this.focusedItem=null,this.walkItems=s,this.walk=s,this.getParentOf=o,this.getParentsOf=a,this.getAncestorsOf=a,this.getChildrenOf=l,this.getChildrenCountOf=u,this}function r(e){return function(){var t=this;return t.silentMode=!0,t[e].apply(t,arguments),t.silentMode=!1,t}}function i(e){if(!this.resource)throw new Error("NeTree: resource is undefined");return this.resource[e]}function s(e,t){1===arguments.length&&(t=arguments[0],e=null);var n=this;if(!e||e===n||t(e,n.getParentOf(e))!==!0)return function r(e,t,n){var i;for(e=e||[],i=0;i<e.length;i++)if(n(e[i],t)===!0)return;for(i=0;i<e.length;i++)e[i].$children&&e[i].$children.length>0&&r(e[i].$children,e[i],n)}(e?e.$children||(e===n?n.items:[]):n.items,e,t)}function o(e){var t;return this.walkItems(function(n){return n.$children&&n.$children.indexOf(e)>=0?(t=n,!0):!1}),t}function a(e,t){var n,r=this;return t=t||[],n=r.getParentOf(e),n?(t.unshift(n),r.getAncestorsOf(n,t)):t}function l(e){if(!e)throw new Error("Wrong arguments");return e.$children}function u(e){if(!e)throw new Error("Wrong arguments");return(e.$children||[]).length}function d(e){var n=this,r=n.idKey,i=n.ancestorsReferenceKey,s=n.parentReferenceKey,o=n.childrenReferenceKey,a={};if(i)e?(a.$and=[{},{}],a.$and[0][i]={$size:(t.deepGet(e,i)||[]).length+1},a.$and[1][i]=t.deepGet(e,r)):a[i]={$size:0};else if(s)a[s]=t.deepGet(e,r);else{if(!o)throw new Error('Cannot create query, "ancestorsReferenceKey", or "parentReferenceKey", or "childrenReferenceKey" not set');a[o]=t.deepGet(e,o)}return a}function c(e,n,r){var i,s,o,a,l,u,d,c,f,h,p,g,m;e&&n&&(i=this,s=i.idKey,o=i.ancestorsReferenceKey,a=i.parentReferenceKey,l=i.childrenReferenceKey,u=i.childrenCountKey,d=!1,o&&!r&&(c=[].concat(t.deepGet(e,o)||[]),c.push(t.deepGet(e,s)),t.deepSet(n,o,c)),a&&!r&&(f=t.deepGet(e,s),t.deepSet(n,a,f)),l&&(h=t.deepGet(e,l)||[],p=t.deepGet(n,s),r?(g=h.indexOf(p),g>-1&&h.splice(g,1)):-1===h.indexOf(p)?h.push(p):d=!0,t.deepSet(e,l,h)),u&&!d&&(m=t.deepGet(e,u)||0,t.deepSet(e,u,m+(r?-1:1))))}function f(e,t,n){var r=this;n=n||{},t[e+"limit"]=t[e+"limit"]||r.defaultLimit,t[e+"pagination"]=n,t[e+"pagesCount"]=Math.ceil(n.count/t[e+"limit"]),void 0!==n.prev?t[e+"prevDisabled"]=!n.prev:n.page<=1&&(t[e+"prevDisabled"]=!0),void 0!==n.next?t[e+"nextDisabled"]=!n.next:n.page>=t[e+"pagesCount"]&&(t[e+"nextDisabled"]=!0),t[e+"paginationDisabled"]=t[e+"prevDisabled"]&&t[e+"nextDisabled"]}function h(e,t,n,r){var i=this;return i.disabled=!1,Array.isArray(arguments[0])&&(n=arguments[1],t=arguments[0],e=null),3===arguments.length&&"string"==typeof arguments[2]&&(r=arguments[2],n=e?e.$pagination:null),t=Array.isArray(t)?t:[t],e?(["push","append"].indexOf(r)>-1?Array.prototype.push.apply(e.$children,t):["unshift","prepend"].indexOf(r)>-1?Array.prototype.unshift.apply(e.$children,t):e.$children=t,f("$",e,n)):(["push","append"].indexOf(r)>-1?Array.prototype.push.apply(i.items,t):["unshift","prepend"].indexOf(r)>-1?Array.prototype.unshift.apply(i.items,t):i.items=t,f("$",i,n)),p(i,e),"function"!=typeof i.onFill||i.silentMode||(e?i.onFill(e,e.$children,e.$pagination,e.$query):i.onFill(i,i.items,i.$pagination,i.$query)),this}function p(e,n){e.walkItems(n,function(n,r){if(e.childrenKey){var i=t.deepGet(n,e.childrenKey);i&&!n.$children&&(n.$children=i)}n.$level=r?r.$level+1:0})}function g(e,t,n){"function"==typeof arguments[1]&&(n=arguments[1],t=arguments[0],e=null);var r=this;return e?e.$sort=t:r.$sort=t,grid.setPage("first",e,n)}function m(e,t,n){if("string"==typeof arguments[0]&&(n=arguments[1],t=arguments[0],e=null),t){var r={};return r[t]=n,this.setSort(e,r)}}function y(e,t,n){var r,i,s,o=this;return 2===arguments.length&&"function"==typeof arguments[1]?(n=arguments[1],t=!1):1===arguments.length&&"function"==typeof arguments[0]&&(n=arguments[0],t=!1,e=null),r=e?o.getChildrenOf(e):o.items,i=e?o.getChildrenCountOf(e):o.items.length,!e||!r||r.length<i||t?(!o.interceptLoad||o.interceptLoad&&o.interceptLoad((e||o).$query,e)!==!1)&&(s=e?e.$query||{}:o.$query||{},s=angular.merge({},{$page:1,$limit:o.$limit||o.defaultLimit},o.defaultQuery,s,o.getChildrenQuery(e)),s.$sort&&(s.$sort=angular.merge({},o.defaultSort,s.$sort)),e?e.$query=s:delete s.$limit,o.disabled=!0,o.getResourceMethod("find",e)(s,function(r,i){o.fillItems(e,r,i,t),n&&n(r),o.disabled=!1})):n&&n(o.items),o}function v(e,t,n,r){var i,s;return"function"==typeof arguments[0]?(n=arguments[0],t=null):"function"==typeof arguments[1]&&(n=arguments[1],t=arguments[0],e=null),i=this,e=e||i,e.$pagination=e.$pagination||{},s="number"==typeof t?t:"first"===t?1:"next"===t?e.$pagination.page+1:"last"===t?e.$pagesCount:"prev"===t?e.$pagination.page-1:"refresh"===t||null===t?e.$pagination.page||1:1,e.$pagesCount&&s>e.$pagesCount&&"number"!=typeof t&&(s=e.$pagesCount+0),0>=s&&(s=1),e.$page=s,i.updateQuery(e,r),i.autoLoad&&!i.silentMode?i.load(e,!0,n):(n&&n(),i)}function b(e,t,n){2===arguments.length&&(n=arguments[1],t=arguments[0],e=null),e=e||r;var r=this;return e.$query=angular.merge({},r.defaultQuery||{},t||{}),r.setPage(e,e.$query.$page||"first",n,t),r}function $(e,t,n){"function"==typeof arguments[1]&&(n=arguments[1],"number"==typeof arguments[0]?(limit=arguments[0],e=null):limit=null);var r=this;return t=t||"next",r.setPageSilent(e,t),r.autoLoad&&!r.silentMode?r.load(e,"push",n):(n&&n(),r)}function x(e,t){1===arguments.length&&(t=arguments[0],e=null);var n=this;if(t)return n.fillItems(e,t,"push"),n}function w(e,t){1===arguments.length&&(t=arguments[0],e=null);var n=this;if(t)return n.fillItems(e,t,"unshift"),n}function k(e,t){var n,r;return 1===arguments.length&&(t=arguments[0],e=null),n=this,t=t||{},e=e||n,e.$page=t.$page||e.$page,e.$limit=t.$limit||e.$limit||n.$limit,e.$sort=t.$sort||e.$sort,e.$page&&("number"!=typeof e.$page||e.$page<=0)&&(e.$page=1),!e.$limit||e.$limit<0?e.$limit=n.defaultLimit:e.$limit>n.maxLimit&&(e.$limit=n.maxLimit),r=angular.merge({},t,{$limit:e.$limit,$sort:{},$page:e.$page}),e.$sort&&(r.$sort=e.$sort),r.$sort=angular.merge({},n.defaultSort||{},e.$sort||{}),0===Object.keys(r.$sort).length&&delete r.$sort,e.$query&&(delete e.$query.$page,delete e.$query.$sort,delete e.$query.$limit),e.$query=angular.merge(r,e.$query||{}),n.onQuery&&!n.silentMode&&n.onQuery(e.$query,e),n}function _(e,n,r){var i=angular.copy(e);return t.deepRemove(i,this.idKey),this.createItem(this.getParentOf(e),i,n,r)}function S(e,n,r,i){var s=this;return"boolean"==typeof arguments[1]?(i=arguments[2],r=arguments[1],n=arguments[0],e=null):3===arguments.length&&"function"==typeof arguments[2]?(i=arguments[2],r=!1):2===arguments.length&&"function"==typeof arguments[1]?(i=arguments[1],n=arguments[0],e=null):1===arguments.length&&(n=arguments[0],e=null),s.maintainReferences(e,n),s.getResourceMethod("create",n,e)(n,function(o){n=angular.merge(n,o),r&&e&&s.maintainReferences(e,n),r?e&&e.$children?(e.$expanded=!0,s.appendItems(e,o),"function"==typeof i&&i(o),"function"==typeof s.onCreate&&s.onCreate(o)):s.load(e,function(n){e&&(e.$expanded=!0);for(var r=0;r<n.length;r++)if(t.deepGet(n[r],s.idKey)===t.deepGet(o,s.idKey)){"function"==typeof i&&i(n[r]),"function"==typeof s.onCreate&&s.onCreate(n[r]);break}}):("function"==typeof i&&i(n),"function"==typeof s.onCreate&&s.onCreate(n))}),s}function q(e,t){return this.getResourceMethod("update",e)(e,function(n){e=angular.merge(e,n),t&&t(e)}),this}function L(e,n){var r=this.idKey,i={};return i[r]=t.deepGet(e,r),this.getResourceMethod("find",e)(i,function(t){var r=e.$expanded;e=t,r?y(e,function(){n&&n(e)}):n&&n(e)}),this}function C(){}function O(e,t){var n=this;n.getResourceMethod("remove",e)(e,function(){n.maintainReferences(n.getParentOf(e),e,!0);var r=n.getParentOf(e);r?r.$children.splice(r.$children.indexOf(e),1):n.items.splice(n.items.indexOf(e),1),"function"==typeof t&&t()})}function E(e,t){var n=this,r=e.$focused?!0:!1;return n.focusedItem&&n.focusedItem!==e&&(n.focusedItem.$focused=!1),e.$focused=t?!e.$focused:!0,n.focusedItem=t&&r?null:e,"function"==typeof n.onFocus&&n.onFocus(e),n}function N(){return this.focusedItem}function A(e){var t,n,r=this,i=!r.multiSelect,s=e.$selected;if(i){for(t=0;t<r.selectedItems.length;t++)r.selectedItems[t].$selected&&(r.selectedItems[t].$selected=!1);s?r.selectedItems=[]:(e.$selected=!0,r.selectedItems=[e])}else e.$selected?(e.$selected=!1,n=r.selectedItems.indexOf(e),n>=0&&r.selectedItems.splice(n,1)):(e.$selected=!0,r.selectedItems.push(e));"function"==typeof r.onSelect&&r.onSelect(e,e.$selected)}function j(){return this.selectedItems}return n.defaults={},n}]),function(e,t){"use strict";var n,r,i,s=["ng","oc.lazyLoad"],o={},a=[],l=[],u=[],d=[],c=e.noop,f={},h=[],p=e.module("oc.lazyLoad",["ng"]);p.provider("$ocLazyLoad",["$controllerProvider","$provide","$compileProvider","$filterProvider","$injector","$animateProvider",function(n,p,g,m,y,v){function b(t,n,r){var o,a,l,d,p,g;if(n){for(d=[],o=n.length-1;o>=0;o--)if(a=n[o],e.isString(a)||(a=w(a)),a&&-1===h.indexOf(a)&&(!q[a]||-1!==u.indexOf(a))){if(p=-1===s.indexOf(a),l=i(a),p&&(s.push(a),b(t,l.requires,r)),l._runBlocks.length>0)for(f[a]=[];l._runBlocks.length>0;)f[a].push(l._runBlocks.shift());e.isDefined(f[a])&&(p||r.rerun)&&(d=d.concat(f[a])),x(t,l._invokeQueue,a,r.reconfig),x(t,l._configBlocks,a,r.reconfig),c(p?"ocLazyLoad.moduleLoaded":"ocLazyLoad.moduleReloaded",a),n.pop(),h.push(a)}g=t.getInstanceInjector(),e.forEach(d,function(e){g.invoke(e)})}}function $(t,n){function r(t,n){var r,s=!0;return n.length&&(r=i(t),e.forEach(n,function(e){s=s&&i(e)!==r})),s}function i(t){return e.isArray(t)?S(t.toString()):e.isObject(t)?S(_(t)):e.isDefined(t)&&null!==t?S(t.toString()):t}var s,a=t[2][0],l=t[1],u=!1;if(e.isUndefined(o[n])&&(o[n]={}),e.isUndefined(o[n][l])&&(o[n][l]={}),s=function(e,t){o[n][l].hasOwnProperty(e)||(o[n][l][e]=[]),r(t,o[n][l][e])&&(u=!0,o[n][l][e].push(t),c("ocLazyLoad.componentLoaded",[n,l,e]))},e.isString(a))s(a,t[2][1]);else{if(!e.isObject(a))return!1;e.forEach(a,function(t,n){e.isString(t)?s(t,a[1]):s(n,t)})}return u}function x(t,n,r,i){var s,o,l,u,d,c,f,h;if(n)for(s=0,o=n.length;o>s;s++)if(l=n[s],e.isArray(l)){if(null!==t){if(!t.hasOwnProperty(l[0]))throw new Error("unsupported provider "+l[0]);u=t[l[0]]}if(d=$(l,r),"invoke"!==l[1])d&&e.isDefined(u)&&u[l[1]].apply(u,l[2]);else if(c=function(t){var n=a.indexOf(r+"-"+t);(-1===n||i)&&(-1===n&&a.push(r+"-"+t),e.isDefined(u)&&u[l[1]].apply(u,l[2]))},e.isFunction(l[2][0]))c(l[2][0]);else if(e.isArray(l[2][0]))for(f=0,h=l[2][0].length;h>f;f++)e.isFunction(l[2][0][f])&&c(l[2][0][f])}}function w(t){var n=null;return e.isString(t)?n=t:e.isObject(t)&&t.hasOwnProperty("name")&&e.isString(t.name)&&(n=t.name),n}function k(t){if(!e.isString(t))return!1;try{return i(t)}catch(n){if(/No module/.test(n)||n.message.indexOf("$injector:nomod")>-1)return!1}}var _,S,q={},L={$controllerProvider:n,$compileProvider:g,$filterProvider:m,$provide:p,$injector:y,$animateProvider:v},C=!1,O=!1,E=[],N={};E.push=function(e){-1===this.indexOf(e)&&Array.prototype.push.apply(this,arguments)},this.config=function(t){e.isDefined(t.modules)&&(e.isArray(t.modules)?e.forEach(t.modules,function(e){q[e.name]=e}):q[t.modules.name]=t.modules),e.isDefined(t.debug)&&(C=t.debug),
e.isDefined(t.events)&&(O=t.events)},this._init=function(n){var r,i,o,a,u;0===l.length&&(r=[n],i=["ng:app","ng-app","x-ng-app","data-ng-app"],o=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/,a=function(e){return e&&r.push(e)},e.forEach(i,function(t){i[t]=!0,a(document.getElementById(t)),t=t.replace(":","\\:"),"undefined"!=typeof n[0]&&n[0].querySelectorAll&&(e.forEach(n[0].querySelectorAll("."+t),a),e.forEach(n[0].querySelectorAll("."+t+"\\:"),a),e.forEach(n[0].querySelectorAll("["+t+"]"),a))}),e.forEach(r,function(t){var r,s;0===l.length&&(r=" "+n.className+" ",s=o.exec(r),s?l.push((s[2]||"").replace(/\s+/g,",")):e.forEach(t.attributes,function(e){0===l.length&&i[e.name]&&l.push(e.value)}))})),0!==l.length||(t.jasmine||t.mocha)&&e.isDefined(e.mock)||console.error("No module found during bootstrap, unable to init ocLazyLoad. You should always use the ng-app directive or angular.boostrap when you use ocLazyLoad."),u=function c(t){if(-1===s.indexOf(t)){s.push(t);var n=e.module(t);x(null,n._invokeQueue,t),x(null,n._configBlocks,t),e.forEach(n.requires,c)}},e.forEach(l,function(e){u(e)}),l=[],d.pop()},_=function(t){try{return JSON.stringify(t)}catch(n){var r=[];return JSON.stringify(t,function(t,n){if(e.isObject(n)&&null!==n){if(-1!==r.indexOf(n))return;r.push(n)}return n})}},S=function(e){var t,n,r,i=0;if(0==e.length)return i;for(t=0,r=e.length;r>t;t++)n=e.charCodeAt(t),i=(i<<5)-i+n,i|=0;return i},this.$get=["$log","$rootElement","$rootScope","$cacheFactory","$q",function(t,n,a,u,f){function p(e){var n=f.defer();return t.error(e.message),n.reject(e),n.promise}var g,m=u("ocLazyLoad");return C||(t={},t.error=e.noop,t.warn=e.noop,t.info=e.noop),L.getInstanceInjector=function(){return g?g:g=n.data("$injector")||e.injector()},c=function(e,n){O&&a.$broadcast(e,n),C&&t.info(e,n)},{_broadcast:c,_$log:t,_getFilesCache:function(){return m},toggleWatch:function(e){e?d.push(!0):d.pop()},getModuleConfig:function(t){if(!e.isString(t))throw new Error("You need to give the name of the module to get");return q[t]?e.copy(q[t]):null},setModuleConfig:function(t){if(!e.isObject(t))throw new Error("You need to give the module config object to set");return q[t.name]=t,t},getModules:function(){return s},isLoaded:function(t){var n,r,i=function(e){var t=s.indexOf(e)>-1;return t||(t=!!k(e)),t};if(e.isString(t)&&(t=[t]),e.isArray(t)){for(n=0,r=t.length;r>n;n++)if(!i(t[n]))return!1;return!0}throw new Error("You need to define the module(s) name(s)")},_getModuleName:w,_getModule:function(e){try{return i(e)}catch(t){throw(/No module/.test(t)||t.message.indexOf("$injector:nomod")>-1)&&(t.message='The module "'+_(e)+'" that you are trying to load does not exist. '+t.message),t}},moduleExists:k,_loadDependencies:function(t,n){var r,i,s,o=[],a=this;if(t=a._getModuleName(t),null===t)return f.when();try{r=a._getModule(t)}catch(l){return p(l)}return i=a.getRequires(r),e.forEach(i,function(r){var i,l;if(e.isString(r)){if(i=a.getModuleConfig(r),null===i)return void E.push(r);r=i,i.name=void 0}if(a.moduleExists(r.name))return s=r.files.filter(function(e){return a.getModuleConfig(r.name).files.indexOf(e)<0}),0!==s.length&&a._$log.warn('Module "',t,'" attempted to redefine configuration for dependency. "',r.name,'"\n Additional Files Loaded:',s),e.isDefined(a.filesLoader)?void o.push(a.filesLoader(r,n).then(function(){return a._loadDependencies(r)})):p(new Error("Error: New dependencies need to be loaded from external files ("+r.files+"), but no loader has been defined."));if(e.isArray(r)?(l=[],e.forEach(r,function(e){var t=a.getModuleConfig(e);null===t?l.push(e):t.files&&(l=l.concat(t.files))}),l.length>0&&(r={files:l})):e.isObject(r)&&r.hasOwnProperty("name")&&r.name&&(a.setModuleConfig(r),E.push(r.name)),e.isDefined(r.files)&&0!==r.files.length){if(!e.isDefined(a.filesLoader))return p(new Error('Error: the module "'+r.name+'" is defined in external files ('+r.files+"), but no loader has been defined."));o.push(a.filesLoader(r,n).then(function(){return a._loadDependencies(r)}))}}),f.all(o)},inject:function(t){var n,r,i,s=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],a=this,u=f.defer();if(e.isDefined(t)&&null!==t){if(e.isArray(t))return n=[],e.forEach(t,function(e){n.push(a.inject(e,s,o))}),f.all(n);a._addToLoadList(a._getModuleName(t),!0,o)}if(l.length>0)r=l.slice(),(i=function d(e){E.push(e),N[e]=u.promise,a._loadDependencies(e,s).then(function(){try{h=[],b(L,E,s)}catch(e){return a._$log.error(e.message),void u.reject(e)}l.length>0?d(l.shift()):u.resolve(r)},function(e){u.reject(e)})})(l.shift());else{if(s&&s.name&&N[s.name])return N[s.name];u.resolve()}return u.promise},getRequires:function(t){var n=[];return e.forEach(t.requires,function(e){-1===s.indexOf(e)&&n.push(e)}),n},_invokeQueue:x,_registerInvokeList:$,_register:b,_addToLoadList:r,_unregister:function(t){e.isDefined(t)&&e.isArray(t)&&e.forEach(t,function(e){o[e]=void 0})}}}],this._init(e.element(t.document))}]),n=e.bootstrap,e.bootstrap=function(t,i,s){return e.forEach(i.slice(),function(e){r(e,!0,!0)}),n(t,i,s)},r=function(t,n,r){(d.length>0||n)&&e.isString(t)&&-1===l.indexOf(t)&&(l.push(t),r&&u.push(t))},i=e.module,e.module=function(e,t,n){return r(e,!1,!0),i(e,t,n)},"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="oc.lazyLoad")}(angular,window),function(e){"use strict";e.module("oc.lazyLoad").directive("ocLazyLoad",["$ocLazyLoad","$compile","$animate","$parse","$timeout",function(t,n,r,i){return{restrict:"A",terminal:!0,priority:1e3,compile:function(s){var o=s[0].innerHTML;return s.html(""),function(s,a,l){var u=i(l.ocLazyLoad);s.$watch(function(){return u(s)||l.ocLazyLoad},function(i){e.isDefined(i)&&t.load(i).then(function(){r.enter(o,a),n(a.contents())(s)})},!0)}}}}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q","$window","$interval",function(t,n,r,i){var s=!1,o=!1,a=r.document.getElementsByTagName("head")[0]||r.document.getElementsByTagName("body")[0];return t.buildElement=function(l,u,d){var c,f,h,p,g,m,y,v,b,$,x,w=n.defer(),k=t._getFilesCache(),_=function(e){var t=(new Date).getTime();return e.indexOf("?")>=0?"&"===e.substring(0,e.length-1)?e+"_dc="+t:e+"&_dc="+t:e+"?_dc="+t};switch(e.isUndefined(k.get(u))&&k.put(u,w.promise),l){case"css":c=r.document.createElement("link"),c.type="text/css",c.rel="stylesheet",c.href=d.cache===!1?_(u):u;break;case"js":c=r.document.createElement("script"),c.src=d.cache===!1?_(u):u;break;default:k.remove(u),w.reject(new Error('Requested type "'+l+'" is not known. Could not inject "'+u+'"'))}return c.onload=c.onreadystatechange=function(){c.readyState&&!/^c|loade/.test(c.readyState)||f||(c.onload=c.onreadystatechange=null,f=1,t._broadcast("ocLazyLoad.fileLoaded",u),w.resolve())},c.onerror=function(){k.remove(u),w.reject(new Error("Unable to load "+u))},c.async=d.serie?0:1,h=a.lastChild,d.insertBefore&&(p=e.element(e.isDefined(window.jQuery)?d.insertBefore:document.querySelector(d.insertBefore)),p&&p.length>0&&(h=p[0])),h.parentNode.insertBefore(c,h),"css"==l&&(s||(g=r.navigator.userAgent.toLowerCase(),/iP(hone|od|ad)/.test(r.navigator.platform)?(m=r.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),y=parseFloat([parseInt(m[1],10),parseInt(m[2],10),parseInt(m[3]||0,10)].join(".")),o=6>y):g.indexOf("android")>-1?(v=parseFloat(g.slice(g.indexOf("android")+8)),o=4.4>v):g.indexOf("safari")>-1&&(b=g.match(/version\/([\.\d]+)/i),o=b&&b[1]&&parseFloat(b[1])<6)),o&&($=1e3,x=i(function(){try{c.sheet.cssRules,i.cancel(x),c.onload()}catch(e){--$<=0&&c.onerror()}},20))),w.promise},t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.filesLoader=function(r){var i,s,o,a,l,u,d=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],c=[],f=[],h=[],p=[],g=null,m=t._getFilesCache();return t.toggleWatch(!0),e.extend(d,r),i=function(n){var r,i=null;if(e.isObject(n)&&(i=n.type,n=n.path),g=m.get(n),e.isUndefined(g)||d.cache===!1){if(null!==(r=/^(css|less|html|htm|js)?(?=!)/.exec(n))&&(i=r[1],n=n.substr(r[1].length+1,n.length)),!i)if(null!==(r=/[.](css|less|html|htm|js)?((\?|#).*)?$/.exec(n)))i=r[1];else{if(t.jsLoader.hasOwnProperty("ocLazyLoadLoader")||!t.jsLoader.hasOwnProperty("requirejs"))return void t._$log.error("File type could not be determined. "+n);i="js"}"css"!==i&&"less"!==i||-1!==c.indexOf(n)?"html"!==i&&"htm"!==i||-1!==f.indexOf(n)?"js"===i||-1===h.indexOf(n)?h.push(n):t._$log.error("File type is not valid. "+n):f.push(n):c.push(n)}else g&&p.push(g)},d.serie?i(d.files.shift()):e.forEach(d.files,function(e){i(e)}),c.length>0&&(s=n.defer(),t.cssLoader(c,function(n){e.isDefined(n)&&t.cssLoader.hasOwnProperty("ocLazyLoadLoader")?(t._$log.error(n),s.reject(n)):s.resolve()},d),p.push(s.promise)),f.length>0&&(o=n.defer(),t.templatesLoader(f,function(n){e.isDefined(n)&&t.templatesLoader.hasOwnProperty("ocLazyLoadLoader")?(t._$log.error(n),o.reject(n)):o.resolve()},d),p.push(o.promise)),h.length>0&&(a=n.defer(),t.jsLoader(h,function(n){e.isDefined(n)&&(t.jsLoader.hasOwnProperty("ocLazyLoadLoader")||t.jsLoader.hasOwnProperty("requirejs"))?(t._$log.error(n),a.reject(n)):a.resolve()},d),p.push(a.promise)),0===p.length?(l=n.defer(),u="Error: no file to load has been found, if you're trying to load an existing module you should use the 'inject' method instead of 'load'.",t._$log.error(u),l.reject(u),l.promise):d.serie&&d.files.length>0?n.all(p).then(function(){return t.filesLoader(r,d)}):n.all(p)["finally"](function(e){return t.toggleWatch(!1),e})},t.load=function(r){var i,s,o,a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],l=this,u=null,d=[],c=n.defer(),f=e.copy(r),h=e.copy(a);return e.isArray(f)?(e.forEach(f,function(e){d.push(l.load(e,h))}),n.all(d).then(function(e){c.resolve(e)},function(e){c.reject(e)}),c.promise):(e.isString(f)?(u=l.getModuleConfig(f),u||(u={files:[f]})):e.isObject(f)&&(u=e.isDefined(f.path)&&e.isDefined(f.type)?{files:[f]}:l.setModuleConfig(f)),null===u?(s=l._getModuleName(f),i='Module "'+(s||"unknown")+'" is not configured, cannot load.',t._$log.error(i),c.reject(new Error(i)),c.promise):(e.isDefined(u.template)&&(e.isUndefined(u.files)&&(u.files=[]),e.isString(u.template)?u.files.push(u.template):e.isArray(u.template)&&u.files.concat(u.template)),o=e.extend({},h,u),e.isUndefined(u.files)&&e.isDefined(u.name)&&t.moduleExists(u.name)?t.inject(u.name,o,!0):(t.filesLoader(u,o).then(function(){t.inject(null,o).then(function(e){c.resolve(e)},function(e){c.reject(e)})},function(e){c.reject(e)}),c.promise)))},t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.cssLoader=function(r,i,s){var o=[];e.forEach(r,function(e){o.push(t.buildElement("css",e,s))}),n.all(o).then(function(){i()},function(e){i(e)})},t.cssLoader.ocLazyLoadLoader=!0,t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.jsLoader=function(r,i,s){var o=[];e.forEach(r,function(e){o.push(t.buildElement("js",e,s))}),n.all(o).then(function(){i()},function(e){i(e)})},t.jsLoader.ocLazyLoadLoader=!0,t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$templateCache","$q","$http",function(t,n,r,i){return t.templatesLoader=function(s,o,a){var l=[],u=t._getFilesCache();return e.forEach(s,function(t){var s=r.defer();l.push(s.promise),i.get(t,a).success(function(r){e.isString(r)&&r.length>0&&e.forEach(e.element(r),function(e){"SCRIPT"===e.nodeName&&"text/ng-template"===e.type&&n.put(e.id,e.innerHTML)}),e.isUndefined(u.get(t))&&u.put(t,!0),s.resolve()}).error(function(e){s.reject(new Error('Unable to load template file "'+t+'": '+e))})}),r.all(l).then(function(){o()},function(e){o(e)})},t.templatesLoader.ocLazyLoadLoader=!0,t}])}])}(angular),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var n,r,i,s;if(null==this)throw new TypeError('"this" is null or not defined');if(r=Object(this),i=r.length>>>0,0===i)return-1;if(s=+t||0,Math.abs(s)===1/0&&(s=0),s>=i)return-1;for(n=Math.max(s>=0?s:i-Math.abs(s),0);i>n;){if(n in r&&r[n]===e)return n;n++}return-1});
//# sourceMappingURL=./ne-modules.min.js.map