//>>built
define("dojox/data/HtmlStore","dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/dom dojo/_base/xhr dojo/_base/kernel dojo/data/util/simpleFetch dojo/data/util/filter dojox/xml/parser".split(" "),function(q,v,r,u,w,t,z,x,p){q=q("dojox.data.HtmlStore",null,{constructor:function(a){a&&"urlPreventCache"in a&&(this.urlPreventCache=a.urlPreventCache?!0:!1);a&&"trimWhitespace"in a&&(this.trimWhitespace=a.trimWhitespace?!0:!1);if(a.url){if(!a.dataId)throw Error("dojo.data.HtmlStore: Cannot instantiate using url without an id!");
this.url=a.url;this.dataId=a.dataId}else a.dataId&&(this.dataId=a.dataId);a&&"fetchOnCreate"in a&&(this.fetchOnCreate=a.fetchOnCreate?!0:!1);this.fetchOnCreate&&this.dataId&&this.fetch()},url:"",dataId:"",trimWhitespace:!1,urlPreventCache:!1,fetchOnCreate:!1,_indexItems:function(){this._getHeadings();if(this._rootNode.rows){this._rootNode.tBodies&&0<this._rootNode.tBodies.length&&(this._rootNode=this._rootNode.tBodies[0]);var a;for(a=0;a<this._rootNode.rows.length;a++)this._rootNode.rows[a]._ident=
a+1}else{var c=1;for(a=0;a<this._rootNode.childNodes.length;a++)1===this._rootNode.childNodes[a].nodeType&&(this._rootNode.childNodes[a]._ident=c,c++)}},_getHeadings:function(){this._headings=[];this._rootNode.tHead?v.forEach(this._rootNode.tHead.rows[0].cells,r.hitch(this,function(a){a=p.textContent(a);this._headings.push(this.trimWhitespace?r.trim(a):a)})):this._headings=["name"]},_getAllItems:function(){var a=[],c;if(this._rootNode.rows)for(c=0;c<this._rootNode.rows.length;c++)a.push(this._rootNode.rows[c]);
else for(c=0;c<this._rootNode.childNodes.length;c++)1===this._rootNode.childNodes[c].nodeType&&a.push(this._rootNode.childNodes[c]);return a},_assertIsItem:function(a){if(!this.isItem(a))throw Error("dojo.data.HtmlStore: a function was passed an item argument that was not an item");},_assertIsAttribute:function(a){if("string"!==typeof a)throw Error("dojo.data.HtmlStore: a function was passed an attribute argument that was not an attribute name string");return v.indexOf(this._headings,a)},getValue:function(a,
c,b){a=this.getValues(a,c);return 0<a.length?a[0]:b},getValues:function(a,c){this._assertIsItem(a);var b=this._assertIsAttribute(c);return-1<b?(b=a.cells?p.textContent(a.cells[b]):p.textContent(a),[this.trimWhitespace?r.trim(b):b]):[]},getAttributes:function(a){this._assertIsItem(a);for(var c=[],b=0;b<this._headings.length;b++)this.hasAttribute(a,this._headings[b])&&c.push(this._headings[b]);return c},hasAttribute:function(a,c){return 0<this.getValues(a,c).length},containsValue:function(a,c,b){var d=
void 0;"string"===typeof b&&(d=x.patternToRegExp(b,!1));return this._containsValue(a,c,b,d)},_containsValue:function(a,c,b,d){a=this.getValues(a,c);for(c=0;c<a.length;++c){var e=a[c];if("string"===typeof e&&d)return null!==e.match(d);if(b===e)return!0}return!1},isItem:function(a){return a&&u.isDescendant(a,this._rootNode)},isItemLoaded:function(a){return this.isItem(a)},loadItem:function(a){this._assertIsItem(a.item)},_fetchItems:function(a,c,b){if(this._rootNode)this._finishFetchItems(a,c,b);else if(this.url){var d=
this,e=w.get({url:this.url,handleAs:"text",preventCache:this.urlPreventCache});e.addCallback(function(g){var f=function(h,k){if(h.id==k)return h;if(h.childNodes)for(var m=0;m<h.childNodes.length;m++){var n=f(h.childNodes[m],k);if(n)return n}return null},l=document.createElement("div");l.innerHTML=g;d._rootNode=f(l,d.dataId);d._indexItems();d._finishFetchItems(a,c,b)});e.addErrback(function(g){b(g,a)})}else this._rootNode=u.byId(this.dataId),this._indexItems(),this._finishFetchItems(a,c,b)},_finishFetchItems:function(a,
c,b){b=[];var d=this._getAllItems();if(a.query){var e=a.queryOptions?a.queryOptions.ignoreCase:!1;b=[];var g={},f;for(f in a.query){var l=a.query[f]+"";"string"===typeof l&&(g[f]=x.patternToRegExp(l,e))}for(e=0;e<d.length;++e){var h=!0,k=d[e];for(f in a.query)l=a.query[f]+"",this._containsValue(k,f,l,g[f])||(h=!1);h&&b.push(k)}}else 0<d.length&&(b=d.slice(0,d.length));c(b,a)},getFeatures:function(){return{"dojo.data.api.Read":!0,"dojo.data.api.Identity":!0}},close:function(a){},getLabel:function(a){if(this.isItem(a))return a.cells?
"Item #"+this.getIdentity(a):this.getValue(a,"name")},getLabelAttributes:function(a){return a.cells?null:["name"]},getIdentity:function(a){this._assertIsItem(a);return this.hasAttribute(a,"name")?this.getValue(a,"name"):a._ident},getIdentityAttributes:function(a){return null},fetchItemByIdentity:function(a){var c=a.identity,b=this,d=null,e=null;if(this._rootNode)this._rootNode.rows[c+1]&&(d=this._rootNode.rows[c+1],a.onItem&&(e=a.scope?a.scope:t.global,a.onItem.call(e,d)));else if(this.url){var g=
w.get({url:this.url,handleAs:"text"});g.addCallback(function(f){var l=function(k,m){if(k.id==m)return k;if(k.childNodes)for(var n=0;n<k.childNodes.length;n++){var y=l(k.childNodes[n],m);if(y)return y}return null},h=document.createElement("div");h.innerHTML=f;b._rootNode=l(h,b.dataId);b._indexItems();if(b._rootNode.rows&&c<=b._rootNode.rows.length)d=b._rootNode.rows[c-1];else for(f=0;f<b._rootNode.childNodes.length;f++)if(1===b._rootNode.childNodes[f].nodeType&&c===p.textContent(b._rootNode.childNodes[f])){d=
b._rootNode.childNodes[f];break}a.onItem&&(e=a.scope?a.scope:t.global,a.onItem.call(e,d))});g.addErrback(function(f){a.onError&&(e=a.scope?a.scope:t.global,a.onError.call(e,f))})}else{this._rootNode=u.byId(this.dataId);this._indexItems();if(b._rootNode.rows)d=this._rootNode.rows[c+1];else for(g=0;g<b._rootNode.childNodes.length;g++)1===b._rootNode.childNodes[g].nodeType&&c===p.textContent(b._rootNode.childNodes[g])&&(d=b._rootNode.childNodes[g]);a.onItem&&(e=a.scope?a.scope:t.global,a.onItem.call(e,
d))}}});r.extend(q,z);return q});