//>>built
define("dojox/dtl/tag/loader",["dojo/_base/lang","../_base","dojo/_base/array","dojo/_base/connect"],function(k,g,q,p){var h=k.getObject("tag.loader",!0,g);h.BlockNode=k.extend(function(c,a){this.name=c;this.nodelist=a},{"super":function(){if(this.parent){var c=this.parent.nodelist.dummyRender(this.context,null,!0);"string"==typeof c&&(c=new String(c));c.safe=!0;return c}return""},render:function(c,a){var b=this.name,d=this.nodelist;a.blocks&&(b=a.blocks[b])&&(d=b.nodelist,b.used=!0);this.rendered=
d;this.context=c=c.push();this.parent=null;d!=this.nodelist&&(this.parent=this);c.block=this;if(a.getParent)var e=a.getParent(),f=p.connect(a,"onSetParent",function(l,m,n){m&&n&&a.setParent(e)});a=d.render(c,a,this);f&&p.disconnect(f);c=c.pop();return a},unrender:function(c,a){return this.rendered.unrender(c,a)},clone:function(c){return new this.constructor(this.name,this.nodelist.clone(c))},toString:function(){return"dojox.dtl.tag.loader.BlockNode"}});h.ExtendsNode=k.extend(function(c,a,b,d,e){this.getTemplate=
c;this.nodelist=a;this.shared=b;this.parent=d;this.key=e},{parents:{},getParent:function(c){var a=this.parent;if(!a){a=this.parent=c.get(this.key,!1);if(!a)throw Error("extends tag used a variable that did not resolve");if("object"==typeof a)if(c=a.url||a.templatePath,a.shared&&(this.shared=!0),c)a=this.parent=c.toString();else if(a.templateString){var b=a.templateString;a=this.parent=" "}else a=this.parent=this.parent.toString();a&&0===a.indexOf("shared:")&&(this.shared=!0,a=this.parent=a.substring(7,
a.length))}if(!a)throw Error("Invalid template name in 'extends' tag.");if(a.render)return a;if(this.parents[a])return this.parents[a];this.parent=this.getTemplate(b||dojox.dtl.text.getTemplateString(a));this.shared&&(this.parents[a]=this.parent);return this.parent},render:function(c,a){var b=this.getParent(c);b.blocks=b.blocks||{};a.blocks=a.blocks||{};for(var d=0,e;e=this.nodelist.contents[d];d++)if(e instanceof dojox.dtl.tag.loader.BlockNode){var f=b.blocks[e.name];f&&f.nodelist!=e.nodelist&&(a=
f.nodelist.unrender(c,a));b.blocks[e.name]=a.blocks[e.name]={shared:this.shared,nodelist:e.nodelist,used:!1}}this.rendered=b;return b.nodelist.render(c,a,this)},unrender:function(c,a){return this.rendered.unrender(c,a,this)},toString:function(){return"dojox.dtl.block.ExtendsNode"}});h.IncludeNode=k.extend(function(c,a,b,d,e){this._path=c;this.path=(this.constant=a)?c:new g._Filter(c);this.getTemplate=b;this.text=d;this.parsed=5==arguments.length?e:!0},{_cache:[{},{}],render:function(c,a){var b=(this.constant?
this.path:this.path.resolve(c)).toString(),d=Number(this.parsed),e=!1;b!=this.last&&(e=!0,this.last&&(a=this.unrender(c,a)),this.last=b);var f=this._cache[d];if(d)return f[b]||(f[b]=g.text._resolveTemplateArg(b,!0)),e&&(this.rendered=this.getTemplate(f[b]).nodelist),this.rendered.render(c,a,this);if(this.text instanceof g._TextNode)return e&&(this.rendered=this.text,this.rendered.set(g.text._resolveTemplateArg(b,!0))),this.rendered.render(c,a);if(!f[b]){d=[];var l=document.createElement("div");l.innerHTML=
g.text._resolveTemplateArg(b,!0);for(var m=l.childNodes;m.length;){var n=l.removeChild(m[0]);d.push(n)}f[b]=d}if(e)for(this.nodelist=[],e=0;d=f[b][e];e++)this.nodelist.push(d.cloneNode(!0));for(e=0;b=this.nodelist[e];e++)a=a.concat(b);return a},unrender:function(c,a){this.rendered&&(a=this.rendered.unrender(c,a));if(this.nodelist)for(var b=0,d;d=this.nodelist[b];b++)a=a.remove(d);return a},clone:function(c){return new this.constructor(this._path,this.constant,this.getTemplate,this.text.clone(c),this.parsed)}});
k.mixin(h,{block:function(c,a){var b=a.contents.split()[1];c._blocks=c._blocks||{};c._blocks[b]=c._blocks[b]||[];c._blocks[b].push(b);var d=c.parse(["endblock","endblock "+b]).rtrim();c.next_token();return new dojox.dtl.tag.loader.BlockNode(b,d)},extends_:function(c,a){var b=a.contents.split(),d=!1,e=null,f=null;'"'==b[1].charAt(0)||"'"==b[1].charAt(0)?e=b[1].substring(1,b[1].length-1):f=b[1];e&&0==e.indexOf("shared:")&&(d=!0,e=e.substring(7,e.length));b=c.parse();return new dojox.dtl.tag.loader.ExtendsNode(c.getTemplate,
b,d,e,f)},include:function(c,a){var b=a.contents.split();if(2!=b.length)throw Error(b[0]+" tag takes one argument: the name of the template to be included");b=b[1];var d=!1;'"'!=b.charAt(0)&&"'"!=b.slice(-1)||b.charAt(0)!=b.slice(-1)||(b=b.slice(1,-1),d=!0);return new h.IncludeNode(b,d,c.getTemplate,c.create_text_node())},ssi:function(c,a){var b=a.contents.split(),d=!1;if(3==b.length&&(d="parsed"==b.pop(),!d))throw Error("Second (optional) argument to ssi tag must be 'parsed'");b=h.include(c,new g.Token(a.token_type,
b.join(" ")));b.parsed=d;return b}});return h});