//>>built
require({cache:{"url:dojox/grid/resources/Expando.html":'\x3cdiv class\x3d"dojoxGridExpando"\n\t\x3e\x3cdiv class\x3d"dojoxGridExpandoNode" dojoAttachEvent\x3d"onclick:onToggle"\n\t\t\x3e\x3cdiv class\x3d"dojoxGridExpandoNodeInner" dojoAttachPoint\x3d"expandoInner"\x3e\x3c/div\n\t\x3e\x3c/div\n\x3e\x3c/div\x3e\n'}});
define("dojox/grid/LazyTreeGrid","dojo/_base/kernel dojo/_base/declare dojo/_base/lang dojo/_base/event dojo/_base/array dojo/query dojo/parser dojo/dom-construct dojo/dom-class dojo/dom-style dojo/dom-geometry dojo/dom dojo/keys dojo/text!./resources/Expando.html dijit/_Widget dijit/_TemplatedMixin ./TreeGrid ./_Builder ./_View ./_Layout ./cells/tree ./_RowManager ./_FocusManager ./_EditManager ./DataSelection ./util".split(" "),function(H,p,h,I,v,C,J,D,w,K,t,L,M,y,N,O,E,P,z,Q,R,S,T,U,V,W){var X=
p("dojox.grid._LazyExpando",[N,O],{grid:null,view:null,rowIdx:-1,cellIdx:-1,level:0,itemId:"",templateString:y,onToggle:function(a){if(this.grid._treeCache.items[this.rowIdx]){this.grid.focus.setFocusIndex(this.rowIdx,this.cellIdx);this.setOpen(!this.grid._treeCache.items[this.rowIdx].opened);try{I.stop(a)}catch(b){}}},setOpen:function(a){var b=this.grid,c=b._by_idx[this.rowIdx].item;c&&b.treeModel.mayHaveChildren(c)&&!b._loading&&b._treeCache.items[this.rowIdx].opened!==a&&(b._treeCache.items[this.rowIdx].opened=
a,b.expandoFetch(this.rowIdx,a),this._updateOpenState(c))},_updateOpenState:function(a){var b=this.grid;a&&b.treeModel.mayHaveChildren(a)?(a=b._treeCache.items[this.rowIdx].opened,this.expandoInner.innerHTML=a?"-":"+",w.toggle(this.domNode,"dojoxGridExpandoOpened",a),this.domNode.parentNode.setAttribute("aria-expanded",a)):w.remove(this.domNode,"dojoxGridExpandoOpened")},setRowNode:function(a,b,c){if(0>this.cellIdx||!this.itemId)return!1;this.view=c;this.grid=c.grid;this.rowIdx=a;a=this.grid.isLeftToRight()?
"marginLeft":"marginRight";K.set(this.domNode.parentNode,a,1.125*this.level+"em");this._updateOpenState(this.grid._by_idx[this.rowIdx].item);return!0}});y=p("dojox.grid._TreeGridContentBuilder",P._ContentBuilder,{generateHtml:function(a,b){var c=this.getTableArray(),d=this.grid,g=this.view.structure.cells,e=d.getItem(b),f=0,k="",l=d._treeCache.items[b]?d._treeCache.items[b].treePath:null;W.fire(this.view,"onBeforeRow",[b,g]);e&&h.isArray(l)&&(f=l.length,k=d.treeModel.mayHaveChildren(e)?"":"dojoxGridNoChildren");
var m=0;d=0;for(var u,n,A=0,F=[];u=g[d];d++)if(!u.hidden&&!u.header){c.push('\x3ctr class\x3d"'+k+'"\x3e');(l=this._getColSpans(f))&&v.forEach(l,function(G){for(m=0;n=u[m];m++)m>=G.start&&m<=G.end&&(A+=this._getCellWidth(u,m));F.push(A);A=0},this);var q=0;for(m=0;n=u[m];m++){var r=n.markup;var x=n.customClasses=[];var B=n.customStyles=[];l&&l[q]&&m>=l[q].start&&m<=l[q].end?m==(l[q].primary||l[q].start)?(r[5]=n.formatAtLevel(e,f,b),r[1]=x.join(" "),x=t.getMarginBox(n.getHeaderNode()).w-t.getContentBox(n.getHeaderNode()).w,
B=n.customStyles=["width:"+(F[q]-x)+"px"],r[3]=B.join(";"),c.push.apply(c,r)):m==l[q].end&&q++:(r[5]=n.formatAtLevel(e,f,b),r[1]=x.join(" "),r[3]=B.join(";"),c.push.apply(c,r))}c.push("\x3c/tr\x3e")}c.push("\x3c/table\x3e");return c.join("")},_getColSpans:function(a){var b=this.grid.colSpans;return b&&b[a]?b[a]:null},_getCellWidth:function(a,b){var c=a[b],d=c.getHeaderNode();if(c.hidden)return 0;if(b==a.length-1||v.every(a.slice(b+1),function(g){return g.hidden}))return c=t.position(a[b].view.headerContentNode.firstChild),
c.x+c.w-t.position(d).x;do c=a[++b];while(c.hidden);return t.position(c.getHeaderNode()).x-t.position(d).x}});p("dojox.grid._TreeGridView",z,{_contentBuilderClass:y,postCreate:function(){this.inherited(arguments);this._expandos={};this.connect(this.grid,"_onCleanupExpandoCache","_cleanupExpandoCache")},destroy:function(){this._cleanupExpandoCache();this.inherited(arguments)},_cleanupExpandoCache:function(a){if(a&&this._expandos[a])this._expandos[a].destroy(),delete this._expandos[a];else{for(var b in this._expandos)this._expandos[b].destroy();
this._expandos={}}},onAfterRow:function(a,b,c){C("span.dojoxGridExpando",c).forEach(function(d){if(d&&d.parentNode){var g=this.grid._by_idx;if(g&&g[a]&&g[a].idty){var e=g[a].idty;var f=this._expandos[e]}f?(D.place(f.domNode,d,"replace"),f.itemId=d.getAttribute("itemId"),f.cellIdx=parseInt(d.getAttribute("cellIdx"),10),isNaN(f.cellIdx)&&(f.cellIdx=-1)):(f=J.parse(d.parentNode)[0],e&&(this._expandos[e]=f));f.setRowNode(a,c,this)||f.domNode.parentNode.removeChild(f.domNode);D.destroy(d)}},this);this.inherited(arguments)},
updateRow:function(a){var b=this.grid,c;b.keepSelection&&(c=b.getItem(a))&&b.selection.preserver._reSelectById(c,a);this.inherited(arguments)}});var Y=h.mixin(h.clone(R),{formatAtLevel:function(a,b,c){if(!a)return this.formatIndexes(c,a,b);var d="";this.isCollapsable&&this.grid.store.isItem(a)&&(d="\x3cspan "+H._scopeName+'Type\x3d"dojox.grid._LazyExpando" level\x3d"'+b+'" class\x3d"dojoxGridExpando" itemId\x3d"'+this.grid.store.getIdentity(a)+'" cellIdx\x3d"'+this.index+'"\x3e\x3c/span\x3e');a=this.formatIndexes(c,
a,b);return""!==d?"\x3cdiv\x3e"+d+a+"\x3c/div\x3e":a},formatIndexes:function(a,b,c){var d=this.grid.edit.info;b=this.get?this.get(a,b):this.value||this.defaultValue;if(this.editable&&(this.alwaysEditing||d.rowIndex===a&&d.cell===this))return this.formatEditing(b,a);d=this.textDir||this.grid.textDir;a=this._defaultFormat(b,[b,a,c,this]);d&&this._enforceTextDirWithUcc&&(a=this._enforceTextDirWithUcc(d,a));return a}});z=p("dojox.grid._LazyTreeLayout",Q,{setStructure:function(a){var b=a;this.grid&&!v.every(b,
function(c){return!!c.cells})&&(b=arguments[0]=[{cells:[b]}]);1===b.length&&1===b[0].cells.length&&(b[0].type="dojox.grid._TreeGridView",this._isCollapsable=!0,b[0].cells[0][this.grid.expandoCell].isCollapsable=!0);this.inherited(arguments)},addCellDef:function(a,b,c){var d=this.inherited(arguments);return h.mixin(d,Y)}});var Z=p("dojox.grid._LazyTreeGridCache",null,{constructor:function(){this.items=[]},getSiblingIndex:function(a,b){for(var c=a-1,d=0,g;0<=c;c--)if(g=this.items[c]?this.items[c].treePath:
[],g.join("/")===b.join("/"))d++;else if(g.length<b.length)break;return d},removeChildren:function(a){for(var b=a+1,c,d=this.items[a]?this.items[a].treePath:[];b<this.items.length&&!(c=this.items[b]?this.items[b].treePath:[],c.join("/")===d.join("/")||c.length<=d.length);b++);b-=a+1;this.items.splice(a+1,b);return b}});p=p("dojox.grid.LazyTreeGrid",E,{_layoutClass:z,_size:0,treeModel:null,defaultState:null,colSpans:null,postCreate:function(){this._setState();this.inherited(arguments);this._treeCache||
(this._treeCache=new Z);if(!(this.treeModel&&this.treeModel instanceof dijit.tree.ForestStoreModel))throw Error("dojox.grid.LazyTreeGrid: must be used with a treeModel which is an instance of dijit.tree.ForestStoreModel");w.add(this.domNode,"dojoxGridTreeModel");L.setSelectable(this.domNode,this.selectable)},createManagers:function(){this.rows=new S(this);this.focus=new T(this);this.edit=new U(this)},createSelection:function(){this.selection=new V(this)},setModel:function(a){a&&(this._setModel(a),
this._cleanup(),this._refresh(!0))},setStore:function(a,b,c){a&&(this._setQuery(b,c),this.treeModel.query=b,this.treeModel.store=a,this.treeModel.root.children=[],this.setModel(this.treeModel))},onSetState:function(){},_setState:function(){this.defaultState&&(this._treeCache=this.defaultState.cache,this.sortInfo=this.defaultState.sortInfo||0,this.query=this.defaultState.query||this.query,this._lastScrollTop=this.defaultState.scrollTop,this.keepSelection?this.selection.preserver._selectedById=this.defaultState.selection:
this.selection.selected=this.defaultState.selection||[],this.onSetState())},getState:function(){var a=this.keepSelection?this.selection.preserver._selectedById:this.selection.selected;return{cache:h.clone(this._treeCache),query:h.clone(this.query),sortInfo:h.clone(this.sortInfo),scrollTop:h.clone(this.scrollTop),selection:h.clone(a)}},_setQuery:function(a,b){this.inherited(arguments);this.treeModel.query=a},filter:function(a,b){this._cleanup();this.inherited(arguments)},destroy:function(){this._cleanup();
this.inherited(arguments)},expand:function(a){this._fold(a,!0)},collapse:function(a){this._fold(a,!1)},refresh:function(a){a||this._cleanup();this._refresh(!0)},_cleanup:function(){this._treeCache.items=[];this._onCleanupExpandoCache()},setSortIndex:function(a,b){this.canSort(a+1)&&this._cleanup();this.inherited(arguments)},_refresh:function(a){this._clearData();this.updateRowCount(this._size);this._fetch(0,!0)},render:function(){this.inherited(arguments);this.setScrollTop(this.scrollTop)},_onNew:function(a,
b){var c=b&&this.store.isItem(b.item)&&v.some(this.treeModel.childrenAttrs,function(k){return k===b.attribute}),d=this._treeCache.items,g=this._by_idx;if(c){c=this.store.getIdentity(b.item);for(var e=-1,f=0;f<g.length;f++)if(c===g[f].idty){e=f;break}if(0<=e)if(d[e]&&d[e].opened){f=d[e].treePath;for(e+=1;e<d.length&&!(d[e].treePath.length<=f.length);e++);d=f.slice();d.push(c);this._treeCache.items.splice(e,0,{opened:!1,treePath:d});d=this.store.getIdentity(a);this._by_idty[d]={idty:d,item:a};g.splice(e,
0,this._by_idty[d]);this._size+=1;this.updateRowCount(this._size);this._updateRenderedRows(e)}else this.updateRow(e)}else d.push({opened:!1,treePath:[]}),this._size+=1,this.inherited(arguments)},_onDelete:function(a){var b=0,c=-1;for(a=this.store.getIdentity(a);b<this._by_idx.length;b++)if(a===this._by_idx[b].idty){c=b;break}if(0<=c){var d=this._treeCache.items,g=d[c]?d[c].treePath:[],e=1;for(b=c+1;b<this._size&&!(d[b].treePath.length<=g.length);b++,e++);d.splice(c,e);this._onCleanupExpandoCache(a);
this._by_idx.splice(c,e);this._size-=e;this.updateRowCount(this._size);this._updateRenderedRows(c)}},_onCleanupExpandoCache:function(a){},_fetch:function(a,b){this._loading||(this._loading=!0);a=a||0;var c=0<this._size-a?Math.min(this.rowsPerPage,this._size-a):this.rowsPerPage,d=0,g=[];for(this._reqQueueLen=0;d<c;d++)if(this._by_idx[a+d])g.push(this._by_idx[a+d].item);else break;if(g.length===c)this._reqQueueLen=1,this._onFetchBegin(this._size,{startRowIdx:a,count:c}),this._onFetchComplete(g,{startRowIdx:a,
count:c});else{var e=1,f=this._treeCache.items,k=f[a]?f[a].treePath:[];for(d=1;d<c;d++){g=f[a+e-1]?f[a+e-1].treePath.length:0;var l=f[a+e]?f[a+e].treePath.length:0;g!==l?(this._reqQueueLen++,this._fetchItems({startRowIdx:a,count:e,treePath:k}),a+=e,e=1,k=f[a]?f[a].treePath:0):e++}this._reqQueueLen++;this._fetchItems({startRowIdx:a,count:e,treePath:k})}},_fetchItems:function(a){if(!this._pending_requests[a.startRowIdx]){this.showMessage(this.loadingMessage);this._pending_requests[a.startRowIdx]=!0;
var b=h.hitch(this,"_onFetchError"),c=this._treeCache.getSiblingIndex(a.startRowIdx,a.treePath);if(0===a.treePath.length)this.store.fetch({start:c,startRowIdx:a.startRowIdx,treePath:a.treePath,count:a.count,query:this.query,sort:this.getSortProps(),queryOptions:this.queryOptions,onBegin:h.hitch(this,"_onFetchBegin"),onComplete:h.hitch(this,"_onFetchComplete"),onError:h.hitch(this,"_onFetchError")});else{var d=a.treePath[a.treePath.length-1],g={start:c,startRowIdx:a.startRowIdx,treePath:a.treePath,
count:a.count,parentId:d,sort:this.getSortProps()},e=this,f=function(){var k=h.hitch(e,"_onFetchComplete");1==arguments.length?k.apply(e,[arguments[0],g]):k.apply(e,arguments)};this._by_idty[d]?(a=this._by_idty[d].item,this.treeModel.getChildren(a,f,b,g)):this.store.fetchItemByIdentity({identity:d,onItem:function(k){e.treeModel.getChildren(k,f,b,g)},onError:b})}}},_onFetchBegin:function(a,b){0===this._treeCache.items.length&&(this._size=parseInt(a,10));a=this._size;this.inherited(arguments)},_onFetchComplete:function(a,
b){var c=b.startRowIdx,d=b.count,g=a.length<=d?0:b.start,e=b.treePath||[];if(h.isArray(a)&&0<a.length){var f=0;for(d=Math.min(d,a.length);f<d;f++)this._treeCache.items[c+f]||(this._treeCache.items[c+f]={opened:!1,treePath:e}),this._by_idx[c+f]||this._addItem(a[g+f],c+f,!0);this.updateRows(c,d)}0==this._size?this.showMessage(this.noDataMessage):this.showMessage();this._pending_requests[c]=!1;this._reqQueueLen--;this._loading&&0===this._reqQueueLen&&(this._loading=!1,this._lastScrollTop&&this.setScrollTop(this._lastScrollTop))},
expandoFetch:function(a,b){if(!this._loading&&this._by_idx[a]){this._loading=!0;this._toggleLoadingClass(a,!0);this.expandoRowIndex=a;var c=this._by_idx[a].item;if(b){var d={start:0,count:this.rowsPerPage,parentId:this.store.getIdentity(this._by_idx[a].item),sort:this.getSortProps()};this.treeModel.getChildren(c,h.hitch(this,"_onExpandoComplete"),h.hitch(this,"_onFetchError"),d)}else c=this._treeCache.removeChildren(a),this._by_idx.splice(a+1,c),this._bop=this._eop=-1,this._size-=c,this.updateRowCount(this._size),
this._updateRenderedRows(a+1),this._toggleLoadingClass(a,!1),this._loading&&(this._loading=!1),this.focus._delayedCellFocus()}},_onExpandoComplete:function(a,b,c){c=isNaN(c)?a.length:parseInt(c,10);var d=this._treeCache.items[this.expandoRowIndex].treePath.slice(0);d.push(this.store.getIdentity(this._by_idx[this.expandoRowIndex].item));for(b=1;b<=c;b++)this._treeCache.items.splice(this.expandoRowIndex+b,0,{treePath:d,opened:!1});this._size+=c;this.updateRowCount(this._size);for(b=0;b<c;b++)a[b]?(d=
this.store.getIdentity(a[b]),this._by_idty[d]={idty:d,item:a[b]},this._by_idx.splice(this.expandoRowIndex+1+b,0,this._by_idty[d])):this._by_idx.splice(this.expandoRowIndex+1+b,0,null);this._updateRenderedRows(this.expandoRowIndex+1);this._toggleLoadingClass(this.expandoRowIndex,!1);this.stateChangeNode=null;this._loading&&(this._loading=!1);!0===this.autoHeight&&this._resize();this.focus._delayedCellFocus()},styleRowNode:function(a,b){b&&this.rows.styleRowNode(a,b)},onStyleRow:function(a){this.layout._isCollapsable?
(a.customClasses+=(a.odd?" dojoxGridRowOdd":"")+(a.selected?" dojoxGridRowSelected":"")+(a.over?" dojoxGridRowOver":""),this.focus.styleRow(a),this.edit.styleRow(a)):this.inherited(arguments)},onKeyDown:function(a){if(!a.altKey&&!a.metaKey){var b=dijit.findWidgets(a.target)[0];if(a.keyCode===M.ENTER&&b instanceof X)b.onToggle();this.inherited(arguments)}},_toggleLoadingClass:function(a,b){var c=this.views.views;(c=c[c.length-1].getRowNode(a))&&(c=C(".dojoxGridExpando",c)[0])&&w.toggle(c,"dojoxGridExpandoLoading",
b)},_updateRenderedRows:function(a){v.forEach(this.scroller.stack,function(b){b*this.rowsPerPage>=a?this.updateRows(b*this.rowsPerPage,this.rowsPerPage):(b+1)*this.rowsPerPage>=a&&this.updateRows(a,(b+1)*this.rowsPerPage-a+1)},this)},_fold:function(a,b){var c=-1,d=0,g=this._by_idx,e=this._by_idty[a];if(e&&e.item&&this.treeModel.mayHaveChildren(e.item)){for(;d<g.length;d++)if(g[d]&&g[d].idty===a){c=d;break}0<=c&&(c=this.views.views[this.views.views.length-1].getRowNode(c))&&(c=dijit.findWidgets(c)[0])&&
c.setOpen(b)}}});p.markupFactory=function(a,b,c,d){return E.markupFactory(a,b,c,d)};return p});