text: /**
   * Copyright (c) 2014, 2016, Oracle and/or its affiliates.
   * The Universal Permissive License (UPL), Version 1.0
   */
  "use strict";
  /*
   Copyright 2013 jQuery Foundation and other contributors
   Released under the MIT license.
   http://jquery.org/license
  */
  define(["ojs/ojcore","jquery","ojs/ojdatasource-common"],function(a,g){a.Qb=function(c,b){b=b||{};if(!(c instanceof a.ua))throw Error(a.aa.nd._ERR_DATA_INVALID_TYPE_SUMMARY+"\n"+a.aa.nd._ERR_DATA_INVALID_TYPE_DETAIL);this.i=c;this.Ue=[];this.pa=0;this.ai=[];this.bn=!0;null==this.i.bF("fetchSize")&&(this.i.Tk=function(){return-1});var d=this;this.i.zM=function(b,c,g){var k,l,m,r,t=[],s=[],n=[];for(c=0;c<g.getCount();c++){l=g.getData(c);r=g.getMetadata(c).key;m=b+c;d.ai.splice(m,0,{});d.ai[m].nodeSet=
  g;d.ai[m].startIndex=b;for(k=m+1;k<d.ai.length;k++)d.ai[k].startIndex+=1;t.push(d.Wo(m,l));s.push(r);n.push(m);d.ya.data.splice(m,0,l);d.ya.keys.splice(m,0,r);d.ya.indexes.splice(m,0,m)}d.VD();d.bn=!0;a.aa.u.handleEvent.call(d,a.aa.Q.ADD,{data:t,keys:s,indexes:n})};this.i.BN=function(b){var c,g,k,l=[],m=[],r=[];for(c=0;c<b.length;c++){k=b[c].index-c;l.push("");m.push("");r.push(k);d.ai.splice(k,1);for(g=k+1;g<d.ai.length;g++)d.ai[g].startIndex-=1;d.ya.data.splice(k,1);d.ya.keys.splice(k,1);d.ya.indexes.splice(k,
  1)}d.VD();d.bn=!0;a.aa.u.handleEvent.call(d,a.aa.Q.REMOVE,{data:l,keys:m,indexes:r})};this.Init();if(null!=b&&("enabled"==b.startFetch||null==b.startFetch)||null==b)this.qE=!0};o_("FlattenedTreeTableDataSource",a.Qb,a);a.b.ta(a.Qb,a.aa,"oj.FlattenedTreeTableDataSource");a.Qb.prototype.Init=function(){a.Qb.u.Init.call(this)};a.b.g("FlattenedTreeTableDataSource.prototype.Init",{Init:a.Qb.prototype.Init});a.Qb.prototype.getCapability=function(){return"full"};a.b.g("FlattenedTreeTableDataSource.prototype.getCapability",
  {getCapability:a.Qb.prototype.getCapability});a.Qb.prototype.getWrappedDataSource=function(){return this.i};a.b.g("FlattenedTreeTableDataSource.prototype.getWrappedDataSource",{getWrappedDataSource:a.Qb.prototype.getWrappedDataSource});a.Qb.prototype.fetch=function(a){a=a||{};return"init"!=a.fetchType||this.qE?this.Bg(a):Promise.resolve()};a.b.g("FlattenedTreeTableDataSource.prototype.fetch",{fetch:a.Qb.prototype.fetch});a.Qb.prototype.at=function(a){var b;b=0>a||a>=this.ya.length?null:{data:this.ya.data[a],
  index:a,key:this.ya.keys[a]};return new Promise(function(a){a(b)})};a.b.g("FlattenedTreeTableDataSource.prototype.at",{at:a.Qb.prototype.at});a.Qb.prototype.collapse=function(a){this.i.collapse(a)};a.b.g("FlattenedTreeTableDataSource.prototype.collapse",{collapse:a.Qb.prototype.collapse});a.Qb.prototype.expand=function(a){this.i.expand(a)};a.b.g("FlattenedTreeTableDataSource.prototype.expand",{expand:a.Qb.prototype.expand});a.Qb.prototype.get=function(a){var b=this.i.Uk(Object(a));a={data:this.Wo(b,
  this.ya.data[b]),key:a,index:b};return Promise.resolve(a)};a.b.g("FlattenedTreeTableDataSource.prototype.get",{get:a.Qb.prototype.get});a.Qb.prototype.on=function(c,b){if("expand"==c||"collapse"==c)this.i.on(c,b);else a.Qb.u.on.call(this,c,b)};a.b.g("FlattenedTreeTableDataSource.prototype.on",{on:a.Qb.prototype.on});a.Qb.prototype.off=function(c,b){"expand"==c||"collapse"==c?this.i.off(c,b):a.Qb.u.off.call(this,c,b)};a.b.g("FlattenedTreeTableDataSource.prototype.off",{off:a.Qb.prototype.off});a.Qb.prototype.sort=
  function(c){null==c?c=this.sortCriteria:this.sortCriteria=c;var b=this;c.axis="column";return new Promise(function(d,e){b.i.getWrappedDataSource().sort(c,{success:function(){setTimeout(function(){b.i.refresh();b.ya=null;var e={header:c.key,direction:c.direction};a.aa.u.handleEvent.call(b,a.aa.Q.SORT,e);d(e)},0)}.bind(this),error:function(a){e(a)}.bind(this)})})};a.b.g("FlattenedTreeTableDataSource.prototype.sort",{sort:a.Qb.prototype.sort});a.Qb.prototype.totalSize=function(){return this.bn?-1:this.ya.data.length};
  a.b.g("FlattenedTreeTableDataSource.prototype.totalSize",{totalSize:a.Qb.prototype.totalSize});a.Qb.prototype.totalSizeConfidence=function(){return this.bn?"unknown":"actual"};a.b.g("FlattenedTreeTableDataSource.prototype.totalSizeConfidence",{totalSizeConfidence:a.Qb.prototype.totalSizeConfidence});a.Qb.prototype.YS=function(a){var b=this.ai[a].nodeSet.getStart();return this.ai[a].nodeSet.getMetadata(b+a-this.ai[a].startIndex)};a.Qb.prototype.Bg=function(c){c=c||{};this.pE(c);this.pa=null==c.startIndex?
  this.pa:c.startIndex;var b=Number.MAX_VALUE;this.Fb=null==c.pageSize?this.Fb:c.pageSize;null!=this.Fb&&(b=this.Fb);var d=this.pa;if(null!=this.ya)if(null!=this.Fb){var e=this.ya.data.length-1;if(this.pa+this.Fb-1<=e){var e=a.Qb.UI(this.ya,this.pa,this.Fb),b=[],d=[],f;for(f=this.pa;f<=e;f++)b[f-this.pa]=this.Wo(f,this.ya.data[f]),d[f-this.pa]=this.ya.keys[f];e={data:b,keys:d,startIndex:this.pa};this.Um(c,e,null);return Promise.resolve(e)}this.pa<=e&&(d=e+1)}else this.i.refresh(),this.ya=null;else d=
  0;var g={start:d,count:b},k=this;return new Promise(function(b,d){k.i.fp(g,{success:function(d){k.NT(d);c.refresh=!0;d=a.Qb.UI(k.ya,k.pa,k.Fb);var e=[],f=[],g;for(g=k.pa;g<=d;g++)e[g-k.pa]=k.Wo(g,k.ya.data[g]),f[g-k.pa]=k.ya.keys[g];k.bn=0<e.length?!0:!1;d={data:e,keys:f,startIndex:k.pa};k.Um(c,d,null);b(d)}.bind(this),error:function(a){k.Um(c,null,a);d(a)}.bind(this)})})};a.Qb.prototype.NT=function(c){var b=c.getStart(),d,e;for(d=0;d<c.getCount();d++)e=b+d,this.ai[e]={},this.ai[e].nodeSet=c,this.ai[e].startIndex=
  b;this.ya||(this.ya={},this.ya.data=[],this.ya.keys=[],this.ya.indexes=[]);a.Qb.Ey(c,this,this.ya,b)};a.Qb.prototype.pE=function(c){c.silent||a.aa.u.handleEvent.call(this,a.aa.Q.REQUEST,{startIndex:c.startIndex})};a.Qb.prototype.Um=function(c,b,d){null!=d?a.aa.u.handleEvent.call(this,a.aa.Q.ERROR,d):c.silent||a.aa.u.handleEvent.call(this,a.aa.Q.SYNC,b)};a.Qb.UI=function(a,b,d){var e=a.data.length-1;0<d&&(e=b+d-1,e=e>a.data.length-1?a.data.length-1:e);return e};a.Qb.Ey=function(a,b,d,e){for(b=0;b<
  a.getCount();b++){var f=a.getData(a.getStart()+b);d.data[e+b]=f;d.keys[e+b]=a.getMetadata(a.getStart()+b).key;d.indexes[e+b]=e+b}};a.Qb.prototype.VD=function(){for(var a=0;a<this.ya.data.length;a++)this.ya.indexes[a]=a};a.Qb.prototype.Wo=function(a,b){var d=g.extend(!0,{},b),e=this,f;for(f in d)d.hasOwnProperty(f)&&function(){var b=f;Object.defineProperty(d,f,{get:function(){return e.ya.data[a][b]},set:function(d){e.ya.data[a][b]=d}})}();return d}});