-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfrytki.min.js
More file actions
34 lines (34 loc) · 16.7 KB
/
frytki.min.js
File metadata and controls
34 lines (34 loc) · 16.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
window.frytki=function(){function J(a,b,d,c,g,e,h,f,l,k,m){this.stopPropagation=function(){this.bubbles=!1;this.__stopPropogation__=!this.bubbles};this.stopImmediatePropagation=function(){this.bubbles=!1;this.__stopImmediatePropogation__=this.__stopPropogation__=!this.bubbles};this.preventDefault=function(){this.__preventDefault__=this.defaultPrevented=!0};this.stop=function(){this.target.__frytkiExtensions__.stop=this.stopped=!0};this.cancelable=k||!0;this.defaultPrevented=!1;this.bubbles=m||!0;
this.value=a;this.oldValue=b;this.target=d;this.key=this.attr=c;this.arguments=g;this.action=e;this.srcObject=h;this.type=f;this.stopped=!1;this.parent=this.target.__frytkiExtensions__.immediateParent;l&&(this.target.__frytkiExtensions__.stop=this.stopped=!0)}function R(a,b,d,c,g,e){var h=d.__frytkiExtensions__,f=h?Object.getOwnPropertyDescriptor(h,"base"):void 0;Object.defineProperties(this,{base:f?f.get?f:H(h,"base"):K(d),hash:f?f.get?Object.getOwnPropertyDescriptor(h,"hash"):H(h,"hash"):K(a)});
this.ref=b;this.scope=c;this.immediateParent=g;this.pointers={};this.parentTranslatePointers={};this.attrListeners={};this.attrUpdateListeners={};this.parentAttrListeners={};this.parentAttrUpdateListeners={};this.events={};this.bubbledEvents={};this.bypass=this.stop=void 0;this.isModifying=!1;this.setIndex=0;this.lengthSet=e;this.descriptors={}}function B(a,b){var d=a.length,c;for(c=0;c<d;c++){!1===a[c](b)&&(b.__preventDefault__=!0);if(b.__stopImmediatePropogation__)break;d!==a.length&&(c=Math.max(c-
(d-a.length),-1),d=a.length)}}function C(a,b){var d=a.length,c;for(c=0;c<d;c++){b.target=a[c].parent;a[c].func(b);if(void 0!==b.__stopPropogation__)break;d!==a.length&&(c=Math.max(c-(d-a.length),-1),d=a.length)}}function x(a,b){b="string"===typeof b?b.split("."):[b];var d=b.length,c=0;for(c;c<d-1;c++)"undefined"===a[b[c]]?a.set&&a.set(b[c],{}):void 0!==a[b[c]]&&"object"===typeof a[b[c]]&&(a=a[b[c]]);return a}function y(a){return"string"===typeof a?a.substring(a.lastIndexOf(".")+1,a.length):a.toString()}
function p(a){a=F(a,"array");return parseInt(a[a.length-1],10)+1}function z(a,b,d){var c=d.descriptors[b],g=c.value,e=c.oldValue,h=void 0===g?"delete":void 0===e?"create":"set";D(a,h,b,g,e,d,d.stop)?("create"===h&&Object.defineProperty(a,b,v(b,g,d)),"delete"===h&&(d.descriptors[b]=void 0),d.stop||E(a,h,b,g,e,d)):"create"!==h?"delete"===h?Object.defineProperty(a,b,v(b,e,d)):c.value=e:(Object.defineProperty(a,b,f(void 0)),d.descriptors[b]=void 0)}function D(a,b,d,c,g,e,h,f,l){if(e.isModifying)return!0;
a=new J(c,g,a,d,f,l,a,b,h);c=e.attrListeners;e=e.parentAttrListeners;c[d]&&B(c[d],a);!a.__stopImmediatePropogation__&&c[b]&&B(c[b],a);!a.__stopImmediatePropogation__&&c["*"]&&B(c["*"],a);!a.__stopPropogation__&&e[d]&&C(e[d],a);!a.__stopPropogation__&&e[b]&&C(e[b],a);!a.__stopPropogation__&&e["*"]&&C(e["*"],a);return a.__preventDefault__?!1:!0}function E(a,b,d,c,g,e,h,f){if(e.isModifying)return!0;a=new J(c,g,a,d,h,f,a,b+"update");c=e.attrUpdateListeners;e=e.parentAttrUpdateListeners;c[d]&&B(c[d],a);
!a.__stopImmediatePropogation__&&c[b]&&B(c[b],a);!a.__stopImmediatePropogation__&&c["*"]&&B(c["*"],a);!a.__stopPropogation__&&e[d]&&C(e[d],a);!a.__stopPropogation__&&e[b]&&C(e[b],a);!a.__stopPropogation__&&e["*"]&&C(e["*"],a);return a.__preventDefault__?!1:!0}function K(a){return{value:a,writable:!0,enumerable:!0,configurable:!0}}function f(a){return{writable:!0,value:a,enumerable:!1,configurable:!0}}function S(a){var b=a;return{get:function(){return b},set:function(a){b=a},enumerable:!1,configurable:!0}}
function v(a,b,d,c){d.descriptors[a]={};var g=d,e=g.descriptors[a],h=g.lengthSet,n=A(a),l=E,k=D,m=!1,t,q;e.key=a;e.value=b;e.oldValue=c?b:void 0;return{get:function(){return e.value},set:function(b){t=void 0===b;"object"===typeof b&&b&&"Frytki"!==w(b)&&(b=r(b,g.base,g.scope+(g.scope.length?".":"")+a,this,g.hash));if(g.isModifying&&m)return t?(Object.defineProperty(this,a,f(void 0)),e.value=b,!(n&&h.call(this,p(this),!0))):!!(e.value=b);if(g.isModifying&&!m)return t?(Object.defineProperty(this,a,f(void 0)),
m=!0,e.value=b,!(n&&h.call(this,p(this),!0))):!!(m=!0,e.value=b);q=t?"delete":"set";if(k(this,q,a,b,e.value,g,g.stop)){m||(e.oldValue=e.value);if(t)return Object.defineProperty(this,a,f(void 0)),n&&h.call(this,p(this),!0),g.stop||l(this,q,a,b,e.oldValue,g),g.stop=void 0,m=!1,g=e=this.__frytkiExtensions__.descriptors[a]=void 0,!0;e.value=b;g.stop||l(this,q,a,b,e.oldValue,g)}else if(m&&(e.value=e.oldValue,void 0===e.oldValue))return Object.defineProperty(this,a,f(void 0)),n&&h.call(this,p(this),!0),
g.stop=void 0,m=!1,t&&(g=e=this.__frytkiExtensions__.descriptors[a]=void 0),!0;g.stop=void 0;m=!1},enumerable:!0,configurable:!0}}function H(a,b){return{get:function(){return a[b]},set:function(d){(this.stop?a.stop():a)[b]=d;this.stop=!1},enumerable:!0,configurable:!0}}function T(a){var b=U,d=E,c=D,g,e=a,h=a,f,l;return{set:function(a,n){"string"===typeof a&&(a=parseInt(a,10));g||(g=this.__frytkiExtensions__);h=e;if(n||g.isModifying)return e=a;c(this,"set","length",a,e,g,g.stop)&&(a<e?b.call(this,
a,e-a):a>e&&b.apply(this,[e,0].concat(Array.apply(null,Array(a-e)))),l=this.keys(this,"array"),f=parseInt(l[l.length],10)+1,f!==a&&(a=f),e=a,g.stop||d(this,"set","length",a,h,g));g.stop=void 0},get:function(){return e},enumerable:!1,configurable:!0}}function L(a,b){return!!Object.getOwnPropertyDescriptor(a,b).set}function M(a){return"object"===w.call(this,a)}function N(a){return"array"===w.call(this,a)}function I(a){return!!a.match(V)}function A(a){return"number"===typeof a||(1===a.length||"0"!==
a.charAt(0))&&!isNaN(parseInt(a,10))}function O(a,b){function d(a){var b=parseFloat(a,10),c="true"===a,d=a.indexOf('"'),e=a.lastIndexOf('"');if(isNaN(b)||b.toString().length!==a.length){if(c||"false"===a)return c;a=0===d&&0!==e?a.substring(1,a.length-1):a.substring(1,a.length)}else return b;return a}var c=this.__frytkiExtensions__&&this.__frytkiExtensions__.ref?this:r();a=a.split(/({"|,"(?=(?:[^"]|"[^"]*")*$)|\[(?=(?:[^"]|"[^"]*")*$)|\](?=(?:[^"]|"[^"]*")*$)|":|"}|{(?=(?:[^"]|"[^"]*")*$)|,(?=(?:[^"]|"[^"]*")*$)|}(?=(?:[^"]|"[^"]*")*$))/).filter(Boolean);
var g=[],e="",h=c.__frytkiExtensions__,f=1,l=a.length,k="",m="",t="";for(f;f<l;f++){k=a[f];m=a[f-1];t=a[f+1];var q=g[g.length-1];if('":'===m&&'{"'===k||'":'===m&&"["===k)e+=(e.length?".":"")+q,c.get(q)||(k=b?r(b(u,{},e,c),h.ref,e,c,h.hash):r({},h.ref,e,c,h.hash),Object.defineProperty(c,q,v(q,k,h,!0)),A(q)&&h.lengthSet.call(c,p(c),!0)),c=c[q],h=c.__frytkiExtensions__,g.pop();else if("["===m||","===m&&0!==c.length)if("{"===k||'{"'===k){e+=(0!==e.length?".":"")+h.setIndex;if("object"!==typeof c[h.setIndex])if(c[h.setIndex])c.set(h.setIndex,
b?b(c.length,{},e,c):{});else{var u=h.setIndex;k=b?r(b(u,{},e,c),h.ref,e,c,h.hash):r({},h.ref,e,c,h.hash);Object.defineProperty(c,u,v(u,k,h,!0));h.lengthSet.call(c,p(c),!0)}h.setIndex+=1;c=c[h.setIndex-1];h=c.__frytkiExtensions__}else c[h.setIndex]?c.set(h.setIndex,b?b(c.length,d(k),e,c):d(k)):(u=h.setIndex,k=b?b(u,d(k),e,c):d(k),Object.defineProperty(c,u,v(u,k,h,!0)),h.lengthSet.call(c,p(c),!0)),h.setIndex+=1;else'":'===m?(c[q]?c.set(q,b?b(q,d(k),e,c):d(k)):(u=q,k=b?b(u,d(k),e,c):d(k),Object.defineProperty(c,
u,v(u,k,h,!0))),g.pop()):'{"'===m||","===m&&'":'===t?g[g.length]=k.replace(/"/g,""):"}"!==m&&"]"!==m||void 0===k||(e=-1!==e.indexOf(".")?e.substring(0,e.lastIndexOf(".")-1):"",c=h.immediateParent,h=c.__frytkiExtensions__)}return this}function P(a,b){var d=a.__frytkiExtensions__,c=d.parentTranslatePointers[b],g=d.pointers[c],e=g.parent;g.child&&P(g.child,c);Object.defineProperty(a,c,f(void 0));A(c)&&d.lengthSet.call(a,p(this),!0);e.pointers[b]&&(e.pointers[b].child=void 0);d.pointers[c]=void 0}function W(a,
b,d){b=void 0!==b?Math.max(0,b):0;d=void 0!==d&&d<=this.length?Math.min(this.length,Math.max(0,d)):this.length;var c=this.__frytkiExtensions__,g=b;c.isModifying=!0;for(g;g<d;g++)this.set(g,a);c.isModifying=!1;if("function"!==typeof c.bypass||c.bypass(b,d))for(a=b,a;a<d;a++)z(this,a,c);c.lengthSet.call(this,p(this),!0);return this}function X(a,b,d){var c=this.__frytkiExtensions__,g;c.isModifying=!0;a<this.length&&(g=Y.call(this,a,b,d));c.isModifying=!1;if("function"!==typeof c.bypass||c.bypass(a,a+
(d?d-b:1))){var e=a;a+=d?d-b:1;for(e;e<a;e++)z(this,e,c)}c.lengthSet.call(this,p(this),!0);return g}function r(a,b,d,c,g){var e=a||{};g=g||(Math.random()*Date.now()).toFixed(0);var h=Object.create(r.prototype),f=F(e);b=b||h;var l=c||b;d=d||"";c=0;var k=f.length,m=T(0),t=m.set;Object.defineProperties(h,{__frytkiExtensions__:S(new R(g,h,b,d,l,t)),length:m});if(e&&"object"===typeof e)for(c;c<k;c++)l=f[c],A(l)&&t.call(h,h.length+1,!0),"object"===typeof a[l]?(m=r(a[l],b,d+(d.length?".":"")+l,h,g),Object.defineProperty(h,
l,v(l,m,h.__frytkiExtensions__,!0))):Object.defineProperty(h,l,v(l,e[l],h.__frytkiExtensions__,!0));else"string"===typeof e&&I(e)&&(h=h.parse(e));return h}var Z=["Symbol","constructor","__proto__","stop","length"],G=["Frytki","Object","Array"],V=/(\{.*:.*)|(\{\})|(\[.*,.*)|(\[\])/,Q=Array.prototype.slice,aa=Array.prototype.sort,U=Array.prototype.splice,ba=Array.prototype.reverse,Y=Array.prototype.copyWithin,ca=Object.prototype.toString,w=function(){var a={}.toString;return function(b){return((b||
this)instanceof r?"[object Frytki]":a.call(b||this)).replace(/[\[\]]|(object\s)/g,"")}}(),F=function(){var a=Object.keys;return function(b,d){return a(("object"===typeof b&&b?b:this)||{}).filter(function(a){return-1!==Z.indexOf(a)?!1:d?"object"===d||"o"===d?!isNaN(parseInt(a,10)):A(a):!0})}}();Object.defineProperties(r.prototype,{stop:f(function(){this.__frytkiExtensions__.stop=!0;return this}),typeof:f(w),keys:f(F),isObservable:f(L),isObject:f(M),isArray:f(N),isJSON:f(I),toString:f(ca),addEventListener:f(function(a,
b,d,c){var g=x(this,a),e=y(a).replace("update",""),h=g.__frytkiExtensions__,f=(a=d||"string"===typeof a&&a.lastIndexOf("update")===a.length-6?"update":"")?(c?"parentA":"a")+"ttrUpdateListeners":(c?"parentA":"a")+"ttrListeners";d=Object.keys(g);var l=d.length,k=0;h[f][e]||(h[f][e]=[]);h[f][e].push(c?{func:b,parent:h.immediateParent}:b);for(k;k<l;k++)c=g[d[k]],"object"===typeof c&&c.addEventListener(e,b,a,!0)}),removeEventListener:f(function(a,b,d,c){var g=x(this,a),e=y(a).replace("update",""),h=g.__frytkiExtensions__;
b=b.toString();a=d||"string"===typeof a&&a.lastIndexOf("update")===a.length-6?"update":"";h=h[a?(c?"parentA":"a")+"ttrUpdateListeners":(c?"parentA":"a")+"ttrListeners"][e];d=Object.keys(g);var f=h.length,l=d.length,k=0;for(k;k<f;k++){var m=c?h[k].func:h[k];if(m.toString()===b){h.splice(k,1);break}}for(k=0;k<l;k++)m=g[d[k]],"object"===typeof m&&m.removeEventListener(e,b,a,!0)}),valueOf:f(function(){var a={},b=F(this),d=b.length,c=0;for(c;c<d;c++)a[b[c]]=this[b[c]];return a}),toJSON:f(function(){function a(e,
h){var f=Object.keys(e),l=f.length,k=0;for(k;k<l;k++){var m=f[k];-1!==b.indexOf(w(e[m]))?(g=d.indexOf(e[m]),-1===g?(d.push(e[m]),c.push(m),h[m]=a(e[m],{})):h[m]="[Circular "+c[g]+" Object]"):h[m]=e[m]}return h}var b=G,d=[],c=[],g=0;return a(this,{})}),parse:f(O),get:f(function(a){return x(this,a)[y(a)]}),set:f(function(a,b,d){var c=x(this,a),g=y(a),e=c.__frytkiExtensions__,h=e.isModifying;"object"===typeof b&&b&&"Frytki"!==w(b)&&(b=r(b,e.base,e.scope+(e.scope.length?".":"")+g,c,e.hash));!c[a]||d?
h?Object.defineProperty(c,g,v(g,b,e)):D(this,"create",g,b,void 0,e,e.stop)&&(Object.defineProperty(c,g,v(g,b,e)),A(g)&&e.lengthSet.call(this,p(this),!0),e.stop||E(this,"create",g,b,void 0,e)):this[g]=b;return this}),setPointer:f(function(a,b,d){var c=x(this,a);a=y(a);var g=c.__frytkiExtensions__,e=!!b.__frytkiExtensions__,h=b.__frytkiExtensions__;D(c,c[a]?"set":"create",a,d?b[d]:b,c[a],g,g.stop)&&(Object.defineProperty(c,a,d?H(b,d):v(a,b,g)),A(a)&&g.lengthSet.call(c,p(this),!0),g.stop||E(c,c[a]?"set":
"create",a,d?b[d]:b,c[a],g),e||(b.__frytkiExtensions__={},b.__frytkiExtensions__.pointers={},b.__frytkiExtensions__.parentTranslatePointers={},h=b.__frytkiExtensions__),h.pointers[d]||(b.__frytkiExtensions__.pointers[d]={key:void 0,child:void 0,original:b,parent:void 0}),h.pointers[d].child=this,g.pointers[a]={key:d,child:void 0,original:h.pointers[d].original,parent:b},g.parentTranslatePointers[d]=a);return this}),del:f(function(a){var b=x(this,a);a=y(a);b[a]=void 0;return this}),remove:f(function(a){return this.del(a)}),
create:f(function(a,b){this.set(a,b,!0);return this}),add:f(function(a,b){this.set(a,b,!0);return this}),addPointer:f(function(){return this.setPointer.apply(this,arguments)}),removePointer:f(function(a){var b=x(this,a);a=y(a);var d=b.__frytkiExtensions__,c=d.pointers[a],g=c.parent.__frytkiExtensions__;D(b,"delete",a,c.key?c.parent[c.key]:c.parent,b[a],d,d.stop)&&(Object.defineProperty(b,a,f(void 0)),A(a)&&d.lengthSet.call(b,p(this),!0),d.stop||E(b,"delete",a,c.key?c.parent[c.key]:c.parent,b[a],d),
d.pointers[a].child&&P(d.pointers[a].child,a),g.pointers[c.key].child=void 0,d.pointers[a]=void 0);return this}),move:f(function(a,b){var d=x(a,b),c=y(b);this.set(b,d[c]);a.del&&a.del(b);d[c]=void 0;return this}),copy:f(function(a,b){a=x(a,b);var d=y(b);this.set(b,a[d]);return this}),merge:f(function(a){function b(a,f){var h=Object.keys(a);var k=h.length;var m=0;for(m;m<k;m++){var n=h[m];-1!==d.indexOf(w(a[n]))?(e=c.indexOf(a[n]),void 0!==e||f[n]?void 0!==e&&f.set(n,g[e]):(f.set(n,{}),c.push(a[n]),
g.push(f[n]),b(a[n],f[n]))):f.set(n,a[n])}}var d=G,c=[],g=[],e;b(a,this);c=[];g=[];return this}),findKey:f(function(a){function b(e){var f=Object.keys(e),n=0,l=f.length;for(n;n<l;n++){var k=f[n];if(k===a)return e[k];if(-1!==d.indexOf(w(e[k]))&&(g=c.indexOf(e[k]),void 0===g&&(c.push(e[k]),k=b(e[k]))))return k}}var d=G,c=[],g;return b(this)}),findLayer:f(function(a){function b(e){var f=Object.keys(e),n=0,l=f.length;for(n;n<l;n++){var k=f[n];if(k===a)return e;if(-1!==d.indexOf(w(e[k]))&&(g=c.indexOf(e[k]),
void 0===g&&(c.push(e[k]),k=b(e[k]))))return k}}var d=G,c=[],g;return b(this)}),concat:f(Array.prototype.concat),includes:f(Array.prototype.includes),indexOf:f(Array.prototype.indexOf),join:f(Array.prototype.join),lastIndexOf:f(Array.prototype.lastIndexOf),slice:f(Array.prototype.slice),entries:f(Array.prototype.entries),every:f(Array.prototype.every),filter:f(Array.prototype.filter),find:f(Array.prototype.find),findIndex:f(Array.prototype.findIndex),forEach:f(Array.prototype.forEach),map:f(Array.prototype.map),
reduce:f(Array.prototype.reduce),reduceRight:f(Array.prototype.reduceRight),some:f(Array.prototype.some),values:f(Array.prototype.values),sort:f(function(a){var b=this.__frytkiExtensions__;b.isModifying=!0;a=aa.call(this,a);b.isModifying=!1;if("function"!==typeof b.bypass||b.bypass()){var d=0,c=this.length;for(d;d<c;d++)z(this,d,b)}return a}),splice:f(function(a,b){var d=this.__frytkiExtensions__,c=Q.apply(arguments).slice(2),f=c.length,e=0,h=[],n=[];d.isModifying=!0;if(0!==b&&void 0!==this[a-1+b])for(e;e<
b;e++){h.push(this[a]);var l=a;var k=this.length-1;for(l;l<k;l++)this[l]=this[l+1];n.push(this.length-(e+1))}if(0!==f)for(e=0,e;e<f;e++){k=a+e;l=this.length-n.length;for(l;l>k;l--)-1!==n.indexOf(l)&&n.splice(n.indexOf(l),1),this.set(l,this[l-1]);this.set(k,c[e])}if(n.length)for(e=0,k=n.length,e;e<k;e++)this.del(n[e]);d.isModifying=!1;e=a;k=f&&f===b?a+f:this.length+Math.max(f-b,0);if("function"!==typeof d.bypass||d.bypass(e,k))for(e;e<k;e++)z(this,e,d);d.lengthSet.call(this,p(this),!0);return h}),
shift:f(function(){var a=this.__frytkiExtensions__,b=this.length,d=0,c=this[0];a.isModifying=!0;for(d;d<b;d++)this[d]=this[d+1];a.isModifying=!1;b=this.length+1;if("function"!==typeof a.bypass||a.bypass(0,b))for(d=0,d;d<b;d++)z(this,d,a);a.lengthSet.call(this,p(this),!0);return c}),unshift:f(function(){var a=this.__frytkiExtensions__,b=Q.call(arguments),d=b.length,c=this.length-1+d;a.isModifying=!0;for(c;-1!==c;c--)c<d?this.set(c,b[c]):this.set(c,this[c-b.length]);a.isModifying=!1;if("function"!==
typeof a.bypass||a.bypass(0,this.length+d))for(b=0,d=this.length+d,b;b<d;b++)z(this,b,a);a.lengthSet.call(this,p(this),!0);return this.length}),push:f(function(a){var b=this.__frytkiExtensions__;b.isModifying=!0;this.set(this.length,a);b.isModifying=!1;("function"!==typeof b.bypass||b.bypass(this.length,this.length+1))&&z(this,this.length,b);b.lengthSet.call(this,p(this),!0);return this.length}),pop:f(function(){var a=this.__frytkiExtensions__;a.isModifying=!0;var b=this[this.length-1];this[this.length-
1]=void 0;a.isModifying=!1;("function"!==typeof a.bypass||a.bypass(this.length,this.length+1))&&z(this,this.length,a);a.lengthSet.call(this,p(this),!0);return b}),reverse:f(function(){var a=this.__frytkiExtensions__;a.isModifying=!0;var b=ba.call(this);a.isModifying=!1;if("function"!==typeof a.bypass||a.bypass()){var d=0,c=this.length;for(d;d<c;d++)z(this,d,a)}return b}),fill:f(Array.prototype.fill?W:void 0),copyWithin:f(Array.prototype.copyWithin?X:void 0)});Object.defineProperties(r,{typeof:f(w),
keys:f(F),isObservable:f(L),isObject:f(M),isArray:f(N),isJSON:f(I),parse:f(O)});"function"===typeof define&&define.amd&&define("frytki",function(){return r});"object"===typeof module&&"object"===typeof module.exports&&(module.exports.frytki=r);return r}();