You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
6.9 KiB
1 lines
6.9 KiB
"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}}();var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}(function(f){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.isEq=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++){o(t[i])}return o}return r}()({1:[function(require,module,exports){var _require=require("./utils"),always=_require.always,isNonZeroFalsy=_require.isNonZeroFalsy,stringify=_require.stringify,areNumbers=_require.areNumbers;var InfiniteListItem=function(){function InfiniteListItem(list,value,index){_classCallCheck(this,InfiniteListItem);this.value=value;this.index=index;this.next=function(z){return!z?list.get(index+1):list.get(index+z)};this.previous=function(z){return!z?list.get(index-1):list.get(index-z)};if(typeof Symbol!=="undefined"&&Symbol.iterator){this[Symbol.iterator]=function(){return{next:function next(){return{value:list.get(index+1),done:false}}}}}}_createClass(InfiniteListItem,[{key:"toString",value:function toString(){return"InfiniteListItem [ .. "+stringify(this.value)+" .. ]"}}]);return InfiniteListItem}();var InfiniteList=function InfiniteList(start,next){_classCallCheck(this,InfiniteList);var cache=[];var j=0;this.get=function(index){if(isNonZeroFalsy(index)||index<0||!areNumbers(index))return;if(!cache[0])cache[0]=start;if(index===Infinity)return new InfiniteListItem(this,Infinity,Infinity);if(index in cache)return new InfiniteListItem(this,cache[index],index);if(!(index in cache)){if(cache.length<=index&&cache.length-1 in cache)while(cache.length<=index){cache[cache.length]=next(cache[cache.length-1],cache[cache.length-2])}}return new InfiniteListItem(this,cache[index],index)};this.clearCache=function(){return cache=[],undefined};if(typeof Symbol!=="undefined"&&Symbol.iterator){this[Symbol.iterator]=function(){var _this=this;return{next:function next(){return{value:_this.get(j++),done:false}}}}}if(typeof Proxy!=="undefined")return new Proxy(this,{get:function get(obj,key){if(key in obj)return obj[key];var index=typeof key==="string"&&/^\d*$/g.test(key)?parseInt(key):undefined;if(index)return obj["get"](index)},has:function has(obj,key){var index=typeof key==="string"&&/^\d*$/g.test(key)?parseInt(key):undefined;return key in obj||areNumbers(index)&&index%1===0&&index>=0},enumerate:function enumerate(obj){return obj.keys()},ownKeys:function ownKeys(obj){return obj.keys()}})};InfiniteList.prototype.take=function(from,to){var arr=[];if(isNonZeroFalsy(from)||from===0&&isNonZeroFalsy(to)||!areNumbers(from)&&isNonZeroFalsy(to))return arr;var source=void 0,target=void 0;if(isNonZeroFalsy(to)){source=0;target=from}else{source=from;target=to+1}for(var i=source;i<target;i++){arr.push(this.get(i))}return arr};InfiniteList.prototype.top=function(){return this.get(0)};InfiniteList.prototype.end=function(){return this.get(Infinity)};InfiniteList.prototype.toString=function(){var length=_typeof(this.first())==="object"?2:5;return["InfiniteList [",this.take(length).map(function(x){return" "+stringify(x.value)})+",","... ]"].join(" ")};InfiniteList.prototype.first=InfiniteList.prototype.top;InfiniteList.prototype.last=InfiniteList.prototype.end;module.exports=InfiniteList;module.exports.InfiniteListItem=InfiniteListItem},{"./utils":3}],2:[function(require,module,exports){if(typeof JSON.decycle!=="function"){JSON.decycle=function decycle(object,replacer){"use strict";var objects=new WeakMap;return function derez(value,path){var old_path;var nu;if(replacer!==undefined){value=replacer(value)}if((typeof value==="undefined"?"undefined":_typeof(value))==="object"&&value!==null&&!(value instanceof Boolean)&&!(value instanceof Date)&&!(value instanceof Number)&&!(value instanceof RegExp)&&!(value instanceof String)){old_path=objects.get(value);if(old_path!==undefined){return{$ref:old_path}}objects.set(value,path);if(Array.isArray(value)){nu=[];value.forEach(function(element,i){nu[i]=derez(element,path+"["+i+"]")})}else{nu={};Object.keys(value).forEach(function(name){nu[name]=derez(value[name],path+"["+JSON.stringify(name)+"]")})}return nu}return value}(object,"$")}}if(typeof JSON.retrocycle!=="function"){JSON.retrocycle=function retrocycle($){"use strict";var px=/^\$(?:\[(?:\d+|"(?:[^\\"\u0000-\u001f]|\\(?:[\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*")\])*$/;(function rez(value){if(value&&(typeof value==="undefined"?"undefined":_typeof(value))==="object"){if(Array.isArray(value)){value.forEach(function(element,i){if((typeof element==="undefined"?"undefined":_typeof(element))==="object"&&element!==null){var path=element.$ref;if(typeof path==="string"&&px.test(path)){value[i]=eval(path)}else{rez(element)}}})}else{Object.keys(value).forEach(function(name){var item=value[name];if((typeof item==="undefined"?"undefined":_typeof(item))==="object"&&item!==null){var path=item.$ref;if(typeof path==="string"&&px.test(path)){value[name]=eval(path)}else{rez(item)}}})}}})($);return $}}module.exports=JSON},{}],3:[function(require,module,exports){"use strict";var JSON=require("./cycle");var always=function always(x){return function(_){return x}};var isNonZeroFalsy=function isNonZeroFalsy(_){return Boolean(_)===false&&_!==0};var stringify=function stringify(_){return(typeof _==="undefined"?"undefined":_typeof(_))==="object"&&_!==null?JSON.stringify(JSON.decycle(_),null,2):_.toString()};var areNumbers=function areNumbers(){for(var _len=arguments.length,items=Array(_len),_key=0;_key<_len;_key++){items[_key]=arguments[_key]}return items.every(function(x){return typeof x==="number"&&x!==NaN})};module.exports={always:always,isNonZeroFalsy:isNonZeroFalsy,stringify:stringify,areNumbers:areNumbers}},{"./cycle":2}]},{},[1])(1)});
|
|
|