-
Notifications
You must be signed in to change notification settings - Fork 0
/
fencache.min.js
1 lines (1 loc) · 2.13 KB
/
fencache.min.js
1
!function(){function n(n,r,t){"use strict";var e,u,o=function(n){return n},i=typeof t;function f(r,t,e,u,o){return n(r,t,e,u,o)}if("function"===i?o=t:(r<1&&"string"!==i||"object"===i)&&(o="number"===i?function(n){return""+n}:function(n){return"number"==typeof n?""+n:"string"==typeof n?n:JSON.stringify(n)}),r<1){var a={},c=0,v=function(){};function s(r,t,e,u,i){return p=o(r,t,e,u,i),a[p]?a[p]:(v(),a[p]=n(r,t,e,u,i))}return r<0&&(r=0-r,v=function(){if(c++>r){var n=r>>>1;for(var t in a)if(a.hasOwnProperty(t)&&(delete a[t],--c<n))break}}),s.state=function(){return a},s.reset=function(n){for(var r in c=0,a=n||{})a.hasOwnProperty(r)&&c++},s.put=function(n,r,t,e,u,i){var f=a[p=o(r,t,e,u,i)];return a[p]=n,void 0===f&&v(),f},s.val=function(n){return a[o(n)]},s.bypass=f,s}if(1===r){function y(r){return e===r?u:(e=r,u=n(r))}return y.reset=function(n){n?(e=n.key,u=n.val):e=u=void 0},y.state=function(){return{key:e,val:u}},y.put=function(n,r,t,i,f,a){var c=u;return u=n,e=o(r,t,i,f,a),c},y.val=function(n,r,t,i,f){if(e===o(n,r,t,i,f))return u},y.bypass=f,y}e=new Array(r),u=new Array(r);var p,d=-1,l=r-1,w=1,b=m(r);function m(n){return n<7?n-2:n<20?.67*n>>>0:5+.37*n>>>0}var g=function(r,t,i,f,a){p=o(r,t,i,f,a);for(var c=n(r,t,i,f,a),v=0;v<e.length;v++)e[v]=p,u[v]=c;h=function(){}},h=g;function k(r,t,i,f,a){if(h(r,t,i,f,a),p=o(r,t,i,f,a),e[0]===p)return u[0];for(var c=1;c<=w;c++)if(e[c]===p){var v,s=u[c];return v=c<=b?c-1:b,e[c]=e[v],u[c]=u[v],e[v]=p,u[v]=s,s}return d===w&&(d===l?d=b:w++),e[++d]=p,u[d]=n(r,t,i,f,a)}function u(n,r,t,i,f){p=o(n,r,t,i,f);for(var a=0;a<=w;a++)if(e[a]===p)return u[a]}return k.reset=function(n){n?(e=n.key,u=n.val,b=n.ra,d=n.rc,w=n.re,l=n.rex):(b=m(r),d=-1,w=1,l=r-1,e=new Array(r),u=new Array(r),h=g)},k.state=function(){return{key:e,val:u,rc:d,ra:b,re:w,rex:l}},k.val=u,k.put=function(n,r,t,i,f,a){h(r,t,i,f,a),p=o(r,t,i,f,a);for(var c=0;c<=w;c++)if(e[c]===p){var v,s=u[c];return v=c<=b?c-1:b,e[c]=e[v],u[c]=u[v],e[v]=p,u[v]=n,s}d===w&&(d===l?d=b:w++),e[++d]=p,u[d]=n},k.bypass=f,k.init=h,k}"undefined"!=typeof module&&module.exports?module.exports=n:"undefined"!=typeof window?window.fencache=n:console.log("fencache.js did not import")}();