diff options
Diffstat (limited to 'web/server/h2o/libh2o/misc/oktavia/templates')
38 files changed, 26707 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/README.md b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/README.md new file mode 100644 index 00000000..a7bd96bf --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/README.md @@ -0,0 +1 @@ +The default template for JSDoc 3 uses: [the Taffy Database library](http://taffydb.com/) and the [Underscore Template library](http://documentcloud.github.com/underscore/#template). diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/publish.js b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/publish.js new file mode 100644 index 00000000..36211462 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/publish.js @@ -0,0 +1,508 @@ +/*global env: true */ +var template = require('jsdoc/template'), + fs = require('jsdoc/fs'), + path = require('jsdoc/path'), + taffy = require('taffydb').taffy, + handle = require('jsdoc/util/error').handle, + helper = require('jsdoc/util/templateHelper'), + htmlsafe = helper.htmlsafe, + linkto = helper.linkto, + resolveAuthorLinks = helper.resolveAuthorLinks, + scopeToPunc = helper.scopeToPunc, + hasOwnProp = Object.prototype.hasOwnProperty, + data, + view, + outdir = env.opts.destination; + + +function find(spec) { + return helper.find(data, spec); +} + +function tutoriallink(tutorial) { + return helper.toTutorial(tutorial, null, { tag: 'em', classname: 'disabled', prefix: 'Tutorial: ' }); +} + +function getAncestorLinks(doclet) { + return helper.getAncestorLinks(data, doclet); +} + +function hashToLink(doclet, hash) { + if ( !/^(#.+)/.test(hash) ) { return hash; } + + var url = helper.createLink(doclet); + + url = url.replace(/(#.+|$)/, hash); + return '<a href="' + url + '">' + hash + '</a>'; +} + +function needsSignature(doclet) { + var needsSig = false; + + // function and class definitions always get a signature + if (doclet.kind === 'function' || doclet.kind === 'class') { + needsSig = true; + } + // typedefs that contain functions get a signature, too + else if (doclet.kind === 'typedef' && doclet.type && doclet.type.names && + doclet.type.names.length) { + for (var i = 0, l = doclet.type.names.length; i < l; i++) { + if (doclet.type.names[i].toLowerCase() === 'function') { + needsSig = true; + break; + } + } + } + + return needsSig; +} + +function addSignatureParams(f) { + var params = helper.getSignatureParams(f, 'optional'); + + f.signature = (f.signature || '') + '('+params.join(', ')+')'; +} + +function addSignatureReturns(f) { + var returnTypes = helper.getSignatureReturns(f); + + f.signature = '<span class="signature">'+(f.signature || '') + '</span>' + '<span class="type-signature">'+(returnTypes.length? ' → {'+returnTypes.join('|')+'}' : '')+'</span>'; +} + +function addSignatureTypes(f) { + var types = helper.getSignatureTypes(f); + + f.signature = (f.signature || '') + '<span class="type-signature">'+(types.length? ' :'+types.join('|') : '')+'</span>'; +} + +function addAttribs(f) { + var attribs = helper.getAttribs(f); + + f.attribs = '<span class="type-signature">'+htmlsafe(attribs.length? '<'+attribs.join(', ')+'> ' : '')+'</span>'; +} + +function shortenPaths(files, commonPrefix) { + // always use forward slashes + var regexp = new RegExp('\\\\', 'g'); + + Object.keys(files).forEach(function(file) { + files[file].shortened = files[file].resolved.replace(commonPrefix, '') + .replace(regexp, '/'); + }); + + return files; +} + +function resolveSourcePath(filepath) { + return path.resolve(process.cwd(), filepath); +} + +function getPathFromDoclet(doclet) { + if (!doclet.meta) { + return; + } + + var filepath = doclet.meta.path && doclet.meta.path !== 'null' ? + doclet.meta.path + '/' + doclet.meta.filename : + doclet.meta.filename; + + return filepath; +} + +function generate(title, docs, filename, resolveLinks) { + resolveLinks = resolveLinks === false ? false : true; + + var docData = { + title: title, + docs: docs + }; + + var outpath = path.join(outdir, filename), + html = view.render('container.tmpl', docData); + + if (resolveLinks) { + html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a> + } + + fs.writeFileSync(outpath, html, 'utf8'); +} + +function generateSourceFiles(sourceFiles) { + Object.keys(sourceFiles).forEach(function(file) { + var source; + // links are keyed to the shortened path in each doclet's `meta.filename` property + var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened); + helper.registerLink(sourceFiles[file].shortened, sourceOutfile); + + try { + source = { + kind: 'source', + code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, 'utf8') ) + }; + } + catch(e) { + handle(e); + } + + generate('Source: ' + sourceFiles[file].shortened, [source], sourceOutfile, + false); + }); +} + +/** + * Create the navigation sidebar. + * @param {object} members The members that will be used to create the sidebar. + * @param {array<object>} members.classes + * @param {array<object>} members.externals + * @param {array<object>} members.globals + * @param {array<object>} members.mixins + * @param {array<object>} members.modules + * @param {array<object>} members.namespaces + * @param {array<object>} members.tutorials + * @param {array<object>} members.events + * @return {string} The HTML for the navigation sidebar. + */ +function buildNav(members) { + var nav = '<h2><a href="index.html">Index</a></h2>', + seen = {}; + + if (members.modules.length) { + nav += '<h3>Modules</h3><ul>'; + members.modules.forEach(function(m) { + if ( !hasOwnProp.call(seen, m.longname) ) { + nav += '<li>'+linkto(m.longname, m.name)+'</li>'; + } + seen[m.longname] = true; + }); + + nav += '</ul>'; + } + + if (members.externals.length) { + nav += '<h3>Externals</h3><ul>'; + members.externals.forEach(function(e) { + if ( !hasOwnProp.call(seen, e.longname) ) { + nav += '<li>'+linkto( e.longname, e.name.replace(/(^"|"$)/g, '') )+'</li>'; + } + seen[e.longname] = true; + }); + + nav += '</ul>'; + } + + if (members.classes.length) { + var moduleClasses = 0; + members.classes.forEach(function(c) { + var moduleSameName = find({kind: 'module', longname: c.longname}); + if (moduleSameName.length) { + c.name = c.name.replace('module:', 'require("')+'")'; + moduleClasses++; + moduleSameName[0].module = c; + } + if (moduleClasses !== -1 && moduleClasses < members.classes.length) { + nav += '<h3>Classes</h3><ul>'; + moduleClasses = -1; + } + if ( !hasOwnProp.call(seen, c.longname) ) { + nav += '<li>'+linkto(c.longname, c.name)+'</li>'; + } + seen[c.longname] = true; + }); + + nav += '</ul>'; + } + + if (members.events.length) { + nav += '<h3>Events</h3><ul>'; + members.events.forEach(function(e) { + if ( !hasOwnProp.call(seen, e.longname) ) { + nav += '<li>'+linkto(e.longname, e.name)+'</li>'; + } + seen[e.longname] = true; + }); + + nav += '</ul>'; + } + + if (members.namespaces.length) { + nav += '<h3>Namespaces</h3><ul>'; + members.namespaces.forEach(function(n) { + if ( !hasOwnProp.call(seen, n.longname) ) { + nav += '<li>'+linkto(n.longname, n.name)+'</li>'; + } + seen[n.longname] = true; + }); + + nav += '</ul>'; + } + + if (members.mixins.length) { + nav += '<h3>Mixins</h3><ul>'; + members.mixins.forEach(function(m) { + if ( !hasOwnProp.call(seen, m.longname) ) { + nav += '<li>'+linkto(m.longname, m.name)+'</li>'; + } + seen[m.longname] = true; + }); + + nav += '</ul>'; + } + + if (members.tutorials.length) { + nav += '<h3>Tutorials</h3><ul>'; + members.tutorials.forEach(function(t) { + nav += '<li>'+tutoriallink(t.name)+'</li>'; + }); + + nav += '</ul>'; + } + + if (members.globals.length) { + nav += '<h3>Global</h3><ul>'; + members.globals.forEach(function(g) { + if ( g.kind !== 'typedef' && !hasOwnProp.call(seen, g.longname) ) { + nav += '<li>'+linkto(g.longname, g.name)+'</li>'; + } + seen[g.longname] = true; + }); + + nav += '</ul>'; + } + + return nav; +} + + +/** + @param {TAFFY} taffyData See <http://taffydb.com/>. + @param {object} opts + @param {Tutorial} tutorials + */ +exports.publish = function(taffyData, opts, tutorials) { + data = taffyData; + + var conf = env.conf.templates || {}; + conf['default'] = conf['default'] || {}; + + var templatePath = opts.template; + view = new template.Template(templatePath + '/tmpl'); + + // claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness + // doesn't try to hand them out later + var indexUrl = helper.getUniqueFilename('index'); + // don't call registerLink() on this one! 'index' is also a valid longname + + var globalUrl = helper.getUniqueFilename('global'); + helper.registerLink('global', globalUrl); + + // set up templating + view.layout = 'layout.tmpl'; + + // set up tutorials for helper + helper.setTutorials(tutorials); + + data = helper.prune(data); + data.sort('longname, version, since'); + + var sourceFiles = {}; + var sourceFilePaths = []; + data().each(function(doclet) { + doclet.attribs = ''; + + if (doclet.examples) { + doclet.examples = doclet.examples.map(function(example) { + var caption, code; + + if (example.match(/^\s*<caption>([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) { + caption = RegExp.$1; + code = RegExp.$3; + } + + return { + caption: caption || '', + code: code || example + }; + }); + } + if (doclet.see) { + doclet.see.forEach(function(seeItem, i) { + doclet.see[i] = hashToLink(doclet, seeItem); + }); + } + + // build a list of source files + var sourcePath; + var resolvedSourcePath; + if (doclet.meta) { + sourcePath = getPathFromDoclet(doclet); + resolvedSourcePath = resolveSourcePath(sourcePath); + sourceFiles[sourcePath] = { + resolved: resolvedSourcePath, + shortened: null + }; + sourceFilePaths.push(resolvedSourcePath); + } + }); + + // update outdir if necessary, then create outdir + var packageInfo = ( find({kind: 'package'}) || [] ) [0]; + if (packageInfo && packageInfo.name) { + outdir = path.join(outdir, packageInfo.name, packageInfo.version); + } + fs.mkPath(outdir); + + // copy static files to outdir + var fromDir = path.join(templatePath, 'static'), + staticFiles = fs.ls(fromDir, 3); + + staticFiles.forEach(function(fileName) { + var toDir = fs.toDir( fileName.replace(fromDir, outdir) ); + fs.mkPath(toDir); + fs.copyFileSync(fileName, toDir); + }); + + if (sourceFilePaths.length) { + sourceFiles = shortenPaths( sourceFiles, path.commonPrefix(sourceFilePaths) ); + } + data().each(function(doclet) { + var url = helper.createLink(doclet); + helper.registerLink(doclet.longname, url); + + // replace the filename with a shortened version of the full path + var docletPath; + if (doclet.meta) { + docletPath = getPathFromDoclet(doclet); + docletPath = sourceFiles[docletPath].shortened; + if (docletPath) { + doclet.meta.filename = docletPath; + } + } + }); + + data().each(function(doclet) { + var url = helper.longnameToUrl[doclet.longname]; + + if (url.indexOf('#') > -1) { + doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop(); + } + else { + doclet.id = doclet.name; + } + + if ( needsSignature(doclet) ) { + addSignatureParams(doclet); + addSignatureReturns(doclet); + addAttribs(doclet); + } + }); + + // do this after the urls have all been generated + data().each(function(doclet) { + doclet.ancestors = getAncestorLinks(doclet); + + if (doclet.kind === 'member') { + addSignatureTypes(doclet); + addAttribs(doclet); + } + + if (doclet.kind === 'constant') { + addSignatureTypes(doclet); + addAttribs(doclet); + doclet.kind = 'member'; + } + }); + + var members = helper.getMembers(data); + members.tutorials = tutorials.children; + + // add template helpers + view.find = find; + view.linkto = linkto; + view.resolveAuthorLinks = resolveAuthorLinks; + view.tutoriallink = tutoriallink; + view.htmlsafe = htmlsafe; + + // once for all + view.nav = buildNav(members); + + // only output pretty-printed source files if requested; do this before generating any other + // pages, so the other pages can link to the source files + if (conf['default'].outputSourceFiles) { + generateSourceFiles(sourceFiles); + } + + if (members.globals.length) { generate('Global', [{kind: 'globalobj'}], globalUrl); } + + // index page displays information from package.json and lists files + var files = find({kind: 'file'}), + packages = find({kind: 'package'}); + + generate('Index', + packages.concat( + [{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}] + ).concat(files), + indexUrl); + + // set up the lists that we'll use to generate pages + var classes = taffy(members.classes); + var modules = taffy(members.modules); + var namespaces = taffy(members.namespaces); + var mixins = taffy(members.mixins); + var externals = taffy(members.externals); + + for (var longname in helper.longnameToUrl) { + if ( hasOwnProp.call(helper.longnameToUrl, longname) ) { + var myClasses = helper.find(classes, {longname: longname}); + if (myClasses.length) { + generate('Class: ' + myClasses[0].name, myClasses, helper.longnameToUrl[longname]); + } + + var myModules = helper.find(modules, {longname: longname}); + if (myModules.length) { + generate('Module: ' + myModules[0].name, myModules, helper.longnameToUrl[longname]); + } + + var myNamespaces = helper.find(namespaces, {longname: longname}); + if (myNamespaces.length) { + generate('Namespace: ' + myNamespaces[0].name, myNamespaces, helper.longnameToUrl[longname]); + } + + var myMixins = helper.find(mixins, {longname: longname}); + if (myMixins.length) { + generate('Mixin: ' + myMixins[0].name, myMixins, helper.longnameToUrl[longname]); + } + + var myExternals = helper.find(externals, {longname: longname}); + if (myExternals.length) { + generate('External: ' + myExternals[0].name, myExternals, helper.longnameToUrl[longname]); + } + } + } + + // TODO: move the tutorial functions to templateHelper.js + function generateTutorial(title, tutorial, filename) { + var tutorialData = { + title: title, + header: tutorial.title, + content: tutorial.parse(), + children: tutorial.children + }; + + var tutorialPath = path.join(outdir, filename), + html = view.render('tutorial.tmpl', tutorialData); + + // yes, you can use {@link} in tutorials too! + html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a> + + fs.writeFileSync(tutorialPath, html, 'utf8'); + } + + // tutorials can have only one parent so there is no risk for loops + function saveChildren(node) { + node.children.forEach(function(child) { + generateTutorial('Tutorial: ' + child.title, child, helper.tutorialToUrl(child.name)); + saveChildren(child); + }); + } + saveChildren(tutorials); +}; diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/jquery-1.9.1.min.js b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/jquery-1.9.1.min.js new file mode 100644 index 00000000..006e9531 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/jquery-1.9.1.min.js @@ -0,0 +1,5 @@ +/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license +//@ sourceMappingURL=jquery.min.map +*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj; +return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l) +}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-english-search.js b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-english-search.js new file mode 100644 index 00000000..cf5c38f3 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-english-search.js @@ -0,0 +1,8922 @@ +// generatedy by JSX compiler 0.9.24 (2013-04-05 13:45:00 +0900; 1b229cc6a411f674f0f7cf7a79b7a8b3f8eb7414) +var JSX = {}; +(function (JSX) { +/** + * copies the implementations from source interface to target + */ +function $__jsx_merge_interface(target, source) { + for (var k in source.prototype) + if (source.prototype.hasOwnProperty(k)) + target.prototype[k] = source.prototype[k]; +} + +/** + * defers the initialization of the property + */ +function $__jsx_lazy_init(obj, prop, func) { + function reset(obj, prop, value) { + delete obj[prop]; + obj[prop] = value; + return value; + } + + Object.defineProperty(obj, prop, { + get: function () { + return reset(obj, prop, func()); + }, + set: function (v) { + reset(obj, prop, v); + }, + enumerable: true, + configurable: true + }); +} + +/** + * sideeffect().a /= b + */ +function $__jsx_div_assign(obj, prop, divisor) { + return obj[prop] = (obj[prop] / divisor) | 0; +} + +/* + * global functions, renamed to avoid conflict with local variable names + */ +var $__jsx_parseInt = parseInt; +var $__jsx_parseFloat = parseFloat; +var $__jsx_isNaN = isNaN; +var $__jsx_isFinite = isFinite; + +var $__jsx_encodeURIComponent = encodeURIComponent; +var $__jsx_decodeURIComponent = decodeURIComponent; +var $__jsx_encodeURI = encodeURI; +var $__jsx_decodeURI = decodeURI; + +var $__jsx_ObjectToString = Object.prototype.toString; +var $__jsx_ObjectHasOwnProperty = Object.prototype.hasOwnProperty; + +/* + * profiler object, initialized afterwards + */ +function $__jsx_profiler() { +} + +/* + * public interface to JSX code + */ +JSX.require = function (path) { + var m = $__jsx_classMap[path]; + return m !== undefined ? m : null; +}; + +JSX.profilerIsRunning = function () { + return $__jsx_profiler.getResults != null; +}; + +JSX.getProfileResults = function () { + return ($__jsx_profiler.getResults || function () { return {}; })(); +}; + +JSX.postProfileResults = function (url, cb) { + if ($__jsx_profiler.postResults == null) + throw new Error("profiler has not been turned on"); + return $__jsx_profiler.postResults(url, cb); +}; + +JSX.resetProfileResults = function () { + if ($__jsx_profiler.resetResults == null) + throw new Error("profiler has not been turned on"); + return $__jsx_profiler.resetResults(); +}; +JSX.DEBUG = false; +/** + * class _Main extends Object + * @constructor + */ +function _Main() { +} + +/** + * @constructor + */ +function _Main$() { +}; + +_Main$.prototype = new _Main; + +/** + * @param {Array.<undefined|!string>} args + */ +_Main.main$AS = function (args) { + OktaviaSearch$setStemmer$LStemmer$(new EnglishStemmer$()); +}; + +var _Main$main$AS = _Main.main$AS; + +/** + * class _Result extends Object + * @constructor + */ +function _Result() { +} + +/** + * @constructor + * @param {!string} title + * @param {!string} url + * @param {!string} content + * @param {!number} score + */ +function _Result$SSSI(title, url, content, score) { + this.title = title; + this.url = url; + this.content = content; + this.score = score; +}; + +_Result$SSSI.prototype = new _Result; + +/** + * class _Proposal extends Object + * @constructor + */ +function _Proposal() { +} + +/** + * @constructor + * @param {!string} options + * @param {!string} label + * @param {!number} count + */ +function _Proposal$SSI(options, label, count) { + this.options = options; + this.label = label; + this.count = count; +}; + +_Proposal$SSI.prototype = new _Proposal; + +/** + * class OktaviaSearch extends Object + * @constructor + */ +function OktaviaSearch() { +} + +/** + * @constructor + * @param {!number} entriesPerPage + */ +function OktaviaSearch$I(entriesPerPage) { + this._queries = null; + this._highlight = ""; + this._result = null; + this._proposals = null; + this._currentFolderDepth = 0; + this._oktavia = new Oktavia$(); + this._entriesPerPage = entriesPerPage; + this._currentPage = 1; + this._queryString = null; + this._callback = null; + OktaviaSearch._instance = this; +}; + +OktaviaSearch$I.prototype = new OktaviaSearch; + +/** + * @param {Stemmer} stemmer + */ +OktaviaSearch.setStemmer$LStemmer$ = function (stemmer) { + /** @type {Oktavia} */ + var this$0; + if (OktaviaSearch._instance) { + this$0 = OktaviaSearch._instance._oktavia; + this$0._stemmer = stemmer; + } else { + OktaviaSearch._stemmer = stemmer; + } +}; + +var OktaviaSearch$setStemmer$LStemmer$ = OktaviaSearch.setStemmer$LStemmer$; + +/** + * @param {!string} index + */ +OktaviaSearch.prototype.loadIndex$S = function (index) { + /** @type {Oktavia} */ + var this$0; + /** @type {Stemmer} */ + var stemmer$0; + if (OktaviaSearch._stemmer) { + this$0 = this._oktavia; + stemmer$0 = OktaviaSearch._stemmer; + this$0._stemmer = stemmer$0; + } + this._oktavia.load$S(Binary$base64decode$S(index)); + if (this._queryString) { + this.search$SF$IIV$(this._queryString, this._callback); + this._queryString = null; + this._callback = null; + } +}; + +/** + * @param {!string} queryString + * @param {*} callback + */ +OktaviaSearch.prototype.search$SF$IIV$ = function (queryString, callback) { + /** @type {QueryStringParser} */ + var queryParser; + /** @type {SearchSummary} */ + var summary; + /** @type {Array.<undefined|SearchUnit>} */ + var _result$0; + if (this._oktavia) { + queryParser = ({queries: [ ]}); + this._queries = QueryStringParser$parse$LQueryStringParser$S(queryParser, queryString); + this._highlight = QueryStringParser$highlight$LQueryStringParser$(queryParser); + summary = this._oktavia.search$ALQuery$(this._queries); + if (SearchSummary$size$LSearchSummary$(summary) > 0) { + this._result = this._sortResult$LSearchSummary$(summary); + this._proposals = [ ]; + this._currentPage = 1; + } else { + this._result = [ ]; + if (this._queries.length > 1) { + this._proposals = SearchSummary$getProposal$LSearchSummary$(summary); + } else { + this._proposals = [ ]; + } + this._currentPage = 1; + } + callback((_result$0 = this._result).length, Math.ceil(_result$0.length / this._entriesPerPage)); + } else { + this._queryString = queryString; + this._callback = callback; + } +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.resultSize$ = function () { + return (this._result.length | 0); +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.totalPages$ = function () { + return (Math.ceil(this._result.length / this._entriesPerPage) | 0); +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.currentPage$ = function () { + return this._currentPage; +}; + +/** + * @param {!number} page + */ +OktaviaSearch.prototype.setCurrentPage$I = function (page) { + this._currentPage = page; +}; + +/** + * @return {!boolean} + */ +OktaviaSearch.prototype.hasPrevPage$ = function () { + return this._currentPage !== 1; +}; + +/** + * @return {!boolean} + */ +OktaviaSearch.prototype.hasNextPage$ = function () { + return this._currentPage !== Math.ceil(this._result.length / this._entriesPerPage); +}; + +/** + * @return {Array.<undefined|!string>} + */ +OktaviaSearch.prototype.pageIndexes$ = function () { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var total; + /** @type {!number} */ + var i; + result = [ ]; + total = Math.ceil(this._result.length / this._entriesPerPage); + if (total < 10) { + for (i = 1; i <= total; i++) { + result.push(i + ""); + } + } else { + if (this._currentPage <= 5) { + for (i = 1; i <= 7; i++) { + result.push(i + ""); + } + result.push('...', total + ""); + } else { + if (total - 5 <= this._currentPage) { + result.push('1', '...'); + for (i = total - 8; i <= total; i++) { + result.push(i + ""); + } + } else { + result.push('1', '...'); + for (i = this._currentPage - 3; i <= this._currentPage + 3; i++) { + result.push(i + ""); + } + result.push('...', total + ""); + } + } + } + return result; +}; + +/** + * @return {Array.<undefined|_Result>} + */ +OktaviaSearch.prototype.getResult$ = function () { + /** @type {Style} */ + var style; + /** @type {!number} */ + var start; + /** @type {!number} */ + var last; + /** @type {Metadata} */ + var metadata; + /** @type {!number} */ + var num; + /** @type {Array.<undefined|_Result>} */ + var results; + /** @type {!number} */ + var i; + /** @type {SearchUnit} */ + var unit; + /** @type {Array.<undefined|!string>} */ + var info; + /** @type {!string} */ + var content; + /** @type {Array.<undefined|Position>} */ + var positions; + /** @type {!number} */ + var end; + /** @type {!boolean} */ + var split; + /** @type {!number} */ + var j; + /** @type {Position} */ + var pos; + /** @type {!string} */ + var text; + /** @type {Oktavia} */ + var this$0; + /** @type {!number} */ + var position$0; + /** @type {!number} */ + var _currentPage$0; + /** @type {!number} */ + var _entriesPerPage$0; + style = new Style$S('html'); + start = ((_currentPage$0 = this._currentPage) - 1) * (_entriesPerPage$0 = this._entriesPerPage); + last = Math.min(_currentPage$0 * _entriesPerPage$0, this._result.length); + this$0 = this._oktavia; + metadata = this$0._metadatas[this$0._metadataLabels[0]]; + num = 250; + results = [ ]; + for (i = start; i < last; i++) { + unit = this._result[i]; + info = metadata.getInformation$I(unit.id).split(Oktavia.eob); + content = metadata.getContent$I(unit.id); + start = 0; + positions = SearchUnit$getPositions$LSearchUnit$(unit); + if (content.indexOf(info[0]) === 1) { + content = content.slice(info[0].length + 2, content.length); + start += info[0].length + 2; + } + end = start + num; + split = false; + if (positions[0].position > end - positions[0].word.length) { + end = positions[0].position + Math.floor(num / 2); + split = true; + } + for (j = positions.length - 1; j > -1; j--) { + pos = positions[j]; + if (pos.position + pos.word.length < end) { + content = [ content.slice(0, pos.position - start), style.convert$S('<hit>*</hit>').replace('*', content.slice((position$0 = pos.position) - start, position$0 + pos.word.length - start)), content.slice(pos.position + pos.word.length - start, content.length) ].join(''); + } + } + if (split) { + text = [ content.slice(0, Math.floor(num / 2)) + ' ...', content.slice(- Math.floor(num / 2), end - start) ].join('<br/>'); + } else { + text = content.slice(0, end - start) + ' ...<br/>'; + } + text = text.replace(Oktavia.eob, ' ').replace(/(<br\/>)(<br\/>)+/, '<br/><br/>'); + results.push(({title: info[0], url: info[1], content: text, score: unit.score})); + } + return results; +}; + +/** + * @return {!string} + */ +OktaviaSearch.prototype.getHighlight$ = function () { + return this._highlight; +}; + +/** + * @return {Array.<undefined|_Proposal>} + */ +OktaviaSearch.prototype.getProposals$ = function () { + /** @type {Style} */ + var style; + /** @type {Array.<undefined|_Proposal>} */ + var results; + /** @type {!number} */ + var i; + /** @type {Proposal} */ + var proposal; + /** @type {Array.<undefined|!string>} */ + var label; + /** @type {Array.<undefined|!string>} */ + var option; + /** @type {!number} */ + var j; + style = new Style$S('html'); + results = [ ]; + if (this._queries.length > 1) { + for (i = 0; i < this._proposals.length; i++) { + proposal = this._proposals[i]; + if (proposal.expect > 0) { + label = [ ]; + option = [ ]; + for (j = 0; j < this._queries.length; j++) { + if (j !== proposal.omit) { + label.push(style.convert$S('<hit>' + this._queries[j].toString() + '</hit>')); + option.push(this._queries[j].toString()); + } else { + label.push(style.convert$S('<del>' + this._queries[j].toString() + '</del>')); + } + } + results.push(({options: option.join(' '), label: label.join(' '), count: proposal.expect})); + } + } + } + return results; +}; + +/** + * @param {SearchSummary} summary + * @return {Array.<undefined|SearchUnit>} + */ +OktaviaSearch.prototype._sortResult$LSearchSummary$ = function (summary) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var score; + /** @type {SearchUnit} */ + var unit; + /** @type {!string} */ + var pos; + /** @type {Position} */ + var position; + for (i = 0; i < summary.result.units.length; i++) { + score = 0; + unit = summary.result.units[i]; + for (pos in unit.positions) { + position = unit.positions[pos]; + if (this._oktavia.wordPositionType$I(position.position)) { + score += 10; + } else { + score += 1; + } + if (! position.stemmed) { + score += 2; + } + } + unit.score = (score | 0); + } + return SearchSummary$getSortedResult$LSearchSummary$(summary); +}; + +/** + * class _Main$0 extends Object + * @constructor + */ +function _Main$0() { +} + +/** + * @constructor + */ +function _Main$0$() { +}; + +_Main$0$.prototype = new _Main$0; + +/** + * @param {Array.<undefined|!string>} args + */ +_Main$0.main$AS = function (args) { +}; + +var _Main$0$main$AS = _Main$0.main$AS; + +/** + * class Oktavia extends Object + * @constructor + */ +function Oktavia() { +} + +/** + * @constructor + */ +function Oktavia$() { + /** @type {Array.<undefined|!string>} */ + var _utf162compressCode$0; + this._compressCode2utf16 = null; + this._fmindex = new FMIndex$(); + this._metadatas = ({ }); + this._metadataLabels = [ ]; + this._stemmer = null; + this._stemmingResult = ({ }); + _utf162compressCode$0 = this._utf162compressCode = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + _utf162compressCode$0.length = 65536; + this._compressCode2utf16 = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; +}; + +Oktavia$.prototype = new Oktavia; + +/** + * @param {Stemmer} stemmer + */ +Oktavia.prototype.setStemmer$LStemmer$ = function (stemmer) { + this._stemmer = stemmer; +}; + +/** + * @return {Metadata} + */ +Oktavia.prototype.getPrimaryMetadata$ = function () { + return this._metadatas[this._metadataLabels[0]]; +}; + +/** + * @param {!string} key + * @return {Section} + */ +Oktavia.prototype.addSection$S = function (key) { + /** @type {Section} */ + var section; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + section = new Section$LOktavia$(this); + this._metadatas[key] = section; + return section; +}; + +/** + * @param {!string} key + * @return {Section} + */ +Oktavia.prototype.getSection$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @return {Splitter} + */ +Oktavia.prototype.addSplitter$S = function (key) { + /** @type {Splitter} */ + var splitter; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + splitter = new Splitter$LOktavia$(this); + this._metadatas[key] = splitter; + return splitter; +}; + +/** + * @param {!string} key + * @return {Splitter} + */ +Oktavia.prototype.getSplitter$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @param {Array.<undefined|!string>} headers + * @return {Table} + */ +Oktavia.prototype.addTable$SAS = function (key, headers) { + /** @type {Table} */ + var table; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + table = new Table$LOktavia$AS(this, headers); + this._metadatas[key] = table; + return table; +}; + +/** + * @param {!string} key + * @return {Table} + */ +Oktavia.prototype.getTable$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @return {Block} + */ +Oktavia.prototype.addBlock$S = function (key) { + /** @type {Block} */ + var block; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + block = new Block$LOktavia$(this); + this._metadatas[key] = block; + return block; +}; + +/** + * @param {!string} key + * @return {Block} + */ +Oktavia.prototype.getBlock$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + */ +Oktavia.prototype.addEndOfBlock$ = function () { + this._fmindex.push$S(Oktavia.eob); +}; + +/** + * @param {!string} words + */ +Oktavia.prototype.addWord$S = function (words) { + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {undefined|!string} */ + var newCharCode; + str = [ ]; + str.length = words.length; + for (i = 0; i < words.length; i++) { + charCode = words.charCodeAt(i); + newCharCode = this._utf162compressCode[charCode]; + if (newCharCode == null) { + newCharCode = String.fromCharCode(this._compressCode2utf16.length); + this._utf162compressCode[charCode] = newCharCode; + this._compressCode2utf16.push(String.fromCharCode(charCode)); + } + str.push(newCharCode); + } + this._fmindex.push$S(str.join('')); +}; + +/** + * @param {!string} words + * @param {!boolean} stemming + */ +Oktavia.prototype.addWord$SB = function (words, stemming) { + /** @type {Array.<undefined|!string>} */ + var wordList; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var originalWord; + /** @type {!string} */ + var smallWord; + /** @type {undefined|!string} */ + var registerWord; + /** @type {!string} */ + var baseWord; + /** @type {!string} */ + var compressedCodeWord; + /** @type {Array.<undefined|!string>} */ + var stemmedList; + this.addWord$S(words); + wordList = words.split(/\s+/); + for (i = 0; i < wordList.length; i++) { + originalWord = wordList[i]; + smallWord = originalWord.slice(0, 1).toLowerCase() + originalWord.slice(1); + registerWord = null; + if (stemming && this._stemmer) { + baseWord = this._stemmer.stemWord$S(originalWord.toLowerCase()); + if (originalWord.indexOf(baseWord) === -1) { + registerWord = baseWord; + } + } else { + if (originalWord != smallWord) { + registerWord = smallWord; + } + } + if (registerWord) { + compressedCodeWord = this._convertToCompressionCode$S(originalWord); + stemmedList = this._stemmingResult[registerWord]; + if (! stemmedList) { + stemmedList = [ compressedCodeWord ]; + this._stemmingResult[registerWord] = stemmedList; + } else { + if (stemmedList.indexOf(compressedCodeWord) === -1) { + stemmedList.push(compressedCodeWord); + } + } + } + } +}; + +/** + * @param {!string} keyword + * @return {!string} + */ +Oktavia.prototype._convertToCompressionCode$S = function (keyword) { + /** @type {Array.<undefined|!string>} */ + var resultChars; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var chr; + resultChars = [ ]; + for (i = 0; i < keyword.length; i++) { + chr = this._utf162compressCode[keyword.charCodeAt(i)]; + if (chr == null) { + resultChars.push(Oktavia.unknown); + } else { + resultChars.push(chr); + } + } + return resultChars.join(''); +}; + +/** + * @param {!string} keyword + * @param {!boolean} stemming + * @return {Array.<undefined|!number>} + */ +Oktavia.prototype.rawSearch$SB = function (keyword, stemming) { + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {!string} */ + var baseWord; + /** @type {Array.<undefined|!string>} */ + var stemmedList; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var word; + if (stemming) { + result = [ ]; + if (this._stemmer) { + baseWord = this._stemmer.stemWord$S(keyword.toLowerCase()); + stemmedList = this._stemmingResult[baseWord]; + if (stemmedList) { + for (i = 0; i < stemmedList.length; i++) { + word = stemmedList[i]; + result = result.concat(this._fmindex.search$S(word)); + } + } + } + } else { + result = this._fmindex.search$S(this._convertToCompressionCode$S(keyword)); + } + return result; +}; + +/** + * @param {Array.<undefined|Query>} queries + * @return {SearchSummary} + */ +Oktavia.prototype.search$ALQuery$ = function (queries) { + /** @type {SearchSummary} */ + var summary; + /** @type {!number} */ + var i; + /** @type {SingleResult} */ + var result$0; + summary = ({sourceResults: [ ], result: null, oktavia: this}); + for (i = 0; i < queries.length; i++) { + result$0 = this._searchQuery$LQuery$(queries[i]); + summary.sourceResults.push(result$0); + } + summary.result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$(summary, summary.sourceResults); + return summary; +}; + +/** + * @param {Query} query + * @return {SingleResult} + */ +Oktavia.prototype._searchQuery$LQuery$ = function (query) { + /** @type {SingleResult} */ + var result; + /** @type {Array.<undefined|!number>} */ + var positions; + result = new SingleResult$SBB(query.word, query.or, query.not); + if (query.raw) { + positions = this.rawSearch$SB(query.word, false); + } else { + positions = this.rawSearch$SB(query.word, false).concat(this.rawSearch$SB(query.word, true)); + } + this._metadatas[this._metadataLabels[0]].grouping$LSingleResult$AISB(result, positions, query.word, ! query.raw); + return result; +}; + +/** + */ +Oktavia.prototype.build$ = function () { + this.build$IB(5, false); +}; + +/** + * @param {!number} cacheDensity + * @param {!boolean} verbose + */ +Oktavia.prototype.build$IB = function (cacheDensity, verbose) { + /** @type {!string} */ + var key; + /** @type {!number} */ + var cacheRange; + /** @type {!number} */ + var maxChar; + for (key in this._metadatas) { + this._metadatas[key]._build$(); + } + cacheRange = Math.round(Math.max(1, 100 / Math.min(100, Math.max(0.01, cacheDensity)))); + maxChar = this._compressCode2utf16.length; + this._fmindex.build$SIIB(Oktavia.eof, maxChar, cacheRange, verbose); +}; + +/** + * @return {!string} + */ +Oktavia.prototype.dump$ = function () { + return this.dump$B(false); +}; + +/** + * @param {!boolean} verbose + * @return {!string} + */ +Oktavia.prototype.dump$B = function (verbose) { + /** @type {!string} */ + var header; + /** @type {!string} */ + var fmdata; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {CompressionReport} */ + var report; + /** @type {undefined|!string} */ + var name; + /** @type {!string} */ + var data; + header = Binary$dumpString$SLCompressionReport$("oktavia-01", null).slice(1); + if (verbose) { + console.log("Source text size: " + (this._fmindex.size$() * 2 + "") + ' bytes'); + } + fmdata = this._fmindex.dump$B(verbose); + result = [ header, fmdata ]; + result.push(Binary$dump16bitNumber$I(this._compressCode2utf16.length)); + for (i = 3; i < this._compressCode2utf16.length; i++) { + result.push(this._compressCode2utf16[i]); + } + if (verbose) { + console.log('Char Code Map: ' + (this._compressCode2utf16.length * 2 - 2 + "") + ' bytes'); + } + report = ({source: 0, result: 0}); + result.push(Binary$dumpStringListMap$HASLCompressionReport$(this._stemmingResult, report)); + if (verbose) { + console.log('Stemmed Word Table: ' + (result[result.length - 1].length + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + result.push(Binary$dump16bitNumber$I(this._metadataLabels.length)); + for (i = 0; i < this._metadataLabels.length; i++) { + report = ({source: 0, result: 0}); + name = this._metadataLabels[i]; + data = this._metadatas[name]._dump$LCompressionReport$(report); + result.push(Binary$dumpString$SLCompressionReport$(name, report), data); + if (verbose) { + console.log('Meta Data ' + name + ': ' + (data.length * 2 + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + } + return result.join(''); +}; + +/** + * @param {!string} data + */ +Oktavia.prototype.load$S = function (data) { + /** @type {!string} */ + var header; + /** @type {!number} */ + var offset; + /** @type {!number} */ + var charCodeCount; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {LoadedStringListMapResult} */ + var stemmedWords; + /** @type {!number} */ + var metadataCount; + /** @type {LoadedStringResult} */ + var nameResult; + /** @type {!string} */ + var name; + /** @type {!number} */ + var type; + header = Binary$dumpString$SLCompressionReport$("oktavia-01", null).slice(1); + if (data.slice(0, 5) !== header) { + throw new Error('Invalid data file'); + } + this._metadatas = ({ }); + this._metadataLabels = [ ]; + offset = 5; + offset = this._fmindex.load$SI(data, offset); + charCodeCount = Binary$load16bitNumber$SI(data, offset++); + this._compressCode2utf16 = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + this._utf162compressCode = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + for (i = 3; i < charCodeCount; i++) { + charCode = Binary$load16bitNumber$SI(data, offset++); + this._compressCode2utf16.push(String.fromCharCode(charCode)); + this._utf162compressCode[charCode] = String.fromCharCode(i); + } + stemmedWords = Binary$loadStringListMap$SI(data, offset); + this._stemmingResult = stemmedWords.result; + offset = stemmedWords.offset; + metadataCount = Binary$load16bitNumber$SI(data, offset++); + for (i = 0; i < metadataCount; i++) { + nameResult = Binary$loadString$SI(data, offset); + name = nameResult.result; + offset = nameResult.offset; + type = Binary$load16bitNumber$SI(data, offset++); + switch (type) { + case 0: + offset = Section$_load$LOktavia$SSI(this, name, data, offset); + break; + case 1: + offset = Splitter$_load$LOktavia$SSI(this, name, data, offset); + break; + case 2: + offset = Table$_load$LOktavia$SSI(this, name, data, offset); + break; + case 3: + offset = Block$_load$LOktavia$SSI(this, name, data, offset); + break; + } + } +}; + +/** + * @return {!number} + */ +Oktavia.prototype.contentSize$ = function () { + /** @type {FMIndex} */ + var this$0; + this$0 = this._fmindex; + return this$0._substr.length; +}; + +/** + * @param {!number} position + * @return {!number} + */ +Oktavia.prototype.wordPositionType$I = function (position) { + /** @type {!number} */ + var result; + /** @type {!string} */ + var ahead; + result = 0; + if (position === 0) { + result = 4; + } else { + ahead = this._fmindex.getSubstring$II(position - 1, 1); + if (/\s/.test(ahead)) { + result = 2; + } else { + if (/\W/.test(ahead)) { + result = 1; + } else { + if (Oktavia.eob === ahead) { + result = 3; + } + } + } + } + return (result | 0); +}; + +/** + * @param {!number} position + * @param {!number} length + * @return {!string} + */ +Oktavia.prototype._getSubstring$II = function (position, length) { + /** @type {!string} */ + var result; + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var i; + result = this._fmindex.getSubstring$II(position, length); + str = [ ]; + for (i = 0; i < result.length; i++) { + str.push(this._compressCode2utf16[result.charCodeAt(i)]); + } + return str.join(''); +}; + +/** + * class Binary extends Object + * @constructor + */ +function Binary() { +} + +/** + * @constructor + */ +function Binary$() { +}; + +Binary$.prototype = new Binary; + +/** + * @param {!number} num + * @return {!string} + */ +Binary.dump32bitNumber$N = function (num) { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ String.fromCharCode(Math.floor(num / 65536)) ]; + result.push(String.fromCharCode(num % 65536)); + return result.join(""); +}; + +var Binary$dump32bitNumber$N = Binary.dump32bitNumber$N; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {!number} + */ +Binary.load32bitNumber$SI = function (buffer, offset) { + /** @type {!number} */ + var result; + result = buffer.charCodeAt(offset) * 65536 + buffer.charCodeAt(offset + 1); + return result; +}; + +var Binary$load32bitNumber$SI = Binary.load32bitNumber$SI; + +/** + * @param {!number} num + * @return {!string} + */ +Binary.dump16bitNumber$I = function (num) { + return String.fromCharCode(num % 65536); +}; + +var Binary$dump16bitNumber$I = Binary.dump16bitNumber$I; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {!number} + */ +Binary.load16bitNumber$SI = function (buffer, offset) { + return (buffer.charCodeAt(offset) | 0); +}; + +var Binary$load16bitNumber$SI = Binary.load16bitNumber$SI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.dumpString$S = function (str) { + return Binary$dumpString$SLCompressionReport$(str, null); +}; + +var Binary$dumpString$S = Binary.dumpString$S; + +/** + * @param {!string} str + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpString$SLCompressionReport$ = function (str, report) { + /** @type {!number} */ + var length; + /** @type {!boolean} */ + var compress; + /** @type {Array.<undefined|!number>} */ + var charCodes; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {undefined|!number} */ + var bytes; + if (str.length > 32768) { + str = str.slice(0, 32768); + } + length = str.length; + compress = true; + charCodes = [ ]; + for (i = 0; i < length; i++) { + charCode = str.charCodeAt(i); + if (charCode > 255) { + compress = false; + break; + } + charCodes.push(charCode); + } + if (compress) { + result = [ Binary$dump16bitNumber$I(length + 32768) ]; + for (i = 0; i < length; i += 2) { + bytes = charCodes[i]; + if (i !== length - 1) { + bytes += charCodes[i + 1] << 8; + } + result.push(String.fromCharCode(bytes % 65536)); + } + if (report) { + CompressionReport$add$LCompressionReport$II(report, length, Math.ceil(length / 2)); + } + } else { + result = [ Binary$dump16bitNumber$I(length), str ]; + if (report) { + CompressionReport$add$LCompressionReport$II(report, length, length); + } + } + return result.join(''); +}; + +var Binary$dumpString$SLCompressionReport$ = Binary.dumpString$SLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringResult} + */ +Binary.loadString$SI = function (buffer, offset) { + return new LoadedStringResult$SI(buffer, offset); +}; + +var Binary$loadString$SI = Binary.loadString$SI; + +/** + * @param {Array.<undefined|!string>} strList + * @return {!string} + */ +Binary.dumpStringList$AS = function (strList) { + return Binary$dumpStringList$ASLCompressionReport$(strList, null); +}; + +var Binary$dumpStringList$AS = Binary.dumpStringList$AS; + +/** + * @param {Array.<undefined|!string>} strList + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpStringList$ASLCompressionReport$ = function (strList, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + result = [ Binary$dump32bitNumber$N(strList.length) ]; + for (i = 0; i < strList.length; i++) { + result.push(Binary$dumpString$SLCompressionReport$(strList[i], report)); + } + return result.join(''); +}; + +var Binary$dumpStringList$ASLCompressionReport$ = Binary.dumpStringList$ASLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringListResult} + */ +Binary.loadStringList$SI = function (buffer, offset) { + return new LoadedStringListResult$SI(buffer, offset); +}; + +var Binary$loadStringList$SI = Binary.loadStringList$SI; + +/** + * @param {Object.<string, undefined|Array.<undefined|!string>>} strMap + * @return {!string} + */ +Binary.dumpStringListMap$HAS = function (strMap) { + return Binary$dumpStringListMap$HASLCompressionReport$(strMap, null); +}; + +var Binary$dumpStringListMap$HAS = Binary.dumpStringListMap$HAS; + +/** + * @param {Object.<string, undefined|Array.<undefined|!string>>} strMap + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpStringListMap$HASLCompressionReport$ = function (strMap, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + result = [ ]; + counter = 0; + for (key in strMap) { + result.push(Binary$dumpString$SLCompressionReport$(key, report)); + result.push(Binary$dumpStringList$ASLCompressionReport$(strMap[key], report)); + counter++; + } + return Binary$dump32bitNumber$N(counter) + result.join(''); +}; + +var Binary$dumpStringListMap$HASLCompressionReport$ = Binary.dumpStringListMap$HASLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringListMapResult} + */ +Binary.loadStringListMap$SI = function (buffer, offset) { + return new LoadedStringListMapResult$SI(buffer, offset); +}; + +var Binary$loadStringListMap$SI = Binary.loadStringListMap$SI; + +/** + * @param {Array.<undefined|!number>} array + * @return {!string} + */ +Binary.dump32bitNumberList$AN = function (array) { + return Binary$dump32bitNumberList$ANLCompressionReport$(array, null); +}; + +var Binary$dump32bitNumberList$AN = Binary.dump32bitNumberList$AN; + +/** + * @param {Array.<undefined|!number>} array + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dump32bitNumberList$ANLCompressionReport$ = function (array, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var index; + /** @type {!number} */ + var inputLength; + /** @type {!number} */ + var length; + /** @type {!string} */ + var resultString; + /** @type {!number} */ + var value1$0; + /** @type {!number} */ + var value2$0; + result = [ Binary$dump32bitNumber$N(array.length) ]; + index = 0; + inputLength = array.length; + while (index < inputLength) { + if (array[index] == 0) { + length = Binary$_countZero$ANI(array, index); + result.push(Binary$_zeroBlock$I(length)); + index += length; + } else { + if (Binary$_shouldZebraCode$ANI(array, index)) { + result.push(Binary$_createZebraCode$ANI(array, index)); + value1$0 = array.length; + value2$0 = index + 15; + index = (value1$0 <= value2$0 ? value1$0 : value2$0); + } else { + length = Binary$_searchDoubleZero$ANI(array, index); + result.push(Binary$_nonZeroBlock$ANII(array, index, length)); + if (length === 0) { + throw new Error(''); + } + index += length; + } + } + } + resultString = result.join(''); + if (report) { + CompressionReport$add$LCompressionReport$II(report, array.length * 2 + 2, resultString.length); + } + return resultString; +}; + +var Binary$dump32bitNumberList$ANLCompressionReport$ = Binary.dump32bitNumberList$ANLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedNumberListResult} + */ +Binary.load32bitNumberList$SI = function (buffer, offset) { + return new LoadedNumberListResult$SI(buffer, offset); +}; + +var Binary$load32bitNumberList$SI = Binary.load32bitNumberList$SI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!number} + */ +Binary._countZero$ANI = function (array, offset) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var array$len$0; + for ((i = offset, array$len$0 = array.length); i < array$len$0; i++) { + if (array[i] != 0) { + return (i - offset | 0); + } + } + return (array.length - offset | 0); +}; + +var Binary$_countZero$ANI = Binary._countZero$ANI; + +/** + * @param {!number} length + * @return {!string} + */ +Binary._zeroBlock$I = function (length) { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ ]; + while (length > 0) { + if (length > 16384) { + result.push(Binary$dump16bitNumber$I(16383)); + length -= 16384; + } else { + result.push(Binary$dump16bitNumber$I(length - 1)); + length = 0; + } + } + return result.join(''); +}; + +var Binary$_zeroBlock$I = Binary._zeroBlock$I; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!boolean} + */ +Binary._shouldZebraCode$ANI = function (array, offset) { + /** @type {!number} */ + var change; + /** @type {!boolean} */ + var isLastZero; + /** @type {!number} */ + var i; + if (array.length - offset < 16) { + return true; + } + change = 0; + isLastZero = false; + for (i = offset; i < offset + 15; i++) { + if (array[i] == 0) { + if (! isLastZero) { + isLastZero = true; + change++; + } + } else { + if (isLastZero) { + isLastZero = false; + change++; + } + } + } + return change > 2; +}; + +var Binary$_shouldZebraCode$ANI = Binary._shouldZebraCode$ANI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!number} + */ +Binary._searchDoubleZero$ANI = function (array, offset) { + /** @type {!boolean} */ + var isLastZero; + /** @type {!number} */ + var i; + /** @type {!number} */ + var array$len$0; + isLastZero = false; + for ((i = offset, array$len$0 = array.length); i < array$len$0; i++) { + if (array[i] == 0) { + if (isLastZero) { + return (i - offset - 1 | 0); + } + isLastZero = true; + } else { + isLastZero = false; + } + } + return (array.length - offset | 0); +}; + +var Binary$_searchDoubleZero$ANI = Binary._searchDoubleZero$ANI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @param {!number} length + * @return {!string} + */ +Binary._nonZeroBlock$ANII = function (array, offset, length) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var blockLength; + /** @type {!number} */ + var i; + result = [ ]; + while (length > 0) { + if (length > 16384) { + blockLength = 16384; + length -= 16384; + } else { + blockLength = length; + length = 0; + } + result.push(Binary$dump16bitNumber$I(blockLength - 1 + 0x4000)); + for (i = offset; i < offset + blockLength; i++) { + result.push(Binary$dump32bitNumber$N(array[i])); + } + offset += blockLength; + } + return result.join(''); +}; + +var Binary$_nonZeroBlock$ANII = Binary._nonZeroBlock$ANII; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!string} + */ +Binary._createZebraCode$ANI = function (array, offset) { + /** @type {!number} */ + var last; + /** @type {!number} */ + var code; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {!number} */ + var value1$0; + /** @type {!number} */ + var value2$0; + value1$0 = offset + 15; + value2$0 = array.length; + last = (value1$0 <= value2$0 ? value1$0 : value2$0); + code = 0x8000; + result = [ ]; + for (i = offset; i < last; i++) { + if (array[i] != 0) { + result.push(Binary$dump32bitNumber$N(array[i])); + code = code + (0x1 << i - offset); + } + } + return String.fromCharCode(code) + result.join(''); +}; + +var Binary$_createZebraCode$ANI = Binary._createZebraCode$ANI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.base64encode$S = function (str) { + /** @type {Array.<undefined|!string>} */ + var out; + /** @type {Array.<undefined|!number>} */ + var source; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var len; + /** @type {!number} */ + var c1; + /** @type {undefined|!number} */ + var c2; + /** @type {undefined|!number} */ + var c3; + out = [ ]; + source = [ ]; + for (i = 0; i < str.length; i++) { + code = str.charCodeAt(i); + source.push(code & 0x00ff, code >>> 8); + } + len = str.length * 2; + i = 0; + while (i < len) { + c1 = source[i++] & 0xff; + if (i === len) { + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4)); + out.push("=="); + break; + } + c2 = source[i++]; + if (i === len) { + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4 | (c2 & 0xF0) >> 4)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c2 & 0xF) << 2)); + out.push("="); + break; + } + c3 = source[i++]; + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4 | (c2 & 0xF0) >> 4)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c2 & 0xF) << 2 | (c3 & 0xC0) >> 6)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c3 & 0x3F)); + } + return out.join(''); +}; + +var Binary$base64encode$S = Binary.base64encode$S; + +/** + * @param {Array.<undefined|!number>} source + * @return {!string} + */ +Binary._mergeCharCode$AI = function (source) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + result = [ ]; + for (i = 0; i < source.length; i += 2) { + result.push(String.fromCharCode(source[i] + (source[i + 1] << 8))); + } + return result.join(''); +}; + +var Binary$_mergeCharCode$AI = Binary._mergeCharCode$AI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.base64decode$S = function (str) { + /** @type {!number} */ + var len; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!number>} */ + var out; + /** @type {undefined|!number} */ + var c1; + /** @type {undefined|!number} */ + var c2; + /** @type {!number} */ + var c3; + /** @type {!number} */ + var c4; + len = str.length; + i = 0; + out = [ ]; + while (i < len) { + do { + c1 = Binary._base64DecodeChars[str.charCodeAt(i++) & 0xff]; + } while (i < len && c1 == -1); + if (c1 == -1) { + break; + } + do { + c2 = Binary._base64DecodeChars[str.charCodeAt(i++) & 0xff]; + } while (i < len && c2 == -1); + if (c2 == -1) { + break; + } + out.push(c1 << 2 | (c2 & 0x30) >> 4); + do { + c3 = str.charCodeAt(i++) & 0xff; + if (c3 === 61) { + return Binary$_mergeCharCode$AI(out); + } + c3 = Binary._base64DecodeChars[c3]; + } while (i < len && c3 === -1); + if (c3 === -1) { + break; + } + out.push((c2 & 0XF) << 4 | (c3 & 0x3C) >> 2); + do { + c4 = str.charCodeAt(i++) & 0xff; + if (c4 === 61) { + return Binary$_mergeCharCode$AI(out); + } + c4 = (Binary._base64DecodeChars[c4] | 0); + } while (i < len && c4 === -1); + if (c4 === -1) { + break; + } + out.push((c3 & 0x03) << 6 | c4); + } + return Binary$_mergeCharCode$AI(out); +}; + +var Binary$base64decode$S = Binary.base64decode$S; + +/** + * class LoadedStringResult extends Object + * @constructor + */ +function LoadedStringResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringResult$SI(data, offset) { + /** @type {!number} */ + var strLength; + /** @type {Array.<undefined|!string>} */ + var bytes; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var offset$0; + this.result = ""; + this.offset = 0; + offset$0 = offset++; + strLength = data.charCodeAt(offset$0); + if (strLength > 32767) { + strLength = strLength - 32768; + bytes = [ ]; + for (i = 0; i < strLength; i += 2) { + code = data.charCodeAt(offset); + bytes.push(String.fromCharCode(code & 0x00ff)); + if (i !== strLength - 1) { + bytes.push(String.fromCharCode(code >>> 8)); + } + offset++; + } + this.result = bytes.join(''); + this.offset = offset; + } else { + this.result = data.slice(offset, offset + strLength); + this.offset = (offset + strLength | 0); + } +}; + +LoadedStringResult$SI.prototype = new LoadedStringResult; + +/** + * class LoadedStringListResult extends Object + * @constructor + */ +function LoadedStringListResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringListResult$SI(data, offset) { + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {!number} */ + var strLength; + /** @type {!string} */ + var resultStr; + /** @type {Array.<undefined|!string>} */ + var bytes; + /** @type {!number} */ + var j; + /** @type {!number} */ + var code; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var offset$0; + this.offset = 0; + this.result = [ ]; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + length = result$0; + offset += 2; + for (i = 0; i < length; i++) { + offset$0 = offset++; + strLength = data.charCodeAt(offset$0); + if (strLength > 32767) { + strLength = strLength - 32768; + bytes = [ ]; + for (j = 0; j < strLength; j += 2) { + code = data.charCodeAt(offset); + bytes.push(String.fromCharCode(code & 0x00ff)); + if (j !== strLength - 1) { + bytes.push(String.fromCharCode(code >>> 8)); + } + offset++; + } + resultStr = bytes.join(''); + } else { + resultStr = data.slice(offset, offset + strLength); + offset = (offset + strLength | 0); + } + this.result.push(resultStr); + } + this.offset = offset; +}; + +LoadedStringListResult$SI.prototype = new LoadedStringListResult; + +/** + * class LoadedStringListMapResult extends Object + * @constructor + */ +function LoadedStringListMapResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringListMapResult$SI(data, offset) { + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {LoadedStringResult} */ + var keyResult; + /** @type {LoadedStringListResult} */ + var valueResult; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var offset$0; + this.offset = 0; + this.result = ({ }); + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + length = result$0; + offset += 2; + for (i = 0; i < length; i++) { + keyResult = new LoadedStringResult$SI(data, offset); + offset$0 = keyResult.offset; + valueResult = new LoadedStringListResult$SI(data, offset$0); + this.result[keyResult.result] = valueResult.result; + offset = valueResult.offset; + } + this.offset = offset; +}; + +LoadedStringListMapResult$SI.prototype = new LoadedStringListMapResult; + +/** + * class LoadedNumberListResult extends Object + * @constructor + */ +function LoadedNumberListResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedNumberListResult$SI(data, offset) { + /** @type {!number} */ + var resultLength; + /** @type {!number} */ + var originalOffset; + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {!number} */ + var tag; + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var value1$0; + this.result = null; + this.offset = 0; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + resultLength = result$0; + originalOffset = offset; + offset += 2; + result = [ ]; + while (result.length < resultLength) { + tag = data.charCodeAt(offset++); + if (tag >>> 15 === 1) { + value1$0 = resultLength - result.length; + length = (value1$0 <= 15 ? value1$0 : 15); + for (i = 0; i < length; i++) { + if (tag >>> i & 0x1) { + result.push(Binary$load32bitNumber$SI(data, offset)); + offset += 2; + } else { + result.push(0); + } + } + } else { + if (tag >>> 14 === 1) { + length = tag - 0x4000 + 1; + for (i = 0; i < length; i++) { + result.push(Binary$load32bitNumber$SI(data, offset)); + offset += 2; + } + } else { + length = tag + 1; + for (i = 0; i < length; i++) { + result.push(0); + } + } + } + } + this.result = result; + this.offset = offset; +}; + +LoadedNumberListResult$SI.prototype = new LoadedNumberListResult; + +/** + * class CompressionReport extends Object + * @constructor + */ +function CompressionReport() { +} + +/** + * @constructor + */ +function CompressionReport$() { + this.source = 0; + this.result = 0; +}; + +CompressionReport$.prototype = new CompressionReport; + +/** + * @param {CompressionReport} $this + * @param {!number} source + * @param {!number} result + */ +CompressionReport.add$LCompressionReport$II = function ($this, source, result) { + $this.source += source; + $this.result += result; +}; + +var CompressionReport$add$LCompressionReport$II = CompressionReport.add$LCompressionReport$II; + +/** + * @param {CompressionReport} $this + * @return {!number} + */ +CompressionReport.rate$LCompressionReport$ = function ($this) { + return (Math.round($this.result * 100.0 / $this.source) | 0); +}; + +var CompressionReport$rate$LCompressionReport$ = CompressionReport.rate$LCompressionReport$; + +/** + * class Query extends Object + * @constructor + */ +function Query() { +} + +/** + * @constructor + */ +function Query$() { + this.word = ''; + this.or = false; + this.not = false; + this.raw = false; +}; + +Query$.prototype = new Query; + +/** + * @return {!string} + */ +Query.prototype.toString = function () { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ ]; + if (this.or) { + result.push("OR "); + } + if (this.not) { + result.push("-"); + } + if (this.raw) { + result.push('"', this.word, '"'); + } else { + result.push(this.word); + } + return result.join(''); +}; + +/** + * class QueryStringParser extends Object + * @constructor + */ +function QueryStringParser() { +} + +/** + * @constructor + */ +function QueryStringParser$() { + this.queries = [ ]; +}; + +QueryStringParser$.prototype = new QueryStringParser; + +/** + * @param {QueryStringParser} $this + * @param {!string} queryString + * @return {Array.<undefined|Query>} + */ +QueryStringParser.parse$LQueryStringParser$S = function ($this, queryString) { + /** @type {!boolean} */ + var nextOr; + /** @type {!boolean} */ + var nextNot; + /** @type {!number} */ + var currentWordStart; + /** @type {!number} */ + var status; + /** @type {RegExp} */ + var isSpace; + /** @type {!number} */ + var i; + /** @type {!string} */ + var ch; + /** @type {!string} */ + var word; + /** @type {Query} */ + var query; + nextOr = false; + nextNot = false; + currentWordStart = 0; + status = 0; + isSpace = /[\s\u3000]/; + for (i = 0; i < queryString.length; i++) { + ch = queryString.charAt(i); + switch (status) { + case 0: + if (! isSpace.test(ch)) { + if (ch === '-') { + nextNot = true; + } else { + if (ch === '"') { + currentWordStart = i + 1; + status = 2; + } else { + currentWordStart = i; + status = 1; + } + } + } else { + nextNot = false; + } + break; + case 1: + if (isSpace.test(ch)) { + word = queryString.slice(currentWordStart, i); + if (word === 'OR') { + nextOr = true; + } else { + query = new Query$(); + query.word = word; + query.or = nextOr; + query.not = nextNot; + $this.queries.push(query); + nextOr = false; + nextNot = false; + } + status = 0; + } + break; + case 2: + if (ch === '"') { + word = queryString.slice(currentWordStart, i); + query = new Query$(); + query.word = word; + query.or = nextOr; + query.not = nextNot; + query.raw = true; + $this.queries.push(query); + nextOr = false; + nextNot = false; + status = 0; + } + break; + } + } + switch (status) { + case 0: + break; + case 1: + query = new Query$(); + word = queryString.slice(currentWordStart, queryString.length); + if (word !== 'OR') { + query.word = word; + query.or = nextOr; + query.not = nextNot; + $this.queries.push(query); + } + break; + case 2: + query = new Query$(); + query.word = queryString.slice(currentWordStart, queryString.length); + query.or = nextOr; + query.not = nextNot; + query.raw = true; + $this.queries.push(query); + break; + } + return $this.queries; +}; + +var QueryStringParser$parse$LQueryStringParser$S = QueryStringParser.parse$LQueryStringParser$S; + +/** + * @param {QueryStringParser} $this + * @return {!string} + */ +QueryStringParser.highlight$LQueryStringParser$ = function ($this) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {Query} */ + var query; + result = [ ]; + for (i = 0; i < $this.queries.length; i++) { + query = $this.queries[i]; + if (! query.not) { + result.push("highlight=" + $__jsx_encodeURIComponent(query.word)); + } + } + return '?' + result.join('&'); +}; + +var QueryStringParser$highlight$LQueryStringParser$ = QueryStringParser.highlight$LQueryStringParser$; + +/** + * class Proposal extends Object + * @constructor + */ +function Proposal() { +} + +/** + * @constructor + * @param {!number} omit + * @param {!number} expect + */ +function Proposal$II(omit, expect) { + this.omit = omit; + this.expect = expect; +}; + +Proposal$II.prototype = new Proposal; + +/** + * class Position extends Object + * @constructor + */ +function Position() { +} + +/** + * @constructor + * @param {!string} word + * @param {!number} position + * @param {!boolean} stemmed + */ +function Position$SIB(word, position, stemmed) { + this.word = word; + this.position = position; + this.stemmed = stemmed; +}; + +Position$SIB.prototype = new Position; + +/** + * class SearchUnit extends Object + * @constructor + */ +function SearchUnit() { +} + +/** + * @constructor + * @param {!number} id + */ +function SearchUnit$I(id) { + this.positions = ({ }); + this.id = id; + this._size = 0; + this.score = 0; + this.startPosition = -1; +}; + +SearchUnit$I.prototype = new SearchUnit; + +/** + * @param {SearchUnit} $this + * @param {!string} word + * @param {!number} position + * @param {!boolean} stemmed + */ +SearchUnit.addPosition$LSearchUnit$SIB = function ($this, word, position, stemmed) { + /** @type {Position} */ + var positionObj; + positionObj = $this.positions[position + ""]; + if (! positionObj) { + $this._size++; + $this.positions[position + ""] = ({word: word, position: position, stemmed: stemmed}); + } else { + if (positionObj.word.length < word.length) { + positionObj.word = word; + } + positionObj.stemmed = positionObj.stemmed && stemmed; + } +}; + +var SearchUnit$addPosition$LSearchUnit$SIB = SearchUnit.addPosition$LSearchUnit$SIB; + +/** + * @param {SearchUnit} $this + * @param {!number} position + * @return {Position} + */ +SearchUnit.get$LSearchUnit$I = function ($this, position) { + return $this.positions[position + ""]; +}; + +var SearchUnit$get$LSearchUnit$I = SearchUnit.get$LSearchUnit$I; + +/** + * @param {SearchUnit} $this + * @return {!number} + */ +SearchUnit.size$LSearchUnit$ = function ($this) { + return $this._size; +}; + +var SearchUnit$size$LSearchUnit$ = SearchUnit.size$LSearchUnit$; + +/** + * @param {SearchUnit} $this + * @param {SearchUnit} rhs + */ +SearchUnit.merge$LSearchUnit$LSearchUnit$ = function ($this, rhs) { + /** @type {!string} */ + var position; + /** @type {Position} */ + var pos; + for (position in rhs.positions) { + pos = rhs.positions[position]; + SearchUnit$addPosition$LSearchUnit$SIB($this, pos.word, pos.position, pos.stemmed); + } +}; + +var SearchUnit$merge$LSearchUnit$LSearchUnit$ = SearchUnit.merge$LSearchUnit$LSearchUnit$; + +/** + * @param {SearchUnit} $this + * @return {Array.<undefined|Position>} + */ +SearchUnit.getPositions$LSearchUnit$ = function ($this) { + /** @type {Array.<undefined|Position>} */ + var result; + /** @type {!string} */ + var pos; + result = [ ]; + for (pos in $this.positions) { + result.push($this.positions[pos]); + } + result.sort((function (a, b) { + return a.position - b.position; + })); + return result; +}; + +var SearchUnit$getPositions$LSearchUnit$ = SearchUnit.getPositions$LSearchUnit$; + +/** + * class SingleResult extends Object + * @constructor + */ +function SingleResult() { +} + +/** + * @constructor + */ +function SingleResult$() { + this.units = [ ]; + this.unitIds = [ ]; + this.or = false; + this.not = false; + this.searchWord = ''; +}; + +SingleResult$.prototype = new SingleResult; + +/** + * @constructor + * @param {!string} searchWord + * @param {!boolean} or + * @param {!boolean} not + */ +function SingleResult$SBB(searchWord, or, not) { + this.units = [ ]; + this.unitIds = [ ]; + this.or = or; + this.not = not; + this.searchWord = searchWord; +}; + +SingleResult$SBB.prototype = new SingleResult; + +/** + * @param {SingleResult} $this + * @param {!number} unitId + * @return {SearchUnit} + */ +SingleResult.getSearchUnit$LSingleResult$I = function ($this, unitId) { + /** @type {!number} */ + var existing; + /** @type {SearchUnit} */ + var result; + existing = $this.unitIds.indexOf(unitId); + if (existing === -1) { + result = ({positions: ({ }), id: unitId, _size: 0, score: 0, startPosition: -1}); + $this.units.push(result); + $this.unitIds.push(unitId); + } else { + result = $this.units[existing]; + } + return result; +}; + +var SingleResult$getSearchUnit$LSingleResult$I = SingleResult.getSearchUnit$LSingleResult$I; + +/** + * @param {SingleResult} $this + * @param {SingleResult} rhs + * @return {SingleResult} + */ +SingleResult.merge$LSingleResult$LSingleResult$ = function ($this, rhs) { + /** @type {SingleResult} */ + var result; + result = ({units: [ ], unitIds: [ ], or: false, not: false, searchWord: ''}); + if (rhs.or) { + SingleResult$_orMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } else { + if (rhs.not) { + SingleResult$_notMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } else { + SingleResult$_andMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } + } + return result; +}; + +var SingleResult$merge$LSingleResult$LSingleResult$ = SingleResult.merge$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @return {!number} + */ +SingleResult.size$LSingleResult$ = function ($this) { + return ($this.units.length | 0); +}; + +var SingleResult$size$LSingleResult$ = SingleResult.size$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._andMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var lhsSection; + for (i = 0; i < $this.unitIds.length; i++) { + id = $this.unitIds[i]; + if (rhs.unitIds.indexOf(id) !== -1) { + lhsSection = $this.units[i]; + result.unitIds.push(id); + result.units.push(lhsSection); + } + } +}; + +var SingleResult$_andMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._andMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._orMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var rhsSection; + /** @type {SearchUnit} */ + var lhsSection; + /** @type {Array.<undefined|!number>} */ + var unitIds$0; + /** @type {Array.<undefined|SearchUnit>} */ + var units$0; + result.unitIds = (unitIds$0 = $this.unitIds).slice(0, unitIds$0.length); + result.units = (units$0 = $this.units).slice(0, units$0.length); + for (i = 0; i < rhs.unitIds.length; i++) { + id = rhs.unitIds[i]; + rhsSection = rhs.units[i]; + if (result.unitIds.indexOf(id) !== -1) { + lhsSection = result.units[result.unitIds.indexOf(id)]; + SearchUnit$merge$LSearchUnit$LSearchUnit$(lhsSection, rhsSection); + } else { + result.unitIds.push(id); + result.units.push(rhsSection); + } + } +}; + +var SingleResult$_orMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._orMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._notMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var lhsSection; + for (i = 0; i < $this.unitIds.length; i++) { + id = $this.unitIds[i]; + if (rhs.unitIds.indexOf(id) === -1) { + lhsSection = $this.units[i]; + result.unitIds.push(id); + result.units.push(lhsSection); + } + } +}; + +var SingleResult$_notMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._notMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * class SearchSummary extends Object + * @constructor + */ +function SearchSummary() { +} + +/** + * @constructor + */ +function SearchSummary$() { + this.sourceResults = [ ]; + this.result = null; + this.oktavia = null; +}; + +SearchSummary$.prototype = new SearchSummary; + +/** + * @constructor + * @param {Oktavia} oktavia + */ +function SearchSummary$LOktavia$(oktavia) { + this.sourceResults = [ ]; + this.result = null; + this.oktavia = oktavia; +}; + +SearchSummary$LOktavia$.prototype = new SearchSummary; + +/** + * @param {SearchSummary} $this + * @param {SingleResult} result + */ +SearchSummary.addQuery$LSearchSummary$LSingleResult$ = function ($this, result) { + $this.sourceResults.push(result); +}; + +var SearchSummary$addQuery$LSearchSummary$LSingleResult$ = SearchSummary.addQuery$LSearchSummary$LSingleResult$; + +/** + * @param {SearchSummary} $this + */ +SearchSummary.mergeResult$LSearchSummary$ = function ($this) { + $this.result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$($this, $this.sourceResults); +}; + +var SearchSummary$mergeResult$LSearchSummary$ = SearchSummary.mergeResult$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @param {Array.<undefined|SingleResult>} results + * @return {SingleResult} + */ +SearchSummary.mergeResult$LSearchSummary$ALSingleResult$ = function ($this, results) { + /** @type {SingleResult} */ + var rhs; + /** @type {!number} */ + var i; + /** @type {!number} */ + var results$len$0; + rhs = results[0]; + for ((i = 1, results$len$0 = results.length); i < results$len$0; i++) { + rhs = SingleResult$merge$LSingleResult$LSingleResult$(rhs, results[i]); + } + return rhs; +}; + +var SearchSummary$mergeResult$LSearchSummary$ALSingleResult$ = SearchSummary.mergeResult$LSearchSummary$ALSingleResult$; + +/** + * @param {SearchSummary} $this + * @return {Array.<undefined|Proposal>} + */ +SearchSummary.getProposal$LSearchSummary$ = function ($this) { + /** @type {Array.<undefined|Proposal>} */ + var proposals; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|SingleResult>} */ + var tmpSource; + /** @type {!number} */ + var j; + /** @type {SingleResult} */ + var result; + proposals = [ ]; + for (i = 0; i < $this.sourceResults.length; i++) { + tmpSource = [ ]; + for (j = 0; j < $this.sourceResults.length; j++) { + if (i !== j) { + tmpSource.push($this.sourceResults[j]); + } + } + result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$($this, tmpSource); + proposals.push(({omit: i, expect: result.units.length})); + } + proposals.sort((function (a, b) { + return b.expect - a.expect; + })); + return proposals; +}; + +var SearchSummary$getProposal$LSearchSummary$ = SearchSummary.getProposal$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @return {Array.<undefined|SearchUnit>} + */ +SearchSummary.getSortedResult$LSearchSummary$ = function ($this) { + /** @type {Array.<undefined|SearchUnit>} */ + var result; + /** @type {Array.<undefined|SearchUnit>} */ + var units$0; + result = (units$0 = $this.result.units).slice(0, units$0.length); + result.sort((function (a, b) { + return b.score - a.score; + })); + return result; +}; + +var SearchSummary$getSortedResult$LSearchSummary$ = SearchSummary.getSortedResult$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @return {!number} + */ +SearchSummary.size$LSearchSummary$ = function ($this) { + /** @type {SingleResult} */ + var this$0; + this$0 = $this.result; + return (this$0.units.length | 0); +}; + +var SearchSummary$size$LSearchSummary$ = SearchSummary.size$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @param {SingleResult} result + */ +SearchSummary.add$LSearchSummary$LSingleResult$ = function ($this, result) { + $this.sourceResults.push(result); +}; + +var SearchSummary$add$LSearchSummary$LSingleResult$ = SearchSummary.add$LSearchSummary$LSingleResult$; + +/** + * class Style extends Object + * @constructor + */ +function Style() { +} + +/** + * @constructor + * @param {!string} mode + */ +function Style$S(mode) { + this.styles = null; + this.escapeHTML = false; + switch (mode) { + case 'console': + this.styles = Style.console; + break; + case 'html': + this.styles = Style.html; + break; + case 'ignore': + this.styles = Style.ignore; + break; + default: + this.styles = Style.ignore; + break; + } + this.escapeHTML = mode === 'html'; +}; + +Style$S.prototype = new Style; + +/** + * @param {!string} source + * @return {!string} + */ +Style.prototype.convert$S = function (source) { + /** @type {_HTMLHandler} */ + var handler; + /** @type {SAXParser} */ + var parser; + handler = new _HTMLHandler$HASB(this.styles, this.escapeHTML); + parser = new SAXParser$LSAXHandler$(handler); + parser.parse$S(source); + return handler.text.join(''); +}; + +/** + * class Stemmer + * @constructor + */ +function Stemmer() { +} + +Stemmer.prototype.$__jsx_implements_Stemmer = true; + +/** + * @constructor + */ +function Stemmer$() { +}; + +Stemmer$.prototype = new Stemmer; + +/** + * class BaseStemmer extends Object + * @constructor + */ +function BaseStemmer() { +} + +$__jsx_merge_interface(BaseStemmer, Stemmer); + +/** + * @constructor + */ +function BaseStemmer$() { + /** @type {!string} */ + var current$0; + /** @type {!number} */ + var cursor$0; + /** @type {!number} */ + var limit$0; + this.cache = ({ }); + current$0 = this.current = ""; + cursor$0 = this.cursor = 0; + limit$0 = this.limit = current$0.length; + this.limit_backward = 0; + this.bra = cursor$0; + this.ket = limit$0; +}; + +BaseStemmer$.prototype = new BaseStemmer; + +/** + * @param {!string} value + */ +BaseStemmer.prototype.setCurrent$S = function (value) { + /** @type {!string} */ + var current$0; + /** @type {!number} */ + var cursor$0; + /** @type {!number} */ + var limit$0; + current$0 = this.current = value; + cursor$0 = this.cursor = 0; + limit$0 = this.limit = current$0.length; + this.limit_backward = 0; + this.bra = cursor$0; + this.ket = limit$0; +}; + +/** + * @return {!string} + */ +BaseStemmer.prototype.getCurrent$ = function () { + return this.current; +}; + +/** + * @param {BaseStemmer} other + */ +BaseStemmer.prototype.copy_from$LBaseStemmer$ = function (other) { + this.current = other.current; + this.cursor = other.cursor; + this.limit = other.limit; + this.limit_backward = other.limit_backward; + this.bra = other.bra; + this.ket = other.ket; +}; + +/** + * @param {Array.<undefined|!number>} s + * @param {!number} min + * @param {!number} max + * @return {!boolean} + */ +BaseStemmer.prototype.in_grouping$AIII = function (s, min, max) { + /** @type {!number} */ + var ch; + if (this.cursor >= this.limit) { + return false; + } + ch = this.current.charCodeAt(this.cursor); + if (ch > max || ch < min) { + return false; + } + ch -= min; + if ((s[ch >>> 3] & 0x1 << (ch & 0x7)) === 0) { + return false; + } + this.cursor++; + return true; +}; + +/** + * @param {Array.<undefined|!number>} s + * @param {!number} min + * @param {!number} max + * @return {!boolean} + */ +BaseStemmer.prototype.in_grouping_b$AIII = function (s, min, max) { + /** @type {!number} */ + var ch; + if (this.cursor <= this.limit_backward) { + return false; + } + ch = this.current.charCodeAt(this.cursor - 1); + if (ch > max || ch < min) { + return false; + } + ch -= min; + if ((s[ch >>> 3] & 0x1 << (ch & 0x7)) === 0) { + return false; + } + this.cursor--; + return true; +}; + +/** + * @param {Array.<undefined|!number>} s + * @param {!number} min + * @param {!number} max + * @return {!boolean} + */ +BaseStemmer.prototype.out_grouping$AIII = function (s, min, max) { + /** @type {!number} */ + var ch; + if (this.cursor >= this.limit) { + return false; + } + ch = this.current.charCodeAt(this.cursor); + if (ch > max || ch < min) { + this.cursor++; + return true; + } + ch -= min; + if ((s[ch >>> 3] & 0X1 << (ch & 0x7)) === 0) { + this.cursor++; + return true; + } + return false; +}; + +/** + * @param {Array.<undefined|!number>} s + * @param {!number} min + * @param {!number} max + * @return {!boolean} + */ +BaseStemmer.prototype.out_grouping_b$AIII = function (s, min, max) { + /** @type {!number} */ + var ch; + if (this.cursor <= this.limit_backward) { + return false; + } + ch = this.current.charCodeAt(this.cursor - 1); + if (ch > max || ch < min) { + this.cursor--; + return true; + } + ch -= min; + if ((s[ch >>> 3] & 0x1 << (ch & 0x7)) === 0) { + this.cursor--; + return true; + } + return false; +}; + +/** + * @param {!number} min + * @param {!number} max + * @return {!boolean} + */ +BaseStemmer.prototype.in_range$II = function (min, max) { + /** @type {!number} */ + var ch; + if (this.cursor >= this.limit) { + return false; + } + ch = this.current.charCodeAt(this.cursor); + if (ch > max || ch < min) { + return false; + } + this.cursor++; + return true; +}; + +/** + * @param {!number} min + * @param {!number} max + * @return {!boolean} + */ +BaseStemmer.prototype.in_range_b$II = function (min, max) { + /** @type {!number} */ + var ch; + if (this.cursor <= this.limit_backward) { + return false; + } + ch = this.current.charCodeAt(this.cursor - 1); + if (ch > max || ch < min) { + return false; + } + this.cursor--; + return true; +}; + +/** + * @param {!number} min + * @param {!number} max + * @return {!boolean} + */ +BaseStemmer.prototype.out_range$II = function (min, max) { + /** @type {!number} */ + var ch; + if (this.cursor >= this.limit) { + return false; + } + ch = this.current.charCodeAt(this.cursor); + if (! (ch > max || ch < min)) { + return false; + } + this.cursor++; + return true; +}; + +/** + * @param {!number} min + * @param {!number} max + * @return {!boolean} + */ +BaseStemmer.prototype.out_range_b$II = function (min, max) { + /** @type {!number} */ + var ch; + if (this.cursor <= this.limit_backward) { + return false; + } + ch = this.current.charCodeAt(this.cursor - 1); + if (! (ch > max || ch < min)) { + return false; + } + this.cursor--; + return true; +}; + +/** + * @param {!number} s_size + * @param {!string} s + * @return {!boolean} + */ +BaseStemmer.prototype.eq_s$IS = function (s_size, s) { + /** @type {!number} */ + var cursor$0; + if (this.limit - this.cursor < s_size) { + return false; + } + if (this.current.slice(cursor$0 = this.cursor, cursor$0 + s_size) !== s) { + return false; + } + this.cursor += s_size; + return true; +}; + +/** + * @param {!number} s_size + * @param {!string} s + * @return {!boolean} + */ +BaseStemmer.prototype.eq_s_b$IS = function (s_size, s) { + /** @type {!number} */ + var cursor$0; + if (this.cursor - this.limit_backward < s_size) { + return false; + } + if (this.current.slice((cursor$0 = this.cursor) - s_size, cursor$0) !== s) { + return false; + } + this.cursor -= s_size; + return true; +}; + +/** + * @param {!string} s + * @return {!boolean} + */ +BaseStemmer.prototype.eq_v$S = function (s) { + return this.eq_s$IS(s.length, s); +}; + +/** + * @param {!string} s + * @return {!boolean} + */ +BaseStemmer.prototype.eq_v_b$S = function (s) { + return this.eq_s_b$IS(s.length, s); +}; + +/** + * @param {Array.<undefined|Among>} v + * @param {!number} v_size + * @return {!number} + */ +BaseStemmer.prototype.find_among$ALAmong$I = function (v, v_size) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var j; + /** @type {!number} */ + var c; + /** @type {!number} */ + var l; + /** @type {!number} */ + var common_i; + /** @type {!number} */ + var common_j; + /** @type {!boolean} */ + var first_key_inspected; + /** @type {!number} */ + var k; + /** @type {!number} */ + var diff; + /** @type {!number} */ + var common; + /** @type {Among} */ + var w; + /** @type {!number} */ + var i2; + /** @type {!boolean} */ + var res; + i = 0; + j = v_size; + c = this.cursor; + l = this.limit; + common_i = 0; + common_j = 0; + first_key_inspected = false; + while (true) { + k = i + (j - i >>> 1); + diff = 0; + common = (common_i < common_j ? common_i : common_j); + w = v[k]; + for (i2 = common; i2 < w.s_size; i2++) { + if (c + common === l) { + diff = -1; + break; + } + diff = this.current.charCodeAt(c + common) - w.s.charCodeAt(i2); + if (diff !== 0) { + break; + } + common++; + } + if (diff < 0) { + j = k; + common_j = common; + } else { + i = k; + common_i = common; + } + if (j - i <= 1) { + if (i > 0) { + break; + } + if (j === i) { + break; + } + if (first_key_inspected) { + break; + } + first_key_inspected = true; + } + } + while (true) { + w = v[i]; + if (common_i >= w.s_size) { + this.cursor = (c + w.s_size | 0); + if (w.method == null) { + return w.result; + } + res = w.method(w.instance); + this.cursor = (c + w.s_size | 0); + if (res) { + return w.result; + } + } + i = w.substring_i; + if (i < 0) { + return 0; + } + } + return -1; +}; + +/** + * @param {Array.<undefined|Among>} v + * @param {!number} v_size + * @return {!number} + */ +BaseStemmer.prototype.find_among_b$ALAmong$I = function (v, v_size) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var j; + /** @type {!number} */ + var c; + /** @type {!number} */ + var lb; + /** @type {!number} */ + var common_i; + /** @type {!number} */ + var common_j; + /** @type {!boolean} */ + var first_key_inspected; + /** @type {!number} */ + var k; + /** @type {!number} */ + var diff; + /** @type {!number} */ + var common; + /** @type {Among} */ + var w; + /** @type {!number} */ + var i2; + /** @type {!boolean} */ + var res; + i = 0; + j = v_size; + c = this.cursor; + lb = this.limit_backward; + common_i = 0; + common_j = 0; + first_key_inspected = false; + while (true) { + k = i + (j - i >> 1); + diff = 0; + common = (common_i < common_j ? common_i : common_j); + w = v[k]; + for (i2 = w.s_size - 1 - common; i2 >= 0; i2--) { + if (c - common === lb) { + diff = -1; + break; + } + diff = this.current.charCodeAt(c - 1 - common) - w.s.charCodeAt(i2); + if (diff !== 0) { + break; + } + common++; + } + if (diff < 0) { + j = k; + common_j = common; + } else { + i = k; + common_i = common; + } + if (j - i <= 1) { + if (i > 0) { + break; + } + if (j === i) { + break; + } + if (first_key_inspected) { + break; + } + first_key_inspected = true; + } + } + while (true) { + w = v[i]; + if (common_i >= w.s_size) { + this.cursor = (c - w.s_size | 0); + if (w.method == null) { + return w.result; + } + res = w.method(this); + this.cursor = (c - w.s_size | 0); + if (res) { + return w.result; + } + } + i = w.substring_i; + if (i < 0) { + return 0; + } + } + return -1; +}; + +/** + * @param {!number} c_bra + * @param {!number} c_ket + * @param {!string} s + * @return {!number} + */ +BaseStemmer.prototype.replace_s$IIS = function (c_bra, c_ket, s) { + /** @type {!number} */ + var adjustment; + adjustment = s.length - (c_ket - c_bra); + this.current = this.current.slice(0, c_bra) + s + this.current.slice(c_ket); + this.limit += (adjustment | 0); + if (this.cursor >= c_ket) { + this.cursor += (adjustment | 0); + } else { + if (this.cursor > c_bra) { + this.cursor = c_bra; + } + } + return (adjustment | 0); +}; + +/** + * @return {!boolean} + */ +BaseStemmer.prototype.slice_check$ = function () { + /** @type {!number} */ + var bra$0; + /** @type {!number} */ + var ket$0; + /** @type {!number} */ + var limit$0; + return ((bra$0 = this.bra) < 0 || bra$0 > (ket$0 = this.ket) || ket$0 > (limit$0 = this.limit) || limit$0 > this.current.length ? false : true); +}; + +/** + * @param {!string} s + * @return {!boolean} + */ +BaseStemmer.prototype.slice_from$S = function (s) { + /** @type {!boolean} */ + var result; + /** @type {!number} */ + var bra$0; + /** @type {!number} */ + var ket$0; + /** @type {!number} */ + var limit$0; + result = false; + if ((bra$0 = this.bra) < 0 || bra$0 > (ket$0 = this.ket) || ket$0 > (limit$0 = this.limit) || limit$0 > this.current.length ? false : true) { + this.replace_s$IIS(this.bra, this.ket, s); + result = true; + } + return result; +}; + +/** + * @return {!boolean} + */ +BaseStemmer.prototype.slice_del$ = function () { + return this.slice_from$S(""); +}; + +/** + * @param {!number} c_bra + * @param {!number} c_ket + * @param {!string} s + */ +BaseStemmer.prototype.insert$IIS = function (c_bra, c_ket, s) { + /** @type {!number} */ + var adjustment; + adjustment = this.replace_s$IIS(c_bra, c_ket, s); + if (c_bra <= this.bra) { + this.bra += (adjustment | 0); + } + if (c_bra <= this.ket) { + this.ket += (adjustment | 0); + } +}; + +/** + * @param {!string} s + * @return {!string} + */ +BaseStemmer.prototype.slice_to$S = function (s) { + /** @type {!string} */ + var result; + /** @type {!number} */ + var bra$0; + /** @type {!number} */ + var ket$0; + /** @type {!number} */ + var limit$0; + result = ''; + if ((bra$0 = this.bra) < 0 || bra$0 > (ket$0 = this.ket) || ket$0 > (limit$0 = this.limit) || limit$0 > this.current.length ? false : true) { + result = this.current.slice(this.bra, this.ket); + } + return result; +}; + +/** + * @param {!string} s + * @return {!string} + */ +BaseStemmer.prototype.assign_to$S = function (s) { + return this.current.slice(0, this.limit); +}; + +/** + * @return {!boolean} + */ +BaseStemmer.prototype.stem$ = function () { + return false; +}; + +/** + * @param {!string} word + * @return {!string} + */ +BaseStemmer.prototype.stemWord$S = function (word) { + /** @type {undefined|!string} */ + var result; + /** @type {!string} */ + var current$0; + /** @type {!number} */ + var cursor$0; + /** @type {!number} */ + var limit$0; + result = this.cache['.' + word]; + if (result == null) { + current$0 = this.current = word; + cursor$0 = this.cursor = 0; + limit$0 = this.limit = current$0.length; + this.limit_backward = 0; + this.bra = cursor$0; + this.ket = limit$0; + this.stem$(); + result = this.current; + this.cache['.' + word] = result; + } + return result; +}; + +/** + * @param {Array.<undefined|!string>} words + * @return {Array.<undefined|!string>} + */ +BaseStemmer.prototype.stemWords$AS = function (words) { + /** @type {Array.<undefined|!string>} */ + var results; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var word; + /** @type {undefined|!string} */ + var result; + /** @type {!string} */ + var current$0; + /** @type {!number} */ + var cursor$0; + /** @type {!number} */ + var limit$0; + results = [ ]; + for (i = 0; i < words.length; i++) { + word = words[i]; + result = this.cache['.' + word]; + if (result == null) { + current$0 = this.current = word; + cursor$0 = this.cursor = 0; + limit$0 = this.limit = current$0.length; + this.limit_backward = 0; + this.bra = cursor$0; + this.ket = limit$0; + this.stem$(); + result = this.current; + this.cache['.' + word] = result; + } + results.push(result); + } + return results; +}; + +/** + * class EnglishStemmer extends BaseStemmer + * @constructor + */ +function EnglishStemmer() { +} + +EnglishStemmer.prototype = new BaseStemmer; +/** + * @constructor + */ +function EnglishStemmer$() { + BaseStemmer$.call(this); + this.B_Y_found = false; + this.I_p2 = 0; + this.I_p1 = 0; +}; + +EnglishStemmer$.prototype = new EnglishStemmer; + +/** + * @param {EnglishStemmer} other + */ +EnglishStemmer.prototype.copy_from$LEnglishStemmer$ = function (other) { + this.B_Y_found = other.B_Y_found; + this.I_p2 = other.I_p2; + this.I_p1 = other.I_p1; + BaseStemmer.prototype.copy_from$LBaseStemmer$.call(this, other); +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_prelude$ = function () { + /** @type {!number} */ + var v_1; + /** @type {!number} */ + var v_2; + /** @type {!number} */ + var v_3; + /** @type {!number} */ + var v_4; + /** @type {!number} */ + var v_5; + /** @type {!boolean} */ + var lab0; + /** @type {!boolean} */ + var lab1; + /** @type {!boolean} */ + var lab2; + /** @type {!boolean} */ + var lab4; + /** @type {!boolean} */ + var lab6; + /** @type {!number} */ + var cursor$0; + /** @type {!number} */ + var cursor$1; + /** @type {!number} */ + var cursor$2; + this.B_Y_found = false; + v_1 = this.cursor; + lab0 = true; +lab0: + while (lab0 === true) { + lab0 = false; + this.bra = this.cursor; + if (! this.eq_s$IS(1, "'")) { + break lab0; + } + this.ket = this.cursor; + if (! this.slice_from$S("")) { + return false; + } + } + cursor$0 = this.cursor = v_1; + v_2 = cursor$0; + lab1 = true; +lab1: + while (lab1 === true) { + lab1 = false; + this.bra = this.cursor; + if (! this.eq_s$IS(1, "y")) { + break lab1; + } + this.ket = this.cursor; + if (! this.slice_from$S("Y")) { + return false; + } + this.B_Y_found = true; + } + cursor$2 = this.cursor = v_2; + v_3 = cursor$2; + lab2 = true; +lab2: + while (lab2 === true) { + lab2 = false; + replab3: + while (true) { + v_4 = this.cursor; + lab4 = true; + lab4: + while (lab4 === true) { + lab4 = false; + golab5: + while (true) { + v_5 = this.cursor; + lab6 = true; + lab6: + while (lab6 === true) { + lab6 = false; + if (! this.in_grouping$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab6; + } + this.bra = this.cursor; + if (! this.eq_s$IS(1, "y")) { + break lab6; + } + this.ket = this.cursor; + this.cursor = v_5; + break golab5; + } + cursor$1 = this.cursor = v_5; + if (cursor$1 >= this.limit) { + break lab4; + } + this.cursor++; + } + if (! this.slice_from$S("Y")) { + return false; + } + this.B_Y_found = true; + continue replab3; + } + this.cursor = v_4; + break replab3; + } + } + this.cursor = v_3; + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_mark_regions$ = function () { + /** @type {!number} */ + var v_1; + /** @type {!number} */ + var v_2; + /** @type {!boolean} */ + var lab0; + /** @type {!boolean} */ + var lab1; + /** @type {!boolean} */ + var lab2; + /** @type {!boolean} */ + var lab4; + /** @type {!boolean} */ + var lab6; + /** @type {!boolean} */ + var lab8; + /** @type {!boolean} */ + var lab10; + /** @type {!number} */ + var limit$0; + this.I_p1 = limit$0 = this.limit; + this.I_p2 = limit$0; + v_1 = this.cursor; + lab0 = true; +lab0: + while (lab0 === true) { + lab0 = false; + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + v_2 = this.cursor; + lab2 = true; + lab2: + while (lab2 === true) { + lab2 = false; + if (this.find_among$ALAmong$I(EnglishStemmer.a_0, 3) === 0) { + break lab2; + } + break lab1; + } + this.cursor = v_2; + golab3: + while (true) { + lab4 = true; + lab4: + while (lab4 === true) { + lab4 = false; + if (! this.in_grouping$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab4; + } + break golab3; + } + if (this.cursor >= this.limit) { + break lab0; + } + this.cursor++; + } + golab5: + while (true) { + lab6 = true; + lab6: + while (lab6 === true) { + lab6 = false; + if (! this.out_grouping$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab6; + } + break golab5; + } + if (this.cursor >= this.limit) { + break lab0; + } + this.cursor++; + } + } + this.I_p1 = this.cursor; + golab7: + while (true) { + lab8 = true; + lab8: + while (lab8 === true) { + lab8 = false; + if (! this.in_grouping$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab8; + } + break golab7; + } + if (this.cursor >= this.limit) { + break lab0; + } + this.cursor++; + } + golab9: + while (true) { + lab10 = true; + lab10: + while (lab10 === true) { + lab10 = false; + if (! this.out_grouping$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab10; + } + break golab9; + } + if (this.cursor >= this.limit) { + break lab0; + } + this.cursor++; + } + this.I_p2 = this.cursor; + } + this.cursor = v_1; + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_shortv$ = function () { + /** @type {!number} */ + var v_1; + /** @type {!boolean} */ + var lab0; + /** @type {!boolean} */ + var lab1; + lab0 = true; +lab0: + while (lab0 === true) { + lab0 = false; + v_1 = this.limit - this.cursor; + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + if (! this.out_grouping_b$AIII(EnglishStemmer.g_v_WXY, 89, 121)) { + break lab1; + } + if (! this.in_grouping_b$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab1; + } + if (! this.out_grouping_b$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab1; + } + break lab0; + } + this.cursor = this.limit - v_1; + if (! this.out_grouping_b$AIII(EnglishStemmer.g_v, 97, 121)) { + return false; + } + if (! this.in_grouping_b$AIII(EnglishStemmer.g_v, 97, 121)) { + return false; + } + if (this.cursor > this.limit_backward) { + return false; + } + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_R1$ = function () { + return (! (this.I_p1 <= this.cursor) ? false : true); +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_R2$ = function () { + return (! (this.I_p2 <= this.cursor) ? false : true); +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_Step_1a$ = function () { + /** @type {!number} */ + var among_var; + /** @type {!number} */ + var v_1; + /** @type {!number} */ + var v_2; + /** @type {!boolean} */ + var lab0; + /** @type {!boolean} */ + var lab1; + /** @type {!boolean} */ + var lab2; + /** @type {!number} */ + var c; + /** @type {!boolean} */ + var lab4; + v_1 = this.limit - this.cursor; + lab0 = true; +lab0: + while (lab0 === true) { + lab0 = false; + this.ket = this.cursor; + among_var = this.find_among_b$ALAmong$I(EnglishStemmer.a_1, 3); + if (among_var === 0) { + this.cursor = this.limit - v_1; + break lab0; + } + this.bra = this.cursor; + switch (among_var) { + case 0: + this.cursor = this.limit - v_1; + break lab0; + case 1: + if (! this.slice_from$S("")) { + return false; + } + break; + } + } + this.ket = this.cursor; + among_var = this.find_among_b$ALAmong$I(EnglishStemmer.a_2, 6); + if (among_var === 0) { + return false; + } + this.bra = this.cursor; + switch (among_var) { + case 0: + return false; + case 1: + if (! this.slice_from$S("ss")) { + return false; + } + break; + case 2: + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + v_2 = this.limit - this.cursor; + lab2 = true; + lab2: + while (lab2 === true) { + lab2 = false; + c = (this.cursor - 2 | 0); + if (this.limit_backward > c || c > this.limit) { + break lab2; + } + this.cursor = c; + if (! this.slice_from$S("i")) { + return false; + } + break lab1; + } + this.cursor = this.limit - v_2; + if (! this.slice_from$S("ie")) { + return false; + } + } + break; + case 3: + if (this.cursor <= this.limit_backward) { + return false; + } + this.cursor--; + golab3: + while (true) { + lab4 = true; + lab4: + while (lab4 === true) { + lab4 = false; + if (! this.in_grouping_b$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab4; + } + break golab3; + } + if (this.cursor <= this.limit_backward) { + return false; + } + this.cursor--; + } + if (! this.slice_from$S("")) { + return false; + } + break; + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_Step_1b$ = function () { + /** @type {!number} */ + var among_var; + /** @type {!number} */ + var v_1; + /** @type {!number} */ + var v_3; + /** @type {!number} */ + var v_4; + /** @type {!boolean} */ + var lab1; + /** @type {!number} */ + var c; + /** @type {!number} */ + var cursor$0; + /** @type {!number} */ + var cursor$1; + /** @type {!number} */ + var cursor$2; + this.ket = this.cursor; + among_var = this.find_among_b$ALAmong$I(EnglishStemmer.a_4, 6); + if (among_var === 0) { + return false; + } + this.bra = this.cursor; + switch (among_var) { + case 0: + return false; + case 1: + if (! (! (this.I_p1 <= this.cursor) ? false : true)) { + return false; + } + if (! this.slice_from$S("ee")) { + return false; + } + break; + case 2: + v_1 = this.limit - this.cursor; + golab0: + while (true) { + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + if (! this.in_grouping_b$AIII(EnglishStemmer.g_v, 97, 121)) { + break lab1; + } + break golab0; + } + if (this.cursor <= this.limit_backward) { + return false; + } + this.cursor--; + } + this.cursor = this.limit - v_1; + if (! this.slice_from$S("")) { + return false; + } + v_3 = this.limit - this.cursor; + among_var = this.find_among_b$ALAmong$I(EnglishStemmer.a_3, 13); + if (among_var === 0) { + return false; + } + this.cursor = this.limit - v_3; + switch (among_var) { + case 0: + return false; + case 1: + c = cursor$0 = this.cursor; + this.insert$IIS(cursor$0, cursor$0, "e"); + this.cursor = c; + break; + case 2: + this.ket = cursor$1 = this.cursor; + if (cursor$1 <= this.limit_backward) { + return false; + } + this.cursor--; + this.bra = this.cursor; + if (! this.slice_from$S("")) { + return false; + } + break; + case 3: + if (this.cursor !== this.I_p1) { + return false; + } + v_4 = this.limit - this.cursor; + if (! this.r_shortv$()) { + return false; + } + cursor$2 = this.cursor = this.limit - v_4; + c = cursor$2; + this.insert$IIS(cursor$2, cursor$2, "e"); + this.cursor = cursor$2; + break; + } + break; + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_Step_1c$ = function () { + /** @type {!number} */ + var v_1; + /** @type {!number} */ + var v_2; + /** @type {!boolean} */ + var lab0; + /** @type {!boolean} */ + var lab1; + /** @type {!boolean} */ + var lab2; + this.ket = this.cursor; + lab0 = true; +lab0: + while (lab0 === true) { + lab0 = false; + v_1 = this.limit - this.cursor; + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + if (! this.eq_s_b$IS(1, "y")) { + break lab1; + } + break lab0; + } + this.cursor = this.limit - v_1; + if (! this.eq_s_b$IS(1, "Y")) { + return false; + } + } + this.bra = this.cursor; + if (! this.out_grouping_b$AIII(EnglishStemmer.g_v, 97, 121)) { + return false; + } + v_2 = this.limit - this.cursor; + lab2 = true; +lab2: + while (lab2 === true) { + lab2 = false; + if (this.cursor > this.limit_backward) { + break lab2; + } + return false; + } + this.cursor = this.limit - v_2; + return (! this.slice_from$S("i") ? false : true); +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_Step_2$ = function () { + /** @type {!number} */ + var among_var; + /** @type {!number} */ + var cursor$0; + this.ket = this.cursor; + among_var = this.find_among_b$ALAmong$I(EnglishStemmer.a_5, 24); + if (among_var === 0) { + return false; + } + this.bra = cursor$0 = this.cursor; + if (! (! (this.I_p1 <= cursor$0) ? false : true)) { + return false; + } + switch (among_var) { + case 0: + return false; + case 1: + if (! this.slice_from$S("tion")) { + return false; + } + break; + case 2: + if (! this.slice_from$S("ence")) { + return false; + } + break; + case 3: + if (! this.slice_from$S("ance")) { + return false; + } + break; + case 4: + if (! this.slice_from$S("able")) { + return false; + } + break; + case 5: + if (! this.slice_from$S("ent")) { + return false; + } + break; + case 6: + if (! this.slice_from$S("ize")) { + return false; + } + break; + case 7: + if (! this.slice_from$S("ate")) { + return false; + } + break; + case 8: + if (! this.slice_from$S("al")) { + return false; + } + break; + case 9: + if (! this.slice_from$S("ful")) { + return false; + } + break; + case 10: + if (! this.slice_from$S("ous")) { + return false; + } + break; + case 11: + if (! this.slice_from$S("ive")) { + return false; + } + break; + case 12: + if (! this.slice_from$S("ble")) { + return false; + } + break; + case 13: + if (! this.eq_s_b$IS(1, "l")) { + return false; + } + if (! this.slice_from$S("og")) { + return false; + } + break; + case 14: + if (! this.slice_from$S("ful")) { + return false; + } + break; + case 15: + if (! this.slice_from$S("less")) { + return false; + } + break; + case 16: + if (! this.in_grouping_b$AIII(EnglishStemmer.g_valid_LI, 99, 116)) { + return false; + } + if (! this.slice_from$S("")) { + return false; + } + break; + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_Step_3$ = function () { + /** @type {!number} */ + var among_var; + /** @type {!number} */ + var cursor$0; + this.ket = this.cursor; + among_var = this.find_among_b$ALAmong$I(EnglishStemmer.a_6, 9); + if (among_var === 0) { + return false; + } + this.bra = cursor$0 = this.cursor; + if (! (! (this.I_p1 <= cursor$0) ? false : true)) { + return false; + } + switch (among_var) { + case 0: + return false; + case 1: + if (! this.slice_from$S("tion")) { + return false; + } + break; + case 2: + if (! this.slice_from$S("ate")) { + return false; + } + break; + case 3: + if (! this.slice_from$S("al")) { + return false; + } + break; + case 4: + if (! this.slice_from$S("ic")) { + return false; + } + break; + case 5: + if (! this.slice_from$S("")) { + return false; + } + break; + case 6: + if (! (! (this.I_p2 <= this.cursor) ? false : true)) { + return false; + } + if (! this.slice_from$S("")) { + return false; + } + break; + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_Step_4$ = function () { + /** @type {!number} */ + var among_var; + /** @type {!number} */ + var v_1; + /** @type {!boolean} */ + var lab0; + /** @type {!boolean} */ + var lab1; + /** @type {!number} */ + var cursor$0; + this.ket = this.cursor; + among_var = this.find_among_b$ALAmong$I(EnglishStemmer.a_7, 18); + if (among_var === 0) { + return false; + } + this.bra = cursor$0 = this.cursor; + if (! (! (this.I_p2 <= cursor$0) ? false : true)) { + return false; + } + switch (among_var) { + case 0: + return false; + case 1: + if (! this.slice_from$S("")) { + return false; + } + break; + case 2: + lab0 = true; + lab0: + while (lab0 === true) { + lab0 = false; + v_1 = this.limit - this.cursor; + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + if (! this.eq_s_b$IS(1, "s")) { + break lab1; + } + break lab0; + } + this.cursor = this.limit - v_1; + if (! this.eq_s_b$IS(1, "t")) { + return false; + } + } + if (! this.slice_from$S("")) { + return false; + } + break; + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_Step_5$ = function () { + /** @type {!number} */ + var among_var; + /** @type {!number} */ + var v_1; + /** @type {!number} */ + var v_2; + /** @type {!boolean} */ + var lab0; + /** @type {!boolean} */ + var lab1; + /** @type {!boolean} */ + var lab2; + /** @type {!number} */ + var cursor$0; + this.ket = this.cursor; + among_var = this.find_among_b$ALAmong$I(EnglishStemmer.a_8, 2); + if (among_var === 0) { + return false; + } + this.bra = this.cursor; + switch (among_var) { + case 0: + return false; + case 1: + lab0 = true; + lab0: + while (lab0 === true) { + lab0 = false; + v_1 = this.limit - this.cursor; + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + if (! (! (this.I_p2 <= this.cursor) ? false : true)) { + break lab1; + } + break lab0; + } + cursor$0 = this.cursor = this.limit - v_1; + if (! (! (this.I_p1 <= cursor$0) ? false : true)) { + return false; + } + v_2 = this.limit - this.cursor; + lab2 = true; + lab2: + while (lab2 === true) { + lab2 = false; + if (! this.r_shortv$()) { + break lab2; + } + return false; + } + this.cursor = this.limit - v_2; + } + if (! this.slice_from$S("")) { + return false; + } + break; + case 2: + if (! (! (this.I_p2 <= this.cursor) ? false : true)) { + return false; + } + if (! this.eq_s_b$IS(1, "l")) { + return false; + } + if (! this.slice_from$S("")) { + return false; + } + break; + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_exception2$ = function () { + /** @type {!number} */ + var cursor$0; + this.ket = this.cursor; + if (this.find_among_b$ALAmong$I(EnglishStemmer.a_9, 8) === 0) { + return false; + } + this.bra = cursor$0 = this.cursor; + return (cursor$0 > this.limit_backward ? false : true); +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_exception1$ = function () { + /** @type {!number} */ + var among_var; + /** @type {!number} */ + var cursor$0; + this.bra = this.cursor; + among_var = this.find_among$ALAmong$I(EnglishStemmer.a_10, 18); + if (among_var === 0) { + return false; + } + this.ket = cursor$0 = this.cursor; + if (cursor$0 < this.limit) { + return false; + } + switch (among_var) { + case 0: + return false; + case 1: + if (! this.slice_from$S("ski")) { + return false; + } + break; + case 2: + if (! this.slice_from$S("sky")) { + return false; + } + break; + case 3: + if (! this.slice_from$S("die")) { + return false; + } + break; + case 4: + if (! this.slice_from$S("lie")) { + return false; + } + break; + case 5: + if (! this.slice_from$S("tie")) { + return false; + } + break; + case 6: + if (! this.slice_from$S("idl")) { + return false; + } + break; + case 7: + if (! this.slice_from$S("gentl")) { + return false; + } + break; + case 8: + if (! this.slice_from$S("ugli")) { + return false; + } + break; + case 9: + if (! this.slice_from$S("earli")) { + return false; + } + break; + case 10: + if (! this.slice_from$S("onli")) { + return false; + } + break; + case 11: + if (! this.slice_from$S("singl")) { + return false; + } + break; + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.r_postlude$ = function () { + /** @type {!number} */ + var v_1; + /** @type {!number} */ + var v_2; + /** @type {!boolean} */ + var lab1; + /** @type {!boolean} */ + var lab3; + /** @type {!number} */ + var cursor$0; + if (! this.B_Y_found) { + return false; + } +replab0: + while (true) { + v_1 = this.cursor; + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + golab2: + while (true) { + v_2 = this.cursor; + lab3 = true; + lab3: + while (lab3 === true) { + lab3 = false; + this.bra = this.cursor; + if (! this.eq_s$IS(1, "Y")) { + break lab3; + } + this.ket = this.cursor; + this.cursor = v_2; + break golab2; + } + cursor$0 = this.cursor = v_2; + if (cursor$0 >= this.limit) { + break lab1; + } + this.cursor++; + } + if (! this.slice_from$S("y")) { + return false; + } + continue replab0; + } + this.cursor = v_1; + break replab0; + } + return true; +}; + +/** + * @return {!boolean} + */ +EnglishStemmer.prototype.stem$ = function () { + /** @type {!number} */ + var v_1; + /** @type {!number} */ + var v_2; + /** @type {!number} */ + var v_3; + /** @type {!number} */ + var v_4; + /** @type {!number} */ + var v_5; + /** @type {!number} */ + var v_6; + /** @type {!number} */ + var v_7; + /** @type {!number} */ + var v_8; + /** @type {!number} */ + var v_9; + /** @type {!number} */ + var v_10; + /** @type {!number} */ + var v_11; + /** @type {!number} */ + var v_12; + /** @type {!number} */ + var v_13; + /** @type {!boolean} */ + var lab0; + /** @type {!boolean} */ + var lab1; + /** @type {!boolean} */ + var lab2; + /** @type {!boolean} */ + var lab3; + /** @type {!number} */ + var c; + /** @type {!boolean} */ + var lab4; + /** @type {!boolean} */ + var lab5; + /** @type {!boolean} */ + var lab6; + /** @type {!boolean} */ + var lab7; + /** @type {!boolean} */ + var lab8; + /** @type {!boolean} */ + var lab9; + /** @type {!boolean} */ + var lab10; + /** @type {!boolean} */ + var lab11; + /** @type {!boolean} */ + var lab12; + /** @type {!boolean} */ + var lab13; + /** @type {!boolean} */ + var lab14; + /** @type {!boolean} */ + var lab15; + /** @type {!number} */ + var cursor$0; + /** @type {!number} */ + var cursor$1; + /** @type {!number} */ + var cursor$2; + /** @type {!number} */ + var limit$0; + /** @type {!number} */ + var cursor$3; + /** @type {!number} */ + var limit$1; + /** @type {!number} */ + var cursor$4; + /** @type {!number} */ + var limit$2; + /** @type {!number} */ + var cursor$5; + /** @type {!number} */ + var limit$3; + /** @type {!number} */ + var cursor$6; + /** @type {!number} */ + var limit$4; + /** @type {!number} */ + var cursor$7; + /** @type {!number} */ + var limit$5; + /** @type {!number} */ + var cursor$8; + /** @type {!number} */ + var limit$6; + /** @type {!number} */ + var cursor$9; + /** @type {!number} */ + var cursor$10; + lab0 = true; +lab0: + while (lab0 === true) { + lab0 = false; + v_1 = this.cursor; + lab1 = true; + lab1: + while (lab1 === true) { + lab1 = false; + if (! this.r_exception1$()) { + break lab1; + } + break lab0; + } + this.cursor = v_1; + lab2 = true; + lab2: + while (lab2 === true) { + lab2 = false; + v_2 = this.cursor; + lab3 = true; + lab3: + while (lab3 === true) { + lab3 = false; + c = (this.cursor + 3 | 0); + if (0 > c || c > this.limit) { + break lab3; + } + this.cursor = c; + break lab2; + } + this.cursor = v_2; + break lab0; + } + cursor$0 = this.cursor = v_1; + v_3 = cursor$0; + lab4 = true; + lab4: + while (lab4 === true) { + lab4 = false; + if (! this.r_prelude$()) { + break lab4; + } + } + cursor$1 = this.cursor = v_3; + v_4 = cursor$1; + lab5 = true; + lab5: + while (lab5 === true) { + lab5 = false; + if (! this.r_mark_regions$()) { + break lab5; + } + } + cursor$2 = this.cursor = v_4; + this.limit_backward = cursor$2; + cursor$3 = this.cursor = limit$0 = this.limit; + v_5 = limit$0 - cursor$3; + lab6 = true; + lab6: + while (lab6 === true) { + lab6 = false; + if (! this.r_Step_1a$()) { + break lab6; + } + } + this.cursor = this.limit - v_5; + lab7 = true; + lab7: + while (lab7 === true) { + lab7 = false; + v_6 = this.limit - this.cursor; + lab8 = true; + lab8: + while (lab8 === true) { + lab8 = false; + if (! this.r_exception2$()) { + break lab8; + } + break lab7; + } + cursor$4 = this.cursor = (limit$1 = this.limit) - v_6; + v_7 = limit$1 - cursor$4; + lab9 = true; + lab9: + while (lab9 === true) { + lab9 = false; + if (! this.r_Step_1b$()) { + break lab9; + } + } + cursor$5 = this.cursor = (limit$2 = this.limit) - v_7; + v_8 = limit$2 - cursor$5; + lab10 = true; + lab10: + while (lab10 === true) { + lab10 = false; + if (! this.r_Step_1c$()) { + break lab10; + } + } + cursor$6 = this.cursor = (limit$3 = this.limit) - v_8; + v_9 = limit$3 - cursor$6; + lab11 = true; + lab11: + while (lab11 === true) { + lab11 = false; + if (! this.r_Step_2$()) { + break lab11; + } + } + cursor$7 = this.cursor = (limit$4 = this.limit) - v_9; + v_10 = limit$4 - cursor$7; + lab12 = true; + lab12: + while (lab12 === true) { + lab12 = false; + if (! this.r_Step_3$()) { + break lab12; + } + } + cursor$8 = this.cursor = (limit$5 = this.limit) - v_10; + v_11 = limit$5 - cursor$8; + lab13 = true; + lab13: + while (lab13 === true) { + lab13 = false; + if (! this.r_Step_4$()) { + break lab13; + } + } + cursor$9 = this.cursor = (limit$6 = this.limit) - v_11; + v_12 = limit$6 - cursor$9; + lab14 = true; + lab14: + while (lab14 === true) { + lab14 = false; + if (! this.r_Step_5$()) { + break lab14; + } + } + this.cursor = this.limit - v_12; + } + cursor$10 = this.cursor = this.limit_backward; + v_13 = cursor$10; + lab15 = true; + lab15: + while (lab15 === true) { + lab15 = false; + if (! this.r_postlude$()) { + break lab15; + } + } + this.cursor = v_13; + } + return true; +}; + +/** + * @param {*} o + * @return {!boolean} + */ +EnglishStemmer.prototype.equals$X = function (o) { + return o instanceof EnglishStemmer; +}; + +/** + * @return {!number} + */ +EnglishStemmer.prototype.hashCode$ = function () { + /** @type {!string} */ + var classname; + /** @type {!number} */ + var hash; + /** @type {!number} */ + var i; + /** @type {!number} */ + var char; + classname = "EnglishStemmer"; + hash = 0; + if ("EnglishStemmer".length === 0) { + return (hash | 0); + } + for (i = 0; i < classname.length; i++) { + char = classname.charCodeAt(i); + hash = (hash << 5) - hash + char; + hash = hash & hash; + } + return (hash | 0); +}; + +/** + * class Among extends Object + * @constructor + */ +function Among() { +} + +/** + * @constructor + * @param {!string} s + * @param {!number} substring_i + * @param {!number} result + */ +function Among$SII(s, substring_i, result) { + this.s_size = s.length; + this.s = s; + this.substring_i = substring_i; + this.result = result; + this.method = null; + this.instance = null; +}; + +Among$SII.prototype = new Among; + +/** + * @constructor + * @param {!string} s + * @param {!number} substring_i + * @param {!number} result + * @param {*} method + * @param {BaseStemmer} instance + */ +function Among$SIIF$LBaseStemmer$B$LBaseStemmer$(s, substring_i, result, method, instance) { + this.s_size = s.length; + this.s = s; + this.substring_i = substring_i; + this.result = result; + this.method = method; + this.instance = instance; +}; + +Among$SIIF$LBaseStemmer$B$LBaseStemmer$.prototype = new Among; + +/** + * class Metadata extends Object + * @constructor + */ +function Metadata() { +} + +/** + * @constructor + * @param {Oktavia} parent + */ +function Metadata$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); +}; + +Metadata$LOktavia$.prototype = new Metadata; + +/** + * @return {!number} + */ +Metadata.prototype._size$ = function () { + /** @type {BitVector} */ + var this$0; + /** @type {!number} */ + var i$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0 = _bitVector$0 = this._bitVector; + i$0 = _bitVector$0._size; + return this$0.rank$IB(i$0, true); +}; + +/** + * @param {!number} index + * @return {!string} + */ +Metadata.prototype.getContent$I = function (index) { + /** @type {!number} */ + var startPosition; + /** @type {!number} */ + var length; + if (index < 0 || this._size$() <= index) { + throw new Error("Section.getContent() : range error " + (index + "")); + } + startPosition = 0; + if (index > 0) { + startPosition = this._bitVector.select$I(index - 1) + 1; + } + length = this._bitVector.select$I(index) - startPosition + 1; + return this._parent._getSubstring$II(startPosition, length); +}; + +/** + * @param {!number} index + * @return {!number} + */ +Metadata.prototype.getStartPosition$I = function (index) { + /** @type {!number} */ + var startPosition; + if (index < 0 || this._size$() <= index) { + throw new Error("Section.getContent() : range error " + (index + "")); + } + startPosition = 0; + if (index > 0) { + startPosition = this._bitVector.select$I(index - 1) + 1; + } + return (startPosition | 0); +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Metadata.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Metadata.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + */ +Metadata.prototype._build$ = function () { + this._bitVector.build$(); +}; + +/** + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Metadata.prototype._load$SSI = function (name, data, offset) { + offset = this._bitVector.load$SI(data, offset); + this._parent._metadataLabels.push(name); + this._parent._metadatas[name] = this; + return offset; +}; + +/** + * @return {!string} + */ +Metadata.prototype._dump$ = function () { + /** @type {BitVector} */ + var this$0; + /** @type {Array.<undefined|!string>} */ + var contents$0; + this$0 = this._bitVector; + contents$0 = [ ]; + contents$0.push(Binary$dump32bitNumber$N(this$0._size)); + contents$0.push(Binary$dump32bitNumberList$AN(this$0._v)); + return contents$0.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Metadata.prototype._dump$LCompressionReport$ = function (report) { + /** @type {BitVector} */ + var this$0; + /** @type {Array.<undefined|!string>} */ + var contents$0; + this$0 = this._bitVector; + contents$0 = [ ]; + contents$0.push(Binary$dump32bitNumber$N(this$0._size)); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents$0.push(Binary$dump32bitNumberList$ANLCompressionReport$(this$0._v, report)); + return contents$0.join(''); +}; + +/** + * class Section extends Metadata + * @constructor + */ +function Section() { +} + +Section.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Section$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._names = [ ]; +}; + +Section$LOktavia$.prototype = new Section; + +/** + * @param {!string} name + */ +Section.prototype.setTail$S = function (name) { + /** @type {!number} */ + var index$0; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index$0 = this$0$0._substr.length; + this._names.push(name); + this._bitVector.set$I(index$0 - 1); +}; + +/** + * @param {!string} name + * @param {!number} index + */ +Section.prototype.setTail$SI = function (name, index) { + this._names.push(name); + this._bitVector.set$I(index - 1); +}; + +/** + * @return {!number} + */ +Section.prototype.size$ = function () { + return (this._names.length | 0); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Section.prototype.getSectionIndex$I = function (position) { + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error " + (position + "")); + } + this$0 = this._bitVector; + return this$0.rank$IB(position, true); +}; + +/** + * @param {!number} index + * @return {!string} + */ +Section.prototype.getName$I = function (index) { + if (index < 0 || this._names.length <= index) { + throw new Error("Section.getName() : range error"); + } + return this._names[index]; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Section.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var position; + /** @type {!number} */ + var index; + /** @type {SearchUnit} */ + var unit; + for (i = 0; i < positions.length; i++) { + position = positions[i]; + index = this.getSectionIndex$I(position); + unit = SingleResult$getSearchUnit$LSingleResult$I(result, index); + if (unit.startPosition < 0) { + unit.startPosition = this.getStartPosition$I(index); + } + SearchUnit$addPosition$LSearchUnit$SIB(unit, word, position - unit.startPosition, stemmed); + } +}; + +/** + * @param {!number} index + * @return {!string} + */ +Section.prototype.getInformation$I = function (index) { + return this.getName$I(index); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Section._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Section} */ + var section; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + section = new Section$LOktavia$(parent); + section._names = strs.result; + offset$0 = strs.offset; + offset$0 = section._bitVector.load$SI(data, offset$0); + section._parent._metadataLabels.push(name); + section._parent._metadatas[name] = section; + return offset$0; +}; + +var Section$_load$LOktavia$SSI = Section._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Section.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(0), Binary$dumpStringList$AS(this._names), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Section.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(0), Binary$dumpStringList$ASLCompressionReport$(this._names, report), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class Splitter extends Metadata + * @constructor + */ +function Splitter() { +} + +Splitter.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Splitter$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this.name = null; +}; + +Splitter$LOktavia$.prototype = new Splitter; + +/** + * @constructor + * @param {Oktavia} parent + * @param {!string} name + */ +function Splitter$LOktavia$S(parent, name) { + this._parent = parent; + this._bitVector = new BitVector$(); + this.name = name; +}; + +Splitter$LOktavia$S.prototype = new Splitter; + +/** + * @return {!number} + */ +Splitter.prototype.size$ = function () { + /** @type {BitVector} */ + var this$0$0; + /** @type {!number} */ + var i$0$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0$0 = _bitVector$0 = this._bitVector; + i$0$0 = _bitVector$0._size; + return this$0$0.rank$IB(i$0$0, true); +}; + +/** + */ +Splitter.prototype.split$ = function () { + /** @type {!number} */ + var index$0; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index$0 = this$0$0._substr.length; + this._bitVector.set$I(index$0 - 1); +}; + +/** + * @param {!number} index + */ +Splitter.prototype.split$I = function (index) { + this._bitVector.set$I(index - 1); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Splitter.prototype.getIndex$I = function (position) { + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error"); + } + this$0 = this._bitVector; + return this$0.rank$IB(position, true); +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Splitter.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var position; + /** @type {!number} */ + var index; + /** @type {SearchUnit} */ + var unit; + for (i = 0; i < positions.length; i++) { + position = positions[i]; + index = this.getIndex$I(position); + unit = SingleResult$getSearchUnit$LSingleResult$I(result, index); + if (unit.startPosition < 0) { + unit.startPosition = this.getStartPosition$I(index); + } + SearchUnit$addPosition$LSearchUnit$SIB(unit, word, position - unit.startPosition, stemmed); + } +}; + +/** + * @param {!number} index + * @return {!string} + */ +Splitter.prototype.getInformation$I = function (index) { + return (this.name != null ? this.name + (index + 1 + "") : ''); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Splitter._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {Splitter} */ + var section; + section = new Splitter$LOktavia$(parent); + offset = section._bitVector.load$SI(data, offset); + section._parent._metadataLabels.push(name); + section._parent._metadatas[name] = section; + return offset; +}; + +var Splitter$_load$LOktavia$SSI = Splitter._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Splitter.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(1), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Splitter.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(1), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class Table extends Metadata + * @constructor + */ +function Table() { +} + +Table.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + * @param {Array.<undefined|!string>} headers + */ +function Table$LOktavia$AS(parent, headers) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._headers = headers; + this._columnTails = new BitVector$(); +}; + +Table$LOktavia$AS.prototype = new Table; + +/** + * @return {!number} + */ +Table.prototype.rowSize$ = function () { + /** @type {BitVector} */ + var this$0$0; + /** @type {!number} */ + var i$0$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0$0 = _bitVector$0 = this._bitVector; + i$0$0 = _bitVector$0._size; + return this$0$0.rank$IB(i$0$0, true); +}; + +/** + * @return {!number} + */ +Table.prototype.columnSize$ = function () { + return (this._headers.length | 0); +}; + +/** + */ +Table.prototype.setColumnTail$ = function () { + /** @type {!number} */ + var index; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + /** @type {Oktavia} */ + var _parent$0; + this$0 = _parent$0 = this._parent; + this$0$0 = this$0._fmindex; + index = this$0$0._substr.length; + _parent$0._fmindex.push$S(Oktavia.eob); + this._columnTails.set$I(index - 1); +}; + +/** + */ +Table.prototype.setRowTail$ = function () { + /** @type {!number} */ + var index; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index = this$0$0._substr.length; + this._bitVector.set$I(index - 1); +}; + +/** + * @param {!number} position + * @return {Array.<undefined|!number>} + */ +Table.prototype.getCell$I = function (position) { + /** @type {!number} */ + var row; + /** @type {!number} */ + var currentColumn; + /** @type {!number} */ + var lastRowColumn; + /** @type {!number} */ + var startPosition; + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {BitVector} */ + var this$0; + /** @type {BitVector} */ + var this$1; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error " + (position + "")); + } + this$0 = this._bitVector; + row = this$0.rank$IB(position, true); + this$1 = this._columnTails; + currentColumn = this$1.rank$IB(position, true); + lastRowColumn = 0; + if (row > 0) { + startPosition = this._bitVector.select$I(row - 1) + 1; + lastRowColumn = this._columnTails.rank$I(startPosition); + } + result = [ row, currentColumn - lastRowColumn ]; + return result; +}; + +/** + * @param {!number} rowIndex + * @return {Object.<string, undefined|!string>} + */ +Table.prototype.getRowContent$I = function (rowIndex) { + /** @type {!string} */ + var content; + /** @type {Array.<undefined|!string>} */ + var values; + /** @type {Object.<string, undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + content = this.getContent$I(rowIndex); + values = content.split(Oktavia.eob, this._headers.length); + result = ({ }); + for (i in this._headers) { + if (i < values.length) { + result[this._headers[i]] = values[i]; + } else { + result[this._headers[i]] = ''; + } + } + return result; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Table.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Table.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + */ +Table.prototype._build$ = function () { + this._bitVector.build$(); + this._columnTails.build$(); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Table._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Table} */ + var table; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + table = new Table$LOktavia$AS(parent, strs.result); + offset$0 = strs.offset; + offset$0 = table._bitVector.load$SI(data, offset$0); + table._parent._metadataLabels.push(name); + table._parent._metadatas[name] = table; + offset = offset$0; + return table._columnTails.load$SI(data, offset$0); +}; + +var Table$_load$LOktavia$SSI = Table._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Table.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(2), Binary$dumpStringList$AS(this._headers), Metadata.prototype._dump$.call(this), this._columnTails.dump$() ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Table.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(2), Binary$dumpStringList$ASLCompressionReport$(this._headers, report), Metadata.prototype._dump$LCompressionReport$.call(this, report), this._columnTails.dump$LCompressionReport$(report) ].join(''); +}; + +/** + * class Block extends Metadata + * @constructor + */ +function Block() { +} + +Block.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Block$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._names = [ ]; + this._start = false; +}; + +Block$LOktavia$.prototype = new Block; + +/** + * @param {!string} blockName + */ +Block.prototype.startBlock$S = function (blockName) { + this.startBlock$SI(blockName, this._parent.contentSize$()); +}; + +/** + * @param {!string} blockName + * @param {!number} index + */ +Block.prototype.startBlock$SI = function (blockName, index) { + if (this._start) { + throw new Error('Splitter `' + this._names[this._names.length - 1] + '` is not closed'); + } + this._start = true; + this._names.push(blockName); + this._bitVector.set$I(index - 1); +}; + +/** + */ +Block.prototype.endBlock$ = function () { + this.endBlock$I(this._parent.contentSize$()); +}; + +/** + * @param {!number} index + */ +Block.prototype.endBlock$I = function (index) { + if (! this._start) { + throw new Error('Splitter is not started'); + } + this._start = false; + this._bitVector.set$I(index - 1); +}; + +/** + * @return {!number} + */ +Block.prototype.size$ = function () { + return (this._names.length | 0); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Block.prototype.blockIndex$I = function (position) { + /** @type {!number} */ + var result; + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._parent._fmindex.size$() - 1 <= position) { + throw new Error("Block.blockIndex() : range error " + (position + "")); + } + if (position >= this._bitVector.size$()) { + position = (this._bitVector.size$() - 1 | 0); + result = (this._bitVector.rank$I(position) + 1 | 0); + } else { + this$0 = this._bitVector; + result = this$0.rank$IB(position, true); + } + return result; +}; + +/** + * @param {!number} position + * @return {!boolean} + */ +Block.prototype.inBlock$I = function (position) { + /** @type {!number} */ + var blockIndex; + blockIndex = this.blockIndex$I(position); + return blockIndex % 2 !== 0; +}; + +/** + * @param {!number} position + * @return {!string} + */ +Block.prototype.getBlockContent$I = function (position) { + /** @type {!number} */ + var blockIndex; + /** @type {!string} */ + var result; + blockIndex = this.blockIndex$I(position); + if (blockIndex % 2 !== 0) { + result = this.getContent$I(blockIndex); + } else { + result = ''; + } + return result; +}; + +/** + * @param {!number} position + * @return {!string} + */ +Block.prototype.getBlockName$I = function (position) { + /** @type {!number} */ + var blockIndex; + /** @type {!string} */ + var result; + blockIndex = this.blockIndex$I(position); + if (blockIndex % 2 !== 0) { + result = this._names[blockIndex >>> 1]; + } else { + result = ''; + } + return result; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Block.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Block.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Block._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Block} */ + var block; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + block = new Block$LOktavia$(parent); + block._names = strs.result; + offset$0 = strs.offset; + offset$0 = block._bitVector.load$SI(data, offset$0); + block._parent._metadataLabels.push(name); + block._parent._metadatas[name] = block; + return offset$0; +}; + +var Block$_load$LOktavia$SSI = Block._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Block.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(3), Binary$dumpStringList$AS(this._names), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Block.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(3), Binary$dumpStringList$ASLCompressionReport$(this._names, report), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class FMIndex extends Object + * @constructor + */ +function FMIndex() { +} + +/** + * @constructor + */ +function FMIndex$() { + /** @type {Array.<undefined|!number>} */ + var _rlt$0; + this._ssize = 0; + (this._ddic = 0, this._head = 0); + this._substr = ""; + this._sv = new WaveletMatrix$(); + this._posdic = [ ]; + this._idic = [ ]; + _rlt$0 = this._rlt = [ ]; + _rlt$0.length = 65536; +}; + +FMIndex$.prototype = new FMIndex; + +/** + */ +FMIndex.prototype.clear$ = function () { + /** @type {WaveletMatrix} */ + var this$0; + this$0 = this._sv; + this$0._bv.length = 0; + this$0._seps.length = 0; + this$0._size = 0; + this._posdic.length = 0; + this._idic.length = 0; + this._ddic = 0; + this._head = 0; + this._substr = ""; +}; + +/** + * @return {!number} + */ +FMIndex.prototype.size$ = function () { + /** @type {WaveletMatrix} */ + var this$0; + this$0 = this._sv; + return this$0._size; +}; + +/** + * @return {!number} + */ +FMIndex.prototype.contentSize$ = function () { + return this._substr.length; +}; + +/** + * @param {!string} key + * @return {!number} + */ +FMIndex.prototype.getRows$S = function (key) { + /** @type {Array.<undefined|!number>} */ + var pos; + pos = [ ]; + return this.getRows$SAI(key, pos); +}; + +/** + * @param {!string} key + * @param {Array.<undefined|!number>} pos + * @return {!number} + */ +FMIndex.prototype.getRows$SAI = function (key, pos) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var first; + /** @type {undefined|!number} */ + var last; + /** @type {!number} */ + var c; + /** @type {Array.<undefined|!number>} */ + var _rlt$0; + i = key.length - 1; + code = key.charCodeAt(i); + first = (_rlt$0 = this._rlt)[code] + 1; + last = _rlt$0[code + 1]; + while (first <= last) { + if (i === 0) { + pos[0] = (-- first | 0); + pos[1] = -- last; + return (last - first + 1 | 0); + } + i--; + c = key.charCodeAt(i); + first = this._rlt[c] + this._sv.rank$II(first - 1, c) + 1; + last = this._rlt[c] + this._sv.rank$II(last, c); + } + return 0; +}; + +/** + * @param {!number} i + * @return {!number} + */ +FMIndex.prototype.getPosition$I = function (i) { + /** @type {!number} */ + var pos; + /** @type {!number} */ + var c; + if (i >= this.size$()) { + throw new Error("FMIndex.getPosition() : range error"); + } + pos = 0; + while (i !== this._head) { + if (i % this._ddic === 0) { + pos += this._posdic[i / this._ddic] + 1; + break; + } + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + pos++; + } + return (pos % this.size$() | 0); +}; + +/** + * @param {!number} pos + * @param {!number} len + * @return {!string} + */ +FMIndex.prototype.getSubstring$II = function (pos, len) { + /** @type {!number} */ + var pos_end; + /** @type {!number} */ + var pos_tmp; + /** @type {!number} */ + var i; + /** @type {!number} */ + var pos_idic; + /** @type {!string} */ + var substr; + /** @type {!number} */ + var c; + /** @type {!number} */ + var _ddic$0; + if (pos >= this.size$()) { + throw new Error("FMIndex.getSubstring() : range error"); + } + pos_end = Math.min(pos + len, this.size$()); + pos_tmp = this.size$() - 1; + i = this._head; + pos_idic = Math.floor((pos_end + (_ddic$0 = this._ddic) - 2) / _ddic$0); + if (pos_idic < this._idic.length) { + pos_tmp = pos_idic * this._ddic; + i = this._idic[pos_idic]; + } + substr = ""; + while (pos_tmp >= pos) { + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + if (pos_tmp < pos_end) { + substr = String.fromCharCode(c) + substr; + } + if (pos_tmp === 0) { + break; + } + pos_tmp--; + } + return substr; +}; + +/** + */ +FMIndex.prototype.build$ = function () { + this.build$SIIB(String.fromCharCode(0), 65535, 20, false); +}; + +/** + * @param {!string} end_marker + * @param {!number} ddic + * @param {!boolean} verbose + */ +FMIndex.prototype.build$SIB = function (end_marker, ddic, verbose) { + this.build$SIIB(end_marker, 65535, ddic, verbose); +}; + +/** + * @param {!string} end_marker + * @param {!number} maxChar + * @param {!number} ddic + * @param {!boolean} verbose + */ +FMIndex.prototype.build$SIIB = function (end_marker, maxChar, ddic, verbose) { + /** @type {BurrowsWheelerTransform} */ + var b; + /** @type {!string} */ + var s; + /** @type {!number} */ + var c; + /** @type {!string} */ + var str$0; + /** @type {WaveletMatrix} */ + var this$0; + /** @type {!string} */ + var _str$0; + /** @type {Array.<undefined|!number>} */ + var _suffixarray$0; + if (verbose) { + console.time("building burrows-wheeler transform"); + } + this._substr += end_marker; + b = ({_str: "", _size: 0, _head: 0, _suffixarray: [ ]}); + str$0 = this._substr; + _str$0 = b._str = str$0; + b._size = _str$0.length; + _suffixarray$0 = b._suffixarray = SAIS$make$S(str$0); + b._head = (_suffixarray$0.indexOf(0) | 0); + s = BurrowsWheelerTransform$get$LBurrowsWheelerTransform$(b); + this._ssize = s.length; + this._head = b._head; + b._str = ""; + b._size = 0; + b._head = 0; + b._suffixarray.length = 0; + this._substr = ""; + if (verbose) { + console.timeEnd("building burrows-wheeler transform"); + } + if (verbose) { + console.time("building wavelet matrix"); + } + this$0 = this._sv; + this$0._bitsize = (Math.ceil(Math.log(maxChar) / 0.6931471805599453) | 0); + if (verbose) { + console.log(" maxCharCode: ", maxChar); + console.log(" bitSize: ", this._sv.bitsize$()); + } + this._sv.build$S(s); + if (verbose) { + console.timeEnd("building wavelet matrix"); + } + if (verbose) { + console.time("caching rank less than"); + } + for (c = 0; c < maxChar; c++) { + this._rlt[c] = this._sv.rank_less_than$II(this._sv.size$(), c); + } + if (verbose) { + console.timeEnd("caching rank less than"); + } + this._ddic = ddic; + if (verbose) { + console.time("building dictionaries"); + } + this._buildDictionaries$(); + if (verbose) { + console.timeEnd("building dictionaries"); + console.log(''); + } +}; + +/** + */ +FMIndex.prototype._buildDictionaries$ = function () { + /** @type {!number} */ + var i; + /** @type {!number} */ + var pos; + /** @type {!number} */ + var c; + for (i = 0; i < this._ssize / this._ddic + 1; i++) { + this._posdic.push(0); + this._idic.push(0); + } + i = this._head; + pos = this.size$() - 1; + do { + if (i % this._ddic === 0) { + this._posdic[Math.floor(i / this._ddic)] = (pos | 0); + } + if (pos % this._ddic === 0) { + this._idic[Math.floor(pos / this._ddic)] = (i | 0); + } + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + pos--; + } while (i !== this._head); +}; + +/** + * @param {!string} doc + */ +FMIndex.prototype.push$S = function (doc) { + if (doc.length <= 0) { + throw new Error("FMIndex::push(): empty string"); + } + this._substr += doc; +}; + +/** + * @param {!string} keyword + * @return {Array.<undefined|!number>} + */ +FMIndex.prototype.search$S = function (keyword) { + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {Array.<undefined|!number>} */ + var position; + /** @type {!number} */ + var rows; + /** @type {undefined|!number} */ + var first; + /** @type {undefined|!number} */ + var last; + /** @type {undefined|!number} */ + var i; + result = [ ]; + position = [ ]; + rows = this.getRows$SAI(keyword, position); + if (rows > 0) { + first = position[0]; + last = position[1]; + for (i = first; i <= last; i++) { + result.push(this.getPosition$I(i)); + } + } + return result; +}; + +/** + * @return {!string} + */ +FMIndex.prototype.dump$ = function () { + return this.dump$B(false); +}; + +/** + * @param {!boolean} verbose + * @return {!string} + */ +FMIndex.prototype.dump$B = function (verbose) { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {CompressionReport} */ + var report; + /** @type {!number} */ + var i; + contents = [ ]; + report = ({source: 0, result: 0}); + contents.push(Binary$dump32bitNumber$N(this._ddic)); + contents.push(Binary$dump32bitNumber$N(this._ssize)); + contents.push(Binary$dump32bitNumber$N(this._head)); + CompressionReport$add$LCompressionReport$II(report, 6, 6); + contents.push(this._sv.dump$LCompressionReport$(report)); + if (verbose) { + console.log("Serializing FM-index"); + console.log(' Wavelet Matrix: ' + (contents[3].length * 2 + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + contents.push(Binary$dump32bitNumber$N(this._posdic.length)); + for (i in this._posdic) { + contents.push(Binary$dump32bitNumber$N(this._posdic[i])); + } + for (i in this._idic) { + contents.push(Binary$dump32bitNumber$N(this._idic[i])); + } + if (verbose) { + console.log(' Dictionary Cache: ' + (this._idic.length * 16 + "") + ' bytes'); + } + return contents.join(""); +}; + +/** + * @param {!string} data + * @return {!number} + */ +FMIndex.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +FMIndex.prototype.load$SI = function (data, offset) { + /** @type {!number} */ + var maxChar; + /** @type {!number} */ + var c; + /** @type {!number} */ + var size; + /** @type {!number} */ + var i; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var result$1; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._ddic = (result$0 | 0); + this._ssize = (Binary$load32bitNumber$SI(data, offset + 2) | 0); + this._head = (Binary$load32bitNumber$SI(data, offset + 4) | 0); + offset = this._sv.load$SI(data, offset + 6); + maxChar = Math.pow(2, this._sv.bitsize$()); + for (c = 0; c < maxChar; c++) { + this._rlt[c] = this._sv.rank_less_than$II(this._sv.size$(), c); + } + result$1 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + size = result$1; + offset += 2; + for (i = 0; i < size; (i++, offset += 2)) { + this._posdic.push(Binary$load32bitNumber$SI(data, offset)); + } + for (i = 0; i < size; (i++, offset += 2)) { + this._idic.push(Binary$load32bitNumber$SI(data, offset)); + } + return offset; +}; + +/** + * class Tag extends Object + * @constructor + */ +function Tag() { +} + +/** + * @constructor + * @param {!string} name + */ +function Tag$S(name) { + this.name = name; + this.attributes = ({ }); + this.isSelfClosing = false; +}; + +Tag$S.prototype = new Tag; + +/** + * class _Common extends Object + * @constructor + */ +function _Common() { +} + +/** + * @constructor + */ +function _Common$() { +}; + +_Common$.prototype = new _Common; + +/** + * class _State extends Object + * @constructor + */ +function _State() { +} + +/** + * @constructor + */ +function _State$() { +}; + +_State$.prototype = new _State; + +/** + * class SAXHandler extends Object + * @constructor + */ +function SAXHandler() { +} + +/** + * @constructor + */ +function SAXHandler$() { + this.position = 0; + this.column = 0; + this.line = 0; +}; + +SAXHandler$.prototype = new SAXHandler; + +/** + * @param {Error} error + */ +SAXHandler.prototype.onerror$LError$ = function (error) { +}; + +/** + * @param {!string} text + */ +SAXHandler.prototype.ontext$S = function (text) { +}; + +/** + * @param {!string} doctype + */ +SAXHandler.prototype.ondoctype$S = function (doctype) { +}; + +/** + * @param {!string} name + * @param {!string} body + */ +SAXHandler.prototype.onprocessinginstruction$SS = function (name, body) { +}; + +/** + * @param {!string} sgmlDecl + */ +SAXHandler.prototype.onsgmldeclaration$S = function (sgmlDecl) { +}; + +/** + * @param {!string} tagname + * @param {Object.<string, undefined|!string>} attributes + */ +SAXHandler.prototype.onopentag$SHS = function (tagname, attributes) { +}; + +/** + * @param {!string} tagname + */ +SAXHandler.prototype.onclosetag$S = function (tagname) { +}; + +/** + * @param {!string} name + * @param {!string} value + */ +SAXHandler.prototype.onattribute$SS = function (name, value) { +}; + +/** + * @param {!string} comment + */ +SAXHandler.prototype.oncomment$S = function (comment) { +}; + +/** + */ +SAXHandler.prototype.onopencdata$ = function () { +}; + +/** + * @param {!string} cdata + */ +SAXHandler.prototype.oncdata$S = function (cdata) { +}; + +/** + */ +SAXHandler.prototype.onclosecdata$ = function () { +}; + +/** + */ +SAXHandler.prototype.onend$ = function () { +}; + +/** + */ +SAXHandler.prototype.onready$ = function () { +}; + +/** + * @param {!string} script + */ +SAXHandler.prototype.onscript$S = function (script) { +}; + +/** + * class _HTMLHandler extends SAXHandler + * @constructor + */ +function _HTMLHandler() { +} + +_HTMLHandler.prototype = new SAXHandler; +/** + * @constructor + * @param {Object.<string, undefined|Array.<undefined|!string>>} styles + * @param {!boolean} escape + */ +function _HTMLHandler$HASB(styles, escape) { + this.position = 0; + this.column = 0; + this.line = 0; + this.text = [ ]; + this.escape = escape; + this.styles = styles; +}; + +_HTMLHandler$HASB.prototype = new _HTMLHandler; + +/** + * @param {!string} str + * @return {!string} + */ +_HTMLHandler.escapeHTML$S = function (str) { + return str.replace(/\n/g, "<br/>").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"); +}; + +var _HTMLHandler$escapeHTML$S = _HTMLHandler.escapeHTML$S; + +/** + * @param {!string} tagname + * @param {Object.<string, undefined|!string>} attributes + */ +_HTMLHandler.prototype.onopentag$SHS = function (tagname, attributes) { + this.text.push(this.styles[tagname][0]); +}; + +/** + * @param {!string} tagname + */ +_HTMLHandler.prototype.onclosetag$S = function (tagname) { + this.text.push(this.styles[tagname][1]); +}; + +/** + * @param {!string} text + */ +_HTMLHandler.prototype.ontext$S = function (text) { + if (this.escape) { + this.text.push(text.replace(/\n/g, "<br/>").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">")); + } else { + this.text.push(text); + } +}; + +/** + * @return {!string} + */ +_HTMLHandler.prototype.result$ = function () { + return this.text.join(''); +}; + +/** + * class SAXParser extends Object + * @constructor + */ +function SAXParser() { +} + +/** + * @constructor + * @param {SAXHandler} handler + */ +function SAXParser$LSAXHandler$(handler) { + this.q = ""; + this.c = ""; + this.bufferCheckPosition = 0; + this.looseCase = ""; + this.tags = [ ]; + this.closed = false; + this.closedRoot = false; + this.sawRoot = false; + this.tag = null; + this.error = null; + this.handler = null; + this.ENTITIES = null; + this.strict = false; + this.tagName = ""; + this.state = 0; + this.line = 0; + this.column = 0; + this.position = 0; + this.startTagPosition = 0; + this.attribName = ""; + this.attribValue = ""; + this.script = ""; + this.textNode = ""; + this.attribList = null; + this.noscript = false; + this.cdata = ""; + this.procInstBody = ""; + this.procInstName = ""; + this.doctype = ""; + this.entity = ""; + this.sgmlDecl = ""; + this.comment = ""; + this.preTags = 0; + this._init$LSAXHandler$B(handler, false); +}; + +SAXParser$LSAXHandler$.prototype = new SAXParser; + +/** + * @constructor + * @param {SAXHandler} handler + * @param {!boolean} strict + */ +function SAXParser$LSAXHandler$B(handler, strict) { + this.q = ""; + this.c = ""; + this.bufferCheckPosition = 0; + this.looseCase = ""; + this.tags = [ ]; + this.closed = false; + this.closedRoot = false; + this.sawRoot = false; + this.tag = null; + this.error = null; + this.handler = null; + this.ENTITIES = null; + this.strict = false; + this.tagName = ""; + this.state = 0; + this.line = 0; + this.column = 0; + this.position = 0; + this.startTagPosition = 0; + this.attribName = ""; + this.attribValue = ""; + this.script = ""; + this.textNode = ""; + this.attribList = null; + this.noscript = false; + this.cdata = ""; + this.procInstBody = ""; + this.procInstName = ""; + this.doctype = ""; + this.entity = ""; + this.sgmlDecl = ""; + this.comment = ""; + this.preTags = 0; + this._init$LSAXHandler$B(handler, strict); +}; + +SAXParser$LSAXHandler$B.prototype = new SAXParser; + +/** + * @param {SAXHandler} handler + * @param {!boolean} strict + */ +SAXParser.prototype._init$LSAXHandler$B = function (handler, strict) { + this.handler = handler; + this.clearBuffers$(); + this.q = ""; + this.bufferCheckPosition = 65536; + this.looseCase = 'toLowerCase'; + this.tags = [ ]; + this.closed = this.closedRoot = this.sawRoot = false; + this.tag = null; + this.error = null; + this.strict = strict; + this.noscript = strict; + this.state = 1; + this.ENTITIES = _Entities$entity_list$(); + this.attribList = [ ]; + this.noscript = false; + this.preTags = 0; +}; + +/** + * @param {!boolean} flag + */ +SAXParser.prototype.set_noscript$B = function (flag) { + this.noscript = flag; +}; + +/** + * @return {SAXParser} + */ +SAXParser.prototype.resume$ = function () { + this.error = null; + return this; +}; + +/** + * @return {SAXParser} + */ +SAXParser.prototype.close$ = function () { + return this.parse$S(''); +}; + +/** + * @param {!string} chunk + * @return {SAXParser} + */ +SAXParser.prototype.parse$S = function (chunk) { + /** @type {Char} */ + var _; + /** @type {!number} */ + var i; + /** @type {!string} */ + var c; + /** @type {!number} */ + var starti; + /** @type {!number} */ + var pad; + /** @type {!number} */ + var returnState; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$0; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$1; + /** @type {RegExp} */ + var charclass$2; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$3; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$4; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$5; + /** @type {!string} */ + var text$0; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$6; + /** @type {RegExp} */ + var charclass$7; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$8; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$9; + /** @type {RegExp} */ + var charclass$10; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$11; + /** @type {RegExp} */ + var charclass$12; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$13; + /** @type {RegExp} */ + var charclass$14; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$15; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$16; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$17; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$18; + /** @type {RegExp} */ + var charclass$19; + /** @type {RegExp} */ + var charclass$20; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$21; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$22; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$23; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$24; + /** @type {!string} */ + var comment$0; + _ = new Char$(); + if (this.error) { + throw this.error; + } + if (this.closed) { + return this.emiterror$S("Cannot write after close. Assign an onready handler."); + } + (i = 0, c = ""); + while (this.c = c = chunk.charAt(i++)) { + this.position++; + if (c === "\n") { + this.handler.line++; + this.handler.column = 0; + } else { + this.handler.column++; + } + switch (this.state) { + case 1: + if (c === "<") { + this.state = 4; + this.startTagPosition = this.position; + } else { + charclass$0 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$0, c)) { + this.strictFail$S("Non-whitespace before first tag."); + this.textNode = c; + this.state = 2; + } + } + continue; + case 2: + if (this.sawRoot && ! this.closedRoot) { + starti = i - 1; + while (c && c !== "<" && c !== "&") { + c = chunk.charAt(i++); + if (c) { + this.position++; + if (c === "\n") { + this.handler.line++; + this.handler.column = 0; + } else { + this.handler.column++; + } + } + } + this.textNode += chunk.substring(starti, i - 1); + } + if (c === "<") { + this.state = 4; + this.startTagPosition = this.position; + } else { + if (_.not$HBS(_.whitespace, c) && (! this.sawRoot || this.closedRoot)) { + this.strictFail$S("Text data outside of root node."); + } + if (c === "&") { + this.state = 3; + } else { + this.textNode += c; + } + } + continue; + case 33: + if (c === "<") { + this.state = 34; + } else { + this.script += c; + } + continue; + case 34: + if (c === "/") { + this.state = 31; + } else { + this.script += "<" + c; + this.state = 33; + } + continue; + case 4: + if (c === "!") { + this.state = 5; + this.sgmlDecl = ""; + } else { + charclass$1 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$1, c)) { + } else { + charclass$2 = _.nameStart; + if (charclass$2.test(c)) { + this.state = 21; + this.tagName = c; + } else { + if (c === "/") { + this.state = 31; + this.tagName = ""; + } else { + if (c === "?") { + this.state = 18; + this.procInstName = this.procInstBody = ""; + } else { + this.strictFail$S("Unencoded <"); + if (this.startTagPosition + 1 < this.position) { + pad = this.position - this.startTagPosition; + for (i = 0; i < pad; i++) { + c = " " + c; + } + } + this.textNode += "<" + c; + this.state = 2; + } + } + } + } + } + continue; + case 5: + if ((this.sgmlDecl + c).toUpperCase() === _.CDATA) { + this.closetext_if_exist$(); + this.state = 15; + this.sgmlDecl = ""; + this.cdata = ""; + } else { + if (this.sgmlDecl + c === "--") { + this.state = 12; + this.comment = ""; + this.sgmlDecl = ""; + } else { + if ((this.sgmlDecl + c).toUpperCase() === _.DOCTYPE) { + this.state = 7; + if (this.doctype || this.sawRoot) { + this.strictFail$S("Inappropriately located doctype declaration"); + } + this.doctype = ""; + this.sgmlDecl = ""; + } else { + if (c === ">") { + this.closetext_if_exist$(); + this.sgmlDecl = ""; + this.state = 2; + } else { + charclass$3 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$3, c)) { + this.state = 6; + this.sgmlDecl += c; + } else { + this.sgmlDecl += c; + } + } + } + } + } + continue; + case 6: + if (c === this.q) { + this.state = 5; + this.q = ""; + } + this.sgmlDecl += c; + continue; + case 7: + if (c === ">") { + this.state = 2; + this.closetext_if_exist$(); + this.doctype.trim(); + } else { + this.doctype += c; + if (c === "[") { + this.state = 9; + } else { + charclass$4 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$4, c)) { + this.state = 8; + this.q = c; + } + } + } + continue; + case 8: + this.doctype += c; + if (c === this.q) { + this.q = ""; + this.state = 7; + } + continue; + case 9: + this.doctype += c; + if (c === "]") { + this.state = 7; + } else { + charclass$5 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$5, c)) { + this.state = 10; + this.q = c; + } + } + continue; + case 10: + this.doctype += c; + if (c === this.q) { + this.state = 9; + this.q = ""; + } + continue; + case 12: + if (c === "-") { + this.state = 13; + } else { + this.comment += c; + } + continue; + case 13: + if (c === "-") { + this.state = 14; + text$0 = this.comment; + text$0 = text$0.replace(/[\n\t]/g, ' '); + text$0 = text$0.replace(/\s\s+/g, " "); + comment$0 = this.comment = text$0; + if (comment$0) { + this.closetext_if_exist$(); + this.comment.trim(); + } + this.comment = ""; + } else { + this.comment += "-" + c; + this.state = 12; + } + continue; + case 14: + if (c !== ">") { + this.strictFail$S("Malformed comment"); + this.comment += "--" + c; + this.state = 12; + } else { + this.state = 2; + } + continue; + case 15: + if (c === "]") { + this.state = 16; + } else { + this.cdata += c; + } + continue; + case 16: + if (c === "]") { + this.state = 17; + } else { + this.cdata += "]" + c; + this.state = 15; + } + continue; + case 17: + if (c === ">") { + if (this.cdata) { + this.closetext_if_exist$(); + } + this.cdata = ""; + this.state = 2; + } else { + if (c === "]") { + this.cdata += "]"; + } else { + this.cdata += "]]" + c; + this.state = 15; + } + } + continue; + case 18: + if (c === "?") { + this.state = 20; + } else { + charclass$6 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$6, c)) { + this.state = 19; + } else { + this.procInstName += c; + } + } + continue; + case 19: + if (! this.procInstBody && _.is$HBS(_.whitespace, c)) { + continue; + } else { + if (c === "?") { + this.state = 20; + } else { + this.procInstBody += c; + } + } + continue; + case 20: + if (c === ">") { + this.closetext_if_exist$(); + this.procInstName = this.procInstBody = ""; + this.state = 2; + } else { + this.procInstBody += "?" + c; + this.state = 19; + } + continue; + case 21: + charclass$7 = _.nameBody; + if (charclass$7.test(c)) { + this.tagName += c; + } else { + this.newTag$(); + if (c === ">") { + this.openTag$B(false); + } else { + if (c === "/") { + this.state = 22; + } else { + charclass$8 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$8, c)) { + this.strictFail$S("Invalid character in tag name"); + } + this.state = 23; + } + } + } + continue; + case 22: + if (c === ">") { + this.openTag$B(true); + this.closeTag$(); + } else { + this.strictFail$S("Forward-slash in opening tag not followed by >"); + this.state = 23; + } + continue; + case 23: + charclass$9 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$9, c)) { + continue; + } else { + if (c === ">") { + this.openTag$B(false); + } else { + if (c === "/") { + this.state = 22; + } else { + charclass$10 = _.nameStart; + if (charclass$10.test(c)) { + this.attribName = c; + this.attribValue = ""; + this.state = 24; + } else { + this.strictFail$S("Invalid attribute name"); + } + } + } + } + continue; + case 24: + if (c === "=") { + this.state = 26; + } else { + if (c === ">") { + this.strictFail$S("Attribute without value"); + this.attribValue = this.attribName; + this.attrib$(); + this.openTag$B(false); + } else { + charclass$11 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$11, c)) { + this.state = 25; + } else { + charclass$12 = _.nameBody; + if (charclass$12.test(c)) { + this.attribName += c; + } else { + this.strictFail$S("Invalid attribute name"); + } + } + } + } + continue; + case 25: + if (c === "=") { + this.state = 26; + } else { + charclass$13 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$13, c)) { + continue; + } else { + this.strictFail$S("Attribute without value"); + this.tag.attributes[this.attribName] = ""; + this.attribValue = ""; + this.closetext_if_exist$(); + this.attribName = ""; + if (c === ">") { + this.openTag$B(false); + } else { + charclass$14 = _.nameStart; + if (charclass$14.test(c)) { + this.attribName = c; + this.state = 24; + } else { + this.strictFail$S("Invalid attribute name"); + this.state = 23; + } + } + } + } + continue; + case 26: + charclass$15 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$15, c)) { + continue; + } else { + charclass$16 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$16, c)) { + this.q = c; + this.state = 27; + } else { + this.strictFail$S("Unquoted attribute value"); + this.state = 28; + this.attribValue = c; + } + } + continue; + case 27: + if (c !== this.q) { + if (c === "&") { + this.state = 29; + } else { + this.attribValue += c; + } + continue; + } + this.attrib$(); + this.q = ""; + this.state = 23; + continue; + case 28: + charclass$17 = _.attribEnd; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$17, c)) { + if (c === "&") { + this.state = 30; + } else { + this.attribValue += c; + } + continue; + } + this.attrib$(); + if (c === ">") { + this.openTag$B(false); + } else { + this.state = 23; + } + continue; + case 31: + if (! this.tagName) { + charclass$18 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$18, c)) { + continue; + } else { + charclass$19 = _.nameStart; + if (! charclass$19.test(c)) { + if (this.script) { + this.script += "</" + c; + this.state = 33; + } else { + this.strictFail$S("Invalid tagname in closing tag."); + } + } else { + this.tagName = c; + } + } + } else { + if (c === ">") { + this.closeTag$(); + } else { + charclass$20 = _.nameBody; + if (charclass$20.test(c)) { + this.tagName += c; + } else { + if (this.script) { + this.script += "</" + this.tagName; + this.tagName = ""; + this.state = 33; + } else { + charclass$21 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$21, c)) { + this.strictFail$S("Invalid tagname in closing tag"); + } + this.state = 32; + } + } + } + } + continue; + case 32: + charclass$22 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$22, c)) { + continue; + } + if (c === ">") { + this.closeTag$(); + } else { + this.strictFail$S("Invalid characters in closing tag"); + } + continue; + case 3: + if (c === ";") { + this.textNode += this.parseEntity$(); + this.entity = ""; + this.state = 2; + } else { + charclass$23 = _.entity; + if ($__jsx_ObjectHasOwnProperty.call(charclass$23, c)) { + this.entity += c; + } else { + this.strictFail$S("Invalid character entity"); + this.textNode += "&" + this.entity + c; + this.entity = ""; + this.state = 2; + } + } + continue; + case 29: + case 30: + if (this.state === 29) { + returnState = 27; + } else { + returnState = 28; + } + if (c === ";") { + this.attribValue += this.parseEntity$(); + this.entity = ""; + this.state = (returnState | 0); + } else { + charclass$24 = _.entity; + if ($__jsx_ObjectHasOwnProperty.call(charclass$24, c)) { + this.entity += c; + } else { + this.strictFail$S("Invalid character entity"); + this.attribValue += "&" + this.entity + c; + this.entity = ""; + this.state = (returnState | 0); + } + } + continue; + default: + throw new Error("Unknown state: " + (this.state + "")); + } + } + this.end$(); + return this; +}; + +/** + */ +SAXParser.prototype.clearBuffers$ = function () { + this.comment = ''; + this.sgmlDecl = ''; + this.textNode = ''; + this.tagName = ''; + this.doctype = ''; + this.procInstName = ''; + this.procInstBody = ''; + this.entity = ''; + this.attribName = ''; + this.attribValue = ''; + this.cdata = ''; + this.script = ''; +}; + +/** + */ +SAXParser.prototype.closetext_if_exist$ = function () { + if (this.textNode !== '') { + this.closetext$(); + } +}; + +/** + */ +SAXParser.prototype.closetext$ = function () { + /** @type {!string} */ + var text; + /** @type {!string} */ + var text$0; + if (this.preTags === 0) { + text$0 = this.textNode; + text$0 = text$0.replace(/[\n\t]/g, ' '); + text$0 = text$0.replace(/\s\s+/g, " "); + text = text$0; + if (text$0) { + this.handler.ontext$S(text); + } + } else { + if (this.textNode) { + this.handler.ontext$S(this.textNode); + } + } + this.textNode = ""; +}; + +/** + * @param {!string} text + * @return {!string} + */ +SAXParser.prototype.textopts$S = function (text) { + text = text.replace(/[\n\t]/g, ' '); + text = text.replace(/\s\s+/g, " "); + return text; +}; + +/** + * @param {!string} er + * @return {SAXParser} + */ +SAXParser.prototype.emiterror$S = function (er) { + /** @type {Error} */ + var error; + this.closetext$(); + er += "\nLine: " + (this.line + "") + "\nColumn: " + (this.column + "") + "\nChar: " + this.c; + error = new Error(er); + this.error = error; + return this; +}; + +/** + */ +SAXParser.prototype.end$ = function () { + if (! this.closedRoot) { + this.strictFail$S("Unclosed root tag"); + } + if (this.state !== 2) { + this.emiterror$S("Unexpected end"); + } + this.closetext$(); + this.c = ""; + this.closed = true; +}; + +/** + * @param {!string} message + */ +SAXParser.prototype.strictFail$S = function (message) { + if (this.strict) { + this.emiterror$S(message); + } +}; + +/** + */ +SAXParser.prototype.newTag$ = function () { + if (! this.strict) { + this.tagName = this.tagName.toLowerCase(); + } + this.tag = ({name: this.tagName, attributes: ({ }), isSelfClosing: false}); + this.attribList.length = 0; +}; + +/** + */ +SAXParser.prototype.attrib$ = function () { + if (! this.strict) { + this.attribName = this.attribName.toLowerCase(); + } + if ($__jsx_ObjectHasOwnProperty.call(this.tag.attributes, this.attribName)) { + this.attribName = this.attribValue = ""; + return; + } + this.tag.attributes[this.attribName] = this.attribValue; + this.closetext_if_exist$(); + this.attribName = this.attribValue = ""; +}; + +/** + */ +SAXParser.prototype.openTag$ = function () { + this.openTag$B(false); +}; + +/** + * @param {!boolean} selfClosing + */ +SAXParser.prototype.openTag$B = function (selfClosing) { + /** @type {Tag} */ + var tag$0; + /** @type {Tag} */ + var tag$1; + (tag$0 = this.tag).isSelfClosing = selfClosing; + this.sawRoot = true; + this.tags.push(tag$0); + this.closetext_if_exist$(); + this.handler.onopentag$SHS((tag$1 = this.tag).name, tag$1.attributes); + if (this.tag.name === 'pre') { + this.preTags++; + } + if (! selfClosing) { + if (! this.noscript && this.tagName.toLowerCase() === "script") { + this.state = 33; + } else { + this.state = 2; + } + this.tag = null; + this.tagName = ""; + } + this.attribName = this.attribValue = ""; + this.attribList.length = 0; +}; + +/** + */ +SAXParser.prototype.closeTag$ = function () { + /** @type {!number} */ + var t; + /** @type {!string} */ + var tagName; + /** @type {!string} */ + var closeTo; + /** @type {Tag} */ + var close; + /** @type {!number} */ + var s; + /** @type {Tag} */ + var tag$0; + if (! this.tagName) { + this.strictFail$S("Weird empty close tag."); + this.textNode += "</>"; + this.state = 2; + return; + } + if (this.script) { + if (this.tagName !== "script") { + this.script += "</" + this.tagName + ">"; + this.tagName = ""; + this.state = 33; + return; + } + this.closetext_if_exist$(); + this.script = ""; + } + t = this.tags.length; + tagName = this.tagName; + if (! this.strict) { + tagName = tagName.toLowerCase(); + } + closeTo = tagName; + while (t--) { + close = this.tags[t]; + if (close.name !== closeTo) { + this.strictFail$S("Unexpected close tag"); + } else { + break; + } + } + if (t < 0) { + this.strictFail$S("Unmatched closing tag: " + this.tagName); + this.textNode += "</" + this.tagName + ">"; + this.state = 2; + return; + } + this.tagName = tagName; + s = this.tags.length; + while (s-- > t) { + tag$0 = this.tag = this.tags.pop(); + this.tagName = tag$0.name; + this.closetext_if_exist$(); + this.handler.onclosetag$S(this.tagName); + if (this.tagName === 'pre') { + this.preTags--; + } + } + if (t === 0) { + this.closedRoot = true; + } + this.tagName = this.attribValue = this.attribName = ""; + this.attribList.length = 0; + this.state = 2; +}; + +/** + * @return {!string} + */ +SAXParser.prototype.parseEntity$ = function () { + /** @type {!string} */ + var entity; + /** @type {!string} */ + var entityLC; + /** @type {!number} */ + var num; + /** @type {!string} */ + var numStr; + entity = this.entity; + entityLC = entity.toLowerCase(); + num = 0; + numStr = ""; + if (this.ENTITIES[entity]) { + return this.ENTITIES[entity]; + } + if (this.ENTITIES[entityLC]) { + return this.ENTITIES[entityLC]; + } + entity = entityLC; + if (entityLC.charAt(0) === "#") { + if (entity.charAt(1) === "x") { + entity = entity.slice(2); + num = $__jsx_parseInt(entity, 16); + numStr = num.toString(16); + } else { + entity = entity.slice(1); + num = $__jsx_parseInt(entity, 10); + numStr = num.toString(10); + } + } + entity = entity.replace(/^0+/, ""); + if (numStr.toLowerCase() !== entity) { + this.strictFail$S("Invalid character entity"); + return "&" + this.entity + ";"; + } + return String.fromCharCode(num); +}; + +/** + * class Char extends Object + * @constructor + */ +function Char() { +} + +/** + * @constructor + */ +function Char$() { + this.CDATA = "[CDATA["; + this.DOCTYPE = "DOCTYPE"; + this.XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"; + this.whitespace = this._charClass$S("\r\n\t "); + this.number = this._charClass$S("0124356789"); + this.letter = this._charClass$S("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); + this.quote = this._charClass$S("'\""); + this.entity = this._charClass$S("0124356789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#"); + this.attribEnd = this._charClass$S("\r\n\t >"); + this.nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; + this.nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/; +}; + +Char$.prototype = new Char; + +/** + * @param {!string} str + * @return {Object.<string, undefined|!boolean>} + */ +Char.prototype._charClass$S = function (str) { + /** @type {Object.<string, undefined|!boolean>} */ + var result; + /** @type {!number} */ + var i; + result = ({ }); + for (i = 0; i < str.length; i++) { + result[str.slice(i, i + 1)] = true; + } + return result; +}; + +/** + * @param {RegExp} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.is$LRegExp$S = function (charclass, c) { + return charclass.test(c); +}; + +/** + * @param {Object.<string, undefined|!boolean>} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.is$HBS = function (charclass, c) { + return $__jsx_ObjectHasOwnProperty.call(charclass, c); +}; + +/** + * @param {RegExp} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.not$LRegExp$S = function (charclass, c) { + return ! charclass.test(c); +}; + +/** + * @param {Object.<string, undefined|!boolean>} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.not$HBS = function (charclass, c) { + return ! $__jsx_ObjectHasOwnProperty.call(charclass, c); +}; + +/** + * class _Entities extends Object + * @constructor + */ +function _Entities() { +} + +/** + * @constructor + */ +function _Entities$() { +}; + +_Entities$.prototype = new _Entities; + +/** + * @return {Object.<string, undefined|!string>} + */ +_Entities.entity_list$ = function () { + /** @type {Object.<string, undefined|!string>} */ + var result; + /** @type {!string} */ + var key; + /** @type {*} */ + var value; + result = ({ }); + for (key in _Entities._entities) { + value = _Entities._entities[key]; + if (typeof value === 'string') { + result[key] = value + ""; + } else { + if (typeof value === 'number') { + result[key] = String.fromCharCode(value | 0); + } + } + } + return result; +}; + +var _Entities$entity_list$ = _Entities.entity_list$; + +/** + * class BitVector extends Object + * @constructor + */ +function BitVector() { +} + +/** + * @constructor + */ +function BitVector$() { + /** @type {Array.<undefined|!number>} */ + var _v$0; + /** @type {Array.<undefined|!number>} */ + var _r$0; + _r$0 = this._r = [ ]; + _v$0 = this._v = [ ]; + _v$0.length = 0; + _r$0.length = 0; + this._size = 0; + this._size1 = 0; +}; + +BitVector$.prototype = new BitVector; + +/** + */ +BitVector.prototype.build$ = function () { + /** @type {!number} */ + var i; + this._size1 = 0; + for (i = 0; i < this._v.length; i++) { + if (i % 8 === 0) { + this._r.push(true ? this._size1 : this._size - this._size1); + } + this._size1 += this._rank32$IIB(this._v[i], 32, true); + } +}; + +/** + */ +BitVector.prototype.clear$ = function () { + this._v.length = 0; + this._r.length = 0; + this._size = 0; + this._size1 = 0; +}; + +/** + * @return {!number} + */ +BitVector.prototype.size$ = function () { + return this._size; +}; + +/** + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.size$B = function (b) { + return (b ? this._size1 : this._size - this._size1); +}; + +/** + * @param {!number} value + */ +BitVector.prototype.set$I = function (value) { + this.set$IB(value, true); +}; + +/** + * @param {!number} value + * @param {!boolean} flag + */ +BitVector.prototype.set$IB = function (value, flag) { + /** @type {!number} */ + var q; + /** @type {!number} */ + var r; + /** @type {!number} */ + var m; + if (value >= this._size) { + this._size = (value + 1 | 0); + } + q = (value / 32 | 0); + r = (value % 32 | 0); + while (q >= this._v.length) { + this._v.push(0); + } + m = 0x1 << r; + if (flag) { + this._v[q] |= m; + } else { + this._v[q] &= ~ m; + } +}; + +/** + * @param {!number} value + * @return {!boolean} + */ +BitVector.prototype.get$I = function (value) { + /** @type {!number} */ + var q; + /** @type {!number} */ + var r; + /** @type {!number} */ + var m; + if (value >= this._size) { + throw new Error("BitVector.get() : range error"); + } + q = (value / 32 | 0); + r = (value % 32 | 0); + m = 0x1 << r; + return !! (this._v[q] & m); +}; + +/** + * @param {!number} i + * @return {!number} + */ +BitVector.prototype.rank$I = function (i) { + return this.rank$IB(i, true); +}; + +/** + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.rank$IB = function (i, b) { + /** @type {!number} */ + var q_large; + /** @type {!number} */ + var q_small; + /** @type {!number} */ + var r; + /** @type {!number} */ + var rank; + /** @type {!number} */ + var begin; + /** @type {!number} */ + var j; + if (i > this._size) { + throw new Error("BitVector.rank() : range error"); + } + if (i === 0) { + return 0; + } + i--; + q_large = (Math.floor(i / 256) | 0); + q_small = (Math.floor(i / 32) | 0); + r = (Math.floor(i % 32) | 0); + rank = (this._r[q_large] | 0); + if (! b) { + rank = q_large * 256 - rank; + } + begin = q_large * 8; + for (j = begin; j < q_small; j++) { + rank += this._rank32$IIB(this._v[j], 32, b); + } + rank += this._rank32$IIB(this._v[q_small], r + 1, b); + return rank; +}; + +/** + * @param {!number} i + * @return {!number} + */ +BitVector.prototype.select$I = function (i) { + return this.select$IB(i, true); +}; + +/** + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.select$IB = function (i, b) { + /** @type {!number} */ + var left; + /** @type {!number} */ + var right; + /** @type {!number} */ + var pivot; + /** @type {undefined|!number} */ + var rank; + /** @type {!number} */ + var j; + if (i >= (b ? this._size1 : this._size - this._size1)) { + throw new Error("BitVector.select() : range error"); + } + left = 0; + right = this._r.length; + while (left < right) { + pivot = Math.floor((left + right) / 2); + rank = this._r[pivot]; + if (! b) { + rank = pivot * 256 - rank; + } + if (i < rank) { + right = pivot; + } else { + left = pivot + 1; + } + } + right--; + if (b) { + i -= (this._r[right] | 0); + } else { + i -= (right * 256 - this._r[right] | 0); + } + j = right * 8; + while (1) { + rank = this._rank32$IIB(this._v[j], 32, b); + if (i < rank) { + break; + } + j++; + i -= (rank | 0); + } + return (j * 32 + this._select32$IIB(this._v[j], i, b) | 0); +}; + +/** + * @param {!number} x + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype._rank32$IIB = function (x, i, b) { + if (! b) { + x = ~ x; + } + x <<= 32 - i; + x = ((x & 0xaaaaaaaa) >>> 1) + (x & 0x55555555); + x = ((x & 0xcccccccc) >>> 2) + (x & 0x33333333); + x = ((x & 0xf0f0f0f0) >>> 4) + (x & 0x0f0f0f0f); + x = ((x & 0xff00ff00) >>> 8) + (x & 0x00ff00ff); + x = ((x & 0xffff0000) >>> 16) + (x & 0x0000ffff); + return x; +}; + +/** + * @param {!number} x + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype._select32$IIB = function (x, i, b) { + /** @type {!number} */ + var x1; + /** @type {!number} */ + var x2; + /** @type {!number} */ + var x3; + /** @type {!number} */ + var x4; + /** @type {!number} */ + var x5; + /** @type {!number} */ + var pos; + /** @type {!number} */ + var v5; + /** @type {!number} */ + var v4; + /** @type {!number} */ + var v3; + /** @type {!number} */ + var v2; + /** @type {!number} */ + var v1; + /** @type {!number} */ + var v0; + if (! b) { + x = ~ x; + } + x1 = ((x & 0xaaaaaaaa) >>> 1) + (x & 0x55555555); + x2 = ((x1 & 0xcccccccc) >>> 2) + (x1 & 0x33333333); + x3 = ((x2 & 0xf0f0f0f0) >>> 4) + (x2 & 0x0f0f0f0f); + x4 = ((x3 & 0xff00ff00) >>> 8) + (x3 & 0x00ff00ff); + x5 = ((x4 & 0xffff0000) >>> 16) + (x4 & 0x0000ffff); + i++; + pos = 0; + v5 = x5 & 0xffffffff; + if (i > v5) { + i -= (v5 | 0); + pos += 32; + } + v4 = x4 >>> pos & 0x0000ffff; + if (i > v4) { + i -= (v4 | 0); + pos += 16; + } + v3 = x3 >>> pos & 0x000000ff; + if (i > v3) { + i -= (v3 | 0); + pos += 8; + } + v2 = x2 >>> pos & 0x0000000f; + if (i > v2) { + i -= (v2 | 0); + pos += 4; + } + v1 = x1 >>> pos & 0x00000003; + if (i > v1) { + i -= (v1 | 0); + pos += 2; + } + v0 = x >>> pos & 0x00000001; + if (i > v0) { + i -= (v0 | 0); + pos += 1; + } + return (pos | 0); +}; + +/** + * @return {!string} + */ +BitVector.prototype.dump$ = function () { + /** @type {Array.<undefined|!string>} */ + var contents; + contents = [ ]; + contents.push(Binary$dump32bitNumber$N(this._size)); + contents.push(Binary$dump32bitNumberList$AN(this._v)); + return contents.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +BitVector.prototype.dump$LCompressionReport$ = function (report) { + /** @type {Array.<undefined|!string>} */ + var contents; + contents = [ ]; + contents.push(Binary$dump32bitNumber$N(this._size)); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents.push(Binary$dump32bitNumberList$ANLCompressionReport$(this._v, report)); + return contents.join(''); +}; + +/** + * @param {!string} data + * @return {!number} + */ +BitVector.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +BitVector.prototype.load$SI = function (data, offset) { + /** @type {LoadedNumberListResult} */ + var result; + /** @type {!number} */ + var result$0; + this._v.length = 0; + this._r.length = 0; + this._size = 0; + this._size1 = 0; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._size = (result$0 | 0); + result = Binary$load32bitNumberList$SI(data, offset + 2); + this._v = result.result; + this.build$(); + return result.offset; +}; + +/** + * class WaveletMatrix extends Object + * @constructor + */ +function WaveletMatrix() { +} + +/** + * @constructor + */ +function WaveletMatrix$() { + /** @type {Array.<undefined|BitVector>} */ + var _bv$0; + /** @type {Array.<undefined|!number>} */ + var _seps$0; + this._range = ({ }); + _bv$0 = this._bv = [ ]; + _seps$0 = this._seps = [ ]; + this._bitsize = 16; + _bv$0.length = 0; + _seps$0.length = 0; + this._size = 0; +}; + +WaveletMatrix$.prototype = new WaveletMatrix; + +/** + * @return {!number} + */ +WaveletMatrix.prototype.bitsize$ = function () { + return this._bitsize; +}; + +/** + * @param {!number} charCode + */ +WaveletMatrix.prototype.setMaxCharCode$I = function (charCode) { + this._bitsize = (Math.ceil(Math.log(charCode) / 0.6931471805599453) | 0); +}; + +/** + */ +WaveletMatrix.prototype.clear$ = function () { + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; +}; + +/** + * @param {!string} v + */ +WaveletMatrix.prototype.build$S = function (v) { + /** @type {!number} */ + var size; + /** @type {!number} */ + var bitsize; + /** @type {!number} */ + var i; + /** @type {!number} */ + var depth; + /** @type {Object.<string, undefined|!number>} */ + var range_tmp; + /** @type {!number} */ + var code; + /** @type {!boolean} */ + var bit; + /** @type {!number} */ + var key; + /** @type {Object.<string, undefined|!number>} */ + var range_rev; + /** @type {!string} */ + var range_key; + /** @type {!number} */ + var value; + /** @type {!number} */ + var pos0; + /** @type {undefined|!number} */ + var pos1; + /** @type {!string} */ + var range_rev_key; + /** @type {!number} */ + var begin; + /** @type {undefined|!number} */ + var end; + /** @type {!number} */ + var num0; + /** @type {!number} */ + var num1; + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; + size = v.length; + bitsize = this._bitsize; + for (i = 0; i < bitsize; i++) { + this._bv.push(new BitVector$()); + this._seps.push(0); + } + this._size = (size | 0); + for (i = 0; i < size; i++) { + this._bv[0].set$IB(i, this._uint2bit$II(v.charCodeAt(i), 0)); + } + this._bv[0].build$(); + this._seps[0] = this._bv[0].size$B(false); + this._range["0"] = 0; + this._range["1"] = this._seps[0]; + depth = 1; + while (depth < bitsize) { + range_tmp = WaveletMatrix$_shallow_copy$HI(this._range); + for (i = 0; i < size; i++) { + code = v.charCodeAt(i); + bit = this._uint2bit$II(code, depth); + key = code >>> bitsize - depth; + this._bv[depth].set$IB(range_tmp[key + ""], bit); + range_tmp[key + ""]++; + } + this._bv[depth].build$(); + this._seps[depth] = this._bv[depth].size$B(false); + range_rev = ({ }); + for (range_key in this._range) { + value = this._range[range_key]; + if (value != range_tmp[range_key]) { + range_rev[value + ""] = range_key | 0; + } + } + this._range = ({ }); + pos0 = 0; + pos1 = this._seps[depth]; + for (range_rev_key in range_rev) { + begin = range_rev_key | 0; + value = range_rev[range_rev_key]; + end = range_tmp[value + ""]; + num0 = this._bv[depth].rank$IB(end, false) - this._bv[depth].rank$IB(begin, false); + num1 = end - begin - num0; + if (num0 > 0) { + this._range[(value << 1) + ""] = (pos0 | 0); + pos0 += num0; + } + if (num1 > 0) { + this._range[(value << 1) + 1 + ""] = pos1; + pos1 += (num1 | 0); + } + } + depth++; + } +}; + +/** + * @return {!number} + */ +WaveletMatrix.prototype.size$ = function () { + return this._size; +}; + +/** + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.size$I = function (c) { + return this.rank$II(this._size, c); +}; + +/** + * @param {!number} i + * @return {!number} + */ +WaveletMatrix.prototype.get$I = function (i) { + /** @type {!number} */ + var value; + /** @type {!number} */ + var depth; + /** @type {!boolean} */ + var bit; + if (i >= this._size) { + throw new Error("WaveletMatrix.get() : range error"); + } + value = 0; + depth = 0; + while (depth < this._bitsize) { + bit = this._bv[depth].get$I(i); + i = this._bv[depth].rank$IB(i, bit); + value <<= 1; + if (bit) { + i += this._seps[depth]; + value += 1; + } + depth++; + } + return (value | 0); +}; + +/** + * @param {!number} i + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.rank$II = function (i, c) { + /** @type {undefined|!number} */ + var begin; + /** @type {!number} */ + var end; + /** @type {!number} */ + var depth; + /** @type {!boolean} */ + var bit; + if (i > this._size) { + throw new Error("WaveletMatrix.rank(): range error"); + } + if (i === 0) { + return 0; + } + begin = this._range[c + ""]; + if (begin == null) { + return 0; + } + end = i; + depth = 0; + while (depth < this._bitsize) { + bit = this._uint2bit$II(c, depth); + end = this._bv[depth].rank$IB(end, bit); + if (bit) { + end += this._seps[depth]; + } + depth++; + } + return (end - begin | 0); +}; + +/** + * @param {!number} i + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.rank_less_than$II = function (i, c) { + /** @type {!number} */ + var begin; + /** @type {!number} */ + var end; + /** @type {!number} */ + var depth; + /** @type {!number} */ + var rlt; + /** @type {!number} */ + var rank0_begin; + /** @type {!number} */ + var rank0_end; + /** @type {Array.<undefined|!number>} */ + var _seps$0; + if (i > this._size) { + throw new Error("WaveletMatrix.rank_less_than(): range error"); + } + if (i === 0) { + return 0; + } + begin = 0; + end = i; + depth = 0; + rlt = 0; + while (depth < this._bitsize) { + rank0_begin = this._bv[depth].rank$IB(begin, false); + rank0_end = this._bv[depth].rank$IB(end, false); + if (this._uint2bit$II(c, depth)) { + rlt += rank0_end - rank0_begin; + begin += (_seps$0 = this._seps)[depth] - rank0_begin; + end += _seps$0[depth] - rank0_end; + } else { + begin = rank0_begin; + end = rank0_end; + } + depth++; + } + return (rlt | 0); +}; + +/** + * @return {!string} + */ +WaveletMatrix.prototype.dump$ = function () { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!string>} */ + var range_contents; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + contents = [ Binary$dump16bitNumber$I(this._bitsize), Binary$dump32bitNumber$N(this._size) ]; + for (i = 0; i < this._bitsize; i++) { + contents.push(this._bv[i].dump$()); + } + for (i = 0; i < this._bitsize; i++) { + contents.push(Binary$dump32bitNumber$N(this._seps[i])); + } + range_contents = [ ]; + counter = 0; + for (key in this._range) { + range_contents.push(Binary$dump32bitNumber$N(key | 0)); + range_contents.push(Binary$dump32bitNumber$N(this._range[key])); + counter++; + } + contents.push(Binary$dump32bitNumber$N(counter)); + return contents.join('') + range_contents.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +WaveletMatrix.prototype.dump$LCompressionReport$ = function (report) { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!string>} */ + var range_contents; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + contents = [ Binary$dump16bitNumber$I(this._bitsize), Binary$dump32bitNumber$N(this._size) ]; + CompressionReport$add$LCompressionReport$II(report, 3, 3); + for (i = 0; i < this._bitsize; i++) { + contents.push(this._bv[i].dump$LCompressionReport$(report)); + } + for (i = 0; i < this._bitsize; i++) { + contents.push(Binary$dump32bitNumber$N(this._seps[i])); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + } + range_contents = [ ]; + counter = 0; + for (key in this._range) { + range_contents.push(Binary$dump32bitNumber$N(key | 0)); + range_contents.push(Binary$dump32bitNumber$N(this._range[key])); + CompressionReport$add$LCompressionReport$II(report, 4, 4); + counter++; + } + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents.push(Binary$dump32bitNumber$N(counter)); + return contents.join('') + range_contents.join(''); +}; + +/** + * @param {!string} data + * @return {!number} + */ +WaveletMatrix.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +WaveletMatrix.prototype.load$SI = function (data, offset) { + /** @type {!number} */ + var i; + /** @type {BitVector} */ + var bit_vector; + /** @type {!number} */ + var range_size; + /** @type {!number} */ + var value; + /** @type {!number} */ + var offset$0; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var result$1; + /** @type {!number} */ + var result$2; + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; + offset$0 = offset++; + this._bitsize = (data.charCodeAt(offset$0) | 0); + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._size = (result$0 | 0); + offset += 2; + for (i = 0; i < this._bitsize; i++) { + bit_vector = new BitVector$(); + offset = bit_vector.load$SI(data, offset); + this._bv.push(bit_vector); + } + for (i = 0; i < this._bitsize; (i++, offset += 2)) { + this._seps.push(Binary$load32bitNumber$SI(data, offset)); + } + result$1 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + range_size = result$1; + offset += 2; + for (i = 0; i < range_size; (i++, offset += 4)) { + result$2 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + value = Binary$load32bitNumber$SI(data, offset + 2); + this._range[result$2 + ""] = (value | 0); + } + return offset; +}; + +/** + * @param {Object.<string, undefined|!number>} input + * @return {Object.<string, undefined|!number>} + */ +WaveletMatrix._shallow_copy$HI = function (input) { + /** @type {Object.<string, undefined|!number>} */ + var result; + /** @type {!string} */ + var key; + result = ({ }); + for (key in input) { + result[key] = input[key]; + } + return result; +}; + +var WaveletMatrix$_shallow_copy$HI = WaveletMatrix._shallow_copy$HI; + +/** + * @param {!number} c + * @param {!number} i + * @return {!boolean} + */ +WaveletMatrix.prototype._uint2bit$II = function (c, i) { + return (c >>> this._bitsize - 1 - i & 0x1) === 0x1; +}; + +/** + * class BurrowsWheelerTransform extends Object + * @constructor + */ +function BurrowsWheelerTransform() { +} + +/** + * @constructor + */ +function BurrowsWheelerTransform$() { + this._str = ""; + this._size = 0; + this._head = 0; + this._suffixarray = [ ]; +}; + +BurrowsWheelerTransform$.prototype = new BurrowsWheelerTransform; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!number} + */ +BurrowsWheelerTransform.size$LBurrowsWheelerTransform$ = function ($this) { + return $this._size; +}; + +var BurrowsWheelerTransform$size$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.size$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!number} + */ +BurrowsWheelerTransform.head$LBurrowsWheelerTransform$ = function ($this) { + return $this._head; +}; + +var BurrowsWheelerTransform$head$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.head$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + */ +BurrowsWheelerTransform.clear$LBurrowsWheelerTransform$ = function ($this) { + $this._str = ""; + $this._size = 0; + $this._head = 0; + $this._suffixarray.length = 0; +}; + +var BurrowsWheelerTransform$clear$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.clear$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!string} str + */ +BurrowsWheelerTransform.build$LBurrowsWheelerTransform$S = function ($this, str) { + /** @type {!string} */ + var _str$0; + /** @type {Array.<undefined|!number>} */ + var _suffixarray$0; + _str$0 = $this._str = str; + $this._size = _str$0.length; + _suffixarray$0 = $this._suffixarray = SAIS$make$S(str); + $this._head = (_suffixarray$0.indexOf(0) | 0); +}; + +var BurrowsWheelerTransform$build$LBurrowsWheelerTransform$S = BurrowsWheelerTransform.build$LBurrowsWheelerTransform$S; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!number} i + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$I = function ($this, i) { + /** @type {!number} */ + var size; + /** @type {!number} */ + var index; + size = $this._size; + if (i >= size) { + throw new Error("BurrowsWheelerTransform.get() : range error"); + } + index = ($this._suffixarray[i] + size - 1) % size; + return $this._str.charAt(index); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$I = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$I; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$ = function ($this) { + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var size; + /** @type {!number} */ + var i; + str = [ ]; + size = $this._size; + for (i = 0; i < size; i++) { + str.push(BurrowsWheelerTransform$get$LBurrowsWheelerTransform$I($this, i)); + } + return str.join(""); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!string} replace + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$S = function ($this, replace) { + /** @type {!string} */ + var result; + result = BurrowsWheelerTransform$get$LBurrowsWheelerTransform$($this); + return result.replace(BurrowsWheelerTransform.END_MARKER, replace); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$S = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$S; + +/** + * class OArray extends Object + * @constructor + */ +function OArray() { +} + +/** + * @constructor + * @param {Array.<undefined|!number>} array + */ +function OArray$AI(array) { + this.array = array; + this.offset = 0; +}; + +OArray$AI.prototype = new OArray; + +/** + * @constructor + * @param {Array.<undefined|!number>} array + * @param {!number} offset + */ +function OArray$AII(array, offset) { + this.array = array; + this.offset = offset; +}; + +OArray$AII.prototype = new OArray; + +/** + * @param {OArray} $this + * @param {!number} index + * @return {!number} + */ +OArray.get$LOArray$I = function ($this, index) { + return $this.array[index + $this.offset]; +}; + +var OArray$get$LOArray$I = OArray.get$LOArray$I; + +/** + * @param {OArray} $this + * @param {!number} index + * @param {!number} value + */ +OArray.set$LOArray$II = function ($this, index, value) { + $this.array[index + $this.offset] = value; +}; + +var OArray$set$LOArray$II = OArray.set$LOArray$II; + +/** + * @param {OArray} $this + * @param {!number} index + * @return {!boolean} + */ +OArray.isS$LOArray$I = function ($this, index) { + /** @type {Array.<undefined|!number>} */ + var array$0; + /** @type {!number} */ + var offset$0; + return (array$0 = $this.array)[index + (offset$0 = $this.offset)] < array$0[index + offset$0 + 1]; +}; + +var OArray$isS$LOArray$I = OArray.isS$LOArray$I; + +/** + * @param {OArray} $this + * @param {!number} index1 + * @param {!number} index2 + * @return {!boolean} + */ +OArray.compare$LOArray$II = function ($this, index1, index2) { + /** @type {Array.<undefined|!number>} */ + var array$0; + /** @type {!number} */ + var offset$0; + return (array$0 = $this.array)[index1 + (offset$0 = $this.offset)] == array$0[index2 + offset$0]; +}; + +var OArray$compare$LOArray$II = OArray.compare$LOArray$II; + +/** + * class SAIS extends Object + * @constructor + */ +function SAIS() { +} + +/** + * @constructor + */ +function SAIS$() { +}; + +SAIS$.prototype = new SAIS; + +/** + * @param {BitVector} t + * @param {!number} i + * @return {!boolean} + */ +SAIS._isLMS$LBitVector$I = function (t, i) { + return i > 0 && t.get$I(i) && ! t.get$I(i - 1); +}; + +var SAIS$_isLMS$LBitVector$I = SAIS._isLMS$LBitVector$I; + +/** + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._getBuckets$LOArray$AIIIB = function (s, bkt, n, K, end) { + /** @type {!number} */ + var sum; + /** @type {!number} */ + var i; + sum = 0; + for (i = 0; i <= K; i++) { + bkt[i] = 0; + } + for (i = 0; i < n; i++) { + bkt[OArray$get$LOArray$I(s, i)]++; + } + for (i = 0; i <= K; i++) { + sum += bkt[i]; + bkt[i] = ((end ? sum : sum - bkt[i]) | 0); + } +}; + +var SAIS$_getBuckets$LOArray$AIIIB = SAIS._getBuckets$LOArray$AIIIB; + +/** + * @param {BitVector} t + * @param {Array.<undefined|!number>} SA + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._induceSAl$LBitVector$AILOArray$AIIIB = function (t, SA, s, bkt, n, K, end) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var j; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, end); + for (i = 0; i < n; i++) { + j = SA[i] - 1; + if (j >= 0 && ! t.get$I(j)) { + SA[bkt[OArray$get$LOArray$I(s, j)]++] = (j | 0); + } + } +}; + +var SAIS$_induceSAl$LBitVector$AILOArray$AIIIB = SAIS._induceSAl$LBitVector$AILOArray$AIIIB; + +/** + * @param {BitVector} t + * @param {Array.<undefined|!number>} SA + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._induceSAs$LBitVector$AILOArray$AIIIB = function (t, SA, s, bkt, n, K, end) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var j; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, end); + for (i = n - 1; i >= 0; i--) { + j = SA[i] - 1; + if (j >= 0 && t.get$I(j)) { + SA[-- bkt[OArray$get$LOArray$I(s, j)]] = (j | 0); + } + } +}; + +var SAIS$_induceSAs$LBitVector$AILOArray$AIIIB = SAIS._induceSAs$LBitVector$AILOArray$AIIIB; + +/** + * @param {!string} source + * @return {Array.<undefined|!number>} + */ +SAIS.make$S = function (source) { + /** @type {Array.<undefined|!number>} */ + var charCodes; + /** @type {!number} */ + var maxCode; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {Array.<undefined|!number>} */ + var SA; + /** @type {OArray} */ + var s; + charCodes = [ ]; + charCodes.length = source.length; + maxCode = 0; + for (i = 0; i < source.length; i++) { + code = source.charCodeAt(i); + charCodes[i] = (code | 0); + maxCode = (code > maxCode ? code : maxCode); + } + SA = [ ]; + SA.length = source.length; + s = ({offset: 0, array: charCodes}); + SAIS$_make$LOArray$AIII(s, SA, source.length, maxCode); + return SA; +}; + +var SAIS$make$S = SAIS.make$S; + +/** + * @param {OArray} s + * @param {Array.<undefined|!number>} SA + * @param {!number} n + * @param {!number} K + */ +SAIS._make$LOArray$AIII = function (s, SA, n, K) { + /** @type {BitVector} */ + var t; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!number>} */ + var bkt; + /** @type {!number} */ + var n1; + /** @type {!number} */ + var name; + /** @type {!number} */ + var prev; + /** @type {undefined|!number} */ + var pos; + /** @type {!boolean} */ + var diff; + /** @type {!number} */ + var d; + /** @type {!number} */ + var j; + /** @type {Array.<undefined|!number>} */ + var SA1; + /** @type {OArray} */ + var s1; + /** @type {!number} */ + var i$0; + /** @type {!number} */ + var index$0; + t = new BitVector$(); + t.set$IB(n - 2, false); + t.set$IB(n - 1, true); + for (i = n - 3; i >= 0; i--) { + t.set$IB(i, OArray$isS$LOArray$I(s, i) || OArray$compare$LOArray$II(s, i, i + 1) && t.get$I(i + 1)); + } + bkt = [ ]; + bkt.length = K + 1; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, true); + for (i = 0; i < n; i++) { + SA[i] = -1; + } + for (i = 1; i < n; i++) { + if (SAIS$_isLMS$LBitVector$I(t, i)) { + SA[-- bkt[OArray$get$LOArray$I(s, i)]] = (i | 0); + } + } + SAIS$_induceSAl$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, false); + SAIS$_induceSAs$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, true); + n1 = 0; + for (i = 0; i < n; i++) { + i$0 = SA[i]; + if (i$0 > 0 && t.get$I(i$0) && ! t.get$I(i$0 - 1)) { + SA[n1++] = SA[i]; + } + } + for (i = n1; i < n; i++) { + SA[i] = -1; + } + name = 0; + prev = -1; + for (i = 0; i < n1; i++) { + pos = SA[i]; + diff = false; + for (d = 0; d < n; d++) { + if (prev === -1 || ! OArray$compare$LOArray$II(s, pos + d, prev + d) || t.get$I(pos + d) !== t.get$I(prev + d)) { + diff = true; + break; + } else { + if (d > 0 && (SAIS$_isLMS$LBitVector$I(t, pos + d) || SAIS$_isLMS$LBitVector$I(t, prev + d))) { + break; + } + } + } + if (diff) { + name++; + prev = pos; + } + pos = ((pos % 2 === 0 ? pos / 2 : (pos - 1) / 2) | 0); + SA[n1 + pos] = (name - 1 | 0); + } + for ((i = n - 1, j = n - 1); i >= n1; i--) { + if (SA[i] >= 0) { + SA[j--] = SA[i]; + } + } + SA1 = SA; + s1 = ({offset: n - n1, array: SA}); + if (name < n1) { + SAIS$_make$LOArray$AIII(s1, SA1, n1, name - 1); + } else { + for (i = 0; i < n1; i++) { + SA1[OArray$get$LOArray$I(s1, i)] = (i | 0); + } + } + bkt = [ ]; + bkt.length = K + 1; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, true); + for ((i = 1, j = 0); i < n; i++) { + if (SAIS$_isLMS$LBitVector$I(t, i)) { + OArray$set$LOArray$II(s1, j++, i); + } + } + for (i = 0; i < n1; i++) { + index$0 = SA1[i]; + SA1[i] = s1.array[index$0 + s1.offset]; + } + for (i = n1; i < n; i++) { + SA[i] = -1; + } + for (i = n1 - 1; i >= 0; i--) { + j = SA[i]; + SA[i] = -1; + SA[-- bkt[OArray$get$LOArray$I(s, j)]] = (j | 0); + } + SAIS$_induceSAl$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, false); + SAIS$_induceSAs$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, true); +}; + +var SAIS$_make$LOArray$AIII = SAIS._make$LOArray$AIII; + +OktaviaSearch._stemmer = null; +OktaviaSearch._instance = null; +$__jsx_lazy_init(Oktavia, "eof", function () { + return String.fromCharCode(0); +}); +$__jsx_lazy_init(Oktavia, "eob", function () { + return String.fromCharCode(1); +}); +$__jsx_lazy_init(Oktavia, "unknown", function () { + return String.fromCharCode(3); +}); +Binary._base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +$__jsx_lazy_init(Binary, "_base64DecodeChars", function () { + return [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 ]; +}); +$__jsx_lazy_init(Style, "console", function () { + return ({ 'title': [ '\x1B[32m\x1b[4m', '\x1B[39m\x1b[0m' ], 'url': [ '\x1B[34m', '\x1B[39m' ], 'hit': [ '\x1B[4m', '\x1B[0m' ], 'del': [ '\x1B[9m', '\x1B[0m' ], 'summary': [ '\x1B[90m', '\x1B[39m' ] }); +}); +$__jsx_lazy_init(Style, "html", function () { + return ({ 'title': [ '<span class="title">', '</span>' ], 'url': [ '<span class="url">', '</span>' ], 'hit': [ '<span class="hit">', '</span>' ], 'del': [ '<del>', '</del>' ], 'summary': [ '<span class="reuslt">', '</span>' ] }); +}); +$__jsx_lazy_init(Style, "ignore", function () { + return ({ 'tilte': [ '', '' ], 'url': [ '', '' ], 'hit': [ '', '' ], 'del': [ '', '' ], 'summary': [ '', '' ] }); +}); +EnglishStemmer.serialVersionUID = 1; +$__jsx_lazy_init(EnglishStemmer, "methodObject", function () { + return new EnglishStemmer$(); +}); +$__jsx_lazy_init(EnglishStemmer, "a_0", function () { + return [ new Among$SII("arsen", -1, -1), new Among$SII("commun", -1, -1), new Among$SII("gener", -1, -1) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_1", function () { + return [ new Among$SII("'", -1, 1), new Among$SII("'s'", 0, 1), new Among$SII("'s", -1, 1) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_2", function () { + return [ new Among$SII("ied", -1, 2), new Among$SII("s", -1, 3), new Among$SII("ies", 1, 2), new Among$SII("sses", 1, 1), new Among$SII("ss", 1, -1), new Among$SII("us", 1, -1) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_3", function () { + return [ new Among$SII("", -1, 3), new Among$SII("bb", 0, 2), new Among$SII("dd", 0, 2), new Among$SII("ff", 0, 2), new Among$SII("gg", 0, 2), new Among$SII("bl", 0, 1), new Among$SII("mm", 0, 2), new Among$SII("nn", 0, 2), new Among$SII("pp", 0, 2), new Among$SII("rr", 0, 2), new Among$SII("at", 0, 1), new Among$SII("tt", 0, 2), new Among$SII("iz", 0, 1) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_4", function () { + return [ new Among$SII("ed", -1, 2), new Among$SII("eed", 0, 1), new Among$SII("ing", -1, 2), new Among$SII("edly", -1, 2), new Among$SII("eedly", 3, 1), new Among$SII("ingly", -1, 2) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_5", function () { + return [ new Among$SII("anci", -1, 3), new Among$SII("enci", -1, 2), new Among$SII("ogi", -1, 13), new Among$SII("li", -1, 16), new Among$SII("bli", 3, 12), new Among$SII("abli", 4, 4), new Among$SII("alli", 3, 8), new Among$SII("fulli", 3, 14), new Among$SII("lessli", 3, 15), new Among$SII("ousli", 3, 10), new Among$SII("entli", 3, 5), new Among$SII("aliti", -1, 8), new Among$SII("biliti", -1, 12), new Among$SII("iviti", -1, 11), new Among$SII("tional", -1, 1), new Among$SII("ational", 14, 7), new Among$SII("alism", -1, 8), new Among$SII("ation", -1, 7), new Among$SII("ization", 17, 6), new Among$SII("izer", -1, 6), new Among$SII("ator", -1, 7), new Among$SII("iveness", -1, 11), new Among$SII("fulness", -1, 9), new Among$SII("ousness", -1, 10) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_6", function () { + return [ new Among$SII("icate", -1, 4), new Among$SII("ative", -1, 6), new Among$SII("alize", -1, 3), new Among$SII("iciti", -1, 4), new Among$SII("ical", -1, 4), new Among$SII("tional", -1, 1), new Among$SII("ational", 5, 2), new Among$SII("ful", -1, 5), new Among$SII("ness", -1, 5) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_7", function () { + return [ new Among$SII("ic", -1, 1), new Among$SII("ance", -1, 1), new Among$SII("ence", -1, 1), new Among$SII("able", -1, 1), new Among$SII("ible", -1, 1), new Among$SII("ate", -1, 1), new Among$SII("ive", -1, 1), new Among$SII("ize", -1, 1), new Among$SII("iti", -1, 1), new Among$SII("al", -1, 1), new Among$SII("ism", -1, 1), new Among$SII("ion", -1, 2), new Among$SII("er", -1, 1), new Among$SII("ous", -1, 1), new Among$SII("ant", -1, 1), new Among$SII("ent", -1, 1), new Among$SII("ment", 15, 1), new Among$SII("ement", 16, 1) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_8", function () { + return [ new Among$SII("e", -1, 1), new Among$SII("l", -1, 2) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_9", function () { + return [ new Among$SII("succeed", -1, -1), new Among$SII("proceed", -1, -1), new Among$SII("exceed", -1, -1), new Among$SII("canning", -1, -1), new Among$SII("inning", -1, -1), new Among$SII("earring", -1, -1), new Among$SII("herring", -1, -1), new Among$SII("outing", -1, -1) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "a_10", function () { + return [ new Among$SII("andes", -1, -1), new Among$SII("atlas", -1, -1), new Among$SII("bias", -1, -1), new Among$SII("cosmos", -1, -1), new Among$SII("dying", -1, 3), new Among$SII("early", -1, 9), new Among$SII("gently", -1, 7), new Among$SII("howe", -1, -1), new Among$SII("idly", -1, 6), new Among$SII("lying", -1, 4), new Among$SII("news", -1, -1), new Among$SII("only", -1, 10), new Among$SII("singly", -1, 11), new Among$SII("skies", -1, 2), new Among$SII("skis", -1, 1), new Among$SII("sky", -1, -1), new Among$SII("tying", -1, 5), new Among$SII("ugly", -1, 8) ]; +}); +$__jsx_lazy_init(EnglishStemmer, "g_v", function () { + return [ 17, 65, 16, 1 ]; +}); +$__jsx_lazy_init(EnglishStemmer, "g_v_WXY", function () { + return [ 1, 17, 65, 208, 1 ]; +}); +$__jsx_lazy_init(EnglishStemmer, "g_valid_LI", function () { + return [ 55, 141, 2 ]; +}); +$__jsx_lazy_init(_Common, "buffers", function () { + return [ "comment", "sgmlDecl", "textNode", "tagName", "doctype", "procInstName", "procInstBody", "entity", "attribName", "attribValue", "cdata", "script" ]; +}); +$__jsx_lazy_init(_Common, "EVENTS", function () { + return [ "text", "processinginstruction", "sgmldeclaration", "doctype", "comment", "attribute", "opentag", "closetag", "opencdata", "cdata", "clo_State.CDATA", "error", "end", "ready", "script", "opennamespace", "closenamespace" ]; +}); +_Common.MAX_BUFFER_LENGTH = 65536; +_State.BEGIN = 1; +_State.TEXT = 2; +_State.TEXT_ENTITY = 3; +_State.OPEN_WAKA = 4; +_State.SGML_DECL = 5; +_State.SGML_DECL_QUOTED = 6; +_State.DOCTYPE = 7; +_State.DOCTYPE_QUOTED = 8; +_State.DOCTYPE_DTD = 9; +_State.DOCTYPE_DTD_QUOTED = 10; +_State.COMMENT_STARTING = 11; +_State.COMMENT = 12; +_State.COMMENT_ENDING = 13; +_State.COMMENT_ENDED = 14; +_State.CDATA = 15; +_State.CDATA_ENDING = 16; +_State.CDATA_ENDING_2 = 17; +_State.PROC_INST = 18; +_State.PROC_INST_BODY = 19; +_State.PROC_INST_ENDING = 20; +_State.OPEN_TAG = 21; +_State.OPEN_TAG_SLASH = 22; +_State.ATTRIB = 23; +_State.ATTRIB_NAME = 24; +_State.ATTRIB_NAME_SAW_WHITE = 25; +_State.ATTRIB_VALUE = 26; +_State.ATTRIB_VALUE_QUOTED = 27; +_State.ATTRIB_VALUE_UNQUOTED = 28; +_State.ATTRIB_VALUE_ENTITY_Q = 29; +_State.ATTRIB_VALUE_ENTITY_U = 30; +_State.CLOSE_TAG = 31; +_State.CLOSE_TAG_SAW_WHITE = 32; +_State.SCRIPT = 33; +_State.SCRIPT_ENDING = 34; +$__jsx_lazy_init(_Entities, "_entities", function () { + return ({ "amp": "&", "gt": ">", "lt": "<", "quot": "\"", "apos": "'", "AElig": 198, "Aacute": 193, "Acirc": 194, "Agrave": 192, "Aring": 197, "Atilde": 195, "Auml": 196, "Ccedil": 199, "ETH": 208, "Eacute": 201, "Ecirc": 202, "Egrave": 200, "Euml": 203, "Iacute": 205, "Icirc": 206, "Igrave": 204, "Iuml": 207, "Ntilde": 209, "Oacute": 211, "Ocirc": 212, "Ograve": 210, "Oslash": 216, "Otilde": 213, "Ouml": 214, "THORN": 222, "Uacute": 218, "Ucirc": 219, "Ugrave": 217, "Uuml": 220, "Yacute": 221, "aacute": 225, "acirc": 226, "aelig": 230, "agrave": 224, "aring": 229, "atilde": 227, "auml": 228, "ccedil": 231, "eacute": 233, "ecirc": 234, "egrave": 232, "eth": 240, "euml": 235, "iacute": 237, "icirc": 238, "igrave": 236, "iuml": 239, "ntilde": 241, "oacute": 243, "ocirc": 244, "ograve": 242, "oslash": 248, "otilde": 245, "ouml": 246, "szlig": 223, "thorn": 254, "uacute": 250, "ucirc": 251, "ugrave": 249, "uuml": 252, "yacute": 253, "yuml": 255, "copy": 169, "reg": 174, "nbsp": 160, "iexcl": 161, "cent": 162, "pound": 163, "curren": 164, "yen": 165, "brvbar": 166, "sect": 167, "uml": 168, "ordf": 170, "laquo": 171, "not": 172, "shy": 173, "macr": 175, "deg": 176, "plusmn": 177, "sup1": 185, "sup2": 178, "sup3": 179, "acute": 180, "micro": 181, "para": 182, "middot": 183, "cedil": 184, "ordm": 186, "raquo": 187, "frac14": 188, "frac12": 189, "frac34": 190, "iquest": 191, "times": 215, "divide": 247, "OElig": 338, "oelig": 339, "Scaron": 352, "scaron": 353, "Yuml": 376, "fnof": 402, "circ": 710, "tilde": 732, "Alpha": 913, "Beta": 914, "Gamma": 915, "Delta": 916, "Epsilon": 917, "Zeta": 918, "Eta": 919, "Theta": 920, "Iota": 921, "Kappa": 922, "Lambda": 923, "Mu": 924, "Nu": 925, "Xi": 926, "Omicron": 927, "Pi": 928, "Rho": 929, "Sigma": 931, "Tau": 932, "Upsilon": 933, "Phi": 934, "Chi": 935, "Psi": 936, "Omega": 937, "alpha": 945, "beta": 946, "gamma": 947, "delta": 948, "epsilon": 949, "zeta": 950, "eta": 951, "theta": 952, "iota": 953, "kappa": 954, "lambda": 955, "mu": 956, "nu": 957, "xi": 958, "omicron": 959, "pi": 960, "rho": 961, "sigmaf": 962, "sigma": 963, "tau": 964, "upsilon": 965, "phi": 966, "chi": 967, "psi": 968, "omega": 969, "thetasym": 977, "upsih": 978, "piv": 982, "ensp": 8194, "emsp": 8195, "thinsp": 8201, "zwnj": 8204, "zwj": 8205, "lrm": 8206, "rlm": 8207, "ndash": 8211, "mdash": 8212, "lsquo": 8216, "rsquo": 8217, "sbquo": 8218, "ldquo": 8220, "rdquo": 8221, "bdquo": 8222, "dagger": 8224, "Dagger": 8225, "bull": 8226, "hellip": 8230, "permil": 8240, "prime": 8242, "Prime": 8243, "lsaquo": 8249, "rsaquo": 8250, "oline": 8254, "frasl": 8260, "euro": 8364, "image": 8465, "weierp": 8472, "real": 8476, "trade": 8482, "alefsym": 8501, "larr": 8592, "uarr": 8593, "rarr": 8594, "darr": 8595, "harr": 8596, "crarr": 8629, "lArr": 8656, "uArr": 8657, "rArr": 8658, "dArr": 8659, "hArr": 8660, "forall": 8704, "part": 8706, "exist": 8707, "empty": 8709, "nabla": 8711, "isin": 8712, "notin": 8713, "ni": 8715, "prod": 8719, "sum": 8721, "minus": 8722, "lowast": 8727, "radic": 8730, "prop": 8733, "infin": 8734, "ang": 8736, "and": 8743, "or": 8744, "cap": 8745, "cup": 8746, "int": 8747, "there4": 8756, "sim": 8764, "cong": 8773, "asymp": 8776, "ne": 8800, "equiv": 8801, "le": 8804, "ge": 8805, "sub": 8834, "sup": 8835, "nsub": 8836, "sube": 8838, "supe": 8839, "oplus": 8853, "otimes": 8855, "perp": 8869, "sdot": 8901, "lceil": 8968, "rceil": 8969, "lfloor": 8970, "rfloor": 8971, "lang": 9001, "rang": 9002, "loz": 9674, "spades": 9824, "clubs": 9827, "hearts": 9829, "diams": 9830 }); +}); +BitVector.SMALL_BLOCK_SIZE = 32; +BitVector.LARGE_BLOCK_SIZE = 256; +BitVector.BLOCK_RATE = 8; +$__jsx_lazy_init(BurrowsWheelerTransform, "END_MARKER", function () { + return String.fromCharCode(0); +}); +var $__jsx_classMap = { + "tool/web/oktavia-english-search.jsx": { + _Main: _Main, + _Main$: _Main$ + }, + "tool/web/oktavia-search.jsx": { + _Result: _Result, + _Result$SSSI: _Result$SSSI, + _Proposal: _Proposal, + _Proposal$SSI: _Proposal$SSI, + OktaviaSearch: OktaviaSearch, + OktaviaSearch$I: OktaviaSearch$I, + _Main: _Main$0, + _Main$: _Main$0$ + }, + "src/oktavia.jsx": { + Oktavia: Oktavia, + Oktavia$: Oktavia$ + }, + "src/binary-util.jsx": { + Binary: Binary, + Binary$: Binary$, + LoadedStringResult: LoadedStringResult, + LoadedStringResult$SI: LoadedStringResult$SI, + LoadedStringListResult: LoadedStringListResult, + LoadedStringListResult$SI: LoadedStringListResult$SI, + LoadedStringListMapResult: LoadedStringListMapResult, + LoadedStringListMapResult$SI: LoadedStringListMapResult$SI, + LoadedNumberListResult: LoadedNumberListResult, + LoadedNumberListResult$SI: LoadedNumberListResult$SI, + CompressionReport: CompressionReport, + CompressionReport$: CompressionReport$ + }, + "src/query.jsx": { + Query: Query, + Query$: Query$ + }, + "src/query-string-parser.jsx": { + QueryStringParser: QueryStringParser, + QueryStringParser$: QueryStringParser$ + }, + "src/search-result.jsx": { + Proposal: Proposal, + Proposal$II: Proposal$II, + Position: Position, + Position$SIB: Position$SIB, + SearchUnit: SearchUnit, + SearchUnit$I: SearchUnit$I, + SingleResult: SingleResult, + SingleResult$: SingleResult$, + SingleResult$SBB: SingleResult$SBB, + SearchSummary: SearchSummary, + SearchSummary$: SearchSummary$, + SearchSummary$LOktavia$: SearchSummary$LOktavia$ + }, + "src/style.jsx": { + Style: Style, + Style$S: Style$S, + _HTMLHandler: _HTMLHandler, + _HTMLHandler$HASB: _HTMLHandler$HASB + }, + "src/stemmer/stemmer.jsx": { + Stemmer: Stemmer, + Stemmer$: Stemmer$ + }, + "src/stemmer/base-stemmer.jsx": { + BaseStemmer: BaseStemmer, + BaseStemmer$: BaseStemmer$ + }, + "src/stemmer/english-stemmer.jsx": { + EnglishStemmer: EnglishStemmer, + EnglishStemmer$: EnglishStemmer$ + }, + "src/stemmer/among.jsx": { + Among: Among, + Among$SII: Among$SII, + Among$SIIF$LBaseStemmer$B$LBaseStemmer$: Among$SIIF$LBaseStemmer$B$LBaseStemmer$ + }, + "src/metadata.jsx": { + Metadata: Metadata, + Metadata$LOktavia$: Metadata$LOktavia$, + Section: Section, + Section$LOktavia$: Section$LOktavia$, + Splitter: Splitter, + Splitter$LOktavia$: Splitter$LOktavia$, + Splitter$LOktavia$S: Splitter$LOktavia$S, + Table: Table, + Table$LOktavia$AS: Table$LOktavia$AS, + Block: Block, + Block$LOktavia$: Block$LOktavia$ + }, + "src/fm-index.jsx": { + FMIndex: FMIndex, + FMIndex$: FMIndex$ + }, + "src/sax.jsx": { + Tag: Tag, + Tag$S: Tag$S, + _Common: _Common, + _Common$: _Common$, + _State: _State, + _State$: _State$, + SAXHandler: SAXHandler, + SAXHandler$: SAXHandler$, + SAXParser: SAXParser, + SAXParser$LSAXHandler$: SAXParser$LSAXHandler$, + SAXParser$LSAXHandler$B: SAXParser$LSAXHandler$B, + Char: Char, + Char$: Char$, + _Entities: _Entities, + _Entities$: _Entities$ + }, + "src/bit-vector.jsx": { + BitVector: BitVector, + BitVector$: BitVector$ + }, + "src/wavelet-matrix.jsx": { + WaveletMatrix: WaveletMatrix, + WaveletMatrix$: WaveletMatrix$ + }, + "src/burrows-wheeler-transform.jsx": { + BurrowsWheelerTransform: BurrowsWheelerTransform, + BurrowsWheelerTransform$: BurrowsWheelerTransform$ + }, + "src/sais.jsx": { + OArray: OArray, + OArray$AI: OArray$AI, + OArray$AII: OArray$AII, + SAIS: SAIS, + SAIS$: SAIS$ + } +}; + + +/** + * launches _Main.main(:string[]):void invoked by jsx --run|--executable + */ +JSX.runMain = function (sourceFile, args) { + var module = JSX.require(sourceFile); + if (! module) { + throw new ReferenceError("entry point module not found in " + sourceFile); + } + if (! module._Main) { + throw new ReferenceError("entry point _Main not found in " + sourceFile); + } + if (! module._Main.main$AS) { + throw new ReferenceError("entry point _Main.main(:string[]):void not found in " + sourceFile); + } + module._Main.main$AS(args); +}; + +/** + * launches _Test#test*():void invoked by jsx --test + */ +JSX.runTests = function (sourceFile, tests) { + var module = JSX.require(sourceFile); + var testClass = module._Test$; + + if (!testClass) return; // skip if there's no test class + + if(tests.length === 0) { + var p = testClass.prototype; + for (var m in p) { + if (p[m] instanceof Function + && /^test.*[$]$/.test(m)) { + tests.push(m); + } + } + } + else { // set as process arguments + tests = tests.map(function (name) { + return name + "$"; // mangle for function test*():void + }); + } + + var testCase = new testClass(); + + if (testCase.beforeClass$AS != null) + testCase.beforeClass$AS(tests); + + for (var i = 0; i < tests.length; ++i) { + (function (method) { + if (method in testCase) { + testCase.run$SF$V$(method, function() { testCase[method](); }); + } + else { + throw new ReferenceError("No such test method: " + method); + } + }(tests[i])); + } + + if (testCase.afterClass$ != null) + testCase.afterClass$(); +}; +/** + * call a function on load/DOMContentLoaded + */ +function $__jsx_onload (event) { + window.removeEventListener("load", $__jsx_onload); + document.removeEventListener("DOMContentLoaded", $__jsx_onload); + JSX.runMain("tool/web/oktavia-english-search.jsx", []) +} + +window.addEventListener("load", $__jsx_onload); +document.addEventListener("DOMContentLoaded", $__jsx_onload); + +})(JSX); diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-jquery-highlight.js b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-jquery-highlight.js new file mode 100644 index 00000000..519e8876 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-jquery-highlight.js @@ -0,0 +1,105 @@ +/** + * @fileOverview + * A UI script helper that provides search word highlight. + * Almost all code came from Sphinx + * @author Yoshiki Shibukawa, yoshiki@shibu.jp + */ + +(function ($) +{ + /** + * small helper function to urldecode strings + */ + function urldecode(x) + { + return decodeURIComponent(x).replace(/\+/g, ' '); + } + + /** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ + function getQueryParameters(s) + { + if (typeof s == 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) + { + var tmp = parts[i].split('=', 2); + var key = urldecode(tmp[0]); + var value = urldecode(tmp[1]); + if (key in result) + { + result[key].push(value); + } + else + { + result[key] = [value]; + } + } + return result; + } + + /** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ + jQuery.fn.highlightText = function(text, className) + { + function highlight(node) + { + if (node.nodeType == 3) + { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) + { + var span = document.createElement("span"); + span.className = className; + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + } + } + else if (!jQuery(node).is("button, select, textarea")) + { + jQuery.each(node.childNodes, function() { + highlight(this); + }); + } + } + return this.each(function() { + highlight(this); + }); + }; + + /** + * highlight the search words provided in the url in the text + */ + function highlightSearchWords(selector) + { + var params = getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) + { + var body = $(selector); + window.setTimeout(function() + { + $.each(terms, function() + { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + } + } + + jQuery(document).ready(function () { + highlightSearchWords('body'); + }); +})(jQuery); + diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-jquery-ui.js b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-jquery-ui.js new file mode 100644 index 00000000..bd1efb8c --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/oktavia-jquery-ui.js @@ -0,0 +1,521 @@ +/** + * @fileOverview + * A UI script that creates search form, loads an index files and show search results. + * It needs jQuery and <tt>oktavia-search.js</tt> or <tt>oktavia-*-search.js</tt> + * (stemming library supported versions). + * @author Yoshiki Shibukawa, yoshiki@shibu.jp + */ + +(function ($) +{ + var logosrc; + /** + * @name SearchView + * @class + * Provides searching feature to your website. + * @constructor + * @param {jQeury} node Target node it has a search form and a search result window. + * @param {string} documentRoot Document root folder like '.', '../', '/' + * @param {string} index Index file path. + */ + function SearchView(node, documentRoot, index) + { + var OktaviaSearch = JSX.require("tool/web/oktavia-search.jsx").OktaviaSearch$I; + + /** + * Target node it contains a search form and a search result window. + * @type jQuery + */ + this.node = node; + /** + * Search engine core + * @type OktaviaSearch + */ + this.engine = new OktaviaSearch(5); + if (documentRoot === '') + { + /** + * Document root path + * @type string[] + */ + this.documentRoot = []; + } + else if (documentRoot.slice(-1) === '/') + { + this.documentRoot = documentRoot.slice(0, -1).split(/\//g); + } + else + { + this.documentRoot = documentRoot.split(/\//g); + } + + /** + * It is true if an index file is loaded. + * @type boolean + */ + this.initialized = false; + /** + * It is true if an user search before loading an index. + * @type boolean + */ + this.reserveSearch = false; + + var indexURL; + switch (index.charAt(0)) + { + case '.': + case '/': + indexURL = index; + break; + default: + indexURL = this.getDocumentPath(index); + break; + } + var self = this; + function loadIndex() + { + self.engine.loadIndex$S(window.searchIndex); + self.initialized = true; + window.searchIndex = null; + if (self.reserveSearch) + { + self.search(); + } + self.reserveSearch = false; + } + if (window.searchIndex) + { + loadIndex() + } + else + { + this.loadJavaScript(indexURL, loadIndex); + } + } + + /** + * Changes result page. + * @param {integer} page Page number + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.changePage = function (page) + { + this.engine.setCurrentPage$I(page); + this.updateResult(); + }; + + /** + * Clears a search form and a reult window. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.clearResult = function () + { + $('.oktavia_search', this.node).val(''); + $('.oktavia_searchresult_box', this.node).hide(); + }; + + /** + * Loads an external JavaScript file. + * + * This code is based on: http://os0x.hatenablog.com/entry/20080827/1219815828 + * @param {string} src A JavaScript source file path + * @param {function} callback It is called when the target JavaScript file is loaded + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.loadJavaScript = function (src, callback) + { + var sc = document.createElement('script'); + sc.type = 'text/javascript'; + if (window.ActiveXObject) + { + sc.onreadystatechange = function () + { + if (sc.readyState === 'complete' || sc.readyState === 'loaded') + { + callback(sc.readyState); + } + }; + } + else + { + sc.onload = function () + { + callback('onload'); + }; + } + sc.src = src; + document.body.appendChild(sc); + }; + + /** + * Updates page navigation list. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updatePageList = function () + { + var self = this; + function createCallback(i) + { + return function () { + self.changePage(i); + }; + } + + var currentPage = String(this.engine.currentPage$()); + var nav = $('.oktavia_searchresult_nav', this.node); + nav.empty(); + var pages = this.engine.pageIndexes$(); + for (var i = 0; i < pages.length; i++) + { + var pageItem = $('<span/>').text(pages[i]); + if (pages[i] === '...') + { + pageItem.addClass('leader'); + } + else + { + pageItem.addClass('page'); + if (pages[i] !== currentPage) + { + pageItem.bind('click', createCallback(Number(pages[i]))); + } + else + { + pageItem.addClass('selected'); + } + } + nav.append(pageItem); + } + }; + + /** + * Updates result list in a result window. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updateResult = function () + { + var totalPages = this.engine.totalPages$(); + var resultslot = $('.oktavia_searchresult', this.node); + resultslot.empty(); + var self = this; + function clearCallback() + { + self.clearResult(); + } + var results = this.engine.getResult$(); + var searchInput = $('.oktavia_search', this.node); + var queryWord = searchInput.val() + for (var i = 0; i < results.length; i++) + { + var result = results[i]; + var url = this.getDocumentPath(result.url.slice(1)) + var entry = $('<div/>', { "class": "entry" }); + var link = $('<a/>', { "href": url + this.engine.getHighlight$() }).text(result.title); + link.bind('click', clearCallback); + entry.append($('<div/>', { "class": "title" }).append(link)); + entry.append($('<div/>', { "class": "url" }).text(url)); + entry.append($('<div/>', { "class": "resultcontent" }).html(result.content)); + resultslot.append(entry); + } + this.updatePageList(); + }; + + /** + * Searchs again by using proposal search words. + * @param {string} option Proposal search words + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.searchProposal = function (option) + { + $('.oktavia_search', this.node).val(option); + this.search(); + }; + + /** + * Shows proposals when no result. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updateProposal = function () + { + var nav = $('.oktavia_searchresult_nav', this.node); + var resultslot = $('.oktavia_searchresult', this.node); + nav.empty(); + resultslot.empty(); + var proposals = this.engine.getProposals$(); + var self = this; + function createCallback(option) + { + return function () + { + self.searchProposal(option); + }; + } + for (var i = 0; i < proposals.length; i++) + { + var proposal = proposals[i]; + var listitem = $('<div/>', {"class": "proposal"}); + listitem.append('<span>Search with: </span>'); + var option = $('<span/>', {"class": "option"}); + option.html(proposal.label); + option.bind('click', createCallback(proposal.options)); + listitem.append(option); + listitem.append('<span> → ' + proposal.count + ' results.</span>'); + resultslot.append(listitem); + } + }; + + /** + * Performs search and shows results. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.search = function () + { + if (!this.initialized) + { + this.reserveSearch = true; + return; + } + var searchInput = $('.oktavia_search', this.node); + var queryWord = searchInput.val(); + searchInput.blur(); + var self = this; + this.engine.search$SF$IIV$(queryWord, function (total, pages) + { + $('.oktavia_searchresult_box', self.node).fadeIn(); + var summaryNode = $('.oktavia_searchresult_summary', self.node); + if (total === 0) + { + summaryNode.text("No result."); + self.updateProposal(); + } + else + { + summaryNode.text(total + ' results.'); + self.updateResult(); + } + }); + }; + + /** + * Converts file path in index. + * @param {string} filePath Source filepath + * @returns {string} Result filepath + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.getDocumentPath = function (filePath) + { + var resultFilePath; + if (filePath.charAt(0) === '/') + { + resultFilePath = filePath; + } + else + { + var elements = filePath.split(/\//g); + var result = this.documentRoot.slice(); + for (var i = 0; i < elements.length; i++) + { + var element = elements[i]; + switch (element) + { + case '.': + break; + case '..': + result = result.slice(0, -1); + break; + default: + result.push(element); + break; + } + } + resultFilePath = result.join('/'); + } + return resultFilePath; + }; + + /** + * Hides all result windows. + * @function + */ + function eraseResultWindow() + { + $('.oktavia_searchresult_box:visible').hide(); + } + + /** + * jQuery plug-in to create search form and window. + * It can receive options from data attributes or an <tt>option</tt> parameter. + * @param {object} [option] Option + * @param {string} [option.index='search/searchindex.js'] Index file path. + * @param {string} [option.documentRoot='.'] Document root folder. + * @param {string} [option.logo='true'] Show logo in result windows. <tt>'false'</tt> or <tt>'disable'</tt> or falsy value disable logo. + * @name oktaviaSearch + * @function + */ + jQuery.fn.oktaviaSearch = function (option) + { + var data = { + 'index': 'search/searchindex.js', + 'documentRoot': '.', + 'logo': 'true' + }; + if (window.DOCUMENTATION_OPTIONS) // Sphinx + { + if (window.DOCUMENTATION_OPTIONS.URL_ROOT === '#') + { + data.documentRoot = ''; + } + else + { + data.documentRoot = window.DOCUMENTATION_OPTIONS.URL_ROOT; + } + } + var userData = this.data(); + var key; + for (key in userData) + { + if (userData.hasOwnProperty(key)) + { + data[key] = userData[key]; + } + } + for (key in option) + { + if (option.hasOwnProperty(key)) + { + data[key] = option[key]; + } + } + if (data.logo === 'false' || data.logo === 'disable' || !data.logo) + { + data.logo = false; + } + else + { + data.logo = true; + } + var view = new SearchView(this, data.documentRoot, data.index); + + var form = $('<form class="oktavia_form"><input class="oktavia_search" result="10" type="search" name="search" value="" placeholder="Search" /></form>'); + form.submit(function (event) { + event.stopPropagation(); + setTimeout(function () { + view.search(); + }, 10); + return false; + }); + this.append(form); + var resultForm = $([ + '<div class="oktavia_searchresult_box">', + '<div class="oktavia_close_search_box">×</div>', + '<div class="oktavia_searchresult_summary"></div>', + '<div class="oktavia_searchresult"></div>', + '<div class="oktavia_searchresult_nav"></div>', + '</div>' + ].join('')); + if (data.logo) + { + resultForm.append($('<span class="pr">Powered by <a href="http://oktavia.info"><img src="' + logosrc + '" width="86px" height="25px" alt="Oktavia"></img></a></span>')); + } + this.append(resultForm); + $('.oktavia_close_search_box', this.node).bind('click', function (event) { + view.clearResult(); + }); + + // Click outside of the result window, close it + resultForm.bind('click', function (event) { + event.stopPropagation(); + }); + }; + + /** + * Global initailization. + * It add some event handlers. + * @name initialize + * @function + */ + function initialize() + { + + function onClick() { + eraseResultWindow(); + return true; + } + function onKeyDown(event) + { + switch (event.keyCode) + { + case 191: // / : focus form + eraseResultWindow(); + var form = $('form.oktavia_form:first input.search'); + if ($(':focus', form).size() === 0) + { + form.focus(); + } + break; + case 74: // j : down + case 75: // k : up + case 72: // h : before page + case 76: // l : next page + case 13: // enter : select + var result = $('.oktavia_searchresult_box:visible:first'); + if (result.size() === 1) + { + switch (event.keyCode) + { + case 74: // j : down + console.log('down'); + break; + case 75: // k : up + console.log('up'); + break; + case 72: // h : before page + console.log('before'); + break; + case 76: // l : next page + console.log('next'); + break; + case 13: // enter : select + console.log('select'); + break; + } + } + break; + } + return true; + } + var version = $.fn.jquery.split(/\./g); + var major = Number(version[0]); + var minor = Number(version[1]); + if (major === 1 && minor < 7) + { + $(document).live('click', onClick); + $(document).live('keydown', onKeyDown); + } + else + { + $(document).on('click', onClick); + $(document).on('keydown', onKeyDown); + } + } + + var logosrc = "data:image/jpeg;base64, /9j/4AAQSkZJRgABAQEASABIAAD/4ge4SUNDX1BST0ZJTEUAAQEAAAeoYXBwbAIgAABtbnRyUkdCIFhZWiAH2QACABkACwAaAAthY3NwQVBQTAAAAABhcHBsAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWFwcGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtkZXNjAAABCAAAAG9kc2NtAAABeAAABWxjcHJ0AAAG5AAAADh3dHB0AAAHHAAAABRyWFlaAAAHMAAAABRnWFlaAAAHRAAAABRiWFlaAAAHWAAAABRyVFJDAAAHbAAAAA5jaGFkAAAHfAAAACxiVFJDAAAHbAAAAA5nVFJDAAAHbAAAAA5kZXNjAAAAAAAAABRHZW5lcmljIFJHQiBQcm9maWxlAAAAAAAAAAAAAAAUR2VuZXJpYyBSR0IgUHJvZmlsZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbWx1YwAAAAAAAAAeAAAADHNrU0sAAAAoAAABeGhySFIAAAAoAAABoGNhRVMAAAAkAAAByHB0QlIAAAAmAAAB7HVrVUEAAAAqAAACEmZyRlUAAAAoAAACPHpoVFcAAAAWAAACZGl0SVQAAAAoAAACem5iTk8AAAAmAAAComtvS1IAAAAWAAACyGNzQ1oAAAAiAAAC3mhlSUwAAAAeAAADAGRlREUAAAAsAAADHmh1SFUAAAAoAAADSnN2U0UAAAAmAAAConpoQ04AAAAWAAADcmphSlAAAAAaAAADiHJvUk8AAAAkAAADomVsR1IAAAAiAAADxnB0UE8AAAAmAAAD6G5sTkwAAAAoAAAEDmVzRVMAAAAmAAAD6HRoVEgAAAAkAAAENnRyVFIAAAAiAAAEWmZpRkkAAAAoAAAEfHBsUEwAAAAsAAAEpHJ1UlUAAAAiAAAE0GFyRUcAAAAmAAAE8mVuVVMAAAAmAAAFGGRhREsAAAAuAAAFPgBWAWEAZQBvAGIAZQBjAG4A/QAgAFIARwBCACAAcAByAG8AZgBpAGwARwBlAG4AZQByAGkBDQBrAGkAIABSAEcAQgAgAHAAcgBvAGYAaQBsAFAAZQByAGYAaQBsACAAUgBHAEIAIABnAGUAbgDoAHIAaQBjAFAAZQByAGYAaQBsACAAUgBHAEIAIABHAGUAbgDpAHIAaQBjAG8EFwQwBDMEMAQ7BEwEPQQ4BDkAIAQ/BEAEPgREBDAEOQQ7ACAAUgBHAEIAUAByAG8AZgBpAGwAIABnAOkAbgDpAHIAaQBxAHUAZQAgAFIAVgBCkBp1KAAgAFIARwBCACCCcl9pY8+P8ABQAHIAbwBmAGkAbABvACAAUgBHAEIAIABnAGUAbgBlAHIAaQBjAG8ARwBlAG4AZQByAGkAcwBrACAAUgBHAEIALQBwAHIAbwBmAGkAbMd8vBgAIABSAEcAQgAg1QS4XNMMx3wATwBiAGUAYwBuAP0AIABSAEcAQgAgAHAAcgBvAGYAaQBsBeQF6AXVBeQF2QXcACAAUgBHAEIAIAXbBdwF3AXZAEEAbABsAGcAZQBtAGUAaQBuAGUAcwAgAFIARwBCAC0AUAByAG8AZgBpAGwAwQBsAHQAYQBsAOEAbgBvAHMAIABSAEcAQgAgAHAAcgBvAGYAaQBsZm6QGgAgAFIARwBCACBjz4/wZYdO9k4AgiwAIABSAEcAQgAgMNcw7TDVMKEwpDDrAFAAcgBvAGYAaQBsACAAUgBHAEIAIABnAGUAbgBlAHIAaQBjA5MDtQO9A7kDugPMACADwAPBA78DxgOvA7sAIABSAEcAQgBQAGUAcgBmAGkAbAAgAFIARwBCACAAZwBlAG4A6QByAGkAYwBvAEEAbABnAGUAbQBlAGUAbgAgAFIARwBCAC0AcAByAG8AZgBpAGUAbA5CDhsOIw5EDh8OJQ5MACAAUgBHAEIAIA4XDjEOSA4nDkQOGwBHAGUAbgBlAGwAIABSAEcAQgAgAFAAcgBvAGYAaQBsAGkAWQBsAGUAaQBuAGUAbgAgAFIARwBCAC0AcAByAG8AZgBpAGkAbABpAFUAbgBpAHcAZQByAHMAYQBsAG4AeQAgAHAAcgBvAGYAaQBsACAAUgBHAEIEHgQxBEkEOAQ5ACAEPwRABD4ERAQ4BDsETAAgAFIARwBCBkUGRAZBACAGKgY5BjEGSgZBACAAUgBHAEIAIAYnBkQGOQYnBkUARwBlAG4AZQByAGkAYwAgAFIARwBCACAAUAByAG8AZgBpAGwAZQBHAGUAbgBlAHIAZQBsACAAUgBHAEIALQBiAGUAcwBrAHIAaQB2AGUAbABzAGV0ZXh0AAAAAENvcHlyaWdodCAyMDA3IEFwcGxlIEluYy4sIGFsbCByaWdodHMgcmVzZXJ2ZWQuAFhZWiAAAAAAAADzUgABAAAAARbPWFlaIAAAAAAAAHRNAAA97gAAA9BYWVogAAAAAAAAWnUAAKxzAAAXNFhZWiAAAAAAAAAoGgAAFZ8AALg2Y3VydgAAAAAAAAABAc0AAHNmMzIAAAAAAAEMQgAABd7///MmAAAHkgAA/ZH///ui///9owAAA9wAAMBs/+EAgEV4aWYAAE1NACoAAAAIAAUBEgADAAAAAQABAAABGgAFAAAAAQAAAEoBGwAFAAAAAQAAAFIBKAADAAAAAQACAACHaQAEAAAAAQAAAFoAAAAAAAAASAAAAAEAAABIAAAAAQACoAIABAAAAAEAAABWoAMABAAAAAEAAAAYAAAAAP/bAEMAAgICAgIBAgICAgICAgMDBgQDAwMDBwUFBAYIBwgICAcICAkKDQsJCQwKCAgLDwsMDQ4ODg4JCxARDw4RDQ4ODv/bAEMBAgICAwMDBgQEBg4JCAkODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODv/AABEIABgAVgMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AP3571+dfjn4ofEz4+/tjeJPg38JPE+peAfh/wCE9Q/szxJ4g0namo6xqCoss9tBM6sLe2gRlEkqqXLNtXnFfooa/Lj9jvU7PwH+3T+0D8J/E00Vt4usvHOs3MfmsAbqDUbmO+tp1J6qyN5ZPZkCnqBTQG7pnwW1VP2lde8FfB74qfF3R/E3hrT459f8Val4xutRsIryVd8Nq1ncGRZlYD5zlSoPHTBufD39oH4y+F9H8Xaj8Ur2w8SxeCvES6P4+0tLBIbzSklI8m/t5IwFmt2BBwVB/PI9Z+DOtWfhn/goR+0p8P8AxDcw6f4j1XV7bxLo0dw4U3+nyWwQvHk/MI3RlbH3a+SvG/jnRdbi/bY+JOkyJc+HvF0mm+BvBoiGf+Eh1OGPy3a2H/LUBnHzLkYXNfa0KNGnmlDCxpKVOpGmndXb5knKSb1i7t2cbWtrfW/w+IjiK2WVsRKu41ISm42dlGzajFpWUlZK6le921bS36G+GPHWq61+2r4+8I/2jFdeGdO8N6Xf6fEkKja1wZdz7wNzBgq8E4Fcr8T/ANpDwX4U0bw63hzxb4P1S5vPE8Gm3zveCRLW2WULdzDacHyhwxzhSwJz0Pxp430f4ww/H74qeEvABimudH+FHhxvFdvFcvDqGoW8KSCSztJFB2STBZlL9QFwOWr2L4k+IPh1r/7Fn7MuufDG00638E3XxJ8Pw6dbQQqPsymdlkgcdQ6uCrg8lgc5r1P7EwEcVhqk1zRlyK0bJL92neWm8nqu9m7nl1MzzN4PE0oS5Jpzd5Xb1ntHXaK0v00SXU+s9e+M/wAKfDGg6NqevfEDwrpljq9st1pckt8v+lwtyssYGSyH+8Bj3rQ0v4o/DrW7Hw/daR408OajBrl09ppElveowu50Xc0SY6yBeSvXHavmb/hIr7Uv22vivD8EvhJoXirxTpP2LTPFfibxX4ke0s7aRYQ8VpawiKVgqo4ZtiopJzyea+e7PQfFGteEv2tLyxh8Op8QPAXjrTfE+nW3htX+xLfWtos00UO7DfPGJImJAJYtx2rzcNw5g6tP35ODtF6uL+NpK8VrFJyTu3qleyvp6tfPsxp1PdhGSvJaKS+FNu0no20mrJWTduZ21/Rf4l6/d6N8PWtNC8UeF/C/jLU3Nv4cfXojLb3NyqmTyjGrKzAqrZKnKj5sHGD5j4L8W6fZfC6y+M3xg+IHguN9UQjSxY6iP7G0qFiR5Fs7HNxM2DvmILNgqoVBg+X6B4vsPj9+14vjbQ5xdeB/AXgBbq0kVt0b6tq1uZCPTfDbAA9wZe1eNfCXxXp9x8Ev2UdE8N/DhfiX8Xl8F3uq6PFqet/YdL0qzM5iluZiVcNIWwi7Y2Yc4IzzyUuFaLSlVlLnjbmjdJK8aklrKyWkY3b25no2kj13xhjIUKlCjThySb5Z8rcnZwi0mtWm3L3Vvy7pSlf9C/BnxO+H3xE+2f8ACEeMNB8TPaAG6isboPJCD0LJ94A+uMUV8JaxqPjex/4KWaZ/wmlh4A8NeJrr4bXUslp4Su5pdsI1C1VPtErpGXcndtwgAAPWisswyGlTlB0p6SSfR2+asntvZHDg+Iq/LKNan7ybV1dX+Tu16XZyPjX4k/tYftcfF/xR8Kvgh4b1/wDZ7+EOkanc6R4p8f8AiK2e31O6khkMcsVqqsGUHBwIW3FWy00BG1vWrX/gnT8EtJ+DfhvS/Dmq+NfDPxL0dnmT4m6dfKuvXs8mDI10zKY54jhQIXUqiqoXGM0UV8wfXC6h+xb418baxpK/Fv8Aad+IHjrRtOt5LSOKy8PadpV9PbyAeZDJexRmYI+BuCFc4x0yD6x8Lv2Pfgl8J/GOleINE0rX9e1jSQ40WfxHrM2oJpW8kubWJz5ULMScuqBj60UV00sdiKUXGE2k1Z2fTt6eRhPC0Zu8op9fn39dD2fTfhx4Y0r9oPxP8TrOG9XxXr+mWmnajK92zRNDamQwhYz8qkGR8kcnPPQV5ZqX7Kvwh1L4deMfCbWHiGx0HxF4lTxJLaWOuTwLp+pK277TZ7WH2Zi3JVMKTnjk0UVdLMsXTlzQqNPTq/s/D93TsKeEozVpRT3/AB3+8zT+yX8OIfEY1nSPEvxc8N6xPpdvp+sX2keOL22n1tIF2JJeOrZmn28GbIkOBluK9C+G/wADPhv8Jtc8WXngTR7nR4vEa2/9qWbX0s9vI0KMgkCSFsSOGYyPnMjEsxJ5ooq62bY2rBwnVk09GrvW21/Syt2M45fhozU1BXXWxL8MPgl8Pfg98LtY8H+A9KuNM0TU7+e9vElu3mkaSZQrYdiSFVQqqvRQABXAT/snfCj/AIQX4daNpD+NfC134GspLHw5rmh+JLi01O3tpGLPA86nMsbE5KuGFFFEc1xiqSqKrLmk7t3ers1r30bXo2U8Fh3BQ5FZdLfMS3/ZL+Elp4qtvEUA8aHxWtrPbXmvz+JrqfUNRSWSJ2+0zSMxlwYUCZ4RQVUKCRRRRTnm+Nl8VVv1ZCy3CramvuP/2Q=="; + initialize(); +})(jQuery); + +jQuery(document).ready(function () { + var form = jQuery('#oktavia_search_form'); + if (form.size() > 0) + { + form.oktaviaSearch(); + } +}); diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/Apache-License-2.0.txt b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/lang-css.js b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/lang-css.js new file mode 100644 index 00000000..041e1f59 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/prettify.js b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/prettify.js new file mode 100644 index 00000000..eef5ad7e --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c< +f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&& +(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r= +{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length, +t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b=== +"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value", +m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m= +a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue= +j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m, +250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit", +PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})(); diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/jsdoc-default.css b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/jsdoc-default.css new file mode 100644 index 00000000..ea49f607 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/jsdoc-default.css @@ -0,0 +1,283 @@ +html +{ + overflow: auto; + background-color: #fff; +} + +body +{ + font: 14px "DejaVu Sans Condensed", "Liberation Sans", "Nimbus Sans L", Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans serif; + line-height: 130%; + color: #000; + background-color: #fff; +} + +a { + color: #444; +} + +a:visited { + color: #444; +} + +a:active { + color: #444; +} + +header +{ + display: block; + padding: 6px 4px; +} + +.class-description { + font-style: italic; + font-family: Palatino, 'Palatino Linotype', serif; + font-size: 130%; + line-height: 140%; + margin-bottom: 1em; + margin-top: 1em; +} + +#main { + float: left; + width: 100%; +} + +section +{ + display: block; + + background-color: #fff; + padding: 12px 24px; + border-bottom: 1px solid #ccc; + margin-right: 240px; +} + +.variation { + display: none; +} + +.optional:after { + content: "opt"; + font-size: 60%; + color: #aaa; + font-style: italic; + font-weight: lighter; +} + +nav +{ + display: block; + float: left; + margin-left: -230px; + margin-top: 28px; + width: 220px; + border-left: 1px solid #ccc; + padding-left: 9px; +} + +nav ul { + font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; + font-size: 100%; + line-height: 17px; + padding:0; + margin:0; + list-style-type:none; +} + +nav h2 a, nav h2 a:visited { + color: #A35A00; + text-decoration: none; +} + +nav h3 { + margin-top: 12px; +} + +nav li { + margin-top: 6px; +} + +nav a { + color: #5C5954; +} + +nav a:visited { + color: #5C5954; +} + +nav a:active { + color: #5C5954; +} + +footer { + display: block; + padding: 6px; + margin-top: 12px; + font-style: italic; + font-size: 90%; +} + +h1 +{ + font-size: 200%; + font-weight: bold; + letter-spacing: -0.01em; + margin: 6px 0 9px 0; +} + +h2 +{ + font-size: 170%; + font-weight: bold; + letter-spacing: -0.01em; + margin: 6px 0 3px 0; +} + +h3 +{ + font-size: 150%; + font-weight: bold; + letter-spacing: -0.01em; + margin-top: 16px; + margin: 6px 0 3px 0; +} + +h4 +{ + font-size: 130%; + font-weight: bold; + letter-spacing: -0.01em; + margin-top: 16px; + margin: 18px 0 3px 0; + color: #A35A00; +} + +h5, .container-overview .subsection-title +{ + font-size: 120%; + font-weight: bold; + letter-spacing: -0.01em; + margin: 8px 0 3px -16px; +} + +h6 +{ + font-size: 100%; + letter-spacing: -0.01em; + margin: 6px 0 3px 0; + font-style: italic; +} + +.ancestors { color: #999; } +.ancestors a +{ + color: #999 !important; + text-decoration: none; +} + +.important +{ + font-weight: bold; + color: #950B02; +} + +.yes-def { + text-indent: -1000px; +} + +.type-signature { + color: #aaa; +} + +.name, .signature { + font-family: Consolas, "Lucida Console", Monaco, monospace; +} + +.details { margin-top: 14px; } +.details dt { width:100px; float:left; border-left: 2px solid #DDD; padding-left: 10px; padding-top: 6px; } +.details dd { margin-left: 50px; } +.details ul { margin: 0; } +.details ul { list-style-type: none; } +.details li { margin-left: 30px; padding-top: 6px; } + +.description { + margin-bottom: 1em; + margin-left: -16px; + margin-top: 1em; +} + +.code-caption +{ + font-style: italic; + font-family: Palatino, 'Palatino Linotype', serif; + font-size: 107%; + margin: 0; +} + +.prettyprint +{ + border: 1px solid #ddd; + width: 80%; + overflow: auto; +} + +.prettyprint.source { + width: inherit; +} + +.prettyprint code +{ + font-family: Consolas, 'Lucida Console', Monaco, monospace; + font-size: 100%; + line-height: 18px; + display: block; + padding: 4px 12px; + margin: 0; + background-color: #fff; + color: #000; + border-left: 3px #ddd solid; +} + +.params, .props +{ + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +.params .name, .props .name, .name code { + color: #A35A00; + font-family: Consolas, 'Lucida Console', Monaco, monospace; + font-size: 100%; +} + +.params td, .params th, .props td, .props th +{ + border: 1px solid #ddd; + margin: 0px; + text-align: left; + vertical-align: top; + padding: 4px 6px; + display: table-cell; +} + +.params thead tr, .props thead tr +{ + background-color: #ddd; + font-weight: bold; +} + +.params .params thead tr, .props .props thead tr +{ + background-color: #fff; + font-weight: bold; +} + +.params th, .props th { border-right: 1px solid #aaa; } +.params thead .last, .props thead .last { border-right: 1px solid #ddd; } + +.disabled { + color: #454545; +} diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/prettify-jsdoc.css b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/prettify-jsdoc.css new file mode 100644 index 00000000..5a2526e3 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/prettify-tomorrow.css b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/prettify-tomorrow.css new file mode 100644 index 00000000..aa2908c2 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Menlo, Monaco, Consolas, monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/searchstyle.css b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/searchstyle.css new file mode 100644 index 00000000..a3d51d43 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/static/styles/searchstyle.css @@ -0,0 +1,174 @@ +form.oktavia_form { + position: relative; + display: block; + width: 240px; + height: 25px; +} + +input.oktavia_search { + -webkit-appearance: searchfield; + -webkit-user-select: text; + cursor: auto; + background-color: white; + color: black; + line-height: normal; + display: inline-block; + padding: 1px; + text-align: start; + margin: 2px 0px 2px 0px; + padding: 1px; +} + +div.oktavia_searchresult_box { + display: none; + position: absolute; + width: 500px; + padding: 10px; + right: 10px; + background-color: #ffffff; + -moz-border-radius: 8px; + border-radius: 8px; + -moz-box-shadow: 3px 3px 5px 5px #b5b2b2; + box-shadow: 3px 3px 5px 5px #b5b2b2; + opacity: 0.95; + z-index: 100000; +} + +div.oktavia_close_search_box { + position: absolute; + top: 10px; + right: 10px; + width: 20px; + height: 20px; + text-align: center; + vertical-align: middle; + color: #666; +} + +div.oktavia_close_search_box:hover { + background-color: #d1e8ff; + border: 1px solid gray; +} + +div.oktavia_close_search_box:active { + background-color: #b4c8db; + border: 1px solid gray; +} + + +div.oktavia_searchresult_summary { + color: #444; +} + +div.oktavia_searchresult .entry { + margin: 10px 10px 10px 10px; + color: black; +} + +div.oktavia_searchresult .entry .title { + font-size: normal; +} + +div.oktavia_searchresult .entry .title a:link { + color: #0000EE; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .title a:visited { + color: #551A8B; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .title a:hover { +} + +div.oktavia_searchresult .entry .title a:active { + color: #FF0000; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .url { + font-size: 14px!important; + color: #093; + font-style: normal; + font-family: arial,sans-serif; +} + +div.oktavia_searchresult .entry .resultcontent { + font-size: small; + font-family: arial,sans-serif; + color: #222; +} + +div.oktavia_searchresult .entry .resultcontent .hit { + font-weight: bolder; + text-decoration: underline; +} + +div.oktavia_searchresult .proposal { + margin: 10px 10px 10px 10px; + color: #222; + font-size: small; + font-family: arial,sans-serif; +} + +div.oktavia_searchresult .proposal .option { + background-color: #e8f4ff; + border-bottom: 1px solid blue; +} + +div.oktavia_searchresult .proposal .option:hover { + background-color: #d1e8ff; +} + +div.oktavia_searchresult .proposal .option:active { + background-color: #b4c8db; +} + +div.oktavia_searchresult_nav span.leader { + color: #228; +} + +div.oktavia_searchresult_nav span.page { + background-color: #ffffff; + border: 1px solid #888888; + padding: 5px; + margin: 5px; + color: #222; +} + +div.oktavia_searchresult_nav span.page:hover { + background-color: #d1e8ff; + border: 1px solid #7d98ff; +} + +div.oktavia_searchresult_nav span.page:active { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected:hover { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected:active { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_box span.pr { + position: absolute; + right: 10px; + bottom: 10px; + color: #555; +} + +.highlighted { + background-color: #fbe54e; +} diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/container.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/container.tmpl new file mode 100644 index 00000000..cd3e5a65 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/container.tmpl @@ -0,0 +1,154 @@ +<?js + var self = this; + docs.forEach(function(doc, i) { +?> + +<?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?> + <?js= self.partial('mainpage.tmpl', doc) ?> +<?js } else if (doc.kind === 'source') { ?> + <?js= self.partial('source.tmpl', doc) ?> +<?js } else { ?> + +<section> + +<header> + <h2><?js if (doc.ancestors && doc.ancestors.length) { ?> + <span class="ancestors"><?js= doc.ancestors.join('') ?></span> + <?js } ?> + <?js= doc.name ?> + <?js if (doc.variation) { ?> + <sup class="variation"><?js= doc.variation ?></sup> + <?js } ?></h2> + <?js if (doc.classdesc) { ?> + <div class="class-description"><?js= doc.classdesc ?></div> + <?js } ?> +</header> + +<article> + <div class="container-overview"> + <?js if (doc.kind === 'module' && doc.module) { ?> + <?js= self.partial('method.tmpl', doc.module) ?> + <?js } ?> + + <?js if (doc.kind === 'class') { ?> + <?js= self.partial('method.tmpl', doc) ?> + <?js } else { ?> + <?js if (doc.description) { ?> + <div class="description"><?js= doc.description ?></div> + <?js } ?> + + <?js= self.partial('details.tmpl', doc) ?> + + <?js if (doc.examples && doc.examples.length) { ?> + <h3>Example<?js= doc.examples.length > 1? 's':'' ?></h3> + <?js= self.partial('examples.tmpl', doc.examples) ?> + <?js } ?> + <?js } ?> + </div> + + <?js if (doc.augments && doc.augments.length) { ?> + <h3 class="subsection-title">Extends</h3> + + <ul><?js doc.augments.forEach(function(a) { ?> + <li><?js= self.linkto(a, a) ?></li> + <?js }); ?></ul> + <?js } ?> + + <?js if (doc.mixes && doc.mixes.length) { ?> + <h3 class="subsection-title">Mixes In</h3> + + <ul><?js doc.mixes.forEach(function(a) { ?> + <li><?js= self.linkto(a, a) ?></li> + <?js }); ?></ul> + <?js } ?> + + <?js if (doc.requires && doc.requires.length) { ?> + <h3 class="subsection-title">Requires</h3> + + <ul><?js doc.requires.forEach(function(r) { ?> + <li><?js= self.linkto(r, r) ?></li> + <?js }); ?></ul> + <?js } ?> + + <?js + var classes = self.find({kind: 'class', memberof: doc.longname}); + if (doc.kind !== 'globalobj' && classes && classes.length) { + ?> + <h3 class="subsection-title">Classes</h3> + + <dl><?js classes.forEach(function(c) { ?> + <dt><?js= self.linkto(c.longname, c.name) ?></dt> + <dd><?js if (c.summary) { ?><?js= c.summary ?><?js } ?></dd> + <?js }); ?></dl> + <?js } ?> + + <?js + var namespaces = self.find({kind: 'namespace', memberof: doc.longname}); + if (doc.kind !== 'globalobj' && namespaces && namespaces.length) { + ?> + <h3 class="subsection-title">Namespaces</h3> + + <dl><?js namespaces.forEach(function(n) { ?> + <dt><a href="namespaces.html#<?js= n.longname ?>"><?js= self.linkto(n.longname, n.name) ?></a></dt> + <dd><?js if (n.summary) { ?><?js= n.summary ?><?js } ?></dd> + <?js }); ?></dl> + <?js } ?> + + <?js + var members = self.find({kind: 'member', memberof: title === 'Global' ? {isUndefined: true} : doc.longname}); + if (members && members.length && members.forEach) { + ?> + <h3 class="subsection-title">Members</h3> + + <dl><?js members.forEach(function(p) { ?> + <?js= self.partial('members.tmpl', p) ?> + <?js }); ?></dl> + <?js } ?> + + <?js + var methods = self.find({kind: 'function', memberof: title === 'Global' ? {isUndefined: true} : doc.longname}); + if (methods && methods.length && methods.forEach) { + ?> + <h3 class="subsection-title">Methods</h3> + + <dl><?js methods.forEach(function(m) { ?> + <?js= self.partial('method.tmpl', m) ?> + <?js }); ?></dl> + <?js } ?> + + <?js + var typedefs = self.find({kind: 'typedef', memberof: title === 'Global' ? {isUndefined: true} : doc.longname}); + if (typedefs && typedefs.length && typedefs.forEach) { + ?> + <h3 class="subsection-title">Type Definitions</h3> + + <dl><?js typedefs.forEach(function(e) { + if (e.signature) { + ?> + <?js= self.partial('method.tmpl', e) ?> + <?js + } + else { + ?> + <?js= self.partial('members.tmpl', e) ?> + <?js + } + }); ?></dl> + <?js } ?> + + <?js + var events = self.find({kind: 'event', memberof: title === 'Global' ? {isUndefined: true} : doc.longname}); + if (events && events.length && events.forEach) { + ?> + <h3 class="subsection-title">Events</h3> + + <dl><?js events.forEach(function(e) { ?> + <?js= self.partial('method.tmpl', e) ?> + <?js }); ?></dl> + <?js } ?> +</article> + +</section> +<?js } ?> + +<?js }); ?> diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/details.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/details.tmpl new file mode 100644 index 00000000..941a03de --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/details.tmpl @@ -0,0 +1,98 @@ +<?js +var data = obj; +var self = this; +?> +<dl class="details"> + <?js + var properties = data.properties; + if (properties && properties.length && properties.forEach) { + ?> + + <h5 class="subsection-title">Properties:</h5> + + <dl><?js= this.partial('properties.tmpl', properties) ?></dl> + + <?js } ?> + + <?js if (data.version) {?> + <dt class="tag-version">Version:</dt> + <dd class="tag-version"><ul class="dummy"><li><?js= version ?></li></ul></dd> + <?js } ?> + + <?js if (data.since) {?> + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li><?js= since ?></dd> + <?js } ?> + + <?js if (data.inherited && data.inherits) { ?> + <dt class="inherited-from">Inherited From:</dt> + <dd class="inherited-from"><ul class="dummy"><li> + <?js= this.linkto(data.inherits, this.htmlsafe(data.inherits)) ?> + </li></dd> + <?js } ?> + + <?js if (data.deprecated) { ?> + <dt class="important tag-deprecated">Deprecated:</dt><?js + if (data.deprecated === true) { ?><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd><?js } + else { ?><dd><ul class="dummy"><li><?js= data.deprecated ?></li><ul></dd><?js } + ?> + <?js } ?> + + <?js if (data.author && author.length) {?> + <dt class="tag-author">Author:</dt> + <dd class="tag-author"> + <ul><?js author.forEach(function(a) { ?> + <li><?js= self.resolveAuthorLinks(a) ?></li> + <?js }); ?></ul> + </dd> + <?js } ?> + + <?js if (data.copyright) {?> + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li><?js= copyright ?></li></ul></dd> + <?js } ?> + + <?js if (data.license) {?> + <dt class="tag-license">License:</dt> + <dd class="tag-license"><ul class="dummy"><li><?js= license ?></li></ul></dd> + <?js } ?> + + <?js if (data.defaultvalue) {?> + <dt class="tag-default">Default Value:</dt> + <dd class="tag-default"><ul class="dummy"><li><?js= data.defaultvalue ?></li></ul></dd> + <?js } ?> + + <?js if (data.meta) {?> + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <?js= self.linkto(meta.filename) ?>, line <?js= meta.lineno ?> + </li></ul></dd> + <?js } ?> + + <?js if (data.tutorials && tutorials.length) {?> + <dt class="tag-tutorial">Tutorials:</dt> + <dd class="tag-tutorial"> + <ul><?js tutorials.forEach(function(t) { ?> + <li><?js= self.tutoriallink(t) ?></li> + <?js }); ?></ul> + </dd> + <?js } ?> + + <?js if (data.see && see.length) {?> + <dt class="tag-see">See:</dt> + <dd class="tag-see"> + <ul><?js see.forEach(function(s) { ?> + <li><?js= self.linkto(s) ?></li> + <?js }); ?></ul> + </dd> + <?js } ?> + + <?js if (data.todo && todo.length) {?> + <dt class="tag-todo">To Do:</dt> + <dd class="tag-todo"> + <ul><?js todo.forEach(function(t) { ?> + <li><?js= t ?></li> + <?js }); ?></ul> + </dd> + <?js } ?> +</dl> diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/example.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/example.tmpl new file mode 100644 index 00000000..e87caa5b --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/example.tmpl @@ -0,0 +1,2 @@ +<?js var data = obj; ?> +<pre><code><?js= data ?></code></pre> diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/examples.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/examples.tmpl new file mode 100644 index 00000000..23384c9d --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/examples.tmpl @@ -0,0 +1,11 @@ +<?js + var data = obj; + data.forEach(function(example) { + if (example.caption) { + ?> + <p class="code-caption"><?js= example.caption ?></p> + <?js } ?> + <pre class="prettyprint"><code><?js= example.code ?></code></pre> +<?js + }); +?>
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/exceptions.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/exceptions.tmpl new file mode 100644 index 00000000..660afa21 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/exceptions.tmpl @@ -0,0 +1,19 @@ +<?js + var data = obj; + if (data.description) { +?> +<div class="param-desc"> + <?js= description ?> +</div> +<?js } ?> + +<?js if (data.type && data.type.names) {?> +<dl> + <dt> + Type + </dt> + <dd> + <?js= this.partial('type.tmpl', data.type.names) ?> + </dd> +</dl> +<?js } ?>
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/fires.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/fires.tmpl new file mode 100644 index 00000000..21cfd229 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/fires.tmpl @@ -0,0 +1,4 @@ +<?js var data = obj; ?> +<li> + <?js= data ?> +</li>
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/layout.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/layout.tmpl new file mode 100644 index 00000000..ec112458 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/layout.tmpl @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: <?js= title ?></title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <script src="scripts/jquery-1.9.1.min.js"> </script> + <script src="scripts/oktavia-english-search.js"> </script> + <script src="scripts/oktavia-jquery-ui.js"> </script> + <script src="scripts/oktavia-jquery-highlight.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> + <link type="text/css" rel="stylesheet" href="styles/searchstyle.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title"><?js= title ?></h1> + + <?js= content ?> +</div> + +<nav> + <?js= this.nav ?> + <h2>Search</h2> + <div id="oktavia_search_form" data-document-root="." data-index="./scripts/searchindex.js" style="position: relative;"/> +</nav> + +<br clear="both"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc <?js= env.version.number ?></a> on <?js= (new Date()) ?> +</footer> + +<script> prettyPrint(); </script> +</body> +</html> diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/mainpage.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/mainpage.tmpl new file mode 100644 index 00000000..64e9e594 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/mainpage.tmpl @@ -0,0 +1,14 @@ +<?js +var data = obj; +var self = this; +?> + +<?js if (data.kind === 'package') { ?> + <h3><?js= data.name ?> <?js= data.version ?></h3> +<?js } ?> + +<?js if (data.readme) { ?> + <section> + <article><?js= data.readme ?></article> + </section> +<?js } ?> diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/members.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/members.tmpl new file mode 100644 index 00000000..c76f772c --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/members.tmpl @@ -0,0 +1,22 @@ +<?js var data = obj; ?> +<dt> + <h4 class="name" id="<?js= id ?>"><?js= data.attribs + name + (data.signature ? data.signature : '') ?></h4> + + <?js if (data.summary) { ?> + <p class="summary"><?js= summary ?></p> + <?js } ?> +</dt> +<dd> + <?js if (data.description) { ?> + <div class="description"> + <?js= data.description ?> + </div> + <?js } ?> + + <?js= this.partial('details.tmpl', data) ?> + + <?js if (data.examples && examples.length) { ?> + <h5>Example<?js= examples.length > 1? 's':'' ?></h5> + <?js= this.partial('examples.tmpl', examples) ?> + <?js } ?> +</dd> diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/method.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/method.tmpl new file mode 100644 index 00000000..1eb9032d --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/method.tmpl @@ -0,0 +1,76 @@ +<?js +var data = obj; +var self = this; +?> +<dt> + <h4 class="name" id="<?js= id ?>"><?js= data.attribs + (kind === 'class' ? 'new ' : '') + name + (kind !== 'event' ? data.signature : '') ?></h4> + + <?js if (data.summary) { ?> + <p class="summary"><?js= summary ?></p> + <?js } ?> +</dt> +<dd> + + <?js if (data.description) { ?> + <div class="description"> + <?js= data.description ?> + </div> + <?js } ?> + + <?js if (kind === 'event' && data.type && data.type.names) {?> + <h5>Type:</h5> + <ul> + <li> + <?js= self.partial('type.tmpl', data.type.names) ?> + </li> + </ul> + <?js } ?> + + <?js if (data['this']) { ?> + <h5>This:</h5> + <ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul> + <?js } ?> + + <?js if (data.params && params.length) { ?> + <h5>Parameters:</h5> + <?js= this.partial('params.tmpl', params) ?> + <?js } ?> + + <?js= this.partial('details.tmpl', data) ?> + + <?js if (data.fires && fires.length) { ?> + <h5>Fires:</h5> + <ul><?js fires.forEach(function(f) { ?> + <?js= self.partial('fires.tmpl', self.linkto(f) ) ?> + <?js }); ?></ul> + <?js } ?> + + <?js if (data.exceptions && exceptions.length) { ?> + <h5>Throws:</h5> + <?js if (exceptions.length > 1) { ?><ul><?js + exceptions.forEach(function(r) { ?> + <li><?js= self.partial('exceptions.tmpl', r) ?></li> + <?js }); + ?></ul><?js } else { + exceptions.forEach(function(r) { ?> + <?js= self.partial('exceptions.tmpl', r) ?> + <?js }); + } } ?> + + <?js if (data.returns && returns.length) { ?> + <h5>Returns:</h5> + <?js if (returns.length > 1) { ?><ul><?js + returns.forEach(function(r) { ?> + <li><?js= self.partial('returns.tmpl', r) ?></li> + <?js }); + ?></ul><?js } else { + returns.forEach(function(r) { ?> + <?js= self.partial('returns.tmpl', r) ?> + <?js }); + } } ?> + + <?js if (data.examples && examples.length) { ?> + <h5>Example<?js= examples.length > 1? 's':'' ?></h5> + <?js= this.partial('examples.tmpl', examples) ?> + <?js } ?> +</dd> diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/params.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/params.tmpl new file mode 100644 index 00000000..ca81f8f8 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/params.tmpl @@ -0,0 +1,108 @@ +<?js + var params = obj; + + /* sort subparams under their parent params (like opts.classname) */ + var parentParam = null; + params.forEach(function(param, i) { + if (!param) { return; } + if ( parentParam && param.name && param.name.indexOf(parentParam.name + '.') === 0 ) { + param.name = param.name.substr(parentParam.name.length+1); + parentParam.subparams = parentParam.subparams || []; + parentParam.subparams.push(param); + params[i] = null; + } + else { + parentParam = param; + } + }); + + /* determine if we need extra columns, "attributes" and "default" */ + params.hasAttributes = false; + params.hasDefault = false; + params.hasName = false; + + params.forEach(function(param) { + if (!param) { return; } + + if (param.optional || param.nullable) { + params.hasAttributes = true; + } + + if (param.name) { + params.hasName = true; + } + + if (typeof param.defaultvalue !== 'undefined') { + params.hasDefault = true; + } + }); +?> + +<table class="params"> + <thead> + <tr> + <?js if (params.hasName) {?> + <th>Name</th> + <?js } ?> + + <th>Type</th> + + <?js if (params.hasAttributes) {?> + <th>Argument</th> + <?js } ?> + + <?js if (params.hasDefault) {?> + <th>Default</th> + <?js } ?> + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + <?js + var self = this; + params.forEach(function(param) { + if (!param) { return; } + ?> + + <tr> + <?js if (params.hasName) {?> + <td class="name"><code><?js= param.name ?></code></td> + <?js } ?> + + <td class="type"> + <?js if (param.type && param.type.names) {?> + <?js= self.partial('type.tmpl', param.type.names) ?> + <?js } ?> + </td> + + <?js if (params.hasAttributes) {?> + <td class="attributes"> + <?js if (param.optional) { ?> + <optional><br> + <?js } ?> + + <?js if (param.nullable) { ?> + <nullable><br> + <?js } ?> + </td> + <?js } ?> + + <?js if (params.hasDefault) {?> + <td class="default"> + <?js if (typeof param.defaultvalue !== 'undefined') { ?> + <?js= self.htmlsafe(param.defaultvalue) ?> + <?js } ?> + </td> + <?js } ?> + + <td class="description last"><?js= param.description ?><?js if (param.subparams) { ?> + <h6>Properties</h6> + <?js= self.partial('params.tmpl', param.subparams) ?> + <?js } ?></td> + </tr> + + <?js }); ?> + </tbody> +</table>
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/properties.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/properties.tmpl new file mode 100644 index 00000000..dfa6ee0e --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/properties.tmpl @@ -0,0 +1,107 @@ +<?js + var props = obj; + + /* sort subprops under their parent props (like opts.classname) */ + var parentProp = null; + props.forEach(function(prop, i) { + if (!prop) { return; } + if ( parentProp && prop.name.indexOf(parentProp.name + '.') === 0 ) { + prop.name = prop.name.substr(parentProp.name.length+1); + parentProp.subprops = parentProp.subprops || []; + parentProp.subprops.push(prop); + props[i] = null; + } + else { + parentProp = prop; + } + }); + + /* determine if we need extra columns, "attributes" and "default" */ + props.hasAttributes = false; + props.hasDefault = false; + props.hasName = false; + + props.forEach(function(prop) { + if (!prop) { return; } + + if (prop.optional || prop.nullable) { + props.hasAttributes = true; + } + + if (prop.name) { + props.hasName = true; + } + + if (typeof prop.defaultvalue !== 'undefined') { + props.hasDefault = true; + } + }); +?> + +<table class="props"> + <thead> + <tr> + <?js if (props.hasName) {?> + <th>Name</th> + <?js } ?> + + <th>Type</th> + + <?js if (props.hasAttributes) {?> + <th>Argument</th> + <?js } ?> + + <?js if (props.hasDefault) {?> + <th>Default</th> + <?js } ?> + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + <?js + var self = this; + props.forEach(function(prop) { + if (!prop) { return; } + ?> + + <tr> + <?js if (props.hasName) {?> + <td class="name"><code><?js= prop.name ?></code></td> + <?js } ?> + + <td class="type"> + <?js if (prop.type && prop.type.names) {?> + <?js= self.partial('type.tmpl', prop.type.names) ?> + <?js } ?> + </td> + + <?js if (props.hasAttributes) {?> + <td class="attributes"> + <?js if (prop.optional) { ?> + <optional><br> + <?js } ?> + + <?js if (prop.nullable) { ?> + <nullable><br> + <?js } ?> + </td> + <?js } ?> + + <?js if (props.hasDefault) {?> + <td class="default"> + <?js if (typeof prop.defaultvalue !== 'undefined') { ?> + <?js= self.htmlsafe(prop.defaultvalue) ?> + <?js } ?> + </td> + <?js } ?> + + <td class="description last"><?js= prop.description ?><?js if (prop.subprops) { ?> + <h6>Properties</h6><?js= self.partial('properties.tmpl', prop.subprops) ?> + <?js } ?></td> + </tr> + + <?js }); ?> + </tbody> +</table>
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/returns.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/returns.tmpl new file mode 100644 index 00000000..32e059ed --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/returns.tmpl @@ -0,0 +1,19 @@ +<?js +var data = obj; +if (data.description) { +?> +<div class="param-desc"> + <?js= description ?> +</div> +<?js } ?> + +<?js if (data.type && data.type.names) {?> +<dl> + <dt> + Type + </dt> + <dd> + <?js= this.partial('type.tmpl', data.type.names) ?> + </dd> +</dl> +<?js } ?>
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/source.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/source.tmpl new file mode 100644 index 00000000..e1092ef2 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/source.tmpl @@ -0,0 +1,8 @@ +<?js + var data = obj; +?> + <section> + <article> + <pre class="prettyprint source"><code><?js= data.code ?></code></pre> + </article> + </section>
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/tutorial.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/tutorial.tmpl new file mode 100644 index 00000000..b0c79c1d --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/tutorial.tmpl @@ -0,0 +1,19 @@ +<section> + +<header> + <?js if (children.length > 0) { ?> + <ul><?js + var self = this; + children.forEach(function(t) { ?> + <li><?js= self.tutoriallink(t.name) ?></li> + <?js }); ?></ul> + <?js } ?> + + <h2><?js= header ?></h2> +</header> + +<article> + <?js= content ?> +</article> + +</section> diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/type.tmpl b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/type.tmpl new file mode 100644 index 00000000..db8194d6 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/jsdoc3/tmpl/type.tmpl @@ -0,0 +1,7 @@ +<?js + var data = obj; + var self = this; + data.forEach(function(name, i) { ?> +<span class="param-type"><?js= self.linkto(name, self.htmlsafe(name)) ?></span> +<?js if (i < data.length-1) { ?>|<?js } ?> +<?js }); ?>
\ No newline at end of file diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/oktavia-jquery-ui.js b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/oktavia-jquery-ui.js new file mode 100644 index 00000000..bd1efb8c --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/oktavia-jquery-ui.js @@ -0,0 +1,521 @@ +/** + * @fileOverview + * A UI script that creates search form, loads an index files and show search results. + * It needs jQuery and <tt>oktavia-search.js</tt> or <tt>oktavia-*-search.js</tt> + * (stemming library supported versions). + * @author Yoshiki Shibukawa, yoshiki@shibu.jp + */ + +(function ($) +{ + var logosrc; + /** + * @name SearchView + * @class + * Provides searching feature to your website. + * @constructor + * @param {jQeury} node Target node it has a search form and a search result window. + * @param {string} documentRoot Document root folder like '.', '../', '/' + * @param {string} index Index file path. + */ + function SearchView(node, documentRoot, index) + { + var OktaviaSearch = JSX.require("tool/web/oktavia-search.jsx").OktaviaSearch$I; + + /** + * Target node it contains a search form and a search result window. + * @type jQuery + */ + this.node = node; + /** + * Search engine core + * @type OktaviaSearch + */ + this.engine = new OktaviaSearch(5); + if (documentRoot === '') + { + /** + * Document root path + * @type string[] + */ + this.documentRoot = []; + } + else if (documentRoot.slice(-1) === '/') + { + this.documentRoot = documentRoot.slice(0, -1).split(/\//g); + } + else + { + this.documentRoot = documentRoot.split(/\//g); + } + + /** + * It is true if an index file is loaded. + * @type boolean + */ + this.initialized = false; + /** + * It is true if an user search before loading an index. + * @type boolean + */ + this.reserveSearch = false; + + var indexURL; + switch (index.charAt(0)) + { + case '.': + case '/': + indexURL = index; + break; + default: + indexURL = this.getDocumentPath(index); + break; + } + var self = this; + function loadIndex() + { + self.engine.loadIndex$S(window.searchIndex); + self.initialized = true; + window.searchIndex = null; + if (self.reserveSearch) + { + self.search(); + } + self.reserveSearch = false; + } + if (window.searchIndex) + { + loadIndex() + } + else + { + this.loadJavaScript(indexURL, loadIndex); + } + } + + /** + * Changes result page. + * @param {integer} page Page number + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.changePage = function (page) + { + this.engine.setCurrentPage$I(page); + this.updateResult(); + }; + + /** + * Clears a search form and a reult window. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.clearResult = function () + { + $('.oktavia_search', this.node).val(''); + $('.oktavia_searchresult_box', this.node).hide(); + }; + + /** + * Loads an external JavaScript file. + * + * This code is based on: http://os0x.hatenablog.com/entry/20080827/1219815828 + * @param {string} src A JavaScript source file path + * @param {function} callback It is called when the target JavaScript file is loaded + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.loadJavaScript = function (src, callback) + { + var sc = document.createElement('script'); + sc.type = 'text/javascript'; + if (window.ActiveXObject) + { + sc.onreadystatechange = function () + { + if (sc.readyState === 'complete' || sc.readyState === 'loaded') + { + callback(sc.readyState); + } + }; + } + else + { + sc.onload = function () + { + callback('onload'); + }; + } + sc.src = src; + document.body.appendChild(sc); + }; + + /** + * Updates page navigation list. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updatePageList = function () + { + var self = this; + function createCallback(i) + { + return function () { + self.changePage(i); + }; + } + + var currentPage = String(this.engine.currentPage$()); + var nav = $('.oktavia_searchresult_nav', this.node); + nav.empty(); + var pages = this.engine.pageIndexes$(); + for (var i = 0; i < pages.length; i++) + { + var pageItem = $('<span/>').text(pages[i]); + if (pages[i] === '...') + { + pageItem.addClass('leader'); + } + else + { + pageItem.addClass('page'); + if (pages[i] !== currentPage) + { + pageItem.bind('click', createCallback(Number(pages[i]))); + } + else + { + pageItem.addClass('selected'); + } + } + nav.append(pageItem); + } + }; + + /** + * Updates result list in a result window. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updateResult = function () + { + var totalPages = this.engine.totalPages$(); + var resultslot = $('.oktavia_searchresult', this.node); + resultslot.empty(); + var self = this; + function clearCallback() + { + self.clearResult(); + } + var results = this.engine.getResult$(); + var searchInput = $('.oktavia_search', this.node); + var queryWord = searchInput.val() + for (var i = 0; i < results.length; i++) + { + var result = results[i]; + var url = this.getDocumentPath(result.url.slice(1)) + var entry = $('<div/>', { "class": "entry" }); + var link = $('<a/>', { "href": url + this.engine.getHighlight$() }).text(result.title); + link.bind('click', clearCallback); + entry.append($('<div/>', { "class": "title" }).append(link)); + entry.append($('<div/>', { "class": "url" }).text(url)); + entry.append($('<div/>', { "class": "resultcontent" }).html(result.content)); + resultslot.append(entry); + } + this.updatePageList(); + }; + + /** + * Searchs again by using proposal search words. + * @param {string} option Proposal search words + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.searchProposal = function (option) + { + $('.oktavia_search', this.node).val(option); + this.search(); + }; + + /** + * Shows proposals when no result. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updateProposal = function () + { + var nav = $('.oktavia_searchresult_nav', this.node); + var resultslot = $('.oktavia_searchresult', this.node); + nav.empty(); + resultslot.empty(); + var proposals = this.engine.getProposals$(); + var self = this; + function createCallback(option) + { + return function () + { + self.searchProposal(option); + }; + } + for (var i = 0; i < proposals.length; i++) + { + var proposal = proposals[i]; + var listitem = $('<div/>', {"class": "proposal"}); + listitem.append('<span>Search with: </span>'); + var option = $('<span/>', {"class": "option"}); + option.html(proposal.label); + option.bind('click', createCallback(proposal.options)); + listitem.append(option); + listitem.append('<span> → ' + proposal.count + ' results.</span>'); + resultslot.append(listitem); + } + }; + + /** + * Performs search and shows results. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.search = function () + { + if (!this.initialized) + { + this.reserveSearch = true; + return; + } + var searchInput = $('.oktavia_search', this.node); + var queryWord = searchInput.val(); + searchInput.blur(); + var self = this; + this.engine.search$SF$IIV$(queryWord, function (total, pages) + { + $('.oktavia_searchresult_box', self.node).fadeIn(); + var summaryNode = $('.oktavia_searchresult_summary', self.node); + if (total === 0) + { + summaryNode.text("No result."); + self.updateProposal(); + } + else + { + summaryNode.text(total + ' results.'); + self.updateResult(); + } + }); + }; + + /** + * Converts file path in index. + * @param {string} filePath Source filepath + * @returns {string} Result filepath + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.getDocumentPath = function (filePath) + { + var resultFilePath; + if (filePath.charAt(0) === '/') + { + resultFilePath = filePath; + } + else + { + var elements = filePath.split(/\//g); + var result = this.documentRoot.slice(); + for (var i = 0; i < elements.length; i++) + { + var element = elements[i]; + switch (element) + { + case '.': + break; + case '..': + result = result.slice(0, -1); + break; + default: + result.push(element); + break; + } + } + resultFilePath = result.join('/'); + } + return resultFilePath; + }; + + /** + * Hides all result windows. + * @function + */ + function eraseResultWindow() + { + $('.oktavia_searchresult_box:visible').hide(); + } + + /** + * jQuery plug-in to create search form and window. + * It can receive options from data attributes or an <tt>option</tt> parameter. + * @param {object} [option] Option + * @param {string} [option.index='search/searchindex.js'] Index file path. + * @param {string} [option.documentRoot='.'] Document root folder. + * @param {string} [option.logo='true'] Show logo in result windows. <tt>'false'</tt> or <tt>'disable'</tt> or falsy value disable logo. + * @name oktaviaSearch + * @function + */ + jQuery.fn.oktaviaSearch = function (option) + { + var data = { + 'index': 'search/searchindex.js', + 'documentRoot': '.', + 'logo': 'true' + }; + if (window.DOCUMENTATION_OPTIONS) // Sphinx + { + if (window.DOCUMENTATION_OPTIONS.URL_ROOT === '#') + { + data.documentRoot = ''; + } + else + { + data.documentRoot = window.DOCUMENTATION_OPTIONS.URL_ROOT; + } + } + var userData = this.data(); + var key; + for (key in userData) + { + if (userData.hasOwnProperty(key)) + { + data[key] = userData[key]; + } + } + for (key in option) + { + if (option.hasOwnProperty(key)) + { + data[key] = option[key]; + } + } + if (data.logo === 'false' || data.logo === 'disable' || !data.logo) + { + data.logo = false; + } + else + { + data.logo = true; + } + var view = new SearchView(this, data.documentRoot, data.index); + + var form = $('<form class="oktavia_form"><input class="oktavia_search" result="10" type="search" name="search" value="" placeholder="Search" /></form>'); + form.submit(function (event) { + event.stopPropagation(); + setTimeout(function () { + view.search(); + }, 10); + return false; + }); + this.append(form); + var resultForm = $([ + '<div class="oktavia_searchresult_box">', + '<div class="oktavia_close_search_box">×</div>', + '<div class="oktavia_searchresult_summary"></div>', + '<div class="oktavia_searchresult"></div>', + '<div class="oktavia_searchresult_nav"></div>', + '</div>' + ].join('')); + if (data.logo) + { + resultForm.append($('<span class="pr">Powered by <a href="http://oktavia.info"><img src="' + logosrc + '" width="86px" height="25px" alt="Oktavia"></img></a></span>')); + } + this.append(resultForm); + $('.oktavia_close_search_box', this.node).bind('click', function (event) { + view.clearResult(); + }); + + // Click outside of the result window, close it + resultForm.bind('click', function (event) { + event.stopPropagation(); + }); + }; + + /** + * Global initailization. + * It add some event handlers. + * @name initialize + * @function + */ + function initialize() + { + + function onClick() { + eraseResultWindow(); + return true; + } + function onKeyDown(event) + { + switch (event.keyCode) + { + case 191: // / : focus form + eraseResultWindow(); + var form = $('form.oktavia_form:first input.search'); + if ($(':focus', form).size() === 0) + { + form.focus(); + } + break; + case 74: // j : down + case 75: // k : up + case 72: // h : before page + case 76: // l : next page + case 13: // enter : select + var result = $('.oktavia_searchresult_box:visible:first'); + if (result.size() === 1) + { + switch (event.keyCode) + { + case 74: // j : down + console.log('down'); + break; + case 75: // k : up + console.log('up'); + break; + case 72: // h : before page + console.log('before'); + break; + case 76: // l : next page + console.log('next'); + break; + case 13: // enter : select + console.log('select'); + break; + } + } + break; + } + return true; + } + var version = $.fn.jquery.split(/\./g); + var major = Number(version[0]); + var minor = Number(version[1]); + if (major === 1 && minor < 7) + { + $(document).live('click', onClick); + $(document).live('keydown', onKeyDown); + } + else + { + $(document).on('click', onClick); + $(document).on('keydown', onKeyDown); + } + } + + var logosrc = "data:image/jpeg;base64, /9j/4AAQSkZJRgABAQEASABIAAD/4ge4SUNDX1BST0ZJTEUAAQEAAAeoYXBwbAIgAABtbnRyUkdCIFhZWiAH2QACABkACwAaAAthY3NwQVBQTAAAAABhcHBsAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWFwcGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtkZXNjAAABCAAAAG9kc2NtAAABeAAABWxjcHJ0AAAG5AAAADh3dHB0AAAHHAAAABRyWFlaAAAHMAAAABRnWFlaAAAHRAAAABRiWFlaAAAHWAAAABRyVFJDAAAHbAAAAA5jaGFkAAAHfAAAACxiVFJDAAAHbAAAAA5nVFJDAAAHbAAAAA5kZXNjAAAAAAAAABRHZW5lcmljIFJHQiBQcm9maWxlAAAAAAAAAAAAAAAUR2VuZXJpYyBSR0IgUHJvZmlsZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbWx1YwAAAAAAAAAeAAAADHNrU0sAAAAoAAABeGhySFIAAAAoAAABoGNhRVMAAAAkAAAByHB0QlIAAAAmAAAB7HVrVUEAAAAqAAACEmZyRlUAAAAoAAACPHpoVFcAAAAWAAACZGl0SVQAAAAoAAACem5iTk8AAAAmAAAComtvS1IAAAAWAAACyGNzQ1oAAAAiAAAC3mhlSUwAAAAeAAADAGRlREUAAAAsAAADHmh1SFUAAAAoAAADSnN2U0UAAAAmAAAConpoQ04AAAAWAAADcmphSlAAAAAaAAADiHJvUk8AAAAkAAADomVsR1IAAAAiAAADxnB0UE8AAAAmAAAD6G5sTkwAAAAoAAAEDmVzRVMAAAAmAAAD6HRoVEgAAAAkAAAENnRyVFIAAAAiAAAEWmZpRkkAAAAoAAAEfHBsUEwAAAAsAAAEpHJ1UlUAAAAiAAAE0GFyRUcAAAAmAAAE8mVuVVMAAAAmAAAFGGRhREsAAAAuAAAFPgBWAWEAZQBvAGIAZQBjAG4A/QAgAFIARwBCACAAcAByAG8AZgBpAGwARwBlAG4AZQByAGkBDQBrAGkAIABSAEcAQgAgAHAAcgBvAGYAaQBsAFAAZQByAGYAaQBsACAAUgBHAEIAIABnAGUAbgDoAHIAaQBjAFAAZQByAGYAaQBsACAAUgBHAEIAIABHAGUAbgDpAHIAaQBjAG8EFwQwBDMEMAQ7BEwEPQQ4BDkAIAQ/BEAEPgREBDAEOQQ7ACAAUgBHAEIAUAByAG8AZgBpAGwAIABnAOkAbgDpAHIAaQBxAHUAZQAgAFIAVgBCkBp1KAAgAFIARwBCACCCcl9pY8+P8ABQAHIAbwBmAGkAbABvACAAUgBHAEIAIABnAGUAbgBlAHIAaQBjAG8ARwBlAG4AZQByAGkAcwBrACAAUgBHAEIALQBwAHIAbwBmAGkAbMd8vBgAIABSAEcAQgAg1QS4XNMMx3wATwBiAGUAYwBuAP0AIABSAEcAQgAgAHAAcgBvAGYAaQBsBeQF6AXVBeQF2QXcACAAUgBHAEIAIAXbBdwF3AXZAEEAbABsAGcAZQBtAGUAaQBuAGUAcwAgAFIARwBCAC0AUAByAG8AZgBpAGwAwQBsAHQAYQBsAOEAbgBvAHMAIABSAEcAQgAgAHAAcgBvAGYAaQBsZm6QGgAgAFIARwBCACBjz4/wZYdO9k4AgiwAIABSAEcAQgAgMNcw7TDVMKEwpDDrAFAAcgBvAGYAaQBsACAAUgBHAEIAIABnAGUAbgBlAHIAaQBjA5MDtQO9A7kDugPMACADwAPBA78DxgOvA7sAIABSAEcAQgBQAGUAcgBmAGkAbAAgAFIARwBCACAAZwBlAG4A6QByAGkAYwBvAEEAbABnAGUAbQBlAGUAbgAgAFIARwBCAC0AcAByAG8AZgBpAGUAbA5CDhsOIw5EDh8OJQ5MACAAUgBHAEIAIA4XDjEOSA4nDkQOGwBHAGUAbgBlAGwAIABSAEcAQgAgAFAAcgBvAGYAaQBsAGkAWQBsAGUAaQBuAGUAbgAgAFIARwBCAC0AcAByAG8AZgBpAGkAbABpAFUAbgBpAHcAZQByAHMAYQBsAG4AeQAgAHAAcgBvAGYAaQBsACAAUgBHAEIEHgQxBEkEOAQ5ACAEPwRABD4ERAQ4BDsETAAgAFIARwBCBkUGRAZBACAGKgY5BjEGSgZBACAAUgBHAEIAIAYnBkQGOQYnBkUARwBlAG4AZQByAGkAYwAgAFIARwBCACAAUAByAG8AZgBpAGwAZQBHAGUAbgBlAHIAZQBsACAAUgBHAEIALQBiAGUAcwBrAHIAaQB2AGUAbABzAGV0ZXh0AAAAAENvcHlyaWdodCAyMDA3IEFwcGxlIEluYy4sIGFsbCByaWdodHMgcmVzZXJ2ZWQuAFhZWiAAAAAAAADzUgABAAAAARbPWFlaIAAAAAAAAHRNAAA97gAAA9BYWVogAAAAAAAAWnUAAKxzAAAXNFhZWiAAAAAAAAAoGgAAFZ8AALg2Y3VydgAAAAAAAAABAc0AAHNmMzIAAAAAAAEMQgAABd7///MmAAAHkgAA/ZH///ui///9owAAA9wAAMBs/+EAgEV4aWYAAE1NACoAAAAIAAUBEgADAAAAAQABAAABGgAFAAAAAQAAAEoBGwAFAAAAAQAAAFIBKAADAAAAAQACAACHaQAEAAAAAQAAAFoAAAAAAAAASAAAAAEAAABIAAAAAQACoAIABAAAAAEAAABWoAMABAAAAAEAAAAYAAAAAP/bAEMAAgICAgIBAgICAgICAgMDBgQDAwMDBwUFBAYIBwgICAcICAkKDQsJCQwKCAgLDwsMDQ4ODg4JCxARDw4RDQ4ODv/bAEMBAgICAwMDBgQEBg4JCAkODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODv/AABEIABgAVgMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AP3571+dfjn4ofEz4+/tjeJPg38JPE+peAfh/wCE9Q/szxJ4g0namo6xqCoss9tBM6sLe2gRlEkqqXLNtXnFfooa/Lj9jvU7PwH+3T+0D8J/E00Vt4usvHOs3MfmsAbqDUbmO+tp1J6qyN5ZPZkCnqBTQG7pnwW1VP2lde8FfB74qfF3R/E3hrT459f8Val4xutRsIryVd8Nq1ncGRZlYD5zlSoPHTBufD39oH4y+F9H8Xaj8Ur2w8SxeCvES6P4+0tLBIbzSklI8m/t5IwFmt2BBwVB/PI9Z+DOtWfhn/goR+0p8P8AxDcw6f4j1XV7bxLo0dw4U3+nyWwQvHk/MI3RlbH3a+SvG/jnRdbi/bY+JOkyJc+HvF0mm+BvBoiGf+Eh1OGPy3a2H/LUBnHzLkYXNfa0KNGnmlDCxpKVOpGmndXb5knKSb1i7t2cbWtrfW/w+IjiK2WVsRKu41ISm42dlGzajFpWUlZK6le921bS36G+GPHWq61+2r4+8I/2jFdeGdO8N6Xf6fEkKja1wZdz7wNzBgq8E4Fcr8T/ANpDwX4U0bw63hzxb4P1S5vPE8Gm3zveCRLW2WULdzDacHyhwxzhSwJz0Pxp430f4ww/H74qeEvABimudH+FHhxvFdvFcvDqGoW8KSCSztJFB2STBZlL9QFwOWr2L4k+IPh1r/7Fn7MuufDG00638E3XxJ8Pw6dbQQqPsymdlkgcdQ6uCrg8lgc5r1P7EwEcVhqk1zRlyK0bJL92neWm8nqu9m7nl1MzzN4PE0oS5Jpzd5Xb1ntHXaK0v00SXU+s9e+M/wAKfDGg6NqevfEDwrpljq9st1pckt8v+lwtyssYGSyH+8Bj3rQ0v4o/DrW7Hw/daR408OajBrl09ppElveowu50Xc0SY6yBeSvXHavmb/hIr7Uv22vivD8EvhJoXirxTpP2LTPFfibxX4ke0s7aRYQ8VpawiKVgqo4ZtiopJzyea+e7PQfFGteEv2tLyxh8Op8QPAXjrTfE+nW3htX+xLfWtos00UO7DfPGJImJAJYtx2rzcNw5g6tP35ODtF6uL+NpK8VrFJyTu3qleyvp6tfPsxp1PdhGSvJaKS+FNu0no20mrJWTduZ21/Rf4l6/d6N8PWtNC8UeF/C/jLU3Nv4cfXojLb3NyqmTyjGrKzAqrZKnKj5sHGD5j4L8W6fZfC6y+M3xg+IHguN9UQjSxY6iP7G0qFiR5Fs7HNxM2DvmILNgqoVBg+X6B4vsPj9+14vjbQ5xdeB/AXgBbq0kVt0b6tq1uZCPTfDbAA9wZe1eNfCXxXp9x8Ev2UdE8N/DhfiX8Xl8F3uq6PFqet/YdL0qzM5iluZiVcNIWwi7Y2Yc4IzzyUuFaLSlVlLnjbmjdJK8aklrKyWkY3b25no2kj13xhjIUKlCjThySb5Z8rcnZwi0mtWm3L3Vvy7pSlf9C/BnxO+H3xE+2f8ACEeMNB8TPaAG6isboPJCD0LJ94A+uMUV8JaxqPjex/4KWaZ/wmlh4A8NeJrr4bXUslp4Su5pdsI1C1VPtErpGXcndtwgAAPWisswyGlTlB0p6SSfR2+asntvZHDg+Iq/LKNan7ybV1dX+Tu16XZyPjX4k/tYftcfF/xR8Kvgh4b1/wDZ7+EOkanc6R4p8f8AiK2e31O6khkMcsVqqsGUHBwIW3FWy00BG1vWrX/gnT8EtJ+DfhvS/Dmq+NfDPxL0dnmT4m6dfKuvXs8mDI10zKY54jhQIXUqiqoXGM0UV8wfXC6h+xb418baxpK/Fv8Aad+IHjrRtOt5LSOKy8PadpV9PbyAeZDJexRmYI+BuCFc4x0yD6x8Lv2Pfgl8J/GOleINE0rX9e1jSQ40WfxHrM2oJpW8kubWJz5ULMScuqBj60UV00sdiKUXGE2k1Z2fTt6eRhPC0Zu8op9fn39dD2fTfhx4Y0r9oPxP8TrOG9XxXr+mWmnajK92zRNDamQwhYz8qkGR8kcnPPQV5ZqX7Kvwh1L4deMfCbWHiGx0HxF4lTxJLaWOuTwLp+pK277TZ7WH2Zi3JVMKTnjk0UVdLMsXTlzQqNPTq/s/D93TsKeEozVpRT3/AB3+8zT+yX8OIfEY1nSPEvxc8N6xPpdvp+sX2keOL22n1tIF2JJeOrZmn28GbIkOBluK9C+G/wADPhv8Jtc8WXngTR7nR4vEa2/9qWbX0s9vI0KMgkCSFsSOGYyPnMjEsxJ5ooq62bY2rBwnVk09GrvW21/Syt2M45fhozU1BXXWxL8MPgl8Pfg98LtY8H+A9KuNM0TU7+e9vElu3mkaSZQrYdiSFVQqqvRQABXAT/snfCj/AIQX4daNpD+NfC134GspLHw5rmh+JLi01O3tpGLPA86nMsbE5KuGFFFEc1xiqSqKrLmk7t3ers1r30bXo2U8Fh3BQ5FZdLfMS3/ZL+Elp4qtvEUA8aHxWtrPbXmvz+JrqfUNRSWSJ2+0zSMxlwYUCZ4RQVUKCRRRRTnm+Nl8VVv1ZCy3CramvuP/2Q=="; + initialize(); +})(jQuery); + +jQuery(document).ready(function () { + var form = jQuery('#oktavia_search_form'); + if (form.size() > 0) + { + form.oktaviaSearch(); + } +}); diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/oktavia-search.js b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/oktavia-search.js new file mode 100644 index 00000000..fce9732a --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/oktavia-search.js @@ -0,0 +1,6795 @@ +// generatedy by JSX compiler 0.9.24 (2013-04-05 13:45:00 +0900; 1b229cc6a411f674f0f7cf7a79b7a8b3f8eb7414) +var JSX = {}; +(function (JSX) { +/** + * copies the implementations from source interface to target + */ +function $__jsx_merge_interface(target, source) { + for (var k in source.prototype) + if (source.prototype.hasOwnProperty(k)) + target.prototype[k] = source.prototype[k]; +} + +/** + * defers the initialization of the property + */ +function $__jsx_lazy_init(obj, prop, func) { + function reset(obj, prop, value) { + delete obj[prop]; + obj[prop] = value; + return value; + } + + Object.defineProperty(obj, prop, { + get: function () { + return reset(obj, prop, func()); + }, + set: function (v) { + reset(obj, prop, v); + }, + enumerable: true, + configurable: true + }); +} + +/** + * sideeffect().a /= b + */ +function $__jsx_div_assign(obj, prop, divisor) { + return obj[prop] = (obj[prop] / divisor) | 0; +} + +/* + * global functions, renamed to avoid conflict with local variable names + */ +var $__jsx_parseInt = parseInt; +var $__jsx_parseFloat = parseFloat; +var $__jsx_isNaN = isNaN; +var $__jsx_isFinite = isFinite; + +var $__jsx_encodeURIComponent = encodeURIComponent; +var $__jsx_decodeURIComponent = decodeURIComponent; +var $__jsx_encodeURI = encodeURI; +var $__jsx_decodeURI = decodeURI; + +var $__jsx_ObjectToString = Object.prototype.toString; +var $__jsx_ObjectHasOwnProperty = Object.prototype.hasOwnProperty; + +/* + * profiler object, initialized afterwards + */ +function $__jsx_profiler() { +} + +/* + * public interface to JSX code + */ +JSX.require = function (path) { + var m = $__jsx_classMap[path]; + return m !== undefined ? m : null; +}; + +JSX.profilerIsRunning = function () { + return $__jsx_profiler.getResults != null; +}; + +JSX.getProfileResults = function () { + return ($__jsx_profiler.getResults || function () { return {}; })(); +}; + +JSX.postProfileResults = function (url, cb) { + if ($__jsx_profiler.postResults == null) + throw new Error("profiler has not been turned on"); + return $__jsx_profiler.postResults(url, cb); +}; + +JSX.resetProfileResults = function () { + if ($__jsx_profiler.resetResults == null) + throw new Error("profiler has not been turned on"); + return $__jsx_profiler.resetResults(); +}; +JSX.DEBUG = false; +/** + * class _Result extends Object + * @constructor + */ +function _Result() { +} + +/** + * @constructor + * @param {!string} title + * @param {!string} url + * @param {!string} content + * @param {!number} score + */ +function _Result$SSSI(title, url, content, score) { + this.title = title; + this.url = url; + this.content = content; + this.score = score; +}; + +_Result$SSSI.prototype = new _Result; + +/** + * class _Proposal extends Object + * @constructor + */ +function _Proposal() { +} + +/** + * @constructor + * @param {!string} options + * @param {!string} label + * @param {!number} count + */ +function _Proposal$SSI(options, label, count) { + this.options = options; + this.label = label; + this.count = count; +}; + +_Proposal$SSI.prototype = new _Proposal; + +/** + * class OktaviaSearch extends Object + * @constructor + */ +function OktaviaSearch() { +} + +/** + * @constructor + * @param {!number} entriesPerPage + */ +function OktaviaSearch$I(entriesPerPage) { + this._queries = null; + this._highlight = ""; + this._result = null; + this._proposals = null; + this._currentFolderDepth = 0; + this._oktavia = new Oktavia$(); + this._entriesPerPage = entriesPerPage; + this._currentPage = 1; + this._queryString = null; + this._callback = null; + OktaviaSearch._instance = this; +}; + +OktaviaSearch$I.prototype = new OktaviaSearch; + +/** + * @param {Stemmer} stemmer + */ +OktaviaSearch.setStemmer$LStemmer$ = function (stemmer) { + /** @type {Oktavia} */ + var this$0; + if (OktaviaSearch._instance) { + this$0 = OktaviaSearch._instance._oktavia; + this$0._stemmer = stemmer; + } else { + OktaviaSearch._stemmer = stemmer; + } +}; + +var OktaviaSearch$setStemmer$LStemmer$ = OktaviaSearch.setStemmer$LStemmer$; + +/** + * @param {!string} index + */ +OktaviaSearch.prototype.loadIndex$S = function (index) { + /** @type {Oktavia} */ + var this$0; + /** @type {Stemmer} */ + var stemmer$0; + if (OktaviaSearch._stemmer) { + this$0 = this._oktavia; + stemmer$0 = OktaviaSearch._stemmer; + this$0._stemmer = stemmer$0; + } + this._oktavia.load$S(Binary$base64decode$S(index)); + if (this._queryString) { + this.search$SF$IIV$(this._queryString, this._callback); + this._queryString = null; + this._callback = null; + } +}; + +/** + * @param {!string} queryString + * @param {*} callback + */ +OktaviaSearch.prototype.search$SF$IIV$ = function (queryString, callback) { + /** @type {QueryStringParser} */ + var queryParser; + /** @type {SearchSummary} */ + var summary; + /** @type {Array.<undefined|SearchUnit>} */ + var _result$0; + if (this._oktavia) { + queryParser = ({queries: [ ]}); + this._queries = QueryStringParser$parse$LQueryStringParser$S(queryParser, queryString); + this._highlight = QueryStringParser$highlight$LQueryStringParser$(queryParser); + summary = this._oktavia.search$ALQuery$(this._queries); + if (SearchSummary$size$LSearchSummary$(summary) > 0) { + this._result = this._sortResult$LSearchSummary$(summary); + this._proposals = [ ]; + this._currentPage = 1; + } else { + this._result = [ ]; + if (this._queries.length > 1) { + this._proposals = SearchSummary$getProposal$LSearchSummary$(summary); + } else { + this._proposals = [ ]; + } + this._currentPage = 1; + } + callback((_result$0 = this._result).length, Math.ceil(_result$0.length / this._entriesPerPage)); + } else { + this._queryString = queryString; + this._callback = callback; + } +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.resultSize$ = function () { + return (this._result.length | 0); +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.totalPages$ = function () { + return (Math.ceil(this._result.length / this._entriesPerPage) | 0); +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.currentPage$ = function () { + return this._currentPage; +}; + +/** + * @param {!number} page + */ +OktaviaSearch.prototype.setCurrentPage$I = function (page) { + this._currentPage = page; +}; + +/** + * @return {!boolean} + */ +OktaviaSearch.prototype.hasPrevPage$ = function () { + return this._currentPage !== 1; +}; + +/** + * @return {!boolean} + */ +OktaviaSearch.prototype.hasNextPage$ = function () { + return this._currentPage !== Math.ceil(this._result.length / this._entriesPerPage); +}; + +/** + * @return {Array.<undefined|!string>} + */ +OktaviaSearch.prototype.pageIndexes$ = function () { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var total; + /** @type {!number} */ + var i; + result = [ ]; + total = Math.ceil(this._result.length / this._entriesPerPage); + if (total < 10) { + for (i = 1; i <= total; i++) { + result.push(i + ""); + } + } else { + if (this._currentPage <= 5) { + for (i = 1; i <= 7; i++) { + result.push(i + ""); + } + result.push('...', total + ""); + } else { + if (total - 5 <= this._currentPage) { + result.push('1', '...'); + for (i = total - 8; i <= total; i++) { + result.push(i + ""); + } + } else { + result.push('1', '...'); + for (i = this._currentPage - 3; i <= this._currentPage + 3; i++) { + result.push(i + ""); + } + result.push('...', total + ""); + } + } + } + return result; +}; + +/** + * @return {Array.<undefined|_Result>} + */ +OktaviaSearch.prototype.getResult$ = function () { + /** @type {Style} */ + var style; + /** @type {!number} */ + var start; + /** @type {!number} */ + var last; + /** @type {Metadata} */ + var metadata; + /** @type {!number} */ + var num; + /** @type {Array.<undefined|_Result>} */ + var results; + /** @type {!number} */ + var i; + /** @type {SearchUnit} */ + var unit; + /** @type {Array.<undefined|!string>} */ + var info; + /** @type {!string} */ + var content; + /** @type {Array.<undefined|Position>} */ + var positions; + /** @type {!number} */ + var end; + /** @type {!boolean} */ + var split; + /** @type {!number} */ + var j; + /** @type {Position} */ + var pos; + /** @type {!string} */ + var text; + /** @type {Oktavia} */ + var this$0; + /** @type {!number} */ + var position$0; + /** @type {!number} */ + var _currentPage$0; + /** @type {!number} */ + var _entriesPerPage$0; + style = new Style$S('html'); + start = ((_currentPage$0 = this._currentPage) - 1) * (_entriesPerPage$0 = this._entriesPerPage); + last = Math.min(_currentPage$0 * _entriesPerPage$0, this._result.length); + this$0 = this._oktavia; + metadata = this$0._metadatas[this$0._metadataLabels[0]]; + num = 250; + results = [ ]; + for (i = start; i < last; i++) { + unit = this._result[i]; + info = metadata.getInformation$I(unit.id).split(Oktavia.eob); + content = metadata.getContent$I(unit.id); + start = 0; + positions = SearchUnit$getPositions$LSearchUnit$(unit); + if (content.indexOf(info[0]) === 1) { + content = content.slice(info[0].length + 2, content.length); + start += info[0].length + 2; + } + end = start + num; + split = false; + if (positions[0].position > end - positions[0].word.length) { + end = positions[0].position + Math.floor(num / 2); + split = true; + } + for (j = positions.length - 1; j > -1; j--) { + pos = positions[j]; + if (pos.position + pos.word.length < end) { + content = [ content.slice(0, pos.position - start), style.convert$S('<hit>*</hit>').replace('*', content.slice((position$0 = pos.position) - start, position$0 + pos.word.length - start)), content.slice(pos.position + pos.word.length - start, content.length) ].join(''); + } + } + if (split) { + text = [ content.slice(0, Math.floor(num / 2)) + ' ...', content.slice(- Math.floor(num / 2), end - start) ].join('<br/>'); + } else { + text = content.slice(0, end - start) + ' ...<br/>'; + } + text = text.replace(Oktavia.eob, ' ').replace(/(<br\/>)(<br\/>)+/, '<br/><br/>'); + results.push(({title: info[0], url: info[1], content: text, score: unit.score})); + } + return results; +}; + +/** + * @return {!string} + */ +OktaviaSearch.prototype.getHighlight$ = function () { + return this._highlight; +}; + +/** + * @return {Array.<undefined|_Proposal>} + */ +OktaviaSearch.prototype.getProposals$ = function () { + /** @type {Style} */ + var style; + /** @type {Array.<undefined|_Proposal>} */ + var results; + /** @type {!number} */ + var i; + /** @type {Proposal} */ + var proposal; + /** @type {Array.<undefined|!string>} */ + var label; + /** @type {Array.<undefined|!string>} */ + var option; + /** @type {!number} */ + var j; + style = new Style$S('html'); + results = [ ]; + if (this._queries.length > 1) { + for (i = 0; i < this._proposals.length; i++) { + proposal = this._proposals[i]; + if (proposal.expect > 0) { + label = [ ]; + option = [ ]; + for (j = 0; j < this._queries.length; j++) { + if (j !== proposal.omit) { + label.push(style.convert$S('<hit>' + this._queries[j].toString() + '</hit>')); + option.push(this._queries[j].toString()); + } else { + label.push(style.convert$S('<del>' + this._queries[j].toString() + '</del>')); + } + } + results.push(({options: option.join(' '), label: label.join(' '), count: proposal.expect})); + } + } + } + return results; +}; + +/** + * @param {SearchSummary} summary + * @return {Array.<undefined|SearchUnit>} + */ +OktaviaSearch.prototype._sortResult$LSearchSummary$ = function (summary) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var score; + /** @type {SearchUnit} */ + var unit; + /** @type {!string} */ + var pos; + /** @type {Position} */ + var position; + for (i = 0; i < summary.result.units.length; i++) { + score = 0; + unit = summary.result.units[i]; + for (pos in unit.positions) { + position = unit.positions[pos]; + if (this._oktavia.wordPositionType$I(position.position)) { + score += 10; + } else { + score += 1; + } + if (! position.stemmed) { + score += 2; + } + } + unit.score = (score | 0); + } + return SearchSummary$getSortedResult$LSearchSummary$(summary); +}; + +/** + * class _Main extends Object + * @constructor + */ +function _Main() { +} + +/** + * @constructor + */ +function _Main$() { +}; + +_Main$.prototype = new _Main; + +/** + * @param {Array.<undefined|!string>} args + */ +_Main.main$AS = function (args) { +}; + +var _Main$main$AS = _Main.main$AS; + +/** + * class Oktavia extends Object + * @constructor + */ +function Oktavia() { +} + +/** + * @constructor + */ +function Oktavia$() { + /** @type {Array.<undefined|!string>} */ + var _utf162compressCode$0; + this._compressCode2utf16 = null; + this._fmindex = new FMIndex$(); + this._metadatas = ({ }); + this._metadataLabels = [ ]; + this._stemmer = null; + this._stemmingResult = ({ }); + _utf162compressCode$0 = this._utf162compressCode = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + _utf162compressCode$0.length = 65536; + this._compressCode2utf16 = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; +}; + +Oktavia$.prototype = new Oktavia; + +/** + * @param {Stemmer} stemmer + */ +Oktavia.prototype.setStemmer$LStemmer$ = function (stemmer) { + this._stemmer = stemmer; +}; + +/** + * @return {Metadata} + */ +Oktavia.prototype.getPrimaryMetadata$ = function () { + return this._metadatas[this._metadataLabels[0]]; +}; + +/** + * @param {!string} key + * @return {Section} + */ +Oktavia.prototype.addSection$S = function (key) { + /** @type {Section} */ + var section; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + section = new Section$LOktavia$(this); + this._metadatas[key] = section; + return section; +}; + +/** + * @param {!string} key + * @return {Section} + */ +Oktavia.prototype.getSection$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @return {Splitter} + */ +Oktavia.prototype.addSplitter$S = function (key) { + /** @type {Splitter} */ + var splitter; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + splitter = new Splitter$LOktavia$(this); + this._metadatas[key] = splitter; + return splitter; +}; + +/** + * @param {!string} key + * @return {Splitter} + */ +Oktavia.prototype.getSplitter$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @param {Array.<undefined|!string>} headers + * @return {Table} + */ +Oktavia.prototype.addTable$SAS = function (key, headers) { + /** @type {Table} */ + var table; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + table = new Table$LOktavia$AS(this, headers); + this._metadatas[key] = table; + return table; +}; + +/** + * @param {!string} key + * @return {Table} + */ +Oktavia.prototype.getTable$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @return {Block} + */ +Oktavia.prototype.addBlock$S = function (key) { + /** @type {Block} */ + var block; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + block = new Block$LOktavia$(this); + this._metadatas[key] = block; + return block; +}; + +/** + * @param {!string} key + * @return {Block} + */ +Oktavia.prototype.getBlock$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + */ +Oktavia.prototype.addEndOfBlock$ = function () { + this._fmindex.push$S(Oktavia.eob); +}; + +/** + * @param {!string} words + */ +Oktavia.prototype.addWord$S = function (words) { + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {undefined|!string} */ + var newCharCode; + str = [ ]; + str.length = words.length; + for (i = 0; i < words.length; i++) { + charCode = words.charCodeAt(i); + newCharCode = this._utf162compressCode[charCode]; + if (newCharCode == null) { + newCharCode = String.fromCharCode(this._compressCode2utf16.length); + this._utf162compressCode[charCode] = newCharCode; + this._compressCode2utf16.push(String.fromCharCode(charCode)); + } + str.push(newCharCode); + } + this._fmindex.push$S(str.join('')); +}; + +/** + * @param {!string} words + * @param {!boolean} stemming + */ +Oktavia.prototype.addWord$SB = function (words, stemming) { + /** @type {Array.<undefined|!string>} */ + var wordList; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var originalWord; + /** @type {!string} */ + var smallWord; + /** @type {undefined|!string} */ + var registerWord; + /** @type {!string} */ + var baseWord; + /** @type {!string} */ + var compressedCodeWord; + /** @type {Array.<undefined|!string>} */ + var stemmedList; + this.addWord$S(words); + wordList = words.split(/\s+/); + for (i = 0; i < wordList.length; i++) { + originalWord = wordList[i]; + smallWord = originalWord.slice(0, 1).toLowerCase() + originalWord.slice(1); + registerWord = null; + if (stemming && this._stemmer) { + baseWord = this._stemmer.stemWord$S(originalWord.toLowerCase()); + if (originalWord.indexOf(baseWord) === -1) { + registerWord = baseWord; + } + } else { + if (originalWord != smallWord) { + registerWord = smallWord; + } + } + if (registerWord) { + compressedCodeWord = this._convertToCompressionCode$S(originalWord); + stemmedList = this._stemmingResult[registerWord]; + if (! stemmedList) { + stemmedList = [ compressedCodeWord ]; + this._stemmingResult[registerWord] = stemmedList; + } else { + if (stemmedList.indexOf(compressedCodeWord) === -1) { + stemmedList.push(compressedCodeWord); + } + } + } + } +}; + +/** + * @param {!string} keyword + * @return {!string} + */ +Oktavia.prototype._convertToCompressionCode$S = function (keyword) { + /** @type {Array.<undefined|!string>} */ + var resultChars; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var chr; + resultChars = [ ]; + for (i = 0; i < keyword.length; i++) { + chr = this._utf162compressCode[keyword.charCodeAt(i)]; + if (chr == null) { + resultChars.push(Oktavia.unknown); + } else { + resultChars.push(chr); + } + } + return resultChars.join(''); +}; + +/** + * @param {!string} keyword + * @param {!boolean} stemming + * @return {Array.<undefined|!number>} + */ +Oktavia.prototype.rawSearch$SB = function (keyword, stemming) { + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {!string} */ + var baseWord; + /** @type {Array.<undefined|!string>} */ + var stemmedList; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var word; + if (stemming) { + result = [ ]; + if (this._stemmer) { + baseWord = this._stemmer.stemWord$S(keyword.toLowerCase()); + stemmedList = this._stemmingResult[baseWord]; + if (stemmedList) { + for (i = 0; i < stemmedList.length; i++) { + word = stemmedList[i]; + result = result.concat(this._fmindex.search$S(word)); + } + } + } + } else { + result = this._fmindex.search$S(this._convertToCompressionCode$S(keyword)); + } + return result; +}; + +/** + * @param {Array.<undefined|Query>} queries + * @return {SearchSummary} + */ +Oktavia.prototype.search$ALQuery$ = function (queries) { + /** @type {SearchSummary} */ + var summary; + /** @type {!number} */ + var i; + /** @type {SingleResult} */ + var result$0; + summary = ({sourceResults: [ ], result: null, oktavia: this}); + for (i = 0; i < queries.length; i++) { + result$0 = this._searchQuery$LQuery$(queries[i]); + summary.sourceResults.push(result$0); + } + summary.result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$(summary, summary.sourceResults); + return summary; +}; + +/** + * @param {Query} query + * @return {SingleResult} + */ +Oktavia.prototype._searchQuery$LQuery$ = function (query) { + /** @type {SingleResult} */ + var result; + /** @type {Array.<undefined|!number>} */ + var positions; + result = new SingleResult$SBB(query.word, query.or, query.not); + if (query.raw) { + positions = this.rawSearch$SB(query.word, false); + } else { + positions = this.rawSearch$SB(query.word, false).concat(this.rawSearch$SB(query.word, true)); + } + this._metadatas[this._metadataLabels[0]].grouping$LSingleResult$AISB(result, positions, query.word, ! query.raw); + return result; +}; + +/** + */ +Oktavia.prototype.build$ = function () { + this.build$IB(5, false); +}; + +/** + * @param {!number} cacheDensity + * @param {!boolean} verbose + */ +Oktavia.prototype.build$IB = function (cacheDensity, verbose) { + /** @type {!string} */ + var key; + /** @type {!number} */ + var cacheRange; + /** @type {!number} */ + var maxChar; + for (key in this._metadatas) { + this._metadatas[key]._build$(); + } + cacheRange = Math.round(Math.max(1, 100 / Math.min(100, Math.max(0.01, cacheDensity)))); + maxChar = this._compressCode2utf16.length; + this._fmindex.build$SIIB(Oktavia.eof, maxChar, cacheRange, verbose); +}; + +/** + * @return {!string} + */ +Oktavia.prototype.dump$ = function () { + return this.dump$B(false); +}; + +/** + * @param {!boolean} verbose + * @return {!string} + */ +Oktavia.prototype.dump$B = function (verbose) { + /** @type {!string} */ + var header; + /** @type {!string} */ + var fmdata; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {CompressionReport} */ + var report; + /** @type {undefined|!string} */ + var name; + /** @type {!string} */ + var data; + header = Binary$dumpString$SLCompressionReport$("oktavia-01", null).slice(1); + if (verbose) { + console.log("Source text size: " + (this._fmindex.size$() * 2 + "") + ' bytes'); + } + fmdata = this._fmindex.dump$B(verbose); + result = [ header, fmdata ]; + result.push(Binary$dump16bitNumber$I(this._compressCode2utf16.length)); + for (i = 3; i < this._compressCode2utf16.length; i++) { + result.push(this._compressCode2utf16[i]); + } + if (verbose) { + console.log('Char Code Map: ' + (this._compressCode2utf16.length * 2 - 2 + "") + ' bytes'); + } + report = ({source: 0, result: 0}); + result.push(Binary$dumpStringListMap$HASLCompressionReport$(this._stemmingResult, report)); + if (verbose) { + console.log('Stemmed Word Table: ' + (result[result.length - 1].length + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + result.push(Binary$dump16bitNumber$I(this._metadataLabels.length)); + for (i = 0; i < this._metadataLabels.length; i++) { + report = ({source: 0, result: 0}); + name = this._metadataLabels[i]; + data = this._metadatas[name]._dump$LCompressionReport$(report); + result.push(Binary$dumpString$SLCompressionReport$(name, report), data); + if (verbose) { + console.log('Meta Data ' + name + ': ' + (data.length * 2 + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + } + return result.join(''); +}; + +/** + * @param {!string} data + */ +Oktavia.prototype.load$S = function (data) { + /** @type {!string} */ + var header; + /** @type {!number} */ + var offset; + /** @type {!number} */ + var charCodeCount; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {LoadedStringListMapResult} */ + var stemmedWords; + /** @type {!number} */ + var metadataCount; + /** @type {LoadedStringResult} */ + var nameResult; + /** @type {!string} */ + var name; + /** @type {!number} */ + var type; + header = Binary$dumpString$SLCompressionReport$("oktavia-01", null).slice(1); + if (data.slice(0, 5) !== header) { + throw new Error('Invalid data file'); + } + this._metadatas = ({ }); + this._metadataLabels = [ ]; + offset = 5; + offset = this._fmindex.load$SI(data, offset); + charCodeCount = Binary$load16bitNumber$SI(data, offset++); + this._compressCode2utf16 = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + this._utf162compressCode = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + for (i = 3; i < charCodeCount; i++) { + charCode = Binary$load16bitNumber$SI(data, offset++); + this._compressCode2utf16.push(String.fromCharCode(charCode)); + this._utf162compressCode[charCode] = String.fromCharCode(i); + } + stemmedWords = Binary$loadStringListMap$SI(data, offset); + this._stemmingResult = stemmedWords.result; + offset = stemmedWords.offset; + metadataCount = Binary$load16bitNumber$SI(data, offset++); + for (i = 0; i < metadataCount; i++) { + nameResult = Binary$loadString$SI(data, offset); + name = nameResult.result; + offset = nameResult.offset; + type = Binary$load16bitNumber$SI(data, offset++); + switch (type) { + case 0: + offset = Section$_load$LOktavia$SSI(this, name, data, offset); + break; + case 1: + offset = Splitter$_load$LOktavia$SSI(this, name, data, offset); + break; + case 2: + offset = Table$_load$LOktavia$SSI(this, name, data, offset); + break; + case 3: + offset = Block$_load$LOktavia$SSI(this, name, data, offset); + break; + } + } +}; + +/** + * @return {!number} + */ +Oktavia.prototype.contentSize$ = function () { + /** @type {FMIndex} */ + var this$0; + this$0 = this._fmindex; + return this$0._substr.length; +}; + +/** + * @param {!number} position + * @return {!number} + */ +Oktavia.prototype.wordPositionType$I = function (position) { + /** @type {!number} */ + var result; + /** @type {!string} */ + var ahead; + result = 0; + if (position === 0) { + result = 4; + } else { + ahead = this._fmindex.getSubstring$II(position - 1, 1); + if (/\s/.test(ahead)) { + result = 2; + } else { + if (/\W/.test(ahead)) { + result = 1; + } else { + if (Oktavia.eob === ahead) { + result = 3; + } + } + } + } + return (result | 0); +}; + +/** + * @param {!number} position + * @param {!number} length + * @return {!string} + */ +Oktavia.prototype._getSubstring$II = function (position, length) { + /** @type {!string} */ + var result; + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var i; + result = this._fmindex.getSubstring$II(position, length); + str = [ ]; + for (i = 0; i < result.length; i++) { + str.push(this._compressCode2utf16[result.charCodeAt(i)]); + } + return str.join(''); +}; + +/** + * class Binary extends Object + * @constructor + */ +function Binary() { +} + +/** + * @constructor + */ +function Binary$() { +}; + +Binary$.prototype = new Binary; + +/** + * @param {!number} num + * @return {!string} + */ +Binary.dump32bitNumber$N = function (num) { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ String.fromCharCode(Math.floor(num / 65536)) ]; + result.push(String.fromCharCode(num % 65536)); + return result.join(""); +}; + +var Binary$dump32bitNumber$N = Binary.dump32bitNumber$N; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {!number} + */ +Binary.load32bitNumber$SI = function (buffer, offset) { + /** @type {!number} */ + var result; + result = buffer.charCodeAt(offset) * 65536 + buffer.charCodeAt(offset + 1); + return result; +}; + +var Binary$load32bitNumber$SI = Binary.load32bitNumber$SI; + +/** + * @param {!number} num + * @return {!string} + */ +Binary.dump16bitNumber$I = function (num) { + return String.fromCharCode(num % 65536); +}; + +var Binary$dump16bitNumber$I = Binary.dump16bitNumber$I; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {!number} + */ +Binary.load16bitNumber$SI = function (buffer, offset) { + return (buffer.charCodeAt(offset) | 0); +}; + +var Binary$load16bitNumber$SI = Binary.load16bitNumber$SI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.dumpString$S = function (str) { + return Binary$dumpString$SLCompressionReport$(str, null); +}; + +var Binary$dumpString$S = Binary.dumpString$S; + +/** + * @param {!string} str + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpString$SLCompressionReport$ = function (str, report) { + /** @type {!number} */ + var length; + /** @type {!boolean} */ + var compress; + /** @type {Array.<undefined|!number>} */ + var charCodes; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {undefined|!number} */ + var bytes; + if (str.length > 32768) { + str = str.slice(0, 32768); + } + length = str.length; + compress = true; + charCodes = [ ]; + for (i = 0; i < length; i++) { + charCode = str.charCodeAt(i); + if (charCode > 255) { + compress = false; + break; + } + charCodes.push(charCode); + } + if (compress) { + result = [ Binary$dump16bitNumber$I(length + 32768) ]; + for (i = 0; i < length; i += 2) { + bytes = charCodes[i]; + if (i !== length - 1) { + bytes += charCodes[i + 1] << 8; + } + result.push(String.fromCharCode(bytes % 65536)); + } + if (report) { + CompressionReport$add$LCompressionReport$II(report, length, Math.ceil(length / 2)); + } + } else { + result = [ Binary$dump16bitNumber$I(length), str ]; + if (report) { + CompressionReport$add$LCompressionReport$II(report, length, length); + } + } + return result.join(''); +}; + +var Binary$dumpString$SLCompressionReport$ = Binary.dumpString$SLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringResult} + */ +Binary.loadString$SI = function (buffer, offset) { + return new LoadedStringResult$SI(buffer, offset); +}; + +var Binary$loadString$SI = Binary.loadString$SI; + +/** + * @param {Array.<undefined|!string>} strList + * @return {!string} + */ +Binary.dumpStringList$AS = function (strList) { + return Binary$dumpStringList$ASLCompressionReport$(strList, null); +}; + +var Binary$dumpStringList$AS = Binary.dumpStringList$AS; + +/** + * @param {Array.<undefined|!string>} strList + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpStringList$ASLCompressionReport$ = function (strList, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + result = [ Binary$dump32bitNumber$N(strList.length) ]; + for (i = 0; i < strList.length; i++) { + result.push(Binary$dumpString$SLCompressionReport$(strList[i], report)); + } + return result.join(''); +}; + +var Binary$dumpStringList$ASLCompressionReport$ = Binary.dumpStringList$ASLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringListResult} + */ +Binary.loadStringList$SI = function (buffer, offset) { + return new LoadedStringListResult$SI(buffer, offset); +}; + +var Binary$loadStringList$SI = Binary.loadStringList$SI; + +/** + * @param {Object.<string, undefined|Array.<undefined|!string>>} strMap + * @return {!string} + */ +Binary.dumpStringListMap$HAS = function (strMap) { + return Binary$dumpStringListMap$HASLCompressionReport$(strMap, null); +}; + +var Binary$dumpStringListMap$HAS = Binary.dumpStringListMap$HAS; + +/** + * @param {Object.<string, undefined|Array.<undefined|!string>>} strMap + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpStringListMap$HASLCompressionReport$ = function (strMap, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + result = [ ]; + counter = 0; + for (key in strMap) { + result.push(Binary$dumpString$SLCompressionReport$(key, report)); + result.push(Binary$dumpStringList$ASLCompressionReport$(strMap[key], report)); + counter++; + } + return Binary$dump32bitNumber$N(counter) + result.join(''); +}; + +var Binary$dumpStringListMap$HASLCompressionReport$ = Binary.dumpStringListMap$HASLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringListMapResult} + */ +Binary.loadStringListMap$SI = function (buffer, offset) { + return new LoadedStringListMapResult$SI(buffer, offset); +}; + +var Binary$loadStringListMap$SI = Binary.loadStringListMap$SI; + +/** + * @param {Array.<undefined|!number>} array + * @return {!string} + */ +Binary.dump32bitNumberList$AN = function (array) { + return Binary$dump32bitNumberList$ANLCompressionReport$(array, null); +}; + +var Binary$dump32bitNumberList$AN = Binary.dump32bitNumberList$AN; + +/** + * @param {Array.<undefined|!number>} array + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dump32bitNumberList$ANLCompressionReport$ = function (array, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var index; + /** @type {!number} */ + var inputLength; + /** @type {!number} */ + var length; + /** @type {!string} */ + var resultString; + /** @type {!number} */ + var value1$0; + /** @type {!number} */ + var value2$0; + result = [ Binary$dump32bitNumber$N(array.length) ]; + index = 0; + inputLength = array.length; + while (index < inputLength) { + if (array[index] == 0) { + length = Binary$_countZero$ANI(array, index); + result.push(Binary$_zeroBlock$I(length)); + index += length; + } else { + if (Binary$_shouldZebraCode$ANI(array, index)) { + result.push(Binary$_createZebraCode$ANI(array, index)); + value1$0 = array.length; + value2$0 = index + 15; + index = (value1$0 <= value2$0 ? value1$0 : value2$0); + } else { + length = Binary$_searchDoubleZero$ANI(array, index); + result.push(Binary$_nonZeroBlock$ANII(array, index, length)); + if (length === 0) { + throw new Error(''); + } + index += length; + } + } + } + resultString = result.join(''); + if (report) { + CompressionReport$add$LCompressionReport$II(report, array.length * 2 + 2, resultString.length); + } + return resultString; +}; + +var Binary$dump32bitNumberList$ANLCompressionReport$ = Binary.dump32bitNumberList$ANLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedNumberListResult} + */ +Binary.load32bitNumberList$SI = function (buffer, offset) { + return new LoadedNumberListResult$SI(buffer, offset); +}; + +var Binary$load32bitNumberList$SI = Binary.load32bitNumberList$SI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!number} + */ +Binary._countZero$ANI = function (array, offset) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var array$len$0; + for ((i = offset, array$len$0 = array.length); i < array$len$0; i++) { + if (array[i] != 0) { + return (i - offset | 0); + } + } + return (array.length - offset | 0); +}; + +var Binary$_countZero$ANI = Binary._countZero$ANI; + +/** + * @param {!number} length + * @return {!string} + */ +Binary._zeroBlock$I = function (length) { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ ]; + while (length > 0) { + if (length > 16384) { + result.push(Binary$dump16bitNumber$I(16383)); + length -= 16384; + } else { + result.push(Binary$dump16bitNumber$I(length - 1)); + length = 0; + } + } + return result.join(''); +}; + +var Binary$_zeroBlock$I = Binary._zeroBlock$I; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!boolean} + */ +Binary._shouldZebraCode$ANI = function (array, offset) { + /** @type {!number} */ + var change; + /** @type {!boolean} */ + var isLastZero; + /** @type {!number} */ + var i; + if (array.length - offset < 16) { + return true; + } + change = 0; + isLastZero = false; + for (i = offset; i < offset + 15; i++) { + if (array[i] == 0) { + if (! isLastZero) { + isLastZero = true; + change++; + } + } else { + if (isLastZero) { + isLastZero = false; + change++; + } + } + } + return change > 2; +}; + +var Binary$_shouldZebraCode$ANI = Binary._shouldZebraCode$ANI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!number} + */ +Binary._searchDoubleZero$ANI = function (array, offset) { + /** @type {!boolean} */ + var isLastZero; + /** @type {!number} */ + var i; + /** @type {!number} */ + var array$len$0; + isLastZero = false; + for ((i = offset, array$len$0 = array.length); i < array$len$0; i++) { + if (array[i] == 0) { + if (isLastZero) { + return (i - offset - 1 | 0); + } + isLastZero = true; + } else { + isLastZero = false; + } + } + return (array.length - offset | 0); +}; + +var Binary$_searchDoubleZero$ANI = Binary._searchDoubleZero$ANI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @param {!number} length + * @return {!string} + */ +Binary._nonZeroBlock$ANII = function (array, offset, length) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var blockLength; + /** @type {!number} */ + var i; + result = [ ]; + while (length > 0) { + if (length > 16384) { + blockLength = 16384; + length -= 16384; + } else { + blockLength = length; + length = 0; + } + result.push(Binary$dump16bitNumber$I(blockLength - 1 + 0x4000)); + for (i = offset; i < offset + blockLength; i++) { + result.push(Binary$dump32bitNumber$N(array[i])); + } + offset += blockLength; + } + return result.join(''); +}; + +var Binary$_nonZeroBlock$ANII = Binary._nonZeroBlock$ANII; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!string} + */ +Binary._createZebraCode$ANI = function (array, offset) { + /** @type {!number} */ + var last; + /** @type {!number} */ + var code; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {!number} */ + var value1$0; + /** @type {!number} */ + var value2$0; + value1$0 = offset + 15; + value2$0 = array.length; + last = (value1$0 <= value2$0 ? value1$0 : value2$0); + code = 0x8000; + result = [ ]; + for (i = offset; i < last; i++) { + if (array[i] != 0) { + result.push(Binary$dump32bitNumber$N(array[i])); + code = code + (0x1 << i - offset); + } + } + return String.fromCharCode(code) + result.join(''); +}; + +var Binary$_createZebraCode$ANI = Binary._createZebraCode$ANI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.base64encode$S = function (str) { + /** @type {Array.<undefined|!string>} */ + var out; + /** @type {Array.<undefined|!number>} */ + var source; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var len; + /** @type {!number} */ + var c1; + /** @type {undefined|!number} */ + var c2; + /** @type {undefined|!number} */ + var c3; + out = [ ]; + source = [ ]; + for (i = 0; i < str.length; i++) { + code = str.charCodeAt(i); + source.push(code & 0x00ff, code >>> 8); + } + len = str.length * 2; + i = 0; + while (i < len) { + c1 = source[i++] & 0xff; + if (i === len) { + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4)); + out.push("=="); + break; + } + c2 = source[i++]; + if (i === len) { + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4 | (c2 & 0xF0) >> 4)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c2 & 0xF) << 2)); + out.push("="); + break; + } + c3 = source[i++]; + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4 | (c2 & 0xF0) >> 4)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c2 & 0xF) << 2 | (c3 & 0xC0) >> 6)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c3 & 0x3F)); + } + return out.join(''); +}; + +var Binary$base64encode$S = Binary.base64encode$S; + +/** + * @param {Array.<undefined|!number>} source + * @return {!string} + */ +Binary._mergeCharCode$AI = function (source) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + result = [ ]; + for (i = 0; i < source.length; i += 2) { + result.push(String.fromCharCode(source[i] + (source[i + 1] << 8))); + } + return result.join(''); +}; + +var Binary$_mergeCharCode$AI = Binary._mergeCharCode$AI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.base64decode$S = function (str) { + /** @type {!number} */ + var len; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!number>} */ + var out; + /** @type {undefined|!number} */ + var c1; + /** @type {undefined|!number} */ + var c2; + /** @type {!number} */ + var c3; + /** @type {!number} */ + var c4; + len = str.length; + i = 0; + out = [ ]; + while (i < len) { + do { + c1 = Binary._base64DecodeChars[str.charCodeAt(i++) & 0xff]; + } while (i < len && c1 == -1); + if (c1 == -1) { + break; + } + do { + c2 = Binary._base64DecodeChars[str.charCodeAt(i++) & 0xff]; + } while (i < len && c2 == -1); + if (c2 == -1) { + break; + } + out.push(c1 << 2 | (c2 & 0x30) >> 4); + do { + c3 = str.charCodeAt(i++) & 0xff; + if (c3 === 61) { + return Binary$_mergeCharCode$AI(out); + } + c3 = Binary._base64DecodeChars[c3]; + } while (i < len && c3 === -1); + if (c3 === -1) { + break; + } + out.push((c2 & 0XF) << 4 | (c3 & 0x3C) >> 2); + do { + c4 = str.charCodeAt(i++) & 0xff; + if (c4 === 61) { + return Binary$_mergeCharCode$AI(out); + } + c4 = (Binary._base64DecodeChars[c4] | 0); + } while (i < len && c4 === -1); + if (c4 === -1) { + break; + } + out.push((c3 & 0x03) << 6 | c4); + } + return Binary$_mergeCharCode$AI(out); +}; + +var Binary$base64decode$S = Binary.base64decode$S; + +/** + * class LoadedStringResult extends Object + * @constructor + */ +function LoadedStringResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringResult$SI(data, offset) { + /** @type {!number} */ + var strLength; + /** @type {Array.<undefined|!string>} */ + var bytes; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var offset$0; + this.result = ""; + this.offset = 0; + offset$0 = offset++; + strLength = data.charCodeAt(offset$0); + if (strLength > 32767) { + strLength = strLength - 32768; + bytes = [ ]; + for (i = 0; i < strLength; i += 2) { + code = data.charCodeAt(offset); + bytes.push(String.fromCharCode(code & 0x00ff)); + if (i !== strLength - 1) { + bytes.push(String.fromCharCode(code >>> 8)); + } + offset++; + } + this.result = bytes.join(''); + this.offset = offset; + } else { + this.result = data.slice(offset, offset + strLength); + this.offset = (offset + strLength | 0); + } +}; + +LoadedStringResult$SI.prototype = new LoadedStringResult; + +/** + * class LoadedStringListResult extends Object + * @constructor + */ +function LoadedStringListResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringListResult$SI(data, offset) { + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {!number} */ + var strLength; + /** @type {!string} */ + var resultStr; + /** @type {Array.<undefined|!string>} */ + var bytes; + /** @type {!number} */ + var j; + /** @type {!number} */ + var code; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var offset$0; + this.offset = 0; + this.result = [ ]; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + length = result$0; + offset += 2; + for (i = 0; i < length; i++) { + offset$0 = offset++; + strLength = data.charCodeAt(offset$0); + if (strLength > 32767) { + strLength = strLength - 32768; + bytes = [ ]; + for (j = 0; j < strLength; j += 2) { + code = data.charCodeAt(offset); + bytes.push(String.fromCharCode(code & 0x00ff)); + if (j !== strLength - 1) { + bytes.push(String.fromCharCode(code >>> 8)); + } + offset++; + } + resultStr = bytes.join(''); + } else { + resultStr = data.slice(offset, offset + strLength); + offset = (offset + strLength | 0); + } + this.result.push(resultStr); + } + this.offset = offset; +}; + +LoadedStringListResult$SI.prototype = new LoadedStringListResult; + +/** + * class LoadedStringListMapResult extends Object + * @constructor + */ +function LoadedStringListMapResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringListMapResult$SI(data, offset) { + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {LoadedStringResult} */ + var keyResult; + /** @type {LoadedStringListResult} */ + var valueResult; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var offset$0; + this.offset = 0; + this.result = ({ }); + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + length = result$0; + offset += 2; + for (i = 0; i < length; i++) { + keyResult = new LoadedStringResult$SI(data, offset); + offset$0 = keyResult.offset; + valueResult = new LoadedStringListResult$SI(data, offset$0); + this.result[keyResult.result] = valueResult.result; + offset = valueResult.offset; + } + this.offset = offset; +}; + +LoadedStringListMapResult$SI.prototype = new LoadedStringListMapResult; + +/** + * class LoadedNumberListResult extends Object + * @constructor + */ +function LoadedNumberListResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedNumberListResult$SI(data, offset) { + /** @type {!number} */ + var resultLength; + /** @type {!number} */ + var originalOffset; + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {!number} */ + var tag; + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var value1$0; + this.result = null; + this.offset = 0; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + resultLength = result$0; + originalOffset = offset; + offset += 2; + result = [ ]; + while (result.length < resultLength) { + tag = data.charCodeAt(offset++); + if (tag >>> 15 === 1) { + value1$0 = resultLength - result.length; + length = (value1$0 <= 15 ? value1$0 : 15); + for (i = 0; i < length; i++) { + if (tag >>> i & 0x1) { + result.push(Binary$load32bitNumber$SI(data, offset)); + offset += 2; + } else { + result.push(0); + } + } + } else { + if (tag >>> 14 === 1) { + length = tag - 0x4000 + 1; + for (i = 0; i < length; i++) { + result.push(Binary$load32bitNumber$SI(data, offset)); + offset += 2; + } + } else { + length = tag + 1; + for (i = 0; i < length; i++) { + result.push(0); + } + } + } + } + this.result = result; + this.offset = offset; +}; + +LoadedNumberListResult$SI.prototype = new LoadedNumberListResult; + +/** + * class CompressionReport extends Object + * @constructor + */ +function CompressionReport() { +} + +/** + * @constructor + */ +function CompressionReport$() { + this.source = 0; + this.result = 0; +}; + +CompressionReport$.prototype = new CompressionReport; + +/** + * @param {CompressionReport} $this + * @param {!number} source + * @param {!number} result + */ +CompressionReport.add$LCompressionReport$II = function ($this, source, result) { + $this.source += source; + $this.result += result; +}; + +var CompressionReport$add$LCompressionReport$II = CompressionReport.add$LCompressionReport$II; + +/** + * @param {CompressionReport} $this + * @return {!number} + */ +CompressionReport.rate$LCompressionReport$ = function ($this) { + return (Math.round($this.result * 100.0 / $this.source) | 0); +}; + +var CompressionReport$rate$LCompressionReport$ = CompressionReport.rate$LCompressionReport$; + +/** + * class Query extends Object + * @constructor + */ +function Query() { +} + +/** + * @constructor + */ +function Query$() { + this.word = ''; + this.or = false; + this.not = false; + this.raw = false; +}; + +Query$.prototype = new Query; + +/** + * @return {!string} + */ +Query.prototype.toString = function () { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ ]; + if (this.or) { + result.push("OR "); + } + if (this.not) { + result.push("-"); + } + if (this.raw) { + result.push('"', this.word, '"'); + } else { + result.push(this.word); + } + return result.join(''); +}; + +/** + * class QueryStringParser extends Object + * @constructor + */ +function QueryStringParser() { +} + +/** + * @constructor + */ +function QueryStringParser$() { + this.queries = [ ]; +}; + +QueryStringParser$.prototype = new QueryStringParser; + +/** + * @param {QueryStringParser} $this + * @param {!string} queryString + * @return {Array.<undefined|Query>} + */ +QueryStringParser.parse$LQueryStringParser$S = function ($this, queryString) { + /** @type {!boolean} */ + var nextOr; + /** @type {!boolean} */ + var nextNot; + /** @type {!number} */ + var currentWordStart; + /** @type {!number} */ + var status; + /** @type {RegExp} */ + var isSpace; + /** @type {!number} */ + var i; + /** @type {!string} */ + var ch; + /** @type {!string} */ + var word; + /** @type {Query} */ + var query; + nextOr = false; + nextNot = false; + currentWordStart = 0; + status = 0; + isSpace = /[\s\u3000]/; + for (i = 0; i < queryString.length; i++) { + ch = queryString.charAt(i); + switch (status) { + case 0: + if (! isSpace.test(ch)) { + if (ch === '-') { + nextNot = true; + } else { + if (ch === '"') { + currentWordStart = i + 1; + status = 2; + } else { + currentWordStart = i; + status = 1; + } + } + } else { + nextNot = false; + } + break; + case 1: + if (isSpace.test(ch)) { + word = queryString.slice(currentWordStart, i); + if (word === 'OR') { + nextOr = true; + } else { + query = new Query$(); + query.word = word; + query.or = nextOr; + query.not = nextNot; + $this.queries.push(query); + nextOr = false; + nextNot = false; + } + status = 0; + } + break; + case 2: + if (ch === '"') { + word = queryString.slice(currentWordStart, i); + query = new Query$(); + query.word = word; + query.or = nextOr; + query.not = nextNot; + query.raw = true; + $this.queries.push(query); + nextOr = false; + nextNot = false; + status = 0; + } + break; + } + } + switch (status) { + case 0: + break; + case 1: + query = new Query$(); + word = queryString.slice(currentWordStart, queryString.length); + if (word !== 'OR') { + query.word = word; + query.or = nextOr; + query.not = nextNot; + $this.queries.push(query); + } + break; + case 2: + query = new Query$(); + query.word = queryString.slice(currentWordStart, queryString.length); + query.or = nextOr; + query.not = nextNot; + query.raw = true; + $this.queries.push(query); + break; + } + return $this.queries; +}; + +var QueryStringParser$parse$LQueryStringParser$S = QueryStringParser.parse$LQueryStringParser$S; + +/** + * @param {QueryStringParser} $this + * @return {!string} + */ +QueryStringParser.highlight$LQueryStringParser$ = function ($this) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {Query} */ + var query; + result = [ ]; + for (i = 0; i < $this.queries.length; i++) { + query = $this.queries[i]; + if (! query.not) { + result.push("highlight=" + $__jsx_encodeURIComponent(query.word)); + } + } + return '?' + result.join('&'); +}; + +var QueryStringParser$highlight$LQueryStringParser$ = QueryStringParser.highlight$LQueryStringParser$; + +/** + * class Proposal extends Object + * @constructor + */ +function Proposal() { +} + +/** + * @constructor + * @param {!number} omit + * @param {!number} expect + */ +function Proposal$II(omit, expect) { + this.omit = omit; + this.expect = expect; +}; + +Proposal$II.prototype = new Proposal; + +/** + * class Position extends Object + * @constructor + */ +function Position() { +} + +/** + * @constructor + * @param {!string} word + * @param {!number} position + * @param {!boolean} stemmed + */ +function Position$SIB(word, position, stemmed) { + this.word = word; + this.position = position; + this.stemmed = stemmed; +}; + +Position$SIB.prototype = new Position; + +/** + * class SearchUnit extends Object + * @constructor + */ +function SearchUnit() { +} + +/** + * @constructor + * @param {!number} id + */ +function SearchUnit$I(id) { + this.positions = ({ }); + this.id = id; + this._size = 0; + this.score = 0; + this.startPosition = -1; +}; + +SearchUnit$I.prototype = new SearchUnit; + +/** + * @param {SearchUnit} $this + * @param {!string} word + * @param {!number} position + * @param {!boolean} stemmed + */ +SearchUnit.addPosition$LSearchUnit$SIB = function ($this, word, position, stemmed) { + /** @type {Position} */ + var positionObj; + positionObj = $this.positions[position + ""]; + if (! positionObj) { + $this._size++; + $this.positions[position + ""] = ({word: word, position: position, stemmed: stemmed}); + } else { + if (positionObj.word.length < word.length) { + positionObj.word = word; + } + positionObj.stemmed = positionObj.stemmed && stemmed; + } +}; + +var SearchUnit$addPosition$LSearchUnit$SIB = SearchUnit.addPosition$LSearchUnit$SIB; + +/** + * @param {SearchUnit} $this + * @param {!number} position + * @return {Position} + */ +SearchUnit.get$LSearchUnit$I = function ($this, position) { + return $this.positions[position + ""]; +}; + +var SearchUnit$get$LSearchUnit$I = SearchUnit.get$LSearchUnit$I; + +/** + * @param {SearchUnit} $this + * @return {!number} + */ +SearchUnit.size$LSearchUnit$ = function ($this) { + return $this._size; +}; + +var SearchUnit$size$LSearchUnit$ = SearchUnit.size$LSearchUnit$; + +/** + * @param {SearchUnit} $this + * @param {SearchUnit} rhs + */ +SearchUnit.merge$LSearchUnit$LSearchUnit$ = function ($this, rhs) { + /** @type {!string} */ + var position; + /** @type {Position} */ + var pos; + for (position in rhs.positions) { + pos = rhs.positions[position]; + SearchUnit$addPosition$LSearchUnit$SIB($this, pos.word, pos.position, pos.stemmed); + } +}; + +var SearchUnit$merge$LSearchUnit$LSearchUnit$ = SearchUnit.merge$LSearchUnit$LSearchUnit$; + +/** + * @param {SearchUnit} $this + * @return {Array.<undefined|Position>} + */ +SearchUnit.getPositions$LSearchUnit$ = function ($this) { + /** @type {Array.<undefined|Position>} */ + var result; + /** @type {!string} */ + var pos; + result = [ ]; + for (pos in $this.positions) { + result.push($this.positions[pos]); + } + result.sort((function (a, b) { + return a.position - b.position; + })); + return result; +}; + +var SearchUnit$getPositions$LSearchUnit$ = SearchUnit.getPositions$LSearchUnit$; + +/** + * class SingleResult extends Object + * @constructor + */ +function SingleResult() { +} + +/** + * @constructor + */ +function SingleResult$() { + this.units = [ ]; + this.unitIds = [ ]; + this.or = false; + this.not = false; + this.searchWord = ''; +}; + +SingleResult$.prototype = new SingleResult; + +/** + * @constructor + * @param {!string} searchWord + * @param {!boolean} or + * @param {!boolean} not + */ +function SingleResult$SBB(searchWord, or, not) { + this.units = [ ]; + this.unitIds = [ ]; + this.or = or; + this.not = not; + this.searchWord = searchWord; +}; + +SingleResult$SBB.prototype = new SingleResult; + +/** + * @param {SingleResult} $this + * @param {!number} unitId + * @return {SearchUnit} + */ +SingleResult.getSearchUnit$LSingleResult$I = function ($this, unitId) { + /** @type {!number} */ + var existing; + /** @type {SearchUnit} */ + var result; + existing = $this.unitIds.indexOf(unitId); + if (existing === -1) { + result = ({positions: ({ }), id: unitId, _size: 0, score: 0, startPosition: -1}); + $this.units.push(result); + $this.unitIds.push(unitId); + } else { + result = $this.units[existing]; + } + return result; +}; + +var SingleResult$getSearchUnit$LSingleResult$I = SingleResult.getSearchUnit$LSingleResult$I; + +/** + * @param {SingleResult} $this + * @param {SingleResult} rhs + * @return {SingleResult} + */ +SingleResult.merge$LSingleResult$LSingleResult$ = function ($this, rhs) { + /** @type {SingleResult} */ + var result; + result = ({units: [ ], unitIds: [ ], or: false, not: false, searchWord: ''}); + if (rhs.or) { + SingleResult$_orMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } else { + if (rhs.not) { + SingleResult$_notMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } else { + SingleResult$_andMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } + } + return result; +}; + +var SingleResult$merge$LSingleResult$LSingleResult$ = SingleResult.merge$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @return {!number} + */ +SingleResult.size$LSingleResult$ = function ($this) { + return ($this.units.length | 0); +}; + +var SingleResult$size$LSingleResult$ = SingleResult.size$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._andMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var lhsSection; + for (i = 0; i < $this.unitIds.length; i++) { + id = $this.unitIds[i]; + if (rhs.unitIds.indexOf(id) !== -1) { + lhsSection = $this.units[i]; + result.unitIds.push(id); + result.units.push(lhsSection); + } + } +}; + +var SingleResult$_andMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._andMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._orMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var rhsSection; + /** @type {SearchUnit} */ + var lhsSection; + /** @type {Array.<undefined|!number>} */ + var unitIds$0; + /** @type {Array.<undefined|SearchUnit>} */ + var units$0; + result.unitIds = (unitIds$0 = $this.unitIds).slice(0, unitIds$0.length); + result.units = (units$0 = $this.units).slice(0, units$0.length); + for (i = 0; i < rhs.unitIds.length; i++) { + id = rhs.unitIds[i]; + rhsSection = rhs.units[i]; + if (result.unitIds.indexOf(id) !== -1) { + lhsSection = result.units[result.unitIds.indexOf(id)]; + SearchUnit$merge$LSearchUnit$LSearchUnit$(lhsSection, rhsSection); + } else { + result.unitIds.push(id); + result.units.push(rhsSection); + } + } +}; + +var SingleResult$_orMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._orMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._notMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var lhsSection; + for (i = 0; i < $this.unitIds.length; i++) { + id = $this.unitIds[i]; + if (rhs.unitIds.indexOf(id) === -1) { + lhsSection = $this.units[i]; + result.unitIds.push(id); + result.units.push(lhsSection); + } + } +}; + +var SingleResult$_notMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._notMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * class SearchSummary extends Object + * @constructor + */ +function SearchSummary() { +} + +/** + * @constructor + */ +function SearchSummary$() { + this.sourceResults = [ ]; + this.result = null; + this.oktavia = null; +}; + +SearchSummary$.prototype = new SearchSummary; + +/** + * @constructor + * @param {Oktavia} oktavia + */ +function SearchSummary$LOktavia$(oktavia) { + this.sourceResults = [ ]; + this.result = null; + this.oktavia = oktavia; +}; + +SearchSummary$LOktavia$.prototype = new SearchSummary; + +/** + * @param {SearchSummary} $this + * @param {SingleResult} result + */ +SearchSummary.addQuery$LSearchSummary$LSingleResult$ = function ($this, result) { + $this.sourceResults.push(result); +}; + +var SearchSummary$addQuery$LSearchSummary$LSingleResult$ = SearchSummary.addQuery$LSearchSummary$LSingleResult$; + +/** + * @param {SearchSummary} $this + */ +SearchSummary.mergeResult$LSearchSummary$ = function ($this) { + $this.result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$($this, $this.sourceResults); +}; + +var SearchSummary$mergeResult$LSearchSummary$ = SearchSummary.mergeResult$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @param {Array.<undefined|SingleResult>} results + * @return {SingleResult} + */ +SearchSummary.mergeResult$LSearchSummary$ALSingleResult$ = function ($this, results) { + /** @type {SingleResult} */ + var rhs; + /** @type {!number} */ + var i; + /** @type {!number} */ + var results$len$0; + rhs = results[0]; + for ((i = 1, results$len$0 = results.length); i < results$len$0; i++) { + rhs = SingleResult$merge$LSingleResult$LSingleResult$(rhs, results[i]); + } + return rhs; +}; + +var SearchSummary$mergeResult$LSearchSummary$ALSingleResult$ = SearchSummary.mergeResult$LSearchSummary$ALSingleResult$; + +/** + * @param {SearchSummary} $this + * @return {Array.<undefined|Proposal>} + */ +SearchSummary.getProposal$LSearchSummary$ = function ($this) { + /** @type {Array.<undefined|Proposal>} */ + var proposals; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|SingleResult>} */ + var tmpSource; + /** @type {!number} */ + var j; + /** @type {SingleResult} */ + var result; + proposals = [ ]; + for (i = 0; i < $this.sourceResults.length; i++) { + tmpSource = [ ]; + for (j = 0; j < $this.sourceResults.length; j++) { + if (i !== j) { + tmpSource.push($this.sourceResults[j]); + } + } + result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$($this, tmpSource); + proposals.push(({omit: i, expect: result.units.length})); + } + proposals.sort((function (a, b) { + return b.expect - a.expect; + })); + return proposals; +}; + +var SearchSummary$getProposal$LSearchSummary$ = SearchSummary.getProposal$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @return {Array.<undefined|SearchUnit>} + */ +SearchSummary.getSortedResult$LSearchSummary$ = function ($this) { + /** @type {Array.<undefined|SearchUnit>} */ + var result; + /** @type {Array.<undefined|SearchUnit>} */ + var units$0; + result = (units$0 = $this.result.units).slice(0, units$0.length); + result.sort((function (a, b) { + return b.score - a.score; + })); + return result; +}; + +var SearchSummary$getSortedResult$LSearchSummary$ = SearchSummary.getSortedResult$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @return {!number} + */ +SearchSummary.size$LSearchSummary$ = function ($this) { + /** @type {SingleResult} */ + var this$0; + this$0 = $this.result; + return (this$0.units.length | 0); +}; + +var SearchSummary$size$LSearchSummary$ = SearchSummary.size$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @param {SingleResult} result + */ +SearchSummary.add$LSearchSummary$LSingleResult$ = function ($this, result) { + $this.sourceResults.push(result); +}; + +var SearchSummary$add$LSearchSummary$LSingleResult$ = SearchSummary.add$LSearchSummary$LSingleResult$; + +/** + * class Style extends Object + * @constructor + */ +function Style() { +} + +/** + * @constructor + * @param {!string} mode + */ +function Style$S(mode) { + this.styles = null; + this.escapeHTML = false; + switch (mode) { + case 'console': + this.styles = Style.console; + break; + case 'html': + this.styles = Style.html; + break; + case 'ignore': + this.styles = Style.ignore; + break; + default: + this.styles = Style.ignore; + break; + } + this.escapeHTML = mode === 'html'; +}; + +Style$S.prototype = new Style; + +/** + * @param {!string} source + * @return {!string} + */ +Style.prototype.convert$S = function (source) { + /** @type {_HTMLHandler} */ + var handler; + /** @type {SAXParser} */ + var parser; + handler = new _HTMLHandler$HASB(this.styles, this.escapeHTML); + parser = new SAXParser$LSAXHandler$(handler); + parser.parse$S(source); + return handler.text.join(''); +}; + +/** + * class Stemmer + * @constructor + */ +function Stemmer() { +} + +Stemmer.prototype.$__jsx_implements_Stemmer = true; + +/** + * @constructor + */ +function Stemmer$() { +}; + +Stemmer$.prototype = new Stemmer; + +/** + * class Metadata extends Object + * @constructor + */ +function Metadata() { +} + +/** + * @constructor + * @param {Oktavia} parent + */ +function Metadata$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); +}; + +Metadata$LOktavia$.prototype = new Metadata; + +/** + * @return {!number} + */ +Metadata.prototype._size$ = function () { + /** @type {BitVector} */ + var this$0; + /** @type {!number} */ + var i$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0 = _bitVector$0 = this._bitVector; + i$0 = _bitVector$0._size; + return this$0.rank$IB(i$0, true); +}; + +/** + * @param {!number} index + * @return {!string} + */ +Metadata.prototype.getContent$I = function (index) { + /** @type {!number} */ + var startPosition; + /** @type {!number} */ + var length; + if (index < 0 || this._size$() <= index) { + throw new Error("Section.getContent() : range error " + (index + "")); + } + startPosition = 0; + if (index > 0) { + startPosition = this._bitVector.select$I(index - 1) + 1; + } + length = this._bitVector.select$I(index) - startPosition + 1; + return this._parent._getSubstring$II(startPosition, length); +}; + +/** + * @param {!number} index + * @return {!number} + */ +Metadata.prototype.getStartPosition$I = function (index) { + /** @type {!number} */ + var startPosition; + if (index < 0 || this._size$() <= index) { + throw new Error("Section.getContent() : range error " + (index + "")); + } + startPosition = 0; + if (index > 0) { + startPosition = this._bitVector.select$I(index - 1) + 1; + } + return (startPosition | 0); +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Metadata.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Metadata.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + */ +Metadata.prototype._build$ = function () { + this._bitVector.build$(); +}; + +/** + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Metadata.prototype._load$SSI = function (name, data, offset) { + offset = this._bitVector.load$SI(data, offset); + this._parent._metadataLabels.push(name); + this._parent._metadatas[name] = this; + return offset; +}; + +/** + * @return {!string} + */ +Metadata.prototype._dump$ = function () { + /** @type {BitVector} */ + var this$0; + /** @type {Array.<undefined|!string>} */ + var contents$0; + this$0 = this._bitVector; + contents$0 = [ ]; + contents$0.push(Binary$dump32bitNumber$N(this$0._size)); + contents$0.push(Binary$dump32bitNumberList$AN(this$0._v)); + return contents$0.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Metadata.prototype._dump$LCompressionReport$ = function (report) { + /** @type {BitVector} */ + var this$0; + /** @type {Array.<undefined|!string>} */ + var contents$0; + this$0 = this._bitVector; + contents$0 = [ ]; + contents$0.push(Binary$dump32bitNumber$N(this$0._size)); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents$0.push(Binary$dump32bitNumberList$ANLCompressionReport$(this$0._v, report)); + return contents$0.join(''); +}; + +/** + * class Section extends Metadata + * @constructor + */ +function Section() { +} + +Section.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Section$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._names = [ ]; +}; + +Section$LOktavia$.prototype = new Section; + +/** + * @param {!string} name + */ +Section.prototype.setTail$S = function (name) { + /** @type {!number} */ + var index$0; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index$0 = this$0$0._substr.length; + this._names.push(name); + this._bitVector.set$I(index$0 - 1); +}; + +/** + * @param {!string} name + * @param {!number} index + */ +Section.prototype.setTail$SI = function (name, index) { + this._names.push(name); + this._bitVector.set$I(index - 1); +}; + +/** + * @return {!number} + */ +Section.prototype.size$ = function () { + return (this._names.length | 0); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Section.prototype.getSectionIndex$I = function (position) { + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error " + (position + "")); + } + this$0 = this._bitVector; + return this$0.rank$IB(position, true); +}; + +/** + * @param {!number} index + * @return {!string} + */ +Section.prototype.getName$I = function (index) { + if (index < 0 || this._names.length <= index) { + throw new Error("Section.getName() : range error"); + } + return this._names[index]; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Section.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var position; + /** @type {!number} */ + var index; + /** @type {SearchUnit} */ + var unit; + for (i = 0; i < positions.length; i++) { + position = positions[i]; + index = this.getSectionIndex$I(position); + unit = SingleResult$getSearchUnit$LSingleResult$I(result, index); + if (unit.startPosition < 0) { + unit.startPosition = this.getStartPosition$I(index); + } + SearchUnit$addPosition$LSearchUnit$SIB(unit, word, position - unit.startPosition, stemmed); + } +}; + +/** + * @param {!number} index + * @return {!string} + */ +Section.prototype.getInformation$I = function (index) { + return this.getName$I(index); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Section._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Section} */ + var section; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + section = new Section$LOktavia$(parent); + section._names = strs.result; + offset$0 = strs.offset; + offset$0 = section._bitVector.load$SI(data, offset$0); + section._parent._metadataLabels.push(name); + section._parent._metadatas[name] = section; + return offset$0; +}; + +var Section$_load$LOktavia$SSI = Section._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Section.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(0), Binary$dumpStringList$AS(this._names), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Section.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(0), Binary$dumpStringList$ASLCompressionReport$(this._names, report), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class Splitter extends Metadata + * @constructor + */ +function Splitter() { +} + +Splitter.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Splitter$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this.name = null; +}; + +Splitter$LOktavia$.prototype = new Splitter; + +/** + * @constructor + * @param {Oktavia} parent + * @param {!string} name + */ +function Splitter$LOktavia$S(parent, name) { + this._parent = parent; + this._bitVector = new BitVector$(); + this.name = name; +}; + +Splitter$LOktavia$S.prototype = new Splitter; + +/** + * @return {!number} + */ +Splitter.prototype.size$ = function () { + /** @type {BitVector} */ + var this$0$0; + /** @type {!number} */ + var i$0$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0$0 = _bitVector$0 = this._bitVector; + i$0$0 = _bitVector$0._size; + return this$0$0.rank$IB(i$0$0, true); +}; + +/** + */ +Splitter.prototype.split$ = function () { + /** @type {!number} */ + var index$0; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index$0 = this$0$0._substr.length; + this._bitVector.set$I(index$0 - 1); +}; + +/** + * @param {!number} index + */ +Splitter.prototype.split$I = function (index) { + this._bitVector.set$I(index - 1); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Splitter.prototype.getIndex$I = function (position) { + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error"); + } + this$0 = this._bitVector; + return this$0.rank$IB(position, true); +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Splitter.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var position; + /** @type {!number} */ + var index; + /** @type {SearchUnit} */ + var unit; + for (i = 0; i < positions.length; i++) { + position = positions[i]; + index = this.getIndex$I(position); + unit = SingleResult$getSearchUnit$LSingleResult$I(result, index); + if (unit.startPosition < 0) { + unit.startPosition = this.getStartPosition$I(index); + } + SearchUnit$addPosition$LSearchUnit$SIB(unit, word, position - unit.startPosition, stemmed); + } +}; + +/** + * @param {!number} index + * @return {!string} + */ +Splitter.prototype.getInformation$I = function (index) { + return (this.name != null ? this.name + (index + 1 + "") : ''); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Splitter._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {Splitter} */ + var section; + section = new Splitter$LOktavia$(parent); + offset = section._bitVector.load$SI(data, offset); + section._parent._metadataLabels.push(name); + section._parent._metadatas[name] = section; + return offset; +}; + +var Splitter$_load$LOktavia$SSI = Splitter._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Splitter.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(1), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Splitter.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(1), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class Table extends Metadata + * @constructor + */ +function Table() { +} + +Table.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + * @param {Array.<undefined|!string>} headers + */ +function Table$LOktavia$AS(parent, headers) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._headers = headers; + this._columnTails = new BitVector$(); +}; + +Table$LOktavia$AS.prototype = new Table; + +/** + * @return {!number} + */ +Table.prototype.rowSize$ = function () { + /** @type {BitVector} */ + var this$0$0; + /** @type {!number} */ + var i$0$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0$0 = _bitVector$0 = this._bitVector; + i$0$0 = _bitVector$0._size; + return this$0$0.rank$IB(i$0$0, true); +}; + +/** + * @return {!number} + */ +Table.prototype.columnSize$ = function () { + return (this._headers.length | 0); +}; + +/** + */ +Table.prototype.setColumnTail$ = function () { + /** @type {!number} */ + var index; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + /** @type {Oktavia} */ + var _parent$0; + this$0 = _parent$0 = this._parent; + this$0$0 = this$0._fmindex; + index = this$0$0._substr.length; + _parent$0._fmindex.push$S(Oktavia.eob); + this._columnTails.set$I(index - 1); +}; + +/** + */ +Table.prototype.setRowTail$ = function () { + /** @type {!number} */ + var index; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index = this$0$0._substr.length; + this._bitVector.set$I(index - 1); +}; + +/** + * @param {!number} position + * @return {Array.<undefined|!number>} + */ +Table.prototype.getCell$I = function (position) { + /** @type {!number} */ + var row; + /** @type {!number} */ + var currentColumn; + /** @type {!number} */ + var lastRowColumn; + /** @type {!number} */ + var startPosition; + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {BitVector} */ + var this$0; + /** @type {BitVector} */ + var this$1; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error " + (position + "")); + } + this$0 = this._bitVector; + row = this$0.rank$IB(position, true); + this$1 = this._columnTails; + currentColumn = this$1.rank$IB(position, true); + lastRowColumn = 0; + if (row > 0) { + startPosition = this._bitVector.select$I(row - 1) + 1; + lastRowColumn = this._columnTails.rank$I(startPosition); + } + result = [ row, currentColumn - lastRowColumn ]; + return result; +}; + +/** + * @param {!number} rowIndex + * @return {Object.<string, undefined|!string>} + */ +Table.prototype.getRowContent$I = function (rowIndex) { + /** @type {!string} */ + var content; + /** @type {Array.<undefined|!string>} */ + var values; + /** @type {Object.<string, undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + content = this.getContent$I(rowIndex); + values = content.split(Oktavia.eob, this._headers.length); + result = ({ }); + for (i in this._headers) { + if (i < values.length) { + result[this._headers[i]] = values[i]; + } else { + result[this._headers[i]] = ''; + } + } + return result; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Table.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Table.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + */ +Table.prototype._build$ = function () { + this._bitVector.build$(); + this._columnTails.build$(); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Table._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Table} */ + var table; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + table = new Table$LOktavia$AS(parent, strs.result); + offset$0 = strs.offset; + offset$0 = table._bitVector.load$SI(data, offset$0); + table._parent._metadataLabels.push(name); + table._parent._metadatas[name] = table; + offset = offset$0; + return table._columnTails.load$SI(data, offset$0); +}; + +var Table$_load$LOktavia$SSI = Table._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Table.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(2), Binary$dumpStringList$AS(this._headers), Metadata.prototype._dump$.call(this), this._columnTails.dump$() ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Table.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(2), Binary$dumpStringList$ASLCompressionReport$(this._headers, report), Metadata.prototype._dump$LCompressionReport$.call(this, report), this._columnTails.dump$LCompressionReport$(report) ].join(''); +}; + +/** + * class Block extends Metadata + * @constructor + */ +function Block() { +} + +Block.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Block$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._names = [ ]; + this._start = false; +}; + +Block$LOktavia$.prototype = new Block; + +/** + * @param {!string} blockName + */ +Block.prototype.startBlock$S = function (blockName) { + this.startBlock$SI(blockName, this._parent.contentSize$()); +}; + +/** + * @param {!string} blockName + * @param {!number} index + */ +Block.prototype.startBlock$SI = function (blockName, index) { + if (this._start) { + throw new Error('Splitter `' + this._names[this._names.length - 1] + '` is not closed'); + } + this._start = true; + this._names.push(blockName); + this._bitVector.set$I(index - 1); +}; + +/** + */ +Block.prototype.endBlock$ = function () { + this.endBlock$I(this._parent.contentSize$()); +}; + +/** + * @param {!number} index + */ +Block.prototype.endBlock$I = function (index) { + if (! this._start) { + throw new Error('Splitter is not started'); + } + this._start = false; + this._bitVector.set$I(index - 1); +}; + +/** + * @return {!number} + */ +Block.prototype.size$ = function () { + return (this._names.length | 0); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Block.prototype.blockIndex$I = function (position) { + /** @type {!number} */ + var result; + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._parent._fmindex.size$() - 1 <= position) { + throw new Error("Block.blockIndex() : range error " + (position + "")); + } + if (position >= this._bitVector.size$()) { + position = (this._bitVector.size$() - 1 | 0); + result = (this._bitVector.rank$I(position) + 1 | 0); + } else { + this$0 = this._bitVector; + result = this$0.rank$IB(position, true); + } + return result; +}; + +/** + * @param {!number} position + * @return {!boolean} + */ +Block.prototype.inBlock$I = function (position) { + /** @type {!number} */ + var blockIndex; + blockIndex = this.blockIndex$I(position); + return blockIndex % 2 !== 0; +}; + +/** + * @param {!number} position + * @return {!string} + */ +Block.prototype.getBlockContent$I = function (position) { + /** @type {!number} */ + var blockIndex; + /** @type {!string} */ + var result; + blockIndex = this.blockIndex$I(position); + if (blockIndex % 2 !== 0) { + result = this.getContent$I(blockIndex); + } else { + result = ''; + } + return result; +}; + +/** + * @param {!number} position + * @return {!string} + */ +Block.prototype.getBlockName$I = function (position) { + /** @type {!number} */ + var blockIndex; + /** @type {!string} */ + var result; + blockIndex = this.blockIndex$I(position); + if (blockIndex % 2 !== 0) { + result = this._names[blockIndex >>> 1]; + } else { + result = ''; + } + return result; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Block.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Block.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Block._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Block} */ + var block; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + block = new Block$LOktavia$(parent); + block._names = strs.result; + offset$0 = strs.offset; + offset$0 = block._bitVector.load$SI(data, offset$0); + block._parent._metadataLabels.push(name); + block._parent._metadatas[name] = block; + return offset$0; +}; + +var Block$_load$LOktavia$SSI = Block._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Block.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(3), Binary$dumpStringList$AS(this._names), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Block.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(3), Binary$dumpStringList$ASLCompressionReport$(this._names, report), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class FMIndex extends Object + * @constructor + */ +function FMIndex() { +} + +/** + * @constructor + */ +function FMIndex$() { + /** @type {Array.<undefined|!number>} */ + var _rlt$0; + this._ssize = 0; + (this._ddic = 0, this._head = 0); + this._substr = ""; + this._sv = new WaveletMatrix$(); + this._posdic = [ ]; + this._idic = [ ]; + _rlt$0 = this._rlt = [ ]; + _rlt$0.length = 65536; +}; + +FMIndex$.prototype = new FMIndex; + +/** + */ +FMIndex.prototype.clear$ = function () { + /** @type {WaveletMatrix} */ + var this$0; + this$0 = this._sv; + this$0._bv.length = 0; + this$0._seps.length = 0; + this$0._size = 0; + this._posdic.length = 0; + this._idic.length = 0; + this._ddic = 0; + this._head = 0; + this._substr = ""; +}; + +/** + * @return {!number} + */ +FMIndex.prototype.size$ = function () { + /** @type {WaveletMatrix} */ + var this$0; + this$0 = this._sv; + return this$0._size; +}; + +/** + * @return {!number} + */ +FMIndex.prototype.contentSize$ = function () { + return this._substr.length; +}; + +/** + * @param {!string} key + * @return {!number} + */ +FMIndex.prototype.getRows$S = function (key) { + /** @type {Array.<undefined|!number>} */ + var pos; + pos = [ ]; + return this.getRows$SAI(key, pos); +}; + +/** + * @param {!string} key + * @param {Array.<undefined|!number>} pos + * @return {!number} + */ +FMIndex.prototype.getRows$SAI = function (key, pos) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var first; + /** @type {undefined|!number} */ + var last; + /** @type {!number} */ + var c; + /** @type {Array.<undefined|!number>} */ + var _rlt$0; + i = key.length - 1; + code = key.charCodeAt(i); + first = (_rlt$0 = this._rlt)[code] + 1; + last = _rlt$0[code + 1]; + while (first <= last) { + if (i === 0) { + pos[0] = (-- first | 0); + pos[1] = -- last; + return (last - first + 1 | 0); + } + i--; + c = key.charCodeAt(i); + first = this._rlt[c] + this._sv.rank$II(first - 1, c) + 1; + last = this._rlt[c] + this._sv.rank$II(last, c); + } + return 0; +}; + +/** + * @param {!number} i + * @return {!number} + */ +FMIndex.prototype.getPosition$I = function (i) { + /** @type {!number} */ + var pos; + /** @type {!number} */ + var c; + if (i >= this.size$()) { + throw new Error("FMIndex.getPosition() : range error"); + } + pos = 0; + while (i !== this._head) { + if (i % this._ddic === 0) { + pos += this._posdic[i / this._ddic] + 1; + break; + } + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + pos++; + } + return (pos % this.size$() | 0); +}; + +/** + * @param {!number} pos + * @param {!number} len + * @return {!string} + */ +FMIndex.prototype.getSubstring$II = function (pos, len) { + /** @type {!number} */ + var pos_end; + /** @type {!number} */ + var pos_tmp; + /** @type {!number} */ + var i; + /** @type {!number} */ + var pos_idic; + /** @type {!string} */ + var substr; + /** @type {!number} */ + var c; + /** @type {!number} */ + var _ddic$0; + if (pos >= this.size$()) { + throw new Error("FMIndex.getSubstring() : range error"); + } + pos_end = Math.min(pos + len, this.size$()); + pos_tmp = this.size$() - 1; + i = this._head; + pos_idic = Math.floor((pos_end + (_ddic$0 = this._ddic) - 2) / _ddic$0); + if (pos_idic < this._idic.length) { + pos_tmp = pos_idic * this._ddic; + i = this._idic[pos_idic]; + } + substr = ""; + while (pos_tmp >= pos) { + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + if (pos_tmp < pos_end) { + substr = String.fromCharCode(c) + substr; + } + if (pos_tmp === 0) { + break; + } + pos_tmp--; + } + return substr; +}; + +/** + */ +FMIndex.prototype.build$ = function () { + this.build$SIIB(String.fromCharCode(0), 65535, 20, false); +}; + +/** + * @param {!string} end_marker + * @param {!number} ddic + * @param {!boolean} verbose + */ +FMIndex.prototype.build$SIB = function (end_marker, ddic, verbose) { + this.build$SIIB(end_marker, 65535, ddic, verbose); +}; + +/** + * @param {!string} end_marker + * @param {!number} maxChar + * @param {!number} ddic + * @param {!boolean} verbose + */ +FMIndex.prototype.build$SIIB = function (end_marker, maxChar, ddic, verbose) { + /** @type {BurrowsWheelerTransform} */ + var b; + /** @type {!string} */ + var s; + /** @type {!number} */ + var c; + /** @type {!string} */ + var str$0; + /** @type {WaveletMatrix} */ + var this$0; + /** @type {!string} */ + var _str$0; + /** @type {Array.<undefined|!number>} */ + var _suffixarray$0; + if (verbose) { + console.time("building burrows-wheeler transform"); + } + this._substr += end_marker; + b = ({_str: "", _size: 0, _head: 0, _suffixarray: [ ]}); + str$0 = this._substr; + _str$0 = b._str = str$0; + b._size = _str$0.length; + _suffixarray$0 = b._suffixarray = SAIS$make$S(str$0); + b._head = (_suffixarray$0.indexOf(0) | 0); + s = BurrowsWheelerTransform$get$LBurrowsWheelerTransform$(b); + this._ssize = s.length; + this._head = b._head; + b._str = ""; + b._size = 0; + b._head = 0; + b._suffixarray.length = 0; + this._substr = ""; + if (verbose) { + console.timeEnd("building burrows-wheeler transform"); + } + if (verbose) { + console.time("building wavelet matrix"); + } + this$0 = this._sv; + this$0._bitsize = (Math.ceil(Math.log(maxChar) / 0.6931471805599453) | 0); + if (verbose) { + console.log(" maxCharCode: ", maxChar); + console.log(" bitSize: ", this._sv.bitsize$()); + } + this._sv.build$S(s); + if (verbose) { + console.timeEnd("building wavelet matrix"); + } + if (verbose) { + console.time("caching rank less than"); + } + for (c = 0; c < maxChar; c++) { + this._rlt[c] = this._sv.rank_less_than$II(this._sv.size$(), c); + } + if (verbose) { + console.timeEnd("caching rank less than"); + } + this._ddic = ddic; + if (verbose) { + console.time("building dictionaries"); + } + this._buildDictionaries$(); + if (verbose) { + console.timeEnd("building dictionaries"); + console.log(''); + } +}; + +/** + */ +FMIndex.prototype._buildDictionaries$ = function () { + /** @type {!number} */ + var i; + /** @type {!number} */ + var pos; + /** @type {!number} */ + var c; + for (i = 0; i < this._ssize / this._ddic + 1; i++) { + this._posdic.push(0); + this._idic.push(0); + } + i = this._head; + pos = this.size$() - 1; + do { + if (i % this._ddic === 0) { + this._posdic[Math.floor(i / this._ddic)] = (pos | 0); + } + if (pos % this._ddic === 0) { + this._idic[Math.floor(pos / this._ddic)] = (i | 0); + } + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + pos--; + } while (i !== this._head); +}; + +/** + * @param {!string} doc + */ +FMIndex.prototype.push$S = function (doc) { + if (doc.length <= 0) { + throw new Error("FMIndex::push(): empty string"); + } + this._substr += doc; +}; + +/** + * @param {!string} keyword + * @return {Array.<undefined|!number>} + */ +FMIndex.prototype.search$S = function (keyword) { + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {Array.<undefined|!number>} */ + var position; + /** @type {!number} */ + var rows; + /** @type {undefined|!number} */ + var first; + /** @type {undefined|!number} */ + var last; + /** @type {undefined|!number} */ + var i; + result = [ ]; + position = [ ]; + rows = this.getRows$SAI(keyword, position); + if (rows > 0) { + first = position[0]; + last = position[1]; + for (i = first; i <= last; i++) { + result.push(this.getPosition$I(i)); + } + } + return result; +}; + +/** + * @return {!string} + */ +FMIndex.prototype.dump$ = function () { + return this.dump$B(false); +}; + +/** + * @param {!boolean} verbose + * @return {!string} + */ +FMIndex.prototype.dump$B = function (verbose) { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {CompressionReport} */ + var report; + /** @type {!number} */ + var i; + contents = [ ]; + report = ({source: 0, result: 0}); + contents.push(Binary$dump32bitNumber$N(this._ddic)); + contents.push(Binary$dump32bitNumber$N(this._ssize)); + contents.push(Binary$dump32bitNumber$N(this._head)); + CompressionReport$add$LCompressionReport$II(report, 6, 6); + contents.push(this._sv.dump$LCompressionReport$(report)); + if (verbose) { + console.log("Serializing FM-index"); + console.log(' Wavelet Matrix: ' + (contents[3].length * 2 + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + contents.push(Binary$dump32bitNumber$N(this._posdic.length)); + for (i in this._posdic) { + contents.push(Binary$dump32bitNumber$N(this._posdic[i])); + } + for (i in this._idic) { + contents.push(Binary$dump32bitNumber$N(this._idic[i])); + } + if (verbose) { + console.log(' Dictionary Cache: ' + (this._idic.length * 16 + "") + ' bytes'); + } + return contents.join(""); +}; + +/** + * @param {!string} data + * @return {!number} + */ +FMIndex.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +FMIndex.prototype.load$SI = function (data, offset) { + /** @type {!number} */ + var maxChar; + /** @type {!number} */ + var c; + /** @type {!number} */ + var size; + /** @type {!number} */ + var i; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var result$1; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._ddic = (result$0 | 0); + this._ssize = (Binary$load32bitNumber$SI(data, offset + 2) | 0); + this._head = (Binary$load32bitNumber$SI(data, offset + 4) | 0); + offset = this._sv.load$SI(data, offset + 6); + maxChar = Math.pow(2, this._sv.bitsize$()); + for (c = 0; c < maxChar; c++) { + this._rlt[c] = this._sv.rank_less_than$II(this._sv.size$(), c); + } + result$1 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + size = result$1; + offset += 2; + for (i = 0; i < size; (i++, offset += 2)) { + this._posdic.push(Binary$load32bitNumber$SI(data, offset)); + } + for (i = 0; i < size; (i++, offset += 2)) { + this._idic.push(Binary$load32bitNumber$SI(data, offset)); + } + return offset; +}; + +/** + * class Tag extends Object + * @constructor + */ +function Tag() { +} + +/** + * @constructor + * @param {!string} name + */ +function Tag$S(name) { + this.name = name; + this.attributes = ({ }); + this.isSelfClosing = false; +}; + +Tag$S.prototype = new Tag; + +/** + * class _Common extends Object + * @constructor + */ +function _Common() { +} + +/** + * @constructor + */ +function _Common$() { +}; + +_Common$.prototype = new _Common; + +/** + * class _State extends Object + * @constructor + */ +function _State() { +} + +/** + * @constructor + */ +function _State$() { +}; + +_State$.prototype = new _State; + +/** + * class SAXHandler extends Object + * @constructor + */ +function SAXHandler() { +} + +/** + * @constructor + */ +function SAXHandler$() { + this.position = 0; + this.column = 0; + this.line = 0; +}; + +SAXHandler$.prototype = new SAXHandler; + +/** + * @param {Error} error + */ +SAXHandler.prototype.onerror$LError$ = function (error) { +}; + +/** + * @param {!string} text + */ +SAXHandler.prototype.ontext$S = function (text) { +}; + +/** + * @param {!string} doctype + */ +SAXHandler.prototype.ondoctype$S = function (doctype) { +}; + +/** + * @param {!string} name + * @param {!string} body + */ +SAXHandler.prototype.onprocessinginstruction$SS = function (name, body) { +}; + +/** + * @param {!string} sgmlDecl + */ +SAXHandler.prototype.onsgmldeclaration$S = function (sgmlDecl) { +}; + +/** + * @param {!string} tagname + * @param {Object.<string, undefined|!string>} attributes + */ +SAXHandler.prototype.onopentag$SHS = function (tagname, attributes) { +}; + +/** + * @param {!string} tagname + */ +SAXHandler.prototype.onclosetag$S = function (tagname) { +}; + +/** + * @param {!string} name + * @param {!string} value + */ +SAXHandler.prototype.onattribute$SS = function (name, value) { +}; + +/** + * @param {!string} comment + */ +SAXHandler.prototype.oncomment$S = function (comment) { +}; + +/** + */ +SAXHandler.prototype.onopencdata$ = function () { +}; + +/** + * @param {!string} cdata + */ +SAXHandler.prototype.oncdata$S = function (cdata) { +}; + +/** + */ +SAXHandler.prototype.onclosecdata$ = function () { +}; + +/** + */ +SAXHandler.prototype.onend$ = function () { +}; + +/** + */ +SAXHandler.prototype.onready$ = function () { +}; + +/** + * @param {!string} script + */ +SAXHandler.prototype.onscript$S = function (script) { +}; + +/** + * class _HTMLHandler extends SAXHandler + * @constructor + */ +function _HTMLHandler() { +} + +_HTMLHandler.prototype = new SAXHandler; +/** + * @constructor + * @param {Object.<string, undefined|Array.<undefined|!string>>} styles + * @param {!boolean} escape + */ +function _HTMLHandler$HASB(styles, escape) { + this.position = 0; + this.column = 0; + this.line = 0; + this.text = [ ]; + this.escape = escape; + this.styles = styles; +}; + +_HTMLHandler$HASB.prototype = new _HTMLHandler; + +/** + * @param {!string} str + * @return {!string} + */ +_HTMLHandler.escapeHTML$S = function (str) { + return str.replace(/\n/g, "<br/>").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"); +}; + +var _HTMLHandler$escapeHTML$S = _HTMLHandler.escapeHTML$S; + +/** + * @param {!string} tagname + * @param {Object.<string, undefined|!string>} attributes + */ +_HTMLHandler.prototype.onopentag$SHS = function (tagname, attributes) { + this.text.push(this.styles[tagname][0]); +}; + +/** + * @param {!string} tagname + */ +_HTMLHandler.prototype.onclosetag$S = function (tagname) { + this.text.push(this.styles[tagname][1]); +}; + +/** + * @param {!string} text + */ +_HTMLHandler.prototype.ontext$S = function (text) { + if (this.escape) { + this.text.push(text.replace(/\n/g, "<br/>").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">")); + } else { + this.text.push(text); + } +}; + +/** + * @return {!string} + */ +_HTMLHandler.prototype.result$ = function () { + return this.text.join(''); +}; + +/** + * class SAXParser extends Object + * @constructor + */ +function SAXParser() { +} + +/** + * @constructor + * @param {SAXHandler} handler + */ +function SAXParser$LSAXHandler$(handler) { + this.q = ""; + this.c = ""; + this.bufferCheckPosition = 0; + this.looseCase = ""; + this.tags = [ ]; + this.closed = false; + this.closedRoot = false; + this.sawRoot = false; + this.tag = null; + this.error = null; + this.handler = null; + this.ENTITIES = null; + this.strict = false; + this.tagName = ""; + this.state = 0; + this.line = 0; + this.column = 0; + this.position = 0; + this.startTagPosition = 0; + this.attribName = ""; + this.attribValue = ""; + this.script = ""; + this.textNode = ""; + this.attribList = null; + this.noscript = false; + this.cdata = ""; + this.procInstBody = ""; + this.procInstName = ""; + this.doctype = ""; + this.entity = ""; + this.sgmlDecl = ""; + this.comment = ""; + this.preTags = 0; + this._init$LSAXHandler$B(handler, false); +}; + +SAXParser$LSAXHandler$.prototype = new SAXParser; + +/** + * @constructor + * @param {SAXHandler} handler + * @param {!boolean} strict + */ +function SAXParser$LSAXHandler$B(handler, strict) { + this.q = ""; + this.c = ""; + this.bufferCheckPosition = 0; + this.looseCase = ""; + this.tags = [ ]; + this.closed = false; + this.closedRoot = false; + this.sawRoot = false; + this.tag = null; + this.error = null; + this.handler = null; + this.ENTITIES = null; + this.strict = false; + this.tagName = ""; + this.state = 0; + this.line = 0; + this.column = 0; + this.position = 0; + this.startTagPosition = 0; + this.attribName = ""; + this.attribValue = ""; + this.script = ""; + this.textNode = ""; + this.attribList = null; + this.noscript = false; + this.cdata = ""; + this.procInstBody = ""; + this.procInstName = ""; + this.doctype = ""; + this.entity = ""; + this.sgmlDecl = ""; + this.comment = ""; + this.preTags = 0; + this._init$LSAXHandler$B(handler, strict); +}; + +SAXParser$LSAXHandler$B.prototype = new SAXParser; + +/** + * @param {SAXHandler} handler + * @param {!boolean} strict + */ +SAXParser.prototype._init$LSAXHandler$B = function (handler, strict) { + this.handler = handler; + this.clearBuffers$(); + this.q = ""; + this.bufferCheckPosition = 65536; + this.looseCase = 'toLowerCase'; + this.tags = [ ]; + this.closed = this.closedRoot = this.sawRoot = false; + this.tag = null; + this.error = null; + this.strict = strict; + this.noscript = strict; + this.state = 1; + this.ENTITIES = _Entities$entity_list$(); + this.attribList = [ ]; + this.noscript = false; + this.preTags = 0; +}; + +/** + * @param {!boolean} flag + */ +SAXParser.prototype.set_noscript$B = function (flag) { + this.noscript = flag; +}; + +/** + * @return {SAXParser} + */ +SAXParser.prototype.resume$ = function () { + this.error = null; + return this; +}; + +/** + * @return {SAXParser} + */ +SAXParser.prototype.close$ = function () { + return this.parse$S(''); +}; + +/** + * @param {!string} chunk + * @return {SAXParser} + */ +SAXParser.prototype.parse$S = function (chunk) { + /** @type {Char} */ + var _; + /** @type {!number} */ + var i; + /** @type {!string} */ + var c; + /** @type {!number} */ + var starti; + /** @type {!number} */ + var pad; + /** @type {!number} */ + var returnState; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$0; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$1; + /** @type {RegExp} */ + var charclass$2; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$3; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$4; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$5; + /** @type {!string} */ + var text$0; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$6; + /** @type {RegExp} */ + var charclass$7; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$8; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$9; + /** @type {RegExp} */ + var charclass$10; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$11; + /** @type {RegExp} */ + var charclass$12; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$13; + /** @type {RegExp} */ + var charclass$14; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$15; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$16; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$17; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$18; + /** @type {RegExp} */ + var charclass$19; + /** @type {RegExp} */ + var charclass$20; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$21; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$22; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$23; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$24; + /** @type {!string} */ + var comment$0; + _ = new Char$(); + if (this.error) { + throw this.error; + } + if (this.closed) { + return this.emiterror$S("Cannot write after close. Assign an onready handler."); + } + (i = 0, c = ""); + while (this.c = c = chunk.charAt(i++)) { + this.position++; + if (c === "\n") { + this.handler.line++; + this.handler.column = 0; + } else { + this.handler.column++; + } + switch (this.state) { + case 1: + if (c === "<") { + this.state = 4; + this.startTagPosition = this.position; + } else { + charclass$0 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$0, c)) { + this.strictFail$S("Non-whitespace before first tag."); + this.textNode = c; + this.state = 2; + } + } + continue; + case 2: + if (this.sawRoot && ! this.closedRoot) { + starti = i - 1; + while (c && c !== "<" && c !== "&") { + c = chunk.charAt(i++); + if (c) { + this.position++; + if (c === "\n") { + this.handler.line++; + this.handler.column = 0; + } else { + this.handler.column++; + } + } + } + this.textNode += chunk.substring(starti, i - 1); + } + if (c === "<") { + this.state = 4; + this.startTagPosition = this.position; + } else { + if (_.not$HBS(_.whitespace, c) && (! this.sawRoot || this.closedRoot)) { + this.strictFail$S("Text data outside of root node."); + } + if (c === "&") { + this.state = 3; + } else { + this.textNode += c; + } + } + continue; + case 33: + if (c === "<") { + this.state = 34; + } else { + this.script += c; + } + continue; + case 34: + if (c === "/") { + this.state = 31; + } else { + this.script += "<" + c; + this.state = 33; + } + continue; + case 4: + if (c === "!") { + this.state = 5; + this.sgmlDecl = ""; + } else { + charclass$1 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$1, c)) { + } else { + charclass$2 = _.nameStart; + if (charclass$2.test(c)) { + this.state = 21; + this.tagName = c; + } else { + if (c === "/") { + this.state = 31; + this.tagName = ""; + } else { + if (c === "?") { + this.state = 18; + this.procInstName = this.procInstBody = ""; + } else { + this.strictFail$S("Unencoded <"); + if (this.startTagPosition + 1 < this.position) { + pad = this.position - this.startTagPosition; + for (i = 0; i < pad; i++) { + c = " " + c; + } + } + this.textNode += "<" + c; + this.state = 2; + } + } + } + } + } + continue; + case 5: + if ((this.sgmlDecl + c).toUpperCase() === _.CDATA) { + this.closetext_if_exist$(); + this.state = 15; + this.sgmlDecl = ""; + this.cdata = ""; + } else { + if (this.sgmlDecl + c === "--") { + this.state = 12; + this.comment = ""; + this.sgmlDecl = ""; + } else { + if ((this.sgmlDecl + c).toUpperCase() === _.DOCTYPE) { + this.state = 7; + if (this.doctype || this.sawRoot) { + this.strictFail$S("Inappropriately located doctype declaration"); + } + this.doctype = ""; + this.sgmlDecl = ""; + } else { + if (c === ">") { + this.closetext_if_exist$(); + this.sgmlDecl = ""; + this.state = 2; + } else { + charclass$3 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$3, c)) { + this.state = 6; + this.sgmlDecl += c; + } else { + this.sgmlDecl += c; + } + } + } + } + } + continue; + case 6: + if (c === this.q) { + this.state = 5; + this.q = ""; + } + this.sgmlDecl += c; + continue; + case 7: + if (c === ">") { + this.state = 2; + this.closetext_if_exist$(); + this.doctype.trim(); + } else { + this.doctype += c; + if (c === "[") { + this.state = 9; + } else { + charclass$4 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$4, c)) { + this.state = 8; + this.q = c; + } + } + } + continue; + case 8: + this.doctype += c; + if (c === this.q) { + this.q = ""; + this.state = 7; + } + continue; + case 9: + this.doctype += c; + if (c === "]") { + this.state = 7; + } else { + charclass$5 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$5, c)) { + this.state = 10; + this.q = c; + } + } + continue; + case 10: + this.doctype += c; + if (c === this.q) { + this.state = 9; + this.q = ""; + } + continue; + case 12: + if (c === "-") { + this.state = 13; + } else { + this.comment += c; + } + continue; + case 13: + if (c === "-") { + this.state = 14; + text$0 = this.comment; + text$0 = text$0.replace(/[\n\t]/g, ' '); + text$0 = text$0.replace(/\s\s+/g, " "); + comment$0 = this.comment = text$0; + if (comment$0) { + this.closetext_if_exist$(); + this.comment.trim(); + } + this.comment = ""; + } else { + this.comment += "-" + c; + this.state = 12; + } + continue; + case 14: + if (c !== ">") { + this.strictFail$S("Malformed comment"); + this.comment += "--" + c; + this.state = 12; + } else { + this.state = 2; + } + continue; + case 15: + if (c === "]") { + this.state = 16; + } else { + this.cdata += c; + } + continue; + case 16: + if (c === "]") { + this.state = 17; + } else { + this.cdata += "]" + c; + this.state = 15; + } + continue; + case 17: + if (c === ">") { + if (this.cdata) { + this.closetext_if_exist$(); + } + this.cdata = ""; + this.state = 2; + } else { + if (c === "]") { + this.cdata += "]"; + } else { + this.cdata += "]]" + c; + this.state = 15; + } + } + continue; + case 18: + if (c === "?") { + this.state = 20; + } else { + charclass$6 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$6, c)) { + this.state = 19; + } else { + this.procInstName += c; + } + } + continue; + case 19: + if (! this.procInstBody && _.is$HBS(_.whitespace, c)) { + continue; + } else { + if (c === "?") { + this.state = 20; + } else { + this.procInstBody += c; + } + } + continue; + case 20: + if (c === ">") { + this.closetext_if_exist$(); + this.procInstName = this.procInstBody = ""; + this.state = 2; + } else { + this.procInstBody += "?" + c; + this.state = 19; + } + continue; + case 21: + charclass$7 = _.nameBody; + if (charclass$7.test(c)) { + this.tagName += c; + } else { + this.newTag$(); + if (c === ">") { + this.openTag$B(false); + } else { + if (c === "/") { + this.state = 22; + } else { + charclass$8 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$8, c)) { + this.strictFail$S("Invalid character in tag name"); + } + this.state = 23; + } + } + } + continue; + case 22: + if (c === ">") { + this.openTag$B(true); + this.closeTag$(); + } else { + this.strictFail$S("Forward-slash in opening tag not followed by >"); + this.state = 23; + } + continue; + case 23: + charclass$9 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$9, c)) { + continue; + } else { + if (c === ">") { + this.openTag$B(false); + } else { + if (c === "/") { + this.state = 22; + } else { + charclass$10 = _.nameStart; + if (charclass$10.test(c)) { + this.attribName = c; + this.attribValue = ""; + this.state = 24; + } else { + this.strictFail$S("Invalid attribute name"); + } + } + } + } + continue; + case 24: + if (c === "=") { + this.state = 26; + } else { + if (c === ">") { + this.strictFail$S("Attribute without value"); + this.attribValue = this.attribName; + this.attrib$(); + this.openTag$B(false); + } else { + charclass$11 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$11, c)) { + this.state = 25; + } else { + charclass$12 = _.nameBody; + if (charclass$12.test(c)) { + this.attribName += c; + } else { + this.strictFail$S("Invalid attribute name"); + } + } + } + } + continue; + case 25: + if (c === "=") { + this.state = 26; + } else { + charclass$13 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$13, c)) { + continue; + } else { + this.strictFail$S("Attribute without value"); + this.tag.attributes[this.attribName] = ""; + this.attribValue = ""; + this.closetext_if_exist$(); + this.attribName = ""; + if (c === ">") { + this.openTag$B(false); + } else { + charclass$14 = _.nameStart; + if (charclass$14.test(c)) { + this.attribName = c; + this.state = 24; + } else { + this.strictFail$S("Invalid attribute name"); + this.state = 23; + } + } + } + } + continue; + case 26: + charclass$15 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$15, c)) { + continue; + } else { + charclass$16 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$16, c)) { + this.q = c; + this.state = 27; + } else { + this.strictFail$S("Unquoted attribute value"); + this.state = 28; + this.attribValue = c; + } + } + continue; + case 27: + if (c !== this.q) { + if (c === "&") { + this.state = 29; + } else { + this.attribValue += c; + } + continue; + } + this.attrib$(); + this.q = ""; + this.state = 23; + continue; + case 28: + charclass$17 = _.attribEnd; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$17, c)) { + if (c === "&") { + this.state = 30; + } else { + this.attribValue += c; + } + continue; + } + this.attrib$(); + if (c === ">") { + this.openTag$B(false); + } else { + this.state = 23; + } + continue; + case 31: + if (! this.tagName) { + charclass$18 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$18, c)) { + continue; + } else { + charclass$19 = _.nameStart; + if (! charclass$19.test(c)) { + if (this.script) { + this.script += "</" + c; + this.state = 33; + } else { + this.strictFail$S("Invalid tagname in closing tag."); + } + } else { + this.tagName = c; + } + } + } else { + if (c === ">") { + this.closeTag$(); + } else { + charclass$20 = _.nameBody; + if (charclass$20.test(c)) { + this.tagName += c; + } else { + if (this.script) { + this.script += "</" + this.tagName; + this.tagName = ""; + this.state = 33; + } else { + charclass$21 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$21, c)) { + this.strictFail$S("Invalid tagname in closing tag"); + } + this.state = 32; + } + } + } + } + continue; + case 32: + charclass$22 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$22, c)) { + continue; + } + if (c === ">") { + this.closeTag$(); + } else { + this.strictFail$S("Invalid characters in closing tag"); + } + continue; + case 3: + if (c === ";") { + this.textNode += this.parseEntity$(); + this.entity = ""; + this.state = 2; + } else { + charclass$23 = _.entity; + if ($__jsx_ObjectHasOwnProperty.call(charclass$23, c)) { + this.entity += c; + } else { + this.strictFail$S("Invalid character entity"); + this.textNode += "&" + this.entity + c; + this.entity = ""; + this.state = 2; + } + } + continue; + case 29: + case 30: + if (this.state === 29) { + returnState = 27; + } else { + returnState = 28; + } + if (c === ";") { + this.attribValue += this.parseEntity$(); + this.entity = ""; + this.state = (returnState | 0); + } else { + charclass$24 = _.entity; + if ($__jsx_ObjectHasOwnProperty.call(charclass$24, c)) { + this.entity += c; + } else { + this.strictFail$S("Invalid character entity"); + this.attribValue += "&" + this.entity + c; + this.entity = ""; + this.state = (returnState | 0); + } + } + continue; + default: + throw new Error("Unknown state: " + (this.state + "")); + } + } + this.end$(); + return this; +}; + +/** + */ +SAXParser.prototype.clearBuffers$ = function () { + this.comment = ''; + this.sgmlDecl = ''; + this.textNode = ''; + this.tagName = ''; + this.doctype = ''; + this.procInstName = ''; + this.procInstBody = ''; + this.entity = ''; + this.attribName = ''; + this.attribValue = ''; + this.cdata = ''; + this.script = ''; +}; + +/** + */ +SAXParser.prototype.closetext_if_exist$ = function () { + if (this.textNode !== '') { + this.closetext$(); + } +}; + +/** + */ +SAXParser.prototype.closetext$ = function () { + /** @type {!string} */ + var text; + /** @type {!string} */ + var text$0; + if (this.preTags === 0) { + text$0 = this.textNode; + text$0 = text$0.replace(/[\n\t]/g, ' '); + text$0 = text$0.replace(/\s\s+/g, " "); + text = text$0; + if (text$0) { + this.handler.ontext$S(text); + } + } else { + if (this.textNode) { + this.handler.ontext$S(this.textNode); + } + } + this.textNode = ""; +}; + +/** + * @param {!string} text + * @return {!string} + */ +SAXParser.prototype.textopts$S = function (text) { + text = text.replace(/[\n\t]/g, ' '); + text = text.replace(/\s\s+/g, " "); + return text; +}; + +/** + * @param {!string} er + * @return {SAXParser} + */ +SAXParser.prototype.emiterror$S = function (er) { + /** @type {Error} */ + var error; + this.closetext$(); + er += "\nLine: " + (this.line + "") + "\nColumn: " + (this.column + "") + "\nChar: " + this.c; + error = new Error(er); + this.error = error; + return this; +}; + +/** + */ +SAXParser.prototype.end$ = function () { + if (! this.closedRoot) { + this.strictFail$S("Unclosed root tag"); + } + if (this.state !== 2) { + this.emiterror$S("Unexpected end"); + } + this.closetext$(); + this.c = ""; + this.closed = true; +}; + +/** + * @param {!string} message + */ +SAXParser.prototype.strictFail$S = function (message) { + if (this.strict) { + this.emiterror$S(message); + } +}; + +/** + */ +SAXParser.prototype.newTag$ = function () { + if (! this.strict) { + this.tagName = this.tagName.toLowerCase(); + } + this.tag = ({name: this.tagName, attributes: ({ }), isSelfClosing: false}); + this.attribList.length = 0; +}; + +/** + */ +SAXParser.prototype.attrib$ = function () { + if (! this.strict) { + this.attribName = this.attribName.toLowerCase(); + } + if ($__jsx_ObjectHasOwnProperty.call(this.tag.attributes, this.attribName)) { + this.attribName = this.attribValue = ""; + return; + } + this.tag.attributes[this.attribName] = this.attribValue; + this.closetext_if_exist$(); + this.attribName = this.attribValue = ""; +}; + +/** + */ +SAXParser.prototype.openTag$ = function () { + this.openTag$B(false); +}; + +/** + * @param {!boolean} selfClosing + */ +SAXParser.prototype.openTag$B = function (selfClosing) { + /** @type {Tag} */ + var tag$0; + /** @type {Tag} */ + var tag$1; + (tag$0 = this.tag).isSelfClosing = selfClosing; + this.sawRoot = true; + this.tags.push(tag$0); + this.closetext_if_exist$(); + this.handler.onopentag$SHS((tag$1 = this.tag).name, tag$1.attributes); + if (this.tag.name === 'pre') { + this.preTags++; + } + if (! selfClosing) { + if (! this.noscript && this.tagName.toLowerCase() === "script") { + this.state = 33; + } else { + this.state = 2; + } + this.tag = null; + this.tagName = ""; + } + this.attribName = this.attribValue = ""; + this.attribList.length = 0; +}; + +/** + */ +SAXParser.prototype.closeTag$ = function () { + /** @type {!number} */ + var t; + /** @type {!string} */ + var tagName; + /** @type {!string} */ + var closeTo; + /** @type {Tag} */ + var close; + /** @type {!number} */ + var s; + /** @type {Tag} */ + var tag$0; + if (! this.tagName) { + this.strictFail$S("Weird empty close tag."); + this.textNode += "</>"; + this.state = 2; + return; + } + if (this.script) { + if (this.tagName !== "script") { + this.script += "</" + this.tagName + ">"; + this.tagName = ""; + this.state = 33; + return; + } + this.closetext_if_exist$(); + this.script = ""; + } + t = this.tags.length; + tagName = this.tagName; + if (! this.strict) { + tagName = tagName.toLowerCase(); + } + closeTo = tagName; + while (t--) { + close = this.tags[t]; + if (close.name !== closeTo) { + this.strictFail$S("Unexpected close tag"); + } else { + break; + } + } + if (t < 0) { + this.strictFail$S("Unmatched closing tag: " + this.tagName); + this.textNode += "</" + this.tagName + ">"; + this.state = 2; + return; + } + this.tagName = tagName; + s = this.tags.length; + while (s-- > t) { + tag$0 = this.tag = this.tags.pop(); + this.tagName = tag$0.name; + this.closetext_if_exist$(); + this.handler.onclosetag$S(this.tagName); + if (this.tagName === 'pre') { + this.preTags--; + } + } + if (t === 0) { + this.closedRoot = true; + } + this.tagName = this.attribValue = this.attribName = ""; + this.attribList.length = 0; + this.state = 2; +}; + +/** + * @return {!string} + */ +SAXParser.prototype.parseEntity$ = function () { + /** @type {!string} */ + var entity; + /** @type {!string} */ + var entityLC; + /** @type {!number} */ + var num; + /** @type {!string} */ + var numStr; + entity = this.entity; + entityLC = entity.toLowerCase(); + num = 0; + numStr = ""; + if (this.ENTITIES[entity]) { + return this.ENTITIES[entity]; + } + if (this.ENTITIES[entityLC]) { + return this.ENTITIES[entityLC]; + } + entity = entityLC; + if (entityLC.charAt(0) === "#") { + if (entity.charAt(1) === "x") { + entity = entity.slice(2); + num = $__jsx_parseInt(entity, 16); + numStr = num.toString(16); + } else { + entity = entity.slice(1); + num = $__jsx_parseInt(entity, 10); + numStr = num.toString(10); + } + } + entity = entity.replace(/^0+/, ""); + if (numStr.toLowerCase() !== entity) { + this.strictFail$S("Invalid character entity"); + return "&" + this.entity + ";"; + } + return String.fromCharCode(num); +}; + +/** + * class Char extends Object + * @constructor + */ +function Char() { +} + +/** + * @constructor + */ +function Char$() { + this.CDATA = "[CDATA["; + this.DOCTYPE = "DOCTYPE"; + this.XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"; + this.whitespace = this._charClass$S("\r\n\t "); + this.number = this._charClass$S("0124356789"); + this.letter = this._charClass$S("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); + this.quote = this._charClass$S("'\""); + this.entity = this._charClass$S("0124356789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#"); + this.attribEnd = this._charClass$S("\r\n\t >"); + this.nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; + this.nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/; +}; + +Char$.prototype = new Char; + +/** + * @param {!string} str + * @return {Object.<string, undefined|!boolean>} + */ +Char.prototype._charClass$S = function (str) { + /** @type {Object.<string, undefined|!boolean>} */ + var result; + /** @type {!number} */ + var i; + result = ({ }); + for (i = 0; i < str.length; i++) { + result[str.slice(i, i + 1)] = true; + } + return result; +}; + +/** + * @param {RegExp} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.is$LRegExp$S = function (charclass, c) { + return charclass.test(c); +}; + +/** + * @param {Object.<string, undefined|!boolean>} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.is$HBS = function (charclass, c) { + return $__jsx_ObjectHasOwnProperty.call(charclass, c); +}; + +/** + * @param {RegExp} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.not$LRegExp$S = function (charclass, c) { + return ! charclass.test(c); +}; + +/** + * @param {Object.<string, undefined|!boolean>} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.not$HBS = function (charclass, c) { + return ! $__jsx_ObjectHasOwnProperty.call(charclass, c); +}; + +/** + * class _Entities extends Object + * @constructor + */ +function _Entities() { +} + +/** + * @constructor + */ +function _Entities$() { +}; + +_Entities$.prototype = new _Entities; + +/** + * @return {Object.<string, undefined|!string>} + */ +_Entities.entity_list$ = function () { + /** @type {Object.<string, undefined|!string>} */ + var result; + /** @type {!string} */ + var key; + /** @type {*} */ + var value; + result = ({ }); + for (key in _Entities._entities) { + value = _Entities._entities[key]; + if (typeof value === 'string') { + result[key] = value + ""; + } else { + if (typeof value === 'number') { + result[key] = String.fromCharCode(value | 0); + } + } + } + return result; +}; + +var _Entities$entity_list$ = _Entities.entity_list$; + +/** + * class BitVector extends Object + * @constructor + */ +function BitVector() { +} + +/** + * @constructor + */ +function BitVector$() { + /** @type {Array.<undefined|!number>} */ + var _v$0; + /** @type {Array.<undefined|!number>} */ + var _r$0; + _r$0 = this._r = [ ]; + _v$0 = this._v = [ ]; + _v$0.length = 0; + _r$0.length = 0; + this._size = 0; + this._size1 = 0; +}; + +BitVector$.prototype = new BitVector; + +/** + */ +BitVector.prototype.build$ = function () { + /** @type {!number} */ + var i; + this._size1 = 0; + for (i = 0; i < this._v.length; i++) { + if (i % 8 === 0) { + this._r.push(true ? this._size1 : this._size - this._size1); + } + this._size1 += this._rank32$IIB(this._v[i], 32, true); + } +}; + +/** + */ +BitVector.prototype.clear$ = function () { + this._v.length = 0; + this._r.length = 0; + this._size = 0; + this._size1 = 0; +}; + +/** + * @return {!number} + */ +BitVector.prototype.size$ = function () { + return this._size; +}; + +/** + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.size$B = function (b) { + return (b ? this._size1 : this._size - this._size1); +}; + +/** + * @param {!number} value + */ +BitVector.prototype.set$I = function (value) { + this.set$IB(value, true); +}; + +/** + * @param {!number} value + * @param {!boolean} flag + */ +BitVector.prototype.set$IB = function (value, flag) { + /** @type {!number} */ + var q; + /** @type {!number} */ + var r; + /** @type {!number} */ + var m; + if (value >= this._size) { + this._size = (value + 1 | 0); + } + q = (value / 32 | 0); + r = (value % 32 | 0); + while (q >= this._v.length) { + this._v.push(0); + } + m = 0x1 << r; + if (flag) { + this._v[q] |= m; + } else { + this._v[q] &= ~ m; + } +}; + +/** + * @param {!number} value + * @return {!boolean} + */ +BitVector.prototype.get$I = function (value) { + /** @type {!number} */ + var q; + /** @type {!number} */ + var r; + /** @type {!number} */ + var m; + if (value >= this._size) { + throw new Error("BitVector.get() : range error"); + } + q = (value / 32 | 0); + r = (value % 32 | 0); + m = 0x1 << r; + return !! (this._v[q] & m); +}; + +/** + * @param {!number} i + * @return {!number} + */ +BitVector.prototype.rank$I = function (i) { + return this.rank$IB(i, true); +}; + +/** + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.rank$IB = function (i, b) { + /** @type {!number} */ + var q_large; + /** @type {!number} */ + var q_small; + /** @type {!number} */ + var r; + /** @type {!number} */ + var rank; + /** @type {!number} */ + var begin; + /** @type {!number} */ + var j; + if (i > this._size) { + throw new Error("BitVector.rank() : range error"); + } + if (i === 0) { + return 0; + } + i--; + q_large = (Math.floor(i / 256) | 0); + q_small = (Math.floor(i / 32) | 0); + r = (Math.floor(i % 32) | 0); + rank = (this._r[q_large] | 0); + if (! b) { + rank = q_large * 256 - rank; + } + begin = q_large * 8; + for (j = begin; j < q_small; j++) { + rank += this._rank32$IIB(this._v[j], 32, b); + } + rank += this._rank32$IIB(this._v[q_small], r + 1, b); + return rank; +}; + +/** + * @param {!number} i + * @return {!number} + */ +BitVector.prototype.select$I = function (i) { + return this.select$IB(i, true); +}; + +/** + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.select$IB = function (i, b) { + /** @type {!number} */ + var left; + /** @type {!number} */ + var right; + /** @type {!number} */ + var pivot; + /** @type {undefined|!number} */ + var rank; + /** @type {!number} */ + var j; + if (i >= (b ? this._size1 : this._size - this._size1)) { + throw new Error("BitVector.select() : range error"); + } + left = 0; + right = this._r.length; + while (left < right) { + pivot = Math.floor((left + right) / 2); + rank = this._r[pivot]; + if (! b) { + rank = pivot * 256 - rank; + } + if (i < rank) { + right = pivot; + } else { + left = pivot + 1; + } + } + right--; + if (b) { + i -= (this._r[right] | 0); + } else { + i -= (right * 256 - this._r[right] | 0); + } + j = right * 8; + while (1) { + rank = this._rank32$IIB(this._v[j], 32, b); + if (i < rank) { + break; + } + j++; + i -= (rank | 0); + } + return (j * 32 + this._select32$IIB(this._v[j], i, b) | 0); +}; + +/** + * @param {!number} x + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype._rank32$IIB = function (x, i, b) { + if (! b) { + x = ~ x; + } + x <<= 32 - i; + x = ((x & 0xaaaaaaaa) >>> 1) + (x & 0x55555555); + x = ((x & 0xcccccccc) >>> 2) + (x & 0x33333333); + x = ((x & 0xf0f0f0f0) >>> 4) + (x & 0x0f0f0f0f); + x = ((x & 0xff00ff00) >>> 8) + (x & 0x00ff00ff); + x = ((x & 0xffff0000) >>> 16) + (x & 0x0000ffff); + return x; +}; + +/** + * @param {!number} x + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype._select32$IIB = function (x, i, b) { + /** @type {!number} */ + var x1; + /** @type {!number} */ + var x2; + /** @type {!number} */ + var x3; + /** @type {!number} */ + var x4; + /** @type {!number} */ + var x5; + /** @type {!number} */ + var pos; + /** @type {!number} */ + var v5; + /** @type {!number} */ + var v4; + /** @type {!number} */ + var v3; + /** @type {!number} */ + var v2; + /** @type {!number} */ + var v1; + /** @type {!number} */ + var v0; + if (! b) { + x = ~ x; + } + x1 = ((x & 0xaaaaaaaa) >>> 1) + (x & 0x55555555); + x2 = ((x1 & 0xcccccccc) >>> 2) + (x1 & 0x33333333); + x3 = ((x2 & 0xf0f0f0f0) >>> 4) + (x2 & 0x0f0f0f0f); + x4 = ((x3 & 0xff00ff00) >>> 8) + (x3 & 0x00ff00ff); + x5 = ((x4 & 0xffff0000) >>> 16) + (x4 & 0x0000ffff); + i++; + pos = 0; + v5 = x5 & 0xffffffff; + if (i > v5) { + i -= (v5 | 0); + pos += 32; + } + v4 = x4 >>> pos & 0x0000ffff; + if (i > v4) { + i -= (v4 | 0); + pos += 16; + } + v3 = x3 >>> pos & 0x000000ff; + if (i > v3) { + i -= (v3 | 0); + pos += 8; + } + v2 = x2 >>> pos & 0x0000000f; + if (i > v2) { + i -= (v2 | 0); + pos += 4; + } + v1 = x1 >>> pos & 0x00000003; + if (i > v1) { + i -= (v1 | 0); + pos += 2; + } + v0 = x >>> pos & 0x00000001; + if (i > v0) { + i -= (v0 | 0); + pos += 1; + } + return (pos | 0); +}; + +/** + * @return {!string} + */ +BitVector.prototype.dump$ = function () { + /** @type {Array.<undefined|!string>} */ + var contents; + contents = [ ]; + contents.push(Binary$dump32bitNumber$N(this._size)); + contents.push(Binary$dump32bitNumberList$AN(this._v)); + return contents.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +BitVector.prototype.dump$LCompressionReport$ = function (report) { + /** @type {Array.<undefined|!string>} */ + var contents; + contents = [ ]; + contents.push(Binary$dump32bitNumber$N(this._size)); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents.push(Binary$dump32bitNumberList$ANLCompressionReport$(this._v, report)); + return contents.join(''); +}; + +/** + * @param {!string} data + * @return {!number} + */ +BitVector.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +BitVector.prototype.load$SI = function (data, offset) { + /** @type {LoadedNumberListResult} */ + var result; + /** @type {!number} */ + var result$0; + this._v.length = 0; + this._r.length = 0; + this._size = 0; + this._size1 = 0; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._size = (result$0 | 0); + result = Binary$load32bitNumberList$SI(data, offset + 2); + this._v = result.result; + this.build$(); + return result.offset; +}; + +/** + * class WaveletMatrix extends Object + * @constructor + */ +function WaveletMatrix() { +} + +/** + * @constructor + */ +function WaveletMatrix$() { + /** @type {Array.<undefined|BitVector>} */ + var _bv$0; + /** @type {Array.<undefined|!number>} */ + var _seps$0; + this._range = ({ }); + _bv$0 = this._bv = [ ]; + _seps$0 = this._seps = [ ]; + this._bitsize = 16; + _bv$0.length = 0; + _seps$0.length = 0; + this._size = 0; +}; + +WaveletMatrix$.prototype = new WaveletMatrix; + +/** + * @return {!number} + */ +WaveletMatrix.prototype.bitsize$ = function () { + return this._bitsize; +}; + +/** + * @param {!number} charCode + */ +WaveletMatrix.prototype.setMaxCharCode$I = function (charCode) { + this._bitsize = (Math.ceil(Math.log(charCode) / 0.6931471805599453) | 0); +}; + +/** + */ +WaveletMatrix.prototype.clear$ = function () { + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; +}; + +/** + * @param {!string} v + */ +WaveletMatrix.prototype.build$S = function (v) { + /** @type {!number} */ + var size; + /** @type {!number} */ + var bitsize; + /** @type {!number} */ + var i; + /** @type {!number} */ + var depth; + /** @type {Object.<string, undefined|!number>} */ + var range_tmp; + /** @type {!number} */ + var code; + /** @type {!boolean} */ + var bit; + /** @type {!number} */ + var key; + /** @type {Object.<string, undefined|!number>} */ + var range_rev; + /** @type {!string} */ + var range_key; + /** @type {!number} */ + var value; + /** @type {!number} */ + var pos0; + /** @type {undefined|!number} */ + var pos1; + /** @type {!string} */ + var range_rev_key; + /** @type {!number} */ + var begin; + /** @type {undefined|!number} */ + var end; + /** @type {!number} */ + var num0; + /** @type {!number} */ + var num1; + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; + size = v.length; + bitsize = this._bitsize; + for (i = 0; i < bitsize; i++) { + this._bv.push(new BitVector$()); + this._seps.push(0); + } + this._size = (size | 0); + for (i = 0; i < size; i++) { + this._bv[0].set$IB(i, this._uint2bit$II(v.charCodeAt(i), 0)); + } + this._bv[0].build$(); + this._seps[0] = this._bv[0].size$B(false); + this._range["0"] = 0; + this._range["1"] = this._seps[0]; + depth = 1; + while (depth < bitsize) { + range_tmp = WaveletMatrix$_shallow_copy$HI(this._range); + for (i = 0; i < size; i++) { + code = v.charCodeAt(i); + bit = this._uint2bit$II(code, depth); + key = code >>> bitsize - depth; + this._bv[depth].set$IB(range_tmp[key + ""], bit); + range_tmp[key + ""]++; + } + this._bv[depth].build$(); + this._seps[depth] = this._bv[depth].size$B(false); + range_rev = ({ }); + for (range_key in this._range) { + value = this._range[range_key]; + if (value != range_tmp[range_key]) { + range_rev[value + ""] = range_key | 0; + } + } + this._range = ({ }); + pos0 = 0; + pos1 = this._seps[depth]; + for (range_rev_key in range_rev) { + begin = range_rev_key | 0; + value = range_rev[range_rev_key]; + end = range_tmp[value + ""]; + num0 = this._bv[depth].rank$IB(end, false) - this._bv[depth].rank$IB(begin, false); + num1 = end - begin - num0; + if (num0 > 0) { + this._range[(value << 1) + ""] = (pos0 | 0); + pos0 += num0; + } + if (num1 > 0) { + this._range[(value << 1) + 1 + ""] = pos1; + pos1 += (num1 | 0); + } + } + depth++; + } +}; + +/** + * @return {!number} + */ +WaveletMatrix.prototype.size$ = function () { + return this._size; +}; + +/** + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.size$I = function (c) { + return this.rank$II(this._size, c); +}; + +/** + * @param {!number} i + * @return {!number} + */ +WaveletMatrix.prototype.get$I = function (i) { + /** @type {!number} */ + var value; + /** @type {!number} */ + var depth; + /** @type {!boolean} */ + var bit; + if (i >= this._size) { + throw new Error("WaveletMatrix.get() : range error"); + } + value = 0; + depth = 0; + while (depth < this._bitsize) { + bit = this._bv[depth].get$I(i); + i = this._bv[depth].rank$IB(i, bit); + value <<= 1; + if (bit) { + i += this._seps[depth]; + value += 1; + } + depth++; + } + return (value | 0); +}; + +/** + * @param {!number} i + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.rank$II = function (i, c) { + /** @type {undefined|!number} */ + var begin; + /** @type {!number} */ + var end; + /** @type {!number} */ + var depth; + /** @type {!boolean} */ + var bit; + if (i > this._size) { + throw new Error("WaveletMatrix.rank(): range error"); + } + if (i === 0) { + return 0; + } + begin = this._range[c + ""]; + if (begin == null) { + return 0; + } + end = i; + depth = 0; + while (depth < this._bitsize) { + bit = this._uint2bit$II(c, depth); + end = this._bv[depth].rank$IB(end, bit); + if (bit) { + end += this._seps[depth]; + } + depth++; + } + return (end - begin | 0); +}; + +/** + * @param {!number} i + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.rank_less_than$II = function (i, c) { + /** @type {!number} */ + var begin; + /** @type {!number} */ + var end; + /** @type {!number} */ + var depth; + /** @type {!number} */ + var rlt; + /** @type {!number} */ + var rank0_begin; + /** @type {!number} */ + var rank0_end; + /** @type {Array.<undefined|!number>} */ + var _seps$0; + if (i > this._size) { + throw new Error("WaveletMatrix.rank_less_than(): range error"); + } + if (i === 0) { + return 0; + } + begin = 0; + end = i; + depth = 0; + rlt = 0; + while (depth < this._bitsize) { + rank0_begin = this._bv[depth].rank$IB(begin, false); + rank0_end = this._bv[depth].rank$IB(end, false); + if (this._uint2bit$II(c, depth)) { + rlt += rank0_end - rank0_begin; + begin += (_seps$0 = this._seps)[depth] - rank0_begin; + end += _seps$0[depth] - rank0_end; + } else { + begin = rank0_begin; + end = rank0_end; + } + depth++; + } + return (rlt | 0); +}; + +/** + * @return {!string} + */ +WaveletMatrix.prototype.dump$ = function () { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!string>} */ + var range_contents; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + contents = [ Binary$dump16bitNumber$I(this._bitsize), Binary$dump32bitNumber$N(this._size) ]; + for (i = 0; i < this._bitsize; i++) { + contents.push(this._bv[i].dump$()); + } + for (i = 0; i < this._bitsize; i++) { + contents.push(Binary$dump32bitNumber$N(this._seps[i])); + } + range_contents = [ ]; + counter = 0; + for (key in this._range) { + range_contents.push(Binary$dump32bitNumber$N(key | 0)); + range_contents.push(Binary$dump32bitNumber$N(this._range[key])); + counter++; + } + contents.push(Binary$dump32bitNumber$N(counter)); + return contents.join('') + range_contents.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +WaveletMatrix.prototype.dump$LCompressionReport$ = function (report) { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!string>} */ + var range_contents; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + contents = [ Binary$dump16bitNumber$I(this._bitsize), Binary$dump32bitNumber$N(this._size) ]; + CompressionReport$add$LCompressionReport$II(report, 3, 3); + for (i = 0; i < this._bitsize; i++) { + contents.push(this._bv[i].dump$LCompressionReport$(report)); + } + for (i = 0; i < this._bitsize; i++) { + contents.push(Binary$dump32bitNumber$N(this._seps[i])); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + } + range_contents = [ ]; + counter = 0; + for (key in this._range) { + range_contents.push(Binary$dump32bitNumber$N(key | 0)); + range_contents.push(Binary$dump32bitNumber$N(this._range[key])); + CompressionReport$add$LCompressionReport$II(report, 4, 4); + counter++; + } + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents.push(Binary$dump32bitNumber$N(counter)); + return contents.join('') + range_contents.join(''); +}; + +/** + * @param {!string} data + * @return {!number} + */ +WaveletMatrix.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +WaveletMatrix.prototype.load$SI = function (data, offset) { + /** @type {!number} */ + var i; + /** @type {BitVector} */ + var bit_vector; + /** @type {!number} */ + var range_size; + /** @type {!number} */ + var value; + /** @type {!number} */ + var offset$0; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var result$1; + /** @type {!number} */ + var result$2; + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; + offset$0 = offset++; + this._bitsize = (data.charCodeAt(offset$0) | 0); + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._size = (result$0 | 0); + offset += 2; + for (i = 0; i < this._bitsize; i++) { + bit_vector = new BitVector$(); + offset = bit_vector.load$SI(data, offset); + this._bv.push(bit_vector); + } + for (i = 0; i < this._bitsize; (i++, offset += 2)) { + this._seps.push(Binary$load32bitNumber$SI(data, offset)); + } + result$1 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + range_size = result$1; + offset += 2; + for (i = 0; i < range_size; (i++, offset += 4)) { + result$2 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + value = Binary$load32bitNumber$SI(data, offset + 2); + this._range[result$2 + ""] = (value | 0); + } + return offset; +}; + +/** + * @param {Object.<string, undefined|!number>} input + * @return {Object.<string, undefined|!number>} + */ +WaveletMatrix._shallow_copy$HI = function (input) { + /** @type {Object.<string, undefined|!number>} */ + var result; + /** @type {!string} */ + var key; + result = ({ }); + for (key in input) { + result[key] = input[key]; + } + return result; +}; + +var WaveletMatrix$_shallow_copy$HI = WaveletMatrix._shallow_copy$HI; + +/** + * @param {!number} c + * @param {!number} i + * @return {!boolean} + */ +WaveletMatrix.prototype._uint2bit$II = function (c, i) { + return (c >>> this._bitsize - 1 - i & 0x1) === 0x1; +}; + +/** + * class BurrowsWheelerTransform extends Object + * @constructor + */ +function BurrowsWheelerTransform() { +} + +/** + * @constructor + */ +function BurrowsWheelerTransform$() { + this._str = ""; + this._size = 0; + this._head = 0; + this._suffixarray = [ ]; +}; + +BurrowsWheelerTransform$.prototype = new BurrowsWheelerTransform; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!number} + */ +BurrowsWheelerTransform.size$LBurrowsWheelerTransform$ = function ($this) { + return $this._size; +}; + +var BurrowsWheelerTransform$size$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.size$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!number} + */ +BurrowsWheelerTransform.head$LBurrowsWheelerTransform$ = function ($this) { + return $this._head; +}; + +var BurrowsWheelerTransform$head$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.head$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + */ +BurrowsWheelerTransform.clear$LBurrowsWheelerTransform$ = function ($this) { + $this._str = ""; + $this._size = 0; + $this._head = 0; + $this._suffixarray.length = 0; +}; + +var BurrowsWheelerTransform$clear$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.clear$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!string} str + */ +BurrowsWheelerTransform.build$LBurrowsWheelerTransform$S = function ($this, str) { + /** @type {!string} */ + var _str$0; + /** @type {Array.<undefined|!number>} */ + var _suffixarray$0; + _str$0 = $this._str = str; + $this._size = _str$0.length; + _suffixarray$0 = $this._suffixarray = SAIS$make$S(str); + $this._head = (_suffixarray$0.indexOf(0) | 0); +}; + +var BurrowsWheelerTransform$build$LBurrowsWheelerTransform$S = BurrowsWheelerTransform.build$LBurrowsWheelerTransform$S; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!number} i + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$I = function ($this, i) { + /** @type {!number} */ + var size; + /** @type {!number} */ + var index; + size = $this._size; + if (i >= size) { + throw new Error("BurrowsWheelerTransform.get() : range error"); + } + index = ($this._suffixarray[i] + size - 1) % size; + return $this._str.charAt(index); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$I = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$I; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$ = function ($this) { + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var size; + /** @type {!number} */ + var i; + str = [ ]; + size = $this._size; + for (i = 0; i < size; i++) { + str.push(BurrowsWheelerTransform$get$LBurrowsWheelerTransform$I($this, i)); + } + return str.join(""); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!string} replace + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$S = function ($this, replace) { + /** @type {!string} */ + var result; + result = BurrowsWheelerTransform$get$LBurrowsWheelerTransform$($this); + return result.replace(BurrowsWheelerTransform.END_MARKER, replace); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$S = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$S; + +/** + * class OArray extends Object + * @constructor + */ +function OArray() { +} + +/** + * @constructor + * @param {Array.<undefined|!number>} array + */ +function OArray$AI(array) { + this.array = array; + this.offset = 0; +}; + +OArray$AI.prototype = new OArray; + +/** + * @constructor + * @param {Array.<undefined|!number>} array + * @param {!number} offset + */ +function OArray$AII(array, offset) { + this.array = array; + this.offset = offset; +}; + +OArray$AII.prototype = new OArray; + +/** + * @param {OArray} $this + * @param {!number} index + * @return {!number} + */ +OArray.get$LOArray$I = function ($this, index) { + return $this.array[index + $this.offset]; +}; + +var OArray$get$LOArray$I = OArray.get$LOArray$I; + +/** + * @param {OArray} $this + * @param {!number} index + * @param {!number} value + */ +OArray.set$LOArray$II = function ($this, index, value) { + $this.array[index + $this.offset] = value; +}; + +var OArray$set$LOArray$II = OArray.set$LOArray$II; + +/** + * @param {OArray} $this + * @param {!number} index + * @return {!boolean} + */ +OArray.isS$LOArray$I = function ($this, index) { + /** @type {Array.<undefined|!number>} */ + var array$0; + /** @type {!number} */ + var offset$0; + return (array$0 = $this.array)[index + (offset$0 = $this.offset)] < array$0[index + offset$0 + 1]; +}; + +var OArray$isS$LOArray$I = OArray.isS$LOArray$I; + +/** + * @param {OArray} $this + * @param {!number} index1 + * @param {!number} index2 + * @return {!boolean} + */ +OArray.compare$LOArray$II = function ($this, index1, index2) { + /** @type {Array.<undefined|!number>} */ + var array$0; + /** @type {!number} */ + var offset$0; + return (array$0 = $this.array)[index1 + (offset$0 = $this.offset)] == array$0[index2 + offset$0]; +}; + +var OArray$compare$LOArray$II = OArray.compare$LOArray$II; + +/** + * class SAIS extends Object + * @constructor + */ +function SAIS() { +} + +/** + * @constructor + */ +function SAIS$() { +}; + +SAIS$.prototype = new SAIS; + +/** + * @param {BitVector} t + * @param {!number} i + * @return {!boolean} + */ +SAIS._isLMS$LBitVector$I = function (t, i) { + return i > 0 && t.get$I(i) && ! t.get$I(i - 1); +}; + +var SAIS$_isLMS$LBitVector$I = SAIS._isLMS$LBitVector$I; + +/** + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._getBuckets$LOArray$AIIIB = function (s, bkt, n, K, end) { + /** @type {!number} */ + var sum; + /** @type {!number} */ + var i; + sum = 0; + for (i = 0; i <= K; i++) { + bkt[i] = 0; + } + for (i = 0; i < n; i++) { + bkt[OArray$get$LOArray$I(s, i)]++; + } + for (i = 0; i <= K; i++) { + sum += bkt[i]; + bkt[i] = ((end ? sum : sum - bkt[i]) | 0); + } +}; + +var SAIS$_getBuckets$LOArray$AIIIB = SAIS._getBuckets$LOArray$AIIIB; + +/** + * @param {BitVector} t + * @param {Array.<undefined|!number>} SA + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._induceSAl$LBitVector$AILOArray$AIIIB = function (t, SA, s, bkt, n, K, end) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var j; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, end); + for (i = 0; i < n; i++) { + j = SA[i] - 1; + if (j >= 0 && ! t.get$I(j)) { + SA[bkt[OArray$get$LOArray$I(s, j)]++] = (j | 0); + } + } +}; + +var SAIS$_induceSAl$LBitVector$AILOArray$AIIIB = SAIS._induceSAl$LBitVector$AILOArray$AIIIB; + +/** + * @param {BitVector} t + * @param {Array.<undefined|!number>} SA + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._induceSAs$LBitVector$AILOArray$AIIIB = function (t, SA, s, bkt, n, K, end) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var j; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, end); + for (i = n - 1; i >= 0; i--) { + j = SA[i] - 1; + if (j >= 0 && t.get$I(j)) { + SA[-- bkt[OArray$get$LOArray$I(s, j)]] = (j | 0); + } + } +}; + +var SAIS$_induceSAs$LBitVector$AILOArray$AIIIB = SAIS._induceSAs$LBitVector$AILOArray$AIIIB; + +/** + * @param {!string} source + * @return {Array.<undefined|!number>} + */ +SAIS.make$S = function (source) { + /** @type {Array.<undefined|!number>} */ + var charCodes; + /** @type {!number} */ + var maxCode; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {Array.<undefined|!number>} */ + var SA; + /** @type {OArray} */ + var s; + charCodes = [ ]; + charCodes.length = source.length; + maxCode = 0; + for (i = 0; i < source.length; i++) { + code = source.charCodeAt(i); + charCodes[i] = (code | 0); + maxCode = (code > maxCode ? code : maxCode); + } + SA = [ ]; + SA.length = source.length; + s = ({offset: 0, array: charCodes}); + SAIS$_make$LOArray$AIII(s, SA, source.length, maxCode); + return SA; +}; + +var SAIS$make$S = SAIS.make$S; + +/** + * @param {OArray} s + * @param {Array.<undefined|!number>} SA + * @param {!number} n + * @param {!number} K + */ +SAIS._make$LOArray$AIII = function (s, SA, n, K) { + /** @type {BitVector} */ + var t; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!number>} */ + var bkt; + /** @type {!number} */ + var n1; + /** @type {!number} */ + var name; + /** @type {!number} */ + var prev; + /** @type {undefined|!number} */ + var pos; + /** @type {!boolean} */ + var diff; + /** @type {!number} */ + var d; + /** @type {!number} */ + var j; + /** @type {Array.<undefined|!number>} */ + var SA1; + /** @type {OArray} */ + var s1; + /** @type {!number} */ + var i$0; + /** @type {!number} */ + var index$0; + t = new BitVector$(); + t.set$IB(n - 2, false); + t.set$IB(n - 1, true); + for (i = n - 3; i >= 0; i--) { + t.set$IB(i, OArray$isS$LOArray$I(s, i) || OArray$compare$LOArray$II(s, i, i + 1) && t.get$I(i + 1)); + } + bkt = [ ]; + bkt.length = K + 1; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, true); + for (i = 0; i < n; i++) { + SA[i] = -1; + } + for (i = 1; i < n; i++) { + if (SAIS$_isLMS$LBitVector$I(t, i)) { + SA[-- bkt[OArray$get$LOArray$I(s, i)]] = (i | 0); + } + } + SAIS$_induceSAl$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, false); + SAIS$_induceSAs$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, true); + n1 = 0; + for (i = 0; i < n; i++) { + i$0 = SA[i]; + if (i$0 > 0 && t.get$I(i$0) && ! t.get$I(i$0 - 1)) { + SA[n1++] = SA[i]; + } + } + for (i = n1; i < n; i++) { + SA[i] = -1; + } + name = 0; + prev = -1; + for (i = 0; i < n1; i++) { + pos = SA[i]; + diff = false; + for (d = 0; d < n; d++) { + if (prev === -1 || ! OArray$compare$LOArray$II(s, pos + d, prev + d) || t.get$I(pos + d) !== t.get$I(prev + d)) { + diff = true; + break; + } else { + if (d > 0 && (SAIS$_isLMS$LBitVector$I(t, pos + d) || SAIS$_isLMS$LBitVector$I(t, prev + d))) { + break; + } + } + } + if (diff) { + name++; + prev = pos; + } + pos = ((pos % 2 === 0 ? pos / 2 : (pos - 1) / 2) | 0); + SA[n1 + pos] = (name - 1 | 0); + } + for ((i = n - 1, j = n - 1); i >= n1; i--) { + if (SA[i] >= 0) { + SA[j--] = SA[i]; + } + } + SA1 = SA; + s1 = ({offset: n - n1, array: SA}); + if (name < n1) { + SAIS$_make$LOArray$AIII(s1, SA1, n1, name - 1); + } else { + for (i = 0; i < n1; i++) { + SA1[OArray$get$LOArray$I(s1, i)] = (i | 0); + } + } + bkt = [ ]; + bkt.length = K + 1; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, true); + for ((i = 1, j = 0); i < n; i++) { + if (SAIS$_isLMS$LBitVector$I(t, i)) { + OArray$set$LOArray$II(s1, j++, i); + } + } + for (i = 0; i < n1; i++) { + index$0 = SA1[i]; + SA1[i] = s1.array[index$0 + s1.offset]; + } + for (i = n1; i < n; i++) { + SA[i] = -1; + } + for (i = n1 - 1; i >= 0; i--) { + j = SA[i]; + SA[i] = -1; + SA[-- bkt[OArray$get$LOArray$I(s, j)]] = (j | 0); + } + SAIS$_induceSAl$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, false); + SAIS$_induceSAs$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, true); +}; + +var SAIS$_make$LOArray$AIII = SAIS._make$LOArray$AIII; + +OktaviaSearch._stemmer = null; +OktaviaSearch._instance = null; +$__jsx_lazy_init(Oktavia, "eof", function () { + return String.fromCharCode(0); +}); +$__jsx_lazy_init(Oktavia, "eob", function () { + return String.fromCharCode(1); +}); +$__jsx_lazy_init(Oktavia, "unknown", function () { + return String.fromCharCode(3); +}); +Binary._base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +$__jsx_lazy_init(Binary, "_base64DecodeChars", function () { + return [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 ]; +}); +$__jsx_lazy_init(Style, "console", function () { + return ({ 'title': [ '\x1B[32m\x1b[4m', '\x1B[39m\x1b[0m' ], 'url': [ '\x1B[34m', '\x1B[39m' ], 'hit': [ '\x1B[4m', '\x1B[0m' ], 'del': [ '\x1B[9m', '\x1B[0m' ], 'summary': [ '\x1B[90m', '\x1B[39m' ] }); +}); +$__jsx_lazy_init(Style, "html", function () { + return ({ 'title': [ '<span class="title">', '</span>' ], 'url': [ '<span class="url">', '</span>' ], 'hit': [ '<span class="hit">', '</span>' ], 'del': [ '<del>', '</del>' ], 'summary': [ '<span class="reuslt">', '</span>' ] }); +}); +$__jsx_lazy_init(Style, "ignore", function () { + return ({ 'tilte': [ '', '' ], 'url': [ '', '' ], 'hit': [ '', '' ], 'del': [ '', '' ], 'summary': [ '', '' ] }); +}); +$__jsx_lazy_init(_Common, "buffers", function () { + return [ "comment", "sgmlDecl", "textNode", "tagName", "doctype", "procInstName", "procInstBody", "entity", "attribName", "attribValue", "cdata", "script" ]; +}); +$__jsx_lazy_init(_Common, "EVENTS", function () { + return [ "text", "processinginstruction", "sgmldeclaration", "doctype", "comment", "attribute", "opentag", "closetag", "opencdata", "cdata", "clo_State.CDATA", "error", "end", "ready", "script", "opennamespace", "closenamespace" ]; +}); +_Common.MAX_BUFFER_LENGTH = 65536; +_State.BEGIN = 1; +_State.TEXT = 2; +_State.TEXT_ENTITY = 3; +_State.OPEN_WAKA = 4; +_State.SGML_DECL = 5; +_State.SGML_DECL_QUOTED = 6; +_State.DOCTYPE = 7; +_State.DOCTYPE_QUOTED = 8; +_State.DOCTYPE_DTD = 9; +_State.DOCTYPE_DTD_QUOTED = 10; +_State.COMMENT_STARTING = 11; +_State.COMMENT = 12; +_State.COMMENT_ENDING = 13; +_State.COMMENT_ENDED = 14; +_State.CDATA = 15; +_State.CDATA_ENDING = 16; +_State.CDATA_ENDING_2 = 17; +_State.PROC_INST = 18; +_State.PROC_INST_BODY = 19; +_State.PROC_INST_ENDING = 20; +_State.OPEN_TAG = 21; +_State.OPEN_TAG_SLASH = 22; +_State.ATTRIB = 23; +_State.ATTRIB_NAME = 24; +_State.ATTRIB_NAME_SAW_WHITE = 25; +_State.ATTRIB_VALUE = 26; +_State.ATTRIB_VALUE_QUOTED = 27; +_State.ATTRIB_VALUE_UNQUOTED = 28; +_State.ATTRIB_VALUE_ENTITY_Q = 29; +_State.ATTRIB_VALUE_ENTITY_U = 30; +_State.CLOSE_TAG = 31; +_State.CLOSE_TAG_SAW_WHITE = 32; +_State.SCRIPT = 33; +_State.SCRIPT_ENDING = 34; +$__jsx_lazy_init(_Entities, "_entities", function () { + return ({ "amp": "&", "gt": ">", "lt": "<", "quot": "\"", "apos": "'", "AElig": 198, "Aacute": 193, "Acirc": 194, "Agrave": 192, "Aring": 197, "Atilde": 195, "Auml": 196, "Ccedil": 199, "ETH": 208, "Eacute": 201, "Ecirc": 202, "Egrave": 200, "Euml": 203, "Iacute": 205, "Icirc": 206, "Igrave": 204, "Iuml": 207, "Ntilde": 209, "Oacute": 211, "Ocirc": 212, "Ograve": 210, "Oslash": 216, "Otilde": 213, "Ouml": 214, "THORN": 222, "Uacute": 218, "Ucirc": 219, "Ugrave": 217, "Uuml": 220, "Yacute": 221, "aacute": 225, "acirc": 226, "aelig": 230, "agrave": 224, "aring": 229, "atilde": 227, "auml": 228, "ccedil": 231, "eacute": 233, "ecirc": 234, "egrave": 232, "eth": 240, "euml": 235, "iacute": 237, "icirc": 238, "igrave": 236, "iuml": 239, "ntilde": 241, "oacute": 243, "ocirc": 244, "ograve": 242, "oslash": 248, "otilde": 245, "ouml": 246, "szlig": 223, "thorn": 254, "uacute": 250, "ucirc": 251, "ugrave": 249, "uuml": 252, "yacute": 253, "yuml": 255, "copy": 169, "reg": 174, "nbsp": 160, "iexcl": 161, "cent": 162, "pound": 163, "curren": 164, "yen": 165, "brvbar": 166, "sect": 167, "uml": 168, "ordf": 170, "laquo": 171, "not": 172, "shy": 173, "macr": 175, "deg": 176, "plusmn": 177, "sup1": 185, "sup2": 178, "sup3": 179, "acute": 180, "micro": 181, "para": 182, "middot": 183, "cedil": 184, "ordm": 186, "raquo": 187, "frac14": 188, "frac12": 189, "frac34": 190, "iquest": 191, "times": 215, "divide": 247, "OElig": 338, "oelig": 339, "Scaron": 352, "scaron": 353, "Yuml": 376, "fnof": 402, "circ": 710, "tilde": 732, "Alpha": 913, "Beta": 914, "Gamma": 915, "Delta": 916, "Epsilon": 917, "Zeta": 918, "Eta": 919, "Theta": 920, "Iota": 921, "Kappa": 922, "Lambda": 923, "Mu": 924, "Nu": 925, "Xi": 926, "Omicron": 927, "Pi": 928, "Rho": 929, "Sigma": 931, "Tau": 932, "Upsilon": 933, "Phi": 934, "Chi": 935, "Psi": 936, "Omega": 937, "alpha": 945, "beta": 946, "gamma": 947, "delta": 948, "epsilon": 949, "zeta": 950, "eta": 951, "theta": 952, "iota": 953, "kappa": 954, "lambda": 955, "mu": 956, "nu": 957, "xi": 958, "omicron": 959, "pi": 960, "rho": 961, "sigmaf": 962, "sigma": 963, "tau": 964, "upsilon": 965, "phi": 966, "chi": 967, "psi": 968, "omega": 969, "thetasym": 977, "upsih": 978, "piv": 982, "ensp": 8194, "emsp": 8195, "thinsp": 8201, "zwnj": 8204, "zwj": 8205, "lrm": 8206, "rlm": 8207, "ndash": 8211, "mdash": 8212, "lsquo": 8216, "rsquo": 8217, "sbquo": 8218, "ldquo": 8220, "rdquo": 8221, "bdquo": 8222, "dagger": 8224, "Dagger": 8225, "bull": 8226, "hellip": 8230, "permil": 8240, "prime": 8242, "Prime": 8243, "lsaquo": 8249, "rsaquo": 8250, "oline": 8254, "frasl": 8260, "euro": 8364, "image": 8465, "weierp": 8472, "real": 8476, "trade": 8482, "alefsym": 8501, "larr": 8592, "uarr": 8593, "rarr": 8594, "darr": 8595, "harr": 8596, "crarr": 8629, "lArr": 8656, "uArr": 8657, "rArr": 8658, "dArr": 8659, "hArr": 8660, "forall": 8704, "part": 8706, "exist": 8707, "empty": 8709, "nabla": 8711, "isin": 8712, "notin": 8713, "ni": 8715, "prod": 8719, "sum": 8721, "minus": 8722, "lowast": 8727, "radic": 8730, "prop": 8733, "infin": 8734, "ang": 8736, "and": 8743, "or": 8744, "cap": 8745, "cup": 8746, "int": 8747, "there4": 8756, "sim": 8764, "cong": 8773, "asymp": 8776, "ne": 8800, "equiv": 8801, "le": 8804, "ge": 8805, "sub": 8834, "sup": 8835, "nsub": 8836, "sube": 8838, "supe": 8839, "oplus": 8853, "otimes": 8855, "perp": 8869, "sdot": 8901, "lceil": 8968, "rceil": 8969, "lfloor": 8970, "rfloor": 8971, "lang": 9001, "rang": 9002, "loz": 9674, "spades": 9824, "clubs": 9827, "hearts": 9829, "diams": 9830 }); +}); +BitVector.SMALL_BLOCK_SIZE = 32; +BitVector.LARGE_BLOCK_SIZE = 256; +BitVector.BLOCK_RATE = 8; +$__jsx_lazy_init(BurrowsWheelerTransform, "END_MARKER", function () { + return String.fromCharCode(0); +}); +var $__jsx_classMap = { + "tool/web/oktavia-search.jsx": { + _Result: _Result, + _Result$SSSI: _Result$SSSI, + _Proposal: _Proposal, + _Proposal$SSI: _Proposal$SSI, + OktaviaSearch: OktaviaSearch, + OktaviaSearch$I: OktaviaSearch$I, + _Main: _Main, + _Main$: _Main$ + }, + "src/oktavia.jsx": { + Oktavia: Oktavia, + Oktavia$: Oktavia$ + }, + "src/binary-util.jsx": { + Binary: Binary, + Binary$: Binary$, + LoadedStringResult: LoadedStringResult, + LoadedStringResult$SI: LoadedStringResult$SI, + LoadedStringListResult: LoadedStringListResult, + LoadedStringListResult$SI: LoadedStringListResult$SI, + LoadedStringListMapResult: LoadedStringListMapResult, + LoadedStringListMapResult$SI: LoadedStringListMapResult$SI, + LoadedNumberListResult: LoadedNumberListResult, + LoadedNumberListResult$SI: LoadedNumberListResult$SI, + CompressionReport: CompressionReport, + CompressionReport$: CompressionReport$ + }, + "src/query.jsx": { + Query: Query, + Query$: Query$ + }, + "src/query-string-parser.jsx": { + QueryStringParser: QueryStringParser, + QueryStringParser$: QueryStringParser$ + }, + "src/search-result.jsx": { + Proposal: Proposal, + Proposal$II: Proposal$II, + Position: Position, + Position$SIB: Position$SIB, + SearchUnit: SearchUnit, + SearchUnit$I: SearchUnit$I, + SingleResult: SingleResult, + SingleResult$: SingleResult$, + SingleResult$SBB: SingleResult$SBB, + SearchSummary: SearchSummary, + SearchSummary$: SearchSummary$, + SearchSummary$LOktavia$: SearchSummary$LOktavia$ + }, + "src/style.jsx": { + Style: Style, + Style$S: Style$S, + _HTMLHandler: _HTMLHandler, + _HTMLHandler$HASB: _HTMLHandler$HASB + }, + "src/stemmer/stemmer.jsx": { + Stemmer: Stemmer, + Stemmer$: Stemmer$ + }, + "src/metadata.jsx": { + Metadata: Metadata, + Metadata$LOktavia$: Metadata$LOktavia$, + Section: Section, + Section$LOktavia$: Section$LOktavia$, + Splitter: Splitter, + Splitter$LOktavia$: Splitter$LOktavia$, + Splitter$LOktavia$S: Splitter$LOktavia$S, + Table: Table, + Table$LOktavia$AS: Table$LOktavia$AS, + Block: Block, + Block$LOktavia$: Block$LOktavia$ + }, + "src/fm-index.jsx": { + FMIndex: FMIndex, + FMIndex$: FMIndex$ + }, + "src/sax.jsx": { + Tag: Tag, + Tag$S: Tag$S, + _Common: _Common, + _Common$: _Common$, + _State: _State, + _State$: _State$, + SAXHandler: SAXHandler, + SAXHandler$: SAXHandler$, + SAXParser: SAXParser, + SAXParser$LSAXHandler$: SAXParser$LSAXHandler$, + SAXParser$LSAXHandler$B: SAXParser$LSAXHandler$B, + Char: Char, + Char$: Char$, + _Entities: _Entities, + _Entities$: _Entities$ + }, + "src/bit-vector.jsx": { + BitVector: BitVector, + BitVector$: BitVector$ + }, + "src/wavelet-matrix.jsx": { + WaveletMatrix: WaveletMatrix, + WaveletMatrix$: WaveletMatrix$ + }, + "src/burrows-wheeler-transform.jsx": { + BurrowsWheelerTransform: BurrowsWheelerTransform, + BurrowsWheelerTransform$: BurrowsWheelerTransform$ + }, + "src/sais.jsx": { + OArray: OArray, + OArray$AI: OArray$AI, + OArray$AII: OArray$AII, + SAIS: SAIS, + SAIS$: SAIS$ + } +}; + + +/** + * launches _Main.main(:string[]):void invoked by jsx --run|--executable + */ +JSX.runMain = function (sourceFile, args) { + var module = JSX.require(sourceFile); + if (! module) { + throw new ReferenceError("entry point module not found in " + sourceFile); + } + if (! module._Main) { + throw new ReferenceError("entry point _Main not found in " + sourceFile); + } + if (! module._Main.main$AS) { + throw new ReferenceError("entry point _Main.main(:string[]):void not found in " + sourceFile); + } + module._Main.main$AS(args); +}; + +/** + * launches _Test#test*():void invoked by jsx --test + */ +JSX.runTests = function (sourceFile, tests) { + var module = JSX.require(sourceFile); + var testClass = module._Test$; + + if (!testClass) return; // skip if there's no test class + + if(tests.length === 0) { + var p = testClass.prototype; + for (var m in p) { + if (p[m] instanceof Function + && /^test.*[$]$/.test(m)) { + tests.push(m); + } + } + } + else { // set as process arguments + tests = tests.map(function (name) { + return name + "$"; // mangle for function test*():void + }); + } + + var testCase = new testClass(); + + if (testCase.beforeClass$AS != null) + testCase.beforeClass$AS(tests); + + for (var i = 0; i < tests.length; ++i) { + (function (method) { + if (method in testCase) { + testCase.run$SF$V$(method, function() { testCase[method](); }); + } + else { + throw new ReferenceError("No such test method: " + method); + } + }(tests[i])); + } + + if (testCase.afterClass$ != null) + testCase.afterClass$(); +}; +/** + * call a function on load/DOMContentLoaded + */ +function $__jsx_onload (event) { + window.removeEventListener("load", $__jsx_onload); + document.removeEventListener("DOMContentLoaded", $__jsx_onload); + JSX.runMain("tool/web/oktavia-search.jsx", []) +} + +window.addEventListener("load", $__jsx_onload); +document.addEventListener("DOMContentLoaded", $__jsx_onload); + +})(JSX); diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/searchstyle.css b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/searchstyle.css new file mode 100644 index 00000000..a3d51d43 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_static/searchstyle.css @@ -0,0 +1,174 @@ +form.oktavia_form { + position: relative; + display: block; + width: 240px; + height: 25px; +} + +input.oktavia_search { + -webkit-appearance: searchfield; + -webkit-user-select: text; + cursor: auto; + background-color: white; + color: black; + line-height: normal; + display: inline-block; + padding: 1px; + text-align: start; + margin: 2px 0px 2px 0px; + padding: 1px; +} + +div.oktavia_searchresult_box { + display: none; + position: absolute; + width: 500px; + padding: 10px; + right: 10px; + background-color: #ffffff; + -moz-border-radius: 8px; + border-radius: 8px; + -moz-box-shadow: 3px 3px 5px 5px #b5b2b2; + box-shadow: 3px 3px 5px 5px #b5b2b2; + opacity: 0.95; + z-index: 100000; +} + +div.oktavia_close_search_box { + position: absolute; + top: 10px; + right: 10px; + width: 20px; + height: 20px; + text-align: center; + vertical-align: middle; + color: #666; +} + +div.oktavia_close_search_box:hover { + background-color: #d1e8ff; + border: 1px solid gray; +} + +div.oktavia_close_search_box:active { + background-color: #b4c8db; + border: 1px solid gray; +} + + +div.oktavia_searchresult_summary { + color: #444; +} + +div.oktavia_searchresult .entry { + margin: 10px 10px 10px 10px; + color: black; +} + +div.oktavia_searchresult .entry .title { + font-size: normal; +} + +div.oktavia_searchresult .entry .title a:link { + color: #0000EE; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .title a:visited { + color: #551A8B; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .title a:hover { +} + +div.oktavia_searchresult .entry .title a:active { + color: #FF0000; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .url { + font-size: 14px!important; + color: #093; + font-style: normal; + font-family: arial,sans-serif; +} + +div.oktavia_searchresult .entry .resultcontent { + font-size: small; + font-family: arial,sans-serif; + color: #222; +} + +div.oktavia_searchresult .entry .resultcontent .hit { + font-weight: bolder; + text-decoration: underline; +} + +div.oktavia_searchresult .proposal { + margin: 10px 10px 10px 10px; + color: #222; + font-size: small; + font-family: arial,sans-serif; +} + +div.oktavia_searchresult .proposal .option { + background-color: #e8f4ff; + border-bottom: 1px solid blue; +} + +div.oktavia_searchresult .proposal .option:hover { + background-color: #d1e8ff; +} + +div.oktavia_searchresult .proposal .option:active { + background-color: #b4c8db; +} + +div.oktavia_searchresult_nav span.leader { + color: #228; +} + +div.oktavia_searchresult_nav span.page { + background-color: #ffffff; + border: 1px solid #888888; + padding: 5px; + margin: 5px; + color: #222; +} + +div.oktavia_searchresult_nav span.page:hover { + background-color: #d1e8ff; + border: 1px solid #7d98ff; +} + +div.oktavia_searchresult_nav span.page:active { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected:hover { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected:active { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_box span.pr { + position: absolute; + right: 10px; + bottom: 10px; + color: #555; +} + +.highlighted { + background-color: #fbe54e; +} diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_templates/layout.html b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_templates/layout.html new file mode 100644 index 00000000..bb36ee1f --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_templates/layout.html @@ -0,0 +1,12 @@ +{% extends "!layout.html" %} + +{% block sidebarlogo %} +{{ super() }} +<div class="sidebarRow"> + <script type="text/javascript" src="{{ pathto("_static/oktavia-search.js", 1) }}"></script> + <script type="text/javascript" src="{{ pathto("_static/oktavia-jquery-ui.js", 1) }}"></script> + <link rel="stylesheet" href="{{ pathto("_static/searchstyle.css", 1) }}" type="text/css" /> + <h3>Search by Oktavia</h3> + <div id="oktavia_search_form" data-index="search/searchindex.js"></div> +</div> +{% endblock %} diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_templates/searchbox.html b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_templates/searchbox.html new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/sphinx/_templates/searchbox.html diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/oktavia-jquery-ui.js b/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/oktavia-jquery-ui.js new file mode 100644 index 00000000..bd1efb8c --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/oktavia-jquery-ui.js @@ -0,0 +1,521 @@ +/** + * @fileOverview + * A UI script that creates search form, loads an index files and show search results. + * It needs jQuery and <tt>oktavia-search.js</tt> or <tt>oktavia-*-search.js</tt> + * (stemming library supported versions). + * @author Yoshiki Shibukawa, yoshiki@shibu.jp + */ + +(function ($) +{ + var logosrc; + /** + * @name SearchView + * @class + * Provides searching feature to your website. + * @constructor + * @param {jQeury} node Target node it has a search form and a search result window. + * @param {string} documentRoot Document root folder like '.', '../', '/' + * @param {string} index Index file path. + */ + function SearchView(node, documentRoot, index) + { + var OktaviaSearch = JSX.require("tool/web/oktavia-search.jsx").OktaviaSearch$I; + + /** + * Target node it contains a search form and a search result window. + * @type jQuery + */ + this.node = node; + /** + * Search engine core + * @type OktaviaSearch + */ + this.engine = new OktaviaSearch(5); + if (documentRoot === '') + { + /** + * Document root path + * @type string[] + */ + this.documentRoot = []; + } + else if (documentRoot.slice(-1) === '/') + { + this.documentRoot = documentRoot.slice(0, -1).split(/\//g); + } + else + { + this.documentRoot = documentRoot.split(/\//g); + } + + /** + * It is true if an index file is loaded. + * @type boolean + */ + this.initialized = false; + /** + * It is true if an user search before loading an index. + * @type boolean + */ + this.reserveSearch = false; + + var indexURL; + switch (index.charAt(0)) + { + case '.': + case '/': + indexURL = index; + break; + default: + indexURL = this.getDocumentPath(index); + break; + } + var self = this; + function loadIndex() + { + self.engine.loadIndex$S(window.searchIndex); + self.initialized = true; + window.searchIndex = null; + if (self.reserveSearch) + { + self.search(); + } + self.reserveSearch = false; + } + if (window.searchIndex) + { + loadIndex() + } + else + { + this.loadJavaScript(indexURL, loadIndex); + } + } + + /** + * Changes result page. + * @param {integer} page Page number + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.changePage = function (page) + { + this.engine.setCurrentPage$I(page); + this.updateResult(); + }; + + /** + * Clears a search form and a reult window. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.clearResult = function () + { + $('.oktavia_search', this.node).val(''); + $('.oktavia_searchresult_box', this.node).hide(); + }; + + /** + * Loads an external JavaScript file. + * + * This code is based on: http://os0x.hatenablog.com/entry/20080827/1219815828 + * @param {string} src A JavaScript source file path + * @param {function} callback It is called when the target JavaScript file is loaded + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.loadJavaScript = function (src, callback) + { + var sc = document.createElement('script'); + sc.type = 'text/javascript'; + if (window.ActiveXObject) + { + sc.onreadystatechange = function () + { + if (sc.readyState === 'complete' || sc.readyState === 'loaded') + { + callback(sc.readyState); + } + }; + } + else + { + sc.onload = function () + { + callback('onload'); + }; + } + sc.src = src; + document.body.appendChild(sc); + }; + + /** + * Updates page navigation list. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updatePageList = function () + { + var self = this; + function createCallback(i) + { + return function () { + self.changePage(i); + }; + } + + var currentPage = String(this.engine.currentPage$()); + var nav = $('.oktavia_searchresult_nav', this.node); + nav.empty(); + var pages = this.engine.pageIndexes$(); + for (var i = 0; i < pages.length; i++) + { + var pageItem = $('<span/>').text(pages[i]); + if (pages[i] === '...') + { + pageItem.addClass('leader'); + } + else + { + pageItem.addClass('page'); + if (pages[i] !== currentPage) + { + pageItem.bind('click', createCallback(Number(pages[i]))); + } + else + { + pageItem.addClass('selected'); + } + } + nav.append(pageItem); + } + }; + + /** + * Updates result list in a result window. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updateResult = function () + { + var totalPages = this.engine.totalPages$(); + var resultslot = $('.oktavia_searchresult', this.node); + resultslot.empty(); + var self = this; + function clearCallback() + { + self.clearResult(); + } + var results = this.engine.getResult$(); + var searchInput = $('.oktavia_search', this.node); + var queryWord = searchInput.val() + for (var i = 0; i < results.length; i++) + { + var result = results[i]; + var url = this.getDocumentPath(result.url.slice(1)) + var entry = $('<div/>', { "class": "entry" }); + var link = $('<a/>', { "href": url + this.engine.getHighlight$() }).text(result.title); + link.bind('click', clearCallback); + entry.append($('<div/>', { "class": "title" }).append(link)); + entry.append($('<div/>', { "class": "url" }).text(url)); + entry.append($('<div/>', { "class": "resultcontent" }).html(result.content)); + resultslot.append(entry); + } + this.updatePageList(); + }; + + /** + * Searchs again by using proposal search words. + * @param {string} option Proposal search words + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.searchProposal = function (option) + { + $('.oktavia_search', this.node).val(option); + this.search(); + }; + + /** + * Shows proposals when no result. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.updateProposal = function () + { + var nav = $('.oktavia_searchresult_nav', this.node); + var resultslot = $('.oktavia_searchresult', this.node); + nav.empty(); + resultslot.empty(); + var proposals = this.engine.getProposals$(); + var self = this; + function createCallback(option) + { + return function () + { + self.searchProposal(option); + }; + } + for (var i = 0; i < proposals.length; i++) + { + var proposal = proposals[i]; + var listitem = $('<div/>', {"class": "proposal"}); + listitem.append('<span>Search with: </span>'); + var option = $('<span/>', {"class": "option"}); + option.html(proposal.label); + option.bind('click', createCallback(proposal.options)); + listitem.append(option); + listitem.append('<span> → ' + proposal.count + ' results.</span>'); + resultslot.append(listitem); + } + }; + + /** + * Performs search and shows results. + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.search = function () + { + if (!this.initialized) + { + this.reserveSearch = true; + return; + } + var searchInput = $('.oktavia_search', this.node); + var queryWord = searchInput.val(); + searchInput.blur(); + var self = this; + this.engine.search$SF$IIV$(queryWord, function (total, pages) + { + $('.oktavia_searchresult_box', self.node).fadeIn(); + var summaryNode = $('.oktavia_searchresult_summary', self.node); + if (total === 0) + { + summaryNode.text("No result."); + self.updateProposal(); + } + else + { + summaryNode.text(total + ' results.'); + self.updateResult(); + } + }); + }; + + /** + * Converts file path in index. + * @param {string} filePath Source filepath + * @returns {string} Result filepath + * @memberOf SearchView.prototype + * @method + */ + SearchView.prototype.getDocumentPath = function (filePath) + { + var resultFilePath; + if (filePath.charAt(0) === '/') + { + resultFilePath = filePath; + } + else + { + var elements = filePath.split(/\//g); + var result = this.documentRoot.slice(); + for (var i = 0; i < elements.length; i++) + { + var element = elements[i]; + switch (element) + { + case '.': + break; + case '..': + result = result.slice(0, -1); + break; + default: + result.push(element); + break; + } + } + resultFilePath = result.join('/'); + } + return resultFilePath; + }; + + /** + * Hides all result windows. + * @function + */ + function eraseResultWindow() + { + $('.oktavia_searchresult_box:visible').hide(); + } + + /** + * jQuery plug-in to create search form and window. + * It can receive options from data attributes or an <tt>option</tt> parameter. + * @param {object} [option] Option + * @param {string} [option.index='search/searchindex.js'] Index file path. + * @param {string} [option.documentRoot='.'] Document root folder. + * @param {string} [option.logo='true'] Show logo in result windows. <tt>'false'</tt> or <tt>'disable'</tt> or falsy value disable logo. + * @name oktaviaSearch + * @function + */ + jQuery.fn.oktaviaSearch = function (option) + { + var data = { + 'index': 'search/searchindex.js', + 'documentRoot': '.', + 'logo': 'true' + }; + if (window.DOCUMENTATION_OPTIONS) // Sphinx + { + if (window.DOCUMENTATION_OPTIONS.URL_ROOT === '#') + { + data.documentRoot = ''; + } + else + { + data.documentRoot = window.DOCUMENTATION_OPTIONS.URL_ROOT; + } + } + var userData = this.data(); + var key; + for (key in userData) + { + if (userData.hasOwnProperty(key)) + { + data[key] = userData[key]; + } + } + for (key in option) + { + if (option.hasOwnProperty(key)) + { + data[key] = option[key]; + } + } + if (data.logo === 'false' || data.logo === 'disable' || !data.logo) + { + data.logo = false; + } + else + { + data.logo = true; + } + var view = new SearchView(this, data.documentRoot, data.index); + + var form = $('<form class="oktavia_form"><input class="oktavia_search" result="10" type="search" name="search" value="" placeholder="Search" /></form>'); + form.submit(function (event) { + event.stopPropagation(); + setTimeout(function () { + view.search(); + }, 10); + return false; + }); + this.append(form); + var resultForm = $([ + '<div class="oktavia_searchresult_box">', + '<div class="oktavia_close_search_box">×</div>', + '<div class="oktavia_searchresult_summary"></div>', + '<div class="oktavia_searchresult"></div>', + '<div class="oktavia_searchresult_nav"></div>', + '</div>' + ].join('')); + if (data.logo) + { + resultForm.append($('<span class="pr">Powered by <a href="http://oktavia.info"><img src="' + logosrc + '" width="86px" height="25px" alt="Oktavia"></img></a></span>')); + } + this.append(resultForm); + $('.oktavia_close_search_box', this.node).bind('click', function (event) { + view.clearResult(); + }); + + // Click outside of the result window, close it + resultForm.bind('click', function (event) { + event.stopPropagation(); + }); + }; + + /** + * Global initailization. + * It add some event handlers. + * @name initialize + * @function + */ + function initialize() + { + + function onClick() { + eraseResultWindow(); + return true; + } + function onKeyDown(event) + { + switch (event.keyCode) + { + case 191: // / : focus form + eraseResultWindow(); + var form = $('form.oktavia_form:first input.search'); + if ($(':focus', form).size() === 0) + { + form.focus(); + } + break; + case 74: // j : down + case 75: // k : up + case 72: // h : before page + case 76: // l : next page + case 13: // enter : select + var result = $('.oktavia_searchresult_box:visible:first'); + if (result.size() === 1) + { + switch (event.keyCode) + { + case 74: // j : down + console.log('down'); + break; + case 75: // k : up + console.log('up'); + break; + case 72: // h : before page + console.log('before'); + break; + case 76: // l : next page + console.log('next'); + break; + case 13: // enter : select + console.log('select'); + break; + } + } + break; + } + return true; + } + var version = $.fn.jquery.split(/\./g); + var major = Number(version[0]); + var minor = Number(version[1]); + if (major === 1 && minor < 7) + { + $(document).live('click', onClick); + $(document).live('keydown', onKeyDown); + } + else + { + $(document).on('click', onClick); + $(document).on('keydown', onKeyDown); + } + } + + var logosrc = "data:image/jpeg;base64, /9j/4AAQSkZJRgABAQEASABIAAD/4ge4SUNDX1BST0ZJTEUAAQEAAAeoYXBwbAIgAABtbnRyUkdCIFhZWiAH2QACABkACwAaAAthY3NwQVBQTAAAAABhcHBsAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWFwcGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtkZXNjAAABCAAAAG9kc2NtAAABeAAABWxjcHJ0AAAG5AAAADh3dHB0AAAHHAAAABRyWFlaAAAHMAAAABRnWFlaAAAHRAAAABRiWFlaAAAHWAAAABRyVFJDAAAHbAAAAA5jaGFkAAAHfAAAACxiVFJDAAAHbAAAAA5nVFJDAAAHbAAAAA5kZXNjAAAAAAAAABRHZW5lcmljIFJHQiBQcm9maWxlAAAAAAAAAAAAAAAUR2VuZXJpYyBSR0IgUHJvZmlsZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbWx1YwAAAAAAAAAeAAAADHNrU0sAAAAoAAABeGhySFIAAAAoAAABoGNhRVMAAAAkAAAByHB0QlIAAAAmAAAB7HVrVUEAAAAqAAACEmZyRlUAAAAoAAACPHpoVFcAAAAWAAACZGl0SVQAAAAoAAACem5iTk8AAAAmAAAComtvS1IAAAAWAAACyGNzQ1oAAAAiAAAC3mhlSUwAAAAeAAADAGRlREUAAAAsAAADHmh1SFUAAAAoAAADSnN2U0UAAAAmAAAConpoQ04AAAAWAAADcmphSlAAAAAaAAADiHJvUk8AAAAkAAADomVsR1IAAAAiAAADxnB0UE8AAAAmAAAD6G5sTkwAAAAoAAAEDmVzRVMAAAAmAAAD6HRoVEgAAAAkAAAENnRyVFIAAAAiAAAEWmZpRkkAAAAoAAAEfHBsUEwAAAAsAAAEpHJ1UlUAAAAiAAAE0GFyRUcAAAAmAAAE8mVuVVMAAAAmAAAFGGRhREsAAAAuAAAFPgBWAWEAZQBvAGIAZQBjAG4A/QAgAFIARwBCACAAcAByAG8AZgBpAGwARwBlAG4AZQByAGkBDQBrAGkAIABSAEcAQgAgAHAAcgBvAGYAaQBsAFAAZQByAGYAaQBsACAAUgBHAEIAIABnAGUAbgDoAHIAaQBjAFAAZQByAGYAaQBsACAAUgBHAEIAIABHAGUAbgDpAHIAaQBjAG8EFwQwBDMEMAQ7BEwEPQQ4BDkAIAQ/BEAEPgREBDAEOQQ7ACAAUgBHAEIAUAByAG8AZgBpAGwAIABnAOkAbgDpAHIAaQBxAHUAZQAgAFIAVgBCkBp1KAAgAFIARwBCACCCcl9pY8+P8ABQAHIAbwBmAGkAbABvACAAUgBHAEIAIABnAGUAbgBlAHIAaQBjAG8ARwBlAG4AZQByAGkAcwBrACAAUgBHAEIALQBwAHIAbwBmAGkAbMd8vBgAIABSAEcAQgAg1QS4XNMMx3wATwBiAGUAYwBuAP0AIABSAEcAQgAgAHAAcgBvAGYAaQBsBeQF6AXVBeQF2QXcACAAUgBHAEIAIAXbBdwF3AXZAEEAbABsAGcAZQBtAGUAaQBuAGUAcwAgAFIARwBCAC0AUAByAG8AZgBpAGwAwQBsAHQAYQBsAOEAbgBvAHMAIABSAEcAQgAgAHAAcgBvAGYAaQBsZm6QGgAgAFIARwBCACBjz4/wZYdO9k4AgiwAIABSAEcAQgAgMNcw7TDVMKEwpDDrAFAAcgBvAGYAaQBsACAAUgBHAEIAIABnAGUAbgBlAHIAaQBjA5MDtQO9A7kDugPMACADwAPBA78DxgOvA7sAIABSAEcAQgBQAGUAcgBmAGkAbAAgAFIARwBCACAAZwBlAG4A6QByAGkAYwBvAEEAbABnAGUAbQBlAGUAbgAgAFIARwBCAC0AcAByAG8AZgBpAGUAbA5CDhsOIw5EDh8OJQ5MACAAUgBHAEIAIA4XDjEOSA4nDkQOGwBHAGUAbgBlAGwAIABSAEcAQgAgAFAAcgBvAGYAaQBsAGkAWQBsAGUAaQBuAGUAbgAgAFIARwBCAC0AcAByAG8AZgBpAGkAbABpAFUAbgBpAHcAZQByAHMAYQBsAG4AeQAgAHAAcgBvAGYAaQBsACAAUgBHAEIEHgQxBEkEOAQ5ACAEPwRABD4ERAQ4BDsETAAgAFIARwBCBkUGRAZBACAGKgY5BjEGSgZBACAAUgBHAEIAIAYnBkQGOQYnBkUARwBlAG4AZQByAGkAYwAgAFIARwBCACAAUAByAG8AZgBpAGwAZQBHAGUAbgBlAHIAZQBsACAAUgBHAEIALQBiAGUAcwBrAHIAaQB2AGUAbABzAGV0ZXh0AAAAAENvcHlyaWdodCAyMDA3IEFwcGxlIEluYy4sIGFsbCByaWdodHMgcmVzZXJ2ZWQuAFhZWiAAAAAAAADzUgABAAAAARbPWFlaIAAAAAAAAHRNAAA97gAAA9BYWVogAAAAAAAAWnUAAKxzAAAXNFhZWiAAAAAAAAAoGgAAFZ8AALg2Y3VydgAAAAAAAAABAc0AAHNmMzIAAAAAAAEMQgAABd7///MmAAAHkgAA/ZH///ui///9owAAA9wAAMBs/+EAgEV4aWYAAE1NACoAAAAIAAUBEgADAAAAAQABAAABGgAFAAAAAQAAAEoBGwAFAAAAAQAAAFIBKAADAAAAAQACAACHaQAEAAAAAQAAAFoAAAAAAAAASAAAAAEAAABIAAAAAQACoAIABAAAAAEAAABWoAMABAAAAAEAAAAYAAAAAP/bAEMAAgICAgIBAgICAgICAgMDBgQDAwMDBwUFBAYIBwgICAcICAkKDQsJCQwKCAgLDwsMDQ4ODg4JCxARDw4RDQ4ODv/bAEMBAgICAwMDBgQEBg4JCAkODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODv/AABEIABgAVgMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AP3571+dfjn4ofEz4+/tjeJPg38JPE+peAfh/wCE9Q/szxJ4g0namo6xqCoss9tBM6sLe2gRlEkqqXLNtXnFfooa/Lj9jvU7PwH+3T+0D8J/E00Vt4usvHOs3MfmsAbqDUbmO+tp1J6qyN5ZPZkCnqBTQG7pnwW1VP2lde8FfB74qfF3R/E3hrT459f8Val4xutRsIryVd8Nq1ncGRZlYD5zlSoPHTBufD39oH4y+F9H8Xaj8Ur2w8SxeCvES6P4+0tLBIbzSklI8m/t5IwFmt2BBwVB/PI9Z+DOtWfhn/goR+0p8P8AxDcw6f4j1XV7bxLo0dw4U3+nyWwQvHk/MI3RlbH3a+SvG/jnRdbi/bY+JOkyJc+HvF0mm+BvBoiGf+Eh1OGPy3a2H/LUBnHzLkYXNfa0KNGnmlDCxpKVOpGmndXb5knKSb1i7t2cbWtrfW/w+IjiK2WVsRKu41ISm42dlGzajFpWUlZK6le921bS36G+GPHWq61+2r4+8I/2jFdeGdO8N6Xf6fEkKja1wZdz7wNzBgq8E4Fcr8T/ANpDwX4U0bw63hzxb4P1S5vPE8Gm3zveCRLW2WULdzDacHyhwxzhSwJz0Pxp430f4ww/H74qeEvABimudH+FHhxvFdvFcvDqGoW8KSCSztJFB2STBZlL9QFwOWr2L4k+IPh1r/7Fn7MuufDG00638E3XxJ8Pw6dbQQqPsymdlkgcdQ6uCrg8lgc5r1P7EwEcVhqk1zRlyK0bJL92neWm8nqu9m7nl1MzzN4PE0oS5Jpzd5Xb1ntHXaK0v00SXU+s9e+M/wAKfDGg6NqevfEDwrpljq9st1pckt8v+lwtyssYGSyH+8Bj3rQ0v4o/DrW7Hw/daR408OajBrl09ppElveowu50Xc0SY6yBeSvXHavmb/hIr7Uv22vivD8EvhJoXirxTpP2LTPFfibxX4ke0s7aRYQ8VpawiKVgqo4ZtiopJzyea+e7PQfFGteEv2tLyxh8Op8QPAXjrTfE+nW3htX+xLfWtos00UO7DfPGJImJAJYtx2rzcNw5g6tP35ODtF6uL+NpK8VrFJyTu3qleyvp6tfPsxp1PdhGSvJaKS+FNu0no20mrJWTduZ21/Rf4l6/d6N8PWtNC8UeF/C/jLU3Nv4cfXojLb3NyqmTyjGrKzAqrZKnKj5sHGD5j4L8W6fZfC6y+M3xg+IHguN9UQjSxY6iP7G0qFiR5Fs7HNxM2DvmILNgqoVBg+X6B4vsPj9+14vjbQ5xdeB/AXgBbq0kVt0b6tq1uZCPTfDbAA9wZe1eNfCXxXp9x8Ev2UdE8N/DhfiX8Xl8F3uq6PFqet/YdL0qzM5iluZiVcNIWwi7Y2Yc4IzzyUuFaLSlVlLnjbmjdJK8aklrKyWkY3b25no2kj13xhjIUKlCjThySb5Z8rcnZwi0mtWm3L3Vvy7pSlf9C/BnxO+H3xE+2f8ACEeMNB8TPaAG6isboPJCD0LJ94A+uMUV8JaxqPjex/4KWaZ/wmlh4A8NeJrr4bXUslp4Su5pdsI1C1VPtErpGXcndtwgAAPWisswyGlTlB0p6SSfR2+asntvZHDg+Iq/LKNan7ybV1dX+Tu16XZyPjX4k/tYftcfF/xR8Kvgh4b1/wDZ7+EOkanc6R4p8f8AiK2e31O6khkMcsVqqsGUHBwIW3FWy00BG1vWrX/gnT8EtJ+DfhvS/Dmq+NfDPxL0dnmT4m6dfKuvXs8mDI10zKY54jhQIXUqiqoXGM0UV8wfXC6h+xb418baxpK/Fv8Aad+IHjrRtOt5LSOKy8PadpV9PbyAeZDJexRmYI+BuCFc4x0yD6x8Lv2Pfgl8J/GOleINE0rX9e1jSQ40WfxHrM2oJpW8kubWJz5ULMScuqBj60UV00sdiKUXGE2k1Z2fTt6eRhPC0Zu8op9fn39dD2fTfhx4Y0r9oPxP8TrOG9XxXr+mWmnajK92zRNDamQwhYz8qkGR8kcnPPQV5ZqX7Kvwh1L4deMfCbWHiGx0HxF4lTxJLaWOuTwLp+pK277TZ7WH2Zi3JVMKTnjk0UVdLMsXTlzQqNPTq/s/D93TsKeEozVpRT3/AB3+8zT+yX8OIfEY1nSPEvxc8N6xPpdvp+sX2keOL22n1tIF2JJeOrZmn28GbIkOBluK9C+G/wADPhv8Jtc8WXngTR7nR4vEa2/9qWbX0s9vI0KMgkCSFsSOGYyPnMjEsxJ5ooq62bY2rBwnVk09GrvW21/Syt2M45fhozU1BXXWxL8MPgl8Pfg98LtY8H+A9KuNM0TU7+e9vElu3mkaSZQrYdiSFVQqqvRQABXAT/snfCj/AIQX4daNpD+NfC134GspLHw5rmh+JLi01O3tpGLPA86nMsbE5KuGFFFEc1xiqSqKrLmk7t3ers1r30bXo2U8Fh3BQ5FZdLfMS3/ZL+Elp4qtvEUA8aHxWtrPbXmvz+JrqfUNRSWSJ2+0zSMxlwYUCZ4RQVUKCRRRRTnm+Nl8VVv1ZCy3CramvuP/2Q=="; + initialize(); +})(jQuery); + +jQuery(document).ready(function () { + var form = jQuery('#oktavia_search_form'); + if (form.size() > 0) + { + form.oktaviaSearch(); + } +}); diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/oktavia-search.js b/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/oktavia-search.js new file mode 100644 index 00000000..fce9732a --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/oktavia-search.js @@ -0,0 +1,6795 @@ +// generatedy by JSX compiler 0.9.24 (2013-04-05 13:45:00 +0900; 1b229cc6a411f674f0f7cf7a79b7a8b3f8eb7414) +var JSX = {}; +(function (JSX) { +/** + * copies the implementations from source interface to target + */ +function $__jsx_merge_interface(target, source) { + for (var k in source.prototype) + if (source.prototype.hasOwnProperty(k)) + target.prototype[k] = source.prototype[k]; +} + +/** + * defers the initialization of the property + */ +function $__jsx_lazy_init(obj, prop, func) { + function reset(obj, prop, value) { + delete obj[prop]; + obj[prop] = value; + return value; + } + + Object.defineProperty(obj, prop, { + get: function () { + return reset(obj, prop, func()); + }, + set: function (v) { + reset(obj, prop, v); + }, + enumerable: true, + configurable: true + }); +} + +/** + * sideeffect().a /= b + */ +function $__jsx_div_assign(obj, prop, divisor) { + return obj[prop] = (obj[prop] / divisor) | 0; +} + +/* + * global functions, renamed to avoid conflict with local variable names + */ +var $__jsx_parseInt = parseInt; +var $__jsx_parseFloat = parseFloat; +var $__jsx_isNaN = isNaN; +var $__jsx_isFinite = isFinite; + +var $__jsx_encodeURIComponent = encodeURIComponent; +var $__jsx_decodeURIComponent = decodeURIComponent; +var $__jsx_encodeURI = encodeURI; +var $__jsx_decodeURI = decodeURI; + +var $__jsx_ObjectToString = Object.prototype.toString; +var $__jsx_ObjectHasOwnProperty = Object.prototype.hasOwnProperty; + +/* + * profiler object, initialized afterwards + */ +function $__jsx_profiler() { +} + +/* + * public interface to JSX code + */ +JSX.require = function (path) { + var m = $__jsx_classMap[path]; + return m !== undefined ? m : null; +}; + +JSX.profilerIsRunning = function () { + return $__jsx_profiler.getResults != null; +}; + +JSX.getProfileResults = function () { + return ($__jsx_profiler.getResults || function () { return {}; })(); +}; + +JSX.postProfileResults = function (url, cb) { + if ($__jsx_profiler.postResults == null) + throw new Error("profiler has not been turned on"); + return $__jsx_profiler.postResults(url, cb); +}; + +JSX.resetProfileResults = function () { + if ($__jsx_profiler.resetResults == null) + throw new Error("profiler has not been turned on"); + return $__jsx_profiler.resetResults(); +}; +JSX.DEBUG = false; +/** + * class _Result extends Object + * @constructor + */ +function _Result() { +} + +/** + * @constructor + * @param {!string} title + * @param {!string} url + * @param {!string} content + * @param {!number} score + */ +function _Result$SSSI(title, url, content, score) { + this.title = title; + this.url = url; + this.content = content; + this.score = score; +}; + +_Result$SSSI.prototype = new _Result; + +/** + * class _Proposal extends Object + * @constructor + */ +function _Proposal() { +} + +/** + * @constructor + * @param {!string} options + * @param {!string} label + * @param {!number} count + */ +function _Proposal$SSI(options, label, count) { + this.options = options; + this.label = label; + this.count = count; +}; + +_Proposal$SSI.prototype = new _Proposal; + +/** + * class OktaviaSearch extends Object + * @constructor + */ +function OktaviaSearch() { +} + +/** + * @constructor + * @param {!number} entriesPerPage + */ +function OktaviaSearch$I(entriesPerPage) { + this._queries = null; + this._highlight = ""; + this._result = null; + this._proposals = null; + this._currentFolderDepth = 0; + this._oktavia = new Oktavia$(); + this._entriesPerPage = entriesPerPage; + this._currentPage = 1; + this._queryString = null; + this._callback = null; + OktaviaSearch._instance = this; +}; + +OktaviaSearch$I.prototype = new OktaviaSearch; + +/** + * @param {Stemmer} stemmer + */ +OktaviaSearch.setStemmer$LStemmer$ = function (stemmer) { + /** @type {Oktavia} */ + var this$0; + if (OktaviaSearch._instance) { + this$0 = OktaviaSearch._instance._oktavia; + this$0._stemmer = stemmer; + } else { + OktaviaSearch._stemmer = stemmer; + } +}; + +var OktaviaSearch$setStemmer$LStemmer$ = OktaviaSearch.setStemmer$LStemmer$; + +/** + * @param {!string} index + */ +OktaviaSearch.prototype.loadIndex$S = function (index) { + /** @type {Oktavia} */ + var this$0; + /** @type {Stemmer} */ + var stemmer$0; + if (OktaviaSearch._stemmer) { + this$0 = this._oktavia; + stemmer$0 = OktaviaSearch._stemmer; + this$0._stemmer = stemmer$0; + } + this._oktavia.load$S(Binary$base64decode$S(index)); + if (this._queryString) { + this.search$SF$IIV$(this._queryString, this._callback); + this._queryString = null; + this._callback = null; + } +}; + +/** + * @param {!string} queryString + * @param {*} callback + */ +OktaviaSearch.prototype.search$SF$IIV$ = function (queryString, callback) { + /** @type {QueryStringParser} */ + var queryParser; + /** @type {SearchSummary} */ + var summary; + /** @type {Array.<undefined|SearchUnit>} */ + var _result$0; + if (this._oktavia) { + queryParser = ({queries: [ ]}); + this._queries = QueryStringParser$parse$LQueryStringParser$S(queryParser, queryString); + this._highlight = QueryStringParser$highlight$LQueryStringParser$(queryParser); + summary = this._oktavia.search$ALQuery$(this._queries); + if (SearchSummary$size$LSearchSummary$(summary) > 0) { + this._result = this._sortResult$LSearchSummary$(summary); + this._proposals = [ ]; + this._currentPage = 1; + } else { + this._result = [ ]; + if (this._queries.length > 1) { + this._proposals = SearchSummary$getProposal$LSearchSummary$(summary); + } else { + this._proposals = [ ]; + } + this._currentPage = 1; + } + callback((_result$0 = this._result).length, Math.ceil(_result$0.length / this._entriesPerPage)); + } else { + this._queryString = queryString; + this._callback = callback; + } +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.resultSize$ = function () { + return (this._result.length | 0); +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.totalPages$ = function () { + return (Math.ceil(this._result.length / this._entriesPerPage) | 0); +}; + +/** + * @return {!number} + */ +OktaviaSearch.prototype.currentPage$ = function () { + return this._currentPage; +}; + +/** + * @param {!number} page + */ +OktaviaSearch.prototype.setCurrentPage$I = function (page) { + this._currentPage = page; +}; + +/** + * @return {!boolean} + */ +OktaviaSearch.prototype.hasPrevPage$ = function () { + return this._currentPage !== 1; +}; + +/** + * @return {!boolean} + */ +OktaviaSearch.prototype.hasNextPage$ = function () { + return this._currentPage !== Math.ceil(this._result.length / this._entriesPerPage); +}; + +/** + * @return {Array.<undefined|!string>} + */ +OktaviaSearch.prototype.pageIndexes$ = function () { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var total; + /** @type {!number} */ + var i; + result = [ ]; + total = Math.ceil(this._result.length / this._entriesPerPage); + if (total < 10) { + for (i = 1; i <= total; i++) { + result.push(i + ""); + } + } else { + if (this._currentPage <= 5) { + for (i = 1; i <= 7; i++) { + result.push(i + ""); + } + result.push('...', total + ""); + } else { + if (total - 5 <= this._currentPage) { + result.push('1', '...'); + for (i = total - 8; i <= total; i++) { + result.push(i + ""); + } + } else { + result.push('1', '...'); + for (i = this._currentPage - 3; i <= this._currentPage + 3; i++) { + result.push(i + ""); + } + result.push('...', total + ""); + } + } + } + return result; +}; + +/** + * @return {Array.<undefined|_Result>} + */ +OktaviaSearch.prototype.getResult$ = function () { + /** @type {Style} */ + var style; + /** @type {!number} */ + var start; + /** @type {!number} */ + var last; + /** @type {Metadata} */ + var metadata; + /** @type {!number} */ + var num; + /** @type {Array.<undefined|_Result>} */ + var results; + /** @type {!number} */ + var i; + /** @type {SearchUnit} */ + var unit; + /** @type {Array.<undefined|!string>} */ + var info; + /** @type {!string} */ + var content; + /** @type {Array.<undefined|Position>} */ + var positions; + /** @type {!number} */ + var end; + /** @type {!boolean} */ + var split; + /** @type {!number} */ + var j; + /** @type {Position} */ + var pos; + /** @type {!string} */ + var text; + /** @type {Oktavia} */ + var this$0; + /** @type {!number} */ + var position$0; + /** @type {!number} */ + var _currentPage$0; + /** @type {!number} */ + var _entriesPerPage$0; + style = new Style$S('html'); + start = ((_currentPage$0 = this._currentPage) - 1) * (_entriesPerPage$0 = this._entriesPerPage); + last = Math.min(_currentPage$0 * _entriesPerPage$0, this._result.length); + this$0 = this._oktavia; + metadata = this$0._metadatas[this$0._metadataLabels[0]]; + num = 250; + results = [ ]; + for (i = start; i < last; i++) { + unit = this._result[i]; + info = metadata.getInformation$I(unit.id).split(Oktavia.eob); + content = metadata.getContent$I(unit.id); + start = 0; + positions = SearchUnit$getPositions$LSearchUnit$(unit); + if (content.indexOf(info[0]) === 1) { + content = content.slice(info[0].length + 2, content.length); + start += info[0].length + 2; + } + end = start + num; + split = false; + if (positions[0].position > end - positions[0].word.length) { + end = positions[0].position + Math.floor(num / 2); + split = true; + } + for (j = positions.length - 1; j > -1; j--) { + pos = positions[j]; + if (pos.position + pos.word.length < end) { + content = [ content.slice(0, pos.position - start), style.convert$S('<hit>*</hit>').replace('*', content.slice((position$0 = pos.position) - start, position$0 + pos.word.length - start)), content.slice(pos.position + pos.word.length - start, content.length) ].join(''); + } + } + if (split) { + text = [ content.slice(0, Math.floor(num / 2)) + ' ...', content.slice(- Math.floor(num / 2), end - start) ].join('<br/>'); + } else { + text = content.slice(0, end - start) + ' ...<br/>'; + } + text = text.replace(Oktavia.eob, ' ').replace(/(<br\/>)(<br\/>)+/, '<br/><br/>'); + results.push(({title: info[0], url: info[1], content: text, score: unit.score})); + } + return results; +}; + +/** + * @return {!string} + */ +OktaviaSearch.prototype.getHighlight$ = function () { + return this._highlight; +}; + +/** + * @return {Array.<undefined|_Proposal>} + */ +OktaviaSearch.prototype.getProposals$ = function () { + /** @type {Style} */ + var style; + /** @type {Array.<undefined|_Proposal>} */ + var results; + /** @type {!number} */ + var i; + /** @type {Proposal} */ + var proposal; + /** @type {Array.<undefined|!string>} */ + var label; + /** @type {Array.<undefined|!string>} */ + var option; + /** @type {!number} */ + var j; + style = new Style$S('html'); + results = [ ]; + if (this._queries.length > 1) { + for (i = 0; i < this._proposals.length; i++) { + proposal = this._proposals[i]; + if (proposal.expect > 0) { + label = [ ]; + option = [ ]; + for (j = 0; j < this._queries.length; j++) { + if (j !== proposal.omit) { + label.push(style.convert$S('<hit>' + this._queries[j].toString() + '</hit>')); + option.push(this._queries[j].toString()); + } else { + label.push(style.convert$S('<del>' + this._queries[j].toString() + '</del>')); + } + } + results.push(({options: option.join(' '), label: label.join(' '), count: proposal.expect})); + } + } + } + return results; +}; + +/** + * @param {SearchSummary} summary + * @return {Array.<undefined|SearchUnit>} + */ +OktaviaSearch.prototype._sortResult$LSearchSummary$ = function (summary) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var score; + /** @type {SearchUnit} */ + var unit; + /** @type {!string} */ + var pos; + /** @type {Position} */ + var position; + for (i = 0; i < summary.result.units.length; i++) { + score = 0; + unit = summary.result.units[i]; + for (pos in unit.positions) { + position = unit.positions[pos]; + if (this._oktavia.wordPositionType$I(position.position)) { + score += 10; + } else { + score += 1; + } + if (! position.stemmed) { + score += 2; + } + } + unit.score = (score | 0); + } + return SearchSummary$getSortedResult$LSearchSummary$(summary); +}; + +/** + * class _Main extends Object + * @constructor + */ +function _Main() { +} + +/** + * @constructor + */ +function _Main$() { +}; + +_Main$.prototype = new _Main; + +/** + * @param {Array.<undefined|!string>} args + */ +_Main.main$AS = function (args) { +}; + +var _Main$main$AS = _Main.main$AS; + +/** + * class Oktavia extends Object + * @constructor + */ +function Oktavia() { +} + +/** + * @constructor + */ +function Oktavia$() { + /** @type {Array.<undefined|!string>} */ + var _utf162compressCode$0; + this._compressCode2utf16 = null; + this._fmindex = new FMIndex$(); + this._metadatas = ({ }); + this._metadataLabels = [ ]; + this._stemmer = null; + this._stemmingResult = ({ }); + _utf162compressCode$0 = this._utf162compressCode = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + _utf162compressCode$0.length = 65536; + this._compressCode2utf16 = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; +}; + +Oktavia$.prototype = new Oktavia; + +/** + * @param {Stemmer} stemmer + */ +Oktavia.prototype.setStemmer$LStemmer$ = function (stemmer) { + this._stemmer = stemmer; +}; + +/** + * @return {Metadata} + */ +Oktavia.prototype.getPrimaryMetadata$ = function () { + return this._metadatas[this._metadataLabels[0]]; +}; + +/** + * @param {!string} key + * @return {Section} + */ +Oktavia.prototype.addSection$S = function (key) { + /** @type {Section} */ + var section; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + section = new Section$LOktavia$(this); + this._metadatas[key] = section; + return section; +}; + +/** + * @param {!string} key + * @return {Section} + */ +Oktavia.prototype.getSection$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @return {Splitter} + */ +Oktavia.prototype.addSplitter$S = function (key) { + /** @type {Splitter} */ + var splitter; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + splitter = new Splitter$LOktavia$(this); + this._metadatas[key] = splitter; + return splitter; +}; + +/** + * @param {!string} key + * @return {Splitter} + */ +Oktavia.prototype.getSplitter$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @param {Array.<undefined|!string>} headers + * @return {Table} + */ +Oktavia.prototype.addTable$SAS = function (key, headers) { + /** @type {Table} */ + var table; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + table = new Table$LOktavia$AS(this, headers); + this._metadatas[key] = table; + return table; +}; + +/** + * @param {!string} key + * @return {Table} + */ +Oktavia.prototype.getTable$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + * @param {!string} key + * @return {Block} + */ +Oktavia.prototype.addBlock$S = function (key) { + /** @type {Block} */ + var block; + if (this._metadataLabels.indexOf(key) !== -1) { + throw new Error('Metadata name ' + key + ' is already exists'); + } + this._metadataLabels.push(key); + block = new Block$LOktavia$(this); + this._metadatas[key] = block; + return block; +}; + +/** + * @param {!string} key + * @return {Block} + */ +Oktavia.prototype.getBlock$S = function (key) { + if (this._metadataLabels.indexOf(key) === -1) { + throw new Error('Metadata name ' + key + " does't exists"); + } + return this._metadatas[key]; +}; + +/** + */ +Oktavia.prototype.addEndOfBlock$ = function () { + this._fmindex.push$S(Oktavia.eob); +}; + +/** + * @param {!string} words + */ +Oktavia.prototype.addWord$S = function (words) { + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {undefined|!string} */ + var newCharCode; + str = [ ]; + str.length = words.length; + for (i = 0; i < words.length; i++) { + charCode = words.charCodeAt(i); + newCharCode = this._utf162compressCode[charCode]; + if (newCharCode == null) { + newCharCode = String.fromCharCode(this._compressCode2utf16.length); + this._utf162compressCode[charCode] = newCharCode; + this._compressCode2utf16.push(String.fromCharCode(charCode)); + } + str.push(newCharCode); + } + this._fmindex.push$S(str.join('')); +}; + +/** + * @param {!string} words + * @param {!boolean} stemming + */ +Oktavia.prototype.addWord$SB = function (words, stemming) { + /** @type {Array.<undefined|!string>} */ + var wordList; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var originalWord; + /** @type {!string} */ + var smallWord; + /** @type {undefined|!string} */ + var registerWord; + /** @type {!string} */ + var baseWord; + /** @type {!string} */ + var compressedCodeWord; + /** @type {Array.<undefined|!string>} */ + var stemmedList; + this.addWord$S(words); + wordList = words.split(/\s+/); + for (i = 0; i < wordList.length; i++) { + originalWord = wordList[i]; + smallWord = originalWord.slice(0, 1).toLowerCase() + originalWord.slice(1); + registerWord = null; + if (stemming && this._stemmer) { + baseWord = this._stemmer.stemWord$S(originalWord.toLowerCase()); + if (originalWord.indexOf(baseWord) === -1) { + registerWord = baseWord; + } + } else { + if (originalWord != smallWord) { + registerWord = smallWord; + } + } + if (registerWord) { + compressedCodeWord = this._convertToCompressionCode$S(originalWord); + stemmedList = this._stemmingResult[registerWord]; + if (! stemmedList) { + stemmedList = [ compressedCodeWord ]; + this._stemmingResult[registerWord] = stemmedList; + } else { + if (stemmedList.indexOf(compressedCodeWord) === -1) { + stemmedList.push(compressedCodeWord); + } + } + } + } +}; + +/** + * @param {!string} keyword + * @return {!string} + */ +Oktavia.prototype._convertToCompressionCode$S = function (keyword) { + /** @type {Array.<undefined|!string>} */ + var resultChars; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var chr; + resultChars = [ ]; + for (i = 0; i < keyword.length; i++) { + chr = this._utf162compressCode[keyword.charCodeAt(i)]; + if (chr == null) { + resultChars.push(Oktavia.unknown); + } else { + resultChars.push(chr); + } + } + return resultChars.join(''); +}; + +/** + * @param {!string} keyword + * @param {!boolean} stemming + * @return {Array.<undefined|!number>} + */ +Oktavia.prototype.rawSearch$SB = function (keyword, stemming) { + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {!string} */ + var baseWord; + /** @type {Array.<undefined|!string>} */ + var stemmedList; + /** @type {!number} */ + var i; + /** @type {undefined|!string} */ + var word; + if (stemming) { + result = [ ]; + if (this._stemmer) { + baseWord = this._stemmer.stemWord$S(keyword.toLowerCase()); + stemmedList = this._stemmingResult[baseWord]; + if (stemmedList) { + for (i = 0; i < stemmedList.length; i++) { + word = stemmedList[i]; + result = result.concat(this._fmindex.search$S(word)); + } + } + } + } else { + result = this._fmindex.search$S(this._convertToCompressionCode$S(keyword)); + } + return result; +}; + +/** + * @param {Array.<undefined|Query>} queries + * @return {SearchSummary} + */ +Oktavia.prototype.search$ALQuery$ = function (queries) { + /** @type {SearchSummary} */ + var summary; + /** @type {!number} */ + var i; + /** @type {SingleResult} */ + var result$0; + summary = ({sourceResults: [ ], result: null, oktavia: this}); + for (i = 0; i < queries.length; i++) { + result$0 = this._searchQuery$LQuery$(queries[i]); + summary.sourceResults.push(result$0); + } + summary.result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$(summary, summary.sourceResults); + return summary; +}; + +/** + * @param {Query} query + * @return {SingleResult} + */ +Oktavia.prototype._searchQuery$LQuery$ = function (query) { + /** @type {SingleResult} */ + var result; + /** @type {Array.<undefined|!number>} */ + var positions; + result = new SingleResult$SBB(query.word, query.or, query.not); + if (query.raw) { + positions = this.rawSearch$SB(query.word, false); + } else { + positions = this.rawSearch$SB(query.word, false).concat(this.rawSearch$SB(query.word, true)); + } + this._metadatas[this._metadataLabels[0]].grouping$LSingleResult$AISB(result, positions, query.word, ! query.raw); + return result; +}; + +/** + */ +Oktavia.prototype.build$ = function () { + this.build$IB(5, false); +}; + +/** + * @param {!number} cacheDensity + * @param {!boolean} verbose + */ +Oktavia.prototype.build$IB = function (cacheDensity, verbose) { + /** @type {!string} */ + var key; + /** @type {!number} */ + var cacheRange; + /** @type {!number} */ + var maxChar; + for (key in this._metadatas) { + this._metadatas[key]._build$(); + } + cacheRange = Math.round(Math.max(1, 100 / Math.min(100, Math.max(0.01, cacheDensity)))); + maxChar = this._compressCode2utf16.length; + this._fmindex.build$SIIB(Oktavia.eof, maxChar, cacheRange, verbose); +}; + +/** + * @return {!string} + */ +Oktavia.prototype.dump$ = function () { + return this.dump$B(false); +}; + +/** + * @param {!boolean} verbose + * @return {!string} + */ +Oktavia.prototype.dump$B = function (verbose) { + /** @type {!string} */ + var header; + /** @type {!string} */ + var fmdata; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {CompressionReport} */ + var report; + /** @type {undefined|!string} */ + var name; + /** @type {!string} */ + var data; + header = Binary$dumpString$SLCompressionReport$("oktavia-01", null).slice(1); + if (verbose) { + console.log("Source text size: " + (this._fmindex.size$() * 2 + "") + ' bytes'); + } + fmdata = this._fmindex.dump$B(verbose); + result = [ header, fmdata ]; + result.push(Binary$dump16bitNumber$I(this._compressCode2utf16.length)); + for (i = 3; i < this._compressCode2utf16.length; i++) { + result.push(this._compressCode2utf16[i]); + } + if (verbose) { + console.log('Char Code Map: ' + (this._compressCode2utf16.length * 2 - 2 + "") + ' bytes'); + } + report = ({source: 0, result: 0}); + result.push(Binary$dumpStringListMap$HASLCompressionReport$(this._stemmingResult, report)); + if (verbose) { + console.log('Stemmed Word Table: ' + (result[result.length - 1].length + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + result.push(Binary$dump16bitNumber$I(this._metadataLabels.length)); + for (i = 0; i < this._metadataLabels.length; i++) { + report = ({source: 0, result: 0}); + name = this._metadataLabels[i]; + data = this._metadatas[name]._dump$LCompressionReport$(report); + result.push(Binary$dumpString$SLCompressionReport$(name, report), data); + if (verbose) { + console.log('Meta Data ' + name + ': ' + (data.length * 2 + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + } + return result.join(''); +}; + +/** + * @param {!string} data + */ +Oktavia.prototype.load$S = function (data) { + /** @type {!string} */ + var header; + /** @type {!number} */ + var offset; + /** @type {!number} */ + var charCodeCount; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {LoadedStringListMapResult} */ + var stemmedWords; + /** @type {!number} */ + var metadataCount; + /** @type {LoadedStringResult} */ + var nameResult; + /** @type {!string} */ + var name; + /** @type {!number} */ + var type; + header = Binary$dumpString$SLCompressionReport$("oktavia-01", null).slice(1); + if (data.slice(0, 5) !== header) { + throw new Error('Invalid data file'); + } + this._metadatas = ({ }); + this._metadataLabels = [ ]; + offset = 5; + offset = this._fmindex.load$SI(data, offset); + charCodeCount = Binary$load16bitNumber$SI(data, offset++); + this._compressCode2utf16 = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + this._utf162compressCode = [ Oktavia.eof, Oktavia.eob, Oktavia.unknown ]; + for (i = 3; i < charCodeCount; i++) { + charCode = Binary$load16bitNumber$SI(data, offset++); + this._compressCode2utf16.push(String.fromCharCode(charCode)); + this._utf162compressCode[charCode] = String.fromCharCode(i); + } + stemmedWords = Binary$loadStringListMap$SI(data, offset); + this._stemmingResult = stemmedWords.result; + offset = stemmedWords.offset; + metadataCount = Binary$load16bitNumber$SI(data, offset++); + for (i = 0; i < metadataCount; i++) { + nameResult = Binary$loadString$SI(data, offset); + name = nameResult.result; + offset = nameResult.offset; + type = Binary$load16bitNumber$SI(data, offset++); + switch (type) { + case 0: + offset = Section$_load$LOktavia$SSI(this, name, data, offset); + break; + case 1: + offset = Splitter$_load$LOktavia$SSI(this, name, data, offset); + break; + case 2: + offset = Table$_load$LOktavia$SSI(this, name, data, offset); + break; + case 3: + offset = Block$_load$LOktavia$SSI(this, name, data, offset); + break; + } + } +}; + +/** + * @return {!number} + */ +Oktavia.prototype.contentSize$ = function () { + /** @type {FMIndex} */ + var this$0; + this$0 = this._fmindex; + return this$0._substr.length; +}; + +/** + * @param {!number} position + * @return {!number} + */ +Oktavia.prototype.wordPositionType$I = function (position) { + /** @type {!number} */ + var result; + /** @type {!string} */ + var ahead; + result = 0; + if (position === 0) { + result = 4; + } else { + ahead = this._fmindex.getSubstring$II(position - 1, 1); + if (/\s/.test(ahead)) { + result = 2; + } else { + if (/\W/.test(ahead)) { + result = 1; + } else { + if (Oktavia.eob === ahead) { + result = 3; + } + } + } + } + return (result | 0); +}; + +/** + * @param {!number} position + * @param {!number} length + * @return {!string} + */ +Oktavia.prototype._getSubstring$II = function (position, length) { + /** @type {!string} */ + var result; + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var i; + result = this._fmindex.getSubstring$II(position, length); + str = [ ]; + for (i = 0; i < result.length; i++) { + str.push(this._compressCode2utf16[result.charCodeAt(i)]); + } + return str.join(''); +}; + +/** + * class Binary extends Object + * @constructor + */ +function Binary() { +} + +/** + * @constructor + */ +function Binary$() { +}; + +Binary$.prototype = new Binary; + +/** + * @param {!number} num + * @return {!string} + */ +Binary.dump32bitNumber$N = function (num) { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ String.fromCharCode(Math.floor(num / 65536)) ]; + result.push(String.fromCharCode(num % 65536)); + return result.join(""); +}; + +var Binary$dump32bitNumber$N = Binary.dump32bitNumber$N; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {!number} + */ +Binary.load32bitNumber$SI = function (buffer, offset) { + /** @type {!number} */ + var result; + result = buffer.charCodeAt(offset) * 65536 + buffer.charCodeAt(offset + 1); + return result; +}; + +var Binary$load32bitNumber$SI = Binary.load32bitNumber$SI; + +/** + * @param {!number} num + * @return {!string} + */ +Binary.dump16bitNumber$I = function (num) { + return String.fromCharCode(num % 65536); +}; + +var Binary$dump16bitNumber$I = Binary.dump16bitNumber$I; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {!number} + */ +Binary.load16bitNumber$SI = function (buffer, offset) { + return (buffer.charCodeAt(offset) | 0); +}; + +var Binary$load16bitNumber$SI = Binary.load16bitNumber$SI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.dumpString$S = function (str) { + return Binary$dumpString$SLCompressionReport$(str, null); +}; + +var Binary$dumpString$S = Binary.dumpString$S; + +/** + * @param {!string} str + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpString$SLCompressionReport$ = function (str, report) { + /** @type {!number} */ + var length; + /** @type {!boolean} */ + var compress; + /** @type {Array.<undefined|!number>} */ + var charCodes; + /** @type {!number} */ + var i; + /** @type {!number} */ + var charCode; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {undefined|!number} */ + var bytes; + if (str.length > 32768) { + str = str.slice(0, 32768); + } + length = str.length; + compress = true; + charCodes = [ ]; + for (i = 0; i < length; i++) { + charCode = str.charCodeAt(i); + if (charCode > 255) { + compress = false; + break; + } + charCodes.push(charCode); + } + if (compress) { + result = [ Binary$dump16bitNumber$I(length + 32768) ]; + for (i = 0; i < length; i += 2) { + bytes = charCodes[i]; + if (i !== length - 1) { + bytes += charCodes[i + 1] << 8; + } + result.push(String.fromCharCode(bytes % 65536)); + } + if (report) { + CompressionReport$add$LCompressionReport$II(report, length, Math.ceil(length / 2)); + } + } else { + result = [ Binary$dump16bitNumber$I(length), str ]; + if (report) { + CompressionReport$add$LCompressionReport$II(report, length, length); + } + } + return result.join(''); +}; + +var Binary$dumpString$SLCompressionReport$ = Binary.dumpString$SLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringResult} + */ +Binary.loadString$SI = function (buffer, offset) { + return new LoadedStringResult$SI(buffer, offset); +}; + +var Binary$loadString$SI = Binary.loadString$SI; + +/** + * @param {Array.<undefined|!string>} strList + * @return {!string} + */ +Binary.dumpStringList$AS = function (strList) { + return Binary$dumpStringList$ASLCompressionReport$(strList, null); +}; + +var Binary$dumpStringList$AS = Binary.dumpStringList$AS; + +/** + * @param {Array.<undefined|!string>} strList + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpStringList$ASLCompressionReport$ = function (strList, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + result = [ Binary$dump32bitNumber$N(strList.length) ]; + for (i = 0; i < strList.length; i++) { + result.push(Binary$dumpString$SLCompressionReport$(strList[i], report)); + } + return result.join(''); +}; + +var Binary$dumpStringList$ASLCompressionReport$ = Binary.dumpStringList$ASLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringListResult} + */ +Binary.loadStringList$SI = function (buffer, offset) { + return new LoadedStringListResult$SI(buffer, offset); +}; + +var Binary$loadStringList$SI = Binary.loadStringList$SI; + +/** + * @param {Object.<string, undefined|Array.<undefined|!string>>} strMap + * @return {!string} + */ +Binary.dumpStringListMap$HAS = function (strMap) { + return Binary$dumpStringListMap$HASLCompressionReport$(strMap, null); +}; + +var Binary$dumpStringListMap$HAS = Binary.dumpStringListMap$HAS; + +/** + * @param {Object.<string, undefined|Array.<undefined|!string>>} strMap + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dumpStringListMap$HASLCompressionReport$ = function (strMap, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + result = [ ]; + counter = 0; + for (key in strMap) { + result.push(Binary$dumpString$SLCompressionReport$(key, report)); + result.push(Binary$dumpStringList$ASLCompressionReport$(strMap[key], report)); + counter++; + } + return Binary$dump32bitNumber$N(counter) + result.join(''); +}; + +var Binary$dumpStringListMap$HASLCompressionReport$ = Binary.dumpStringListMap$HASLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedStringListMapResult} + */ +Binary.loadStringListMap$SI = function (buffer, offset) { + return new LoadedStringListMapResult$SI(buffer, offset); +}; + +var Binary$loadStringListMap$SI = Binary.loadStringListMap$SI; + +/** + * @param {Array.<undefined|!number>} array + * @return {!string} + */ +Binary.dump32bitNumberList$AN = function (array) { + return Binary$dump32bitNumberList$ANLCompressionReport$(array, null); +}; + +var Binary$dump32bitNumberList$AN = Binary.dump32bitNumberList$AN; + +/** + * @param {Array.<undefined|!number>} array + * @param {CompressionReport} report + * @return {!string} + */ +Binary.dump32bitNumberList$ANLCompressionReport$ = function (array, report) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var index; + /** @type {!number} */ + var inputLength; + /** @type {!number} */ + var length; + /** @type {!string} */ + var resultString; + /** @type {!number} */ + var value1$0; + /** @type {!number} */ + var value2$0; + result = [ Binary$dump32bitNumber$N(array.length) ]; + index = 0; + inputLength = array.length; + while (index < inputLength) { + if (array[index] == 0) { + length = Binary$_countZero$ANI(array, index); + result.push(Binary$_zeroBlock$I(length)); + index += length; + } else { + if (Binary$_shouldZebraCode$ANI(array, index)) { + result.push(Binary$_createZebraCode$ANI(array, index)); + value1$0 = array.length; + value2$0 = index + 15; + index = (value1$0 <= value2$0 ? value1$0 : value2$0); + } else { + length = Binary$_searchDoubleZero$ANI(array, index); + result.push(Binary$_nonZeroBlock$ANII(array, index, length)); + if (length === 0) { + throw new Error(''); + } + index += length; + } + } + } + resultString = result.join(''); + if (report) { + CompressionReport$add$LCompressionReport$II(report, array.length * 2 + 2, resultString.length); + } + return resultString; +}; + +var Binary$dump32bitNumberList$ANLCompressionReport$ = Binary.dump32bitNumberList$ANLCompressionReport$; + +/** + * @param {!string} buffer + * @param {!number} offset + * @return {LoadedNumberListResult} + */ +Binary.load32bitNumberList$SI = function (buffer, offset) { + return new LoadedNumberListResult$SI(buffer, offset); +}; + +var Binary$load32bitNumberList$SI = Binary.load32bitNumberList$SI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!number} + */ +Binary._countZero$ANI = function (array, offset) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var array$len$0; + for ((i = offset, array$len$0 = array.length); i < array$len$0; i++) { + if (array[i] != 0) { + return (i - offset | 0); + } + } + return (array.length - offset | 0); +}; + +var Binary$_countZero$ANI = Binary._countZero$ANI; + +/** + * @param {!number} length + * @return {!string} + */ +Binary._zeroBlock$I = function (length) { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ ]; + while (length > 0) { + if (length > 16384) { + result.push(Binary$dump16bitNumber$I(16383)); + length -= 16384; + } else { + result.push(Binary$dump16bitNumber$I(length - 1)); + length = 0; + } + } + return result.join(''); +}; + +var Binary$_zeroBlock$I = Binary._zeroBlock$I; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!boolean} + */ +Binary._shouldZebraCode$ANI = function (array, offset) { + /** @type {!number} */ + var change; + /** @type {!boolean} */ + var isLastZero; + /** @type {!number} */ + var i; + if (array.length - offset < 16) { + return true; + } + change = 0; + isLastZero = false; + for (i = offset; i < offset + 15; i++) { + if (array[i] == 0) { + if (! isLastZero) { + isLastZero = true; + change++; + } + } else { + if (isLastZero) { + isLastZero = false; + change++; + } + } + } + return change > 2; +}; + +var Binary$_shouldZebraCode$ANI = Binary._shouldZebraCode$ANI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!number} + */ +Binary._searchDoubleZero$ANI = function (array, offset) { + /** @type {!boolean} */ + var isLastZero; + /** @type {!number} */ + var i; + /** @type {!number} */ + var array$len$0; + isLastZero = false; + for ((i = offset, array$len$0 = array.length); i < array$len$0; i++) { + if (array[i] == 0) { + if (isLastZero) { + return (i - offset - 1 | 0); + } + isLastZero = true; + } else { + isLastZero = false; + } + } + return (array.length - offset | 0); +}; + +var Binary$_searchDoubleZero$ANI = Binary._searchDoubleZero$ANI; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @param {!number} length + * @return {!string} + */ +Binary._nonZeroBlock$ANII = function (array, offset, length) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var blockLength; + /** @type {!number} */ + var i; + result = [ ]; + while (length > 0) { + if (length > 16384) { + blockLength = 16384; + length -= 16384; + } else { + blockLength = length; + length = 0; + } + result.push(Binary$dump16bitNumber$I(blockLength - 1 + 0x4000)); + for (i = offset; i < offset + blockLength; i++) { + result.push(Binary$dump32bitNumber$N(array[i])); + } + offset += blockLength; + } + return result.join(''); +}; + +var Binary$_nonZeroBlock$ANII = Binary._nonZeroBlock$ANII; + +/** + * @param {Array.<undefined|!number>} array + * @param {!number} offset + * @return {!string} + */ +Binary._createZebraCode$ANI = function (array, offset) { + /** @type {!number} */ + var last; + /** @type {!number} */ + var code; + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {!number} */ + var value1$0; + /** @type {!number} */ + var value2$0; + value1$0 = offset + 15; + value2$0 = array.length; + last = (value1$0 <= value2$0 ? value1$0 : value2$0); + code = 0x8000; + result = [ ]; + for (i = offset; i < last; i++) { + if (array[i] != 0) { + result.push(Binary$dump32bitNumber$N(array[i])); + code = code + (0x1 << i - offset); + } + } + return String.fromCharCode(code) + result.join(''); +}; + +var Binary$_createZebraCode$ANI = Binary._createZebraCode$ANI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.base64encode$S = function (str) { + /** @type {Array.<undefined|!string>} */ + var out; + /** @type {Array.<undefined|!number>} */ + var source; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var len; + /** @type {!number} */ + var c1; + /** @type {undefined|!number} */ + var c2; + /** @type {undefined|!number} */ + var c3; + out = [ ]; + source = [ ]; + for (i = 0; i < str.length; i++) { + code = str.charCodeAt(i); + source.push(code & 0x00ff, code >>> 8); + } + len = str.length * 2; + i = 0; + while (i < len) { + c1 = source[i++] & 0xff; + if (i === len) { + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4)); + out.push("=="); + break; + } + c2 = source[i++]; + if (i === len) { + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4 | (c2 & 0xF0) >> 4)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c2 & 0xF) << 2)); + out.push("="); + break; + } + c3 = source[i++]; + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c1 >> 2)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c1 & 0x3) << 4 | (c2 & 0xF0) >> 4)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((c2 & 0xF) << 2 | (c3 & 0xC0) >> 6)); + out.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c3 & 0x3F)); + } + return out.join(''); +}; + +var Binary$base64encode$S = Binary.base64encode$S; + +/** + * @param {Array.<undefined|!number>} source + * @return {!string} + */ +Binary._mergeCharCode$AI = function (source) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + result = [ ]; + for (i = 0; i < source.length; i += 2) { + result.push(String.fromCharCode(source[i] + (source[i + 1] << 8))); + } + return result.join(''); +}; + +var Binary$_mergeCharCode$AI = Binary._mergeCharCode$AI; + +/** + * @param {!string} str + * @return {!string} + */ +Binary.base64decode$S = function (str) { + /** @type {!number} */ + var len; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!number>} */ + var out; + /** @type {undefined|!number} */ + var c1; + /** @type {undefined|!number} */ + var c2; + /** @type {!number} */ + var c3; + /** @type {!number} */ + var c4; + len = str.length; + i = 0; + out = [ ]; + while (i < len) { + do { + c1 = Binary._base64DecodeChars[str.charCodeAt(i++) & 0xff]; + } while (i < len && c1 == -1); + if (c1 == -1) { + break; + } + do { + c2 = Binary._base64DecodeChars[str.charCodeAt(i++) & 0xff]; + } while (i < len && c2 == -1); + if (c2 == -1) { + break; + } + out.push(c1 << 2 | (c2 & 0x30) >> 4); + do { + c3 = str.charCodeAt(i++) & 0xff; + if (c3 === 61) { + return Binary$_mergeCharCode$AI(out); + } + c3 = Binary._base64DecodeChars[c3]; + } while (i < len && c3 === -1); + if (c3 === -1) { + break; + } + out.push((c2 & 0XF) << 4 | (c3 & 0x3C) >> 2); + do { + c4 = str.charCodeAt(i++) & 0xff; + if (c4 === 61) { + return Binary$_mergeCharCode$AI(out); + } + c4 = (Binary._base64DecodeChars[c4] | 0); + } while (i < len && c4 === -1); + if (c4 === -1) { + break; + } + out.push((c3 & 0x03) << 6 | c4); + } + return Binary$_mergeCharCode$AI(out); +}; + +var Binary$base64decode$S = Binary.base64decode$S; + +/** + * class LoadedStringResult extends Object + * @constructor + */ +function LoadedStringResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringResult$SI(data, offset) { + /** @type {!number} */ + var strLength; + /** @type {Array.<undefined|!string>} */ + var bytes; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var offset$0; + this.result = ""; + this.offset = 0; + offset$0 = offset++; + strLength = data.charCodeAt(offset$0); + if (strLength > 32767) { + strLength = strLength - 32768; + bytes = [ ]; + for (i = 0; i < strLength; i += 2) { + code = data.charCodeAt(offset); + bytes.push(String.fromCharCode(code & 0x00ff)); + if (i !== strLength - 1) { + bytes.push(String.fromCharCode(code >>> 8)); + } + offset++; + } + this.result = bytes.join(''); + this.offset = offset; + } else { + this.result = data.slice(offset, offset + strLength); + this.offset = (offset + strLength | 0); + } +}; + +LoadedStringResult$SI.prototype = new LoadedStringResult; + +/** + * class LoadedStringListResult extends Object + * @constructor + */ +function LoadedStringListResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringListResult$SI(data, offset) { + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {!number} */ + var strLength; + /** @type {!string} */ + var resultStr; + /** @type {Array.<undefined|!string>} */ + var bytes; + /** @type {!number} */ + var j; + /** @type {!number} */ + var code; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var offset$0; + this.offset = 0; + this.result = [ ]; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + length = result$0; + offset += 2; + for (i = 0; i < length; i++) { + offset$0 = offset++; + strLength = data.charCodeAt(offset$0); + if (strLength > 32767) { + strLength = strLength - 32768; + bytes = [ ]; + for (j = 0; j < strLength; j += 2) { + code = data.charCodeAt(offset); + bytes.push(String.fromCharCode(code & 0x00ff)); + if (j !== strLength - 1) { + bytes.push(String.fromCharCode(code >>> 8)); + } + offset++; + } + resultStr = bytes.join(''); + } else { + resultStr = data.slice(offset, offset + strLength); + offset = (offset + strLength | 0); + } + this.result.push(resultStr); + } + this.offset = offset; +}; + +LoadedStringListResult$SI.prototype = new LoadedStringListResult; + +/** + * class LoadedStringListMapResult extends Object + * @constructor + */ +function LoadedStringListMapResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedStringListMapResult$SI(data, offset) { + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {LoadedStringResult} */ + var keyResult; + /** @type {LoadedStringListResult} */ + var valueResult; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var offset$0; + this.offset = 0; + this.result = ({ }); + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + length = result$0; + offset += 2; + for (i = 0; i < length; i++) { + keyResult = new LoadedStringResult$SI(data, offset); + offset$0 = keyResult.offset; + valueResult = new LoadedStringListResult$SI(data, offset$0); + this.result[keyResult.result] = valueResult.result; + offset = valueResult.offset; + } + this.offset = offset; +}; + +LoadedStringListMapResult$SI.prototype = new LoadedStringListMapResult; + +/** + * class LoadedNumberListResult extends Object + * @constructor + */ +function LoadedNumberListResult() { +} + +/** + * @constructor + * @param {!string} data + * @param {!number} offset + */ +function LoadedNumberListResult$SI(data, offset) { + /** @type {!number} */ + var resultLength; + /** @type {!number} */ + var originalOffset; + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {!number} */ + var tag; + /** @type {!number} */ + var length; + /** @type {!number} */ + var i; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var value1$0; + this.result = null; + this.offset = 0; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + resultLength = result$0; + originalOffset = offset; + offset += 2; + result = [ ]; + while (result.length < resultLength) { + tag = data.charCodeAt(offset++); + if (tag >>> 15 === 1) { + value1$0 = resultLength - result.length; + length = (value1$0 <= 15 ? value1$0 : 15); + for (i = 0; i < length; i++) { + if (tag >>> i & 0x1) { + result.push(Binary$load32bitNumber$SI(data, offset)); + offset += 2; + } else { + result.push(0); + } + } + } else { + if (tag >>> 14 === 1) { + length = tag - 0x4000 + 1; + for (i = 0; i < length; i++) { + result.push(Binary$load32bitNumber$SI(data, offset)); + offset += 2; + } + } else { + length = tag + 1; + for (i = 0; i < length; i++) { + result.push(0); + } + } + } + } + this.result = result; + this.offset = offset; +}; + +LoadedNumberListResult$SI.prototype = new LoadedNumberListResult; + +/** + * class CompressionReport extends Object + * @constructor + */ +function CompressionReport() { +} + +/** + * @constructor + */ +function CompressionReport$() { + this.source = 0; + this.result = 0; +}; + +CompressionReport$.prototype = new CompressionReport; + +/** + * @param {CompressionReport} $this + * @param {!number} source + * @param {!number} result + */ +CompressionReport.add$LCompressionReport$II = function ($this, source, result) { + $this.source += source; + $this.result += result; +}; + +var CompressionReport$add$LCompressionReport$II = CompressionReport.add$LCompressionReport$II; + +/** + * @param {CompressionReport} $this + * @return {!number} + */ +CompressionReport.rate$LCompressionReport$ = function ($this) { + return (Math.round($this.result * 100.0 / $this.source) | 0); +}; + +var CompressionReport$rate$LCompressionReport$ = CompressionReport.rate$LCompressionReport$; + +/** + * class Query extends Object + * @constructor + */ +function Query() { +} + +/** + * @constructor + */ +function Query$() { + this.word = ''; + this.or = false; + this.not = false; + this.raw = false; +}; + +Query$.prototype = new Query; + +/** + * @return {!string} + */ +Query.prototype.toString = function () { + /** @type {Array.<undefined|!string>} */ + var result; + result = [ ]; + if (this.or) { + result.push("OR "); + } + if (this.not) { + result.push("-"); + } + if (this.raw) { + result.push('"', this.word, '"'); + } else { + result.push(this.word); + } + return result.join(''); +}; + +/** + * class QueryStringParser extends Object + * @constructor + */ +function QueryStringParser() { +} + +/** + * @constructor + */ +function QueryStringParser$() { + this.queries = [ ]; +}; + +QueryStringParser$.prototype = new QueryStringParser; + +/** + * @param {QueryStringParser} $this + * @param {!string} queryString + * @return {Array.<undefined|Query>} + */ +QueryStringParser.parse$LQueryStringParser$S = function ($this, queryString) { + /** @type {!boolean} */ + var nextOr; + /** @type {!boolean} */ + var nextNot; + /** @type {!number} */ + var currentWordStart; + /** @type {!number} */ + var status; + /** @type {RegExp} */ + var isSpace; + /** @type {!number} */ + var i; + /** @type {!string} */ + var ch; + /** @type {!string} */ + var word; + /** @type {Query} */ + var query; + nextOr = false; + nextNot = false; + currentWordStart = 0; + status = 0; + isSpace = /[\s\u3000]/; + for (i = 0; i < queryString.length; i++) { + ch = queryString.charAt(i); + switch (status) { + case 0: + if (! isSpace.test(ch)) { + if (ch === '-') { + nextNot = true; + } else { + if (ch === '"') { + currentWordStart = i + 1; + status = 2; + } else { + currentWordStart = i; + status = 1; + } + } + } else { + nextNot = false; + } + break; + case 1: + if (isSpace.test(ch)) { + word = queryString.slice(currentWordStart, i); + if (word === 'OR') { + nextOr = true; + } else { + query = new Query$(); + query.word = word; + query.or = nextOr; + query.not = nextNot; + $this.queries.push(query); + nextOr = false; + nextNot = false; + } + status = 0; + } + break; + case 2: + if (ch === '"') { + word = queryString.slice(currentWordStart, i); + query = new Query$(); + query.word = word; + query.or = nextOr; + query.not = nextNot; + query.raw = true; + $this.queries.push(query); + nextOr = false; + nextNot = false; + status = 0; + } + break; + } + } + switch (status) { + case 0: + break; + case 1: + query = new Query$(); + word = queryString.slice(currentWordStart, queryString.length); + if (word !== 'OR') { + query.word = word; + query.or = nextOr; + query.not = nextNot; + $this.queries.push(query); + } + break; + case 2: + query = new Query$(); + query.word = queryString.slice(currentWordStart, queryString.length); + query.or = nextOr; + query.not = nextNot; + query.raw = true; + $this.queries.push(query); + break; + } + return $this.queries; +}; + +var QueryStringParser$parse$LQueryStringParser$S = QueryStringParser.parse$LQueryStringParser$S; + +/** + * @param {QueryStringParser} $this + * @return {!string} + */ +QueryStringParser.highlight$LQueryStringParser$ = function ($this) { + /** @type {Array.<undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + /** @type {Query} */ + var query; + result = [ ]; + for (i = 0; i < $this.queries.length; i++) { + query = $this.queries[i]; + if (! query.not) { + result.push("highlight=" + $__jsx_encodeURIComponent(query.word)); + } + } + return '?' + result.join('&'); +}; + +var QueryStringParser$highlight$LQueryStringParser$ = QueryStringParser.highlight$LQueryStringParser$; + +/** + * class Proposal extends Object + * @constructor + */ +function Proposal() { +} + +/** + * @constructor + * @param {!number} omit + * @param {!number} expect + */ +function Proposal$II(omit, expect) { + this.omit = omit; + this.expect = expect; +}; + +Proposal$II.prototype = new Proposal; + +/** + * class Position extends Object + * @constructor + */ +function Position() { +} + +/** + * @constructor + * @param {!string} word + * @param {!number} position + * @param {!boolean} stemmed + */ +function Position$SIB(word, position, stemmed) { + this.word = word; + this.position = position; + this.stemmed = stemmed; +}; + +Position$SIB.prototype = new Position; + +/** + * class SearchUnit extends Object + * @constructor + */ +function SearchUnit() { +} + +/** + * @constructor + * @param {!number} id + */ +function SearchUnit$I(id) { + this.positions = ({ }); + this.id = id; + this._size = 0; + this.score = 0; + this.startPosition = -1; +}; + +SearchUnit$I.prototype = new SearchUnit; + +/** + * @param {SearchUnit} $this + * @param {!string} word + * @param {!number} position + * @param {!boolean} stemmed + */ +SearchUnit.addPosition$LSearchUnit$SIB = function ($this, word, position, stemmed) { + /** @type {Position} */ + var positionObj; + positionObj = $this.positions[position + ""]; + if (! positionObj) { + $this._size++; + $this.positions[position + ""] = ({word: word, position: position, stemmed: stemmed}); + } else { + if (positionObj.word.length < word.length) { + positionObj.word = word; + } + positionObj.stemmed = positionObj.stemmed && stemmed; + } +}; + +var SearchUnit$addPosition$LSearchUnit$SIB = SearchUnit.addPosition$LSearchUnit$SIB; + +/** + * @param {SearchUnit} $this + * @param {!number} position + * @return {Position} + */ +SearchUnit.get$LSearchUnit$I = function ($this, position) { + return $this.positions[position + ""]; +}; + +var SearchUnit$get$LSearchUnit$I = SearchUnit.get$LSearchUnit$I; + +/** + * @param {SearchUnit} $this + * @return {!number} + */ +SearchUnit.size$LSearchUnit$ = function ($this) { + return $this._size; +}; + +var SearchUnit$size$LSearchUnit$ = SearchUnit.size$LSearchUnit$; + +/** + * @param {SearchUnit} $this + * @param {SearchUnit} rhs + */ +SearchUnit.merge$LSearchUnit$LSearchUnit$ = function ($this, rhs) { + /** @type {!string} */ + var position; + /** @type {Position} */ + var pos; + for (position in rhs.positions) { + pos = rhs.positions[position]; + SearchUnit$addPosition$LSearchUnit$SIB($this, pos.word, pos.position, pos.stemmed); + } +}; + +var SearchUnit$merge$LSearchUnit$LSearchUnit$ = SearchUnit.merge$LSearchUnit$LSearchUnit$; + +/** + * @param {SearchUnit} $this + * @return {Array.<undefined|Position>} + */ +SearchUnit.getPositions$LSearchUnit$ = function ($this) { + /** @type {Array.<undefined|Position>} */ + var result; + /** @type {!string} */ + var pos; + result = [ ]; + for (pos in $this.positions) { + result.push($this.positions[pos]); + } + result.sort((function (a, b) { + return a.position - b.position; + })); + return result; +}; + +var SearchUnit$getPositions$LSearchUnit$ = SearchUnit.getPositions$LSearchUnit$; + +/** + * class SingleResult extends Object + * @constructor + */ +function SingleResult() { +} + +/** + * @constructor + */ +function SingleResult$() { + this.units = [ ]; + this.unitIds = [ ]; + this.or = false; + this.not = false; + this.searchWord = ''; +}; + +SingleResult$.prototype = new SingleResult; + +/** + * @constructor + * @param {!string} searchWord + * @param {!boolean} or + * @param {!boolean} not + */ +function SingleResult$SBB(searchWord, or, not) { + this.units = [ ]; + this.unitIds = [ ]; + this.or = or; + this.not = not; + this.searchWord = searchWord; +}; + +SingleResult$SBB.prototype = new SingleResult; + +/** + * @param {SingleResult} $this + * @param {!number} unitId + * @return {SearchUnit} + */ +SingleResult.getSearchUnit$LSingleResult$I = function ($this, unitId) { + /** @type {!number} */ + var existing; + /** @type {SearchUnit} */ + var result; + existing = $this.unitIds.indexOf(unitId); + if (existing === -1) { + result = ({positions: ({ }), id: unitId, _size: 0, score: 0, startPosition: -1}); + $this.units.push(result); + $this.unitIds.push(unitId); + } else { + result = $this.units[existing]; + } + return result; +}; + +var SingleResult$getSearchUnit$LSingleResult$I = SingleResult.getSearchUnit$LSingleResult$I; + +/** + * @param {SingleResult} $this + * @param {SingleResult} rhs + * @return {SingleResult} + */ +SingleResult.merge$LSingleResult$LSingleResult$ = function ($this, rhs) { + /** @type {SingleResult} */ + var result; + result = ({units: [ ], unitIds: [ ], or: false, not: false, searchWord: ''}); + if (rhs.or) { + SingleResult$_orMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } else { + if (rhs.not) { + SingleResult$_notMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } else { + SingleResult$_andMerge$LSingleResult$LSingleResult$LSingleResult$($this, result, rhs); + } + } + return result; +}; + +var SingleResult$merge$LSingleResult$LSingleResult$ = SingleResult.merge$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @return {!number} + */ +SingleResult.size$LSingleResult$ = function ($this) { + return ($this.units.length | 0); +}; + +var SingleResult$size$LSingleResult$ = SingleResult.size$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._andMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var lhsSection; + for (i = 0; i < $this.unitIds.length; i++) { + id = $this.unitIds[i]; + if (rhs.unitIds.indexOf(id) !== -1) { + lhsSection = $this.units[i]; + result.unitIds.push(id); + result.units.push(lhsSection); + } + } +}; + +var SingleResult$_andMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._andMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._orMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var rhsSection; + /** @type {SearchUnit} */ + var lhsSection; + /** @type {Array.<undefined|!number>} */ + var unitIds$0; + /** @type {Array.<undefined|SearchUnit>} */ + var units$0; + result.unitIds = (unitIds$0 = $this.unitIds).slice(0, unitIds$0.length); + result.units = (units$0 = $this.units).slice(0, units$0.length); + for (i = 0; i < rhs.unitIds.length; i++) { + id = rhs.unitIds[i]; + rhsSection = rhs.units[i]; + if (result.unitIds.indexOf(id) !== -1) { + lhsSection = result.units[result.unitIds.indexOf(id)]; + SearchUnit$merge$LSearchUnit$LSearchUnit$(lhsSection, rhsSection); + } else { + result.unitIds.push(id); + result.units.push(rhsSection); + } + } +}; + +var SingleResult$_orMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._orMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * @param {SingleResult} $this + * @param {SingleResult} result + * @param {SingleResult} rhs + */ +SingleResult._notMerge$LSingleResult$LSingleResult$LSingleResult$ = function ($this, result, rhs) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var id; + /** @type {SearchUnit} */ + var lhsSection; + for (i = 0; i < $this.unitIds.length; i++) { + id = $this.unitIds[i]; + if (rhs.unitIds.indexOf(id) === -1) { + lhsSection = $this.units[i]; + result.unitIds.push(id); + result.units.push(lhsSection); + } + } +}; + +var SingleResult$_notMerge$LSingleResult$LSingleResult$LSingleResult$ = SingleResult._notMerge$LSingleResult$LSingleResult$LSingleResult$; + +/** + * class SearchSummary extends Object + * @constructor + */ +function SearchSummary() { +} + +/** + * @constructor + */ +function SearchSummary$() { + this.sourceResults = [ ]; + this.result = null; + this.oktavia = null; +}; + +SearchSummary$.prototype = new SearchSummary; + +/** + * @constructor + * @param {Oktavia} oktavia + */ +function SearchSummary$LOktavia$(oktavia) { + this.sourceResults = [ ]; + this.result = null; + this.oktavia = oktavia; +}; + +SearchSummary$LOktavia$.prototype = new SearchSummary; + +/** + * @param {SearchSummary} $this + * @param {SingleResult} result + */ +SearchSummary.addQuery$LSearchSummary$LSingleResult$ = function ($this, result) { + $this.sourceResults.push(result); +}; + +var SearchSummary$addQuery$LSearchSummary$LSingleResult$ = SearchSummary.addQuery$LSearchSummary$LSingleResult$; + +/** + * @param {SearchSummary} $this + */ +SearchSummary.mergeResult$LSearchSummary$ = function ($this) { + $this.result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$($this, $this.sourceResults); +}; + +var SearchSummary$mergeResult$LSearchSummary$ = SearchSummary.mergeResult$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @param {Array.<undefined|SingleResult>} results + * @return {SingleResult} + */ +SearchSummary.mergeResult$LSearchSummary$ALSingleResult$ = function ($this, results) { + /** @type {SingleResult} */ + var rhs; + /** @type {!number} */ + var i; + /** @type {!number} */ + var results$len$0; + rhs = results[0]; + for ((i = 1, results$len$0 = results.length); i < results$len$0; i++) { + rhs = SingleResult$merge$LSingleResult$LSingleResult$(rhs, results[i]); + } + return rhs; +}; + +var SearchSummary$mergeResult$LSearchSummary$ALSingleResult$ = SearchSummary.mergeResult$LSearchSummary$ALSingleResult$; + +/** + * @param {SearchSummary} $this + * @return {Array.<undefined|Proposal>} + */ +SearchSummary.getProposal$LSearchSummary$ = function ($this) { + /** @type {Array.<undefined|Proposal>} */ + var proposals; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|SingleResult>} */ + var tmpSource; + /** @type {!number} */ + var j; + /** @type {SingleResult} */ + var result; + proposals = [ ]; + for (i = 0; i < $this.sourceResults.length; i++) { + tmpSource = [ ]; + for (j = 0; j < $this.sourceResults.length; j++) { + if (i !== j) { + tmpSource.push($this.sourceResults[j]); + } + } + result = SearchSummary$mergeResult$LSearchSummary$ALSingleResult$($this, tmpSource); + proposals.push(({omit: i, expect: result.units.length})); + } + proposals.sort((function (a, b) { + return b.expect - a.expect; + })); + return proposals; +}; + +var SearchSummary$getProposal$LSearchSummary$ = SearchSummary.getProposal$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @return {Array.<undefined|SearchUnit>} + */ +SearchSummary.getSortedResult$LSearchSummary$ = function ($this) { + /** @type {Array.<undefined|SearchUnit>} */ + var result; + /** @type {Array.<undefined|SearchUnit>} */ + var units$0; + result = (units$0 = $this.result.units).slice(0, units$0.length); + result.sort((function (a, b) { + return b.score - a.score; + })); + return result; +}; + +var SearchSummary$getSortedResult$LSearchSummary$ = SearchSummary.getSortedResult$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @return {!number} + */ +SearchSummary.size$LSearchSummary$ = function ($this) { + /** @type {SingleResult} */ + var this$0; + this$0 = $this.result; + return (this$0.units.length | 0); +}; + +var SearchSummary$size$LSearchSummary$ = SearchSummary.size$LSearchSummary$; + +/** + * @param {SearchSummary} $this + * @param {SingleResult} result + */ +SearchSummary.add$LSearchSummary$LSingleResult$ = function ($this, result) { + $this.sourceResults.push(result); +}; + +var SearchSummary$add$LSearchSummary$LSingleResult$ = SearchSummary.add$LSearchSummary$LSingleResult$; + +/** + * class Style extends Object + * @constructor + */ +function Style() { +} + +/** + * @constructor + * @param {!string} mode + */ +function Style$S(mode) { + this.styles = null; + this.escapeHTML = false; + switch (mode) { + case 'console': + this.styles = Style.console; + break; + case 'html': + this.styles = Style.html; + break; + case 'ignore': + this.styles = Style.ignore; + break; + default: + this.styles = Style.ignore; + break; + } + this.escapeHTML = mode === 'html'; +}; + +Style$S.prototype = new Style; + +/** + * @param {!string} source + * @return {!string} + */ +Style.prototype.convert$S = function (source) { + /** @type {_HTMLHandler} */ + var handler; + /** @type {SAXParser} */ + var parser; + handler = new _HTMLHandler$HASB(this.styles, this.escapeHTML); + parser = new SAXParser$LSAXHandler$(handler); + parser.parse$S(source); + return handler.text.join(''); +}; + +/** + * class Stemmer + * @constructor + */ +function Stemmer() { +} + +Stemmer.prototype.$__jsx_implements_Stemmer = true; + +/** + * @constructor + */ +function Stemmer$() { +}; + +Stemmer$.prototype = new Stemmer; + +/** + * class Metadata extends Object + * @constructor + */ +function Metadata() { +} + +/** + * @constructor + * @param {Oktavia} parent + */ +function Metadata$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); +}; + +Metadata$LOktavia$.prototype = new Metadata; + +/** + * @return {!number} + */ +Metadata.prototype._size$ = function () { + /** @type {BitVector} */ + var this$0; + /** @type {!number} */ + var i$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0 = _bitVector$0 = this._bitVector; + i$0 = _bitVector$0._size; + return this$0.rank$IB(i$0, true); +}; + +/** + * @param {!number} index + * @return {!string} + */ +Metadata.prototype.getContent$I = function (index) { + /** @type {!number} */ + var startPosition; + /** @type {!number} */ + var length; + if (index < 0 || this._size$() <= index) { + throw new Error("Section.getContent() : range error " + (index + "")); + } + startPosition = 0; + if (index > 0) { + startPosition = this._bitVector.select$I(index - 1) + 1; + } + length = this._bitVector.select$I(index) - startPosition + 1; + return this._parent._getSubstring$II(startPosition, length); +}; + +/** + * @param {!number} index + * @return {!number} + */ +Metadata.prototype.getStartPosition$I = function (index) { + /** @type {!number} */ + var startPosition; + if (index < 0 || this._size$() <= index) { + throw new Error("Section.getContent() : range error " + (index + "")); + } + startPosition = 0; + if (index > 0) { + startPosition = this._bitVector.select$I(index - 1) + 1; + } + return (startPosition | 0); +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Metadata.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Metadata.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + */ +Metadata.prototype._build$ = function () { + this._bitVector.build$(); +}; + +/** + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Metadata.prototype._load$SSI = function (name, data, offset) { + offset = this._bitVector.load$SI(data, offset); + this._parent._metadataLabels.push(name); + this._parent._metadatas[name] = this; + return offset; +}; + +/** + * @return {!string} + */ +Metadata.prototype._dump$ = function () { + /** @type {BitVector} */ + var this$0; + /** @type {Array.<undefined|!string>} */ + var contents$0; + this$0 = this._bitVector; + contents$0 = [ ]; + contents$0.push(Binary$dump32bitNumber$N(this$0._size)); + contents$0.push(Binary$dump32bitNumberList$AN(this$0._v)); + return contents$0.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Metadata.prototype._dump$LCompressionReport$ = function (report) { + /** @type {BitVector} */ + var this$0; + /** @type {Array.<undefined|!string>} */ + var contents$0; + this$0 = this._bitVector; + contents$0 = [ ]; + contents$0.push(Binary$dump32bitNumber$N(this$0._size)); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents$0.push(Binary$dump32bitNumberList$ANLCompressionReport$(this$0._v, report)); + return contents$0.join(''); +}; + +/** + * class Section extends Metadata + * @constructor + */ +function Section() { +} + +Section.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Section$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._names = [ ]; +}; + +Section$LOktavia$.prototype = new Section; + +/** + * @param {!string} name + */ +Section.prototype.setTail$S = function (name) { + /** @type {!number} */ + var index$0; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index$0 = this$0$0._substr.length; + this._names.push(name); + this._bitVector.set$I(index$0 - 1); +}; + +/** + * @param {!string} name + * @param {!number} index + */ +Section.prototype.setTail$SI = function (name, index) { + this._names.push(name); + this._bitVector.set$I(index - 1); +}; + +/** + * @return {!number} + */ +Section.prototype.size$ = function () { + return (this._names.length | 0); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Section.prototype.getSectionIndex$I = function (position) { + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error " + (position + "")); + } + this$0 = this._bitVector; + return this$0.rank$IB(position, true); +}; + +/** + * @param {!number} index + * @return {!string} + */ +Section.prototype.getName$I = function (index) { + if (index < 0 || this._names.length <= index) { + throw new Error("Section.getName() : range error"); + } + return this._names[index]; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Section.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var position; + /** @type {!number} */ + var index; + /** @type {SearchUnit} */ + var unit; + for (i = 0; i < positions.length; i++) { + position = positions[i]; + index = this.getSectionIndex$I(position); + unit = SingleResult$getSearchUnit$LSingleResult$I(result, index); + if (unit.startPosition < 0) { + unit.startPosition = this.getStartPosition$I(index); + } + SearchUnit$addPosition$LSearchUnit$SIB(unit, word, position - unit.startPosition, stemmed); + } +}; + +/** + * @param {!number} index + * @return {!string} + */ +Section.prototype.getInformation$I = function (index) { + return this.getName$I(index); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Section._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Section} */ + var section; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + section = new Section$LOktavia$(parent); + section._names = strs.result; + offset$0 = strs.offset; + offset$0 = section._bitVector.load$SI(data, offset$0); + section._parent._metadataLabels.push(name); + section._parent._metadatas[name] = section; + return offset$0; +}; + +var Section$_load$LOktavia$SSI = Section._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Section.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(0), Binary$dumpStringList$AS(this._names), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Section.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(0), Binary$dumpStringList$ASLCompressionReport$(this._names, report), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class Splitter extends Metadata + * @constructor + */ +function Splitter() { +} + +Splitter.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Splitter$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this.name = null; +}; + +Splitter$LOktavia$.prototype = new Splitter; + +/** + * @constructor + * @param {Oktavia} parent + * @param {!string} name + */ +function Splitter$LOktavia$S(parent, name) { + this._parent = parent; + this._bitVector = new BitVector$(); + this.name = name; +}; + +Splitter$LOktavia$S.prototype = new Splitter; + +/** + * @return {!number} + */ +Splitter.prototype.size$ = function () { + /** @type {BitVector} */ + var this$0$0; + /** @type {!number} */ + var i$0$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0$0 = _bitVector$0 = this._bitVector; + i$0$0 = _bitVector$0._size; + return this$0$0.rank$IB(i$0$0, true); +}; + +/** + */ +Splitter.prototype.split$ = function () { + /** @type {!number} */ + var index$0; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index$0 = this$0$0._substr.length; + this._bitVector.set$I(index$0 - 1); +}; + +/** + * @param {!number} index + */ +Splitter.prototype.split$I = function (index) { + this._bitVector.set$I(index - 1); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Splitter.prototype.getIndex$I = function (position) { + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error"); + } + this$0 = this._bitVector; + return this$0.rank$IB(position, true); +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Splitter.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { + /** @type {!number} */ + var i; + /** @type {undefined|!number} */ + var position; + /** @type {!number} */ + var index; + /** @type {SearchUnit} */ + var unit; + for (i = 0; i < positions.length; i++) { + position = positions[i]; + index = this.getIndex$I(position); + unit = SingleResult$getSearchUnit$LSingleResult$I(result, index); + if (unit.startPosition < 0) { + unit.startPosition = this.getStartPosition$I(index); + } + SearchUnit$addPosition$LSearchUnit$SIB(unit, word, position - unit.startPosition, stemmed); + } +}; + +/** + * @param {!number} index + * @return {!string} + */ +Splitter.prototype.getInformation$I = function (index) { + return (this.name != null ? this.name + (index + 1 + "") : ''); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Splitter._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {Splitter} */ + var section; + section = new Splitter$LOktavia$(parent); + offset = section._bitVector.load$SI(data, offset); + section._parent._metadataLabels.push(name); + section._parent._metadatas[name] = section; + return offset; +}; + +var Splitter$_load$LOktavia$SSI = Splitter._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Splitter.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(1), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Splitter.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(1), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class Table extends Metadata + * @constructor + */ +function Table() { +} + +Table.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + * @param {Array.<undefined|!string>} headers + */ +function Table$LOktavia$AS(parent, headers) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._headers = headers; + this._columnTails = new BitVector$(); +}; + +Table$LOktavia$AS.prototype = new Table; + +/** + * @return {!number} + */ +Table.prototype.rowSize$ = function () { + /** @type {BitVector} */ + var this$0$0; + /** @type {!number} */ + var i$0$0; + /** @type {BitVector} */ + var _bitVector$0; + this$0$0 = _bitVector$0 = this._bitVector; + i$0$0 = _bitVector$0._size; + return this$0$0.rank$IB(i$0$0, true); +}; + +/** + * @return {!number} + */ +Table.prototype.columnSize$ = function () { + return (this._headers.length | 0); +}; + +/** + */ +Table.prototype.setColumnTail$ = function () { + /** @type {!number} */ + var index; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + /** @type {Oktavia} */ + var _parent$0; + this$0 = _parent$0 = this._parent; + this$0$0 = this$0._fmindex; + index = this$0$0._substr.length; + _parent$0._fmindex.push$S(Oktavia.eob); + this._columnTails.set$I(index - 1); +}; + +/** + */ +Table.prototype.setRowTail$ = function () { + /** @type {!number} */ + var index; + /** @type {Oktavia} */ + var this$0; + /** @type {FMIndex} */ + var this$0$0; + this$0 = this._parent; + this$0$0 = this$0._fmindex; + index = this$0$0._substr.length; + this._bitVector.set$I(index - 1); +}; + +/** + * @param {!number} position + * @return {Array.<undefined|!number>} + */ +Table.prototype.getCell$I = function (position) { + /** @type {!number} */ + var row; + /** @type {!number} */ + var currentColumn; + /** @type {!number} */ + var lastRowColumn; + /** @type {!number} */ + var startPosition; + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {BitVector} */ + var this$0; + /** @type {BitVector} */ + var this$1; + if (position < 0 || this._bitVector.size$() <= position) { + throw new Error("Section.getSectionIndex() : range error " + (position + "")); + } + this$0 = this._bitVector; + row = this$0.rank$IB(position, true); + this$1 = this._columnTails; + currentColumn = this$1.rank$IB(position, true); + lastRowColumn = 0; + if (row > 0) { + startPosition = this._bitVector.select$I(row - 1) + 1; + lastRowColumn = this._columnTails.rank$I(startPosition); + } + result = [ row, currentColumn - lastRowColumn ]; + return result; +}; + +/** + * @param {!number} rowIndex + * @return {Object.<string, undefined|!string>} + */ +Table.prototype.getRowContent$I = function (rowIndex) { + /** @type {!string} */ + var content; + /** @type {Array.<undefined|!string>} */ + var values; + /** @type {Object.<string, undefined|!string>} */ + var result; + /** @type {!number} */ + var i; + content = this.getContent$I(rowIndex); + values = content.split(Oktavia.eob, this._headers.length); + result = ({ }); + for (i in this._headers) { + if (i < values.length) { + result[this._headers[i]] = values[i]; + } else { + result[this._headers[i]] = ''; + } + } + return result; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Table.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Table.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + */ +Table.prototype._build$ = function () { + this._bitVector.build$(); + this._columnTails.build$(); +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Table._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Table} */ + var table; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + table = new Table$LOktavia$AS(parent, strs.result); + offset$0 = strs.offset; + offset$0 = table._bitVector.load$SI(data, offset$0); + table._parent._metadataLabels.push(name); + table._parent._metadatas[name] = table; + offset = offset$0; + return table._columnTails.load$SI(data, offset$0); +}; + +var Table$_load$LOktavia$SSI = Table._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Table.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(2), Binary$dumpStringList$AS(this._headers), Metadata.prototype._dump$.call(this), this._columnTails.dump$() ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Table.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(2), Binary$dumpStringList$ASLCompressionReport$(this._headers, report), Metadata.prototype._dump$LCompressionReport$.call(this, report), this._columnTails.dump$LCompressionReport$(report) ].join(''); +}; + +/** + * class Block extends Metadata + * @constructor + */ +function Block() { +} + +Block.prototype = new Metadata; +/** + * @constructor + * @param {Oktavia} parent + */ +function Block$LOktavia$(parent) { + this._parent = parent; + this._bitVector = new BitVector$(); + this._names = [ ]; + this._start = false; +}; + +Block$LOktavia$.prototype = new Block; + +/** + * @param {!string} blockName + */ +Block.prototype.startBlock$S = function (blockName) { + this.startBlock$SI(blockName, this._parent.contentSize$()); +}; + +/** + * @param {!string} blockName + * @param {!number} index + */ +Block.prototype.startBlock$SI = function (blockName, index) { + if (this._start) { + throw new Error('Splitter `' + this._names[this._names.length - 1] + '` is not closed'); + } + this._start = true; + this._names.push(blockName); + this._bitVector.set$I(index - 1); +}; + +/** + */ +Block.prototype.endBlock$ = function () { + this.endBlock$I(this._parent.contentSize$()); +}; + +/** + * @param {!number} index + */ +Block.prototype.endBlock$I = function (index) { + if (! this._start) { + throw new Error('Splitter is not started'); + } + this._start = false; + this._bitVector.set$I(index - 1); +}; + +/** + * @return {!number} + */ +Block.prototype.size$ = function () { + return (this._names.length | 0); +}; + +/** + * @param {!number} position + * @return {!number} + */ +Block.prototype.blockIndex$I = function (position) { + /** @type {!number} */ + var result; + /** @type {BitVector} */ + var this$0; + if (position < 0 || this._parent._fmindex.size$() - 1 <= position) { + throw new Error("Block.blockIndex() : range error " + (position + "")); + } + if (position >= this._bitVector.size$()) { + position = (this._bitVector.size$() - 1 | 0); + result = (this._bitVector.rank$I(position) + 1 | 0); + } else { + this$0 = this._bitVector; + result = this$0.rank$IB(position, true); + } + return result; +}; + +/** + * @param {!number} position + * @return {!boolean} + */ +Block.prototype.inBlock$I = function (position) { + /** @type {!number} */ + var blockIndex; + blockIndex = this.blockIndex$I(position); + return blockIndex % 2 !== 0; +}; + +/** + * @param {!number} position + * @return {!string} + */ +Block.prototype.getBlockContent$I = function (position) { + /** @type {!number} */ + var blockIndex; + /** @type {!string} */ + var result; + blockIndex = this.blockIndex$I(position); + if (blockIndex % 2 !== 0) { + result = this.getContent$I(blockIndex); + } else { + result = ''; + } + return result; +}; + +/** + * @param {!number} position + * @return {!string} + */ +Block.prototype.getBlockName$I = function (position) { + /** @type {!number} */ + var blockIndex; + /** @type {!string} */ + var result; + blockIndex = this.blockIndex$I(position); + if (blockIndex % 2 !== 0) { + result = this._names[blockIndex >>> 1]; + } else { + result = ''; + } + return result; +}; + +/** + * @param {SingleResult} result + * @param {Array.<undefined|!number>} positions + * @param {!string} word + * @param {!boolean} stemmed + */ +Block.prototype.grouping$LSingleResult$AISB = function (result, positions, word, stemmed) { +}; + +/** + * @param {!number} index + * @return {!string} + */ +Block.prototype.getInformation$I = function (index) { + return ''; +}; + +/** + * @param {Oktavia} parent + * @param {!string} name + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +Block._load$LOktavia$SSI = function (parent, name, data, offset) { + /** @type {LoadedStringListResult} */ + var strs; + /** @type {Block} */ + var block; + /** @type {!number} */ + var offset$0; + strs = new LoadedStringListResult$SI(data, offset); + block = new Block$LOktavia$(parent); + block._names = strs.result; + offset$0 = strs.offset; + offset$0 = block._bitVector.load$SI(data, offset$0); + block._parent._metadataLabels.push(name); + block._parent._metadatas[name] = block; + return offset$0; +}; + +var Block$_load$LOktavia$SSI = Block._load$LOktavia$SSI; + +/** + * @return {!string} + */ +Block.prototype._dump$ = function () { + return [ Binary$dump16bitNumber$I(3), Binary$dumpStringList$AS(this._names), Metadata.prototype._dump$.call(this) ].join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +Block.prototype._dump$LCompressionReport$ = function (report) { + CompressionReport$add$LCompressionReport$II(report, 1, 1); + return [ Binary$dump16bitNumber$I(3), Binary$dumpStringList$ASLCompressionReport$(this._names, report), Metadata.prototype._dump$LCompressionReport$.call(this, report) ].join(''); +}; + +/** + * class FMIndex extends Object + * @constructor + */ +function FMIndex() { +} + +/** + * @constructor + */ +function FMIndex$() { + /** @type {Array.<undefined|!number>} */ + var _rlt$0; + this._ssize = 0; + (this._ddic = 0, this._head = 0); + this._substr = ""; + this._sv = new WaveletMatrix$(); + this._posdic = [ ]; + this._idic = [ ]; + _rlt$0 = this._rlt = [ ]; + _rlt$0.length = 65536; +}; + +FMIndex$.prototype = new FMIndex; + +/** + */ +FMIndex.prototype.clear$ = function () { + /** @type {WaveletMatrix} */ + var this$0; + this$0 = this._sv; + this$0._bv.length = 0; + this$0._seps.length = 0; + this$0._size = 0; + this._posdic.length = 0; + this._idic.length = 0; + this._ddic = 0; + this._head = 0; + this._substr = ""; +}; + +/** + * @return {!number} + */ +FMIndex.prototype.size$ = function () { + /** @type {WaveletMatrix} */ + var this$0; + this$0 = this._sv; + return this$0._size; +}; + +/** + * @return {!number} + */ +FMIndex.prototype.contentSize$ = function () { + return this._substr.length; +}; + +/** + * @param {!string} key + * @return {!number} + */ +FMIndex.prototype.getRows$S = function (key) { + /** @type {Array.<undefined|!number>} */ + var pos; + pos = [ ]; + return this.getRows$SAI(key, pos); +}; + +/** + * @param {!string} key + * @param {Array.<undefined|!number>} pos + * @return {!number} + */ +FMIndex.prototype.getRows$SAI = function (key, pos) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {!number} */ + var first; + /** @type {undefined|!number} */ + var last; + /** @type {!number} */ + var c; + /** @type {Array.<undefined|!number>} */ + var _rlt$0; + i = key.length - 1; + code = key.charCodeAt(i); + first = (_rlt$0 = this._rlt)[code] + 1; + last = _rlt$0[code + 1]; + while (first <= last) { + if (i === 0) { + pos[0] = (-- first | 0); + pos[1] = -- last; + return (last - first + 1 | 0); + } + i--; + c = key.charCodeAt(i); + first = this._rlt[c] + this._sv.rank$II(first - 1, c) + 1; + last = this._rlt[c] + this._sv.rank$II(last, c); + } + return 0; +}; + +/** + * @param {!number} i + * @return {!number} + */ +FMIndex.prototype.getPosition$I = function (i) { + /** @type {!number} */ + var pos; + /** @type {!number} */ + var c; + if (i >= this.size$()) { + throw new Error("FMIndex.getPosition() : range error"); + } + pos = 0; + while (i !== this._head) { + if (i % this._ddic === 0) { + pos += this._posdic[i / this._ddic] + 1; + break; + } + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + pos++; + } + return (pos % this.size$() | 0); +}; + +/** + * @param {!number} pos + * @param {!number} len + * @return {!string} + */ +FMIndex.prototype.getSubstring$II = function (pos, len) { + /** @type {!number} */ + var pos_end; + /** @type {!number} */ + var pos_tmp; + /** @type {!number} */ + var i; + /** @type {!number} */ + var pos_idic; + /** @type {!string} */ + var substr; + /** @type {!number} */ + var c; + /** @type {!number} */ + var _ddic$0; + if (pos >= this.size$()) { + throw new Error("FMIndex.getSubstring() : range error"); + } + pos_end = Math.min(pos + len, this.size$()); + pos_tmp = this.size$() - 1; + i = this._head; + pos_idic = Math.floor((pos_end + (_ddic$0 = this._ddic) - 2) / _ddic$0); + if (pos_idic < this._idic.length) { + pos_tmp = pos_idic * this._ddic; + i = this._idic[pos_idic]; + } + substr = ""; + while (pos_tmp >= pos) { + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + if (pos_tmp < pos_end) { + substr = String.fromCharCode(c) + substr; + } + if (pos_tmp === 0) { + break; + } + pos_tmp--; + } + return substr; +}; + +/** + */ +FMIndex.prototype.build$ = function () { + this.build$SIIB(String.fromCharCode(0), 65535, 20, false); +}; + +/** + * @param {!string} end_marker + * @param {!number} ddic + * @param {!boolean} verbose + */ +FMIndex.prototype.build$SIB = function (end_marker, ddic, verbose) { + this.build$SIIB(end_marker, 65535, ddic, verbose); +}; + +/** + * @param {!string} end_marker + * @param {!number} maxChar + * @param {!number} ddic + * @param {!boolean} verbose + */ +FMIndex.prototype.build$SIIB = function (end_marker, maxChar, ddic, verbose) { + /** @type {BurrowsWheelerTransform} */ + var b; + /** @type {!string} */ + var s; + /** @type {!number} */ + var c; + /** @type {!string} */ + var str$0; + /** @type {WaveletMatrix} */ + var this$0; + /** @type {!string} */ + var _str$0; + /** @type {Array.<undefined|!number>} */ + var _suffixarray$0; + if (verbose) { + console.time("building burrows-wheeler transform"); + } + this._substr += end_marker; + b = ({_str: "", _size: 0, _head: 0, _suffixarray: [ ]}); + str$0 = this._substr; + _str$0 = b._str = str$0; + b._size = _str$0.length; + _suffixarray$0 = b._suffixarray = SAIS$make$S(str$0); + b._head = (_suffixarray$0.indexOf(0) | 0); + s = BurrowsWheelerTransform$get$LBurrowsWheelerTransform$(b); + this._ssize = s.length; + this._head = b._head; + b._str = ""; + b._size = 0; + b._head = 0; + b._suffixarray.length = 0; + this._substr = ""; + if (verbose) { + console.timeEnd("building burrows-wheeler transform"); + } + if (verbose) { + console.time("building wavelet matrix"); + } + this$0 = this._sv; + this$0._bitsize = (Math.ceil(Math.log(maxChar) / 0.6931471805599453) | 0); + if (verbose) { + console.log(" maxCharCode: ", maxChar); + console.log(" bitSize: ", this._sv.bitsize$()); + } + this._sv.build$S(s); + if (verbose) { + console.timeEnd("building wavelet matrix"); + } + if (verbose) { + console.time("caching rank less than"); + } + for (c = 0; c < maxChar; c++) { + this._rlt[c] = this._sv.rank_less_than$II(this._sv.size$(), c); + } + if (verbose) { + console.timeEnd("caching rank less than"); + } + this._ddic = ddic; + if (verbose) { + console.time("building dictionaries"); + } + this._buildDictionaries$(); + if (verbose) { + console.timeEnd("building dictionaries"); + console.log(''); + } +}; + +/** + */ +FMIndex.prototype._buildDictionaries$ = function () { + /** @type {!number} */ + var i; + /** @type {!number} */ + var pos; + /** @type {!number} */ + var c; + for (i = 0; i < this._ssize / this._ddic + 1; i++) { + this._posdic.push(0); + this._idic.push(0); + } + i = this._head; + pos = this.size$() - 1; + do { + if (i % this._ddic === 0) { + this._posdic[Math.floor(i / this._ddic)] = (pos | 0); + } + if (pos % this._ddic === 0) { + this._idic[Math.floor(pos / this._ddic)] = (i | 0); + } + c = this._sv.get$I(i); + i = this._rlt[c] + this._sv.rank$II(i, c); + pos--; + } while (i !== this._head); +}; + +/** + * @param {!string} doc + */ +FMIndex.prototype.push$S = function (doc) { + if (doc.length <= 0) { + throw new Error("FMIndex::push(): empty string"); + } + this._substr += doc; +}; + +/** + * @param {!string} keyword + * @return {Array.<undefined|!number>} + */ +FMIndex.prototype.search$S = function (keyword) { + /** @type {Array.<undefined|!number>} */ + var result; + /** @type {Array.<undefined|!number>} */ + var position; + /** @type {!number} */ + var rows; + /** @type {undefined|!number} */ + var first; + /** @type {undefined|!number} */ + var last; + /** @type {undefined|!number} */ + var i; + result = [ ]; + position = [ ]; + rows = this.getRows$SAI(keyword, position); + if (rows > 0) { + first = position[0]; + last = position[1]; + for (i = first; i <= last; i++) { + result.push(this.getPosition$I(i)); + } + } + return result; +}; + +/** + * @return {!string} + */ +FMIndex.prototype.dump$ = function () { + return this.dump$B(false); +}; + +/** + * @param {!boolean} verbose + * @return {!string} + */ +FMIndex.prototype.dump$B = function (verbose) { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {CompressionReport} */ + var report; + /** @type {!number} */ + var i; + contents = [ ]; + report = ({source: 0, result: 0}); + contents.push(Binary$dump32bitNumber$N(this._ddic)); + contents.push(Binary$dump32bitNumber$N(this._ssize)); + contents.push(Binary$dump32bitNumber$N(this._head)); + CompressionReport$add$LCompressionReport$II(report, 6, 6); + contents.push(this._sv.dump$LCompressionReport$(report)); + if (verbose) { + console.log("Serializing FM-index"); + console.log(' Wavelet Matrix: ' + (contents[3].length * 2 + "") + ' bytes (' + (Math.round(report.result * 100.0 / report.source) + "") + '%)'); + } + contents.push(Binary$dump32bitNumber$N(this._posdic.length)); + for (i in this._posdic) { + contents.push(Binary$dump32bitNumber$N(this._posdic[i])); + } + for (i in this._idic) { + contents.push(Binary$dump32bitNumber$N(this._idic[i])); + } + if (verbose) { + console.log(' Dictionary Cache: ' + (this._idic.length * 16 + "") + ' bytes'); + } + return contents.join(""); +}; + +/** + * @param {!string} data + * @return {!number} + */ +FMIndex.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +FMIndex.prototype.load$SI = function (data, offset) { + /** @type {!number} */ + var maxChar; + /** @type {!number} */ + var c; + /** @type {!number} */ + var size; + /** @type {!number} */ + var i; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var result$1; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._ddic = (result$0 | 0); + this._ssize = (Binary$load32bitNumber$SI(data, offset + 2) | 0); + this._head = (Binary$load32bitNumber$SI(data, offset + 4) | 0); + offset = this._sv.load$SI(data, offset + 6); + maxChar = Math.pow(2, this._sv.bitsize$()); + for (c = 0; c < maxChar; c++) { + this._rlt[c] = this._sv.rank_less_than$II(this._sv.size$(), c); + } + result$1 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + size = result$1; + offset += 2; + for (i = 0; i < size; (i++, offset += 2)) { + this._posdic.push(Binary$load32bitNumber$SI(data, offset)); + } + for (i = 0; i < size; (i++, offset += 2)) { + this._idic.push(Binary$load32bitNumber$SI(data, offset)); + } + return offset; +}; + +/** + * class Tag extends Object + * @constructor + */ +function Tag() { +} + +/** + * @constructor + * @param {!string} name + */ +function Tag$S(name) { + this.name = name; + this.attributes = ({ }); + this.isSelfClosing = false; +}; + +Tag$S.prototype = new Tag; + +/** + * class _Common extends Object + * @constructor + */ +function _Common() { +} + +/** + * @constructor + */ +function _Common$() { +}; + +_Common$.prototype = new _Common; + +/** + * class _State extends Object + * @constructor + */ +function _State() { +} + +/** + * @constructor + */ +function _State$() { +}; + +_State$.prototype = new _State; + +/** + * class SAXHandler extends Object + * @constructor + */ +function SAXHandler() { +} + +/** + * @constructor + */ +function SAXHandler$() { + this.position = 0; + this.column = 0; + this.line = 0; +}; + +SAXHandler$.prototype = new SAXHandler; + +/** + * @param {Error} error + */ +SAXHandler.prototype.onerror$LError$ = function (error) { +}; + +/** + * @param {!string} text + */ +SAXHandler.prototype.ontext$S = function (text) { +}; + +/** + * @param {!string} doctype + */ +SAXHandler.prototype.ondoctype$S = function (doctype) { +}; + +/** + * @param {!string} name + * @param {!string} body + */ +SAXHandler.prototype.onprocessinginstruction$SS = function (name, body) { +}; + +/** + * @param {!string} sgmlDecl + */ +SAXHandler.prototype.onsgmldeclaration$S = function (sgmlDecl) { +}; + +/** + * @param {!string} tagname + * @param {Object.<string, undefined|!string>} attributes + */ +SAXHandler.prototype.onopentag$SHS = function (tagname, attributes) { +}; + +/** + * @param {!string} tagname + */ +SAXHandler.prototype.onclosetag$S = function (tagname) { +}; + +/** + * @param {!string} name + * @param {!string} value + */ +SAXHandler.prototype.onattribute$SS = function (name, value) { +}; + +/** + * @param {!string} comment + */ +SAXHandler.prototype.oncomment$S = function (comment) { +}; + +/** + */ +SAXHandler.prototype.onopencdata$ = function () { +}; + +/** + * @param {!string} cdata + */ +SAXHandler.prototype.oncdata$S = function (cdata) { +}; + +/** + */ +SAXHandler.prototype.onclosecdata$ = function () { +}; + +/** + */ +SAXHandler.prototype.onend$ = function () { +}; + +/** + */ +SAXHandler.prototype.onready$ = function () { +}; + +/** + * @param {!string} script + */ +SAXHandler.prototype.onscript$S = function (script) { +}; + +/** + * class _HTMLHandler extends SAXHandler + * @constructor + */ +function _HTMLHandler() { +} + +_HTMLHandler.prototype = new SAXHandler; +/** + * @constructor + * @param {Object.<string, undefined|Array.<undefined|!string>>} styles + * @param {!boolean} escape + */ +function _HTMLHandler$HASB(styles, escape) { + this.position = 0; + this.column = 0; + this.line = 0; + this.text = [ ]; + this.escape = escape; + this.styles = styles; +}; + +_HTMLHandler$HASB.prototype = new _HTMLHandler; + +/** + * @param {!string} str + * @return {!string} + */ +_HTMLHandler.escapeHTML$S = function (str) { + return str.replace(/\n/g, "<br/>").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"); +}; + +var _HTMLHandler$escapeHTML$S = _HTMLHandler.escapeHTML$S; + +/** + * @param {!string} tagname + * @param {Object.<string, undefined|!string>} attributes + */ +_HTMLHandler.prototype.onopentag$SHS = function (tagname, attributes) { + this.text.push(this.styles[tagname][0]); +}; + +/** + * @param {!string} tagname + */ +_HTMLHandler.prototype.onclosetag$S = function (tagname) { + this.text.push(this.styles[tagname][1]); +}; + +/** + * @param {!string} text + */ +_HTMLHandler.prototype.ontext$S = function (text) { + if (this.escape) { + this.text.push(text.replace(/\n/g, "<br/>").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">")); + } else { + this.text.push(text); + } +}; + +/** + * @return {!string} + */ +_HTMLHandler.prototype.result$ = function () { + return this.text.join(''); +}; + +/** + * class SAXParser extends Object + * @constructor + */ +function SAXParser() { +} + +/** + * @constructor + * @param {SAXHandler} handler + */ +function SAXParser$LSAXHandler$(handler) { + this.q = ""; + this.c = ""; + this.bufferCheckPosition = 0; + this.looseCase = ""; + this.tags = [ ]; + this.closed = false; + this.closedRoot = false; + this.sawRoot = false; + this.tag = null; + this.error = null; + this.handler = null; + this.ENTITIES = null; + this.strict = false; + this.tagName = ""; + this.state = 0; + this.line = 0; + this.column = 0; + this.position = 0; + this.startTagPosition = 0; + this.attribName = ""; + this.attribValue = ""; + this.script = ""; + this.textNode = ""; + this.attribList = null; + this.noscript = false; + this.cdata = ""; + this.procInstBody = ""; + this.procInstName = ""; + this.doctype = ""; + this.entity = ""; + this.sgmlDecl = ""; + this.comment = ""; + this.preTags = 0; + this._init$LSAXHandler$B(handler, false); +}; + +SAXParser$LSAXHandler$.prototype = new SAXParser; + +/** + * @constructor + * @param {SAXHandler} handler + * @param {!boolean} strict + */ +function SAXParser$LSAXHandler$B(handler, strict) { + this.q = ""; + this.c = ""; + this.bufferCheckPosition = 0; + this.looseCase = ""; + this.tags = [ ]; + this.closed = false; + this.closedRoot = false; + this.sawRoot = false; + this.tag = null; + this.error = null; + this.handler = null; + this.ENTITIES = null; + this.strict = false; + this.tagName = ""; + this.state = 0; + this.line = 0; + this.column = 0; + this.position = 0; + this.startTagPosition = 0; + this.attribName = ""; + this.attribValue = ""; + this.script = ""; + this.textNode = ""; + this.attribList = null; + this.noscript = false; + this.cdata = ""; + this.procInstBody = ""; + this.procInstName = ""; + this.doctype = ""; + this.entity = ""; + this.sgmlDecl = ""; + this.comment = ""; + this.preTags = 0; + this._init$LSAXHandler$B(handler, strict); +}; + +SAXParser$LSAXHandler$B.prototype = new SAXParser; + +/** + * @param {SAXHandler} handler + * @param {!boolean} strict + */ +SAXParser.prototype._init$LSAXHandler$B = function (handler, strict) { + this.handler = handler; + this.clearBuffers$(); + this.q = ""; + this.bufferCheckPosition = 65536; + this.looseCase = 'toLowerCase'; + this.tags = [ ]; + this.closed = this.closedRoot = this.sawRoot = false; + this.tag = null; + this.error = null; + this.strict = strict; + this.noscript = strict; + this.state = 1; + this.ENTITIES = _Entities$entity_list$(); + this.attribList = [ ]; + this.noscript = false; + this.preTags = 0; +}; + +/** + * @param {!boolean} flag + */ +SAXParser.prototype.set_noscript$B = function (flag) { + this.noscript = flag; +}; + +/** + * @return {SAXParser} + */ +SAXParser.prototype.resume$ = function () { + this.error = null; + return this; +}; + +/** + * @return {SAXParser} + */ +SAXParser.prototype.close$ = function () { + return this.parse$S(''); +}; + +/** + * @param {!string} chunk + * @return {SAXParser} + */ +SAXParser.prototype.parse$S = function (chunk) { + /** @type {Char} */ + var _; + /** @type {!number} */ + var i; + /** @type {!string} */ + var c; + /** @type {!number} */ + var starti; + /** @type {!number} */ + var pad; + /** @type {!number} */ + var returnState; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$0; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$1; + /** @type {RegExp} */ + var charclass$2; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$3; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$4; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$5; + /** @type {!string} */ + var text$0; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$6; + /** @type {RegExp} */ + var charclass$7; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$8; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$9; + /** @type {RegExp} */ + var charclass$10; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$11; + /** @type {RegExp} */ + var charclass$12; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$13; + /** @type {RegExp} */ + var charclass$14; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$15; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$16; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$17; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$18; + /** @type {RegExp} */ + var charclass$19; + /** @type {RegExp} */ + var charclass$20; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$21; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$22; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$23; + /** @type {Object.<string, undefined|!boolean>} */ + var charclass$24; + /** @type {!string} */ + var comment$0; + _ = new Char$(); + if (this.error) { + throw this.error; + } + if (this.closed) { + return this.emiterror$S("Cannot write after close. Assign an onready handler."); + } + (i = 0, c = ""); + while (this.c = c = chunk.charAt(i++)) { + this.position++; + if (c === "\n") { + this.handler.line++; + this.handler.column = 0; + } else { + this.handler.column++; + } + switch (this.state) { + case 1: + if (c === "<") { + this.state = 4; + this.startTagPosition = this.position; + } else { + charclass$0 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$0, c)) { + this.strictFail$S("Non-whitespace before first tag."); + this.textNode = c; + this.state = 2; + } + } + continue; + case 2: + if (this.sawRoot && ! this.closedRoot) { + starti = i - 1; + while (c && c !== "<" && c !== "&") { + c = chunk.charAt(i++); + if (c) { + this.position++; + if (c === "\n") { + this.handler.line++; + this.handler.column = 0; + } else { + this.handler.column++; + } + } + } + this.textNode += chunk.substring(starti, i - 1); + } + if (c === "<") { + this.state = 4; + this.startTagPosition = this.position; + } else { + if (_.not$HBS(_.whitespace, c) && (! this.sawRoot || this.closedRoot)) { + this.strictFail$S("Text data outside of root node."); + } + if (c === "&") { + this.state = 3; + } else { + this.textNode += c; + } + } + continue; + case 33: + if (c === "<") { + this.state = 34; + } else { + this.script += c; + } + continue; + case 34: + if (c === "/") { + this.state = 31; + } else { + this.script += "<" + c; + this.state = 33; + } + continue; + case 4: + if (c === "!") { + this.state = 5; + this.sgmlDecl = ""; + } else { + charclass$1 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$1, c)) { + } else { + charclass$2 = _.nameStart; + if (charclass$2.test(c)) { + this.state = 21; + this.tagName = c; + } else { + if (c === "/") { + this.state = 31; + this.tagName = ""; + } else { + if (c === "?") { + this.state = 18; + this.procInstName = this.procInstBody = ""; + } else { + this.strictFail$S("Unencoded <"); + if (this.startTagPosition + 1 < this.position) { + pad = this.position - this.startTagPosition; + for (i = 0; i < pad; i++) { + c = " " + c; + } + } + this.textNode += "<" + c; + this.state = 2; + } + } + } + } + } + continue; + case 5: + if ((this.sgmlDecl + c).toUpperCase() === _.CDATA) { + this.closetext_if_exist$(); + this.state = 15; + this.sgmlDecl = ""; + this.cdata = ""; + } else { + if (this.sgmlDecl + c === "--") { + this.state = 12; + this.comment = ""; + this.sgmlDecl = ""; + } else { + if ((this.sgmlDecl + c).toUpperCase() === _.DOCTYPE) { + this.state = 7; + if (this.doctype || this.sawRoot) { + this.strictFail$S("Inappropriately located doctype declaration"); + } + this.doctype = ""; + this.sgmlDecl = ""; + } else { + if (c === ">") { + this.closetext_if_exist$(); + this.sgmlDecl = ""; + this.state = 2; + } else { + charclass$3 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$3, c)) { + this.state = 6; + this.sgmlDecl += c; + } else { + this.sgmlDecl += c; + } + } + } + } + } + continue; + case 6: + if (c === this.q) { + this.state = 5; + this.q = ""; + } + this.sgmlDecl += c; + continue; + case 7: + if (c === ">") { + this.state = 2; + this.closetext_if_exist$(); + this.doctype.trim(); + } else { + this.doctype += c; + if (c === "[") { + this.state = 9; + } else { + charclass$4 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$4, c)) { + this.state = 8; + this.q = c; + } + } + } + continue; + case 8: + this.doctype += c; + if (c === this.q) { + this.q = ""; + this.state = 7; + } + continue; + case 9: + this.doctype += c; + if (c === "]") { + this.state = 7; + } else { + charclass$5 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$5, c)) { + this.state = 10; + this.q = c; + } + } + continue; + case 10: + this.doctype += c; + if (c === this.q) { + this.state = 9; + this.q = ""; + } + continue; + case 12: + if (c === "-") { + this.state = 13; + } else { + this.comment += c; + } + continue; + case 13: + if (c === "-") { + this.state = 14; + text$0 = this.comment; + text$0 = text$0.replace(/[\n\t]/g, ' '); + text$0 = text$0.replace(/\s\s+/g, " "); + comment$0 = this.comment = text$0; + if (comment$0) { + this.closetext_if_exist$(); + this.comment.trim(); + } + this.comment = ""; + } else { + this.comment += "-" + c; + this.state = 12; + } + continue; + case 14: + if (c !== ">") { + this.strictFail$S("Malformed comment"); + this.comment += "--" + c; + this.state = 12; + } else { + this.state = 2; + } + continue; + case 15: + if (c === "]") { + this.state = 16; + } else { + this.cdata += c; + } + continue; + case 16: + if (c === "]") { + this.state = 17; + } else { + this.cdata += "]" + c; + this.state = 15; + } + continue; + case 17: + if (c === ">") { + if (this.cdata) { + this.closetext_if_exist$(); + } + this.cdata = ""; + this.state = 2; + } else { + if (c === "]") { + this.cdata += "]"; + } else { + this.cdata += "]]" + c; + this.state = 15; + } + } + continue; + case 18: + if (c === "?") { + this.state = 20; + } else { + charclass$6 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$6, c)) { + this.state = 19; + } else { + this.procInstName += c; + } + } + continue; + case 19: + if (! this.procInstBody && _.is$HBS(_.whitespace, c)) { + continue; + } else { + if (c === "?") { + this.state = 20; + } else { + this.procInstBody += c; + } + } + continue; + case 20: + if (c === ">") { + this.closetext_if_exist$(); + this.procInstName = this.procInstBody = ""; + this.state = 2; + } else { + this.procInstBody += "?" + c; + this.state = 19; + } + continue; + case 21: + charclass$7 = _.nameBody; + if (charclass$7.test(c)) { + this.tagName += c; + } else { + this.newTag$(); + if (c === ">") { + this.openTag$B(false); + } else { + if (c === "/") { + this.state = 22; + } else { + charclass$8 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$8, c)) { + this.strictFail$S("Invalid character in tag name"); + } + this.state = 23; + } + } + } + continue; + case 22: + if (c === ">") { + this.openTag$B(true); + this.closeTag$(); + } else { + this.strictFail$S("Forward-slash in opening tag not followed by >"); + this.state = 23; + } + continue; + case 23: + charclass$9 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$9, c)) { + continue; + } else { + if (c === ">") { + this.openTag$B(false); + } else { + if (c === "/") { + this.state = 22; + } else { + charclass$10 = _.nameStart; + if (charclass$10.test(c)) { + this.attribName = c; + this.attribValue = ""; + this.state = 24; + } else { + this.strictFail$S("Invalid attribute name"); + } + } + } + } + continue; + case 24: + if (c === "=") { + this.state = 26; + } else { + if (c === ">") { + this.strictFail$S("Attribute without value"); + this.attribValue = this.attribName; + this.attrib$(); + this.openTag$B(false); + } else { + charclass$11 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$11, c)) { + this.state = 25; + } else { + charclass$12 = _.nameBody; + if (charclass$12.test(c)) { + this.attribName += c; + } else { + this.strictFail$S("Invalid attribute name"); + } + } + } + } + continue; + case 25: + if (c === "=") { + this.state = 26; + } else { + charclass$13 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$13, c)) { + continue; + } else { + this.strictFail$S("Attribute without value"); + this.tag.attributes[this.attribName] = ""; + this.attribValue = ""; + this.closetext_if_exist$(); + this.attribName = ""; + if (c === ">") { + this.openTag$B(false); + } else { + charclass$14 = _.nameStart; + if (charclass$14.test(c)) { + this.attribName = c; + this.state = 24; + } else { + this.strictFail$S("Invalid attribute name"); + this.state = 23; + } + } + } + } + continue; + case 26: + charclass$15 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$15, c)) { + continue; + } else { + charclass$16 = _.quote; + if ($__jsx_ObjectHasOwnProperty.call(charclass$16, c)) { + this.q = c; + this.state = 27; + } else { + this.strictFail$S("Unquoted attribute value"); + this.state = 28; + this.attribValue = c; + } + } + continue; + case 27: + if (c !== this.q) { + if (c === "&") { + this.state = 29; + } else { + this.attribValue += c; + } + continue; + } + this.attrib$(); + this.q = ""; + this.state = 23; + continue; + case 28: + charclass$17 = _.attribEnd; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$17, c)) { + if (c === "&") { + this.state = 30; + } else { + this.attribValue += c; + } + continue; + } + this.attrib$(); + if (c === ">") { + this.openTag$B(false); + } else { + this.state = 23; + } + continue; + case 31: + if (! this.tagName) { + charclass$18 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$18, c)) { + continue; + } else { + charclass$19 = _.nameStart; + if (! charclass$19.test(c)) { + if (this.script) { + this.script += "</" + c; + this.state = 33; + } else { + this.strictFail$S("Invalid tagname in closing tag."); + } + } else { + this.tagName = c; + } + } + } else { + if (c === ">") { + this.closeTag$(); + } else { + charclass$20 = _.nameBody; + if (charclass$20.test(c)) { + this.tagName += c; + } else { + if (this.script) { + this.script += "</" + this.tagName; + this.tagName = ""; + this.state = 33; + } else { + charclass$21 = _.whitespace; + if (! $__jsx_ObjectHasOwnProperty.call(charclass$21, c)) { + this.strictFail$S("Invalid tagname in closing tag"); + } + this.state = 32; + } + } + } + } + continue; + case 32: + charclass$22 = _.whitespace; + if ($__jsx_ObjectHasOwnProperty.call(charclass$22, c)) { + continue; + } + if (c === ">") { + this.closeTag$(); + } else { + this.strictFail$S("Invalid characters in closing tag"); + } + continue; + case 3: + if (c === ";") { + this.textNode += this.parseEntity$(); + this.entity = ""; + this.state = 2; + } else { + charclass$23 = _.entity; + if ($__jsx_ObjectHasOwnProperty.call(charclass$23, c)) { + this.entity += c; + } else { + this.strictFail$S("Invalid character entity"); + this.textNode += "&" + this.entity + c; + this.entity = ""; + this.state = 2; + } + } + continue; + case 29: + case 30: + if (this.state === 29) { + returnState = 27; + } else { + returnState = 28; + } + if (c === ";") { + this.attribValue += this.parseEntity$(); + this.entity = ""; + this.state = (returnState | 0); + } else { + charclass$24 = _.entity; + if ($__jsx_ObjectHasOwnProperty.call(charclass$24, c)) { + this.entity += c; + } else { + this.strictFail$S("Invalid character entity"); + this.attribValue += "&" + this.entity + c; + this.entity = ""; + this.state = (returnState | 0); + } + } + continue; + default: + throw new Error("Unknown state: " + (this.state + "")); + } + } + this.end$(); + return this; +}; + +/** + */ +SAXParser.prototype.clearBuffers$ = function () { + this.comment = ''; + this.sgmlDecl = ''; + this.textNode = ''; + this.tagName = ''; + this.doctype = ''; + this.procInstName = ''; + this.procInstBody = ''; + this.entity = ''; + this.attribName = ''; + this.attribValue = ''; + this.cdata = ''; + this.script = ''; +}; + +/** + */ +SAXParser.prototype.closetext_if_exist$ = function () { + if (this.textNode !== '') { + this.closetext$(); + } +}; + +/** + */ +SAXParser.prototype.closetext$ = function () { + /** @type {!string} */ + var text; + /** @type {!string} */ + var text$0; + if (this.preTags === 0) { + text$0 = this.textNode; + text$0 = text$0.replace(/[\n\t]/g, ' '); + text$0 = text$0.replace(/\s\s+/g, " "); + text = text$0; + if (text$0) { + this.handler.ontext$S(text); + } + } else { + if (this.textNode) { + this.handler.ontext$S(this.textNode); + } + } + this.textNode = ""; +}; + +/** + * @param {!string} text + * @return {!string} + */ +SAXParser.prototype.textopts$S = function (text) { + text = text.replace(/[\n\t]/g, ' '); + text = text.replace(/\s\s+/g, " "); + return text; +}; + +/** + * @param {!string} er + * @return {SAXParser} + */ +SAXParser.prototype.emiterror$S = function (er) { + /** @type {Error} */ + var error; + this.closetext$(); + er += "\nLine: " + (this.line + "") + "\nColumn: " + (this.column + "") + "\nChar: " + this.c; + error = new Error(er); + this.error = error; + return this; +}; + +/** + */ +SAXParser.prototype.end$ = function () { + if (! this.closedRoot) { + this.strictFail$S("Unclosed root tag"); + } + if (this.state !== 2) { + this.emiterror$S("Unexpected end"); + } + this.closetext$(); + this.c = ""; + this.closed = true; +}; + +/** + * @param {!string} message + */ +SAXParser.prototype.strictFail$S = function (message) { + if (this.strict) { + this.emiterror$S(message); + } +}; + +/** + */ +SAXParser.prototype.newTag$ = function () { + if (! this.strict) { + this.tagName = this.tagName.toLowerCase(); + } + this.tag = ({name: this.tagName, attributes: ({ }), isSelfClosing: false}); + this.attribList.length = 0; +}; + +/** + */ +SAXParser.prototype.attrib$ = function () { + if (! this.strict) { + this.attribName = this.attribName.toLowerCase(); + } + if ($__jsx_ObjectHasOwnProperty.call(this.tag.attributes, this.attribName)) { + this.attribName = this.attribValue = ""; + return; + } + this.tag.attributes[this.attribName] = this.attribValue; + this.closetext_if_exist$(); + this.attribName = this.attribValue = ""; +}; + +/** + */ +SAXParser.prototype.openTag$ = function () { + this.openTag$B(false); +}; + +/** + * @param {!boolean} selfClosing + */ +SAXParser.prototype.openTag$B = function (selfClosing) { + /** @type {Tag} */ + var tag$0; + /** @type {Tag} */ + var tag$1; + (tag$0 = this.tag).isSelfClosing = selfClosing; + this.sawRoot = true; + this.tags.push(tag$0); + this.closetext_if_exist$(); + this.handler.onopentag$SHS((tag$1 = this.tag).name, tag$1.attributes); + if (this.tag.name === 'pre') { + this.preTags++; + } + if (! selfClosing) { + if (! this.noscript && this.tagName.toLowerCase() === "script") { + this.state = 33; + } else { + this.state = 2; + } + this.tag = null; + this.tagName = ""; + } + this.attribName = this.attribValue = ""; + this.attribList.length = 0; +}; + +/** + */ +SAXParser.prototype.closeTag$ = function () { + /** @type {!number} */ + var t; + /** @type {!string} */ + var tagName; + /** @type {!string} */ + var closeTo; + /** @type {Tag} */ + var close; + /** @type {!number} */ + var s; + /** @type {Tag} */ + var tag$0; + if (! this.tagName) { + this.strictFail$S("Weird empty close tag."); + this.textNode += "</>"; + this.state = 2; + return; + } + if (this.script) { + if (this.tagName !== "script") { + this.script += "</" + this.tagName + ">"; + this.tagName = ""; + this.state = 33; + return; + } + this.closetext_if_exist$(); + this.script = ""; + } + t = this.tags.length; + tagName = this.tagName; + if (! this.strict) { + tagName = tagName.toLowerCase(); + } + closeTo = tagName; + while (t--) { + close = this.tags[t]; + if (close.name !== closeTo) { + this.strictFail$S("Unexpected close tag"); + } else { + break; + } + } + if (t < 0) { + this.strictFail$S("Unmatched closing tag: " + this.tagName); + this.textNode += "</" + this.tagName + ">"; + this.state = 2; + return; + } + this.tagName = tagName; + s = this.tags.length; + while (s-- > t) { + tag$0 = this.tag = this.tags.pop(); + this.tagName = tag$0.name; + this.closetext_if_exist$(); + this.handler.onclosetag$S(this.tagName); + if (this.tagName === 'pre') { + this.preTags--; + } + } + if (t === 0) { + this.closedRoot = true; + } + this.tagName = this.attribValue = this.attribName = ""; + this.attribList.length = 0; + this.state = 2; +}; + +/** + * @return {!string} + */ +SAXParser.prototype.parseEntity$ = function () { + /** @type {!string} */ + var entity; + /** @type {!string} */ + var entityLC; + /** @type {!number} */ + var num; + /** @type {!string} */ + var numStr; + entity = this.entity; + entityLC = entity.toLowerCase(); + num = 0; + numStr = ""; + if (this.ENTITIES[entity]) { + return this.ENTITIES[entity]; + } + if (this.ENTITIES[entityLC]) { + return this.ENTITIES[entityLC]; + } + entity = entityLC; + if (entityLC.charAt(0) === "#") { + if (entity.charAt(1) === "x") { + entity = entity.slice(2); + num = $__jsx_parseInt(entity, 16); + numStr = num.toString(16); + } else { + entity = entity.slice(1); + num = $__jsx_parseInt(entity, 10); + numStr = num.toString(10); + } + } + entity = entity.replace(/^0+/, ""); + if (numStr.toLowerCase() !== entity) { + this.strictFail$S("Invalid character entity"); + return "&" + this.entity + ";"; + } + return String.fromCharCode(num); +}; + +/** + * class Char extends Object + * @constructor + */ +function Char() { +} + +/** + * @constructor + */ +function Char$() { + this.CDATA = "[CDATA["; + this.DOCTYPE = "DOCTYPE"; + this.XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"; + this.whitespace = this._charClass$S("\r\n\t "); + this.number = this._charClass$S("0124356789"); + this.letter = this._charClass$S("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); + this.quote = this._charClass$S("'\""); + this.entity = this._charClass$S("0124356789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#"); + this.attribEnd = this._charClass$S("\r\n\t >"); + this.nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; + this.nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/; +}; + +Char$.prototype = new Char; + +/** + * @param {!string} str + * @return {Object.<string, undefined|!boolean>} + */ +Char.prototype._charClass$S = function (str) { + /** @type {Object.<string, undefined|!boolean>} */ + var result; + /** @type {!number} */ + var i; + result = ({ }); + for (i = 0; i < str.length; i++) { + result[str.slice(i, i + 1)] = true; + } + return result; +}; + +/** + * @param {RegExp} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.is$LRegExp$S = function (charclass, c) { + return charclass.test(c); +}; + +/** + * @param {Object.<string, undefined|!boolean>} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.is$HBS = function (charclass, c) { + return $__jsx_ObjectHasOwnProperty.call(charclass, c); +}; + +/** + * @param {RegExp} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.not$LRegExp$S = function (charclass, c) { + return ! charclass.test(c); +}; + +/** + * @param {Object.<string, undefined|!boolean>} charclass + * @param {!string} c + * @return {!boolean} + */ +Char.prototype.not$HBS = function (charclass, c) { + return ! $__jsx_ObjectHasOwnProperty.call(charclass, c); +}; + +/** + * class _Entities extends Object + * @constructor + */ +function _Entities() { +} + +/** + * @constructor + */ +function _Entities$() { +}; + +_Entities$.prototype = new _Entities; + +/** + * @return {Object.<string, undefined|!string>} + */ +_Entities.entity_list$ = function () { + /** @type {Object.<string, undefined|!string>} */ + var result; + /** @type {!string} */ + var key; + /** @type {*} */ + var value; + result = ({ }); + for (key in _Entities._entities) { + value = _Entities._entities[key]; + if (typeof value === 'string') { + result[key] = value + ""; + } else { + if (typeof value === 'number') { + result[key] = String.fromCharCode(value | 0); + } + } + } + return result; +}; + +var _Entities$entity_list$ = _Entities.entity_list$; + +/** + * class BitVector extends Object + * @constructor + */ +function BitVector() { +} + +/** + * @constructor + */ +function BitVector$() { + /** @type {Array.<undefined|!number>} */ + var _v$0; + /** @type {Array.<undefined|!number>} */ + var _r$0; + _r$0 = this._r = [ ]; + _v$0 = this._v = [ ]; + _v$0.length = 0; + _r$0.length = 0; + this._size = 0; + this._size1 = 0; +}; + +BitVector$.prototype = new BitVector; + +/** + */ +BitVector.prototype.build$ = function () { + /** @type {!number} */ + var i; + this._size1 = 0; + for (i = 0; i < this._v.length; i++) { + if (i % 8 === 0) { + this._r.push(true ? this._size1 : this._size - this._size1); + } + this._size1 += this._rank32$IIB(this._v[i], 32, true); + } +}; + +/** + */ +BitVector.prototype.clear$ = function () { + this._v.length = 0; + this._r.length = 0; + this._size = 0; + this._size1 = 0; +}; + +/** + * @return {!number} + */ +BitVector.prototype.size$ = function () { + return this._size; +}; + +/** + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.size$B = function (b) { + return (b ? this._size1 : this._size - this._size1); +}; + +/** + * @param {!number} value + */ +BitVector.prototype.set$I = function (value) { + this.set$IB(value, true); +}; + +/** + * @param {!number} value + * @param {!boolean} flag + */ +BitVector.prototype.set$IB = function (value, flag) { + /** @type {!number} */ + var q; + /** @type {!number} */ + var r; + /** @type {!number} */ + var m; + if (value >= this._size) { + this._size = (value + 1 | 0); + } + q = (value / 32 | 0); + r = (value % 32 | 0); + while (q >= this._v.length) { + this._v.push(0); + } + m = 0x1 << r; + if (flag) { + this._v[q] |= m; + } else { + this._v[q] &= ~ m; + } +}; + +/** + * @param {!number} value + * @return {!boolean} + */ +BitVector.prototype.get$I = function (value) { + /** @type {!number} */ + var q; + /** @type {!number} */ + var r; + /** @type {!number} */ + var m; + if (value >= this._size) { + throw new Error("BitVector.get() : range error"); + } + q = (value / 32 | 0); + r = (value % 32 | 0); + m = 0x1 << r; + return !! (this._v[q] & m); +}; + +/** + * @param {!number} i + * @return {!number} + */ +BitVector.prototype.rank$I = function (i) { + return this.rank$IB(i, true); +}; + +/** + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.rank$IB = function (i, b) { + /** @type {!number} */ + var q_large; + /** @type {!number} */ + var q_small; + /** @type {!number} */ + var r; + /** @type {!number} */ + var rank; + /** @type {!number} */ + var begin; + /** @type {!number} */ + var j; + if (i > this._size) { + throw new Error("BitVector.rank() : range error"); + } + if (i === 0) { + return 0; + } + i--; + q_large = (Math.floor(i / 256) | 0); + q_small = (Math.floor(i / 32) | 0); + r = (Math.floor(i % 32) | 0); + rank = (this._r[q_large] | 0); + if (! b) { + rank = q_large * 256 - rank; + } + begin = q_large * 8; + for (j = begin; j < q_small; j++) { + rank += this._rank32$IIB(this._v[j], 32, b); + } + rank += this._rank32$IIB(this._v[q_small], r + 1, b); + return rank; +}; + +/** + * @param {!number} i + * @return {!number} + */ +BitVector.prototype.select$I = function (i) { + return this.select$IB(i, true); +}; + +/** + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype.select$IB = function (i, b) { + /** @type {!number} */ + var left; + /** @type {!number} */ + var right; + /** @type {!number} */ + var pivot; + /** @type {undefined|!number} */ + var rank; + /** @type {!number} */ + var j; + if (i >= (b ? this._size1 : this._size - this._size1)) { + throw new Error("BitVector.select() : range error"); + } + left = 0; + right = this._r.length; + while (left < right) { + pivot = Math.floor((left + right) / 2); + rank = this._r[pivot]; + if (! b) { + rank = pivot * 256 - rank; + } + if (i < rank) { + right = pivot; + } else { + left = pivot + 1; + } + } + right--; + if (b) { + i -= (this._r[right] | 0); + } else { + i -= (right * 256 - this._r[right] | 0); + } + j = right * 8; + while (1) { + rank = this._rank32$IIB(this._v[j], 32, b); + if (i < rank) { + break; + } + j++; + i -= (rank | 0); + } + return (j * 32 + this._select32$IIB(this._v[j], i, b) | 0); +}; + +/** + * @param {!number} x + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype._rank32$IIB = function (x, i, b) { + if (! b) { + x = ~ x; + } + x <<= 32 - i; + x = ((x & 0xaaaaaaaa) >>> 1) + (x & 0x55555555); + x = ((x & 0xcccccccc) >>> 2) + (x & 0x33333333); + x = ((x & 0xf0f0f0f0) >>> 4) + (x & 0x0f0f0f0f); + x = ((x & 0xff00ff00) >>> 8) + (x & 0x00ff00ff); + x = ((x & 0xffff0000) >>> 16) + (x & 0x0000ffff); + return x; +}; + +/** + * @param {!number} x + * @param {!number} i + * @param {!boolean} b + * @return {!number} + */ +BitVector.prototype._select32$IIB = function (x, i, b) { + /** @type {!number} */ + var x1; + /** @type {!number} */ + var x2; + /** @type {!number} */ + var x3; + /** @type {!number} */ + var x4; + /** @type {!number} */ + var x5; + /** @type {!number} */ + var pos; + /** @type {!number} */ + var v5; + /** @type {!number} */ + var v4; + /** @type {!number} */ + var v3; + /** @type {!number} */ + var v2; + /** @type {!number} */ + var v1; + /** @type {!number} */ + var v0; + if (! b) { + x = ~ x; + } + x1 = ((x & 0xaaaaaaaa) >>> 1) + (x & 0x55555555); + x2 = ((x1 & 0xcccccccc) >>> 2) + (x1 & 0x33333333); + x3 = ((x2 & 0xf0f0f0f0) >>> 4) + (x2 & 0x0f0f0f0f); + x4 = ((x3 & 0xff00ff00) >>> 8) + (x3 & 0x00ff00ff); + x5 = ((x4 & 0xffff0000) >>> 16) + (x4 & 0x0000ffff); + i++; + pos = 0; + v5 = x5 & 0xffffffff; + if (i > v5) { + i -= (v5 | 0); + pos += 32; + } + v4 = x4 >>> pos & 0x0000ffff; + if (i > v4) { + i -= (v4 | 0); + pos += 16; + } + v3 = x3 >>> pos & 0x000000ff; + if (i > v3) { + i -= (v3 | 0); + pos += 8; + } + v2 = x2 >>> pos & 0x0000000f; + if (i > v2) { + i -= (v2 | 0); + pos += 4; + } + v1 = x1 >>> pos & 0x00000003; + if (i > v1) { + i -= (v1 | 0); + pos += 2; + } + v0 = x >>> pos & 0x00000001; + if (i > v0) { + i -= (v0 | 0); + pos += 1; + } + return (pos | 0); +}; + +/** + * @return {!string} + */ +BitVector.prototype.dump$ = function () { + /** @type {Array.<undefined|!string>} */ + var contents; + contents = [ ]; + contents.push(Binary$dump32bitNumber$N(this._size)); + contents.push(Binary$dump32bitNumberList$AN(this._v)); + return contents.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +BitVector.prototype.dump$LCompressionReport$ = function (report) { + /** @type {Array.<undefined|!string>} */ + var contents; + contents = [ ]; + contents.push(Binary$dump32bitNumber$N(this._size)); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents.push(Binary$dump32bitNumberList$ANLCompressionReport$(this._v, report)); + return contents.join(''); +}; + +/** + * @param {!string} data + * @return {!number} + */ +BitVector.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +BitVector.prototype.load$SI = function (data, offset) { + /** @type {LoadedNumberListResult} */ + var result; + /** @type {!number} */ + var result$0; + this._v.length = 0; + this._r.length = 0; + this._size = 0; + this._size1 = 0; + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._size = (result$0 | 0); + result = Binary$load32bitNumberList$SI(data, offset + 2); + this._v = result.result; + this.build$(); + return result.offset; +}; + +/** + * class WaveletMatrix extends Object + * @constructor + */ +function WaveletMatrix() { +} + +/** + * @constructor + */ +function WaveletMatrix$() { + /** @type {Array.<undefined|BitVector>} */ + var _bv$0; + /** @type {Array.<undefined|!number>} */ + var _seps$0; + this._range = ({ }); + _bv$0 = this._bv = [ ]; + _seps$0 = this._seps = [ ]; + this._bitsize = 16; + _bv$0.length = 0; + _seps$0.length = 0; + this._size = 0; +}; + +WaveletMatrix$.prototype = new WaveletMatrix; + +/** + * @return {!number} + */ +WaveletMatrix.prototype.bitsize$ = function () { + return this._bitsize; +}; + +/** + * @param {!number} charCode + */ +WaveletMatrix.prototype.setMaxCharCode$I = function (charCode) { + this._bitsize = (Math.ceil(Math.log(charCode) / 0.6931471805599453) | 0); +}; + +/** + */ +WaveletMatrix.prototype.clear$ = function () { + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; +}; + +/** + * @param {!string} v + */ +WaveletMatrix.prototype.build$S = function (v) { + /** @type {!number} */ + var size; + /** @type {!number} */ + var bitsize; + /** @type {!number} */ + var i; + /** @type {!number} */ + var depth; + /** @type {Object.<string, undefined|!number>} */ + var range_tmp; + /** @type {!number} */ + var code; + /** @type {!boolean} */ + var bit; + /** @type {!number} */ + var key; + /** @type {Object.<string, undefined|!number>} */ + var range_rev; + /** @type {!string} */ + var range_key; + /** @type {!number} */ + var value; + /** @type {!number} */ + var pos0; + /** @type {undefined|!number} */ + var pos1; + /** @type {!string} */ + var range_rev_key; + /** @type {!number} */ + var begin; + /** @type {undefined|!number} */ + var end; + /** @type {!number} */ + var num0; + /** @type {!number} */ + var num1; + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; + size = v.length; + bitsize = this._bitsize; + for (i = 0; i < bitsize; i++) { + this._bv.push(new BitVector$()); + this._seps.push(0); + } + this._size = (size | 0); + for (i = 0; i < size; i++) { + this._bv[0].set$IB(i, this._uint2bit$II(v.charCodeAt(i), 0)); + } + this._bv[0].build$(); + this._seps[0] = this._bv[0].size$B(false); + this._range["0"] = 0; + this._range["1"] = this._seps[0]; + depth = 1; + while (depth < bitsize) { + range_tmp = WaveletMatrix$_shallow_copy$HI(this._range); + for (i = 0; i < size; i++) { + code = v.charCodeAt(i); + bit = this._uint2bit$II(code, depth); + key = code >>> bitsize - depth; + this._bv[depth].set$IB(range_tmp[key + ""], bit); + range_tmp[key + ""]++; + } + this._bv[depth].build$(); + this._seps[depth] = this._bv[depth].size$B(false); + range_rev = ({ }); + for (range_key in this._range) { + value = this._range[range_key]; + if (value != range_tmp[range_key]) { + range_rev[value + ""] = range_key | 0; + } + } + this._range = ({ }); + pos0 = 0; + pos1 = this._seps[depth]; + for (range_rev_key in range_rev) { + begin = range_rev_key | 0; + value = range_rev[range_rev_key]; + end = range_tmp[value + ""]; + num0 = this._bv[depth].rank$IB(end, false) - this._bv[depth].rank$IB(begin, false); + num1 = end - begin - num0; + if (num0 > 0) { + this._range[(value << 1) + ""] = (pos0 | 0); + pos0 += num0; + } + if (num1 > 0) { + this._range[(value << 1) + 1 + ""] = pos1; + pos1 += (num1 | 0); + } + } + depth++; + } +}; + +/** + * @return {!number} + */ +WaveletMatrix.prototype.size$ = function () { + return this._size; +}; + +/** + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.size$I = function (c) { + return this.rank$II(this._size, c); +}; + +/** + * @param {!number} i + * @return {!number} + */ +WaveletMatrix.prototype.get$I = function (i) { + /** @type {!number} */ + var value; + /** @type {!number} */ + var depth; + /** @type {!boolean} */ + var bit; + if (i >= this._size) { + throw new Error("WaveletMatrix.get() : range error"); + } + value = 0; + depth = 0; + while (depth < this._bitsize) { + bit = this._bv[depth].get$I(i); + i = this._bv[depth].rank$IB(i, bit); + value <<= 1; + if (bit) { + i += this._seps[depth]; + value += 1; + } + depth++; + } + return (value | 0); +}; + +/** + * @param {!number} i + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.rank$II = function (i, c) { + /** @type {undefined|!number} */ + var begin; + /** @type {!number} */ + var end; + /** @type {!number} */ + var depth; + /** @type {!boolean} */ + var bit; + if (i > this._size) { + throw new Error("WaveletMatrix.rank(): range error"); + } + if (i === 0) { + return 0; + } + begin = this._range[c + ""]; + if (begin == null) { + return 0; + } + end = i; + depth = 0; + while (depth < this._bitsize) { + bit = this._uint2bit$II(c, depth); + end = this._bv[depth].rank$IB(end, bit); + if (bit) { + end += this._seps[depth]; + } + depth++; + } + return (end - begin | 0); +}; + +/** + * @param {!number} i + * @param {!number} c + * @return {!number} + */ +WaveletMatrix.prototype.rank_less_than$II = function (i, c) { + /** @type {!number} */ + var begin; + /** @type {!number} */ + var end; + /** @type {!number} */ + var depth; + /** @type {!number} */ + var rlt; + /** @type {!number} */ + var rank0_begin; + /** @type {!number} */ + var rank0_end; + /** @type {Array.<undefined|!number>} */ + var _seps$0; + if (i > this._size) { + throw new Error("WaveletMatrix.rank_less_than(): range error"); + } + if (i === 0) { + return 0; + } + begin = 0; + end = i; + depth = 0; + rlt = 0; + while (depth < this._bitsize) { + rank0_begin = this._bv[depth].rank$IB(begin, false); + rank0_end = this._bv[depth].rank$IB(end, false); + if (this._uint2bit$II(c, depth)) { + rlt += rank0_end - rank0_begin; + begin += (_seps$0 = this._seps)[depth] - rank0_begin; + end += _seps$0[depth] - rank0_end; + } else { + begin = rank0_begin; + end = rank0_end; + } + depth++; + } + return (rlt | 0); +}; + +/** + * @return {!string} + */ +WaveletMatrix.prototype.dump$ = function () { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!string>} */ + var range_contents; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + contents = [ Binary$dump16bitNumber$I(this._bitsize), Binary$dump32bitNumber$N(this._size) ]; + for (i = 0; i < this._bitsize; i++) { + contents.push(this._bv[i].dump$()); + } + for (i = 0; i < this._bitsize; i++) { + contents.push(Binary$dump32bitNumber$N(this._seps[i])); + } + range_contents = [ ]; + counter = 0; + for (key in this._range) { + range_contents.push(Binary$dump32bitNumber$N(key | 0)); + range_contents.push(Binary$dump32bitNumber$N(this._range[key])); + counter++; + } + contents.push(Binary$dump32bitNumber$N(counter)); + return contents.join('') + range_contents.join(''); +}; + +/** + * @param {CompressionReport} report + * @return {!string} + */ +WaveletMatrix.prototype.dump$LCompressionReport$ = function (report) { + /** @type {Array.<undefined|!string>} */ + var contents; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!string>} */ + var range_contents; + /** @type {!number} */ + var counter; + /** @type {!string} */ + var key; + contents = [ Binary$dump16bitNumber$I(this._bitsize), Binary$dump32bitNumber$N(this._size) ]; + CompressionReport$add$LCompressionReport$II(report, 3, 3); + for (i = 0; i < this._bitsize; i++) { + contents.push(this._bv[i].dump$LCompressionReport$(report)); + } + for (i = 0; i < this._bitsize; i++) { + contents.push(Binary$dump32bitNumber$N(this._seps[i])); + CompressionReport$add$LCompressionReport$II(report, 2, 2); + } + range_contents = [ ]; + counter = 0; + for (key in this._range) { + range_contents.push(Binary$dump32bitNumber$N(key | 0)); + range_contents.push(Binary$dump32bitNumber$N(this._range[key])); + CompressionReport$add$LCompressionReport$II(report, 4, 4); + counter++; + } + CompressionReport$add$LCompressionReport$II(report, 2, 2); + contents.push(Binary$dump32bitNumber$N(counter)); + return contents.join('') + range_contents.join(''); +}; + +/** + * @param {!string} data + * @return {!number} + */ +WaveletMatrix.prototype.load$S = function (data) { + return this.load$SI(data, 0); +}; + +/** + * @param {!string} data + * @param {!number} offset + * @return {!number} + */ +WaveletMatrix.prototype.load$SI = function (data, offset) { + /** @type {!number} */ + var i; + /** @type {BitVector} */ + var bit_vector; + /** @type {!number} */ + var range_size; + /** @type {!number} */ + var value; + /** @type {!number} */ + var offset$0; + /** @type {!number} */ + var result$0; + /** @type {!number} */ + var result$1; + /** @type {!number} */ + var result$2; + this._bv.length = 0; + this._seps.length = 0; + this._size = 0; + offset$0 = offset++; + this._bitsize = (data.charCodeAt(offset$0) | 0); + result$0 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + this._size = (result$0 | 0); + offset += 2; + for (i = 0; i < this._bitsize; i++) { + bit_vector = new BitVector$(); + offset = bit_vector.load$SI(data, offset); + this._bv.push(bit_vector); + } + for (i = 0; i < this._bitsize; (i++, offset += 2)) { + this._seps.push(Binary$load32bitNumber$SI(data, offset)); + } + result$1 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + range_size = result$1; + offset += 2; + for (i = 0; i < range_size; (i++, offset += 4)) { + result$2 = data.charCodeAt(offset) * 65536 + data.charCodeAt(offset + 1); + value = Binary$load32bitNumber$SI(data, offset + 2); + this._range[result$2 + ""] = (value | 0); + } + return offset; +}; + +/** + * @param {Object.<string, undefined|!number>} input + * @return {Object.<string, undefined|!number>} + */ +WaveletMatrix._shallow_copy$HI = function (input) { + /** @type {Object.<string, undefined|!number>} */ + var result; + /** @type {!string} */ + var key; + result = ({ }); + for (key in input) { + result[key] = input[key]; + } + return result; +}; + +var WaveletMatrix$_shallow_copy$HI = WaveletMatrix._shallow_copy$HI; + +/** + * @param {!number} c + * @param {!number} i + * @return {!boolean} + */ +WaveletMatrix.prototype._uint2bit$II = function (c, i) { + return (c >>> this._bitsize - 1 - i & 0x1) === 0x1; +}; + +/** + * class BurrowsWheelerTransform extends Object + * @constructor + */ +function BurrowsWheelerTransform() { +} + +/** + * @constructor + */ +function BurrowsWheelerTransform$() { + this._str = ""; + this._size = 0; + this._head = 0; + this._suffixarray = [ ]; +}; + +BurrowsWheelerTransform$.prototype = new BurrowsWheelerTransform; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!number} + */ +BurrowsWheelerTransform.size$LBurrowsWheelerTransform$ = function ($this) { + return $this._size; +}; + +var BurrowsWheelerTransform$size$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.size$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!number} + */ +BurrowsWheelerTransform.head$LBurrowsWheelerTransform$ = function ($this) { + return $this._head; +}; + +var BurrowsWheelerTransform$head$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.head$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + */ +BurrowsWheelerTransform.clear$LBurrowsWheelerTransform$ = function ($this) { + $this._str = ""; + $this._size = 0; + $this._head = 0; + $this._suffixarray.length = 0; +}; + +var BurrowsWheelerTransform$clear$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.clear$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!string} str + */ +BurrowsWheelerTransform.build$LBurrowsWheelerTransform$S = function ($this, str) { + /** @type {!string} */ + var _str$0; + /** @type {Array.<undefined|!number>} */ + var _suffixarray$0; + _str$0 = $this._str = str; + $this._size = _str$0.length; + _suffixarray$0 = $this._suffixarray = SAIS$make$S(str); + $this._head = (_suffixarray$0.indexOf(0) | 0); +}; + +var BurrowsWheelerTransform$build$LBurrowsWheelerTransform$S = BurrowsWheelerTransform.build$LBurrowsWheelerTransform$S; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!number} i + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$I = function ($this, i) { + /** @type {!number} */ + var size; + /** @type {!number} */ + var index; + size = $this._size; + if (i >= size) { + throw new Error("BurrowsWheelerTransform.get() : range error"); + } + index = ($this._suffixarray[i] + size - 1) % size; + return $this._str.charAt(index); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$I = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$I; + +/** + * @param {BurrowsWheelerTransform} $this + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$ = function ($this) { + /** @type {Array.<undefined|!string>} */ + var str; + /** @type {!number} */ + var size; + /** @type {!number} */ + var i; + str = [ ]; + size = $this._size; + for (i = 0; i < size; i++) { + str.push(BurrowsWheelerTransform$get$LBurrowsWheelerTransform$I($this, i)); + } + return str.join(""); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$ = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$; + +/** + * @param {BurrowsWheelerTransform} $this + * @param {!string} replace + * @return {!string} + */ +BurrowsWheelerTransform.get$LBurrowsWheelerTransform$S = function ($this, replace) { + /** @type {!string} */ + var result; + result = BurrowsWheelerTransform$get$LBurrowsWheelerTransform$($this); + return result.replace(BurrowsWheelerTransform.END_MARKER, replace); +}; + +var BurrowsWheelerTransform$get$LBurrowsWheelerTransform$S = BurrowsWheelerTransform.get$LBurrowsWheelerTransform$S; + +/** + * class OArray extends Object + * @constructor + */ +function OArray() { +} + +/** + * @constructor + * @param {Array.<undefined|!number>} array + */ +function OArray$AI(array) { + this.array = array; + this.offset = 0; +}; + +OArray$AI.prototype = new OArray; + +/** + * @constructor + * @param {Array.<undefined|!number>} array + * @param {!number} offset + */ +function OArray$AII(array, offset) { + this.array = array; + this.offset = offset; +}; + +OArray$AII.prototype = new OArray; + +/** + * @param {OArray} $this + * @param {!number} index + * @return {!number} + */ +OArray.get$LOArray$I = function ($this, index) { + return $this.array[index + $this.offset]; +}; + +var OArray$get$LOArray$I = OArray.get$LOArray$I; + +/** + * @param {OArray} $this + * @param {!number} index + * @param {!number} value + */ +OArray.set$LOArray$II = function ($this, index, value) { + $this.array[index + $this.offset] = value; +}; + +var OArray$set$LOArray$II = OArray.set$LOArray$II; + +/** + * @param {OArray} $this + * @param {!number} index + * @return {!boolean} + */ +OArray.isS$LOArray$I = function ($this, index) { + /** @type {Array.<undefined|!number>} */ + var array$0; + /** @type {!number} */ + var offset$0; + return (array$0 = $this.array)[index + (offset$0 = $this.offset)] < array$0[index + offset$0 + 1]; +}; + +var OArray$isS$LOArray$I = OArray.isS$LOArray$I; + +/** + * @param {OArray} $this + * @param {!number} index1 + * @param {!number} index2 + * @return {!boolean} + */ +OArray.compare$LOArray$II = function ($this, index1, index2) { + /** @type {Array.<undefined|!number>} */ + var array$0; + /** @type {!number} */ + var offset$0; + return (array$0 = $this.array)[index1 + (offset$0 = $this.offset)] == array$0[index2 + offset$0]; +}; + +var OArray$compare$LOArray$II = OArray.compare$LOArray$II; + +/** + * class SAIS extends Object + * @constructor + */ +function SAIS() { +} + +/** + * @constructor + */ +function SAIS$() { +}; + +SAIS$.prototype = new SAIS; + +/** + * @param {BitVector} t + * @param {!number} i + * @return {!boolean} + */ +SAIS._isLMS$LBitVector$I = function (t, i) { + return i > 0 && t.get$I(i) && ! t.get$I(i - 1); +}; + +var SAIS$_isLMS$LBitVector$I = SAIS._isLMS$LBitVector$I; + +/** + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._getBuckets$LOArray$AIIIB = function (s, bkt, n, K, end) { + /** @type {!number} */ + var sum; + /** @type {!number} */ + var i; + sum = 0; + for (i = 0; i <= K; i++) { + bkt[i] = 0; + } + for (i = 0; i < n; i++) { + bkt[OArray$get$LOArray$I(s, i)]++; + } + for (i = 0; i <= K; i++) { + sum += bkt[i]; + bkt[i] = ((end ? sum : sum - bkt[i]) | 0); + } +}; + +var SAIS$_getBuckets$LOArray$AIIIB = SAIS._getBuckets$LOArray$AIIIB; + +/** + * @param {BitVector} t + * @param {Array.<undefined|!number>} SA + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._induceSAl$LBitVector$AILOArray$AIIIB = function (t, SA, s, bkt, n, K, end) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var j; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, end); + for (i = 0; i < n; i++) { + j = SA[i] - 1; + if (j >= 0 && ! t.get$I(j)) { + SA[bkt[OArray$get$LOArray$I(s, j)]++] = (j | 0); + } + } +}; + +var SAIS$_induceSAl$LBitVector$AILOArray$AIIIB = SAIS._induceSAl$LBitVector$AILOArray$AIIIB; + +/** + * @param {BitVector} t + * @param {Array.<undefined|!number>} SA + * @param {OArray} s + * @param {Array.<undefined|!number>} bkt + * @param {!number} n + * @param {!number} K + * @param {!boolean} end + */ +SAIS._induceSAs$LBitVector$AILOArray$AIIIB = function (t, SA, s, bkt, n, K, end) { + /** @type {!number} */ + var i; + /** @type {!number} */ + var j; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, end); + for (i = n - 1; i >= 0; i--) { + j = SA[i] - 1; + if (j >= 0 && t.get$I(j)) { + SA[-- bkt[OArray$get$LOArray$I(s, j)]] = (j | 0); + } + } +}; + +var SAIS$_induceSAs$LBitVector$AILOArray$AIIIB = SAIS._induceSAs$LBitVector$AILOArray$AIIIB; + +/** + * @param {!string} source + * @return {Array.<undefined|!number>} + */ +SAIS.make$S = function (source) { + /** @type {Array.<undefined|!number>} */ + var charCodes; + /** @type {!number} */ + var maxCode; + /** @type {!number} */ + var i; + /** @type {!number} */ + var code; + /** @type {Array.<undefined|!number>} */ + var SA; + /** @type {OArray} */ + var s; + charCodes = [ ]; + charCodes.length = source.length; + maxCode = 0; + for (i = 0; i < source.length; i++) { + code = source.charCodeAt(i); + charCodes[i] = (code | 0); + maxCode = (code > maxCode ? code : maxCode); + } + SA = [ ]; + SA.length = source.length; + s = ({offset: 0, array: charCodes}); + SAIS$_make$LOArray$AIII(s, SA, source.length, maxCode); + return SA; +}; + +var SAIS$make$S = SAIS.make$S; + +/** + * @param {OArray} s + * @param {Array.<undefined|!number>} SA + * @param {!number} n + * @param {!number} K + */ +SAIS._make$LOArray$AIII = function (s, SA, n, K) { + /** @type {BitVector} */ + var t; + /** @type {!number} */ + var i; + /** @type {Array.<undefined|!number>} */ + var bkt; + /** @type {!number} */ + var n1; + /** @type {!number} */ + var name; + /** @type {!number} */ + var prev; + /** @type {undefined|!number} */ + var pos; + /** @type {!boolean} */ + var diff; + /** @type {!number} */ + var d; + /** @type {!number} */ + var j; + /** @type {Array.<undefined|!number>} */ + var SA1; + /** @type {OArray} */ + var s1; + /** @type {!number} */ + var i$0; + /** @type {!number} */ + var index$0; + t = new BitVector$(); + t.set$IB(n - 2, false); + t.set$IB(n - 1, true); + for (i = n - 3; i >= 0; i--) { + t.set$IB(i, OArray$isS$LOArray$I(s, i) || OArray$compare$LOArray$II(s, i, i + 1) && t.get$I(i + 1)); + } + bkt = [ ]; + bkt.length = K + 1; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, true); + for (i = 0; i < n; i++) { + SA[i] = -1; + } + for (i = 1; i < n; i++) { + if (SAIS$_isLMS$LBitVector$I(t, i)) { + SA[-- bkt[OArray$get$LOArray$I(s, i)]] = (i | 0); + } + } + SAIS$_induceSAl$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, false); + SAIS$_induceSAs$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, true); + n1 = 0; + for (i = 0; i < n; i++) { + i$0 = SA[i]; + if (i$0 > 0 && t.get$I(i$0) && ! t.get$I(i$0 - 1)) { + SA[n1++] = SA[i]; + } + } + for (i = n1; i < n; i++) { + SA[i] = -1; + } + name = 0; + prev = -1; + for (i = 0; i < n1; i++) { + pos = SA[i]; + diff = false; + for (d = 0; d < n; d++) { + if (prev === -1 || ! OArray$compare$LOArray$II(s, pos + d, prev + d) || t.get$I(pos + d) !== t.get$I(prev + d)) { + diff = true; + break; + } else { + if (d > 0 && (SAIS$_isLMS$LBitVector$I(t, pos + d) || SAIS$_isLMS$LBitVector$I(t, prev + d))) { + break; + } + } + } + if (diff) { + name++; + prev = pos; + } + pos = ((pos % 2 === 0 ? pos / 2 : (pos - 1) / 2) | 0); + SA[n1 + pos] = (name - 1 | 0); + } + for ((i = n - 1, j = n - 1); i >= n1; i--) { + if (SA[i] >= 0) { + SA[j--] = SA[i]; + } + } + SA1 = SA; + s1 = ({offset: n - n1, array: SA}); + if (name < n1) { + SAIS$_make$LOArray$AIII(s1, SA1, n1, name - 1); + } else { + for (i = 0; i < n1; i++) { + SA1[OArray$get$LOArray$I(s1, i)] = (i | 0); + } + } + bkt = [ ]; + bkt.length = K + 1; + SAIS$_getBuckets$LOArray$AIIIB(s, bkt, n, K, true); + for ((i = 1, j = 0); i < n; i++) { + if (SAIS$_isLMS$LBitVector$I(t, i)) { + OArray$set$LOArray$II(s1, j++, i); + } + } + for (i = 0; i < n1; i++) { + index$0 = SA1[i]; + SA1[i] = s1.array[index$0 + s1.offset]; + } + for (i = n1; i < n; i++) { + SA[i] = -1; + } + for (i = n1 - 1; i >= 0; i--) { + j = SA[i]; + SA[i] = -1; + SA[-- bkt[OArray$get$LOArray$I(s, j)]] = (j | 0); + } + SAIS$_induceSAl$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, false); + SAIS$_induceSAs$LBitVector$AILOArray$AIIIB(t, SA, s, bkt, n, K, true); +}; + +var SAIS$_make$LOArray$AIII = SAIS._make$LOArray$AIII; + +OktaviaSearch._stemmer = null; +OktaviaSearch._instance = null; +$__jsx_lazy_init(Oktavia, "eof", function () { + return String.fromCharCode(0); +}); +$__jsx_lazy_init(Oktavia, "eob", function () { + return String.fromCharCode(1); +}); +$__jsx_lazy_init(Oktavia, "unknown", function () { + return String.fromCharCode(3); +}); +Binary._base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +$__jsx_lazy_init(Binary, "_base64DecodeChars", function () { + return [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 ]; +}); +$__jsx_lazy_init(Style, "console", function () { + return ({ 'title': [ '\x1B[32m\x1b[4m', '\x1B[39m\x1b[0m' ], 'url': [ '\x1B[34m', '\x1B[39m' ], 'hit': [ '\x1B[4m', '\x1B[0m' ], 'del': [ '\x1B[9m', '\x1B[0m' ], 'summary': [ '\x1B[90m', '\x1B[39m' ] }); +}); +$__jsx_lazy_init(Style, "html", function () { + return ({ 'title': [ '<span class="title">', '</span>' ], 'url': [ '<span class="url">', '</span>' ], 'hit': [ '<span class="hit">', '</span>' ], 'del': [ '<del>', '</del>' ], 'summary': [ '<span class="reuslt">', '</span>' ] }); +}); +$__jsx_lazy_init(Style, "ignore", function () { + return ({ 'tilte': [ '', '' ], 'url': [ '', '' ], 'hit': [ '', '' ], 'del': [ '', '' ], 'summary': [ '', '' ] }); +}); +$__jsx_lazy_init(_Common, "buffers", function () { + return [ "comment", "sgmlDecl", "textNode", "tagName", "doctype", "procInstName", "procInstBody", "entity", "attribName", "attribValue", "cdata", "script" ]; +}); +$__jsx_lazy_init(_Common, "EVENTS", function () { + return [ "text", "processinginstruction", "sgmldeclaration", "doctype", "comment", "attribute", "opentag", "closetag", "opencdata", "cdata", "clo_State.CDATA", "error", "end", "ready", "script", "opennamespace", "closenamespace" ]; +}); +_Common.MAX_BUFFER_LENGTH = 65536; +_State.BEGIN = 1; +_State.TEXT = 2; +_State.TEXT_ENTITY = 3; +_State.OPEN_WAKA = 4; +_State.SGML_DECL = 5; +_State.SGML_DECL_QUOTED = 6; +_State.DOCTYPE = 7; +_State.DOCTYPE_QUOTED = 8; +_State.DOCTYPE_DTD = 9; +_State.DOCTYPE_DTD_QUOTED = 10; +_State.COMMENT_STARTING = 11; +_State.COMMENT = 12; +_State.COMMENT_ENDING = 13; +_State.COMMENT_ENDED = 14; +_State.CDATA = 15; +_State.CDATA_ENDING = 16; +_State.CDATA_ENDING_2 = 17; +_State.PROC_INST = 18; +_State.PROC_INST_BODY = 19; +_State.PROC_INST_ENDING = 20; +_State.OPEN_TAG = 21; +_State.OPEN_TAG_SLASH = 22; +_State.ATTRIB = 23; +_State.ATTRIB_NAME = 24; +_State.ATTRIB_NAME_SAW_WHITE = 25; +_State.ATTRIB_VALUE = 26; +_State.ATTRIB_VALUE_QUOTED = 27; +_State.ATTRIB_VALUE_UNQUOTED = 28; +_State.ATTRIB_VALUE_ENTITY_Q = 29; +_State.ATTRIB_VALUE_ENTITY_U = 30; +_State.CLOSE_TAG = 31; +_State.CLOSE_TAG_SAW_WHITE = 32; +_State.SCRIPT = 33; +_State.SCRIPT_ENDING = 34; +$__jsx_lazy_init(_Entities, "_entities", function () { + return ({ "amp": "&", "gt": ">", "lt": "<", "quot": "\"", "apos": "'", "AElig": 198, "Aacute": 193, "Acirc": 194, "Agrave": 192, "Aring": 197, "Atilde": 195, "Auml": 196, "Ccedil": 199, "ETH": 208, "Eacute": 201, "Ecirc": 202, "Egrave": 200, "Euml": 203, "Iacute": 205, "Icirc": 206, "Igrave": 204, "Iuml": 207, "Ntilde": 209, "Oacute": 211, "Ocirc": 212, "Ograve": 210, "Oslash": 216, "Otilde": 213, "Ouml": 214, "THORN": 222, "Uacute": 218, "Ucirc": 219, "Ugrave": 217, "Uuml": 220, "Yacute": 221, "aacute": 225, "acirc": 226, "aelig": 230, "agrave": 224, "aring": 229, "atilde": 227, "auml": 228, "ccedil": 231, "eacute": 233, "ecirc": 234, "egrave": 232, "eth": 240, "euml": 235, "iacute": 237, "icirc": 238, "igrave": 236, "iuml": 239, "ntilde": 241, "oacute": 243, "ocirc": 244, "ograve": 242, "oslash": 248, "otilde": 245, "ouml": 246, "szlig": 223, "thorn": 254, "uacute": 250, "ucirc": 251, "ugrave": 249, "uuml": 252, "yacute": 253, "yuml": 255, "copy": 169, "reg": 174, "nbsp": 160, "iexcl": 161, "cent": 162, "pound": 163, "curren": 164, "yen": 165, "brvbar": 166, "sect": 167, "uml": 168, "ordf": 170, "laquo": 171, "not": 172, "shy": 173, "macr": 175, "deg": 176, "plusmn": 177, "sup1": 185, "sup2": 178, "sup3": 179, "acute": 180, "micro": 181, "para": 182, "middot": 183, "cedil": 184, "ordm": 186, "raquo": 187, "frac14": 188, "frac12": 189, "frac34": 190, "iquest": 191, "times": 215, "divide": 247, "OElig": 338, "oelig": 339, "Scaron": 352, "scaron": 353, "Yuml": 376, "fnof": 402, "circ": 710, "tilde": 732, "Alpha": 913, "Beta": 914, "Gamma": 915, "Delta": 916, "Epsilon": 917, "Zeta": 918, "Eta": 919, "Theta": 920, "Iota": 921, "Kappa": 922, "Lambda": 923, "Mu": 924, "Nu": 925, "Xi": 926, "Omicron": 927, "Pi": 928, "Rho": 929, "Sigma": 931, "Tau": 932, "Upsilon": 933, "Phi": 934, "Chi": 935, "Psi": 936, "Omega": 937, "alpha": 945, "beta": 946, "gamma": 947, "delta": 948, "epsilon": 949, "zeta": 950, "eta": 951, "theta": 952, "iota": 953, "kappa": 954, "lambda": 955, "mu": 956, "nu": 957, "xi": 958, "omicron": 959, "pi": 960, "rho": 961, "sigmaf": 962, "sigma": 963, "tau": 964, "upsilon": 965, "phi": 966, "chi": 967, "psi": 968, "omega": 969, "thetasym": 977, "upsih": 978, "piv": 982, "ensp": 8194, "emsp": 8195, "thinsp": 8201, "zwnj": 8204, "zwj": 8205, "lrm": 8206, "rlm": 8207, "ndash": 8211, "mdash": 8212, "lsquo": 8216, "rsquo": 8217, "sbquo": 8218, "ldquo": 8220, "rdquo": 8221, "bdquo": 8222, "dagger": 8224, "Dagger": 8225, "bull": 8226, "hellip": 8230, "permil": 8240, "prime": 8242, "Prime": 8243, "lsaquo": 8249, "rsaquo": 8250, "oline": 8254, "frasl": 8260, "euro": 8364, "image": 8465, "weierp": 8472, "real": 8476, "trade": 8482, "alefsym": 8501, "larr": 8592, "uarr": 8593, "rarr": 8594, "darr": 8595, "harr": 8596, "crarr": 8629, "lArr": 8656, "uArr": 8657, "rArr": 8658, "dArr": 8659, "hArr": 8660, "forall": 8704, "part": 8706, "exist": 8707, "empty": 8709, "nabla": 8711, "isin": 8712, "notin": 8713, "ni": 8715, "prod": 8719, "sum": 8721, "minus": 8722, "lowast": 8727, "radic": 8730, "prop": 8733, "infin": 8734, "ang": 8736, "and": 8743, "or": 8744, "cap": 8745, "cup": 8746, "int": 8747, "there4": 8756, "sim": 8764, "cong": 8773, "asymp": 8776, "ne": 8800, "equiv": 8801, "le": 8804, "ge": 8805, "sub": 8834, "sup": 8835, "nsub": 8836, "sube": 8838, "supe": 8839, "oplus": 8853, "otimes": 8855, "perp": 8869, "sdot": 8901, "lceil": 8968, "rceil": 8969, "lfloor": 8970, "rfloor": 8971, "lang": 9001, "rang": 9002, "loz": 9674, "spades": 9824, "clubs": 9827, "hearts": 9829, "diams": 9830 }); +}); +BitVector.SMALL_BLOCK_SIZE = 32; +BitVector.LARGE_BLOCK_SIZE = 256; +BitVector.BLOCK_RATE = 8; +$__jsx_lazy_init(BurrowsWheelerTransform, "END_MARKER", function () { + return String.fromCharCode(0); +}); +var $__jsx_classMap = { + "tool/web/oktavia-search.jsx": { + _Result: _Result, + _Result$SSSI: _Result$SSSI, + _Proposal: _Proposal, + _Proposal$SSI: _Proposal$SSI, + OktaviaSearch: OktaviaSearch, + OktaviaSearch$I: OktaviaSearch$I, + _Main: _Main, + _Main$: _Main$ + }, + "src/oktavia.jsx": { + Oktavia: Oktavia, + Oktavia$: Oktavia$ + }, + "src/binary-util.jsx": { + Binary: Binary, + Binary$: Binary$, + LoadedStringResult: LoadedStringResult, + LoadedStringResult$SI: LoadedStringResult$SI, + LoadedStringListResult: LoadedStringListResult, + LoadedStringListResult$SI: LoadedStringListResult$SI, + LoadedStringListMapResult: LoadedStringListMapResult, + LoadedStringListMapResult$SI: LoadedStringListMapResult$SI, + LoadedNumberListResult: LoadedNumberListResult, + LoadedNumberListResult$SI: LoadedNumberListResult$SI, + CompressionReport: CompressionReport, + CompressionReport$: CompressionReport$ + }, + "src/query.jsx": { + Query: Query, + Query$: Query$ + }, + "src/query-string-parser.jsx": { + QueryStringParser: QueryStringParser, + QueryStringParser$: QueryStringParser$ + }, + "src/search-result.jsx": { + Proposal: Proposal, + Proposal$II: Proposal$II, + Position: Position, + Position$SIB: Position$SIB, + SearchUnit: SearchUnit, + SearchUnit$I: SearchUnit$I, + SingleResult: SingleResult, + SingleResult$: SingleResult$, + SingleResult$SBB: SingleResult$SBB, + SearchSummary: SearchSummary, + SearchSummary$: SearchSummary$, + SearchSummary$LOktavia$: SearchSummary$LOktavia$ + }, + "src/style.jsx": { + Style: Style, + Style$S: Style$S, + _HTMLHandler: _HTMLHandler, + _HTMLHandler$HASB: _HTMLHandler$HASB + }, + "src/stemmer/stemmer.jsx": { + Stemmer: Stemmer, + Stemmer$: Stemmer$ + }, + "src/metadata.jsx": { + Metadata: Metadata, + Metadata$LOktavia$: Metadata$LOktavia$, + Section: Section, + Section$LOktavia$: Section$LOktavia$, + Splitter: Splitter, + Splitter$LOktavia$: Splitter$LOktavia$, + Splitter$LOktavia$S: Splitter$LOktavia$S, + Table: Table, + Table$LOktavia$AS: Table$LOktavia$AS, + Block: Block, + Block$LOktavia$: Block$LOktavia$ + }, + "src/fm-index.jsx": { + FMIndex: FMIndex, + FMIndex$: FMIndex$ + }, + "src/sax.jsx": { + Tag: Tag, + Tag$S: Tag$S, + _Common: _Common, + _Common$: _Common$, + _State: _State, + _State$: _State$, + SAXHandler: SAXHandler, + SAXHandler$: SAXHandler$, + SAXParser: SAXParser, + SAXParser$LSAXHandler$: SAXParser$LSAXHandler$, + SAXParser$LSAXHandler$B: SAXParser$LSAXHandler$B, + Char: Char, + Char$: Char$, + _Entities: _Entities, + _Entities$: _Entities$ + }, + "src/bit-vector.jsx": { + BitVector: BitVector, + BitVector$: BitVector$ + }, + "src/wavelet-matrix.jsx": { + WaveletMatrix: WaveletMatrix, + WaveletMatrix$: WaveletMatrix$ + }, + "src/burrows-wheeler-transform.jsx": { + BurrowsWheelerTransform: BurrowsWheelerTransform, + BurrowsWheelerTransform$: BurrowsWheelerTransform$ + }, + "src/sais.jsx": { + OArray: OArray, + OArray$AI: OArray$AI, + OArray$AII: OArray$AII, + SAIS: SAIS, + SAIS$: SAIS$ + } +}; + + +/** + * launches _Main.main(:string[]):void invoked by jsx --run|--executable + */ +JSX.runMain = function (sourceFile, args) { + var module = JSX.require(sourceFile); + if (! module) { + throw new ReferenceError("entry point module not found in " + sourceFile); + } + if (! module._Main) { + throw new ReferenceError("entry point _Main not found in " + sourceFile); + } + if (! module._Main.main$AS) { + throw new ReferenceError("entry point _Main.main(:string[]):void not found in " + sourceFile); + } + module._Main.main$AS(args); +}; + +/** + * launches _Test#test*():void invoked by jsx --test + */ +JSX.runTests = function (sourceFile, tests) { + var module = JSX.require(sourceFile); + var testClass = module._Test$; + + if (!testClass) return; // skip if there's no test class + + if(tests.length === 0) { + var p = testClass.prototype; + for (var m in p) { + if (p[m] instanceof Function + && /^test.*[$]$/.test(m)) { + tests.push(m); + } + } + } + else { // set as process arguments + tests = tests.map(function (name) { + return name + "$"; // mangle for function test*():void + }); + } + + var testCase = new testClass(); + + if (testCase.beforeClass$AS != null) + testCase.beforeClass$AS(tests); + + for (var i = 0; i < tests.length; ++i) { + (function (method) { + if (method in testCase) { + testCase.run$SF$V$(method, function() { testCase[method](); }); + } + else { + throw new ReferenceError("No such test method: " + method); + } + }(tests[i])); + } + + if (testCase.afterClass$ != null) + testCase.afterClass$(); +}; +/** + * call a function on load/DOMContentLoaded + */ +function $__jsx_onload (event) { + window.removeEventListener("load", $__jsx_onload); + document.removeEventListener("DOMContentLoaded", $__jsx_onload); + JSX.runMain("tool/web/oktavia-search.jsx", []) +} + +window.addEventListener("load", $__jsx_onload); +document.addEventListener("DOMContentLoaded", $__jsx_onload); + +})(JSX); diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/searchstyle.css b/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/searchstyle.css new file mode 100644 index 00000000..a3d51d43 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_static/searchstyle.css @@ -0,0 +1,174 @@ +form.oktavia_form { + position: relative; + display: block; + width: 240px; + height: 25px; +} + +input.oktavia_search { + -webkit-appearance: searchfield; + -webkit-user-select: text; + cursor: auto; + background-color: white; + color: black; + line-height: normal; + display: inline-block; + padding: 1px; + text-align: start; + margin: 2px 0px 2px 0px; + padding: 1px; +} + +div.oktavia_searchresult_box { + display: none; + position: absolute; + width: 500px; + padding: 10px; + right: 10px; + background-color: #ffffff; + -moz-border-radius: 8px; + border-radius: 8px; + -moz-box-shadow: 3px 3px 5px 5px #b5b2b2; + box-shadow: 3px 3px 5px 5px #b5b2b2; + opacity: 0.95; + z-index: 100000; +} + +div.oktavia_close_search_box { + position: absolute; + top: 10px; + right: 10px; + width: 20px; + height: 20px; + text-align: center; + vertical-align: middle; + color: #666; +} + +div.oktavia_close_search_box:hover { + background-color: #d1e8ff; + border: 1px solid gray; +} + +div.oktavia_close_search_box:active { + background-color: #b4c8db; + border: 1px solid gray; +} + + +div.oktavia_searchresult_summary { + color: #444; +} + +div.oktavia_searchresult .entry { + margin: 10px 10px 10px 10px; + color: black; +} + +div.oktavia_searchresult .entry .title { + font-size: normal; +} + +div.oktavia_searchresult .entry .title a:link { + color: #0000EE; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .title a:visited { + color: #551A8B; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .title a:hover { +} + +div.oktavia_searchresult .entry .title a:active { + color: #FF0000; + text-decoration: underline; +} + +div.oktavia_searchresult .entry .url { + font-size: 14px!important; + color: #093; + font-style: normal; + font-family: arial,sans-serif; +} + +div.oktavia_searchresult .entry .resultcontent { + font-size: small; + font-family: arial,sans-serif; + color: #222; +} + +div.oktavia_searchresult .entry .resultcontent .hit { + font-weight: bolder; + text-decoration: underline; +} + +div.oktavia_searchresult .proposal { + margin: 10px 10px 10px 10px; + color: #222; + font-size: small; + font-family: arial,sans-serif; +} + +div.oktavia_searchresult .proposal .option { + background-color: #e8f4ff; + border-bottom: 1px solid blue; +} + +div.oktavia_searchresult .proposal .option:hover { + background-color: #d1e8ff; +} + +div.oktavia_searchresult .proposal .option:active { + background-color: #b4c8db; +} + +div.oktavia_searchresult_nav span.leader { + color: #228; +} + +div.oktavia_searchresult_nav span.page { + background-color: #ffffff; + border: 1px solid #888888; + padding: 5px; + margin: 5px; + color: #222; +} + +div.oktavia_searchresult_nav span.page:hover { + background-color: #d1e8ff; + border: 1px solid #7d98ff; +} + +div.oktavia_searchresult_nav span.page:active { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected:hover { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_nav span.selected:active { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +div.oktavia_searchresult_box span.pr { + position: absolute; + right: 10px; + bottom: 10px; + color: #555; +} + +.highlighted { + background-color: #fbe54e; +} diff --git a/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_templates/oktaviasearch.html b/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_templates/oktaviasearch.html new file mode 100644 index 00000000..30bf8626 --- /dev/null +++ b/web/server/h2o/libh2o/misc/oktavia/templates/tinkerer/_templates/oktaviasearch.html @@ -0,0 +1,8 @@ +<div class="widget"> + <h1>Search by Oktavia</h1> + <script type="text/javascript" src="{{ pathto("_static/oktavia-search.js", 1) }}"></script> + <script type="text/javascript" src="{{ pathto("_static/oktavia-jquery-ui.js", 1) }}"></script> + <link rel="stylesheet" href="{{ pathto("_static/searchstyle.css", 1) }}" type="text/css" /> + <div id="oktavia_search_form" data-index="search/searchindex.js"></div> +</div> + |