mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-27 20:04:17 +00:00
14 lines
12 KiB
JavaScript
14 lines
12 KiB
JavaScript
|
/*! fast-json-patch, version: 3.1.1 */
|
||
|
var jsonpatch=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t){
|
||
|
/*!
|
||
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
||
|
* (c) 2017-2022 Joachim Wester
|
||
|
* MIT licensed
|
||
|
*/
|
||
|
var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=Object.prototype.hasOwnProperty;function a(e,t){return o.call(e,t)}function i(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)a(e,o)&&n.push(o);return n}function p(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function u(e,t){var r;for(var n in e)if(a(e,n)){if(e[n]===t)return p(n)+"/";if("object"==typeof e[n]&&""!=(r=u(e[n],t)))return p(n)+"/"+r}return""}function s(e,t){var r=[e];for(var n in t){var o="object"==typeof t[n]?JSON.stringify(t[n],null,2):t[n];void 0!==o&&r.push(n+": "+o)}return r.join("\n")}t.hasOwnProperty=a,t._objectKeys=i,t._deepClone=function(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}},t.isInteger=function(e){for(var t,r=0,n=e.length;r<n;){if(!((t=e.charCodeAt(r))>=48&&t<=57))return!1;r++}return!0},t.escapePathComponent=p,t.unescapePathComponent=function(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")},t._getPathRecursive=u,t.getPath=function(e,t){if(e===t)return"/";var r=u(e,t);if(""===r)throw new Error("Object not found in root");return"/"+r},t.hasUndefined=function e(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(var r=0,n=t.length;r<n;r++)if(e(t[r]))return!0}else if("object"==typeof t)for(var o=i(t),a=o.length,p=0;p<a;p++)if(e(t[o[p]]))return!0;return!1};var c=function(e){function t(t,r,n,o,a){var i=this.constructor,p=e.call(this,s(t,{name:r,index:n,operation:o,tree:a}))||this;return p.name=r,p.index=n,p.operation=o,p.tree=a,Object.setPrototypeOf(p,i.prototype),p.message=s(t,{name:r,index:n,operation:o,tree:a}),p}return n(t,e),t}(Error);t.PatchError=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.JsonPatchError=n.PatchError,t.deepClone=n._deepClone;var o={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var o=i(r,this.path);o&&(o=n._deepClone(o));var a=p(r,{op:"remove",path:this.from}).removed;return p(r,{op:"add",path:this.path,value:a}),{newDocument:r,removed:o}},copy:function(e,t,r){var o=i(r,this.from);return p(r,{op:"add",path:this.path,value:n._deepClone(o)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:f(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},a={add:function(e,t,r){return n.isInteger(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:o.move,copy:o.copy,test:o.test,_get:o._get};function i(e,t){if(""==t)return e;var r={op:"_get",path:t};return p(e,r),r.value}function p(e,r,p,u,c,h){if(void 0===p&&(p=!1),void 0===u&&(u=!0),void 0===c&&(c=!0),void 0===h&&(h=0),p&&("function"==typeof p?p(r,0,e,r.path):s(r,0)),""===r.path){var l={newDocument:e};if("add"===r.op)return l.newDocument=r.value,l;if("replace"===r.op)return l.newDocument=r.value,l.removed=e,l;if("move"===r.op||"copy"===r.op)return l.newDocument=i(e,r.from),"move"===r.op&&(l.removed=e),l;if("test"===r.op){if(l.test=f(e,r.value),!1===l.test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",h,r,e);return l.newDocument=e,l}if("remove"===r.op)return l.removed=e,l.newDocument=null,l;if("_get"===r.op)return r.value=e,l;if(p)throw new t.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",h,
|
||
|
/*!
|
||
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
||
|
* (c) 2017-2021 Joachim Wester
|
||
|
* MIT license
|
||
|
*/
|
||
|
var n=r(0),o=r(1),a=new WeakMap,i=function(e){this.observers=new Map,this.obj=e},p=function(e,t){this.callback=e,this.observer=t};function u(e,t){void 0===t&&(t=!1);var r=a.get(e.object);s(r.value,e.object,e.patches,"",t),e.patches.length&&o.applyPatch(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function s(e,t,r,o,a){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var i=n._objectKeys(t),p=n._objectKeys(e),u=!1,c=p.length-1;c>=0;c--){var f=e[l=p[c]];if(!n.hasOwnProperty(t,l)||void 0===t[l]&&void 0!==f&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(a&&r.push({op:"test",path:o+"/"+n.escapePathComponent(l),value:n._deepClone(f)}),r.push({op:"remove",path:o+"/"+n.escapePathComponent(l)}),u=!0):(a&&r.push({op:"test",path:o,value:e}),r.push({op:"replace",path:o,value:t}),!0);else{var h=t[l];"object"==typeof f&&null!=f&&"object"==typeof h&&null!=h&&Array.isArray(f)===Array.isArray(h)?s(f,h,r,o+"/"+n.escapePathComponent(l),a):f!==h&&(!0,a&&r.push({op:"test",path:o+"/"+n.escapePathComponent(l),value:n._deepClone(f)}),r.push({op:"replace",path:o+"/"+n.escapePathComponent(l),value:n._deepClone(h)}))}}if(u||i.length!=p.length)for(c=0;c<i.length;c++){var l=i[c];n.hasOwnProperty(e,l)||void 0===t[l]||r.push({op:"add",path:o+"/"+n.escapePathComponent(l),value:n._deepClone(t[l])})}}}t.unobserve=function(e,t){t.unobserve()},t.observe=function(e,t){var r,o=function(e){return a.get(e)}(e);if(o){var s=function(e,t){return e.observers.get(t)}(o,t);r=s&&s.observer}else o=new i(e),a.set(e,o);if(r)return r;if(r={},o.value=n._deepClone(e),t){r.callback=t,r.next=null;var c=function(){u(r)},f=function(){clearTimeout(r.next),r.next=setTimeout(c)};"undefined"!=typeof window&&(window.addEventListener("mouseup",f),window.addEventListener("keyup",f),window.addEventListener("mousedown",f),window.addEventListener("keydown",f),window.addEventListener("change",f))}return r.patches=[],r.object=e,r.unobserve=function(){u(r),clearTimeout(r.next),function(e,t){e.observers.delete(t.callback)}(o,r),"undefined"!=typeof window&&(window.removeEventListener("mouseup",f),window.removeEventListener("keyup",f),window.removeEventListener("mousedown",f),window.removeEventListener("keydown",f),window.removeEventListener("change",f))},o.observers.set(t,new p(t,r)),r},t.generate=u,t.compare=function(e,t,r){void 0===r&&(r=!1);var n=[];return s(e,t,n,"",r),n}}]);
|