// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(t,n,a){var e,r,l=[],g=RegExp("\\][\n\\s]*"+n.source+"[\n\\s]*\\[","i"),s=t.getSpan().next(g),u=s.previous("td").start_,i=s.previous("th").start_;r=u<i?"th":"td",s=s.next(n).nextAnyTag(r).previousAnyTag(r);for(var p=s.innerCapture(/\[t[dh](\d+)\]/,1),h=s.parentAnyTag("tr").allInnerTags(r+p),o=0,T=0;T<h.length;T++)if(h[T].sameAs(s)){o=T;break}for(var d=s.parentAnyTag("table");d!==t.getNullSpan();){for(var f=d.allInnerTags("tr"+p),T=0;T<f.length;T++)e=f[T].allInnerTags("td"+p)[o],e&&e.tagContents()!==t.getNullSpan()&&(e=(""+e.tagContents()).trim(),e=e.match(a),e&&e.length>=1&&l.push(e[0]));d=d.nextAnyTag("table")}if(0===l.length)for(var v=0,A=3,x=s.nextAnyTag("tr");!x.isNullSpan_&&v<=A;)p=x.innerCapture(/\[t[dh](\d+)\]/,1),e=x.allInnerTagsFiltered("td"+p)[o],e&&!e.isNullSpan_&&(e=(""+e).trim().match(a),e&&e.length>=1&&l.push(e[0])),0===l.length&&v++,x=x.nextAnyTag("tr");return l}}).call();