Comparing version 5.0.2 to 5.0.3
@@ -1,1 +0,1 @@ | ||
!function(e){function r(t){if(n[t])return n[t].exports;var i=n[t]={exports:{},id:t,loaded:!1};return e[t].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var n={};return r.m=e,r.c=n,r.p="",r(0)}([function(e,r,n){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=n(1),o=t(i);!function(){(0,o["default"])()}(),r.createCache=o["default"]},function(e,r,n){"use strict";function t(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r["default"]=e,r}function i(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var r=0,n=Array(e.length);r<e.length;r++)n[r]=e[r];return n}return Array.from(e)}function u(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],r=arguments.length<=1||void 0===arguments[1]?"One":arguments[1];return window?(void 0===window[r]&&(window[r]=f(e)),window[r]):f(e)}function f(){function e(e){return"undefined"==typeof e?!1:void 0!=E[e]}function r(r){if("undefined"==typeof r)throw new ReferenceError("Cannot create thread. Missing thread id");if(e(r))return E[r];var t=n(r);return E[r]=t,t}function n(e){var r=u();return r.id=e,r.current=-1,r.nodes=[],r}function t(){return E[p]}function i(){var e=u();return e.id=g,g+=1,O.set(e.id,e),e}function u(){var e={};return Object.defineProperty(e,"length",{value:0,enumerable:!1,writable:!0}),Object.defineProperty(e,"addThread",{value:function(r,n){return e[r]?!1:(e[r]=n,e.length+=1,!0)},enumerable:!1,writable:!1}),Object.defineProperty(e,"removeThread",{value:function(r){return"undefined"!=typeof e[r]?(e[r]=void 0,e.length-=1,!0):!1},enumerable:!1,writable:!1}),e}function f(e,r){for(var n,t,i=0,o=e.length-1;o>=i;)if(n=(i+o)/2|0,t=e[n],r>t)i=n+1;else{if(!(t>r))return n;o=n-1}return-1}function c(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0],r=E[e],n=r?r.nodes[r.current]:void 0;return n>=0?s(n):void 0}function s(e){return O.get(e)}var v=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],p="main",g=0,O=new Map,E=u(),F=[],y=u(),R=u(),T=function(){y=u(),E=u(),O.clear(),r(p),g=0};T();for(var _=function(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0],r=E[e];return r&&e!==p?r.current+1:-1},b=function(e){if(Ie()>0)throw new Error("You may only configure an empty cache. Please clear the cache first and then configure.");d.config(e)},m=function(e){var r=arguments.length<=1||void 0===arguments[1]?p:arguments[1];arguments.length<=2||void 0===arguments[2]?!0:arguments[2];if(r=j(r,!0),r.indexOf(p)<0&&r.unshift(p),(0,a.isArray)(e)||(0,a.isObject)(e)){var n=new Map,t=new Map;n.set(h.UPDATED_KEY,!1),V(e,n,null,t),L(n);var i=n.get(h.UPDATED_KEY);n["delete"](h.UPDATED_KEY);var u=!1;return n.size>0&&i&&(Ce(r),Fe([].concat(o(n.values())),r,t),Ze(),u=!0),Se(u)}return e},j=function(e){var r=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],n=void 0,t=r===!0;if((0,a.isArray)(e))t&&e.forEach(function(e){M(e)}),n=e;else if("string"==typeof e)t&&M(e),n=[e];else{if("number"!=typeof e)throw new TypeError("Thread id must be one of 'string', 'number' or an array of strings or numbers");e=String(e),t&&M(e),n=[e]}return n},M=function(n){e(n)||r(n)},w=function(e){var r=arguments.length<=1||void 0===arguments[1]?p:arguments[1];if("undefined"==typeof e)throw new TypeError("Cannot close thread. Missing thread id");return S(e,!0,r)},N=function(e){var r=arguments.length<=1||void 0===arguments[1]?p:arguments[1];if("undefined"==typeof e)throw new TypeError("Cannot merge thread. Missing threadId");return S(e,!1,r)},A=function(e){if(e===p)throw new TypeError("You may not cancel the main thread. Pfft.");if("undefined"==typeof e)return Se(!1);var r=E[e];if(!r)return Se(!1);var n=r.nodes,t=[];return n.forEach(function(r){var n=O.get(r);n&&(n.threads.removeThread(e),n.threads.length<=1&&t.push(r))}),P(t),E.removeThread(e),Se(!0)},S=function(e){var r=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?p:arguments[2];if("undefined"!=typeof e){if(e===p)throw new TypeError("You may not remove the main thread");var t=E[e];if(t){var i=xe(e)-1,o=t.current;if(o>=0){var u=function(){var u=[];return r===!0?t.nodes=t.nodes.reduce(function(r,t,f){var a=s(t);return 0==f||f==o?(a.threads.removeThread(e),Qe(a,n),r.push(t)):i>=f&&(a.threads.removeThread(e),a.threads.length<=1&&u.push(t)),r},[]):t.nodes.forEach(function(r,t){var i=O.get(r);i&&(i.threads.removeThread(e),o>=t?Qe(i,n):i.threads.length<=1&&u.push(r))}),P(u),E.removeThread(e),{v:Se(!0)}}();if("object"==typeof u)return u.v}}}},P=function(e){var r=E[p];e.forEach(function(e){var n=f(r.nodes,e);r.nodes.splice(n,1),O["delete"](e),r.current-=1})},z=function(e){var r=E[e];if(!r)return!1;var n=c(p);return r&&I(e,n)},Y=function(){var e=[];for(var r in E)E.hasOwnProperty(r)&&E[r]&&e.push(r);return e},I=function(e,r){return r.threads&&void 0!==r.threads[e]},x=function(e){function r(e,r){if((0,a.hasUid)(e)){var t=e[d.prop.uidName],i=y[t];!n&&i||!n&&k(t)||(K(t)||(y.length+=1),y[t]=e,r.push(t))}}var n=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],t=[];(0,a.isArray)(e)?e.forEach(function(e){r(e,t)}):(0,a.isObject)(e)&&r(e,t);var i=t.length>0;return i&&Ze(t),t.length},U=function(e){var r=Re(e);if(r)return y[r]?(y[r]=void 0,y.length>0&&(y.length-=1),!0):!1},C=function(e){var r=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(y.length>0){var n=[];for(var t in y)y.hasOwnProperty(t)&&n.push(y[t]);var i=m(n,e,r);return i.success===!0&&(y=u()),i}return Se(!1)},D=function(e){e&&(0,a.hasUid)(e)&&(R[e[d.prop.uidName]]=e)},K=function(e){var r=Re(e);if(r)return y[r]},J=function(){return Object.keys(y).length>0},q=function(){return Object.keys(R).length>0},Q=function(){return J()||q()},k=function(e){var r=arguments.length<=1||void 0===arguments[1]?p:arguments[1];if(!e)throw new TypeError("Cache-uid get(): requires a uid to retrieve an item from the cache.");return(0,a.isArray)(e)?e.map(function(e){return ye(e,r)}).filter(function(e){return null!==e&&void 0!==e}):ye(e,r)},H=function(e){var r=G(e);if(0==r.length)return!1;var n=Ee(),t=r.some(function(e){return n&&n.has(String(e))});if(!t)return!1;var i=new Map;n.forEach(function(e,r){i.set(r,e)}),Ce();var o=new Map,u=new Map;return r.forEach(function(e){X(e,o,u),u.set(e,null),$(e,o)}),o.forEach(function(e,r){i.set(r,e)}),u.forEach(function(e,r){i["delete"](r)}),Je(i,p),Ze(),!0},G=function(e){var r=[];if((0,a.isArray)(e))e.forEach(function(e){(0,a.hasUid)(e)?r.push(String(e[d.prop.uidName])):r.push(String(e))});else{var n=e;if((0,a.isObject)(e)&&(n=e[d.prop.uidName]),void 0===n)return!1;r.push(String(n))}return r},L=function(e){var r=new Map;e.forEach(function(r,n){if(n!==h.UPDATED_KEY){var t=r[h.REF_FROM];for(var i in t)if(t.hasOwnProperty(i)){var o=t[i],u=e.get(i);if(u||(u=ke(i)),u&&o.length>0){var f=o[0],c=l["default"].get(u[h.ENTITY],f),s=!1;s=(0,a.isArray)(c)?!B(r[h.ENTITY],c):c&&c!==r[h.ENTITY],s===!0&&(u=me(u[h.ENTITY],e),u[h.ENTITY]=(0,a.deepClone)(u[h.ENTITY],r[h.ENTITY],!0,!0))}}}}),r.forEach(function(r,n){e.set(n,r)})},B=function nr(e,r){var n=!1;return r.forEach(function(r){(r===e||"string"==typeof e&&String(r[d.prop.uidName])===e)&&(n=!0),(0,a.isArray)(r)&&(n=nr(e,r))}),n},Z=function tr(e,r){if("string"!=typeof e)return!1;var n=r.some(function(r){return(0,a.isArray)(r)&&tr(r),String(r[d.prop.uidName])===e});if(n===!0){var t=r.indexOf(e);r.splice(t,1)}},V=function(e,r,n,t,i){(0,a.hasUid)(e)?W(e,r,n,t,i):((0,a.isArray)(e)?pe(e,r,n,t,i):de(e,r,n,t,i),Object.freeze(e))},W=function(e,r,n,t,i){var o=String(e[d.prop.uidName]);ve(e)!==!0&&(r.has(o)?de(e,r,n,t):(me(e,r),n=String(o),de(e,r,n,t),Object.isFrozen(e)||Object.freeze(e)),re(o,r,t))},X=function ir(e,r,n){var t=ke(e);if(t){var i=t[h.REF_TO];for(var o in i)if(i.hasOwnProperty(o)){var u=ee(o,r);u&&(ae(u,e),0===u[h.REF_FROM].length?(ir(o,r,n),n.set(o,u)):r.set(o,u))}}},$=function(e,r){var n=ee(e,r);if(n){var t=n[h.REF_FROM];for(var i in t)if(t.hasOwnProperty(i)){var o=ee(i,r);if(o){var u=ce(o,e);u===!0&&r.set(i,o)}}}},ee=function(e,r){if(e){e=String(e);var n=r.get(e);return n||(n=ke(e)),Object.isFrozen(n)&&(n=Me(n)),n}},re=function(e,r,n){var t=ee(e,r);if(t){var i=t[h.REF_TO],o=function(o){if(i.hasOwnProperty(o)){var u=i[o],f=u.map(function(i){var u=!1,f=l["default"].get(t[h.ENTITY],i);return u=(0,a.isArray)(f)?B(String(o),f):!!f,u!==!1?i:void te(e,o,i,r,n)}).filter(function(e){return null!==e&&void 0!==e});Object.isFrozen(t[h.REF_TO])&&ie(t,h.REF_TO),f.length>0?t[h.REF_TO][o]=f:(t[h.REF_TO][o]=void 0,delete t[h.REF_TO][o])}};for(var u in i)o(u)}},ne=function(e){Object.freeze(e),Object.freeze(e[h.ENTITY]),Object.freeze(e[h.REF_TO]),Object.freeze(e[h.REF_FROM])},te=function(e,r,n,t,i){var o=ee(r,t);o&&(o=Object.assign({},o),ie(o,h.REF_FROM),o[h.REF_FROM].hasOwnProperty(e)&&(fe(o,e,n),0===o[h.REF_FROM].length?(i.set(r,o),t["delete"](r)):(t.set(r,o),i["delete"](r))))},ie=function(e,r){var n=e[r].length;e[r]=Object.assign(u(),e[r]),e[r].length=n},oe=function(e,r,n){Object.isFrozen(e)&&(e=Me(e));var t=e[h.REF_TO];e[h.REF_TO][r]||(Object.isFrozen(e[h.REF_TO])&&(e[h.REF_TO]=Object.assign(u(),e[h.REF_TO]),t=e[h.REF_TO]),e[h.REF_TO][r]=[],e[h.REF_TO].length+=1);var i=t[r];return Object.isFrozen(i)&&(t[r]=i.slice(),i=t[r]),i.indexOf(n)<0&&i.push(n),e},ue=function(e,r,n){Object.isFrozen(e)&&(e=Me(e));var t=e[h.REF_FROM];e[h.REF_FROM][r]||(Object.isFrozen(e[h.REF_FROM])&&(e[h.REF_FROM]=Object.assign(u(),e[h.REF_FROM]),t=e[h.REF_FROM]),e[h.REF_FROM][r]=[],e[h.REF_FROM].length+=1);var i=t[r];return Object.isFrozen(i)&&(t[r]=i.slice(),i=t[r]),i.indexOf(n)<0&&i.push(n),e},fe=function(e,r,n){var t=e[h.REF_FROM][r];if(t){var i=t.indexOf(n);0>i||(t=t.slice(),t.splice(i,1),e[h.REF_FROM][r]=t,0==t.length&&(e[h.REF_FROM][r]=void 0,delete e[h.REF_FROM][r],e[h.REF_FROM].length-=1))}},ae=function(e,r){var n=e[h.REF_FROM][r];n&&(ie(e,h.REF_FROM),e[h.REF_FROM][r]=void 0,delete e[h.REF_FROM][r],e[h.REF_FROM].length>0&&(e[h.REF_FROM].length-=1))},ce=function(e,r){var n=e[h.REF_TO][r];if(!n)return!1;var t=e[h.ENTITY];Object.isFrozen(t)&&(t=Te(t[d.prop.uidName]),e[h.ENTITY]=t);var i=e[h.REF_TO][r];return i.forEach(function(e){var n=l["default"].get(t,e);(0,a.isArray)(n)?Z(r,n):l["default"].del(t,e)}),Object.isFrozen(t)||Object.freeze(t),e[h.ENTITY]=t,ie(e,h.REF_TO),e[h.REF_TO][r]=void 0,delete e[h.REF_TO][r],e[h.REF_TO].length>0&&(e[h.REF_TO].length-=1),!0},se=function(e){y[e]&&(y[e]=void 0,y.length>0&&(y.length-=1))},de=function(e,r,n,t){var i=arguments.length<=4||void 0===arguments[4]?"":arguments[4];for(var o in e){if(e.hasOwnProperty(o)){i=Oe(i,o);var u=e[o];(0,a.isArray)(u)?pe(u,r,n,t,i):(0,a.isObject)(u)&&le(u,r,n,t,i),Object.freeze(u)}i=""}},ve=function(e){var r=arguments.length<=1||void 0===arguments[1]?p:arguments[1],n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2];if(!(0,a.hasUid)(e))return!1;var t=e[d.prop.uidName],i=ke(t,r);return n===!0?i&&i[h.ENTITY]===e:!!i},le=function(e,r,n,t){var i=arguments.length<=4||void 0===arguments[4]?"":arguments[4];if((0,a.hasUid)(e)){var o=me(e,r);if(o){he(o,n,i,r);var u=ve(e);if(u===!0)return;o[h.ENTITY]=e,n=String(e[d.prop.uidName]),V(e,r,n,t)}}else de(e,r,n,t,i);Object.freeze(e)},he=function(e,r,n,t){var i=ee(r,t);i&&n&&""!==n&&ge(i,e,n)},pe=function or(e,r,n,t){var i=arguments.length<=4||void 0===arguments[4]?"":arguments[4];e.forEach(function(e){(0,a.isArray)(e)?or(e,r,n,t,i):(0,a.isObject)(e)&&le(e,r,n,t,i)}),Object.freeze(e)},ge=function(e,r,n){if(!e)throw new ReferenceError("Cannot assign reference. Missing parent item.");if(!r)throw new ReferenceError("Cannot assign reference. Missing reference item.");if(!n||""===n)throw new TypeError("Cannot assign reference. Missing property name. prop: "+n);var t=e[h.ENTITY][d.prop.uidName],i=r[h.ENTITY][d.prop.uidName];oe(e,i,n),ue(r,t,n)},Oe=function(e,r){return e=""===e?r:e+"."+r},Ee=function(){var e=c(p);return e?e.items:new Map},Fe=function(e,r,n){var t=new Map,i=Ee();i.forEach(function(e,r){t.set(r,e)}),e.forEach(function(e){var r=e[h.ENTITY][d.prop.uidName];if(void 0!==r){var n=ke(r);if(n){var i=n[h.REF_TO],o=e[h.REF_TO];for(var u in i)if(i.hasOwnProperty(u)){var f=i[u],a=0;if(o.hasOwnProperty(u)&&(a=o[u]),f>0&&0==a){var c=t.get(u);Object.isFrozen(c)&&(c=je(c[h.ENTITY],c[h.REF_FROM],c[h.REF_TO]),t.set(u,c)),c[h.REF_FROM]["delete"](String(r)),0==c[h.REF_FROM].size&&t["delete"](u)}}}ne(e),t.set(String(r),e)}}),n.size>0&&n.forEach(function(e,r){t["delete"](String(r))}),Je(t,r)},ye=function(e){var r=arguments.length<=1||void 0===arguments[1]?p:arguments[1];if(e){var n=Re(e);if(n){var t=ke(n,r);if(void 0!==t)return t[h.ENTITY];var i=y[n];if(i)return i}}},Re=function(e){return"string"==typeof e?e:"number"==typeof e?String(e):(0,a.isObject)(e)&&(0,a.hasUid)(e)?e[d.prop.uidName]:void 0},Te=function(e){return(0,a.isArray)(e)?e.map(function(e){return be(e)}).filter(function(e){return null!==e&void 0!==e}):be(e)},_e=function(r){return"undefined"==typeof r&&(r=p),e(r)?E[r].current:-1},be=function(e){if(e){var r=Re(e);if(r){if(K(e))return y[r];var n=k(r);if(n)return(0,a.deepClone)(n,void 0,!1)}}},me=function(e,r){if(void 0!==e){var n=String(e[d.prop.uidName]),t=r.get(n);if(t)return t;t={};var i=ke(n);return t[h.ENTITY]=e,void 0!==i?(t=Object.assign(t,i),t[h.ENTITY]=e,t[h.REF_FROM]=Object.assign(u(),i[h.REF_FROM]),t[h.REF_FROM].length=i[h.REF_FROM].length,t[h.REF_TO]=Object.assign(u(),i[h.REF_TO]),t[h.REF_TO].length=i[h.REF_TO].length):(t[h.REF_FROM]=u(),t[h.REF_TO]=u()),r.set(n,t),r.set(h.UPDATED_KEY,!0),se(n),t}},je=function(e,r,n){var t={};t[h.ENTITY]=e;var i=r;void 0===i&&(i=u()),t[h.REF_FROM]=i;var o=n;return void 0===o&&(o=u()),t[h.REF_TO]=o,t},Me=function(e){var r=Object.assign({},e);return ie(r,h.REF_FROM),ie(r,h.REF_TO),r},we=function(e){return(0,a.hasUid)(e)?"undefined"!=typeof ke(e[d.prop.uidName]):!1},Ne=function(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0],r=E[e],n=!1;return r&&Ye(e)&&(r.current-=1,n=!0),Se(n,e)},Ae=function(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0],r=E[e],n=!1;return r&&ze(e)&&(r.current+=1,n=!0),Se(n,e)},Se=function(e,r){if(r&&"string"!=typeof r&&"number"!=typeof r)throw new TypeError("Get history state errror: The thread id must be a string or a number: "+r+":"+typeof r);var n={threads:{}};n.success=e;var t=void 0;return t=void 0===r||r===p?Y():[p,r],t.forEach(function(e){Pe(n,e)}),n},Pe=function(e,r){if(E[r]){var n=_e(r),t=xe(r);e.threads[r]={currentIndex:n,length:t,hasPrev:n>0,hasNext:t-1>n}}},ze=function(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0],r=E[e];return r?r.current<r.nodes.length-1:!1},Ye=function(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0],r=E[e];return r?r.current>0:!1},Ie=function(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0],r=E[e];if(r){var n=c(e);return n?n.items.size:0}return 0},xe=function(){var r=arguments.length<=0||void 0===arguments[0]?p:arguments[0];return e(r)?E[r].nodes.length:0},Ue=function(){return{queue:y.length}},Ce=function(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0],r=j(e,!1);r.forEach(function(e){De(e)})},De=function(){var e=arguments.length<=0||void 0===arguments[0]?p:arguments[0];if(ze(e)){var r=E[e];if(r)if(e===p){if(r.current<r.nodes.length-1){var n=r.nodes.slice(r.current+1,r.nodes.length);r.nodes=r.nodes.slice(0,r.current+1),r.current=r.nodes.length-1,Ke(n)}}else!function(){var n=[],t=r.nodes.length;r.nodes=r.nodes.filter(function(i,o){if(o>r.current&&t>o){var u=O.get(i);return u.threads.removeThread(e),u.threads.length<=1&&n.push(i),!1}return!0}),P(n)}()}},Ke=function(e){e.forEach(function(e){var r=O.get(e);if(r){var n=r.threads;for(var t in n)if(n.hasOwnProperty(t)){var i=n[t];i>=0&&console.log("TRUNCATE AFTER "+i+" threadId"+t)}}O["delete"](e)})},Je=function(e,r){null!==e&&!function(){Object.freeze(e);var n=i();if(n.items=e,"undefined"!=typeof r){void 0===n.threads&&(n.threads=u());var t=qe(r);t.forEach(function(e){Qe(n,e)})}}()},qe=function(e){var r=void 0;return"string"==typeof e?r=[e]:(0,a.isArray)(e)&&(r=e),r.indexOf(p)<0&&r.unshift(p),r},Qe=function(e,n){if("undefined"!=typeof n&&void 0!==e){var t=E[n];t||(t=r(n)),e.threads.addThread(n,_(n))&&(t.nodes.push(e.id),t.current+=1)}},ke=function(e){var r=arguments.length<=1||void 0===arguments[1]?p:arguments[1],n=c(r);return n?n.items.get(String(e)):void 0},He=function(){var e="",r=0,n=t(),i=n.current;n.nodes.map(function(n){var t="",o=O.get(n);o.threads&&(t=JSON.stringify(o.threads));var u=r+":"+t+"\n["+Ge(o.items)+"],\n\n";r===i&&(u="-> "+u),e+=u,r++}),e=e.substring(0,e.length-2),r=0,console.log("\n------ One -------\nSTACK:\n"+e+"\n\nCONFIG:"+JSON.stringify(d,null,2)+"\n\nQUEUE:"+JSON.stringify(y,null,2)+"\n\nTHREADS:"+JSON.stringify(E,null,2)+"\n\nREPO SIZE:"+O.size+"\n===================\n")},Ge=function(e){var r="",n=[].concat(o(e.values()));return n.map(function(e){var n=void 0;try{n=JSON.stringify(e,null,2)+",\n"}catch(t){return void console.log("CYCLICAL STRUCTURE - to fix: "+t.message)}n.indexOf(h.REF_FROM)>=0&&e[h.REF_FROM]&&(n=n.replace('"'+h.REF_FROM+'": {}','"'+h.REF_FROM+'": '+JSON.stringify([].concat(o(e[h.REF_FROM]))))),n.indexOf(h.REF_TO)>=0&&e[h.REF_TO]&&(n=n.replace('"'+h.REF_TO+'": {}','"'+h.REF_TO+'": '+JSON.stringify(e[h.REF_TO]))),r+=n}),r=""===r?"{}":r.substring(0,r.length-2)},Le=function(e){if(!(0,a.hasUid)(e))return!0;var r=e[d.prop.uidName],n=k(r);return n?n!==e:!0},Be=function(e){F.push(e);var r=!0;return function(){if(r){r=!1;var n=F.indexOf(e);F.splice(n,1)}}},Ze=function(e){F.slice().forEach(function(r){r(e)})},Ve=[],We=0;256>We;We++)Ve[We]=(16>We?"0":"")+We.toString(16);var Xe=function(){var e=4294967296*Math.random()|0,r=4294967296*Math.random()|0,n=4294967296*Math.random()|0,t=4294967296*Math.random()|0;return Ve[255&e]+Ve[e>>8&255]+Ve[e>>16&255]+Ve[e>>24&255]+"-"+Ve[255&r]+Ve[r>>8&255]+"-"+Ve[r>>16&15|64]+Ve[r>>24&255]+"-"+Ve[63&n|128]+Ve[n>>8&255]+"-"+Ve[n>>16&255]+Ve[n>>24&255]+Ve[255&t]+Ve[t>>8&255]+Ve[t>>16&255]+Ve[t>>24&255]},$e=function(e){var r=ke(e);return r[h.REF_FROM]},er=function(e){var r=ke(e);return r[h.REF_TO]},rr={put:m,get:k,getEdit:Te,evict:H,reset:T,queue:x,unQueue:U,queueEvict:D,getQueued:K,commit:C,closeThread:w,mergeThread:N,cutThread:A,hasThread:e,onThread:z,listThreads:Y,undo:Ne,redo:Ae,getHistoryState:Se,getCurrentIndex:_e,isDirty:Le,createUid:Xe,contains:we,config:b,subscribe:Be};return v===!0&&(rr.getCurrentNode=c,rr.hasQueue=Q,rr.refFrom=$e,rr.refTo=er,rr.size=Ie,rr.length=xe,rr.pending=Ue,rr.print=He),rr}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=u;var a=n(2),c=n(4),s=(i(c),n(3)),d=t(s),v=n(5),l=i(v),h=n(6);e.exports=r["default"]},function(e,r,n){"use strict";function t(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r["default"]=e,r}function i(e){if(Array.isArray(e)){for(var r=0,n=Array(e.length);r<e.length;r++)n[r]=e[r];return n}return Array.from(e)}function o(e,r){var n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2],t=arguments.length<=3||void 0===arguments[3]?!1:arguments[3];if(!e||!c(e)&&!s(e))return e;if(n&&r&&!Object.isFrozen(r)&&Object.freeze(r),r&&f(e)&&e[p.prop.uidName]===r[p.prop.uidName])return r;var i,a=Object.assign({},e);for(i in a)if(a.hasOwnProperty(i)){var d=a[i];if(d)if(s(d))a[i]=u(d,r,t);else if(v(d)){var l=new Date(d.getTime());n&&Object.freeze(l),a[i]=l}else c(d)&&(f(d)?(a[i]=d,r&&f(r)&&d!==r&&d.uid===r.uid&&d!==r&&(a[i]=r)):a[i]=o(d,r,n,t))}return n&&!Object.isFrozen(a)&&Object.freeze(a),a}function u(e,r,n){return e.map(function(e){return s(e)?u(e,r,n):c(e)?f(e)&&n===!1?e:o(e,r,!0,n):e})}function f(e){if(!e)return!1;if(!c(e))return!1;if("undefined"==typeof e[p.prop.uidName])return!1;var r=e[p.prop.uidName];return 0!==r.length}function a(e){var r=e||new Set;return new Set([].concat(i(r)))}function c(e){return"[object Array]"===Object.prototype.toString.call(e)?!1:null!==e&&"object"==typeof e}function s(e){return e&&null!==e?Array.isArray(e)||e&&"object"==typeof e&&"number"==typeof e.length&&"function"==typeof e.splice&&!e.propertyIsEnumerable("length"):!1}function d(e){return Object.prototype.toString.call(e)}function v(e){return c(e)&&"[object Date]"===d(e)}function l(e){return c(e)&&"[object RegExp]"===d(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.deepClone=o,r.hasUid=f,r.cloneSet=a,r.isObject=c,r.isArray=s,r.isDate=v,r.isRegExp=l;var h=n(3),p=t(h)},function(e,r){"use strict";function n(e){for(var r in t)t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&(t[r]=e[r])}Object.defineProperty(r,"__esModule",{value:!0}),r.config=n;var t={uidName:"uid",maxHistoryStates:1e3};r.prop=t},function(e,r){"use strict";function n(e){return e?(Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(r){!e.hasOwnProperty(r)||null===e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||Object.isFrozen(e[r])||n(e[r])}),e):void 0}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n,e.exports=r["default"]},function(e,r,n){var t,i,o;!function(n,u){"use strict";"object"==typeof e&&"object"==typeof e.exports?e.exports=u():(i=[],t=u,o="function"==typeof t?t.apply(r,i):t,!(void 0!==o&&(e.exports=o)))}(this,function(){"use strict";function e(e){if(!e)return!0;if(o(e)&&0===e.length)return!0;if(!t(e)){for(var r in e)if(d.call(e,r))return!1;return!0}return!1}function r(e){return s.call(e)}function n(e){return"number"==typeof e||"[object Number]"===r(e)}function t(e){return"string"==typeof e||"[object String]"===r(e)}function i(e){return"object"==typeof e&&"[object Object]"===r(e)}function o(e){return"object"==typeof e&&"number"==typeof e.length&&"[object Array]"===r(e)}function u(e){return"boolean"==typeof e||"[object Boolean]"===r(e)}function f(e){var r=parseInt(e);return r.toString()===e?r:e}function a(r,i,o,u){if(n(i)&&(i=[i]),e(i))return r;if(t(i))return a(r,i.split(".").map(f),o,u);var c=i[0];if(1===i.length){var s=r[c];return void 0!==s&&u||(r[c]=o),s}return void 0===r[c]&&(n(i[1])?r[c]=[]:r[c]={}),a(r[c],i.slice(1),o,u)}function c(r,i){if(n(i)&&(i=[i]),!e(r)){if(e(i))return r;if(t(i))return c(r,i.split("."));var u=f(i[0]),a=r[u];if(1===i.length)void 0!==a&&(o(r)?r.splice(u,1):delete r[u]);else if(void 0!==r[u])return c(r[u],i.slice(1));return r}}var s=Object.prototype.toString,d=Object.prototype.hasOwnProperty,v=function(e){return Object.keys(v).reduce(function(r,n){return"function"==typeof v[n]&&(r[n]=v[n].bind(v,e)),r},{})};return v.has=function(r,u){if(e(r))return!1;if(n(u)?u=[u]:t(u)&&(u=u.split(".")),e(u)||0===u.length)return!1;for(var f=0;f<u.length;f++){var a=u[f];if(!i(r)&&!o(r)||!d.call(r,a))return!1;r=r[a]}return!0},v.ensureExists=function(e,r,n){return a(e,r,n,!0)},v.set=function(e,r,n,t){return a(e,r,n,t)},v.insert=function(e,r,n,t){var i=v.get(e,r);t=~~t,o(i)||(i=[],v.set(e,r,i)),i.splice(t,0,n)},v.empty=function(r,f){if(e(f))return r;if(!e(r)){var a,c;if(!(a=v.get(r,f)))return r;if(t(a))return v.set(r,f,"");if(u(a))return v.set(r,f,!1);if(n(a))return v.set(r,f,0);if(o(a))a.length=0;else{if(!i(a))return v.set(r,f,null);for(c in a)d.call(a,c)&&delete a[c]}}},v.push=function(e,r){var n=v.get(e,r);o(n)||(n=[],v.set(e,r,n)),n.push.apply(n,Array.prototype.slice.call(arguments,2))},v.coalesce=function(e,r,n){for(var t,i=0,o=r.length;o>i;i++)if(void 0!==(t=v.get(e,r[i])))return t;return n},v.get=function(r,i,o){if(n(i)&&(i=[i]),e(i))return r;if(e(r))return o;if(t(i))return v.get(r,i.split("."),o);var u=f(i[0]);return 1===i.length?void 0===r[u]?o:r[u]:v.get(r[u],i.slice(1),o)},v.del=function(e,r){return c(e,r)},v})},function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="entity";r.ENTITY=n;var t="ref_from";r.REF_FROM=t;var i="ref_to";r.REF_TO=i;var o="mapUpdatedKey";r.UPDATED_KEY=o}]); | ||
!function(e){function r(t){if(n[t])return n[t].exports;var i=n[t]={exports:{},id:t,loaded:!1};return e[t].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var n={};return r.m=e,r.c=n,r.p="",r(0)}([function(e,r,n){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=n(1),o=t(i);!function(){(0,o["default"])()}(),r.createCache=o["default"]},function(e,r,n){"use strict";function t(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r["default"]=e,r}function i(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var r=0,n=Array(e.length);r<e.length;r++)n[r]=e[r];return n}return Array.from(e)}function u(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],r=arguments.length<=1||void 0===arguments[1]?"One":arguments[1];return window?(void 0===window[r]&&(window[r]=a(e)),window[r]):a(e)}function a(){function e(e){return"undefined"==typeof e?!1:void 0!=E[e]}function r(r){if("undefined"==typeof r)throw new ReferenceError("Cannot create thread. Missing thread id");if(e(r))return E[r];var t=n(r);return E[r]=t,t}function n(e){var r=u();return r.id=e,r.current=-1,r.nodes=[],r}function t(){return E[O]}function i(){var e=u();return e.id=g,g+=1,p.set(e.id,e),e}function u(){var e={};return Object.defineProperty(e,"length",{value:0,enumerable:!1,writable:!0}),Object.defineProperty(e,"addThread",{value:function(r,n){return e[r]?!1:(e[r]=n,e.length+=1,!0)},enumerable:!1,writable:!1}),Object.defineProperty(e,"removeThread",{value:function(r){return"undefined"!=typeof e[r]?(e[r]=void 0,e.length-=1,!0):!1},enumerable:!1,writable:!1}),e}function a(e,r){for(var n,t,i=0,o=e.length-1;o>=i;)if(n=(i+o)/2|0,t=e[n],r>t)i=n+1;else{if(!(t>r))return n;o=n-1}return-1}function c(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0],r=E[e],n=r?r.nodes[r.current]:void 0;return n>=0?s(n):void 0}function s(e){return p.get(e)}var v=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],O="main",g=0,p=new Map,E=u(),F=[],R=u(),T=u(),y=function(){R=u(),E=u(),p.clear(),r(O),g=0};y();for(var _=function(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0],r=E[e];return r&&e!==O?r.current+1:-1},b=function(e){if(Ae()>0)throw new Error("You may only configure an empty cache. Please clear the cache first and then configure.");d.config(e)},m=function(e){var r=arguments.length<=1||void 0===arguments[1]?O:arguments[1],n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2];if(r=j(r,!0),r.indexOf(O)<0&&r.unshift(O),(0,f.isArray)(e)||(0,f.isObject)(e)){var t=new Map,i=new Map;t.set(l.UPDATED_KEY,!1),Z(e,t,null,i,n),L(t);var u=t.get(l.UPDATED_KEY);t["delete"](l.UPDATED_KEY);var a=!1;return t.size>0&&u&&(xe(r),pe([].concat(o(t.values())),r,i),Le(),a=!0),Ne(a)}return e},j=function(e){var r=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],n=void 0,t=r===!0;if((0,f.isArray)(e))t&&e.forEach(function(e){M(e)}),n=e;else if("string"==typeof e)t&&M(e),n=[e];else{if("number"!=typeof e)throw new TypeError("Thread id must be one of 'string', 'number' or an array of strings or numbers");e=String(e),t&&M(e),n=[e]}return n},M=function(n){e(n)||r(n)},w=function(e){var r=arguments.length<=1||void 0===arguments[1]?O:arguments[1];if("undefined"==typeof e)throw new TypeError("Cannot close thread. Missing thread id");return S(e,!0,r)},N=function(e){var r=arguments.length<=1||void 0===arguments[1]?O:arguments[1];if("undefined"==typeof e)throw new TypeError("Cannot merge thread. Missing threadId");return S(e,!1,r)},P=function(e){if(e===O)throw new TypeError("You may not cancel the main thread. Pfft.");if("undefined"==typeof e)return Ne(!1);var r=E[e];if(!r)return Ne(!1);var n=r.nodes,t=[];return n.forEach(function(r){var n=p.get(r);n&&(n.threads.removeThread(e),n.threads.length<=1&&t.push(r))}),z(t),E.removeThread(e),Ne(!0)},S=function(e){var r=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?O:arguments[2];if("undefined"!=typeof e){if(e===O)throw new TypeError("You may not remove the main thread");var t=E[e];if(t){var i=Ye(e)-1,o=t.current;if(o>=0){var u=function(){var u=[];return r===!0?t.nodes=t.nodes.reduce(function(r,t,a){var f=s(t);return 0==a||a==o?(f.threads.removeThread(e),Je(f,n),r.push(t)):i>=a&&(f.threads.removeThread(e),f.threads.length<=1&&u.push(t)),r},[]):t.nodes.forEach(function(r,t){var i=p.get(r);i&&(i.threads.removeThread(e),o>=t?Je(i,n):i.threads.length<=1&&u.push(r))}),z(u),E.removeThread(e),{v:Ne(!0)}}();if("object"==typeof u)return u.v}}}},z=function(e){var r=E[O];e.forEach(function(e){var n=a(r.nodes,e);r.nodes.splice(n,1),p["delete"](e),r.current-=1})},A=function(e){var r=E[e];if(!r)return!1;var n=c(O);return r&&I(e,n)},Y=function(){var e=[];for(var r in E)E.hasOwnProperty(r)&&E[r]&&e.push(r);return e},I=function(e,r){return r.threads&&void 0!==r.threads[e]},x=function(e){function r(e,r){if((0,f.hasUid)(e)){var t=e[d.prop.uidName],i=R[t];!n&&i||!n&&H(t)||(K(t)||(R.length+=1),R[t]=e,r.push(t))}}var n=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],t=[];(0,f.isArray)(e)?e.forEach(function(e){r(e,t)}):(0,f.isObject)(e)&&r(e,t);var i=t.length>0;return i&&Le(t),t.length},U=function(e){var r=Fe(e);if(r)return R[r]?(R[r]=void 0,R.length>0&&(R.length-=1),!0):!1},C=function(e){var r=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(R.length>0){var n=[];for(var t in R)R.hasOwnProperty(t)&&n.push(R[t]);var i=m(n,e,r);return i.success===!0&&(R=u()),i}return Ne(!1)},D=function(e){e&&(0,f.hasUid)(e)&&(T[e[d.prop.uidName]]=e)},K=function(e){var r=Fe(e);if(r)return R[r]},J=function(){return Object.keys(R).length>0},q=function(){return Object.keys(T).length>0},Q=function(){return J()||q()},H=function(e){var r=arguments.length<=1||void 0===arguments[1]?O:arguments[1];if(!e)throw new TypeError("Cache-uid get(): requires a uid to retrieve an item from the cache.");return(0,f.isArray)(e)?e.map(function(e){return Ee(e,r)}).filter(function(e){return null!==e&&void 0!==e}):Ee(e,r)},k=function(e){var r=G(e);if(0==r.length)return!1;var n=ge(),t=r.some(function(e){return n&&n.has(String(e))});if(!t)return!1;var i=new Map;n.forEach(function(e,r){i.set(r,e)}),xe();var o=new Map,u=new Map;return r.forEach(function(e){V(e,o,u),u.set(e,null),W(e,o)}),o.forEach(function(e,r){i.set(r,e)}),u.forEach(function(e,r){i["delete"](r)}),De(i,O),Le(),!0},G=function(e){var r=[];if((0,f.isArray)(e))e.forEach(function(e){(0,f.hasUid)(e)?r.push(String(e[d.prop.uidName])):r.push(String(e))});else{var n=e;if((0,f.isObject)(e)&&(n=e[d.prop.uidName]),void 0===n)return!1;r.push(String(n))}return r},L=function(e){var r=new Map;e.forEach(function(r,n){if(n!==l.UPDATED_KEY){var t=r[l.REF_FROM];for(var i in t)if(t.hasOwnProperty(i)){var o=t[i],u=e.get(i);if(u||(u=qe(i)),u&&o.length>0){var a=o[0],c=h.get(u[l.ENTITY],a),s=c&&c!==r[l.ENTITY];s===!0&&(u=_e(u[l.ENTITY],e),u[l.ENTITY]=(0,f.deepClone)(u[l.ENTITY],r[l.ENTITY],!0,!0))}}}}),r.forEach(function(r,n){e.set(n,r)})},Z=function(e,r,n,t,i){(0,f.hasUid)(e)?B(e,r,n,t,i):((0,f.isArray)(e)?he(e,r,n,t,i):ce(e,r,n,t,i),Object.freeze(e))},B=function(e,r,n,t,i){var o=String(e[d.prop.uidName]);se(e)!==!0&&(r.has(o)?ce(e,r,n,t):(_e(e,r),n=String(o),ce(e,r,n,t),Object.isFrozen(e)||Object.freeze(e)),$(o,r,t))},V=function er(e,r,n){var t=qe(e);if(t){var i=t[l.REF_TO];for(var o in i)if(i.hasOwnProperty(o)){var u=X(o,r);u&&(ue(u,e),0===u[l.REF_FROM].length?(er(o,r,n),n.set(o,u)):r.set(o,u))}}},W=function(e,r){var n=X(e,r);if(n){var t=n[l.REF_FROM];for(var i in t)if(t.hasOwnProperty(i)){var o=X(i,r);if(o){var u=ae(o,e);u===!0&&r.set(i,o)}}}},X=function(e,r){if(e){e=String(e);var n=r.get(e);return n||(n=qe(e)),Object.isFrozen(n)&&(n=me(n)),n}},$=function(e,r,n){var t=X(e,r);if(t){var i=t[l.REF_TO],o=function(o){if(i.hasOwnProperty(o)){var u=i[o],a=u.map(function(i){var u=h.get(t[l.ENTITY],i);if(u){var a=u[d.prop.uidName];if(a){var f=a==o;if(f===!0)return i}}re(e,o,i,r,n)}).filter(function(e){return null!==e&&void 0!==e});Object.isFrozen(t[l.REF_TO])&&ne(t,l.REF_TO),a.length>0?t[l.REF_TO][o]=a:(t[l.REF_TO][o]=void 0,delete t[l.REF_TO][o])}};for(var u in i)o(u)}},ee=function(e){Object.freeze(e),Object.freeze(e[l.ENTITY]),Object.freeze(e[l.REF_TO]),Object.freeze(e[l.REF_FROM])},re=function(e,r,n,t,i){var o=X(r,t);o&&(o=Object.assign({},o),ne(o,l.REF_FROM),o[l.REF_FROM].hasOwnProperty(e)&&(oe(o,e,n),0===o[l.REF_FROM].length?(i.set(r,o),t["delete"](r)):(t.set(r,o),i["delete"](r))))},ne=function(e,r){var n=e[r].length;e[r]=Object.assign(u(),e[r]),e[r].length=n},te=function(e,r,n){Object.isFrozen(e)&&(e=me(e));var t=e[l.REF_TO];e[l.REF_TO][r]||(Object.isFrozen(e[l.REF_TO])&&(e[l.REF_TO]=Object.assign(u(),e[l.REF_TO]),t=e[l.REF_TO]),e[l.REF_TO][r]=[],e[l.REF_TO].length+=1);var i=t[r];return Object.isFrozen(i)&&(t[r]=i.slice(),i=t[r]),i.indexOf(n)<0&&i.push(n),e},ie=function(e,r,n){Object.isFrozen(e)&&(e=me(e));var t=e[l.REF_FROM];e[l.REF_FROM][r]||(Object.isFrozen(e[l.REF_FROM])&&(e[l.REF_FROM]=Object.assign(u(),e[l.REF_FROM]),t=e[l.REF_FROM]),e[l.REF_FROM][r]=[],e[l.REF_FROM].length+=1);var i=t[r];return Object.isFrozen(i)&&(t[r]=i.slice(),i=t[r]),i.indexOf(n)<0&&i.push(n),e},oe=function(e,r,n){var t=e[l.REF_FROM][r];if(t){var i=t.indexOf(n);0>i||(t=t.slice(),t.splice(i,1),e[l.REF_FROM][r]=t,0==t.length&&(e[l.REF_FROM][r]=void 0,delete e[l.REF_FROM][r],e[l.REF_FROM].length-=1))}},ue=function(e,r){var n=e[l.REF_FROM][r];n&&(ne(e,l.REF_FROM),e[l.REF_FROM][r]=void 0,delete e[l.REF_FROM][r],e[l.REF_FROM].length>0&&(e[l.REF_FROM].length-=1))},ae=function(e,r){var n=e[l.REF_TO][r];if(!n)return!1;var t=e[l.ENTITY];Object.isFrozen(t)&&(t=Re(t[d.prop.uidName]),e[l.ENTITY]=t);var i=e[l.REF_TO][r];return i.forEach(function(e){h.del(t,e)}),Object.isFrozen(t)||Object.freeze(t),e[l.ENTITY]=t,ne(e,l.REF_TO),e[l.REF_TO][r]=void 0,delete e[l.REF_TO][r],e[l.REF_TO].length>0&&(e[l.REF_TO].length-=1),!0},fe=function(e){R[e]&&(R[e]=void 0,R.length>0&&(R.length-=1))},ce=function(e,r,n,t,i,o){void 0===i&&(i="");for(var u in e){if(e.hasOwnProperty(u)){i=Oe(i,u);var a=e[u];(0,f.isArray)(a)?he(a,r,n,t,i,o):(0,f.isObject)(a)&&de(a,r,n,t,i,o),Object.freeze(a)}i=""}},se=function(e){var r=arguments.length<=1||void 0===arguments[1]?O:arguments[1],n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2];if(!(0,f.hasUid)(e))return!1;var t=e[d.prop.uidName],i=qe(t,r);return n===!0?i&&i[l.ENTITY]===e:!!i},de=function(e,r,n,t){var i=arguments.length<=4||void 0===arguments[4]?"":arguments[4];if((0,f.hasUid)(e)){var o=_e(e,r);if(o){ve(o,n,i,r);var u=se(e);if(u===!0)return;o[l.ENTITY]=e,n=String(e[d.prop.uidName]),Z(e,r,n,t)}}else ce(e,r,n,t,i);Object.freeze(e)},ve=function(e,r,n,t){var i=X(r,t);i&&n&&""!==n&&le(i,e,n)},he=function rr(e,r,n,t){var i=arguments.length<=4||void 0===arguments[4]?"":arguments[4],o=void 0;e.forEach(function(e,u){o=i+"."+u,(0,f.isArray)(e)?rr(e,r,n,t,o):(0,f.isObject)(e)&&de(e,r,n,t,o)}),Object.freeze(e)},le=function(e,r,n){if(!e)throw new ReferenceError("Cannot assign reference. Missing parent item.");if(!r)throw new ReferenceError("Cannot assign reference. Missing reference item.");if(!n||""===n)throw new TypeError("Cannot assign reference. Missing property name. prop: "+n);var t=e[l.ENTITY][d.prop.uidName],i=r[l.ENTITY][d.prop.uidName];te(e,i,n),ie(r,t,n)},Oe=function(e,r){return e=""===e?r:e+"."+r},ge=function(){var e=c(O);return e?e.items:new Map},pe=function(e,r,n){var t=new Map,i=ge();i.forEach(function(e,r){t.set(r,e)}),e.forEach(function(e){var r=e[l.ENTITY][d.prop.uidName];if(void 0!==r){var n=qe(r);if(n){var i=n[l.REF_TO],o=e[l.REF_TO];for(var u in i)if(i.hasOwnProperty(u)){var a=i[u],f=0;if(o.hasOwnProperty(u)&&(f=o[u]),a>0&&0==f){var c=t.get(u);Object.isFrozen(c)&&(c=be(c[l.ENTITY],c[l.REF_FROM],c[l.REF_TO]),t.set(u,c)),c[l.REF_FROM]["delete"](String(r)),0==c[l.REF_FROM].size&&t["delete"](u)}}}ee(e),t.set(String(r),e)}}),n.size>0&&n.forEach(function(e,r){t["delete"](String(r))}),De(t,r)},Ee=function(e){var r=arguments.length<=1||void 0===arguments[1]?O:arguments[1];if(e){var n=Fe(e);if(n){var t=qe(n,r);if(void 0!==t)return t[l.ENTITY];var i=R[n];if(i)return i}}},Fe=function(e){return"string"==typeof e?e:"number"==typeof e?String(e):(0,f.isObject)(e)&&(0,f.hasUid)(e)?e[d.prop.uidName]:void 0},Re=function(e){return(0,f.isArray)(e)?e.map(function(e){return ye(e)}).filter(function(e){return null!==e&void 0!==e}):ye(e)},Te=function(r){return"undefined"==typeof r&&(r=O),e(r)?E[r].current:-1},ye=function(e){if(e){var r=Fe(e);if(r){if(K(e))return R[r];var n=H(r);if(n)return(0,f.deepClone)(n,void 0,!1)}}},_e=function(e,r){if(void 0!==e){var n=String(e[d.prop.uidName]),t=r.get(n);if(t)return t;t={};var i=qe(n);return t[l.ENTITY]=e,void 0!==i?(t=Object.assign(t,i),t[l.ENTITY]=e,t[l.REF_FROM]=Object.assign(u(),i[l.REF_FROM]),t[l.REF_FROM].length=i[l.REF_FROM].length,t[l.REF_TO]=Object.assign(u(),i[l.REF_TO]),t[l.REF_TO].length=i[l.REF_TO].length):(t[l.REF_FROM]=u(),t[l.REF_TO]=u()),r.set(n,t),r.set(l.UPDATED_KEY,!0),fe(n),t}},be=function(e,r,n){var t={};t[l.ENTITY]=e;var i=r;void 0===i&&(i=u()),t[l.REF_FROM]=i;var o=n;return void 0===o&&(o=u()),t[l.REF_TO]=o,t},me=function(e){var r=Object.assign({},e);return ne(r,l.REF_FROM),ne(r,l.REF_TO),r},je=function(e){return(0,f.hasUid)(e)?"undefined"!=typeof qe(e[d.prop.uidName]):!1},Me=function(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0],r=E[e],n=!1;return r&&ze(e)&&(r.current-=1,n=!0),Ne(n,e)},we=function(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0],r=E[e],n=!1;return r&&Se(e)&&(r.current+=1,n=!0),Ne(n,e)},Ne=function(e,r){if(r&&"string"!=typeof r&&"number"!=typeof r)throw new TypeError("Get history state errror: The thread id must be a string or a number: "+r+":"+typeof r);var n={threads:{}};n.success=e;var t=void 0;return t=void 0===r||r===O?Y():[O,r],t.forEach(function(e){Pe(n,e)}),n},Pe=function(e,r){if(E[r]){var n=Te(r),t=Ye(r);e.threads[r]={currentIndex:n,length:t,hasPrev:n>0,hasNext:t-1>n}}},Se=function(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0],r=E[e];return r?r.current<r.nodes.length-1:!1},ze=function(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0],r=E[e];return r?r.current>0:!1},Ae=function(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0],r=E[e];if(r){var n=c(e);return n?n.items.size:0}return 0},Ye=function(){var r=arguments.length<=0||void 0===arguments[0]?O:arguments[0];return e(r)?E[r].nodes.length:0},Ie=function(){return{queue:R.length}},xe=function(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0],r=j(e,!1);r.forEach(function(e){Ue(e)})},Ue=function(){var e=arguments.length<=0||void 0===arguments[0]?O:arguments[0];if(Se(e)){var r=E[e];if(r)if(e===O){if(r.current<r.nodes.length-1){var n=r.nodes.slice(r.current+1,r.nodes.length);r.nodes=r.nodes.slice(0,r.current+1),r.current=r.nodes.length-1,Ce(n)}}else!function(){var n=[],t=r.nodes.length;r.nodes=r.nodes.filter(function(i,o){if(o>r.current&&t>o){var u=p.get(i);return u.threads.removeThread(e),u.threads.length<=1&&n.push(i),!1}return!0}),z(n)}()}},Ce=function(e){e.forEach(function(e){var r=p.get(e);if(r){var n=r.threads;for(var t in n)if(n.hasOwnProperty(t)){var i=n[t];i>=0&&console.log("TRUNCATE AFTER "+i+" threadId"+t)}}p["delete"](e)})},De=function(e,r){null!==e&&!function(){Object.freeze(e);var n=i();if(n.items=e,"undefined"!=typeof r){void 0===n.threads&&(n.threads=u());var t=Ke(r);t.forEach(function(e){Je(n,e)})}}()},Ke=function(e){var r=void 0;return"string"==typeof e?r=[e]:(0,f.isArray)(e)&&(r=e),r.indexOf(O)<0&&r.unshift(O),r},Je=function(e,n){if("undefined"!=typeof n&&void 0!==e){var t=E[n];t||(t=r(n)),e.threads.addThread(n,_(n))&&(t.nodes.push(e.id),t.current+=1)}},qe=function(e){var r=arguments.length<=1||void 0===arguments[1]?O:arguments[1],n=c(r);return n?n.items.get(String(e)):void 0},Qe=function(){var e="",r=0,n=t(),i=n.current;n.nodes.map(function(n){var t="",o=p.get(n);o.threads&&(t=JSON.stringify(o.threads));var u=r+":"+t+"\n["+He(o.items)+"],\n\n";r===i&&(u="-> "+u),e+=u,r++}),e=e.substring(0,e.length-2),r=0,console.log("\n------ One -------\nSTACK:\n"+e+"\n\nCONFIG:"+JSON.stringify(d,null,2)+"\n\nQUEUE:"+JSON.stringify(R,null,2)+"\n\nTHREADS:"+JSON.stringify(E,null,2)+"\n\nREPO SIZE:"+p.size+"\n===================\n")},He=function(e){var r="",n=[].concat(o(e.values()));return n.map(function(e){var n=void 0;try{n=JSON.stringify(e,null,2)+",\n"}catch(t){return void console.log("CYCLICAL STRUCTURE - to fix: "+t.message)}n.indexOf(l.REF_FROM)>=0&&e[l.REF_FROM]&&(n=n.replace('"'+l.REF_FROM+'": {}','"'+l.REF_FROM+'": '+JSON.stringify([].concat(o(e[l.REF_FROM]))))),n.indexOf(l.REF_TO)>=0&&e[l.REF_TO]&&(n=n.replace('"'+l.REF_TO+'": {}','"'+l.REF_TO+'": '+JSON.stringify(e[l.REF_TO]))),r+=n}),r=""===r?"{}":r.substring(0,r.length-2)},ke=function(e){if(!(0,f.hasUid)(e))return!0;var r=e[d.prop.uidName],n=H(r);return n?n!==e:!0},Ge=function(e){F.push(e);var r=!0;return function(){if(r){r=!1;var n=F.indexOf(e);F.splice(n,1)}}},Le=function(e){F.slice().forEach(function(r){r(e)})},Ze=[],Be=0;256>Be;Be++)Ze[Be]=(16>Be?"0":"")+Be.toString(16);var Ve=function(){var e=4294967296*Math.random()|0,r=4294967296*Math.random()|0,n=4294967296*Math.random()|0,t=4294967296*Math.random()|0;return Ze[255&e]+Ze[e>>8&255]+Ze[e>>16&255]+Ze[e>>24&255]+"-"+Ze[255&r]+Ze[r>>8&255]+"-"+Ze[r>>16&15|64]+Ze[r>>24&255]+"-"+Ze[63&n|128]+Ze[n>>8&255]+"-"+Ze[n>>16&255]+Ze[n>>24&255]+Ze[255&t]+Ze[t>>8&255]+Ze[t>>16&255]+Ze[t>>24&255]},We=function(e){var r=qe(e);return r[l.REF_FROM]},Xe=function(e){var r=qe(e);return r[l.REF_TO]},$e={put:m,get:H,getEdit:Re,evict:k,reset:y,queue:x,unQueue:U,queueEvict:D,getQueued:K,commit:C,closeThread:w,mergeThread:N,cutThread:P,hasThread:e,onThread:A,listThreads:Y,undo:Me,redo:we,getHistoryState:Ne,getCurrentIndex:Te,isDirty:ke,uuid:Ve,contains:je,config:b,subscribe:Ge};return v===!0&&($e.getCurrentNode=c,$e.hasQueue=Q,$e.refFrom=We,$e.refTo=Xe,$e.size=Ae,$e.length=Ye,$e.pending=Ie,$e.print=Qe),$e}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=u;var f=n(2),c=n(4),s=(i(c),n(3)),d=t(s),v=n(5),h=t(v),l=n(6);e.exports=r["default"]},function(e,r,n){"use strict";function t(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r["default"]=e,r}function i(e){if(Array.isArray(e)){for(var r=0,n=Array(e.length);r<e.length;r++)n[r]=e[r];return n}return Array.from(e)}function o(e,r){var n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2],t=arguments.length<=3||void 0===arguments[3]?!1:arguments[3];if(!e||!c(e)&&!s(e))return e;if(n&&r&&!Object.isFrozen(r)&&Object.freeze(r),r&&a(e)&&e[O.prop.uidName]===r[O.prop.uidName])return r;var i,f=Object.assign({},e);for(i in f)if(f.hasOwnProperty(i)){var d=f[i];if(d)if(s(d))f[i]=u(d,r,t);else if(v(d)){var h=new Date(d.getTime());n&&Object.freeze(h),f[i]=h}else c(d)&&(a(d)?(f[i]=d,r&&a(r)&&d!==r&&d.uid===r.uid&&d!==r&&(f[i]=r)):f[i]=o(d,r,n,t))}return n&&!Object.isFrozen(f)&&Object.freeze(f),f}function u(e,r,n){return e.map(function(e){return s(e)?u(e,r,n):c(e)?a(e)&&n===!1?e:o(e,r,!0,n):e})}function a(e){if(!e)return!1;if(!c(e))return!1;if("undefined"==typeof e[O.prop.uidName])return!1;var r=e[O.prop.uidName];return 0!==r.length}function f(e){var r=e||new Set;return new Set([].concat(i(r)))}function c(e){return"[object Array]"===Object.prototype.toString.call(e)?!1:null!==e&&"object"==typeof e}function s(e){return e&&null!==e?Array.isArray(e)||e&&"object"==typeof e&&"number"==typeof e.length&&"function"==typeof e.splice&&!e.propertyIsEnumerable("length"):!1}function d(e){return Object.prototype.toString.call(e)}function v(e){return c(e)&&"[object Date]"===d(e)}function h(e){return c(e)&&"[object RegExp]"===d(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.deepClone=o,r.hasUid=a,r.cloneSet=f,r.isObject=c,r.isArray=s,r.isDate=v,r.isRegExp=h;var l=n(3),O=t(l)},function(e,r){"use strict";function n(e){for(var r in t)t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&(t[r]=e[r])}Object.defineProperty(r,"__esModule",{value:!0}),r.config=n;var t={uidName:"uid",maxHistoryStates:1e3};r.prop=t},function(e,r){"use strict";function n(e){return e?(Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(r){!e.hasOwnProperty(r)||null===e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||Object.isFrozen(e[r])||n(e[r])}),e):void 0}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n,e.exports=r["default"]},function(e,r,n){"use strict";function t(e){return"number"==typeof e||"[object Number]"===toString(e)}function i(e){return"string"==typeof e||"[object String]"===toString(e)}function o(e){if(!e)return!0;if((0,c.isArray)(e)&&0===e.length)return!0;if(!i(e)){for(var r in e)if(s.call(e,r))return!1;return!0}return!1}function u(e,r){var n=!0;e:for(;n;){var u=e,a=r;if(n=!1,t(a)&&(a=[a]),o(u))return;if(o(a))return u;if(!i(a)){var s=f(a[0]),d=u[s];if(1===a.length)void 0!==d&&((0,c.isArray)(u)?u.splice(s,1):delete u[s]);else if(void 0!==u[s]){e=u[s],r=a.slice(1),n=!0,s=d=void 0;continue e}return u}e=u,r=a.split("."),n=!0}}function a(e,r,n){for(var u=!0;u;){var a=e,c=r,s=n;if(u=!1,t(c)&&(c=[c]),o(c))return a;if(o(a))return s;if(i(c))e=a,r=c.split("."),n=s,u=!0;else{var d=f(c[0]);if(1===c.length)return void 0===a[d]?s:a[d];e=a[d],r=c.slice(1),n=s,u=!0,d=void 0}}}function f(e){var r=parseInt(e);return r.toString()===e?r:e}Object.defineProperty(r,"__esModule",{value:!0}),r.del=u,r.get=a;var c=n(2),s=Object.prototype.hasOwnProperty},function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="entity";r.ENTITY=n;var t="ref_from";r.REF_FROM=t;var i="ref_to";r.REF_TO=i;var o="mapUpdatedKey";r.UPDATED_KEY=o}]); |
{ | ||
"name": "one", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Browser application cache. It guarantees entity uniqueness across the entire cache.", | ||
@@ -9,2 +9,3 @@ "main": "lib/index.js", | ||
"test": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", | ||
"cov": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec", | ||
"build:js": "webpack --config webpack.config.js", | ||
@@ -14,3 +15,2 @@ "build:js:min": "webpack --config webpack.config.production.js", | ||
"build": "npm run build:lib && npm run build:js && npm run build:js:min", | ||
"tt": "webpack --config webpack.tt.config.js", | ||
"prepub": "npm run clean && npm run build" | ||
@@ -33,5 +33,3 @@ }, | ||
}, | ||
"dependencies": { | ||
"object-path": "^0.9.2" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -38,0 +36,0 @@ "babel": "^5.8.34", |
# One | ||
```One``` is a browser side application cache. It guarantees entity uniqueness across the entire cache. | ||
[![Npm Status](https://badge.fury.io/js/one.svg)](https://npmjs.com/package/one) [![Build Status](https://travis-ci.org/maierson/one.svg)](https://travis-ci.org/maierson/one) [![Coverage Status](https://coveralls.io/repos/github/maierson/one/badge.svg?branch=master)](https://coveralls.io/github/maierson/one?branch=master) | ||
@@ -4,0 +6,0 @@ |
@@ -19,3 +19,3 @@ /** | ||
if (freeze && uidReference && !Object.isFrozen(uidReference)) { | ||
if (freeze === true && uidReference && !Object.isFrozen(uidReference)) { | ||
Object.freeze(uidReference); | ||
@@ -31,4 +31,3 @@ } | ||
let result = Object.assign({}, obj); | ||
var propName; | ||
for (propName in result) { | ||
for (let propName in result) { | ||
if (result.hasOwnProperty(propName)) { | ||
@@ -41,3 +40,3 @@ let value = result[propName]; | ||
let date = new Date(value.getTime()); | ||
if (freeze) { | ||
if (freeze === true) { | ||
Object.freeze(date); | ||
@@ -66,3 +65,3 @@ } | ||
} | ||
if (freeze && !Object.isFrozen(result)) { | ||
if (freeze === true && !Object.isFrozen(result)) { | ||
Object.freeze(result); | ||
@@ -78,6 +77,7 @@ } | ||
} else if (isObject(item)) { | ||
// *** keep items inside clones as we're not editing them = must getEdit on item | ||
if (hasUid(item) && force === false) { | ||
return item; | ||
} else { | ||
return deepClone(item, uidReference, true, force); | ||
return deepClone(item, uidReference, force); | ||
} | ||
@@ -127,3 +127,3 @@ } else { | ||
return mixed_var !== null && typeof mixed_var === 'object'; | ||
}; | ||
} | ||
@@ -146,3 +146,3 @@ /** | ||
); | ||
}; | ||
} | ||
@@ -149,0 +149,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
0
22
7491
167
331488
- Removedobject-path@^0.9.2
- Removedobject-path@0.9.2(transitive)