UNPKG

@appscode/ui-builder

Version:
7 lines 3.47 kB
"use strict";var e=require("./wrapper-944ca3a6.js"),t=e.v.includes,n=e.s("indexOf",{ACCESSORS:!0,1:0});e._({target:"Array",proto:!0,forced:!n},{includes:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}}),e.d("includes");var r=e.u.map,o=e.p("map"),a=e.s("map");e._({target:"Array",proto:!0,forced:!o||!a},{map:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}});var i=function(t){return function(n,r,o,a){e.x(r);var i=e.a(n),u=e.y(i),s=e.t(i.length),c=t?s-1:0,v=t?-1:1;if(o<2)for(;;){if(c in u){a=u[c],c+=v;break}if(c+=v,t?c<0:s<=c)throw TypeError("Reduce of empty array with no initial value")}for(;t?c>=0:s>c;c+=v)c in u&&(a=r(a,u[c],c,i));return a}},u={left:i(!1),right:i(!0)}.left,s=e.z("reduce"),c=e.s("reduce",{1:0});e._({target:"Array",proto:!0,forced:!s||!c},{reduce:function(e){return u(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}}),e._({target:"String",proto:!0,forced:!e.A("includes")},{includes:function(t){return!!~String(e.B(this)).indexOf(e.C(t),arguments.length>1?arguments[1]:void 0)}}); /*! * https://github.com/Starcounter-Jack/JSON-Patch * (c) 2017 Joachim Wester * MIT license */ var v=new WeakMap,p=function(e){this.observers=new Map,this.obj=e},d=function(e,t){this.callback=e,this.observer=t};function l(t,n){void 0===n&&(n=!1);var r=v.get(t.object);f(r.value,t.object,t.patches,"",n),t.patches.length&&e.D(r.value,t.patches);var o=t.patches;return o.length>0&&(t.patches=[],t.callback&&t.callback(o)),o}function f(t,n,r,o,a){if(n!==t){"function"==typeof n.toJSON&&(n=n.toJSON());for(var i=e.E(n),u=e.E(t),s=!1,c=u.length-1;c>=0;c--){var v=t[d=u[c]];if(!e.F(n,d)||void 0===n[d]&&void 0!==v&&!1===Array.isArray(n))Array.isArray(t)===Array.isArray(n)?(a&&r.push({op:"test",path:o+"/"+e.G(d),value:e.g(v)}),r.push({op:"remove",path:o+"/"+e.G(d)}),s=!0):(a&&r.push({op:"test",path:o,value:t}),r.push({op:"replace",path:o,value:n}));else{var p=n[d];"object"==typeof v&&null!=v&&"object"==typeof p&&null!=p?f(v,p,r,o+"/"+e.G(d),a):v!==p&&(a&&r.push({op:"test",path:o+"/"+e.G(d),value:e.g(v)}),r.push({op:"replace",path:o+"/"+e.G(d),value:e.g(p)}))}}if(s||i.length!=u.length)for(c=0;c<i.length;c++){var d=i[c];e.F(t,d)||void 0===n[d]||r.push({op:"add",path:o+"/"+e.G(d),value:e.g(n[d])})}}}function h(e,t,n){void 0===n&&(n=!1);var r=[];return f(e,t,r,"",n),r}var w=Object.freeze({__proto__:null,unobserve:function(e,t){t.unobserve()},observe:function(t,n){var r,o=function(e){return v.get(e)}(t);if(o){var a=function(e,t){return e.observers.get(t)}(o,n);r=a&&a.observer}else o=new p(t),v.set(t,o);if(r)return r;if(r={},o.value=e.g(t),n){r.callback=n,r.next=null;var i=function(){l(r)},u=function(){clearTimeout(r.next),r.next=setTimeout(i)};"undefined"!=typeof window&&(window.addEventListener("mouseup",u),window.addEventListener("keyup",u),window.addEventListener("mousedown",u),window.addEventListener("keydown",u),window.addEventListener("change",u))}return r.patches=[],r.object=t,r.unobserve=function(){l(r),clearTimeout(r.next),function(e,t){e.observers.delete(t.callback)}(o,r),"undefined"!=typeof window&&(window.removeEventListener("mouseup",u),window.removeEventListener("keyup",u),window.removeEventListener("mousedown",u),window.removeEventListener("keydown",u),window.removeEventListener("change",u))},o.observers.set(n,new d(n,r)),r},generate:l,compare:h});Object.assign({},e.H,w,{JsonPatchError:e.P,deepClone:e.g,escapePathComponent:e.G,unescapePathComponent:e.I}),exports.c=h;