/******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 367: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { const PRIVATE = Symbol(); const SUB_QUERY = Symbol(); const tools = __webpack_require__(897); const ops = [ { regExp : /\!(\$?_?\w+)/, //negative handle : (run, args) => { return !(args[0] && args[0] !=="undefined" && JSON.parse(args[0])); } }, { regExp : /(\$?_?[\w\.]+)(\=\=\=?)(\$?_?\w+)/, //is equal handle : (run, args)=>{ return args[1] == "===" ? ((args[0] === 'undefined' ? undefined : JSON.parse(args[0])) === (args[2] === 'undefined' ? undefined : JSON.parse(args[2]))) : ((args[0] === 'undefined' ? undefined : JSON.parse(args[0])) == (args[2] === 'undefined' ? undefined : JSON.parse(args[2]))) } }, { regExp : /(\$?_?\w+)\!\=(\$?_?\w+)/, //is unequal handle : (run, args)=>{ return JSON.parse(args[0]) != JSON.parse(args[1]) } }, { regExp : /(\w+)\~(.+)?/, //execute handle : (run, args) => { return run.handle(args[0], (args[1] && JSON.parse(args[1]))) } }, { regExp : /^\?(\$?_?[\w\.]+)(\$_?\w+)(?:\:(\$_\w+))?/, // condition handle : (run, args, stack) =>{ (args[0] && args[0] !== "undefined" && JSON.parse(args[0])) ? stack.add(args[1]) : (args.length > 2 && stack.add(args[2])) } }, { regExp : /\$(\w+)\=(.+)/, //assign handle : (run, args)=>{ if(args[1] === "undefined") { param = null; } else { try { var param = JSON.parse(args[1]); } catch(e) { throw new Error(e); } } run.setVar("$"+args[0], param); return param; } }, { regExp : /^\=\>(.+)/, //return handle : (run, args)=>{ if(args[0] === "undefined") { var res = null; } else { try { var res = JSON.parse(args[0]); } catch(e) { throw e; } } return run.setVar("$__", res); } }, { regExp : /^\-\>@_(\d+)/, //return bookmark handle : (run, args)=>{ return run.setVar("$@", args[0]); } } ] class Run { constructor({query, params}, handlers, localResolver, getResolvers) { this[PRIVATE] = {}; this[PRIVATE].scope = {}; if(params) { Object.keys(params).map(key=>{ this[PRIVATE].scope['$'+key] = params[key]; }); } this[PRIVATE].varCount = 0; this[PRIVATE].bookmarkCount = 0; this[PRIVATE].query = typeof query == "string" ? query .replace(/\"([^"]*)\"|\'([^']*)\'/g, (m, str)=>this.setVar(str)) //save strings .replace(/\s+/g, '') .split(";").filter(el=>el!=="") : query; this[PRIVATE].current = 0; this[PRIVATE].score = 0; this[PRIVATE].bookmarks = {}; this[PRIVATE].currentLine; this[PRIVATE].prom = Promise.resolve({}); this[PRIVATE].currentChunk = { resolver : null, lines : [], score : 0 } this[PRIVATE].localResolver = localResolver; this[PRIVATE].handlers = handlers; this[PRIVATE].getResolvers = getResolvers; } handle(method, param) { for(let i in this[PRIVATE].handlers){ let handler = this[PRIVATE].handlers[i]; if(handler.regExp.test(method)){ return Promise.resolve().then(()=>handler.handle(param, method)); } } } updateScope(data) { data && Object.keys(data).forEach(key=>{ this.setVar("$"+key, data[key]) }); } pastParams(query) { return query.replace(/\$_?[\w+\.]+/g, (name)=>{ var path = name.split("."), param = this.getVar(path[0]); if(param === undefined) return name; var param = path.length > 1 ? tools.lookDeep(path.slice(1).join("."), param) : param; if(param === undefined) return name; return JSON.stringify(param); }) } getNextVarKey() { return `$_${this[PRIVATE].varCount++}` } getNextBookmarkKey() { return `@_${this[PRIVATE].bookmarkCount++}` } getNextLine(){ var line = this[PRIVATE].query[this[PRIVATE].current++]; this[PRIVATE].score += tools.getBalance(line); this[PRIVATE].currentLine = line; return line; } stepBack() { this[PRIVATE].score -= tools.getBalance(this[PRIVATE].currentLine); this[PRIVATE].current--; this[PRIVATE].currentLine = this[PRIVATE].query[this[PRIVATE].current]; } splitLine() { var that = this; this[PRIVATE].currentLine = this[PRIVATE].currentLine.replace(/\(([^\(]+)\)/, (str, call)=>{ let key = this.getNextVarKey() + '_'; that[PRIVATE].query.splice(this[PRIVATE].current-1, 0, key+"="+call); return key; }); this[PRIVATE].query.splice(this[PRIVATE].current, 1, this[PRIVATE].currentLine); this[PRIVATE].current--; this[PRIVATE].currentLine = this[PRIVATE].query[this[PRIVATE].current]; } adjustChunk(){ if(this[PRIVATE].score == 0) { return } var bookmark = this.getNextBookmarkKey(); this[PRIVATE].bookmarks[bookmark] = this[PRIVATE].current; this[PRIVATE].currentChunk.lines.push(`->${bookmark}`); var score = 0; while(score >= 0) { let line = this.getNextLine(), balance = tools.getBalance(line); score += balance; this[PRIVATE].score += balance; if(score == 0 && ~line.indexOf("}") && (line.indexOf("}") < line.indexOf("}"))) { score --; } } this.stepBack(); } hasNextLine(){ return this[PRIVATE].current < this[PRIVATE].query.length; } setVar(key, val) { if(val === undefined) { let name = this.getNextVarKey(); this[PRIVATE].scope[name] = key; return name; } this[PRIVATE].scope[key] = val; return; } getVar(key) { let val = this[PRIVATE].scope[key]; if((/^\$_[^_]/).test(key)) { delete this[PRIVATE].scope[key]; } return val; } setFunction(key, val) { if(!val) { let name = this.getNextVarKey(); this[PRIVATE].scope[name] = {[SUB_QUERY] : key}; return name; } this[PRIVATE].scope[key] = {[SUB_QUERY] : val}; return; } getResolvedScope(){ this[PRIVATE].prom = this[PRIVATE].prom.then(()=>{ var keys = Object.keys(this[PRIVATE].scope).filter(key=>!(/^\$\_\d+$/).test(key)); return Promise.all(keys.map(key=>this[PRIVATE].scope[key])).then(vals=>{ if(~keys.indexOf("$__")) { return this[PRIVATE].scope["$__"]; } var resolved = {}; keys.forEach((key, index)=>{ resolved[key.substring(1)] = vals[index]; }); return resolved; }); }); return this[PRIVATE].prom; } executeLine(line, stack, prom){ var that = this; var prom = prom || Promise.resolve(); return prom.then(()=>{ if(~line.indexOf("(")) { let newProm; return that.executeLine(line.replace(/\(([^\(\)]+)\)/, (m, expr)=>{ var newProm = that.executeLine(expr, stack, prom); return that.setVar(newProm); }), stack, newProm); } for(let i = 0; i < ops.length; i++) { let op = ops[i]; if(op.regExp.test(line)) { let newProm; return that.executeLine(line.replace(op.regExp, function(str){ var args = Object.values(arguments); args = args.slice(1, args.length - 2); var paramMap = that.getParamsFromQuery(str), newProm = Promise.all(Object.values(paramMap)).then(values=>{ Object.keys(paramMap).forEach((key, index)=>{ var path = key.split("."), val = path.length > 1 ? tools.lookDeep(path.slice(1).join("."), values[index]) : values[index]; args = args.filter(arg=>arg!==undefined).map(arg=>{ return arg.replace(key, typeof val == "object" && val !== null && val[SUB_QUERY] ? val[SUB_QUERY] : JSON.stringify(val)) }) }); return op.handle(that, args, stack); }).then(r=>{ if(that.getVar("$__") || that.getVar("$@")) { stack.clear(); } return r; }).catch(e=>{ throw new Error(`Error during executing ${str.replace(/\$[\_\w]+/g, (m)=>{ return paramMap[m]; })}. Details: ${e.stack}`); }); return that.setVar(newProm); }), stack, newProm); } } return prom.then(r=>{ var paramMap = that.getParamsFromQuery(line), vals = Object.values(paramMap); if(!vals.length) { return r; } return Promise.all(vals).then(values=>{ Object.keys(paramMap).forEach((key, index)=>{ var path = key.split("."), val = path.length > 1 ? tools.lookDeep(path.slice(1).join("."), values[index]) : values[index]; line = line.replace(key, JSON.stringify(val)); }); try { return line == "undefined" ? undefined : JSON.parse(line); } catch(e) { throw new Error ("Error durring parsing expression "+line+": invalid JSON") } }); }); }) } getParamsFromQuery(query) { var res = {}; (query.match(/\$_?[\w\.]+/g) || []).forEach(key=>{ var path = key.split("."); res[key] = this.getVar(path[0]); }); return res; } startFromBookMark(bookmark) { var score = tools.getBalance(this[PRIVATE].query.slice(0, bookmark).join(";")), rest = tools.saveTopLevelFunction(this[PRIVATE].query.slice(bookmark).join(";")), newQuery = rest.str.split(";").filter(el=>!(/^\}\:/).test(el)); this[PRIVATE].current = 0; this[PRIVATE].query = newQuery; delete this[PRIVATE].scope["$@"]; } execute() { while(this.hasNextLine()) { var line = this.getNextLine(), calls = tools.getCalls(line), resolvers = this[PRIVATE].getResolvers(calls); if(resolvers.length > 1) { this.splitLine(); continue; } this[PRIVATE].currentChunk.score = this[PRIVATE].score; if(this.readyToResolve(resolvers[0])) { if(this[PRIVATE].currentChunk.score > 0) { this.adjustChunk(); continue; } this[PRIVATE].current--; return this.resolveChunk({ resolver : this[PRIVATE].currentChunk.resolver, lines : this[PRIVATE].currentChunk.lines.join(";").split(";") }); } } return this.resolveChunk().then(()=>this.getResolvedScope()); } resolveChunk(chunk) { chunk = chunk || this[PRIVATE].currentChunk; let query = chunk.lines.join(";"); chunk.resolver = chunk.resolver || this[PRIVATE].localResolver; this[PRIVATE].prom = this[PRIVATE].prom.then(()=>{ return chunk.resolver.handle(chunk.resolver.isLocal ? query : this.pastParams(query.replace(/\=\>([^\;]+)/g, (m, p)=>`=>{"__":(${p})}`)), this, this[PRIVATE].context).then(r=>chunk.resolver.isLocal ? r : this.updateScope(r)); }); return this[PRIVATE].prom.then(r=>{ var bookmark = this[PRIVATE].bookmarks["@_"+this.getVar("$@")]; if(bookmark !== undefined) { this.startFromBookMark(+bookmark-1); } this[PRIVATE].currentChunk = { resolver : null, lines : [] } if(~Object.keys(this[PRIVATE].scope).indexOf("$__")) return this[PRIVATE].scope["$__"]; return this.hasNextLine() ? this.execute() : r; }); } readyToResolve(resolver){ if(!resolver || !this[PRIVATE].currentChunk.resolver || this[PRIVATE].currentChunk.resolver.id == resolver.id) { this[PRIVATE].currentChunk.lines.push(this[PRIVATE].currentLine); !this[PRIVATE].currentChunk.resolver && (this[PRIVATE].currentChunk.resolver = resolver); return false; } return true; } } module.exports = Run; /***/ }), /***/ 936: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { const PRIVATE = Symbol(), LOCAL_RESOLVER = Symbol(), Run = __webpack_require__(367); class Stack { constructor(query) { this[PRIVATE] = {}; this[PRIVATE].lines = typeof query == "string" ? query.split(";") : query; } hasNext() { return !!this[PRIVATE].lines.length; } next() { return this[PRIVATE].lines.shift(); } add(lines){ this[PRIVATE].lines.unshift.apply(this[PRIVATE].lines, typeof lines == "string" ? lines.split(";") : lines); } clear() { this[PRIVATE].lines = []; } } function saveNestedFunctions(query, run) { var start = query.indexOf("@{"); if(start == -1) { return query } let counter = 1, current = start+1; while(counter != 0) { current++; counter = counter + ({ "{" : 1, "}" : -1 }[query[current]] || 0); } return query.substr(0, start) + run.setFunction(saveNestedFunctions(query.substr(start+2, current-start-2), run)) + saveNestedFunctions(query.substr(current+1), run); } class Limbo { constructor(options){ var that = this; this[PRIVATE] = { getResolvers(calls){ return calls.map(call=>{ for(let key in that[PRIVATE].resolvers) { if(!that[PRIVATE].resolvers[key].regExp || that[PRIVATE].resolvers[key].regExp.test(call)) { return that[PRIVATE].resolvers[key]; } } }).filter((resolver, index, arr)=>arr.indexOf(resolver) == index); }, executeLocaly(query, run){ function next(stack, prom){ return stack.hasNext() ? run.executeLine(stack.next(), stack).then(()=>next(stack, prom)) : prom; } return next(new Stack(saveNestedFunctions(query, run).split(";")), Promise.resolve()); } } this[PRIVATE].handlers = (options && options.handlers) || []; this[PRIVATE].resolvers = [{ id : LOCAL_RESOLVER, isLocal : true, regExp : (options && options.localResolver && options.localResolver.regExp) || null, handle : that[PRIVATE].executeLocaly }]; } getLocalResolver() { return this[PRIVATE].resolvers.filter(resolver=>resolver.id == LOCAL_RESOLVER)[0] } delegate(obj){ this[PRIVATE].resolvers.push({ id: obj.id || Symbol(), regExp : typeof obj.regExp == "string" ? new RegExp(obj.regExp) : obj.regExp, handle : obj.handle }) this[PRIVATE].resolvers = this[PRIVATE].resolvers.sort(resolver=>resolver.isLocal ? 1 : -1) } addHandler(obj){ if(typeof obj == 'function') { obj = { id : null, handle : obj, regExp : new RegExp(obj.name) } } this[PRIVATE].handlers.push({ id : obj.id || Symbol(), regExp : (typeof obj.regExp == "string" ? new RegExp(obj.regExp) : obj.regExp), handle : obj.handle }); } addHandlers(handlers){ handlers.forEach(handler=>{ this.addHandler(handler); }) } call(query) { var {query, params} = typeof query != "string" ? query : {query: query, params: {}}; if(typeof query !== 'string' || typeof params !== 'object') { throw new Error("Incorect input"); } var run = new Run({query, params}, this[PRIVATE].handlers, this.getLocalResolver(), this[PRIVATE].getResolvers); return run.execute(); } } module.exports = Limbo; /***/ }), /***/ 897: /***/ (function(module) { function lookDeep(key, obj){ let path = key.split('.'), val = obj; for(let i = 0; i < path.length; i++){ if(!val) { break; } val = val[path[i]]; } return val; } module.exports = { lookDeep : lookDeep, getCalls(line){ return (line.match(/\w+\~/g) || []).filter((el, index, arr)=>arr.indexOf(el) == index) .map(el=>el.replace(/\~/g, '')); }, getBalance(line){ return (line.match(/\{/g) || []).length - (line.match(/\}/g) || []).length; }, saveTopLevelFunction(str) { var scope = []; function process(str) { var start = str.indexOf("@{"); if(start == -1) { return str } let counter = 1, current = start+1; while(counter != 0) { current++; counter = counter + ({ "{" : 1, "}" : -1 }[str[current]] || 0); } scope.push(str.substr(start+2, current-start-2)); return str.substr(0, start) + "$"+(scope.length+1) + process(str.substr(current+1)); } var result = process(str); return { str : result, scope : scope } }, generateKey(length) { var text = "", possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (var i = 0; i < length; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } } /***/ }), /***/ 962: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { const tools = __webpack_require__(310); module.exports = { cache(){ var queryJson = JSON.stringify(this.currentQuery), cacheKeys = []; for(let i in arguments){ let key = arguments[i][0], cacheVal = this.buffer[key], match = queryJson.match(new RegExp('(?:(\\w+)\\>)?('+key+')"(?:\\:([^\\}]+))')); if(!cacheVal){ return '__defer__'; } match && (key = match[1] || match[2]); key += JSON.stringify(tools.getParams(JSON.parse(match[3]), this.buffer)); let exp = new Date(); exp.setHours(exp.getHours() + arguments[i][1]); if(!this.cache[key]){ cacheKeys.push(key); this.cache[key] = { val : cacheVal, expiration : exp, isSingleServe : arguments[i][2] }; } } return cacheKeys; }, writeToCache(obj){ Object.assign(this.cache, obj); }, aggr(obj){ return obj; }, set(key, val){ this.scope[key] = val; }, get(key) { return this.scope[key]; }, map(items, methodName, field) { var obj = this.obj; return new Promise((resolve, reject)=>{ for(let key in items){ this.promise.then((obj)=>{ method = this.getResourceFunction(tools.parseKey(methodName), [items[key]], [methodName]); //TODO: add key parsing return method.apply(this, [items[key]]); }).then((r)=>{ items[key] = r; return r; }); } this.promise.then(()=>{ resolve(items); }) }) }, sort(items, key, desc){ items && items.sort && items.sort((a, b)=>{ if(key) { a = tools.lookDeep(key, a); b = tools.lookDeep(key, b); if(!a || !b) return; } return desc ? (a < b ? 1 : -1) : (a > b ? 1 : -1); }); return items; }, frame(items, offset, limit){ return items.slice(offset, offset+limit) } } /***/ }), /***/ 474: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { const builtIn = __webpack_require__(962), tools = __webpack_require__(310); var sharedResourceMethods; class LiteQL{ constructor(options){ options = options || {}; this.resources = options.resources || {}; this.resourceMethod = options.resourceMethod; this.cache = {}; this.delegatedBuiltin = options.delegatedBuiltin || []; this.scope = {}; } addResources(resources){ Object.assign(this.resources, resources); return this; } call(query){ var obj = {}, buffer = {}, promise = Promise.resolve(obj), deferred = [], delegated = [], resourceMethod = this.resourceMethod, resources = this.resources, cache = this.cache, delegatedBuiltin = this.delegatedBuiltin, scope = this.scope, context = {}; context.currentQuery = query; context.promise = promise; context.handleQuery = handleQuery; context.getResourceFunction = getResourceFunction; function getResourceFunction(queryMethod, params, subQuery){ var key = queryMethod.getterKey, cacheEntryPoint = cache[key+JSON.stringify(params)]; if(cacheEntryPoint) { let result; if(!cacheEntryPoint.expiration || cacheEntryPoint.expiration > (new Date()).getTime()){ result = cacheEntryPoint.val; cacheEntryPoint.singleServe && (delete cache[key+JSON.stringify(params)]) } else { delete cache[key+JSON.stringify(params)]; } if(result) { return ()=>result; } } var method = resources[key] || (resourceMethod ? resourceMethod(key) : (sharedResourceMethods && sharedResourceMethods(key))); if((!method && (~delegatedBuiltin.indexOf(key) || !queryMethod.builtIn)) || queryMethod.delegated) { if(params && !~JSON.stringify(params).indexOf('__failed__')) { for(let key in subQuery){ subQuery[key] = params; } } delegated.push(subQuery); return ()=>null; } if(~JSON.stringify(params).indexOf('__failed__')){ deferred.push(subQuery); return ()=>null; } if(queryMethod.builtIn) { return builtIn[key]; } return method; } !(query instanceof Array) && (query = [query]); function handleQuery(query) { for(let i = 0; i < query.length; i++) { let currentKey; if(typeof query[i] == 'string') { query[i] = {[query[i]] : null} } for(let key in query[i]){ currentKey = tools.parseKey(key); promise = promise.then((obj)=>{ var params = tools.getParams(query[i][key], buffer); context.cacheSettings = []; context.buffer = buffer; context.cache = cache; context.scope = scope; return getResourceFunction(currentKey, params, query[i]) .apply(context, params); }); } promise = promise.then(function(result){ if(result == '__defer__'){ deferred.push(query[i]); return obj; } if(currentKey.mode == "standard") { obj[currentKey.settterKey] = result; } else if(currentKey.mode == "dominant" && result !== null) { obj = result; } buffer[currentKey.settterKey] = result; return obj }); } return promise; } handleQuery(query); if(resources.__delegate__){ promise = promise.then((obj)=>{ if(delegated.length) { delegated = JSON.parse(JSON.stringify(delegated).replace(/~/g, '')); return resources.__delegate__(delegated).then((resp)=>{ if(~JSON.stringify(delegated).indexOf('!')){ obj = resp; } else { Object.assign(obj, resp) } Object.assign(buffer, resp); return obj; }) } else {return obj} }) } return new Promise((resolve, reject)=>{ promise.then((obj)=>{ if(deferred.length) { handleQuery(deferred).then(obj=>resolve(obj)) } else { resolve(obj) } }).catch((e)=>{ typeof console !== "undefined" && console && console.error && console.error(e); reject(e); }); }); } setResourceMethod(method){ resourceMethod = method; return this; } static setResourceMethod(method){ sharedResourceMethods = method; } } module.exports = LiteQL; /***/ }), /***/ 310: /***/ (function(module) { function lookDeep(key, obj){ let path = key.split('.'), val = obj; for(let i = 0; i < path.length; i++){ if(!val) { break; } val = val[path[i]]; } return val; } module.exports = { getParams(key, obj){ !(key instanceof Array) && (key = [key]); return JSON.parse(key && JSON.stringify(key).replace(/"?_([\w\.]+)"?/g, function(match, key){ if(key == 'this') { return JSON.stringify(obj); } val = lookDeep(key, obj); if(val === undefined) { val = '__failed__'; } if(typeof val == 'object') { val = JSON.stringify(val); } else if(typeof val == 'string') { val = '"'+val+'"'; } return val; })); }, lookDeep : lookDeep, parseKey(key){ var match = key.match(/^([\?\!\~\@]+)?([\w]+)(?:\>(\w+))?/); return { getterKey : match[2], mode : match[1] && (~match[1].indexOf('?') ? 'buffer' : ~match[1].indexOf('!') ? 'dominant' : '')|| 'standard', settterKey : match[3] || match[2], delegated : match[1] && ~match[1].indexOf('~'), builtIn : match[1] && ~match[1].indexOf('@') } } } /***/ }), /***/ 723: /***/ (function(__unused_webpack_module, exports) { !function(e,t){ true?t(exports):0}(this,(function(e){"use strict";function t(e){var n,r,a=new Error(e);return n=a,r=t.prototype,Object.setPrototypeOf?Object.setPrototypeOf(n,r):n.__proto__=r,a}function n(e,n,r){var a=n.slice(0,r).split(/\n/),i=a.length,s=a[i-1].length+1;throw t(e+=" at line "+i+" col "+s+":\n\n "+n.split(/\n/)[i-1]+"\n "+Array(s).join(" ")+"^")}t.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var r=new Function("return this")().Promise,a=!1;try{a=new Function("return (async function(){}).constructor")()}catch(e){if(!(e instanceof SyntaxError))throw e}function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function s(e,t,n){for(var r in t)i(t,r)&&(null==t[r]||"object"!=typeof t[r]||"storage"!==r&&"prefixes"!==r||n?e[r]=t[r]:e[r]=s({},t[r]));return e}var c=/^async +/,o=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,l=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,f=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,u=/[.*+\-?^${}()|[\]\\]/g;function p(e){return u.test(e)?e.replace(u,"\\$&"):e}function h(e,r){r.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),o.lastIndex=0,l.lastIndex=0,f.lastIndex=0;var a=r.prefixes,i=[a.h,a.b,a.i,a.r,a.c,a.e].reduce((function(e,t){return e&&t?e+"|"+p(t):t?p(t):e}),""),s=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+p(r.tags[1])+")","g"),u=new RegExp("([^]*?)"+p(r.tags[0])+"(-|_)?\\s*("+i+")?\\s*","g"),h=0,d=!1;function g(t,a){var i,p={f:[]},g=0,v="c";function m(t){var a=e.slice(h,t),i=a.trim();if("f"===v)"safe"===i?p.raw=!0:r.async&&c.test(i)?(i=i.replace(c,""),p.f.push([i,"",!0])):p.f.push([i,""]);else if("fp"===v)p.f[p.f.length-1][1]+=i;else if("err"===v){if(i){var s=a.search(/\S/);n("invalid syntax",e,h+s)}}else p[v]=i;h=t+1}for("h"===a||"b"===a||"c"===a?v="n":"r"===a&&(p.raw=!0,a="i"),s.lastIndex=h;null!==(i=s.exec(e));){var y=i[1],x=i[2],b=i[3],w=i[4],F=i[5],S=i.index;if(y)"("===y?(0===g&&("n"===v?(m(S),v="p"):"f"===v&&(m(S),v="fp")),g++):")"===y?0===--g&&"c"!==v&&(m(S),v="err"):0===g&&"|"===y?(m(S),v="f"):"=>"===y&&(m(S),h+=1,v="res");else if(x){if("/*"===x){var I=e.indexOf("*/",s.lastIndex);-1===I&&n("unclosed comment",e,i.index),s.lastIndex=I+2}else if("'"===x){l.lastIndex=i.index,l.exec(e)?s.lastIndex=l.lastIndex:n("unclosed string",e,i.index)}else if('"'===x){f.lastIndex=i.index,f.exec(e)?s.lastIndex=f.lastIndex:n("unclosed string",e,i.index)}else if("`"===x){o.lastIndex=i.index,o.exec(e)?s.lastIndex=o.lastIndex:n("unclosed string",e,i.index)}}else if(b)return m(S),h=S+i[0].length,u.lastIndex=h,d=F,w&&"h"===a&&(a="s"),p.t=a,p}return n("unclosed tag",e,t),p}var v=function i(s,o){s.b=[],s.d=[];var l,f=!1,p=[];function v(e,t){e&&(e=function(e,t,n,r){var a,i;return"string"==typeof t.autoTrim?a=i=t.autoTrim:Array.isArray(t.autoTrim)&&(a=t.autoTrim[1],i=t.autoTrim[0]),(n||!1===n)&&(a=n),(r||!1===r)&&(i=r),"slurp"===a&&"slurp"===i?e.trim():("_"===a||"slurp"===a?e=String.prototype.trimLeft?e.trimLeft():e.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==a&&"nl"!==a||(e=e.replace(/^(?:\n|\r|\r\n)/,"")),"_"===i||"slurp"===i?e=String.prototype.trimRight?e.trimRight():e.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==i&&"nl"!==i||(e=e.replace(/(?:\n|\r|\r\n)$/,"")),e)}(e,r,d,t))&&(e=e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),p.push(e))}for(;null!==(l=u.exec(e));){var m,y=l[1],x=l[2],b=l[3]||"";for(var w in a)if(a[w]===b){m=w;break}v(y,x),h=l.index+l[0].length,m||n("unrecognized tag type: "+b,e,h);var F=g(l.index,m),S=F.t;if("h"===S){var I=F.n||"";r.async&&c.test(I)&&(F.a=!0,F.n=I.replace(c,"")),F=i(F),p.push(F)}else if("c"===S){if(s.n===F.n)return f?(f.d=p,s.b.push(f)):s.d=p,s;n("Helper start and end don't match",e,l.index+l[0].length)}else if("b"===S){f?(f.d=p,s.b.push(f)):s.d=p;var R=F.n||"";r.async&&c.test(R)&&(F.a=!0,F.n=R.replace(c,"")),f=F,p=[]}else if("s"===S){var T=F.n||"";r.async&&c.test(T)&&(F.a=!0,F.n=T.replace(c,"")),p.push(F)}else p.push(F)}if(!o)throw t('unclosed helper "'+s.n+'"');return v(e.slice(h,e.length),!1),s.d=p,s}({f:[]},!0);if(r.plugins)for(var m=0;m0)throw t((a?"Native":"")+"Helper '"+e+"' doesn't accept blocks");if(r&&r.length>0)throw t((a?"Native":"")+"Helper '"+e+"' doesn't accept filters")}var F={"&":"&","<":"<",">":">",'"':""","'":"'"};function S(e){return F[e]}var I=new b({}),R=new b({each:function(e,t){var n="",r=e.params[0];if(w("each",t,!1),e.async)return new Promise((function(t){!function e(t,n,r,a,i){r(t[n],n).then((function(s){a+=s,n===t.length-1?i(a):e(t,n+1,r,a,i)}))}(r,0,e.exec,n,t)}));for(var a=0;a"']/.test(t)?t.replace(/[&<>"']/g,S):t}}),j={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(e,n){if("H"===e){var r=this.storage.helpers.get(n);if(r)return r;throw t("Can't find helper '"+n+"'")}if("F"===e){var a=this.storage.filters.get(n);if(a)return a;throw t("Can't find filter '"+n+"'")}},async:!1,storage:{helpers:R,nativeHelpers:T,filters:E,templates:I},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function H(e,t){var n={};return s(n,j),t&&s(n,t),e&&s(n,e),n.l.bind(n),n}function O(e,n){var r=H(n||{}),i=Function;if(r.async){if(!a)throw t("This environment doesn't support async/await");i=a}try{return new i(r.varName,"c","cb",d(e,r))}catch(n){throw n instanceof SyntaxError?t("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+d(e,r)):n}}function _(e,t){var n;return t.cache&&t.name&&t.storage.templates.get(t.name)?t.storage.templates.get(t.name):(n="function"==typeof e?e:O(e,t),t.cache&&t.name&&t.storage.templates.define(t.name,n),n)}j.l.bind(j),e.compile=O,e.compileScope=x,e.compileScopeIntoFunction=y,e.compileToString=d,e.defaultConfig=j,e.filters=E,e.getConfig=H,e.helpers=R,e.nativeHelpers=T,e.parse=h,e.render=function(e,n,a,i){var s=H(a||{});if(!s.async)return _(e,s)(n,s);if(!i){if("function"==typeof r)return new r((function(t,r){try{t(_(e,s)(n,s))}catch(e){r(e)}}));throw t("Please provide a callback function, this env doesn't support Promises")}try{_(e,s)(n,s,i)}catch(e){return i(e)}},e.templates=I,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=squirrelly.min.js.map /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. !function() { var LiteQL = __webpack_require__(474); var Limbo = __webpack_require__(936); window.sqrl = __webpack_require__(723); window.liteQL = new LiteQL(); window.limbo = new Limbo(); var url = "/data"; window.liteQL.addResources({ __delegate__(query){ return fetch(url, { method : "POST", headers : { "Content-Type" : "application/json" }, body : JSON.stringify(query) }).then(resp=>{ return resp && resp.json(); }); } }); window.limbo.delegate({regExp : /.+/, handle : query=>{ var headers = { "Content-Type" : "application/json" }; return fetch("/limbo", { method : "POST", headers : headers, body : JSON.stringify({query : query}) }).then(resp=>{ return resp && resp.json(); }).catch(err=>{ console.log(err) }); }}); window.onload = ()=>{ var loadedComponenets = []; document.querySelectorAll("[data-component]").forEach((element)=>{ if(!~loadedComponenets.indexOf(element.dataset.component)) { let scriptElement = document.createElement("script"); scriptElement.setAttribute("src", "/js/"+element.dataset.component+".js"); document.querySelector("body").appendChild(scriptElement); } }); } }(); /******/ })() ;