!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.YASR=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0; var S; try{S = sessionStorage;}catch(e){} //Firefox crashes when executed as local file system //append required CSS rules h.append(""); /** * Function to allow column resizing for table objects. It is the starting point to apply the plugin. * @param {DOM node} tb - refrence to the DOM table object to be enhanced * @param {Object} options - some customization values */ var init = function( tb, options){ var t = $(tb); //the table object is wrapped if(options.disable) return destroy(t); //the user is asking to destroy a previously colResized table var id = t.id = t.attr(ID) || SIGNATURE+count++; //its id is obtained, if null new one is generated t.p = options.postbackSafe; //shortcut to detect postback safe if(!t.is("table") || tables[id]) return; //if the object is not a table or if it was already processed then it is ignored. t.addClass(SIGNATURE).attr(ID, id).before('
'); //the grips container object is added. Signature class forces table rendering in fixed-layout mode to prevent column's min-width t.opt = options; t.g = []; t.c = []; t.w = t.width(); t.gc = t.prev(); //t.c and t.g are arrays of columns and grips respectively if(options.marginLeft) t.gc.css("marginLeft", options.marginLeft); //if the table contains margins, it must be specified if(options.marginRight) t.gc.css("marginRight", options.marginRight); //since there is no (direct) way to obtain margin values in its original units (%, em, ...) t.cs = I(ie? tb.cellSpacing || tb.currentStyle.borderSpacing :t.css('border-spacing'))||2; //table cellspacing (not even jQuery is fully cross-browser) t.b = I(ie? tb.border || tb.currentStyle.borderLeftWidth :t.css('border-left-width'))||1; //outer border width (again cross-browser isues) // if(!(tb.style.width || tb.width)) t.width(t.width()); //I am not an IE fan at all, but it is a pitty that only IE has the currentStyle attribute working as expected. For this reason I can not check easily if the table has an explicit width or if it is rendered as "auto" tables[id] = t; //the table object is stored using its id as key createGrips(t); //grips are created }; /** * This function allows to remove any enhancements performed by this plugin on a previously processed table. * @param {jQuery ref} t - table object */ var destroy = function(t){ var id=t.attr(ID), t=tables[id]; //its table object is found if(!t||!t.is("table")) return; //if none, then it wasnt processed t.removeClass(SIGNATURE).gc.remove(); //class and grips are removed delete tables[id]; //clean up data }; /** * Function to create all the grips associated with the table given by parameters * @param {jQuery ref} t - table object */ var createGrips = function(t){ var th = t.find(">thead>tr>th,>thead>tr>td"); //if table headers are specified in its semantically correct tag, are obtained if(!th.length) th = t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td"); //but headers can also be included in different ways t.cg = t.find("col"); //a table can also contain a colgroup with col elements t.ln = th.length; //table length is stored if(t.p && S && S[t.id])memento(t,th); //if 'postbackSafe' is enabled and there is data for the current table, its coloumn layout is restored th.each(function(i){ //iterate through the table column headers var c = $(this); //jquery wrap for the current column var g = $(t.gc.append('
')[0].lastChild); //add the visual node to be used as grip g.t = t; g.i = i; g.c = c; c.w =c.width(); //some values are stored in the grip's node data t.g.push(g); t.c.push(c); //the current grip and column are added to its table object c.width(c.w).removeAttr("width"); //the width of the column is converted into pixel-based measurements if (i < t.ln-1) { g.bind('touchstart mousedown', onGripMouseDown).append(t.opt.gripInnerHtml).append('
'); //bind the mousedown event to start dragging } else g.addClass("JCLRLastGrip").removeClass("JCLRgrip"); //the last grip is used only to store data g.data(SIGNATURE, {i:i, t:t.attr(ID)}); //grip index and its table name are stored in the HTML }); t.cg.removeAttr("width"); //remove the width attribute from elements in the colgroup (in any) syncGrips(t); //the grips are positioned according to the current table layout //there is a small problem, some cells in the table could contain dimension values interfering with the //width value set by this plugin. Those values are removed t.find('td, th').not(th).not('table th, table td').each(function(){ $(this).removeAttr('width'); //the width attribute is removed from all table cells which are not nested in other tables and dont belong to the header }); }; /** * Function to allow the persistence of columns dimensions after a browser postback. It is based in * the HTML5 sessionStorage object, which can be emulated for older browsers using sessionstorage.js * @param {jQuery ref} t - table object * @param {jQuery ref} th - reference to the first row elements (only set in deserialization) */ var memento = function(t, th){ var w,m=0,i=0,aux =[]; if(th){ //in deserialization mode (after a postback) t.cg.removeAttr("width"); if(t.opt.flush){ S[t.id] =""; return;} //if flush is activated, stored data is removed w = S[t.id].split(";"); //column widths is obtained for(;i*{cursor:"+ t.opt.dragCursor +"!important}"); //change the mouse cursor g.addClass(t.opt.draggingClass); //add the dragging class (to allow some visual feedback) drag = g; //the current grip is stored as the current dragging object if(t.c[o.i].l) for(var i=0,c; i= options.end) { exit = true; } // update global state options.state.rowNum++; options.state.colNum = 1; } function endOfValue() { if(options.onParseValue === undefined) { // onParseValue hook not set entry.push(value); } else { var hook = options.onParseValue(value, options.state); // onParseValue Hook // false skips the row, configurable through a hook if(hook !== false) { entry.push(hook); } } //console.log('value:' + value); // reset the state value = ''; state = 0; // update global state options.state.colNum++; } // escape regex-specific control chars var escSeparator = RegExp.escape(separator); var escDelimiter = RegExp.escape(delimiter); // compile the regEx str using the custom delimiter/separator var match = /(D|S|\n|\r|[^DS\r\n]+)/; var matchSrc = match.source; matchSrc = matchSrc.replace(/S/g, escSeparator); matchSrc = matchSrc.replace(/D/g, escDelimiter); match = RegExp(matchSrc, 'gm'); // put on your fancy pants... // process control chars individually, use look-ahead on non-control chars csv.replace(match, function (m0) { if(exit) { return; } switch (state) { // the start of a value case 0: // null last value if (m0 === separator) { value += ''; endOfValue(); break; } // opening delimiter if (m0 === delimiter) { state = 1; break; } // null last value if (m0 === '\n') { endOfValue(); endOfEntry(); break; } // phantom carriage return if (/^\r$/.test(m0)) { break; } // un-delimited value value += m0; state = 3; break; // delimited input case 1: // second delimiter? check further if (m0 === delimiter) { state = 2; break; } // delimited data value += m0; state = 1; break; // delimiter found in delimited input case 2: // escaped delimiter? if (m0 === delimiter) { value += m0; state = 1; break; } // null value if (m0 === separator) { endOfValue(); break; } // end of entry if (m0 === '\n') { endOfValue(); endOfEntry(); break; } // phantom carriage return if (/^\r$/.test(m0)) { break; } // broken paser? throw new Error('CSVDataError: Illegal State [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); // un-delimited input case 3: // null last value if (m0 === separator) { endOfValue(); break; } // end of entry if (m0 === '\n') { endOfValue(); endOfEntry(); break; } // phantom carriage return if (/^\r$/.test(m0)) { break; } if (m0 === delimiter) { // non-compliant data throw new Error('CSVDataError: Illegal Quote [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); } // broken parser? throw new Error('CSVDataError: Illegal Data [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); default: // shenanigans throw new Error('CSVDataError: Unknown State [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); } //console.log('val:' + m0 + ' state:' + state); }); // submit the last entry // ignore null last line if(entry.length !== 0) { endOfValue(); endOfEntry(); } return data; }, // a csv-specific line splitter splitLines: function(csv, options) { // cache settings var separator = options.separator; var delimiter = options.delimiter; // set initial state if it's missing if(!options.state.rowNum) { options.state.rowNum = 1; } // clear initial state var entries = []; var state = 0; var entry = ''; var exit = false; function endOfLine() { // reset the state state = 0; // if 'start' hasn't been met, don't output if(options.start && options.state.rowNum < options.start) { // update global state entry = ''; options.state.rowNum++; return; } if(options.onParseEntry === undefined) { // onParseEntry hook not set entries.push(entry); } else { var hookVal = options.onParseEntry(entry, options.state); // onParseEntry Hook // false skips the row, configurable through a hook if(hookVal !== false) { entries.push(hookVal); } } // cleanup entry = ''; // if 'end' is met, stop parsing if(options.end && options.state.rowNum >= options.end) { exit = true; } // update global state options.state.rowNum++; } // escape regex-specific control chars var escSeparator = RegExp.escape(separator); var escDelimiter = RegExp.escape(delimiter); // compile the regEx str using the custom delimiter/separator var match = /(D|S|\n|\r|[^DS\r\n]+)/; var matchSrc = match.source; matchSrc = matchSrc.replace(/S/g, escSeparator); matchSrc = matchSrc.replace(/D/g, escDelimiter); match = RegExp(matchSrc, 'gm'); // put on your fancy pants... // process control chars individually, use look-ahead on non-control chars csv.replace(match, function (m0) { if(exit) { return; } switch (state) { // the start of a value/entry case 0: // null value if (m0 === separator) { entry += m0; state = 0; break; } // opening delimiter if (m0 === delimiter) { entry += m0; state = 1; break; } // end of line if (m0 === '\n') { endOfLine(); break; } // phantom carriage return if (/^\r$/.test(m0)) { break; } // un-delimit value entry += m0; state = 3; break; // delimited input case 1: // second delimiter? check further if (m0 === delimiter) { entry += m0; state = 2; break; } // delimited data entry += m0; state = 1; break; // delimiter found in delimited input case 2: // escaped delimiter? var prevChar = entry.substr(entry.length - 1); if (m0 === delimiter && prevChar === delimiter) { entry += m0; state = 1; break; } // end of value if (m0 === separator) { entry += m0; state = 0; break; } // end of line if (m0 === '\n') { endOfLine(); break; } // phantom carriage return if (m0 === '\r') { break; } // broken paser? throw new Error('CSVDataError: Illegal state [Row:' + options.state.rowNum + ']'); // un-delimited input case 3: // null value if (m0 === separator) { entry += m0; state = 0; break; } // end of line if (m0 === '\n') { endOfLine(); break; } // phantom carriage return if (m0 === '\r') { break; } // non-compliant data if (m0 === delimiter) { throw new Error('CSVDataError: Illegal quote [Row:' + options.state.rowNum + ']'); } // broken parser? throw new Error('CSVDataError: Illegal state [Row:' + options.state.rowNum + ']'); default: // shenanigans throw new Error('CSVDataError: Unknown state [Row:' + options.state.rowNum + ']'); } //console.log('val:' + m0 + ' state:' + state); }); // submit the last entry // ignore null last line if(entry !== '') { endOfLine(); } return entries; }, // a csv entry parser parseEntry: function(csv, options) { // cache settings var separator = options.separator; var delimiter = options.delimiter; // set initial state if it's missing if(!options.state.rowNum) { options.state.rowNum = 1; } if(!options.state.colNum) { options.state.colNum = 1; } // clear initial state var entry = []; var state = 0; var value = ''; function endOfValue() { if(options.onParseValue === undefined) { // onParseValue hook not set entry.push(value); } else { var hook = options.onParseValue(value, options.state); // onParseValue Hook // false skips the value, configurable through a hook if(hook !== false) { entry.push(hook); } } // reset the state value = ''; state = 0; // update global state options.state.colNum++; } // checked for a cached regEx first if(!options.match) { // escape regex-specific control chars var escSeparator = RegExp.escape(separator); var escDelimiter = RegExp.escape(delimiter); // compile the regEx str using the custom delimiter/separator var match = /(D|S|\n|\r|[^DS\r\n]+)/; var matchSrc = match.source; matchSrc = matchSrc.replace(/S/g, escSeparator); matchSrc = matchSrc.replace(/D/g, escDelimiter); options.match = RegExp(matchSrc, 'gm'); } // put on your fancy pants... // process control chars individually, use look-ahead on non-control chars csv.replace(options.match, function (m0) { switch (state) { // the start of a value case 0: // null last value if (m0 === separator) { value += ''; endOfValue(); break; } // opening delimiter if (m0 === delimiter) { state = 1; break; } // skip un-delimited new-lines if (m0 === '\n' || m0 === '\r') { break; } // un-delimited value value += m0; state = 3; break; // delimited input case 1: // second delimiter? check further if (m0 === delimiter) { state = 2; break; } // delimited data value += m0; state = 1; break; // delimiter found in delimited input case 2: // escaped delimiter? if (m0 === delimiter) { value += m0; state = 1; break; } // null value if (m0 === separator) { endOfValue(); break; } // skip un-delimited new-lines if (m0 === '\n' || m0 === '\r') { break; } // broken paser? throw new Error('CSVDataError: Illegal State [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); // un-delimited input case 3: // null last value if (m0 === separator) { endOfValue(); break; } // skip un-delimited new-lines if (m0 === '\n' || m0 === '\r') { break; } // non-compliant data if (m0 === delimiter) { throw new Error('CSVDataError: Illegal Quote [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); } // broken parser? throw new Error('CSVDataError: Illegal Data [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); default: // shenanigans throw new Error('CSVDataError: Unknown State [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); } //console.log('val:' + m0 + ' state:' + state); }); // submit the last value endOfValue(); return entry; } }, /** * $.csv.toArray(csv) * Converts a CSV entry string to a javascript array. * * @param {Array} csv The string containing the CSV data. * @param {Object} [options] An object containing user-defined options. * @param {Character} [separator] An override for the separator character. Defaults to a comma(,). * @param {Character} [delimiter] An override for the delimiter character. Defaults to a double-quote("). * * This method deals with simple CSV strings only. It's useful if you only * need to parse a single entry. If you need to parse more than one line, * use $.csv2Array instead. */ toArray: function(csv, options, callback) { var options = (options !== undefined ? options : {}); var config = {}; config.callback = ((callback !== undefined && typeof(callback) === 'function') ? callback : false); config.separator = 'separator' in options ? options.separator : $.csv.defaults.separator; config.delimiter = 'delimiter' in options ? options.delimiter : $.csv.defaults.delimiter; var state = (options.state !== undefined ? options.state : {}); // setup var options = { delimiter: config.delimiter, separator: config.separator, onParseEntry: options.onParseEntry, onParseValue: options.onParseValue, state: state } var entry = $.csv.parsers.parseEntry(csv, options); // push the value to a callback if one is defined if(!config.callback) { return entry; } else { config.callback('', entry); } }, /** * $.csv.toArrays(csv) * Converts a CSV string to a javascript array. * * @param {String} csv The string containing the raw CSV data. * @param {Object} [options] An object containing user-defined options. * @param {Character} [separator] An override for the separator character. Defaults to a comma(,). * @param {Character} [delimiter] An override for the delimiter character. Defaults to a double-quote("). * * This method deals with multi-line CSV. The breakdown is simple. The first * dimension of the array represents the line (or entry/row) while the second * dimension contains the values (or values/columns). */ toArrays: function(csv, options, callback) { var options = (options !== undefined ? options : {}); var config = {}; config.callback = ((callback !== undefined && typeof(callback) === 'function') ? callback : false); config.separator = 'separator' in options ? options.separator : $.csv.defaults.separator; config.delimiter = 'delimiter' in options ? options.delimiter : $.csv.defaults.delimiter; // setup var data = []; var options = { delimiter: config.delimiter, separator: config.separator, onParseEntry: options.onParseEntry, onParseValue: options.onParseValue, start: options.start, end: options.end, state: { rowNum: 1, colNum: 1 } }; // break the data down to lines data = $.csv.parsers.parse(csv, options); // push the value to a callback if one is defined if(!config.callback) { return data; } else { config.callback('', data); } }, /** * $.csv.toObjects(csv) * Converts a CSV string to a javascript object. * @param {String} csv The string containing the raw CSV data. * @param {Object} [options] An object containing user-defined options. * @param {Character} [separator] An override for the separator character. Defaults to a comma(,). * @param {Character} [delimiter] An override for the delimiter character. Defaults to a double-quote("). * @param {Boolean} [headers] Indicates whether the data contains a header line. Defaults to true. * * This method deals with multi-line CSV strings. Where the headers line is * used as the key for each value per entry. */ toObjects: function(csv, options, callback) { var options = (options !== undefined ? options : {}); var config = {}; config.callback = ((callback !== undefined && typeof(callback) === 'function') ? callback : false); config.separator = 'separator' in options ? options.separator : $.csv.defaults.separator; config.delimiter = 'delimiter' in options ? options.delimiter : $.csv.defaults.delimiter; config.headers = 'headers' in options ? options.headers : $.csv.defaults.headers; options.start = 'start' in options ? options.start : 1; // account for headers if(config.headers) { options.start++; } if(options.end && config.headers) { options.end++; } // setup var lines = []; var data = []; var options = { delimiter: config.delimiter, separator: config.separator, onParseEntry: options.onParseEntry, onParseValue: options.onParseValue, start: options.start, end: options.end, state: { rowNum: 1, colNum: 1 }, match: false }; // fetch the headers var headerOptions = { delimiter: config.delimiter, separator: config.separator, start: 1, end: 1, state: { rowNum:1, colNum:1 } } var headerLine = $.csv.parsers.splitLines(csv, headerOptions); var headers = $.csv.toArray(headerLine[0], options); // fetch the data var lines = $.csv.parsers.splitLines(csv, options); // reset the state for re-use options.state.colNum = 1; if(headers){ options.state.rowNum = 2; } else { options.state.rowNum = 1; } // convert data to objects for(var i=0, len=lines.length; i 0 && this._events[type].length > m) { this._events[type].warned = true; console.error('(node) warning: possible EventEmitter memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', this._events[type].length); if (typeof console.trace === 'function') { // not supported in IE 10 console.trace(); } } } return this; }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; EventEmitter.prototype.once = function(type, listener) { if (!isFunction(listener)) throw TypeError('listener must be a function'); var fired = false; function g() { this.removeListener(type, g); if (!fired) { fired = true; listener.apply(this, arguments); } } g.listener = listener; this.on(type, g); return this; }; // emits a 'removeListener' event iff the listener was removed EventEmitter.prototype.removeListener = function(type, listener) { var list, position, length, i; if (!isFunction(listener)) throw TypeError('listener must be a function'); if (!this._events || !this._events[type]) return this; list = this._events[type]; length = list.length; position = -1; if (list === listener || (isFunction(list.listener) && list.listener === listener)) { delete this._events[type]; if (this._events.removeListener) this.emit('removeListener', type, listener); } else if (isObject(list)) { for (i = length; i-- > 0;) { if (list[i] === listener || (list[i].listener && list[i].listener === listener)) { position = i; break; } } if (position < 0) return this; if (list.length === 1) { list.length = 0; delete this._events[type]; } else { list.splice(position, 1); } if (this._events.removeListener) this.emit('removeListener', type, listener); } return this; }; EventEmitter.prototype.removeAllListeners = function(type) { var key, listeners; if (!this._events) return this; // not listening for removeListener, no need to emit if (!this._events.removeListener) { if (arguments.length === 0) this._events = {}; else if (this._events[type]) delete this._events[type]; return this; } // emit removeListener for all listeners on all events if (arguments.length === 0) { for (key in this._events) { if (key === 'removeListener') continue; this.removeAllListeners(key); } this.removeAllListeners('removeListener'); this._events = {}; return this; } listeners = this._events[type]; if (isFunction(listeners)) { this.removeListener(type, listeners); } else { // LIFO order while (listeners.length) this.removeListener(type, listeners[listeners.length - 1]); } delete this._events[type]; return this; }; EventEmitter.prototype.listeners = function(type) { var ret; if (!this._events || !this._events[type]) ret = []; else if (isFunction(this._events[type])) ret = [this._events[type]]; else ret = this._events[type].slice(); return ret; }; EventEmitter.listenerCount = function(emitter, type) { var ret; if (!emitter._events || !emitter._events[type]) ret = 0; else if (isFunction(emitter._events[type])) ret = 1; else ret = emitter._events[type].length; return ret; }; function isFunction(arg) { return typeof arg === 'function'; } function isNumber(arg) { return typeof arg === 'number'; } function isObject(arg) { return typeof arg === 'object' && arg !== null; } function isUndefined(arg) { return arg === void 0; } },{}],5:[function(require,module,exports){ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod((function(){try{return require('codemirror')}catch(e){return window.CodeMirror}})()); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { var ie_lt8 = /MSIE \d/.test(navigator.userAgent) && (document.documentMode == null || document.documentMode < 8); var Pos = CodeMirror.Pos; var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; function findMatchingBracket(cm, where, strict, config) { var line = cm.getLineHandle(where.line), pos = where.ch - 1; var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; if (!match) return null; var dir = match.charAt(1) == ">" ? 1 : -1; if (strict && (dir > 0) != (pos == where.ch)) return null; var style = cm.getTokenTypeAt(Pos(where.line, pos + 1)); var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config); if (found == null) return null; return {from: Pos(where.line, pos), to: found && found.pos, match: found && found.ch == match.charAt(0), forward: dir > 0}; } // bracketRegex is used to specify which type of bracket to scan // should be a regexp, e.g. /[[\]]/ // // Note: If "where" is on an open bracket, then this bracket is ignored. // // Returns false when no bracket was found, null when it reached // maxScanLines and gave up function scanForBracket(cm, where, dir, style, config) { var maxScanLen = (config && config.maxScanLineLength) || 10000; var maxScanLines = (config && config.maxScanLines) || 1000; var stack = []; var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/; var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) : Math.max(cm.firstLine() - 1, where.line - maxScanLines); for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) { var line = cm.getLine(lineNo); if (!line) continue; var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1; if (line.length > maxScanLen) continue; if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0); for (; pos != end; pos += dir) { var ch = line.charAt(pos); if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) { var match = matching[ch]; if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch); else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch}; else stack.pop(); } } } return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null; } function matchBrackets(cm, autoclear, config) { // Disable brace matching in long lines, since it'll cause hugely slow updates var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000; var marks = [], ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config); if (match && cm.getLine(match.from.line).length <= maxHighlightLen) { var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style})); if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen) marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style})); } } if (marks.length) { // Kludge to work around the IE bug from issue #1193, where text // input stops going to the textare whever this fires. if (ie_lt8 && cm.state.focused) cm.display.input.focus(); var clear = function() { cm.operation(function() { for (var i = 0; i < marks.length; i++) marks[i].clear(); }); }; if (autoclear) setTimeout(clear, 800); else return clear; } } var currentlyHighlighted = null; function doMatchBrackets(cm) { cm.operation(function() { if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;} currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets); }); } CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { if (old && old != CodeMirror.Init) cm.off("cursorActivity", doMatchBrackets); if (val) { cm.state.matchBrackets = typeof val == "object" ? val : {}; cm.on("cursorActivity", doMatchBrackets); } }); CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);}); CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config){ return findMatchingBracket(this, pos, strict, config); }); CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){ return scanForBracket(this, pos, dir, style, config); }); }); },{"codemirror":undefined}],6:[function(require,module,exports){ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod((function(){try{return require('codemirror')}catch(e){return window.CodeMirror}})()); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.registerHelper("fold", "brace", function(cm, start) { var line = start.line, lineText = cm.getLine(line); var startCh, tokenType; function findOpening(openCh) { for (var at = start.ch, pass = 0;;) { var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1); if (found == -1) { if (pass == 1) break; pass = 1; at = lineText.length; continue; } if (pass == 1 && found < start.ch) break; tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)); if (!/^(comment|string)/.test(tokenType)) return found + 1; at = found - 1; } } var startToken = "{", endToken = "}", startCh = findOpening("{"); if (startCh == null) { startToken = "[", endToken = "]"; startCh = findOpening("["); } if (startCh == null) return; var count = 1, lastLine = cm.lastLine(), end, endCh; outer: for (var i = line; i <= lastLine; ++i) { var text = cm.getLine(i), pos = i == line ? startCh : 0; for (;;) { var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); if (nextOpen < 0) nextOpen = text.length; if (nextClose < 0) nextClose = text.length; pos = Math.min(nextOpen, nextClose); if (pos == text.length) break; if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) { if (pos == nextOpen) ++count; else if (!--count) { end = i; endCh = pos; break outer; } } ++pos; } } if (end == null || line == end && endCh == startCh) return; return {from: CodeMirror.Pos(line, startCh), to: CodeMirror.Pos(end, endCh)}; }); CodeMirror.registerHelper("fold", "import", function(cm, start) { function hasImport(line) { if (line < cm.firstLine() || line > cm.lastLine()) return null; var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); if (start.type != "keyword" || start.string != "import") return null; // Now find closing semicolon, return its position for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) { var text = cm.getLine(i), semi = text.indexOf(";"); if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)}; } } var start = start.line, has = hasImport(start), prev; if (!has || hasImport(start - 1) || ((prev = hasImport(start - 2)) && prev.end.line == start - 1)) return null; for (var end = has.end;;) { var next = hasImport(end.line + 1); if (next == null) break; end = next.end; } return {from: cm.clipPos(CodeMirror.Pos(start, has.startCh + 1)), to: end}; }); CodeMirror.registerHelper("fold", "include", function(cm, start) { function hasInclude(line) { if (line < cm.firstLine() || line > cm.lastLine()) return null; var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8; } var start = start.line, has = hasInclude(start); if (has == null || hasInclude(start - 1) != null) return null; for (var end = start;;) { var next = hasInclude(end + 1); if (next == null) break; ++end; } return {from: CodeMirror.Pos(start, has + 1), to: cm.clipPos(CodeMirror.Pos(end))}; }); }); },{"codemirror":undefined}],7:[function(require,module,exports){ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod((function(){try{return require('codemirror')}catch(e){return window.CodeMirror}})()); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; function doFold(cm, pos, options, force) { if (options && options.call) { var finder = options; options = null; } else { var finder = getOption(cm, options, "rangeFinder"); } if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); var minSize = getOption(cm, options, "minFoldSize"); function getRange(allowFolded) { var range = finder(cm, pos); if (!range || range.to.line - range.from.line < minSize) return null; var marks = cm.findMarksAt(range.from); for (var i = 0; i < marks.length; ++i) { if (marks[i].__isFold && force !== "fold") { if (!allowFolded) return null; range.cleared = true; marks[i].clear(); } } return range; } var range = getRange(true); if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) { pos = CodeMirror.Pos(pos.line - 1, 0); range = getRange(false); } if (!range || range.cleared || force === "unfold") return; var myWidget = makeWidget(cm, options); CodeMirror.on(myWidget, "mousedown", function(e) { myRange.clear(); CodeMirror.e_preventDefault(e); }); var myRange = cm.markText(range.from, range.to, { replacedWith: myWidget, clearOnEnter: true, __isFold: true }); myRange.on("clear", function(from, to) { CodeMirror.signal(cm, "unfold", cm, from, to); }); CodeMirror.signal(cm, "fold", cm, range.from, range.to); } function makeWidget(cm, options) { var widget = getOption(cm, options, "widget"); if (typeof widget == "string") { var text = document.createTextNode(widget); widget = document.createElement("span"); widget.appendChild(text); widget.className = "CodeMirror-foldmarker"; } return widget; } // Clumsy backwards-compatible interface CodeMirror.newFoldFunction = function(rangeFinder, widget) { return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); }; }; // New-style interface CodeMirror.defineExtension("foldCode", function(pos, options, force) { doFold(this, pos, options, force); }); CodeMirror.defineExtension("isFolded", function(pos) { var marks = this.findMarksAt(pos); for (var i = 0; i < marks.length; ++i) if (marks[i].__isFold) return true; }); CodeMirror.commands.toggleFold = function(cm) { cm.foldCode(cm.getCursor()); }; CodeMirror.commands.fold = function(cm) { cm.foldCode(cm.getCursor(), null, "fold"); }; CodeMirror.commands.unfold = function(cm) { cm.foldCode(cm.getCursor(), null, "unfold"); }; CodeMirror.commands.foldAll = function(cm) { cm.operation(function() { for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); }); }; CodeMirror.commands.unfoldAll = function(cm) { cm.operation(function() { for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold"); }); }; CodeMirror.registerHelper("fold", "combine", function() { var funcs = Array.prototype.slice.call(arguments, 0); return function(cm, start) { for (var i = 0; i < funcs.length; ++i) { var found = funcs[i](cm, start); if (found) return found; } }; }); CodeMirror.registerHelper("fold", "auto", function(cm, start) { var helpers = cm.getHelpers(start, "fold"); for (var i = 0; i < helpers.length; i++) { var cur = helpers[i](cm, start); if (cur) return cur; } }); var defaultOptions = { rangeFinder: CodeMirror.fold.auto, widget: "\u2194", minFoldSize: 0, scanUp: false }; CodeMirror.defineOption("foldOptions", null); function getOption(cm, options, name) { if (options && options[name] !== undefined) return options[name]; var editorOptions = cm.options.foldOptions; if (editorOptions && editorOptions[name] !== undefined) return editorOptions[name]; return defaultOptions[name]; } CodeMirror.defineExtension("foldOption", function(options, name) { return getOption(this, options, name); }); }); },{"codemirror":undefined}],8:[function(require,module,exports){ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod((function(){try{return require('codemirror')}catch(e){return window.CodeMirror}})(), require("./foldcode")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror", "./foldcode"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.defineOption("foldGutter", false, function(cm, val, old) { if (old && old != CodeMirror.Init) { cm.clearGutter(cm.state.foldGutter.options.gutter); cm.state.foldGutter = null; cm.off("gutterClick", onGutterClick); cm.off("change", onChange); cm.off("viewportChange", onViewportChange); cm.off("fold", onFold); cm.off("unfold", onFold); cm.off("swapDoc", updateInViewport); } if (val) { cm.state.foldGutter = new State(parseOptions(val)); updateInViewport(cm); cm.on("gutterClick", onGutterClick); cm.on("change", onChange); cm.on("viewportChange", onViewportChange); cm.on("fold", onFold); cm.on("unfold", onFold); cm.on("swapDoc", updateInViewport); } }); var Pos = CodeMirror.Pos; function State(options) { this.options = options; this.from = this.to = 0; } function parseOptions(opts) { if (opts === true) opts = {}; if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter"; if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open"; if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded"; return opts; } function isFolded(cm, line) { var marks = cm.findMarksAt(Pos(line)); for (var i = 0; i < marks.length; ++i) if (marks[i].__isFold && marks[i].find().from.line == line) return true; } function marker(spec) { if (typeof spec == "string") { var elt = document.createElement("div"); elt.className = spec + " CodeMirror-guttermarker-subtle"; return elt; } else { return spec.cloneNode(true); } } function updateFoldInfo(cm, from, to) { var opts = cm.state.foldGutter.options, cur = from; var minSize = cm.foldOption(opts, "minFoldSize"); var func = cm.foldOption(opts, "rangeFinder"); cm.eachLine(from, to, function(line) { var mark = null; if (isFolded(cm, cur)) { mark = marker(opts.indicatorFolded); } else { var pos = Pos(cur, 0); var range = func && func(cm, pos); if (range && range.to.line - range.from.line >= minSize) mark = marker(opts.indicatorOpen); } cm.setGutterMarker(line, opts.gutter, mark); ++cur; }); } function updateInViewport(cm) { var vp = cm.getViewport(), state = cm.state.foldGutter; if (!state) return; cm.operation(function() { updateFoldInfo(cm, vp.from, vp.to); }); state.from = vp.from; state.to = vp.to; } function onGutterClick(cm, line, gutter) { var state = cm.state.foldGutter; if (!state) return; var opts = state.options; if (gutter != opts.gutter) return; cm.foldCode(Pos(line, 0), opts.rangeFinder); } function onChange(cm) { var state = cm.state.foldGutter; if (!state) return; var opts = state.options; state.from = state.to = 0; clearTimeout(state.changeUpdate); state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600); } function onViewportChange(cm) { var state = cm.state.foldGutter; if (!state) return; var opts = state.options; clearTimeout(state.changeUpdate); state.changeUpdate = setTimeout(function() { var vp = cm.getViewport(); if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) { updateInViewport(cm); } else { cm.operation(function() { if (vp.from < state.from) { updateFoldInfo(cm, vp.from, state.from); state.from = vp.from; } if (vp.to > state.to) { updateFoldInfo(cm, state.to, vp.to); state.to = vp.to; } }); } }, opts.updateViewportTimeSpan || 400); } function onFold(cm, from) { var state = cm.state.foldGutter; if (!state) return; var line = from.line; if (line >= state.from && line < state.to) updateFoldInfo(cm, line, line + 1); } }); },{"./foldcode":7,"codemirror":undefined}],9:[function(require,module,exports){ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod((function(){try{return require('codemirror')}catch(e){return window.CodeMirror}})()); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; var Pos = CodeMirror.Pos; function cmp(a, b) { return a.line - b.line || a.ch - b.ch; } var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g"); function Iter(cm, line, ch, range) { this.line = line; this.ch = ch; this.cm = cm; this.text = cm.getLine(line); this.min = range ? range.from : cm.firstLine(); this.max = range ? range.to - 1 : cm.lastLine(); } function tagAt(iter, ch) { var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch)); return type && /\btag\b/.test(type); } function nextLine(iter) { if (iter.line >= iter.max) return; iter.ch = 0; iter.text = iter.cm.getLine(++iter.line); return true; } function prevLine(iter) { if (iter.line <= iter.min) return; iter.text = iter.cm.getLine(--iter.line); iter.ch = iter.text.length; return true; } function toTagEnd(iter) { for (;;) { var gt = iter.text.indexOf(">", iter.ch); if (gt == -1) { if (nextLine(iter)) continue; else return; } if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; } var lastSlash = iter.text.lastIndexOf("/", gt); var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); iter.ch = gt + 1; return selfClose ? "selfClose" : "regular"; } } function toTagStart(iter) { for (;;) { var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1; if (lt == -1) { if (prevLine(iter)) continue; else return; } if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; } xmlTagStart.lastIndex = lt; iter.ch = lt; var match = xmlTagStart.exec(iter.text); if (match && match.index == lt) return match; } } function toNextTag(iter) { for (;;) { xmlTagStart.lastIndex = iter.ch; var found = xmlTagStart.exec(iter.text); if (!found) { if (nextLine(iter)) continue; else return; } if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; } iter.ch = found.index + found[0].length; return found; } } function toPrevTag(iter) { for (;;) { var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1; if (gt == -1) { if (prevLine(iter)) continue; else return; } if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; } var lastSlash = iter.text.lastIndexOf("/", gt); var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); iter.ch = gt + 1; return selfClose ? "selfClose" : "regular"; } } function findMatchingClose(iter, tag) { var stack = []; for (;;) { var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0); if (!next || !(end = toTagEnd(iter))) return; if (end == "selfClose") continue; if (next[1]) { // closing tag for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) { stack.length = i; break; } if (i < 0 && (!tag || tag == next[2])) return { tag: next[2], from: Pos(startLine, startCh), to: Pos(iter.line, iter.ch) }; } else { // opening tag stack.push(next[2]); } } } function findMatchingOpen(iter, tag) { var stack = []; for (;;) { var prev = toPrevTag(iter); if (!prev) return; if (prev == "selfClose") { toTagStart(iter); continue; } var endLine = iter.line, endCh = iter.ch; var start = toTagStart(iter); if (!start) return; if (start[1]) { // closing tag stack.push(start[2]); } else { // opening tag for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) { stack.length = i; break; } if (i < 0 && (!tag || tag == start[2])) return { tag: start[2], from: Pos(iter.line, iter.ch), to: Pos(endLine, endCh) }; } } } CodeMirror.registerHelper("fold", "xml", function(cm, start) { var iter = new Iter(cm, start.line, 0); for (;;) { var openTag = toNextTag(iter), end; if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return; if (!openTag[1] && end != "selfClose") { var start = Pos(iter.line, iter.ch); var close = findMatchingClose(iter, openTag[2]); return close && {from: start, to: close.from}; } } }); CodeMirror.findMatchingTag = function(cm, pos, range) { var iter = new Iter(cm, pos.line, pos.ch, range); if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return; var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch); var start = end && toTagStart(iter); if (!end || !start || cmp(iter, pos) > 0) return; var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]}; if (end == "selfClose") return {open: here, close: null, at: "open"}; if (start[1]) { // closing tag return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"}; } else { // opening tag iter = new Iter(cm, to.line, to.ch, range); return {open: here, close: findMatchingClose(iter, start[2]), at: "open"}; } }; CodeMirror.findEnclosingTag = function(cm, pos, range) { var iter = new Iter(cm, pos.line, pos.ch, range); for (;;) { var open = findMatchingOpen(iter); if (!open) break; var forward = new Iter(cm, pos.line, pos.ch, range); var close = findMatchingClose(forward, open.tag); if (close) return {open: open, close: close}; } }; // Used by addon/edit/closetag.js CodeMirror.scanForClosingTag = function(cm, pos, name, end) { var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null); return findMatchingClose(iter, name); }; }); },{"codemirror":undefined}],10:[function(require,module,exports){ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE // TODO actually recognize syntax of TypeScript constructs (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod((function(){try{return require('codemirror')}catch(e){return window.CodeMirror}})()); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.defineMode("javascript", function(config, parserConfig) { var indentUnit = config.indentUnit; var statementIndent = parserConfig.statementIndent; var jsonldMode = parserConfig.jsonld; var jsonMode = parserConfig.json || jsonldMode; var isTS = parserConfig.typescript; var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; // Tokenizer var keywords = function(){ function kw(type) {return {type: type, style: "keyword"};} var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); var operator = kw("operator"), atom = {type: "atom", style: "atom"}; var jsKeywords = { "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, "debugger": C, "var": kw("var"), "const": kw("var"), "let": kw("var"), "function": kw("function"), "catch": kw("catch"), "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), "in": operator, "typeof": operator, "instanceof": operator, "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom, "this": kw("this"), "module": kw("module"), "class": kw("class"), "super": kw("atom"), "yield": C, "export": kw("export"), "import": kw("import"), "extends": C }; // Extend the 'normal' keywords with the TypeScript language extensions if (isTS) { var type = {type: "variable", style: "variable-3"}; var tsKeywords = { // object-like things "interface": kw("interface"), "extends": kw("extends"), "constructor": kw("constructor"), // scope modifiers "public": kw("public"), "private": kw("private"), "protected": kw("protected"), "static": kw("static"), // types "string": type, "number": type, "bool": type, "any": type }; for (var attr in tsKeywords) { jsKeywords[attr] = tsKeywords[attr]; } } return jsKeywords; }(); var isOperatorChar = /[+\-*&%=<>!?|~^]/; var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/; function readRegexp(stream) { var escaped = false, next, inSet = false; while ((next = stream.next()) != null) { if (!escaped) { if (next == "/" && !inSet) return; if (next == "[") inSet = true; else if (inSet && next == "]") inSet = false; } escaped = !escaped && next == "\\"; } } // Used as scratch variables to communicate multiple values without // consing up tons of objects. var type, content; function ret(tp, style, cont) { type = tp; content = cont; return style; } function tokenBase(stream, state) { var ch = stream.next(); if (ch == '"' || ch == "'") { state.tokenize = tokenString(ch); return state.tokenize(stream, state); } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { return ret("number", "number"); } else if (ch == "." && stream.match("..")) { return ret("spread", "meta"); } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) { return ret(ch); } else if (ch == "=" && stream.eat(">")) { return ret("=>", "operator"); } else if (ch == "0" && stream.eat(/x/i)) { stream.eatWhile(/[\da-f]/i); return ret("number", "number"); } else if (/\d/.test(ch)) { stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); return ret("number", "number"); } else if (ch == "/") { if (stream.eat("*")) { state.tokenize = tokenComment; return tokenComment(stream, state); } else if (stream.eat("/")) { stream.skipToEnd(); return ret("comment", "comment"); } else if (state.lastType == "operator" || state.lastType == "keyword c" || state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) { readRegexp(stream); stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); return ret("regexp", "string-2"); } else { stream.eatWhile(isOperatorChar); return ret("operator", "operator", stream.current()); } } else if (ch == "`") { state.tokenize = tokenQuasi; return tokenQuasi(stream, state); } else if (ch == "#") { stream.skipToEnd(); return ret("error", "error"); } else if (isOperatorChar.test(ch)) { stream.eatWhile(isOperatorChar); return ret("operator", "operator", stream.current()); } else if (wordRE.test(ch)) { stream.eatWhile(wordRE); var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; return (known && state.lastType != ".") ? ret(known.type, known.style, word) : ret("variable", "variable", word); } } function tokenString(quote) { return function(stream, state) { var escaped = false, next; if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){ state.tokenize = tokenBase; return ret("jsonld-keyword", "meta"); } while ((next = stream.next()) != null) { if (next == quote && !escaped) break; escaped = !escaped && next == "\\"; } if (!escaped) state.tokenize = tokenBase; return ret("string", "string"); }; } function tokenComment(stream, state) { var maybeEnd = false, ch; while (ch = stream.next()) { if (ch == "/" && maybeEnd) { state.tokenize = tokenBase; break; } maybeEnd = (ch == "*"); } return ret("comment", "comment"); } function tokenQuasi(stream, state) { var escaped = false, next; while ((next = stream.next()) != null) { if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) { state.tokenize = tokenBase; break; } escaped = !escaped && next == "\\"; } return ret("quasi", "string-2", stream.current()); } var brackets = "([{}])"; // This is a crude lookahead trick to try and notice that we're // parsing the argument patterns for a fat-arrow function before we // actually hit the arrow token. It only works if the arrow is on // the same line as the arguments and there's no strange noise // (comments) in between. Fallback is to only notice when we hit the // arrow, and not declare the arguments as locals for the arrow // body. function findFatArrow(stream, state) { if (state.fatArrowAt) state.fatArrowAt = null; var arrow = stream.string.indexOf("=>", stream.start); if (arrow < 0) return; var depth = 0, sawSomething = false; for (var pos = arrow - 1; pos >= 0; --pos) { var ch = stream.string.charAt(pos); var bracket = brackets.indexOf(ch); if (bracket >= 0 && bracket < 3) { if (!depth) { ++pos; break; } if (--depth == 0) break; } else if (bracket >= 3 && bracket < 6) { ++depth; } else if (wordRE.test(ch)) { sawSomething = true; } else if (/["'\/]/.test(ch)) { return; } else if (sawSomething && !depth) { ++pos; break; } } if (sawSomething && !depth) state.fatArrowAt = pos; } // Parser var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true}; function JSLexical(indented, column, type, align, prev, info) { this.indented = indented; this.column = column; this.type = type; this.prev = prev; this.info = info; if (align != null) this.align = align; } function inScope(state, varname) { for (var v = state.localVars; v; v = v.next) if (v.name == varname) return true; for (var cx = state.context; cx; cx = cx.prev) { for (var v = cx.vars; v; v = v.next) if (v.name == varname) return true; } } function parseJS(state, style, type, content, stream) { var cc = state.cc; // Communicate our context to the combinators. // (Less wasteful than consing up a hundred closures on every call.) cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style; if (!state.lexical.hasOwnProperty("align")) state.lexical.align = true; while(true) { var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; if (combinator(type, content)) { while(cc.length && cc[cc.length - 1].lex) cc.pop()(); if (cx.marked) return cx.marked; if (type == "variable" && inScope(state, content)) return "variable-2"; return style; } } } // Combinator utils var cx = {state: null, column: null, marked: null, cc: null}; function pass() { for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); } function cont() { pass.apply(null, arguments); return true; } function register(varname) { function inList(list) { for (var v = list; v; v = v.next) if (v.name == varname) return true; return false; } var state = cx.state; if (state.context) { cx.marked = "def"; if (inList(state.localVars)) return; state.localVars = {name: varname, next: state.localVars}; } else { if (inList(state.globalVars)) return; if (parserConfig.globalVars) state.globalVars = {name: varname, next: state.globalVars}; } } // Combinators var defaultVars = {name: "this", next: {name: "arguments"}}; function pushcontext() { cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; cx.state.localVars = defaultVars; } function popcontext() { cx.state.localVars = cx.state.context.vars; cx.state.context = cx.state.context.prev; } function pushlex(type, info) { var result = function() { var state = cx.state, indent = state.indented; if (state.lexical.type == "stat") indent = state.lexical.indented; else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev) indent = outer.indented; state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info); }; result.lex = true; return result; } function poplex() { var state = cx.state; if (state.lexical.prev) { if (state.lexical.type == ")") state.indented = state.lexical.indented; state.lexical = state.lexical.prev; } } poplex.lex = true; function expect(wanted) { function exp(type) { if (type == wanted) return cont(); else if (wanted == ";") return pass(); else return cont(exp); }; return exp; } function statement(type, value) { if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex); if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex); if (type == "keyword b") return cont(pushlex("form"), statement, poplex); if (type == "{") return cont(pushlex("}"), block, poplex); if (type == ";") return cont(); if (type == "if") { if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex) cx.state.cc.pop()(); return cont(pushlex("form"), expression, statement, poplex, maybeelse); } if (type == "function") return cont(functiondef); if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); if (type == "variable") return cont(pushlex("stat"), maybelabel); if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), block, poplex, poplex); if (type == "case") return cont(expression, expect(":")); if (type == "default") return cont(expect(":")); if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), statement, poplex, popcontext); if (type == "module") return cont(pushlex("form"), pushcontext, afterModule, popcontext, poplex); if (type == "class") return cont(pushlex("form"), className, poplex); if (type == "export") return cont(pushlex("form"), afterExport, poplex); if (type == "import") return cont(pushlex("form"), afterImport, poplex); return pass(pushlex("stat"), expression, expect(";"), poplex); } function expression(type) { return expressionInner(type, false); } function expressionNoComma(type) { return expressionInner(type, true); } function expressionInner(type, noComma) { if (cx.state.fatArrowAt == cx.stream.start) { var body = noComma ? arrowBodyNoComma : arrowBody; if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext); else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext); } var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); if (type == "function") return cont(functiondef, maybeop); if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression); if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop); if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop); if (type == "{") return contCommasep(objprop, "}", null, maybeop); if (type == "quasi") { return pass(quasi, maybeop); } return cont(); } function maybeexpression(type) { if (type.match(/[;\}\)\],]/)) return pass(); return pass(expression); } function maybeexpressionNoComma(type) { if (type.match(/[;\}\)\],]/)) return pass(); return pass(expressionNoComma); } function maybeoperatorComma(type, value) { if (type == ",") return cont(expression); return maybeoperatorNoComma(type, value, false); } function maybeoperatorNoComma(type, value, noComma) { var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma; var expr = noComma == false ? expression : expressionNoComma; if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); if (type == "operator") { if (/\+\+|--/.test(value)) return cont(me); if (value == "?") return cont(expression, expect(":"), expr); return cont(expr); } if (type == "quasi") { return pass(quasi, me); } if (type == ";") return; if (type == "(") return contCommasep(expressionNoComma, ")", "call", me); if (type == ".") return cont(property, me); if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me); } function quasi(type, value) { if (type != "quasi") return pass(); if (value.slice(value.length - 2) != "${") return cont(quasi); return cont(expression, continueQuasi); } function continueQuasi(type) { if (type == "}") { cx.marked = "string-2"; cx.state.tokenize = tokenQuasi; return cont(quasi); } } function arrowBody(type) { findFatArrow(cx.stream, cx.state); return pass(type == "{" ? statement : expression); } function arrowBodyNoComma(type) { findFatArrow(cx.stream, cx.state); return pass(type == "{" ? statement : expressionNoComma); } function maybelabel(type) { if (type == ":") return cont(poplex, statement); return pass(maybeoperatorComma, expect(";"), poplex); } function property(type) { if (type == "variable") {cx.marked = "property"; return cont();} } function objprop(type, value) { if (type == "variable" || cx.style == "keyword") { cx.marked = "property"; if (value == "get" || value == "set") return cont(getterSetter); return cont(afterprop); } else if (type == "number" || type == "string") { cx.marked = jsonldMode ? "property" : (cx.style + " property"); return cont(afterprop); } else if (type == "jsonld-keyword") { return cont(afterprop); } else if (type == "[") { return cont(expression, expect("]"), afterprop); } } function getterSetter(type) { if (type != "variable") return pass(afterprop); cx.marked = "property"; return cont(functiondef); } function afterprop(type) { if (type == ":") return cont(expressionNoComma); if (type == "(") return pass(functiondef); } function commasep(what, end) { function proceed(type) { if (type == ",") { var lex = cx.state.lexical; if (lex.info == "call") lex.pos = (lex.pos || 0) + 1; return cont(what, proceed); } if (type == end) return cont(); return cont(expect(end)); } return function(type) { if (type == end) return cont(); return pass(what, proceed); }; } function contCommasep(what, end, info) { for (var i = 3; i < arguments.length; i++) cx.cc.push(arguments[i]); return cont(pushlex(end, info), commasep(what, end), poplex); } function block(type) { if (type == "}") return cont(); return pass(statement, block); } function maybetype(type) { if (isTS && type == ":") return cont(typedef); } function typedef(type) { if (type == "variable"){cx.marked = "variable-3"; return cont();} } function vardef() { return pass(pattern, maybetype, maybeAssign, vardefCont); } function pattern(type, value) { if (type == "variable") { register(value); return cont(); } if (type == "[") return contCommasep(pattern, "]"); if (type == "{") return contCommasep(proppattern, "}"); } function proppattern(type, value) { if (type == "variable" && !cx.stream.match(/^\s*:/, false)) { register(value); return cont(maybeAssign); } if (type == "variable") cx.marked = "property"; return cont(expect(":"), pattern, maybeAssign); } function maybeAssign(_type, value) { if (value == "=") return cont(expressionNoComma); } function vardefCont(type) { if (type == ",") return cont(vardef); } function maybeelse(type, value) { if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex); } function forspec(type) { if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); } function forspec1(type) { if (type == "var") return cont(vardef, expect(";"), forspec2); if (type == ";") return cont(forspec2); if (type == "variable") return cont(formaybeinof); return pass(expression, expect(";"), forspec2); } function formaybeinof(_type, value) { if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } return cont(maybeoperatorComma, forspec2); } function forspec2(type, value) { if (type == ";") return cont(forspec3); if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } return pass(expression, expect(";"), forspec3); } function forspec3(type) { if (type != ")") cont(expression); } function functiondef(type, value) { if (value == "*") {cx.marked = "keyword"; return cont(functiondef);} if (type == "variable") {register(value); return cont(functiondef);} if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, statement, popcontext); } function funarg(type) { if (type == "spread") return cont(funarg); return pass(pattern, maybetype); } function className(type, value) { if (type == "variable") {register(value); return cont(classNameAfter);} } function classNameAfter(type, value) { if (value == "extends") return cont(expression, classNameAfter); if (type == "{") return cont(pushlex("}"), classBody, poplex); } function classBody(type, value) { if (type == "variable" || cx.style == "keyword") { cx.marked = "property"; if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody); return cont(functiondef, classBody); } if (value == "*") { cx.marked = "keyword"; return cont(classBody); } if (type == ";") return cont(classBody); if (type == "}") return cont(); } function classGetterSetter(type) { if (type != "variable") return pass(); cx.marked = "property"; return cont(); } function afterModule(type, value) { if (type == "string") return cont(statement); if (type == "variable") { register(value); return cont(maybeFrom); } } function afterExport(_type, value) { if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); } if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); } return pass(statement); } function afterImport(type) { if (type == "string") return cont(); return pass(importSpec, maybeFrom); } function importSpec(type, value) { if (type == "{") return contCommasep(importSpec, "}"); if (type == "variable") register(value); return cont(); } function maybeFrom(_type, value) { if (value == "from") { cx.marked = "keyword"; return cont(expression); } } function arrayLiteral(type) { if (type == "]") return cont(); return pass(expressionNoComma, maybeArrayComprehension); } function maybeArrayComprehension(type) { if (type == "for") return pass(comprehension, expect("]")); if (type == ",") return cont(commasep(maybeexpressionNoComma, "]")); return pass(commasep(expressionNoComma, "]")); } function comprehension(type) { if (type == "for") return cont(forspec, comprehension); if (type == "if") return cont(expression, comprehension); } function isContinuedStatement(state, textAfter) { return state.lastType == "operator" || state.lastType == "," || isOperatorChar.test(textAfter.charAt(0)) || /[,.]/.test(textAfter.charAt(0)); } // Interface return { startState: function(basecolumn) { var state = { tokenize: tokenBase, lastType: "sof", cc: [], lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), localVars: parserConfig.localVars, context: parserConfig.localVars && {vars: parserConfig.localVars}, indented: 0 }; if (parserConfig.globalVars && typeof parserConfig.globalVars == "object") state.globalVars = parserConfig.globalVars; return state; }, token: function(stream, state) { if (stream.sol()) { if (!state.lexical.hasOwnProperty("align")) state.lexical.align = false; state.indented = stream.indentation(); findFatArrow(stream, state); } if (state.tokenize != tokenComment && stream.eatSpace()) return null; var style = state.tokenize(stream, state); if (type == "comment") return style; state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type; return parseJS(state, style, type, content, stream); }, indent: function(state, textAfter) { if (state.tokenize == tokenComment) return CodeMirror.Pass; if (state.tokenize != tokenBase) return 0; var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; // Kludge to prevent 'maybelse' from blocking lexical scope pops if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { var c = state.cc[i]; if (c == poplex) lexical = lexical.prev; else if (c != maybeelse) break; } if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat") lexical = lexical.prev; var type = lexical.type, closing = firstChar == type; if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0); else if (type == "form" && firstChar == "{") return lexical.indented; else if (type == "form") return lexical.indented + indentUnit; else if (type == "stat") return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0); else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false) return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); else if (lexical.align) return lexical.column + (closing ? 0 : 1); else return lexical.indented + (closing ? 0 : indentUnit); }, electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, blockCommentStart: jsonMode ? null : "/*", blockCommentEnd: jsonMode ? null : "*/", lineComment: jsonMode ? null : "//", fold: "brace", helperType: jsonMode ? "json" : "javascript", jsonldMode: jsonldMode, jsonMode: jsonMode }; }); CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/); CodeMirror.defineMIME("text/javascript", "javascript"); CodeMirror.defineMIME("text/ecmascript", "javascript"); CodeMirror.defineMIME("application/javascript", "javascript"); CodeMirror.defineMIME("application/x-javascript", "javascript"); CodeMirror.defineMIME("application/ecmascript", "javascript"); CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true}); CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true}); CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); }); },{"codemirror":undefined}],11:[function(require,module,exports){ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod((function(){try{return require('codemirror')}catch(e){return window.CodeMirror}})()); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.defineMode("xml", function(config, parserConfig) { var indentUnit = config.indentUnit; var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1; var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag; if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true; var Kludges = parserConfig.htmlMode ? { autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true, 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, 'track': true, 'wbr': true, 'menuitem': true}, implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, 'th': true, 'tr': true}, contextGrabbers: { 'dd': {'dd': true, 'dt': true}, 'dt': {'dd': true, 'dt': true}, 'li': {'li': true}, 'option': {'option': true, 'optgroup': true}, 'optgroup': {'optgroup': true}, 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true}, 'rp': {'rp': true, 'rt': true}, 'rt': {'rp': true, 'rt': true}, 'tbody': {'tbody': true, 'tfoot': true}, 'td': {'td': true, 'th': true}, 'tfoot': {'tbody': true}, 'th': {'td': true, 'th': true}, 'thead': {'tbody': true, 'tfoot': true}, 'tr': {'tr': true} }, doNotIndent: {"pre": true}, allowUnquoted: true, allowMissing: true, caseFold: true } : { autoSelfClosers: {}, implicitlyClosed: {}, contextGrabbers: {}, doNotIndent: {}, allowUnquoted: false, allowMissing: false, caseFold: false }; var alignCDATA = parserConfig.alignCDATA; // Return variables for tokenizers var type, setStyle; function inText(stream, state) { function chain(parser) { state.tokenize = parser; return parser(stream, state); } var ch = stream.next(); if (ch == "<") { if (stream.eat("!")) { if (stream.eat("[")) { if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); else return null; } else if (stream.match("--")) { return chain(inBlock("comment", "-->")); } else if (stream.match("DOCTYPE", true, true)) { stream.eatWhile(/[\w\._\-]/); return chain(doctype(1)); } else { return null; } } else if (stream.eat("?")) { stream.eatWhile(/[\w\._\-]/); state.tokenize = inBlock("meta", "?>"); return "meta"; } else { type = stream.eat("/") ? "closeTag" : "openTag"; state.tokenize = inTag; return "tag bracket"; } } else if (ch == "&") { var ok; if (stream.eat("#")) { if (stream.eat("x")) { ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); } else { ok = stream.eatWhile(/[\d]/) && stream.eat(";"); } } else { ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); } return ok ? "atom" : "error"; } else { stream.eatWhile(/[^&<]/); return null; } } function inTag(stream, state) { var ch = stream.next(); if (ch == ">" || (ch == "/" && stream.eat(">"))) { state.tokenize = inText; type = ch == ">" ? "endTag" : "selfcloseTag"; return "tag bracket"; } else if (ch == "=") { type = "equals"; return null; } else if (ch == "<") { state.tokenize = inText; state.state = baseState; state.tagName = state.tagStart = null; var next = state.tokenize(stream, state); return next ? next + " tag error" : "tag error"; } else if (/[\'\"]/.test(ch)) { state.tokenize = inAttribute(ch); state.stringStartCol = stream.column(); return state.tokenize(stream, state); } else { stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/); return "word"; } } function inAttribute(quote) { var closure = function(stream, state) { while (!stream.eol()) { if (stream.next() == quote) { state.tokenize = inTag; break; } } return "string"; }; closure.isInAttribute = true; return closure; } function inBlock(style, terminator) { return function(stream, state) { while (!stream.eol()) { if (stream.match(terminator)) { state.tokenize = inText; break; } stream.next(); } return style; }; } function doctype(depth) { return function(stream, state) { var ch; while ((ch = stream.next()) != null) { if (ch == "<") { state.tokenize = doctype(depth + 1); return state.tokenize(stream, state); } else if (ch == ">") { if (depth == 1) { state.tokenize = inText; break; } else { state.tokenize = doctype(depth - 1); return state.tokenize(stream, state); } } } return "meta"; }; } function Context(state, tagName, startOfLine) { this.prev = state.context; this.tagName = tagName; this.indent = state.indented; this.startOfLine = startOfLine; if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) this.noIndent = true; } function popContext(state) { if (state.context) state.context = state.context.prev; } function maybePopContext(state, nextTagName) { var parentTagName; while (true) { if (!state.context) { return; } parentTagName = state.context.tagName; if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) || !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { return; } popContext(state); } } function baseState(type, stream, state) { if (type == "openTag") { state.tagStart = stream.column(); return tagNameState; } else if (type == "closeTag") { return closeTagNameState; } else { return baseState; } } function tagNameState(type, stream, state) { if (type == "word") { state.tagName = stream.current(); setStyle = "tag"; return attrState; } else { setStyle = "error"; return tagNameState; } } function closeTagNameState(type, stream, state) { if (type == "word") { var tagName = stream.current(); if (state.context && state.context.tagName != tagName && Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName)) popContext(state); if (state.context && state.context.tagName == tagName) { setStyle = "tag"; return closeState; } else { setStyle = "tag error"; return closeStateErr; } } else { setStyle = "error"; return closeStateErr; } } function closeState(type, _stream, state) { if (type != "endTag") { setStyle = "error"; return closeState; } popContext(state); return baseState; } function closeStateErr(type, stream, state) { setStyle = "error"; return closeState(type, stream, state); } function attrState(type, _stream, state) { if (type == "word") { setStyle = "attribute"; return attrEqState; } else if (type == "endTag" || type == "selfcloseTag") { var tagName = state.tagName, tagStart = state.tagStart; state.tagName = state.tagStart = null; if (type == "selfcloseTag" || Kludges.autoSelfClosers.hasOwnProperty(tagName)) { maybePopContext(state, tagName); } else { maybePopContext(state, tagName); state.context = new Context(state, tagName, tagStart == state.indented); } return baseState; } setStyle = "error"; return attrState; } function attrEqState(type, stream, state) { if (type == "equals") return attrValueState; if (!Kludges.allowMissing) setStyle = "error"; return attrState(type, stream, state); } function attrValueState(type, stream, state) { if (type == "string") return attrContinuedState; if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;} setStyle = "error"; return attrState(type, stream, state); } function attrContinuedState(type, stream, state) { if (type == "string") return attrContinuedState; return attrState(type, stream, state); } return { startState: function() { return {tokenize: inText, state: baseState, indented: 0, tagName: null, tagStart: null, context: null}; }, token: function(stream, state) { if (!state.tagName && stream.sol()) state.indented = stream.indentation(); if (stream.eatSpace()) return null; type = null; var style = state.tokenize(stream, state); if ((style || type) && style != "comment") { setStyle = null; state.state = state.state(type || style, stream, state); if (setStyle) style = setStyle == "error" ? style + " error" : setStyle; } return style; }, indent: function(state, textAfter, fullLine) { var context = state.context; // Indent multi-line strings (e.g. css). if (state.tokenize.isInAttribute) { if (state.tagStart == state.indented) return state.stringStartCol + 1; else return state.indented + indentUnit; } if (context && context.noIndent) return CodeMirror.Pass; if (state.tokenize != inTag && state.tokenize != inText) return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; // Indent the starts of attribute names. if (state.tagName) { if (multilineTagIndentPastTag) return state.tagStart + state.tagName.length + 2; else return state.tagStart + indentUnit * multilineTagIndentFactor; } if (alignCDATA && /$/, blockCommentStart: "", configuration: parserConfig.htmlMode ? "html" : "xml", helperType: parserConfig.htmlMode ? "html" : "xml" }; }); CodeMirror.defineMIME("text/xml", "xml"); CodeMirror.defineMIME("application/xml", "xml"); if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); }); },{"codemirror":undefined}],12:[function(require,module,exports){ (function() { var callWithJQuery; callWithJQuery = function(pivotModule) { if (typeof exports === "object" && typeof module === "object") { return pivotModule((function(){try{return require('jquery')}catch(e){return window.jQuery}})()); } else if (typeof define === "function" && define.amd) { return define(["jquery"], pivotModule); } else { return pivotModule(jQuery); } }; callWithJQuery(function($) { return $.pivotUtilities.d3_renderers = { Treemap: function(pivotData, opts) { var addToTree, color, defaults, height, i, len, ref, result, rowKey, tree, treemap, value, width; defaults = { localeStrings: {}, d3: { width: function() { return $(window).width() / 1.4; }, height: function() { return $(window).height() / 1.4; } } }; opts = $.extend(defaults, opts); result = $("
").css({ width: "100%", height: "100%" }); tree = { name: "All", children: [] }; addToTree = function(tree, path, value) { var child, i, len, newChild, ref, x; if (path.length === 0) { tree.value = value; return; } if (tree.children == null) { tree.children = []; } x = path.shift(); ref = tree.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; if (!(child.name === x)) { continue; } addToTree(child, path, value); return; } newChild = { name: x }; addToTree(newChild, path, value); return tree.children.push(newChild); }; ref = pivotData.getRowKeys(); for (i = 0, len = ref.length; i < len; i++) { rowKey = ref[i]; value = pivotData.getAggregator(rowKey, []).value(); if (value != null) { addToTree(tree, rowKey, value); } } color = d3.scale.category10(); width = opts.d3.width(); height = opts.d3.height(); treemap = d3.layout.treemap().size([width, height]).sticky(true).value(function(d) { return d.size; }); d3.select(result[0]).append("div").style("position", "relative").style("width", width + "px").style("height", height + "px").datum(tree).selectAll(".node").data(treemap.padding([15, 0, 0, 0]).value(function(d) { return d.value; }).nodes).enter().append("div").attr("class", "node").style("background", function(d) { if (d.children != null) { return "lightgrey"; } else { return color(d.name); } }).text(function(d) { return d.name; }).call(function() { this.style("left", function(d) { return d.x + "px"; }).style("top", function(d) { return d.y + "px"; }).style("width", function(d) { return Math.max(0, d.dx - 1) + "px"; }).style("height", function(d) { return Math.max(0, d.dy - 1) + "px"; }); }); return result; } }; }); }).call(this); //# sourceMappingURL=d3_renderers.js.map },{"jquery":undefined}],13:[function(require,module,exports){ (function() { var callWithJQuery; callWithJQuery = function(pivotModule) { if (typeof exports === "object" && typeof module === "object") { return pivotModule((function(){try{return require('jquery')}catch(e){return window.jQuery}})()); } else if (typeof define === "function" && define.amd) { return define(["jquery"], pivotModule); } else { return pivotModule(jQuery); } }; callWithJQuery(function($) { var makeGoogleChart; makeGoogleChart = function(chartType, extraOptions) { return function(pivotData, opts) { var agg, base, base1, colKey, colKeys, dataArray, dataTable, defaults, fullAggName, groupByTitle, h, hAxisTitle, headers, i, j, len, len1, numCharsInHAxis, options, ref, result, row, rowKey, rowKeys, title, tree2, vAxisTitle, val, wrapper, x, y; defaults = { localeStrings: { vs: "vs", by: "by" }, gchart: {} }; opts = $.extend(true, defaults, opts); if ((base = opts.gchart).width == null) { base.width = window.innerWidth / 1.4; } if ((base1 = opts.gchart).height == null) { base1.height = window.innerHeight / 1.4; } rowKeys = pivotData.getRowKeys(); if (rowKeys.length === 0) { rowKeys.push([]); } colKeys = pivotData.getColKeys(); if (colKeys.length === 0) { colKeys.push([]); } fullAggName = pivotData.aggregatorName; if (pivotData.valAttrs.length) { fullAggName += "(" + (pivotData.valAttrs.join(", ")) + ")"; } headers = (function() { var i, len, results; results = []; for (i = 0, len = rowKeys.length; i < len; i++) { h = rowKeys[i]; results.push(h.join("-")); } return results; })(); headers.unshift(""); numCharsInHAxis = 0; if (chartType === "ScatterChart") { dataArray = []; ref = pivotData.tree; for (y in ref) { tree2 = ref[y]; for (x in tree2) { agg = tree2[x]; dataArray.push([parseFloat(x), parseFloat(y), fullAggName + ": \n" + agg.format(agg.value())]); } } dataTable = new google.visualization.DataTable(); dataTable.addColumn('number', pivotData.colAttrs.join("-")); dataTable.addColumn('number', pivotData.rowAttrs.join("-")); dataTable.addColumn({ type: "string", role: "tooltip" }); dataTable.addRows(dataArray); hAxisTitle = pivotData.colAttrs.join("-"); vAxisTitle = pivotData.rowAttrs.join("-"); title = ""; } else { dataArray = [headers]; for (i = 0, len = colKeys.length; i < len; i++) { colKey = colKeys[i]; row = [colKey.join("-")]; numCharsInHAxis += row[0].length; for (j = 0, len1 = rowKeys.length; j < len1; j++) { rowKey = rowKeys[j]; agg = pivotData.getAggregator(rowKey, colKey); if (agg.value() != null) { val = agg.value(); if ($.isNumeric(val)) { if (val < 1) { row.push(parseFloat(val.toPrecision(3))); } else { row.push(parseFloat(val.toFixed(3))); } } else { row.push(val); } } else { row.push(null); } } dataArray.push(row); } dataTable = google.visualization.arrayToDataTable(dataArray); title = vAxisTitle = fullAggName; hAxisTitle = pivotData.colAttrs.join("-"); if (hAxisTitle !== "") { title += " " + opts.localeStrings.vs + " " + hAxisTitle; } groupByTitle = pivotData.rowAttrs.join("-"); if (groupByTitle !== "") { title += " " + opts.localeStrings.by + " " + groupByTitle; } } options = { title: title, hAxis: { title: hAxisTitle, slantedText: numCharsInHAxis > 50 }, vAxis: { title: vAxisTitle }, tooltip: { textStyle: { fontName: 'Arial', fontSize: 12 } } }; if (chartType === "ColumnChart") { options.vAxis.minValue = 0; } if (chartType === "ScatterChart") { options.legend = { position: "none" }; options.chartArea = { 'width': '80%', 'height': '80%' }; } else if (dataArray[0].length === 2 && dataArray[0][1] === "") { options.legend = { position: "none" }; } $.extend(options, opts.gchart, extraOptions); result = $("
").css({ width: "100%", height: "100%" }); wrapper = new google.visualization.ChartWrapper({ dataTable: dataTable, chartType: chartType, options: options }); wrapper.draw(result[0]); result.bind("dblclick", function() { var editor; editor = new google.visualization.ChartEditor(); google.visualization.events.addListener(editor, 'ok', function() { return editor.getChartWrapper().draw(result[0]); }); return editor.openDialog(wrapper); }); return result; }; }; return $.pivotUtilities.gchart_renderers = { "Line Chart": makeGoogleChart("LineChart"), "Bar Chart": makeGoogleChart("ColumnChart"), "Stacked Bar Chart": makeGoogleChart("ColumnChart", { isStacked: true }), "Area Chart": makeGoogleChart("AreaChart", { isStacked: true }), "Scatter Chart": makeGoogleChart("ScatterChart") }; }); }).call(this); //# sourceMappingURL=gchart_renderers.js.map },{"jquery":undefined}],14:[function(require,module,exports){ ;(function(win){ var store = {}, doc = win.document, localStorageName = 'localStorage', scriptTag = 'script', storage store.disabled = false store.version = '1.3.17' store.set = function(key, value) {} store.get = function(key, defaultVal) {} store.has = function(key) { return store.get(key) !== undefined } store.remove = function(key) {} store.clear = function() {} store.transact = function(key, defaultVal, transactionFn) { if (transactionFn == null) { transactionFn = defaultVal defaultVal = null } if (defaultVal == null) { defaultVal = {} } var val = store.get(key, defaultVal) transactionFn(val) store.set(key, val) } store.getAll = function() {} store.forEach = function() {} store.serialize = function(value) { return JSON.stringify(value) } store.deserialize = function(value) { if (typeof value != 'string') { return undefined } try { return JSON.parse(value) } catch(e) { return value || undefined } } // Functions to encapsulate questionable FireFox 3.6.13 behavior // when about.config::dom.storage.enabled === false // See https://github.com/marcuswestin/store.js/issues#issue/13 function isLocalStorageNameSupported() { try { return (localStorageName in win && win[localStorageName]) } catch(err) { return false } } if (isLocalStorageNameSupported()) { storage = win[localStorageName] store.set = function(key, val) { if (val === undefined) { return store.remove(key) } storage.setItem(key, store.serialize(val)) return val } store.get = function(key, defaultVal) { var val = store.deserialize(storage.getItem(key)) return (val === undefined ? defaultVal : val) } store.remove = function(key) { storage.removeItem(key) } store.clear = function() { storage.clear() } store.getAll = function() { var ret = {} store.forEach(function(key, val) { ret[key] = val }) return ret } store.forEach = function(callback) { for (var i=0; idocument.w=window') storageContainer.close() storageOwner = storageContainer.w.frames[0].document storage = storageOwner.createElement('div') } catch(e) { // somehow ActiveXObject instantiation failed (perhaps some special // security settings or otherwse), fall back to per-path storage storage = doc.createElement('div') storageOwner = doc.body } var withIEStorage = function(storeFunction) { return function() { var args = Array.prototype.slice.call(arguments, 0) args.unshift(storage) // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx storageOwner.appendChild(storage) storage.addBehavior('#default#userData') storage.load(localStorageName) var result = storeFunction.apply(store, args) storageOwner.removeChild(storage) return result } } // In IE7, keys cannot start with a digit or contain certain chars. // See https://github.com/marcuswestin/store.js/issues/40 // See https://github.com/marcuswestin/store.js/issues/83 var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g") function ieKeyFix(key) { return key.replace(/^d/, '___$&').replace(forbiddenCharsRegex, '___') } store.set = withIEStorage(function(storage, key, val) { key = ieKeyFix(key) if (val === undefined) { return store.remove(key) } storage.setAttribute(key, store.serialize(val)) storage.save(localStorageName) return val }) store.get = withIEStorage(function(storage, key, defaultVal) { key = ieKeyFix(key) var val = store.deserialize(storage.getAttribute(key)) return (val === undefined ? defaultVal : val) }) store.remove = withIEStorage(function(storage, key) { key = ieKeyFix(key) storage.removeAttribute(key) storage.save(localStorageName) }) store.clear = withIEStorage(function(storage) { var attributes = storage.XMLDocument.documentElement.attributes storage.load(localStorageName) for (var i=0, attr; attr=attributes[i]; i++) { storage.removeAttribute(attr.name) } storage.save(localStorageName) }) store.getAll = function(storage) { var ret = {} store.forEach(function(key, val) { ret[key] = val }) return ret } store.forEach = withIEStorage(function(storage, callback) { var attributes = storage.XMLDocument.documentElement.attributes for (var i=0, attr; attr=attributes[i]; ++i) { callback(attr.name, store.deserialize(storage.getAttribute(attr.name))) } }) } try { var testKey = '__storejs__' store.set(testKey, testKey) if (store.get(testKey) != testKey) { store.disabled = true } store.remove(testKey) } catch(e) { store.disabled = true } store.enabled = !store.disabled if (typeof module != 'undefined' && module.exports && this.module !== module) { module.exports = store } else if (typeof define === 'function' && define.amd) { define(store) } else { win.store = store } })(Function('return this')()); },{}],15:[function(require,module,exports){ module.exports={ "name": "yasgui-utils", "version": "1.6.0", "description": "Utils for YASGUI libs", "main": "src/main.js", "repository": { "type": "git", "url": "git://github.com/YASGUI/Utils.git" }, "licenses": [ { "type": "MIT", "url": "http://yasgui.github.io/license.txt" } ], "author": { "name": "Laurens Rietveld" }, "maintainers": [ { "name": "Laurens Rietveld", "email": "laurens.rietveld@gmail.com", "url": "http://laurensrietveld.nl" } ], "bugs": { "url": "https://github.com/YASGUI/Utils/issues" }, "homepage": "https://github.com/YASGUI/Utils", "dependencies": { "store": "^1.3.14" }, "readme": "A simple utils repo for the YASGUI tools\n", "readmeFilename": "README.md", "_id": "yasgui-utils@1.6.0", "_from": "yasgui-utils@>=1.4.1 <2.0.0" } },{}],16:[function(require,module,exports){ window.console = window.console || {"log":function(){}};//make sure any console statements don't break IE module.exports = { storage: require("./storage.js"), svg: require("./svg.js"), version: { "yasgui-utils" : require("../package.json").version, }, nestedExists : function(obj) { var args = Array.prototype.slice.call(arguments, 1); for (var i = 0; i < args.length; i++) { if (!obj || !obj.hasOwnProperty(args[i])) { return false; } obj = obj[args[i]]; } return true; } }; },{"../package.json":15,"./storage.js":17,"./svg.js":18}],17:[function(require,module,exports){ var store = require("store"); var times = { day: function() { return 1000 * 3600 * 24;//millis to day }, month: function() { times.day() * 30; }, year: function() { times.month() * 12; } }; var root = module.exports = { set : function(key, val, exp) { if (!store.enabled) return;//this is probably in private mode. Don't run, as we might get Js errors if (key && val !== undefined) { if (typeof exp == "string") { exp = times[exp](); } //try to store string for dom objects (e.g. XML result). Otherwise, we might get a circular reference error when stringifying this if (val.documentElement) val = new XMLSerializer().serializeToString(val.documentElement); store.set(key, { val : val, exp : exp, time : new Date().getTime() }); } }, remove: function(key) { if (!store.enabled) return;//this is probably in private mode. Don't run, as we might get Js errors if (key) store.remove(key) }, removeAll: function(filter) { if (!store.enabled) return;//this is probably in private mode. Don't run, as we might get Js errors if (typeof filter === 'function') { for (var key in store.getAll()) { if (filter(key, root.get(key))) root.remove(key); } } }, get : function(key) { if (!store.enabled) return null;//this is probably in private mode. Don't run, as we might get Js errors if (key) { var info = store.get(key); if (!info) { return null; } if (info.exp && new Date().getTime() - info.time > info.exp) { return null; } return info.val; } else { return null; } } }; },{"store":14}],18:[function(require,module,exports){ module.exports = { draw: function(parent, svgString) { if (!parent) return; var el = module.exports.getElement(svgString); if (el) { if (parent.append) { parent.append(el); } else { //regular dom doc parent.appendChild(el); } } }, getElement: function(svgString) { if (svgString && svgString.indexOf("=1.11.3", "datatables": "^1.10.7", "codemirror": "^4.7.0", "yasgui-utils": "^1.4.1", "pivottable": "^1.2.2", "jquery-ui": "^1.10.5", "d3": "^3.4.13" }, "browserify-shim": { "google": "global:google" }, "browserify": { "transform": [ "browserify-shim" ] }, "optionalShim": { "codemirror": { "require": "codemirror", "global": "CodeMirror" }, "jquery": { "require": "jquery", "global": "jQuery" }, "../../lib/codemirror": { "require": "codemirror", "global": "CodeMirror" }, "datatables": { "require": "datatables", "global": "jQuery" }, "d3": { "require": "d3", "global": "d3" }, "jquery-ui/sortable": { "require": "jquery-ui/sortable", "global": "jQuery" }, "pivottable": { "require": "pivottable", "global": "jQuery" } } } },{}],20:[function(require,module,exports){ 'use strict'; module.exports = function(result) { var quote = "\""; var delimiter = ","; var lineBreak = "\n"; var variables = result.head.vars; var querySolutions = result.results.bindings; var createHeader = function() { for (var i = 0; i < variables.length; i++) { addValueToString(variables[i]); } csvString += lineBreak; }; var createBody = function() { for (var i = 0; i < querySolutions.length; i++) { addQuerySolutionToString(querySolutions[i]); csvString += lineBreak; } }; var addQuerySolutionToString = function(querySolution) { for (var i = 0; i < variables.length; i++) { var variable = variables[i]; if (querySolution.hasOwnProperty(variable)) { addValueToString(querySolution[variable]["value"]); } else { addValueToString(""); } } }; var addValueToString = function(value) { //Quotes in the string need to be escaped value.replace(quote, quote + quote); if (needToQuoteString(value)) { value = quote + value + quote; } csvString += " " + value + " " + delimiter; }; var needToQuoteString = function(value) { //quote when it contains whitespace or the delimiter var needQuoting = false; if (value.match("[\\w|" + delimiter + "|" + quote + "]")) { needQuoting = true; } return needQuoting; }; var csvString = ""; createHeader(); createBody(); return csvString; }; },{}],21:[function(require,module,exports){ 'use strict'; var $ = (function(){try{return require('jquery')}catch(e){return window.jQuery}})(); /** * Constructor of plugin which displays boolean info * * @param yasr {object} * @param parent {DOM element} * @param options {object} * @class YASR.plugins.boolean * @return yasr-boolean (doc) * */ var root = module.exports = function(yasr) { var container = $("
"); var draw = function() { container.empty().appendTo(yasr.resultsContainer); var booleanVal = yasr.results.getBoolean(); var imgId = null; var textVal = null; if (booleanVal === true) { imgId = "check"; textVal = "True"; } else if (booleanVal === false) { imgId = "cross"; textVal = "False"; } else { container.width("140"); textVal = "Could not find boolean value in response"; } //add icon if (imgId) require("yasgui-utils").svg.draw(container, require('./imgs.js')[imgId]); $("").text(textVal).appendTo(container); }; var canHandleResults = function() { return yasr.results.getBoolean && (yasr.results.getBoolean() === true || yasr.results.getBoolean() == false); }; return { name: null, //don't need to set this: we don't show it in the selection widget anyway, so don't need a human-friendly name draw: draw, hideFromSelection: true, getPriority: 10, canHandleResults: canHandleResults } }; root.version = { "YASR-boolean": require("../package.json").version, "jquery": $.fn.jquery, }; },{"../package.json":19,"./imgs.js":27,"jquery":undefined,"yasgui-utils":16}],22:[function(require,module,exports){ 'use strict'; var $ = (function(){try{return require('jquery')}catch(e){return window.jQuery}})(); module.exports = { /** * key of default plugin to use * @property output * @type string * @default "table" */ output: "table", useGoogleCharts: true, outputPlugins: ["table", "error", "boolean", "rawResponse", "pivot", "gchart"], /** * Draw the output selector widget * * @property drawOutputSelector * @type boolean * @default true */ drawOutputSelector: true, /** * Draw download icon. This issues html5 download functionality to 'download' files created on the client-side. * This allows the user to download results already queried for, such as a CSV when a table is shown, or the original response when the raw response output is selected * * @property drawDownloadIcon * @type boolean * @default true */ drawDownloadIcon: true, getUsedPrefixes: null, /** * Make certain settings and values of YASR persistent. Setting a key * to null, will disable persistancy: nothing is stored between browser * sessions Setting the values to a string (or a function which returns a * string), will store the query in localstorage using the specified string. * By default, the ID is dynamically generated by finding the nearest DOM element with an "id" set, * to avoid collissions when using multiple YASR items on one page * * @property persistency * @type object */ persistency: { prefix: function(yasr) { return "yasr_" + $(yasr.container).closest('[id]').attr('id') + "_"; }, /** * Persistency setting for the selected output * * @property persistency.outputSelector * @type string|function * @default function (determine unique id) */ outputSelector: function(yasr) { return "selector"; }, /** * Persistency setting for query results. * * @property persistency.results * @type object */ results: { /** * Get the key to store results in * * @property persistency.results.id * @type string|function * @default function (determine unique id) */ id: function(yasr) { return "results_" + $(yasr.container).closest('[id]').attr('id'); }, key: 'results', /** * The result set might too large to fit in local storage. * It is impossible to detect how large the local storage is. * Therefore, we do not store all results in local storage, depending on a max number of characters in the SPARQL result serialization. * Set this function conservitavely. (especially when using multiple YASR instances on one page) * * @property persistency.results.maxSize * @type int * @default 100000 */ maxSize: 100000 //char count } }, }; },{"jquery":undefined}],23:[function(require,module,exports){ 'use strict'; var $ = (function(){try{return require('jquery')}catch(e){return window.jQuery}})(); /** * Constructor of plugin which displays SPARQL errors * * @param yasr {object} * @param parent {DOM element} * @param options {object} * @class YASR.plugins.boolean * @return yasr-erro (doc) * */ var root = module.exports = function(yasr) { var $container = $("
"); var options = $.extend(true, {}, root.defaults); var getTryBtn = function() { var $tryBtn = null; if (options.tryQueryLink) { var link = options.tryQueryLink(); $tryBtn = $('") .text(name) .addClass("select_" + pluginName) .click(function() { //update buttons btnGroup.find("button.selected").removeClass("selected"); $(this).addClass("selected"); //set and draw output yasr.options.output = pluginName; //store if needed yasr.store(); //close warning if there is any if ($toggableWarning) $toggableWarning.hide(400); yasr.draw(); }) .appendTo(btnGroup); if (yasr.options.output == pluginName) button.addClass("selected"); }); if (btnGroup.children().length > 1) yasr.header.append(btnGroup); }; var drawDownloadIcon = function() { var stringToUrl = function(string, contentType) { var url = null; var windowUrl = window.URL || window.webkitURL || window.mozURL || window.msURL; if (windowUrl && Blob) { var blob = new Blob([string], { type: contentType }); url = windowUrl.createObjectURL(blob); } return url; }; var button = $("") .append(require("yasgui-utils").svg.getElement(require('./imgs.js').download)) .click(function() { var currentPlugin = yasr.plugins[yasr.options.output]; if (currentPlugin && currentPlugin.getDownloadInfo) { var downloadInfo = currentPlugin.getDownloadInfo(); var downloadUrl = stringToUrl(downloadInfo.getContent(), (downloadInfo.contentType ? downloadInfo.contentType : "text/plain")); var downloadMockLink = $("", { href: downloadUrl, download: downloadInfo.filename }); require('./utils.js').fireClick(downloadMockLink); // downloadMockLink[0].click(); } }); yasr.header.append(button); }; var drawFullscreenButton = function() { var button = $("") .append(require("yasgui-utils").svg.getElement(require('./imgs.js').fullscreen)) .click(function() { yasr.container.addClass('yasr_fullscreen'); }); yasr.header.append(button); }; var drawSmallscreenButton = function() { var button = $("") .append(require("yasgui-utils").svg.getElement(require('./imgs.js').smallscreen)) .click(function() { yasr.container.removeClass('yasr_fullscreen'); }); yasr.header.append(button); }; var drawEmbedButton = function() { embedBtn = $("