dom-gdpr-guard
Advanced tools
Comparing version 1.0.1 to 2.0.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.domGdprGuard=t():e.domGdprGuard=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var o=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function u(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((o=o.apply(e,t||[])).next())}))},r=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},i=function(e,t){return o(void 0,void 0,void 0,(function(){var n,o,i,s,u,a;return r(this,(function(r){switch(r.label){case 0:return n=e.savior,o=e.managerFactory,[4,n.restoreOrCreate(o)];case 1:return i=r.sent(),s=t.renderManager,u=t.renderGroup,a=t.renderGuard,[2,{bound:function(e){return this[e].bind(this)},renderGuard:function(e){return a(this.bound("renderGroup"),n,e)},renderGroup:function(e){return u(this.bound("renderGuard"),n,e)},renderManager:function(e){return s(this.bound("renderGroup"),n,e)}}.renderManager(i)]}}))}))}},function(e,t,n){window,e.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.None=1]="None",e[e.Cookie=2]="Cookie",e[e.LocalStorage=4]="LocalStorage",e[e.SessionStorage=8]="SessionStorage",e[e.IndexedDb=16]="IndexedDb",e[e.FileSystem=16]="FileSystem",e[e.ServerStorage=16]="ServerStorage",e[e.All=30]="All"}(o||(o={})),t.GdprStorage=o},function(e,t,n){"use strict";var o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s},i=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=function(){function e(e,t,n,o){void 0===t&&(t=""),void 0===n&&(n=!1),void 0===o&&(o=!1),this.name=e,this.description=t,this.enabled=n,this.required=o,this.bindings=new Map,this.storage=s.GdprStorage.None,this.required&&(this.enabled=!0)}return e.for=function(t,n,o,r){return void 0===n&&(n=""),void 0===o&&(o=!1),void 0===r&&(r=!1),new e(t,n,o,r)},e.prototype.addGuard=function(e){return this.bindings.set(e.name,e),this},e.prototype.hasGuard=function(e){return this.name===e||this.bindings.has(e)},e.prototype.getGuard=function(e){return this.name===e?this:this.bindings.get(e)||null},e.prototype.doForEachGuard=function(e){return this.bindings.forEach((function(t){return e(t)})),this},e.prototype.isEnabled=function(e){var t,n;if(this.hasGuard(e)&&null!==(u=this.getGuard(e)))return u.enabled;try{for(var i=o(this.bindings),s=i.next();!s.done;s=i.next()){var u,a=r(s.value,2);if(a[0],(u=a[1]).isEnabled(e))return!0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return!1},e.prototype.enable=function(){return this.required?this:(this.enabled=!0,this.doForEachGuard((function(e){return e.enable()})))},e.prototype.disable=function(){return this.required?this:(this.enabled=!1,this.doForEachGuard((function(e){return e.disable()})))},e.prototype.toggle=function(){return this.enabled?this.disable():this.enable()},e.prototype.makeRequired=function(){return this.required=!0,this.enabled=!0,this.doForEachGuard((function(e){return e.makeRequired()}))},e.prototype.enableForStorage=function(e){return this.doForEachGuard((function(t){t.storage&e&&t.enable()}))},e.prototype.disableForStorage=function(e){return this.doForEachGuard((function(t){t.storage&e&&t.disable()}))},e.prototype.toggleForStorage=function(e){return this.doForEachGuard((function(t){if(t.storage&e)return t.toggle()}))},e.prototype.raw=function(){var e={name:this.name,description:this.description,enabled:this.enabled,required:this.required,storage:this.storage,guards:[]};return e.guards=i(this.bindings).map((function(e){var t=r(e,2);return t[0],t[1].raw()})),e},e}();t.GdprGuardGroup=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0);t.makeGuard=function(e,t,n,r,i){return void 0===n&&(n=o.GdprStorage.Cookie),void 0===r&&(r=!1),void 0===i&&(i=null),{name:e,description:t,storage:n,required:r,enabled:null===i?r:i,enable:function(){return this.enabled||this.toggle(),this},disable:function(){return this.enabled&&this.toggle(),this},toggle:function(){return this.required||(this.enabled=!this.enabled),this},makeRequired:function(){return this.required=!0,this.enabled=!0,this},isEnabled:function(e){return this.name===e&&this.enabled},enableForStorage:function(e){return this.enabled||this.toggleForStorage(e),this},disableForStorage:function(e){return this.enabled&&this.toggleForStorage(e),this},toggleForStorage:function(e){return this.storage!=e||this.required||this.toggle(),this},raw:function(){return JSON.parse(JSON.stringify(this))}}}},function(e,t,n){"use strict";var o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s},i=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),u=n(0),a=function(){function e(){this.groups=new Map,this.name="manager",this.description="Manager of GDPR guard groups",this.enabled=!0,this.storage=u.GdprStorage.None,this.required=!1}return e.create=function(t){void 0===t&&(t=[]);var n=new e;return t.forEach((function(e){return n.addGroup(e)})),n},e.prototype.createGroup=function(e,t){return void 0===t&&(t=""),this.addGroup(s.GdprGuardGroup.for(e,t))},e.prototype.addGroup=function(e){return this.groups.set(e.name,e),this},e.prototype.reduceGroupsPred=function(e){var t,n;try{for(var i=o(this.groups),s=i.next();!s.done;s=i.next()){var u=r(s.value,2);if(u[0],e(u[1]))return!0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return!1},e.prototype.forEachGroup=function(e){return this.groups.forEach((function(t){return e(t)})),this},e.prototype.hasGuard=function(e){return this.reduceGroupsPred((function(t){return t.hasGuard(e)}))},e.prototype.getGuard=function(e){var t,n;try{for(var i=o(this.groups),s=i.next();!s.done;s=i.next()){var u=r(s.value,2),a=(u[0],u[1]);if(a.hasGuard(e))return a.getGuard(e)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.hasGroup=function(e){return this.reduceGroupsPred((function(t){return t.name===e}))},e.prototype.getGroup=function(e){var t,n;try{for(var i=o(this.groups),s=i.next();!s.done;s=i.next()){var u=r(s.value,2),a=u[0],l=u[1];if(a===e)return l}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.isEnabled=function(e){return this.reduceGroupsPred((function(t){return t.isEnabled(e)}))},e.prototype.enable=function(){return this.enabled=!0,this.forEachGroup((function(e){return e.enable()}))},e.prototype.disable=function(){return this.enabled=!1,this.forEachGroup((function(e){return e.disable()}))},e.prototype.toggle=function(){return this.enabled?this.disable():this.enable()},e.prototype.makeRequired=function(){return this},e.prototype.enableForStorage=function(e){return this.forEachGroup((function(t){return t.enableForStorage(e)}))},e.prototype.disableForStorage=function(e){return this.forEachGroup((function(t){return t.disableForStorage(e)}))},e.prototype.toggleForStorage=function(e){return this.forEachGroup((function(t){return t.toggleForStorage(e)}))},e.prototype.raw=function(){var e={enabled:this.enabled,groups:[]};return e.groups=i(this.groups).map((function(e){var t=r(e,2);return t[0],t[1].raw()})),e},e}();t.GdprManager=a},function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(5)),o(n(6)),o(n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),r=n(2),i=function(){function e(e,t,n,o){this.parent=e,this.storage=t,this.enable=n,this.require=o,this.name="",this.description="",o&&(this.enable=!0)}return e.create=function(t,n,r,i){return void 0===n&&(n=o.GdprStorage.Cookie),void 0===r&&(r=!1),void 0===i&&(i=!1),new e(t,n,r,i)},e.prototype.endGuard=function(){var e=this.require||this.enable,t=r.makeGuard(this.name,this.description,this.storage,this.require,e);return this.require&&t.makeRequired(),this.parent.guards.push(t),this.parent},e.prototype.edit=function(e){return e(this),this},e.prototype.withName=function(e){return this.edit((function(t){return t.name=e}))},e.prototype.withDescription=function(e){return this.edit((function(t){return t.description=e}))},e.prototype.enabled=function(){return this.edit((function(e){return e.enable=!0}))},e.prototype.disabled=function(){return this.edit((function(e){return e.enable=!1}))},e.prototype.storedIn=function(e){return this.edit((function(t){return t.storage=e}))},e.prototype.required=function(){return this.edit((function(e){return e.require=!0}))},e}();t.GdprGuardBuilder=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),r=n(3),i=n(4),s=function(){function e(){this.storage=o.GdprStorage.Cookie,this.groups=[]}return e.make=function(){return new e},e.prototype.startGroup=function(e,t,n,o){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),void 0===o&&(o=!0),i.GdprGroupBuilder.create(this,t,n,e,o,!1)},e.prototype.startRequiredGroup=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),this.startEnabledGroup(e,t,n).required()},e.prototype.startEnabledGroup=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),this.startGroup(e,t,n,!0).enabled()},e.prototype.startDisabledGroup=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),this.startGroup(e,t,n,!1).disabled()},e.prototype.build=function(){return r.GdprManager.create(this.groups)},e.prototype.endGroup=function(){return this},e}();t.GdprManagerBuilder=s},function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(2)),o(n(1)),o(n(3)),o(n(0)),o(n(4)),o(n(9)),o(n(10))},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s},s=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0),a=n(6),l=n(1),c=n(5),d=function(e){function t(t,n,o,r,i,s){var u=e.call(this)||this;return u.parent=t,u.name=n,u.description=o,u.enable=i,u.require=s,u.guards=[],u.storage=r,s&&(u.enable=!0),u}return r(t,e),t.prototype.startGroup=function(t,n,o){return void 0===t&&(t=null),void 0===n&&(n=""),void 0===o&&(o=""),e.prototype.startGroup.call(this,t||this.parent.storage,n,o)},t.prototype.startRequiredGroup=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),this.startGroup(e,t,n).required()},t.create=function(e,n,o,r,i,s){return void 0===o&&(o=""),void 0===r&&(r=null),void 0===i&&(i=!0),void 0===s&&(s=!1),new t(e,n,o,r||u.GdprStorage.Cookie,i,s)},t.prototype.endGroup=function(){var e=this.require||this.enable,t=l.GdprGuardGroup.for(this.name,this.description,e,this.require);return s(this.guards,this.groups).forEach((function(e){return t.addGuard(e)})),this.require&&t.makeRequired(),this.parent.groups.push(t),this.parent},t.prototype.edit=function(e){return e(this),this},t.prototype.withName=function(e){return this.edit((function(t){return t.name=e}))},t.prototype.withDescription=function(e){return this.edit((function(t){return t.description=e}))},t.prototype.storedIn=function(e){return this.edit((function(t){return t.storage=e}))},t.prototype.enabled=function(){return this.edit((function(e){return e.enable=!0}))},t.prototype.disabled=function(){return this.edit((function(e){return e.enable=!1}))},t.prototype.required=function(){return this.edit((function(e){return e.require=!0}))},t.prototype.startGuard=function(e){return void 0===e&&(e=null),c.GdprGuardBuilder.create(this,e||this.storage,this.enable)},t.prototype.startRequiredGuard=function(e){return this.startGuard(e).required()},t.prototype.withEnabledGuard=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=null),this.startGuard(n).withName(e).withDescription(t).enabled().endGuard()},t.prototype.withDisabledGuard=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=null),this.startGuard(n).withName(e).withDescription(t).disabled().endGuard()},t}(a.GdprManagerBuilder);t.GdprGroupBuilder=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),r=n(0),i=n(1),s=n(2),u=function(){function e(){}return e.manager=function(e){var t=this;if(!["enabled","groups"].every((function(t){return t in e}))||"boolean"!=typeof e.enabled||!Array.isArray(e.groups))return null;var n=e.groups.map((function(e){return t.group(e)})).filter((function(e){return null!==e})),r=o.GdprManager.create([]);return r.enabled=!!e.enabled,n.length?(n.forEach((function(e){return r.addGroup(e)})),r):null},e.group=function(e){var t=this,n=this.guard(e);if(null===n)return null;var o=["guards"];if(!o.every((function(t){return t in e}))||!Array.isArray(e.guards))return null;var r=i.GdprGuardGroup.for(n.name,n.description,n.enabled,n.required),s=e.guards.map((function(e){return o.every((function(t){return t in e}))?t.group(e):t.guard(e)})).filter((function(e){return null!==e}));return s.length?(s.forEach((function(e){return r.addGuard(e)})),r):null},e.guard=function(e){return["name","enabled","required","description","storage"].every((function(t){return t in e}))&&"string"==typeof e.name&&"boolean"==typeof e.enabled&&"boolean"==typeof e.required&&"string"==typeof e.description&&"number"==typeof e.storage&&e.storage in r.GdprStorage?s.makeGuard(e.name,e.description,e.storage,!!e.required,!!e.enabled):null},e}();t.GdprDeserializer=u},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function u(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.prototype.exists=function(e){return void 0===e&&(e=!0),o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.restore(e)];case 1:return[2,null!==t.sent()]}}))}))},e.prototype.storeIfNotExists=function(e){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.exists()];case 1:return[2,!!t.sent()||this.store(e)]}}))}))},e.prototype.restoreOrCreate=function(e){return o(this,void 0,void 0,(function(){var t,n;return r(this,(function(o){switch(o.label){case 0:return[4,this.restore()];case 1:return(t=o.sent())?[3,3]:[4,e()];case 2:return n=o.sent(),this.updateSharedManager(n),[2,n];case 3:return[2,t]}}))}))},e.prototype.check=function(){return o(this,void 0,void 0,(function(){var e=this;return r(this,(function(t){switch(t.label){case 0:return[4,Promise.resolve()];case 1:return t.sent(),setTimeout((function(){e.exists(!0)}),100),[2]}}))}))},e}();t.GdprSaviorAdapter=i}])},function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return C})),n.d(t,"b",(function(){return q}));var o=n(0);function r(e,t,n){let o;return"#text"===e.nodeName?o=n.document.createTextNode(e.data):"#comment"===e.nodeName?o=n.document.createComment(e.data):("svg"===e.nodeName||t?(o=n.document.createElementNS("http://www.w3.org/2000/svg",e.nodeName),t=!0):o=n.document.createElement(e.nodeName),e.attributes&&Object.entries(e.attributes).forEach(([e,t])=>o.setAttribute(e,t)),e.childNodes&&e.childNodes.forEach(e=>o.appendChild(r(e,t,n))),n.valueDiffing&&(e.value&&(o.value=e.value),e.checked&&(o.checked=e.checked),e.selected&&(o.selected=e.selected))),o}function i(e,t){for(t=t.slice();t.length>0;){if(!e.childNodes)return!1;const n=t.splice(0,1)[0];e=e.childNodes[n]}return e}function s(e,t,n){let o,s,u,a,l,c=i(e,t[n._const.route]);const d={diff:t,node:c};if(n.preDiffApply(d))return!0;switch(t[n._const.action]){case n._const.addAttribute:if(!c||!c.setAttribute)return!1;c.setAttribute(t[n._const.name],t[n._const.value]);break;case n._const.modifyAttribute:if(!c||!c.setAttribute)return!1;c.setAttribute(t[n._const.name],t[n._const.newValue]),"INPUT"===c.nodeName&&"value"===t[n._const.name]&&(c.value=t[n._const.newValue]);break;case n._const.removeAttribute:if(!c||!c.removeAttribute)return!1;c.removeAttribute(t[n._const.name]);break;case n._const.modifyTextElement:if(!c||3!==c.nodeType)return!1;n.textDiff(c,c.data,t[n._const.oldValue],t[n._const.newValue]);break;case n._const.modifyValue:if(!c||void 0===c.value)return!1;c.value=t[n._const.newValue];break;case n._const.modifyComment:if(!c||void 0===c.data)return!1;n.textDiff(c,c.data,t[n._const.oldValue],t[n._const.newValue]);break;case n._const.modifyChecked:if(!c||void 0===c.checked)return!1;c.checked=t[n._const.newValue];break;case n._const.modifySelected:if(!c||void 0===c.selected)return!1;c.selected=t[n._const.newValue];break;case n._const.replaceElement:c.parentNode.replaceChild(r(t[n._const.newValue],"http://www.w3.org/2000/svg"===c.namespaceURI,n),c);break;case n._const.relocateGroup:a=Array(...new Array(t.groupLength)).map(()=>c.removeChild(c.childNodes[t[n._const.from]])),a.forEach((e,o)=>{0===o&&(s=c.childNodes[t[n._const.to]]),c.insertBefore(e,s||null)});break;case n._const.removeElement:c.parentNode.removeChild(c);break;case n._const.addElement:u=t[n._const.route].slice(),l=u.splice(u.length-1,1)[0],c=i(e,u),c.insertBefore(r(t[n._const.element],"http://www.w3.org/2000/svg"===c.namespaceURI,n),c.childNodes[l]||null);break;case n._const.removeTextElement:if(!c||3!==c.nodeType)return!1;c.parentNode.removeChild(c);break;case n._const.addTextElement:if(u=t[n._const.route].slice(),l=u.splice(u.length-1,1)[0],o=n.document.createTextNode(t[n._const.value]),c=i(e,u),!c||!c.childNodes)return!1;c.insertBefore(o,c.childNodes[l]||null);break;default:console.log("unknown action")}return d.newNode=o,n.postDiffApply(d),!0}function u(e,t,n){const o=e[t];e[t]=e[n],e[n]=o}function a(e,t,n){t.length||(t=[t]),(t=t.slice()).reverse(),t.forEach(t=>{!function(e,t,n){switch(t[n._const.action]){case n._const.addAttribute:t[n._const.action]=n._const.removeAttribute,s(e,t,n);break;case n._const.modifyAttribute:u(t,n._const.oldValue,n._const.newValue),s(e,t,n);break;case n._const.removeAttribute:t[n._const.action]=n._const.addAttribute,s(e,t,n);break;case n._const.modifyTextElement:case n._const.modifyValue:case n._const.modifyComment:case n._const.modifyChecked:case n._const.modifySelected:case n._const.replaceElement:u(t,n._const.oldValue,n._const.newValue),s(e,t,n);break;case n._const.relocateGroup:u(t,n._const.from,n._const.to),s(e,t,n);break;case n._const.removeElement:t[n._const.action]=n._const.addElement,s(e,t,n);break;case n._const.addElement:t[n._const.action]=n._const.removeElement,s(e,t,n);break;case n._const.removeTextElement:t[n._const.action]=n._const.addTextElement,s(e,t,n);break;case n._const.addTextElement:t[n._const.action]=n._const.removeTextElement,s(e,t,n);break;default:console.log("unknown action")}}(e,t,n)})}class l{constructor(e={}){Object.entries(e).forEach(([e,t])=>this[e]=t)}toString(){return JSON.stringify(this)}setValue(e,t){return this[e]=t,this}}function c(e){const t=[];return"#text"!==e.nodeName&&"#comment"!==e.nodeName&&(t.push(e.nodeName),e.attributes&&(e.attributes.class&&t.push(`${e.nodeName}.${e.attributes.class.replace(/ /g,".")}`),e.attributes.id&&t.push(`${e.nodeName}#${e.attributes.id}`))),t}function d(e){const t={},n={};return e.forEach(e=>{c(e).forEach(e=>{const o=e in t;o||e in n?o&&(delete t[e],n[e]=!0):t[e]=!0})}),t}function h(e,t){const n=d(e),o=d(t),r={};return Object.keys(n).forEach(e=>{o[e]&&(r[e]=!0)}),r}function f(e){return delete e.outerDone,delete e.innerDone,delete e.valueDone,!e.childNodes||e.childNodes.every(f)}function p(e,t){if(!["nodeName","value","checked","selected","data"].every(n=>e[n]===t[n]))return!1;if(Boolean(e.attributes)!==Boolean(t.attributes))return!1;if(Boolean(e.childNodes)!==Boolean(t.childNodes))return!1;if(e.attributes){const n=Object.keys(e.attributes),o=Object.keys(t.attributes);if(n.length!==o.length)return!1;if(!n.every(n=>e.attributes[n]===t.attributes[n]))return!1}if(e.childNodes){if(e.childNodes.length!==t.childNodes.length)return!1;if(!e.childNodes.every((e,n)=>p(e,t.childNodes[n])))return!1}return!0}function b(e,t,n,o,r){if(!e||!t)return!1;if(e.nodeName!==t.nodeName)return!1;if("#text"===e.nodeName)return!!r||e.data===t.data;if(e.nodeName in n)return!0;if(e.attributes&&t.attributes){if(e.attributes.id){if(e.attributes.id!==t.attributes.id)return!1;if(`${e.nodeName}#${e.attributes.id}`in n)return!0}if(e.attributes.class&&e.attributes.class===t.attributes.class){if(`${e.nodeName}.${e.attributes.class.replace(/ /g,".")}`in n)return!0}}if(o)return!0;const i=e.childNodes?e.childNodes.slice().reverse():[],s=t.childNodes?t.childNodes.slice().reverse():[];if(i.length!==s.length)return!1;if(r)return i.every((e,t)=>e.nodeName===s[t].nodeName);{const e=h(i,s);return i.every((t,n)=>b(t,s[n],e,!0,!0))}}function m(e){return JSON.parse(JSON.stringify(e))}function g(e,t,n,o){let r=0,i=[];const s=e.length,u=t.length,a=Array(...new Array(s+1)).map(()=>[]),l=h(e,t);let d=s===u;d&&e.some((e,n)=>{const o=c(e),r=c(t[n]);return o.length!==r.length?(d=!1,!0):(o.some((e,t)=>{if(e!==r[t])return d=!1,!0}),!d||void 0)});for(let c=0;c<s;c++){const s=e[c];for(let e=0;e<u;e++){const u=t[e];n[c]||o[e]||!b(s,u,l,d)?a[c+1][e+1]=0:(a[c+1][e+1]=a[c][e]?a[c][e]+1:1,a[c+1][e+1]>=r&&(r=a[c+1][e+1],i=[c+1,e+1]))}}return 0!==r&&{oldValue:i[0]-r,newValue:i[1]-r,length:r}}function v(e,t){return Array(...new Array(e)).map(()=>t)}class y{constructor(){this.list=[]}add(e){this.list.push(...e)}forEach(e){this.list.forEach(t=>e(t))}}function _(e,t){let n,o,r=e;for(t=t.slice();t.length>0;){if(!r.childNodes)return!1;o=t.splice(0,1)[0],n=r,r=r.childNodes[o]}return{node:r,parentNode:n,nodeIndex:o}}function V(e,t,n){return t.forEach(t=>{!function(e,t,n){const o=_(e,t[n._const.route]);let r=o.node;const i=o.parentNode,s=o.nodeIndex,u=[],a={diff:t,node:r};if(n.preDiffApply(a))return!0;let l,c,d,h;switch(t[n._const.action]){case n._const.addAttribute:r.attributes||(r.attributes={}),r.attributes[t[n._const.name]]=t[n._const.value],"checked"===t[n._const.name]?r.checked=!0:"selected"===t[n._const.name]?r.selected=!0:"INPUT"===r.nodeName&&"value"===t[n._const.name]&&(r.value=t[n._const.value]);break;case n._const.modifyAttribute:r.attributes[t[n._const.name]]=t[n._const.newValue];break;case n._const.removeAttribute:delete r.attributes[t[n._const.name]],0===Object.keys(r.attributes).length&&delete r.attributes,"checked"===t[n._const.name]?r.checked=!1:"selected"===t[n._const.name]?delete r.selected:"INPUT"===r.nodeName&&"value"===t[n._const.name]&&delete r.value;break;case n._const.modifyTextElement:r.data=t[n._const.newValue];break;case n._const.modifyValue:r.value=t[n._const.newValue];break;case n._const.modifyComment:r.data=t[n._const.newValue];break;case n._const.modifyChecked:r.checked=t[n._const.newValue];break;case n._const.modifySelected:r.selected=t[n._const.newValue];break;case n._const.replaceElement:l=m(t[n._const.newValue]),l.outerDone=!0,l.innerDone=!0,l.valueDone=!0,i.childNodes[s]=l;break;case n._const.relocateGroup:c=r.childNodes.splice(t[n._const.from],t.groupLength).reverse(),c.forEach(e=>r.childNodes.splice(t[n._const.to],0,e)),r.subsets&&r.subsets.forEach(e=>{if(t[n._const.from]<t[n._const.to]&&e.oldValue<=t[n._const.to]&&e.oldValue>t[n._const.from]){e.oldValue-=t.groupLength;const o=e.oldValue+e.length-t[n._const.to];o>0&&(u.push({oldValue:t[n._const.to]+t.groupLength,newValue:e.newValue+e.length-o,length:o}),e.length-=o)}else if(t[n._const.from]>t[n._const.to]&&e.oldValue>t[n._const.to]&&e.oldValue<t[n._const.from]){e.oldValue+=t.groupLength;const o=e.oldValue+e.length-t[n._const.to];o>0&&(u.push({oldValue:t[n._const.to]+t.groupLength,newValue:e.newValue+e.length-o,length:o}),e.length-=o)}else e.oldValue===t[n._const.from]&&(e.oldValue=t[n._const.to])});break;case n._const.removeElement:i.childNodes.splice(s,1),i.subsets&&i.subsets.forEach(e=>{e.oldValue>s?e.oldValue-=1:e.oldValue===s?e.delete=!0:e.oldValue<s&&e.oldValue+e.length>s&&(e.oldValue+e.length-1===s?e.length--:(u.push({newValue:e.newValue+s-e.oldValue,oldValue:s,length:e.length-s+e.oldValue-1}),e.length=s-e.oldValue))}),r=i;break;case n._const.addElement:d=t[n._const.route].slice(),h=d.splice(d.length-1,1)[0],r=_(e,d).node,l=m(t[n._const.element]),l.outerDone=!0,l.innerDone=!0,l.valueDone=!0,r.childNodes||(r.childNodes=[]),h>=r.childNodes.length?r.childNodes.push(l):r.childNodes.splice(h,0,l),r.subsets&&r.subsets.forEach(e=>{if(e.oldValue>=h)e.oldValue+=1;else if(e.oldValue<h&&e.oldValue+e.length>h){const t=e.oldValue+e.length-h;u.push({newValue:e.newValue+e.length-t,oldValue:h+1,length:t}),e.length-=t}});break;case n._const.removeTextElement:i.childNodes.splice(s,1),"TEXTAREA"===i.nodeName&&delete i.value,i.subsets&&i.subsets.forEach(e=>{e.oldValue>s?e.oldValue-=1:e.oldValue===s?e.delete=!0:e.oldValue<s&&e.oldValue+e.length>s&&(e.oldValue+e.length-1===s?e.length--:(u.push({newValue:e.newValue+s-e.oldValue,oldValue:s,length:e.length-s+e.oldValue-1}),e.length=s-e.oldValue))}),r=i;break;case n._const.addTextElement:d=t[n._const.route].slice(),h=d.splice(d.length-1,1)[0],l={},l.nodeName="#text",l.data=t[n._const.value],r=_(e,d).node,r.childNodes||(r.childNodes=[]),h>=r.childNodes.length?r.childNodes.push(l):r.childNodes.splice(h,0,l),"TEXTAREA"===r.nodeName&&(r.value=t[n._const.newValue]),r.subsets&&r.subsets.forEach(e=>{if(e.oldValue>=h&&(e.oldValue+=1),e.oldValue<h&&e.oldValue+e.length>h){const t=e.oldValue+e.length-h;u.push({newValue:e.newValue+e.length-t,oldValue:h+1,length:t}),e.length-=t}});break;default:console.log("unknown action")}r.subsets&&(r.subsets=r.subsets.filter(e=>!e.delete&&e.oldValue!==e.newValue),u.length&&(r.subsets=r.subsets.concat(u))),a.newNode=l,n.postDiffApply(a)}(e,t,n)}),!0}function w(e,t={}){const n={};if(n.nodeName=e.nodeName,"#text"===n.nodeName||"#comment"===n.nodeName)n.data=e.data;else{if(e.attributes&&e.attributes.length>0){n.attributes={};Array.prototype.slice.call(e.attributes).forEach(e=>n.attributes[e.name]=e.value)}if("TEXTAREA"===n.nodeName)n.value=e.value;else if(e.childNodes&&e.childNodes.length>0){n.childNodes=[];Array.prototype.slice.call(e.childNodes).forEach(e=>n.childNodes.push(w(e,t)))}t.valueDiffing&&(void 0!==e.checked&&e.type&&["radio","checkbox"].includes(e.type.toLowerCase())?n.checked=e.checked:void 0!==e.value&&(n.value=e.value),void 0!==e.selected&&(n.selected=e.selected))}return n}const N=/<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>/g,G=Object.create?Object.create(null):{},E=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const k={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuItem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};function S(e,t={components:G}){const n=[];let o,r=-1;const i=[],s={};let u=!1;return e.replace(N,(a,l)=>{if(u){if(a!==`</${o.nodeName}>`)return;u=!1}const c="/"!==a.charAt(1),d=l+a.length,h=e.charAt(d);let f;if(c&&(r++,o=function(e){const t={nodeName:"",attributes:{}};let n=e.match(/<\/?([^\s]+?)[/\s>]/);n&&(t.nodeName=n[1].toUpperCase(),(k[n[1].toLowerCase()]||"/"===e.charAt(e.length-2))&&(t.voidElement=!0));let o=new RegExp(E),r=null,i=!1;for(;!i;)if(r=o.exec(e),null===r)i=!0;else if(r[0].trim())if(r[1]){let e=r[1].trim(),n=[e,""];e.indexOf("=")>-1&&(n=e.split("=")),t.attributes[n[0]]=n[1],o.lastIndex--}else r[2]&&(t.attributes[r[2]]=r[3].trim().substring(1,r[3].length-1));return t}(a),"tag"===o.type&&t.components[o.nodeName]&&(o.type="component",u=!0),o.voidElement||u||!h||"<"===h||(o.childNodes||(o.childNodes=[]),o.childNodes.push({nodeName:"#text",data:x(e.slice(d,e.indexOf("<",d)))})),s[o.tagName]=o,0===r&&n.push(o),f=i[r-1],f&&(f.childNodes||(f.childNodes=[]),f.childNodes.push(o)),i[r]=o),(!c||o.voidElement)&&(r--,!u&&"<"!==h&&h)){f=-1===r?n:i[r].childNodes||[];const t=e.indexOf("<",d),o=x(e.slice(d,-1===t?void 0:t));f.push({nodeName:"#text",data:o})}}),n[0]}function O(e){return function e(t){return delete t.voidElement,t.childNodes&&t.childNodes.forEach(t=>e(t)),t}(S(e))}class A{constructor(e,t,n){this.options=n,this.t1=e instanceof HTMLElement?w(e,this.options):"string"==typeof e?O(e,this.options):JSON.parse(JSON.stringify(e)),this.t2=t instanceof HTMLElement?w(t,this.options):"string"==typeof t?O(t,this.options):JSON.parse(JSON.stringify(t)),this.diffcount=0,this.foundAll=!1,this.debug&&(this.t1Orig=w(e,this.options),this.t2Orig=w(t,this.options)),this.tracker=new y}init(){return this.findDiffs(this.t1,this.t2)}findDiffs(e,t){let n;do{if(this.options.debug&&(this.diffcount+=1,this.diffcount>this.options.diffcap))throw window.diffError=[this.t1Orig,this.t2Orig],new Error(`surpassed diffcap:${JSON.stringify(this.t1Orig)} -> ${JSON.stringify(this.t2Orig)}`);n=this.findNextDiff(e,t,[]),0===n.length&&(p(e,t)||(this.foundAll?console.error("Could not find remaining diffs!"):(this.foundAll=!0,f(e),n=this.findNextDiff(e,t,[])))),n.length>0&&(this.foundAll=!1,this.tracker.add(n),V(e,n,this.options))}while(n.length>0);return this.tracker.list}findNextDiff(e,t,n){let o,r;if(this.options.maxDepth&&n.length>this.options.maxDepth)return[];if(!e.outerDone){if(o=this.findOuterDiff(e,t,n),this.options.filterOuterDiff&&(r=this.options.filterOuterDiff(e,t,o),r&&(o=r)),o.length>0)return e.outerDone=!0,o;e.outerDone=!0}if(!e.innerDone){if(o=this.findInnerDiff(e,t,n),o.length>0)return o;e.innerDone=!0}if(this.options.valueDiffing&&!e.valueDone){if(o=this.findValueDiff(e,t,n),o.length>0)return e.valueDone=!0,o;e.valueDone=!0}return[]}findOuterDiff(e,t,n){const o=[];let r,i,s,u,a,c;if(e.nodeName!==t.nodeName){if(!n.length)throw new Error("Top level nodes have to be of the same kind.");return[(new l).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,m(e)).setValue(this.options._const.newValue,m(t)).setValue(this.options._const.route,n)]}if(n.length&&this.options.maxNodeDiffCount<Math.abs((e.childNodes||[]).length-(t.childNodes||[]).length))return[(new l).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,m(e)).setValue(this.options._const.newValue,m(t)).setValue(this.options._const.route,n)];if(e.data!==t.data)return"#text"===e.nodeName?[(new l).setValue(this.options._const.action,this.options._const.modifyTextElement).setValue(this.options._const.route,n).setValue(this.options._const.oldValue,e.data).setValue(this.options._const.newValue,t.data)]:[(new l).setValue(this.options._const.action,this.options._const.modifyComment).setValue(this.options._const.route,n).setValue(this.options._const.oldValue,e.data).setValue(this.options._const.newValue,t.data)];for(i=e.attributes?Object.keys(e.attributes).sort():[],s=t.attributes?Object.keys(t.attributes).sort():[],u=i.length,c=0;c<u;c++)r=i[c],a=s.indexOf(r),-1===a?o.push((new l).setValue(this.options._const.action,this.options._const.removeAttribute).setValue(this.options._const.route,n).setValue(this.options._const.name,r).setValue(this.options._const.value,e.attributes[r])):(s.splice(a,1),e.attributes[r]!==t.attributes[r]&&o.push((new l).setValue(this.options._const.action,this.options._const.modifyAttribute).setValue(this.options._const.route,n).setValue(this.options._const.name,r).setValue(this.options._const.oldValue,e.attributes[r]).setValue(this.options._const.newValue,t.attributes[r])));for(u=s.length,c=0;c<u;c++)r=s[c],o.push((new l).setValue(this.options._const.action,this.options._const.addAttribute).setValue(this.options._const.route,n).setValue(this.options._const.name,r).setValue(this.options._const.value,t.attributes[r]));return o}findInnerDiff(e,t,n){const o=e.childNodes?e.childNodes.slice():[],r=t.childNodes?t.childNodes.slice():[],i=Math.max(o.length,r.length);let s=Math.abs(o.length-r.length),u=[],a=0;if(!this.options.maxChildCount||i<this.options.maxChildCount){const o=e.subsets&&e.subsetsAge--?e.subsets:e.childNodes&&t.childNodes?function(e,t){const n=e.childNodes?e.childNodes:[],o=t.childNodes?t.childNodes:[],r=v(n.length,!1),i=v(o.length,!1),s=[];let u=!0;const a=function(){return arguments[1]};for(;u;)if(u=g(n,o,r,i),u){s.push(u);Array(...new Array(u.length)).map(a).forEach(e=>{return t=e,r[u.oldValue+t]=!0,void(i[u.newValue+t]=!0);var t})}return e.subsets=s,e.subsetsAge=100,s}(e,t):[];if(o.length>0&&(u=this.attemptGroupRelocation(e,t,o,n),u.length>0))return u}for(let e=0;e<i;e+=1){const t=o[e],c=r[e];s&&(t&&!c?"#text"===t.nodeName?(u.push((new l).setValue(this.options._const.action,this.options._const.removeTextElement).setValue(this.options._const.route,n.concat(a)).setValue(this.options._const.value,t.data)),a-=1):(u.push((new l).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.route,n.concat(a)).setValue(this.options._const.element,m(t))),a-=1):c&&!t&&("#text"===c.nodeName?u.push((new l).setValue(this.options._const.action,this.options._const.addTextElement).setValue(this.options._const.route,n.concat(a)).setValue(this.options._const.value,c.data)):u.push((new l).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.route,n.concat(a)).setValue(this.options._const.element,m(c))))),t&&c&&(!this.options.maxChildCount||i<this.options.maxChildCount?u=u.concat(this.findNextDiff(t,c,n.concat(a))):p(t,c)||(o.length>r.length?(u=u.concat([(new l).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.element,m(t)).setValue(this.options._const.route,n.concat(a))]),o.splice(e,1),a-=1,s-=1):o.length<r.length?(u=u.concat([(new l).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.element,m(c)).setValue(this.options._const.route,n.concat(a))]),o.splice(e,0,{}),s-=1):u=u.concat([(new l).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,m(t)).setValue(this.options._const.newValue,m(c)).setValue(this.options._const.route,n.concat(a))]))),a+=1}return e.innerDone=!0,u}attemptGroupRelocation(e,t,n,o){const r=function(e,t,n){const o=e.childNodes?v(e.childNodes.length,!0):[],r=t.childNodes?v(t.childNodes.length,!0):[];let i=0;return n.forEach(e=>{const t=e.oldValue+e.length,n=e.newValue+e.length;for(let n=e.oldValue;n<t;n+=1)o[n]=i;for(let t=e.newValue;t<n;t+=1)r[t]=i;i+=1}),{gaps1:o,gaps2:r}}(e,t,n),i=r.gaps1,s=r.gaps2;let u,a,c,d,h,f,p=Math.min(i.length,s.length);const g=[];for(let r=0,v=0;r<p;v+=1,r+=1)if(!0===i[r])if(d=e.childNodes[v],"#text"===d.nodeName){if("#text"===t.childNodes[r].nodeName&&d.data!==t.childNodes[r].data){for(f=v;e.childNodes.length>f+1&&"#text"===e.childNodes[f+1].nodeName;)if(f+=1,t.childNodes[r].data===e.childNodes[f].data){h=!0;break}if(!h)return g.push((new l).setValue(this.options._const.action,this.options._const.modifyTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.oldValue,d.data).setValue(this.options._const.newValue,t.childNodes[r].data)),g}g.push((new l).setValue(this.options._const.action,this.options._const.removeTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.value,d.data)),i.splice(r,1),p=Math.min(i.length,s.length),r-=1}else g.push((new l).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.element,m(d))),i.splice(r,1),p=Math.min(i.length,s.length),r-=1;else if(!0===s[r])d=t.childNodes[r],"#text"===d.nodeName?(g.push((new l).setValue(this.options._const.action,this.options._const.addTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.value,d.data)),i.splice(r,0,!0),p=Math.min(i.length,s.length),v-=1):(g.push((new l).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.element,m(d))),i.splice(r,0,!0),p=Math.min(i.length,s.length),v-=1);else if(i[r]!==s[r]){if(g.length>0)return g;if(c=n[i[r]],a=Math.min(c.newValue,e.childNodes.length-c.length),a!==c.oldValue){u=!1;for(let t=0;t<c.length;t+=1)b(e.childNodes[a+t],e.childNodes[c.oldValue+t],[],!1,!0)||(u=!0);if(u)return[(new l).setValue(this.options._const.action,this.options._const.relocateGroup).setValue("groupLength",c.length).setValue(this.options._const.from,c.oldValue).setValue(this.options._const.to,a).setValue(this.options._const.route,o)]}}return g}findValueDiff(e,t,n){const o=[];return e.selected!==t.selected&&o.push((new l).setValue(this.options._const.action,this.options._const.modifySelected).setValue(this.options._const.oldValue,e.selected).setValue(this.options._const.newValue,t.selected).setValue(this.options._const.route,n)),(e.value||t.value)&&e.value!==t.value&&"OPTION"!==e.nodeName&&o.push((new l).setValue(this.options._const.action,this.options._const.modifyValue).setValue(this.options._const.oldValue,e.value||"").setValue(this.options._const.newValue,t.value||"").setValue(this.options._const.route,n)),e.checked!==t.checked&&o.push((new l).setValue(this.options._const.action,this.options._const.modifyChecked).setValue(this.options._const.oldValue,e.checked).setValue(this.options._const.newValue,t.checked).setValue(this.options._const.route,n)),o}}const D={debug:!1,diffcap:10,maxDepth:!1,maxChildCount:50,valueDiffing:!0,textDiff(e,t,n,o){e.data=o},preVirtualDiffApply(){},postVirtualDiffApply(){},preDiffApply(){},postDiffApply(){},filterOuterDiff:null,compress:!1,_const:!1,document:!(!window||!window.document)&&window.document};var T=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function u(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((o=o.apply(e,t||[])).next())}))},j=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},M=new class{constructor(e={}){if(this.options=e,Object.entries(D).forEach(([e,t])=>{Object.prototype.hasOwnProperty.call(this.options,e)||(this.options[e]=t)}),!this.options._const){const e=["addAttribute","modifyAttribute","removeAttribute","modifyTextElement","relocateGroup","removeElement","addElement","removeTextElement","addTextElement","replaceElement","modifyValue","modifyChecked","modifySelected","modifyComment","action","route","oldValue","newValue","element","group","from","to","name","value","data","attributes","nodeName","childNodes","checked","selected"];this.options._const={},this.options.compress?e.forEach((e,t)=>this.options._const[e]=t):e.forEach(e=>this.options._const[e]=e)}this.DiffFinder=A}apply(e,t){return function(e,t,n){return t.every(t=>s(e,t,n))}(e,t,this.options)}undo(e,t){return a(e,t,this.options)}diff(e,t){return new this.DiffFinder(e,t,this.options).init()}},C=function(e,t){if(e.childElementCount){var n=e.children.item(0),o=M.diff(n,t);M.apply(n,o)}else e.appendChild(t)},q=function(e,t,n){return T(void 0,void 0,void 0,(function(){var r;return j(this,(function(i){switch(i.label){case 0:return[4,(r=function(){return T(void 0,void 0,void 0,(function(){var r;return j(this,(function(i){switch(i.label){case 0:return[4,Object(o.a)(t,n)];case 1:return r=i.sent(),C(e,r),[2]}}))}))})()];case 1:return i.sent(),[2,r]}}))}))}},function(e,t,n){"use strict";n.r(t);var o=n(1);n.d(t,"gdprGuard",(function(){return o}));var r=n(2);for(var i in r)["gdprGuard","default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(i);var s=n(0);n.d(t,"render",(function(){return s.a}));var u=n(3);n.d(t,"mountOnTarget",(function(){return u.a})),n.d(t,"renderInside",(function(){return u.b}))}])})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.domGdprGuard=t():e.domGdprGuard=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var o=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function u(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((o=o.apply(e,t||[])).next())}))},r=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},i=function(e,t){return o(void 0,void 0,void 0,(function(){var n,o,i,s,u,a;return r(this,(function(r){switch(r.label){case 0:return n=e.savior,o=e.managerFactory,[4,n.restoreOrCreate(o)];case 1:return i=r.sent(),s=t.renderManager,u=t.renderGroup,a=t.renderGuard,[4,{bound:function(e){return this[e].bind(this)},renderGuard:function(e){return a(this.bound("renderGroup"),n,e)},renderGroup:function(e){return u(this.bound("renderGuard"),n,e)},renderManager:function(e){return s(this.bound("renderGroup"),n,e)}}.renderManager(i)];case 2:return[2,{rendered:r.sent(),manager:i}]}}))}))}},function(e,t,n){window,e.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.None=1]="None",e[e.Cookie=2]="Cookie",e[e.LocalStorage=4]="LocalStorage",e[e.SessionStorage=8]="SessionStorage",e[e.IndexedDb=16]="IndexedDb",e[e.FileSystem=16]="FileSystem",e[e.ServerStorage=16]="ServerStorage",e[e.All=30]="All"}(o||(o={})),t.GdprStorage=o},function(e,t,n){"use strict";var o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s},i=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=function(){function e(e,t,n,o){void 0===t&&(t=""),void 0===n&&(n=!1),void 0===o&&(o=!1),this.name=e,this.description=t,this.enabled=n,this.required=o,this.bindings=new Map,this.storage=s.GdprStorage.None,this.required&&(this.enabled=!0)}return e.for=function(t,n,o,r){return void 0===n&&(n=""),void 0===o&&(o=!1),void 0===r&&(r=!1),new e(t,n,o,r)},e.prototype.addGuard=function(e){return this.bindings.set(e.name,e),this},e.prototype.hasGuard=function(e){return this.name===e||this.bindings.has(e)},e.prototype.getGuard=function(e){return this.name===e?this:this.bindings.get(e)||null},e.prototype.doForEachGuard=function(e){return this.bindings.forEach((function(t){return e(t)})),this},e.prototype.isEnabled=function(e){var t,n;if(this.hasGuard(e)&&null!==(u=this.getGuard(e)))return u.enabled;try{for(var i=o(this.bindings),s=i.next();!s.done;s=i.next()){var u,a=r(s.value,2);if(a[0],(u=a[1]).isEnabled(e))return!0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return!1},e.prototype.enable=function(){return this.required?this:(this.enabled=!0,this.doForEachGuard((function(e){return e.enable()})))},e.prototype.disable=function(){return this.required?this:(this.enabled=!1,this.doForEachGuard((function(e){return e.disable()})))},e.prototype.toggle=function(){return this.enabled?this.disable():this.enable()},e.prototype.makeRequired=function(){return this.required=!0,this.enabled=!0,this.doForEachGuard((function(e){return e.makeRequired()}))},e.prototype.enableForStorage=function(e){return this.doForEachGuard((function(t){t.storage&e&&t.enable()}))},e.prototype.disableForStorage=function(e){return this.doForEachGuard((function(t){t.storage&e&&t.disable()}))},e.prototype.toggleForStorage=function(e){return this.doForEachGuard((function(t){if(t.storage&e)return t.toggle()}))},e.prototype.raw=function(){var e={name:this.name,description:this.description,enabled:this.enabled,required:this.required,storage:this.storage,guards:[]};return e.guards=i(this.bindings).map((function(e){var t=r(e,2);return t[0],t[1].raw()})),e},e}();t.GdprGuardGroup=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0);t.makeGuard=function(e,t,n,r,i){return void 0===n&&(n=o.GdprStorage.Cookie),void 0===r&&(r=!1),void 0===i&&(i=null),{name:e,description:t,storage:n,required:r,enabled:null===i?r:i,enable:function(){return this.enabled||this.toggle(),this},disable:function(){return this.enabled&&this.toggle(),this},toggle:function(){return this.required||(this.enabled=!this.enabled),this},makeRequired:function(){return this.required=!0,this.enabled=!0,this},isEnabled:function(e){return this.name===e&&this.enabled},enableForStorage:function(e){return this.enabled||this.toggleForStorage(e),this},disableForStorage:function(e){return this.enabled&&this.toggleForStorage(e),this},toggleForStorage:function(e){return this.storage!=e||this.required||this.toggle(),this},raw:function(){return JSON.parse(JSON.stringify(this))}}}},function(e,t,n){"use strict";var o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s},i=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),u=n(0),a=function(){function e(){this.groups=new Map,this.name="manager",this.description="Manager of GDPR guard groups",this.enabled=!0,this.storage=u.GdprStorage.None,this.required=!1}return e.create=function(t){void 0===t&&(t=[]);var n=new e;return t.forEach((function(e){return n.addGroup(e)})),n},e.prototype.createGroup=function(e,t){return void 0===t&&(t=""),this.addGroup(s.GdprGuardGroup.for(e,t))},e.prototype.addGroup=function(e){return this.groups.set(e.name,e),this},e.prototype.reduceGroupsPred=function(e){var t,n;try{for(var i=o(this.groups),s=i.next();!s.done;s=i.next()){var u=r(s.value,2);if(u[0],e(u[1]))return!0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return!1},e.prototype.forEachGroup=function(e){return this.groups.forEach((function(t){return e(t)})),this},e.prototype.hasGuard=function(e){return this.reduceGroupsPred((function(t){return t.hasGuard(e)}))},e.prototype.getGuard=function(e){var t,n;try{for(var i=o(this.groups),s=i.next();!s.done;s=i.next()){var u=r(s.value,2),a=(u[0],u[1]);if(a.hasGuard(e))return a.getGuard(e)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.hasGroup=function(e){return this.reduceGroupsPred((function(t){return t.name===e}))},e.prototype.getGroup=function(e){var t,n;try{for(var i=o(this.groups),s=i.next();!s.done;s=i.next()){var u=r(s.value,2),a=u[0],l=u[1];if(a===e)return l}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.isEnabled=function(e){return this.reduceGroupsPred((function(t){return t.isEnabled(e)}))},e.prototype.enable=function(){return this.enabled=!0,this.forEachGroup((function(e){return e.enable()}))},e.prototype.disable=function(){return this.enabled=!1,this.forEachGroup((function(e){return e.disable()}))},e.prototype.toggle=function(){return this.enabled?this.disable():this.enable()},e.prototype.makeRequired=function(){return this},e.prototype.enableForStorage=function(e){return this.forEachGroup((function(t){return t.enableForStorage(e)}))},e.prototype.disableForStorage=function(e){return this.forEachGroup((function(t){return t.disableForStorage(e)}))},e.prototype.toggleForStorage=function(e){return this.forEachGroup((function(t){return t.toggleForStorage(e)}))},e.prototype.raw=function(){var e={enabled:this.enabled,groups:[]};return e.groups=i(this.groups).map((function(e){var t=r(e,2);return t[0],t[1].raw()})),e},e}();t.GdprManager=a},function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(5)),o(n(6)),o(n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),r=n(2),i=function(){function e(e,t,n,o){this.parent=e,this.storage=t,this.enable=n,this.require=o,this.name="",this.description="",o&&(this.enable=!0)}return e.create=function(t,n,r,i){return void 0===n&&(n=o.GdprStorage.Cookie),void 0===r&&(r=!1),void 0===i&&(i=!1),new e(t,n,r,i)},e.prototype.endGuard=function(){var e=this.require||this.enable,t=r.makeGuard(this.name,this.description,this.storage,this.require,e);return this.require&&t.makeRequired(),this.parent.guards.push(t),this.parent},e.prototype.edit=function(e){return e(this),this},e.prototype.withName=function(e){return this.edit((function(t){return t.name=e}))},e.prototype.withDescription=function(e){return this.edit((function(t){return t.description=e}))},e.prototype.enabled=function(){return this.edit((function(e){return e.enable=!0}))},e.prototype.disabled=function(){return this.edit((function(e){return e.enable=!1}))},e.prototype.storedIn=function(e){return this.edit((function(t){return t.storage=e}))},e.prototype.required=function(){return this.edit((function(e){return e.require=!0}))},e}();t.GdprGuardBuilder=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),r=n(3),i=n(4),s=function(){function e(){this.storage=o.GdprStorage.Cookie,this.groups=[]}return e.make=function(){return new e},e.prototype.startGroup=function(e,t,n,o){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),void 0===o&&(o=!0),i.GdprGroupBuilder.create(this,t,n,e,o,!1)},e.prototype.startRequiredGroup=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),this.startEnabledGroup(e,t,n).required()},e.prototype.startEnabledGroup=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),this.startGroup(e,t,n,!0).enabled()},e.prototype.startDisabledGroup=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),this.startGroup(e,t,n,!1).disabled()},e.prototype.build=function(){return r.GdprManager.create(this.groups)},e.prototype.endGroup=function(){return this},e}();t.GdprManagerBuilder=s},function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(2)),o(n(1)),o(n(3)),o(n(0)),o(n(4)),o(n(9)),o(n(10))},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s},s=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0),a=n(6),l=n(1),c=n(5),d=function(e){function t(t,n,o,r,i,s){var u=e.call(this)||this;return u.parent=t,u.name=n,u.description=o,u.enable=i,u.require=s,u.guards=[],u.storage=r,s&&(u.enable=!0),u}return r(t,e),t.prototype.startGroup=function(t,n,o){return void 0===t&&(t=null),void 0===n&&(n=""),void 0===o&&(o=""),e.prototype.startGroup.call(this,t||this.parent.storage,n,o)},t.prototype.startRequiredGroup=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=""),void 0===n&&(n=""),this.startGroup(e,t,n).required()},t.create=function(e,n,o,r,i,s){return void 0===o&&(o=""),void 0===r&&(r=null),void 0===i&&(i=!0),void 0===s&&(s=!1),new t(e,n,o,r||u.GdprStorage.Cookie,i,s)},t.prototype.endGroup=function(){var e=this.require||this.enable,t=l.GdprGuardGroup.for(this.name,this.description,e,this.require);return s(this.guards,this.groups).forEach((function(e){return t.addGuard(e)})),this.require&&t.makeRequired(),this.parent.groups.push(t),this.parent},t.prototype.edit=function(e){return e(this),this},t.prototype.withName=function(e){return this.edit((function(t){return t.name=e}))},t.prototype.withDescription=function(e){return this.edit((function(t){return t.description=e}))},t.prototype.storedIn=function(e){return this.edit((function(t){return t.storage=e}))},t.prototype.enabled=function(){return this.edit((function(e){return e.enable=!0}))},t.prototype.disabled=function(){return this.edit((function(e){return e.enable=!1}))},t.prototype.required=function(){return this.edit((function(e){return e.require=!0}))},t.prototype.startGuard=function(e){return void 0===e&&(e=null),c.GdprGuardBuilder.create(this,e||this.storage,this.enable)},t.prototype.startRequiredGuard=function(e){return this.startGuard(e).required()},t.prototype.withEnabledGuard=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=null),this.startGuard(n).withName(e).withDescription(t).enabled().endGuard()},t.prototype.withDisabledGuard=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=null),this.startGuard(n).withName(e).withDescription(t).disabled().endGuard()},t}(a.GdprManagerBuilder);t.GdprGroupBuilder=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),r=n(0),i=n(1),s=n(2),u=function(){function e(){}return e.manager=function(e){var t=this;if(!["enabled","groups"].every((function(t){return t in e}))||"boolean"!=typeof e.enabled||!Array.isArray(e.groups))return null;var n=e.groups.map((function(e){return t.group(e)})).filter((function(e){return null!==e})),r=o.GdprManager.create([]);return r.enabled=!!e.enabled,n.length?(n.forEach((function(e){return r.addGroup(e)})),r):null},e.group=function(e){var t=this,n=this.guard(e);if(null===n)return null;var o=["guards"];if(!o.every((function(t){return t in e}))||!Array.isArray(e.guards))return null;var r=i.GdprGuardGroup.for(n.name,n.description,n.enabled,n.required),s=e.guards.map((function(e){return o.every((function(t){return t in e}))?t.group(e):t.guard(e)})).filter((function(e){return null!==e}));return s.length?(s.forEach((function(e){return r.addGuard(e)})),r):null},e.guard=function(e){return["name","enabled","required","description","storage"].every((function(t){return t in e}))&&"string"==typeof e.name&&"boolean"==typeof e.enabled&&"boolean"==typeof e.required&&"string"==typeof e.description&&"number"==typeof e.storage&&e.storage in r.GdprStorage?s.makeGuard(e.name,e.description,e.storage,!!e.required,!!e.enabled):null},e}();t.GdprDeserializer=u},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function u(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.prototype.exists=function(e){return void 0===e&&(e=!0),o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.restore(e)];case 1:return[2,null!==t.sent()]}}))}))},e.prototype.storeIfNotExists=function(e){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.exists()];case 1:return[2,!!t.sent()||this.store(e)]}}))}))},e.prototype.restoreOrCreate=function(e){return o(this,void 0,void 0,(function(){var t,n;return r(this,(function(o){switch(o.label){case 0:return[4,this.restore()];case 1:return(t=o.sent())?[3,3]:[4,e()];case 2:return n=o.sent(),this.updateSharedManager(n),[2,n];case 3:return[2,t]}}))}))},e.prototype.check=function(){return o(this,void 0,void 0,(function(){var e=this;return r(this,(function(t){switch(t.label){case 0:return[4,Promise.resolve()];case 1:return t.sent(),setTimeout((function(){e.exists(!0)}),100),[2]}}))}))},e}();t.GdprSaviorAdapter=i}])},function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return C})),n.d(t,"b",(function(){return q}));var o=n(0);function r(e,t,n){let o;return"#text"===e.nodeName?o=n.document.createTextNode(e.data):"#comment"===e.nodeName?o=n.document.createComment(e.data):("svg"===e.nodeName||t?(o=n.document.createElementNS("http://www.w3.org/2000/svg",e.nodeName),t=!0):o=n.document.createElement(e.nodeName),e.attributes&&Object.entries(e.attributes).forEach(([e,t])=>o.setAttribute(e,t)),e.childNodes&&e.childNodes.forEach(e=>o.appendChild(r(e,t,n))),n.valueDiffing&&(e.value&&(o.value=e.value),e.checked&&(o.checked=e.checked),e.selected&&(o.selected=e.selected))),o}function i(e,t){for(t=t.slice();t.length>0;){if(!e.childNodes)return!1;const n=t.splice(0,1)[0];e=e.childNodes[n]}return e}function s(e,t,n){let o,s,u,a,l,c=i(e,t[n._const.route]);const d={diff:t,node:c};if(n.preDiffApply(d))return!0;switch(t[n._const.action]){case n._const.addAttribute:if(!c||!c.setAttribute)return!1;c.setAttribute(t[n._const.name],t[n._const.value]);break;case n._const.modifyAttribute:if(!c||!c.setAttribute)return!1;c.setAttribute(t[n._const.name],t[n._const.newValue]),"INPUT"===c.nodeName&&"value"===t[n._const.name]&&(c.value=t[n._const.newValue]);break;case n._const.removeAttribute:if(!c||!c.removeAttribute)return!1;c.removeAttribute(t[n._const.name]);break;case n._const.modifyTextElement:if(!c||3!==c.nodeType)return!1;n.textDiff(c,c.data,t[n._const.oldValue],t[n._const.newValue]);break;case n._const.modifyValue:if(!c||void 0===c.value)return!1;c.value=t[n._const.newValue];break;case n._const.modifyComment:if(!c||void 0===c.data)return!1;n.textDiff(c,c.data,t[n._const.oldValue],t[n._const.newValue]);break;case n._const.modifyChecked:if(!c||void 0===c.checked)return!1;c.checked=t[n._const.newValue];break;case n._const.modifySelected:if(!c||void 0===c.selected)return!1;c.selected=t[n._const.newValue];break;case n._const.replaceElement:c.parentNode.replaceChild(r(t[n._const.newValue],"http://www.w3.org/2000/svg"===c.namespaceURI,n),c);break;case n._const.relocateGroup:a=Array(...new Array(t.groupLength)).map(()=>c.removeChild(c.childNodes[t[n._const.from]])),a.forEach((e,o)=>{0===o&&(s=c.childNodes[t[n._const.to]]),c.insertBefore(e,s||null)});break;case n._const.removeElement:c.parentNode.removeChild(c);break;case n._const.addElement:u=t[n._const.route].slice(),l=u.splice(u.length-1,1)[0],c=i(e,u),c.insertBefore(r(t[n._const.element],"http://www.w3.org/2000/svg"===c.namespaceURI,n),c.childNodes[l]||null);break;case n._const.removeTextElement:if(!c||3!==c.nodeType)return!1;c.parentNode.removeChild(c);break;case n._const.addTextElement:if(u=t[n._const.route].slice(),l=u.splice(u.length-1,1)[0],o=n.document.createTextNode(t[n._const.value]),c=i(e,u),!c||!c.childNodes)return!1;c.insertBefore(o,c.childNodes[l]||null);break;default:console.log("unknown action")}return d.newNode=o,n.postDiffApply(d),!0}function u(e,t,n){const o=e[t];e[t]=e[n],e[n]=o}function a(e,t,n){t.length||(t=[t]),(t=t.slice()).reverse(),t.forEach(t=>{!function(e,t,n){switch(t[n._const.action]){case n._const.addAttribute:t[n._const.action]=n._const.removeAttribute,s(e,t,n);break;case n._const.modifyAttribute:u(t,n._const.oldValue,n._const.newValue),s(e,t,n);break;case n._const.removeAttribute:t[n._const.action]=n._const.addAttribute,s(e,t,n);break;case n._const.modifyTextElement:case n._const.modifyValue:case n._const.modifyComment:case n._const.modifyChecked:case n._const.modifySelected:case n._const.replaceElement:u(t,n._const.oldValue,n._const.newValue),s(e,t,n);break;case n._const.relocateGroup:u(t,n._const.from,n._const.to),s(e,t,n);break;case n._const.removeElement:t[n._const.action]=n._const.addElement,s(e,t,n);break;case n._const.addElement:t[n._const.action]=n._const.removeElement,s(e,t,n);break;case n._const.removeTextElement:t[n._const.action]=n._const.addTextElement,s(e,t,n);break;case n._const.addTextElement:t[n._const.action]=n._const.removeTextElement,s(e,t,n);break;default:console.log("unknown action")}}(e,t,n)})}class l{constructor(e={}){Object.entries(e).forEach(([e,t])=>this[e]=t)}toString(){return JSON.stringify(this)}setValue(e,t){return this[e]=t,this}}function c(e){const t=[];return"#text"!==e.nodeName&&"#comment"!==e.nodeName&&(t.push(e.nodeName),e.attributes&&(e.attributes.class&&t.push(`${e.nodeName}.${e.attributes.class.replace(/ /g,".")}`),e.attributes.id&&t.push(`${e.nodeName}#${e.attributes.id}`))),t}function d(e){const t={},n={};return e.forEach(e=>{c(e).forEach(e=>{const o=e in t;o||e in n?o&&(delete t[e],n[e]=!0):t[e]=!0})}),t}function h(e,t){const n=d(e),o=d(t),r={};return Object.keys(n).forEach(e=>{o[e]&&(r[e]=!0)}),r}function f(e){return delete e.outerDone,delete e.innerDone,delete e.valueDone,!e.childNodes||e.childNodes.every(f)}function p(e,t){if(!["nodeName","value","checked","selected","data"].every(n=>e[n]===t[n]))return!1;if(Boolean(e.attributes)!==Boolean(t.attributes))return!1;if(Boolean(e.childNodes)!==Boolean(t.childNodes))return!1;if(e.attributes){const n=Object.keys(e.attributes),o=Object.keys(t.attributes);if(n.length!==o.length)return!1;if(!n.every(n=>e.attributes[n]===t.attributes[n]))return!1}if(e.childNodes){if(e.childNodes.length!==t.childNodes.length)return!1;if(!e.childNodes.every((e,n)=>p(e,t.childNodes[n])))return!1}return!0}function b(e,t,n,o,r){if(!e||!t)return!1;if(e.nodeName!==t.nodeName)return!1;if("#text"===e.nodeName)return!!r||e.data===t.data;if(e.nodeName in n)return!0;if(e.attributes&&t.attributes){if(e.attributes.id){if(e.attributes.id!==t.attributes.id)return!1;if(`${e.nodeName}#${e.attributes.id}`in n)return!0}if(e.attributes.class&&e.attributes.class===t.attributes.class){if(`${e.nodeName}.${e.attributes.class.replace(/ /g,".")}`in n)return!0}}if(o)return!0;const i=e.childNodes?e.childNodes.slice().reverse():[],s=t.childNodes?t.childNodes.slice().reverse():[];if(i.length!==s.length)return!1;if(r)return i.every((e,t)=>e.nodeName===s[t].nodeName);{const e=h(i,s);return i.every((t,n)=>b(t,s[n],e,!0,!0))}}function m(e){return JSON.parse(JSON.stringify(e))}function g(e,t,n,o){let r=0,i=[];const s=e.length,u=t.length,a=Array(...new Array(s+1)).map(()=>[]),l=h(e,t);let d=s===u;d&&e.some((e,n)=>{const o=c(e),r=c(t[n]);return o.length!==r.length?(d=!1,!0):(o.some((e,t)=>{if(e!==r[t])return d=!1,!0}),!d||void 0)});for(let c=0;c<s;c++){const s=e[c];for(let e=0;e<u;e++){const u=t[e];n[c]||o[e]||!b(s,u,l,d)?a[c+1][e+1]=0:(a[c+1][e+1]=a[c][e]?a[c][e]+1:1,a[c+1][e+1]>=r&&(r=a[c+1][e+1],i=[c+1,e+1]))}}return 0!==r&&{oldValue:i[0]-r,newValue:i[1]-r,length:r}}function v(e,t){return Array(...new Array(e)).map(()=>t)}class y{constructor(){this.list=[]}add(e){this.list.push(...e)}forEach(e){this.list.forEach(t=>e(t))}}function _(e,t){let n,o,r=e;for(t=t.slice();t.length>0;){if(!r.childNodes)return!1;o=t.splice(0,1)[0],n=r,r=r.childNodes[o]}return{node:r,parentNode:n,nodeIndex:o}}function V(e,t,n){return t.forEach(t=>{!function(e,t,n){const o=_(e,t[n._const.route]);let r=o.node;const i=o.parentNode,s=o.nodeIndex,u=[],a={diff:t,node:r};if(n.preDiffApply(a))return!0;let l,c,d,h;switch(t[n._const.action]){case n._const.addAttribute:r.attributes||(r.attributes={}),r.attributes[t[n._const.name]]=t[n._const.value],"checked"===t[n._const.name]?r.checked=!0:"selected"===t[n._const.name]?r.selected=!0:"INPUT"===r.nodeName&&"value"===t[n._const.name]&&(r.value=t[n._const.value]);break;case n._const.modifyAttribute:r.attributes[t[n._const.name]]=t[n._const.newValue];break;case n._const.removeAttribute:delete r.attributes[t[n._const.name]],0===Object.keys(r.attributes).length&&delete r.attributes,"checked"===t[n._const.name]?r.checked=!1:"selected"===t[n._const.name]?delete r.selected:"INPUT"===r.nodeName&&"value"===t[n._const.name]&&delete r.value;break;case n._const.modifyTextElement:r.data=t[n._const.newValue];break;case n._const.modifyValue:r.value=t[n._const.newValue];break;case n._const.modifyComment:r.data=t[n._const.newValue];break;case n._const.modifyChecked:r.checked=t[n._const.newValue];break;case n._const.modifySelected:r.selected=t[n._const.newValue];break;case n._const.replaceElement:l=m(t[n._const.newValue]),l.outerDone=!0,l.innerDone=!0,l.valueDone=!0,i.childNodes[s]=l;break;case n._const.relocateGroup:c=r.childNodes.splice(t[n._const.from],t.groupLength).reverse(),c.forEach(e=>r.childNodes.splice(t[n._const.to],0,e)),r.subsets&&r.subsets.forEach(e=>{if(t[n._const.from]<t[n._const.to]&&e.oldValue<=t[n._const.to]&&e.oldValue>t[n._const.from]){e.oldValue-=t.groupLength;const o=e.oldValue+e.length-t[n._const.to];o>0&&(u.push({oldValue:t[n._const.to]+t.groupLength,newValue:e.newValue+e.length-o,length:o}),e.length-=o)}else if(t[n._const.from]>t[n._const.to]&&e.oldValue>t[n._const.to]&&e.oldValue<t[n._const.from]){e.oldValue+=t.groupLength;const o=e.oldValue+e.length-t[n._const.to];o>0&&(u.push({oldValue:t[n._const.to]+t.groupLength,newValue:e.newValue+e.length-o,length:o}),e.length-=o)}else e.oldValue===t[n._const.from]&&(e.oldValue=t[n._const.to])});break;case n._const.removeElement:i.childNodes.splice(s,1),i.subsets&&i.subsets.forEach(e=>{e.oldValue>s?e.oldValue-=1:e.oldValue===s?e.delete=!0:e.oldValue<s&&e.oldValue+e.length>s&&(e.oldValue+e.length-1===s?e.length--:(u.push({newValue:e.newValue+s-e.oldValue,oldValue:s,length:e.length-s+e.oldValue-1}),e.length=s-e.oldValue))}),r=i;break;case n._const.addElement:d=t[n._const.route].slice(),h=d.splice(d.length-1,1)[0],r=_(e,d).node,l=m(t[n._const.element]),l.outerDone=!0,l.innerDone=!0,l.valueDone=!0,r.childNodes||(r.childNodes=[]),h>=r.childNodes.length?r.childNodes.push(l):r.childNodes.splice(h,0,l),r.subsets&&r.subsets.forEach(e=>{if(e.oldValue>=h)e.oldValue+=1;else if(e.oldValue<h&&e.oldValue+e.length>h){const t=e.oldValue+e.length-h;u.push({newValue:e.newValue+e.length-t,oldValue:h+1,length:t}),e.length-=t}});break;case n._const.removeTextElement:i.childNodes.splice(s,1),"TEXTAREA"===i.nodeName&&delete i.value,i.subsets&&i.subsets.forEach(e=>{e.oldValue>s?e.oldValue-=1:e.oldValue===s?e.delete=!0:e.oldValue<s&&e.oldValue+e.length>s&&(e.oldValue+e.length-1===s?e.length--:(u.push({newValue:e.newValue+s-e.oldValue,oldValue:s,length:e.length-s+e.oldValue-1}),e.length=s-e.oldValue))}),r=i;break;case n._const.addTextElement:d=t[n._const.route].slice(),h=d.splice(d.length-1,1)[0],l={},l.nodeName="#text",l.data=t[n._const.value],r=_(e,d).node,r.childNodes||(r.childNodes=[]),h>=r.childNodes.length?r.childNodes.push(l):r.childNodes.splice(h,0,l),"TEXTAREA"===r.nodeName&&(r.value=t[n._const.newValue]),r.subsets&&r.subsets.forEach(e=>{if(e.oldValue>=h&&(e.oldValue+=1),e.oldValue<h&&e.oldValue+e.length>h){const t=e.oldValue+e.length-h;u.push({newValue:e.newValue+e.length-t,oldValue:h+1,length:t}),e.length-=t}});break;default:console.log("unknown action")}r.subsets&&(r.subsets=r.subsets.filter(e=>!e.delete&&e.oldValue!==e.newValue),u.length&&(r.subsets=r.subsets.concat(u))),a.newNode=l,n.postDiffApply(a)}(e,t,n)}),!0}function w(e,t={}){const n={};if(n.nodeName=e.nodeName,"#text"===n.nodeName||"#comment"===n.nodeName)n.data=e.data;else{if(e.attributes&&e.attributes.length>0){n.attributes={};Array.prototype.slice.call(e.attributes).forEach(e=>n.attributes[e.name]=e.value)}if("TEXTAREA"===n.nodeName)n.value=e.value;else if(e.childNodes&&e.childNodes.length>0){n.childNodes=[];Array.prototype.slice.call(e.childNodes).forEach(e=>n.childNodes.push(w(e,t)))}t.valueDiffing&&(void 0!==e.checked&&e.type&&["radio","checkbox"].includes(e.type.toLowerCase())?n.checked=e.checked:void 0!==e.value&&(n.value=e.value),void 0!==e.selected&&(n.selected=e.selected))}return n}const N=/<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>/g,G=Object.create?Object.create(null):{},E=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const k={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuItem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};function S(e,t={components:G}){const n=[];let o,r=-1;const i=[],s={};let u=!1;return e.replace(N,(a,l)=>{if(u){if(a!==`</${o.nodeName}>`)return;u=!1}const c="/"!==a.charAt(1),d=l+a.length,h=e.charAt(d);let f;if(c&&(r++,o=function(e){const t={nodeName:"",attributes:{}};let n=e.match(/<\/?([^\s]+?)[/\s>]/);n&&(t.nodeName=n[1].toUpperCase(),(k[n[1].toLowerCase()]||"/"===e.charAt(e.length-2))&&(t.voidElement=!0));let o=new RegExp(E),r=null,i=!1;for(;!i;)if(r=o.exec(e),null===r)i=!0;else if(r[0].trim())if(r[1]){let e=r[1].trim(),n=[e,""];e.indexOf("=")>-1&&(n=e.split("=")),t.attributes[n[0]]=n[1],o.lastIndex--}else r[2]&&(t.attributes[r[2]]=r[3].trim().substring(1,r[3].length-1));return t}(a),"tag"===o.type&&t.components[o.nodeName]&&(o.type="component",u=!0),o.voidElement||u||!h||"<"===h||(o.childNodes||(o.childNodes=[]),o.childNodes.push({nodeName:"#text",data:x(e.slice(d,e.indexOf("<",d)))})),s[o.tagName]=o,0===r&&n.push(o),f=i[r-1],f&&(f.childNodes||(f.childNodes=[]),f.childNodes.push(o)),i[r]=o),(!c||o.voidElement)&&(r--,!u&&"<"!==h&&h)){f=-1===r?n:i[r].childNodes||[];const t=e.indexOf("<",d),o=x(e.slice(d,-1===t?void 0:t));f.push({nodeName:"#text",data:o})}}),n[0]}function O(e){return function e(t){return delete t.voidElement,t.childNodes&&t.childNodes.forEach(t=>e(t)),t}(S(e))}class A{constructor(e,t,n){this.options=n,this.t1=e instanceof HTMLElement?w(e,this.options):"string"==typeof e?O(e,this.options):JSON.parse(JSON.stringify(e)),this.t2=t instanceof HTMLElement?w(t,this.options):"string"==typeof t?O(t,this.options):JSON.parse(JSON.stringify(t)),this.diffcount=0,this.foundAll=!1,this.debug&&(this.t1Orig=w(e,this.options),this.t2Orig=w(t,this.options)),this.tracker=new y}init(){return this.findDiffs(this.t1,this.t2)}findDiffs(e,t){let n;do{if(this.options.debug&&(this.diffcount+=1,this.diffcount>this.options.diffcap))throw window.diffError=[this.t1Orig,this.t2Orig],new Error(`surpassed diffcap:${JSON.stringify(this.t1Orig)} -> ${JSON.stringify(this.t2Orig)}`);n=this.findNextDiff(e,t,[]),0===n.length&&(p(e,t)||(this.foundAll?console.error("Could not find remaining diffs!"):(this.foundAll=!0,f(e),n=this.findNextDiff(e,t,[])))),n.length>0&&(this.foundAll=!1,this.tracker.add(n),V(e,n,this.options))}while(n.length>0);return this.tracker.list}findNextDiff(e,t,n){let o,r;if(this.options.maxDepth&&n.length>this.options.maxDepth)return[];if(!e.outerDone){if(o=this.findOuterDiff(e,t,n),this.options.filterOuterDiff&&(r=this.options.filterOuterDiff(e,t,o),r&&(o=r)),o.length>0)return e.outerDone=!0,o;e.outerDone=!0}if(!e.innerDone){if(o=this.findInnerDiff(e,t,n),o.length>0)return o;e.innerDone=!0}if(this.options.valueDiffing&&!e.valueDone){if(o=this.findValueDiff(e,t,n),o.length>0)return e.valueDone=!0,o;e.valueDone=!0}return[]}findOuterDiff(e,t,n){const o=[];let r,i,s,u,a,c;if(e.nodeName!==t.nodeName){if(!n.length)throw new Error("Top level nodes have to be of the same kind.");return[(new l).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,m(e)).setValue(this.options._const.newValue,m(t)).setValue(this.options._const.route,n)]}if(n.length&&this.options.maxNodeDiffCount<Math.abs((e.childNodes||[]).length-(t.childNodes||[]).length))return[(new l).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,m(e)).setValue(this.options._const.newValue,m(t)).setValue(this.options._const.route,n)];if(e.data!==t.data)return"#text"===e.nodeName?[(new l).setValue(this.options._const.action,this.options._const.modifyTextElement).setValue(this.options._const.route,n).setValue(this.options._const.oldValue,e.data).setValue(this.options._const.newValue,t.data)]:[(new l).setValue(this.options._const.action,this.options._const.modifyComment).setValue(this.options._const.route,n).setValue(this.options._const.oldValue,e.data).setValue(this.options._const.newValue,t.data)];for(i=e.attributes?Object.keys(e.attributes).sort():[],s=t.attributes?Object.keys(t.attributes).sort():[],u=i.length,c=0;c<u;c++)r=i[c],a=s.indexOf(r),-1===a?o.push((new l).setValue(this.options._const.action,this.options._const.removeAttribute).setValue(this.options._const.route,n).setValue(this.options._const.name,r).setValue(this.options._const.value,e.attributes[r])):(s.splice(a,1),e.attributes[r]!==t.attributes[r]&&o.push((new l).setValue(this.options._const.action,this.options._const.modifyAttribute).setValue(this.options._const.route,n).setValue(this.options._const.name,r).setValue(this.options._const.oldValue,e.attributes[r]).setValue(this.options._const.newValue,t.attributes[r])));for(u=s.length,c=0;c<u;c++)r=s[c],o.push((new l).setValue(this.options._const.action,this.options._const.addAttribute).setValue(this.options._const.route,n).setValue(this.options._const.name,r).setValue(this.options._const.value,t.attributes[r]));return o}findInnerDiff(e,t,n){const o=e.childNodes?e.childNodes.slice():[],r=t.childNodes?t.childNodes.slice():[],i=Math.max(o.length,r.length);let s=Math.abs(o.length-r.length),u=[],a=0;if(!this.options.maxChildCount||i<this.options.maxChildCount){const o=e.subsets&&e.subsetsAge--?e.subsets:e.childNodes&&t.childNodes?function(e,t){const n=e.childNodes?e.childNodes:[],o=t.childNodes?t.childNodes:[],r=v(n.length,!1),i=v(o.length,!1),s=[];let u=!0;const a=function(){return arguments[1]};for(;u;)if(u=g(n,o,r,i),u){s.push(u);Array(...new Array(u.length)).map(a).forEach(e=>{return t=e,r[u.oldValue+t]=!0,void(i[u.newValue+t]=!0);var t})}return e.subsets=s,e.subsetsAge=100,s}(e,t):[];if(o.length>0&&(u=this.attemptGroupRelocation(e,t,o,n),u.length>0))return u}for(let e=0;e<i;e+=1){const t=o[e],c=r[e];s&&(t&&!c?"#text"===t.nodeName?(u.push((new l).setValue(this.options._const.action,this.options._const.removeTextElement).setValue(this.options._const.route,n.concat(a)).setValue(this.options._const.value,t.data)),a-=1):(u.push((new l).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.route,n.concat(a)).setValue(this.options._const.element,m(t))),a-=1):c&&!t&&("#text"===c.nodeName?u.push((new l).setValue(this.options._const.action,this.options._const.addTextElement).setValue(this.options._const.route,n.concat(a)).setValue(this.options._const.value,c.data)):u.push((new l).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.route,n.concat(a)).setValue(this.options._const.element,m(c))))),t&&c&&(!this.options.maxChildCount||i<this.options.maxChildCount?u=u.concat(this.findNextDiff(t,c,n.concat(a))):p(t,c)||(o.length>r.length?(u=u.concat([(new l).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.element,m(t)).setValue(this.options._const.route,n.concat(a))]),o.splice(e,1),a-=1,s-=1):o.length<r.length?(u=u.concat([(new l).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.element,m(c)).setValue(this.options._const.route,n.concat(a))]),o.splice(e,0,{}),s-=1):u=u.concat([(new l).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,m(t)).setValue(this.options._const.newValue,m(c)).setValue(this.options._const.route,n.concat(a))]))),a+=1}return e.innerDone=!0,u}attemptGroupRelocation(e,t,n,o){const r=function(e,t,n){const o=e.childNodes?v(e.childNodes.length,!0):[],r=t.childNodes?v(t.childNodes.length,!0):[];let i=0;return n.forEach(e=>{const t=e.oldValue+e.length,n=e.newValue+e.length;for(let n=e.oldValue;n<t;n+=1)o[n]=i;for(let t=e.newValue;t<n;t+=1)r[t]=i;i+=1}),{gaps1:o,gaps2:r}}(e,t,n),i=r.gaps1,s=r.gaps2;let u,a,c,d,h,f,p=Math.min(i.length,s.length);const g=[];for(let r=0,v=0;r<p;v+=1,r+=1)if(!0===i[r])if(d=e.childNodes[v],"#text"===d.nodeName){if("#text"===t.childNodes[r].nodeName&&d.data!==t.childNodes[r].data){for(f=v;e.childNodes.length>f+1&&"#text"===e.childNodes[f+1].nodeName;)if(f+=1,t.childNodes[r].data===e.childNodes[f].data){h=!0;break}if(!h)return g.push((new l).setValue(this.options._const.action,this.options._const.modifyTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.oldValue,d.data).setValue(this.options._const.newValue,t.childNodes[r].data)),g}g.push((new l).setValue(this.options._const.action,this.options._const.removeTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.value,d.data)),i.splice(r,1),p=Math.min(i.length,s.length),r-=1}else g.push((new l).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.element,m(d))),i.splice(r,1),p=Math.min(i.length,s.length),r-=1;else if(!0===s[r])d=t.childNodes[r],"#text"===d.nodeName?(g.push((new l).setValue(this.options._const.action,this.options._const.addTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.value,d.data)),i.splice(r,0,!0),p=Math.min(i.length,s.length),v-=1):(g.push((new l).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.element,m(d))),i.splice(r,0,!0),p=Math.min(i.length,s.length),v-=1);else if(i[r]!==s[r]){if(g.length>0)return g;if(c=n[i[r]],a=Math.min(c.newValue,e.childNodes.length-c.length),a!==c.oldValue){u=!1;for(let t=0;t<c.length;t+=1)b(e.childNodes[a+t],e.childNodes[c.oldValue+t],[],!1,!0)||(u=!0);if(u)return[(new l).setValue(this.options._const.action,this.options._const.relocateGroup).setValue("groupLength",c.length).setValue(this.options._const.from,c.oldValue).setValue(this.options._const.to,a).setValue(this.options._const.route,o)]}}return g}findValueDiff(e,t,n){const o=[];return e.selected!==t.selected&&o.push((new l).setValue(this.options._const.action,this.options._const.modifySelected).setValue(this.options._const.oldValue,e.selected).setValue(this.options._const.newValue,t.selected).setValue(this.options._const.route,n)),(e.value||t.value)&&e.value!==t.value&&"OPTION"!==e.nodeName&&o.push((new l).setValue(this.options._const.action,this.options._const.modifyValue).setValue(this.options._const.oldValue,e.value||"").setValue(this.options._const.newValue,t.value||"").setValue(this.options._const.route,n)),e.checked!==t.checked&&o.push((new l).setValue(this.options._const.action,this.options._const.modifyChecked).setValue(this.options._const.oldValue,e.checked).setValue(this.options._const.newValue,t.checked).setValue(this.options._const.route,n)),o}}const D={debug:!1,diffcap:10,maxDepth:!1,maxChildCount:50,valueDiffing:!0,textDiff(e,t,n,o){e.data=o},preVirtualDiffApply(){},postVirtualDiffApply(){},preDiffApply(){},postDiffApply(){},filterOuterDiff:null,compress:!1,_const:!1,document:!(!window||!window.document)&&window.document};var T=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function u(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((o=o.apply(e,t||[])).next())}))},j=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},M=new class{constructor(e={}){if(this.options=e,Object.entries(D).forEach(([e,t])=>{Object.prototype.hasOwnProperty.call(this.options,e)||(this.options[e]=t)}),!this.options._const){const e=["addAttribute","modifyAttribute","removeAttribute","modifyTextElement","relocateGroup","removeElement","addElement","removeTextElement","addTextElement","replaceElement","modifyValue","modifyChecked","modifySelected","modifyComment","action","route","oldValue","newValue","element","group","from","to","name","value","data","attributes","nodeName","childNodes","checked","selected"];this.options._const={},this.options.compress?e.forEach((e,t)=>this.options._const[e]=t):e.forEach(e=>this.options._const[e]=e)}this.DiffFinder=A}apply(e,t){return function(e,t,n){return t.every(t=>s(e,t,n))}(e,t,this.options)}undo(e,t){return a(e,t,this.options)}diff(e,t){return new this.DiffFinder(e,t,this.options).init()}},C=function(e,t){if(e.childElementCount){var n=e.children.item(0),o=M.diff(n,t);M.apply(n,o)}else e.appendChild(t)},q=function(e,t,n){return T(void 0,void 0,void 0,(function(){var r,i;return j(this,(function(s){switch(s.label){case 0:return[4,(r=function(){return T(void 0,void 0,void 0,(function(){var r,i,s;return j(this,(function(u){switch(u.label){case 0:return[4,Object(o.a)(t,n)];case 1:return r=u.sent(),i=r.rendered,s=r.manager,C(e,i),[2,s]}}))}))})()];case 1:return i=s.sent(),[2,{render:r,manager:i}]}}))}))}},function(e,t,n){"use strict";n.r(t);var o=n(1);n.d(t,"gdprGuard",(function(){return o}));var r=n(2);for(var i in r)["gdprGuard","default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(i);var s=n(0);n.d(t,"render",(function(){return s.a}));var u=n(3);n.d(t,"mountOnTarget",(function(){return u.a})),n.d(t,"renderInside",(function(){return u.b}))}])})); | ||
//# sourceMappingURL=index.js.map |
@@ -33,3 +33,6 @@ /* | ||
const rehydrate = input => { | ||
GDPR.smartReRender(); | ||
setTimeout(() => { | ||
console.log("[rehydrate]"); | ||
GDPR.smartReRender(); | ||
}, 50); | ||
}; | ||
@@ -47,2 +50,3 @@ | ||
$switch.click(e => { | ||
console.log(`[IN] guard: ${guard.name} [${guard.enabled}]`); | ||
e.preventDefault(); | ||
@@ -54,2 +58,4 @@ if(switch_.checked) | ||
console.log(`[OUT] guard: ${guard.name} [${guard.enabled}]`); | ||
rehydrate(switch_); | ||
@@ -155,3 +161,4 @@ }); | ||
(async () => { | ||
GDPR.smartReRender = await domGdprGuard.renderInside( | ||
console.clear(); | ||
const { render, manager } = await domGdprGuard.renderInside( | ||
document.getElementById("app"), | ||
@@ -168,5 +175,8 @@ { | ||
); | ||
})() | ||
GDPR.smartReRender = render; | ||
GDPR.manager = manager; | ||
})(); | ||
{ | ||
"name": "dom-gdpr-guard", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Vanilla JavaScript binding to use gdpr-guard as efficiently and easily as possible", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -66,3 +66,9 @@ # dom-gdpr-guard | ||
It returns the rendered element so that you can mount it yourself in the DOM. | ||
```typescript | ||
interface GdprRenderResult{ | ||
rendered: Rendered; | ||
manager: GdprManager; | ||
} | ||
``` | ||
It returns the rendered element so that you can mount it yourself in the DOM. It also returns the manager so that you can query its state for conditional logic. | ||
@@ -73,4 +79,11 @@ ### renderInside | ||
It returns a function that when called will smartly re-render the GDPR state to avoid the pain of manually handling updates efficiently (it uses DOM diffing). | ||
```typescript | ||
interface ReRenderResult{ | ||
render: ReRenderFunction; | ||
manager: GdprManager; | ||
} | ||
``` | ||
It returns a function that when called will smartly re-render the GDPR state to avoid the pain of manually handling updates efficiently (it uses DOM diffing). It also returns the manager so that you can query its state for conditional logic. | ||
## Savior API | ||
@@ -77,0 +90,0 @@ |
@@ -33,3 +33,6 @@ /* | ||
const rehydrate = input => { | ||
GDPR.smartReRender(); | ||
setTimeout(() => { | ||
console.log("[rehydrate]"); | ||
GDPR.smartReRender(); | ||
}, 50); | ||
}; | ||
@@ -47,2 +50,3 @@ | ||
$switch.click(e => { | ||
console.log(`[IN] guard: ${guard.name} [${guard.enabled}]`); | ||
e.preventDefault(); | ||
@@ -54,2 +58,4 @@ if(switch_.checked) | ||
console.log(`[OUT] guard: ${guard.name} [${guard.enabled}]`); | ||
rehydrate(switch_); | ||
@@ -155,3 +161,4 @@ }); | ||
(async () => { | ||
GDPR.smartReRender = await domGdprGuard.renderInside( | ||
console.clear(); | ||
const { render, manager } = await domGdprGuard.renderInside( | ||
document.getElementById("app"), | ||
@@ -168,5 +175,8 @@ { | ||
); | ||
})() | ||
GDPR.smartReRender = render; | ||
GDPR.manager = manager; | ||
})(); | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
214956
507
101