(function(n){"object"==typeof exports&&"object"==typeof module?n(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)})(function(n){var r=n.Pos;n.registerHelper("hint","xml",function(p,t){var b=t&&t.schemaInfo,h=t&&t.quoteChar||'"';if(b){var f=p.getCursor(),a=p.getTokenAt(f);a.end>f.ch&&(a.end=f.ch,a.string=a.string.slice(0,f.ch-a.start));var k=n.innerMode(p.getMode(),a.state);if("xml"==k.mode.name){var q=[],l=!1,e,u=/\btag\b/.test(a.type)&&
!/>$/.test(a.string),x=u&&/^\w/.test(a.string),v;if(x){var c=p.getLine(f.line).slice(Math.max(0,a.start-2),a.start);(c=/<\/$/.test(c)?"close":/<$/.test(c)?"open":null)&&(v=a.start-("close"==c?2:1))}else u&&"\x3c"==a.string?c="open":u&&"\x3c/"==a.string&&(c="close");if(!u&&!k.state.tagName||c){x&&(e=a.string);var l=c,k=(h=k.state.context)&&b[h.tagName],g=h?k&&k.children:b["!top"];if(g&&"close"!=c)for(b=0;b<g.length;++b)e&&0!=g[b].lastIndexOf(e,0)||q.push("\x3c"+g[b]);else if("close"!=c)for(var d in b)!b.hasOwnProperty(d)||
"!top"==d||"!attrs"==d||e&&0!=d.lastIndexOf(e,0)||q.push("\x3c"+d);h&&(!e||"close"==c&&0==h.tagName.lastIndexOf(e,0))&&q.push("\x3c/"+h.tagName+"\x3e")}else{d=(k=b[k.state.tagName])&&k.attrs;b=b["!attrs"];if(!d&&!b)return;if(!d)d=b;else if(b){var c={},m;for(m in b)b.hasOwnProperty(m)&&(c[m]=b[m]);for(m in d)d.hasOwnProperty(m)&&(c[m]=d[m]);d=c}if("string"==a.type||"\x3d"==a.string){c=p.getRange(r(f.line,Math.max(0,f.ch-60)),r(f.line,"string"==a.type?a.start:a.end));b=c.match(/([^\s\u00a0=<>\"\']+)=$/);
if(!b||!d.hasOwnProperty(b[1])||!(g=d[b[1]]))return;"function"==typeof g&&(g=g.call(this,p));"string"==a.type&&(e=a.string,l=0,/['"]/.test(a.string.charAt(0))&&(h=a.string.charAt(0),e=a.string.slice(1),l++),b=a.string.length,/['"]/.test(a.string.charAt(b-1))&&(h=a.string.charAt(b-1),e=a.string.substr(l,b-2)),l=!0);for(b=0;b<g.length;++b)e&&0!=g[b].lastIndexOf(e,0)||q.push(h+g[b]+h)}else{"attribute"==a.type&&(e=a.string,l=!0);for(var w in d)!d.hasOwnProperty(w)||e&&0!=w.lastIndexOf(e,0)||q.push(w)}}return{list:q,
from:l?r(f.line,null==v?a.start:v):f,to:l?r(f.line,a.end):f}}}})});