@xysfe/memento-core
Version:
record and replay the web
31 lines • 76.6 kB
JavaScript
var mementoCoreReplay=function(e){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var t,n=function(){return(n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function a(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(t||(t={}));var l=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function c(e,t){void 0===t&&(t={});var n=1,r=1;function i(e){var t=e.match(/\n/g);t&&(n+=t.length);var i=e.lastIndexOf("\n");r=-1===i?r+e.length:e.length-i}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),m(),t}}var o=function(e){this.start=e,this.end={line:n,column:r},this.source=t.source};o.prototype.content=e;var s=[];function c(i){var a=new Error(t.source+":"+n+":"+r+": "+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a;s.push(a)}function f(){return p(/^{\s*/)}function d(){return p(/^}/)}function h(){var t,n=[];for(m(),v(n);e.length&&"}"!==e.charAt(0)&&(t=T()||C());)!1!==t&&(n.push(t),v(n));return n}function p(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function m(){p(/^\s*/)}function v(e){var t;for(void 0===e&&(e=[]);t=y();)!1!==t&&e.push(t),t=y();return e}function y(){var t=a();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var n=2;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:"comment",comment:o})}}function g(){var e=p(/^([^{]+)/);if(e)return u(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(e){return e.replace(/,/g,"")})).split(/\s*(?![^(]*\)),\s*/).map((function(e){return e.replace(/\u200C/g,",")}))}function b(){var e=a(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var n=u(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var r=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),i=e({type:"declaration",property:n.replace(l,""),value:r?u(r[0]).replace(l,""):""});return p(/^[;\s]*/),i}}function w(){var e,t=[];if(!f())return c("missing '{'");for(v(t);e=b();)!1!==e&&(t.push(e),v(t)),e=b();return d()?t:c("missing '}'")}function x(){for(var e,t=[],n=a();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:w()})}var k,_=M("import"),E=M("charset"),S=M("namespace");function M(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var n=a(),r=p(t);if(r){var i={type:e};return i[e]=r[1].trim(),n(i)}}}function T(){if("@"===e[0])return function(){var e=a(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var n=t[1];if(!(t=p(/^([-\w]+)\s*/)))return c("@keyframes missing name");var r,i=t[1];if(!f())return c("@keyframes missing '{'");for(var o=v();r=x();)o.push(r),o=o.concat(v());return d()?e({type:"keyframes",name:i,vendor:n,keyframes:o}):c("@keyframes missing '}'")}}()||function(){var e=a(),t=p(/^@media *([^{]+)/);if(t){var n=u(t[1]);if(!f())return c("@media missing '{'");var r=v().concat(h());return d()?e({type:"media",media:n,rules:r}):c("@media missing '}'")}}()||function(){var e=a(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:u(t[1]),media:u(t[2])})}()||function(){var e=a(),t=p(/^@supports *([^{]+)/);if(t){var n=u(t[1]);if(!f())return c("@supports missing '{'");var r=v().concat(h());return d()?e({type:"supports",supports:n,rules:r}):c("@supports missing '}'")}}()||_()||E()||S()||function(){var e=a(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var n=u(t[1]),r=u(t[2]);if(!f())return c("@document missing '{'");var i=v().concat(h());return d()?e({type:"document",document:r,vendor:n,rules:i}):c("@document missing '}'")}}()||function(){var e=a();if(p(/^@page */)){var t=g()||[];if(!f())return c("@page missing '{'");for(var n,r=v();n=b();)r.push(n),r=r.concat(v());return d()?e({type:"page",selectors:t,declarations:r}):c("@page missing '}'")}}()||function(){var e=a();if(p(/^@host\s*/)){if(!f())return c("@host missing '{'");var t=v().concat(h());return d()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=a();if(p(/^@font-face\s*/)){if(!f())return c("@font-face missing '{'");for(var t,n=v();t=b();)n.push(t),n=n.concat(v());return d()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}}()}function C(){var e=a(),t=g();return t?(v(),e({type:"rule",selectors:t,declarations:w()})):c("selector missing")}return function e(t,n){for(var r=t&&"string"==typeof t.type,i=r?t:n,a=0,o=Object.keys(t);a<o.length;a++){var s=o[a],l=t[s];Array.isArray(l)?l.forEach((function(t){e(t,i)})):l&&"object"==typeof l&&e(l,i)}r&&Object.defineProperty(t,"parent",{configurable:!0,writable:!0,enumerable:!1,value:n||null});return t}((k=h(),{type:"stylesheet",stylesheet:{source:t.source,rules:k,parsingErrors:s}}))}function u(e){return e?e.replace(/^\s+|\s+$/g,""):""}var f={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};var d=/([^\\]):hover/g,h=/(\s|;|\{)inset\s*:([^;}]+)/gi;function p(e){var t=c(e,{silent:!0});return t.stylesheet&&t.stylesheet.rules?(t.stylesheet.rules.forEach((function(t){"selectors"in t&&(t.selectors||[]).forEach((function(t){if(d.test(t)){var n=t.replace(d,"$1.\\:hover");e=e.replace(t,t+", "+n)}}))})),e.replace(h,"$1top: $2; right: $2; bottom: $2; left: $2;")):e}var m=/url\((data:image\/svg\+xml;charset=[\w-].*?)\)\s*(;|\}|$)/gi;function v(e){return e?e.replace(m,(function(e,t,n){return'url("'+t+'")'+n})):e}function y(e,n,r,i){switch(void 0===i&&(i=!0),e.type){case t.Document:return n.implementation.createDocument(null,"",null);case t.DocumentType:return n.implementation.createDocumentType(e.name,e.publicId,e.systemId);case t.Element:var a,o=function(e){var t=f[e.tagName]?f[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e);a=e.isSVG?n.createElementNS("http://www.w3.org/2000/svg",o):n.createElement(o);var s=function(t){if(!e.attributes.hasOwnProperty(t))return"continue";if(e.attributes.hasOwnProperty("_memimage_"+t))return"continue";var s=e.attributes[t];s="boolean"==typeof s||"number"==typeof s?"":s;var l=t;if((t=t.replace("_memimage_","")).startsWith("mem_")){if("canvas"===o&&"mem_dataURL"===t){var c=document.createElement("img");c.src=s,c.onload=function(){var e=a.getContext("2d");e&&e.drawImage(c,0,0,c.width,c.height)}}"mem_imgwidth"===t||"mem_width"===t?a.style.width=s:"mem_imgheight"===t||"mem_height"===t?a.style.height=s:"video"===o&&"mem_placeholder"===l&&(a.style.background="center / cover no-repeat url("+s+") !important")}else{var u="textarea"===o&&"value"===t,f="style"===o&&"_cssText"===t;if(f&&r&&(s=v(s=p(s))),u||f){for(var d=n.createTextNode(s),h=0,m=Array.from(a.childNodes);h<m.length;h++){var y=m[h];y.nodeType===a.TEXT_NODE&&a.removeChild(y)}return a.appendChild(d),"continue"}if("iframe"===o&&"src"===t)return"continue";try{e.isSVG&&"xlink:href"===t?a.setAttributeNS("http://www.w3.org/1999/xlink",t,s):"onload"===t||"onclick"===t||"onmouse"===t.substring(0,7)?a.setAttribute("_"+t,s):(i&&"link"===o&&"_memimage_href"===l&&s&&s.match(/memento\.oss/)&&(s=s.replace(/^http\:\/\//,"https://")),a.setAttribute(t,s))}catch(e){}}};for(var l in e.attributes)s(l);return a;case t.Text:var c=e.isStyle?v(e.textContent):e.textContent;return n.createTextNode(e.isStyle&&r?p(c):c);case t.CDATA:return n.createCDATASection(e.textContent);case t.Comment:return n.createComment(e.textContent);default:return null}}function g(e,n,r,i,a,o){void 0===i&&(i=!1),void 0===a&&(a=!0),void 0===o&&(o=!0);var s=y(e,n,a,o);if(!s)return null;if(e.type===t.Document&&(n.close(),n.open(),s=n),s.__sn=e,r[e.id]=s,(e.type===t.Document||e.type===t.Element)&&!i)for(var l=0,c=e.childNodes;l<c.length;l++){var u=c[l],f=g(u,n,r,!1,a,o);f?s.appendChild(f):console.warn("Failed to rebuild",u)}return s}function b(e,n,r,i){void 0===r&&(r=!0),void 0===i&&(i=!0);var a={},o=g(e,n,a,!1,r,i);return function(e){for(var n in e){var r=e[n],i=r.__sn;if(i.type===t.Element){var a=r;for(var o in i.attributes)if(i.attributes.hasOwnProperty(o)&&o.startsWith("mem_")){var s=i.attributes[o];"mem_scrollLeft"===o&&(a.scrollLeft=s),"mem_scrollTop"===o&&(a.scrollTop=s)}}}}(a),[o,a]}function w(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map((function(e){e(n)})),(e["*"]||[]).slice().map((function(e){e(t,n)}))}}}var x=Object.freeze({__proto__:null,default:w});function k(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function _(e,t){return e(t={exports:{}},t.exports),t.exports}var E,S,M,T,C,A,N,I,O=_((function(e,t){e.exports={polyfill:function(){var e=window,t=document;if(!("scrollBehavior"in t.documentElement.style)||!0===e.__forceSmoothScrollPolyfill__){var n,r=e.HTMLElement||e.Element,i={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||s,scrollIntoView:r.prototype.scrollIntoView},a=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now,o=(n=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(n)?1:0);e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?p.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):i.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(l(arguments[0])?i.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):p.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},r.prototype.scroll=r.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==l(arguments[0])){var e=arguments[0].left,t=arguments[0].top;p.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},r.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},r.prototype.scrollIntoView=function(){if(!0!==l(arguments[0])){var n=d(this),r=n.getBoundingClientRect(),a=this.getBoundingClientRect();n!==t.body?(p.call(this,n,n.scrollLeft+a.left-r.left,n.scrollTop+a.top-r.top),"fixed"!==e.getComputedStyle(n).position&&e.scrollBy({left:r.left,top:r.top,behavior:"smooth"})):e.scrollBy({left:a.left,top:a.top,behavior:"smooth"})}else i.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function s(e,t){this.scrollLeft=e,this.scrollTop=t}function l(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function c(e,t){return"Y"===t?e.clientHeight+o<e.scrollHeight:"X"===t?e.clientWidth+o<e.scrollWidth:void 0}function u(t,n){var r=e.getComputedStyle(t,null)["overflow"+n];return"auto"===r||"scroll"===r}function f(e){var t=c(e,"Y")&&u(e,"Y"),n=c(e,"X")&&u(e,"X");return t||n}function d(e){for(;e!==t.body&&!1===f(e);)e=e.parentNode||e.host;return e}function h(t){var n,r,i,o,s=(a()-t.startTime)/468;o=s=s>1?1:s,n=.5*(1-Math.cos(Math.PI*o)),r=t.startX+(t.x-t.startX)*n,i=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,r,i),r===t.x&&i===t.y||e.requestAnimationFrame(h.bind(e,t))}function p(n,r,o){var l,c,u,f,d=a();n===t.body?(l=e,c=e.scrollX||e.pageXOffset,u=e.scrollY||e.pageYOffset,f=i.scroll):(l=n,c=n.scrollLeft,u=n.scrollTop,f=s),h({scrollable:l,method:f,startTime:d,startX:c,startY:u,x:r,y:o})}}}})).polyfill;!function(e){e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.PageChange=5]="PageChange",e[e.Custom=9]="Custom",e[e.Other=99]="Other"}(E||(E={})),function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Drag=10]="Drag",e[e.UserDefinedEvent=11]="UserDefinedEvent"}(S||(S={})),function(e){e[e.LivePlay=0]="LivePlay"}(M||(M={})),function(e){e[e.Console=1]="Console",e[e.Network=2]="Network"}(T||(T={})),function(e){e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd"}(C||(C={})),function(e){e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2"}(A||(A={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause"}(N||(N={})),function(e){e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.AddEvents="add-events"}(I||(I={}));var D,L=function(){function e(e,t){void 0===t&&(t=[]),this.timeOffset=0,this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,s(e))},e.prototype.start=function(){this.actions.sort((function(e,t){return e.delay-t.delay})),this.timeOffset=0;var e=performance.now(),t=this.actions,n=this.config,r=this;this.raf=requestAnimationFrame((function i(a){for(r.timeOffset+=(a-e)*n.speed,e=a;t.length;){var o=t[0];if(!(r.timeOffset>=o.delay))break;t.shift(),o.doAction()}(t.length>0||r.config.liveMode)&&(r.raf&&cancelAnimationFrame(r.raf),r.raf=requestAnimationFrame(i))}))},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}();function F(e,t){if(e.type===E.IncrementalSnapshot&&e.data.source===S.MouseMove){var n=e.data.positions[0].timeOffset,r=e.timestamp+n;return e.delay=r-t,r-t}return e.delay=e.timestamp-t,e.timestamp-t}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function R(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(D||(D={}));var P={type:"xstate.init"};function B(e){return void 0===e?[]:[].concat(e)}function U(e){return{type:"xstate.assign",assignment:e}}function z(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function Z(e){return function(t){return e===t}}function j(e){return"string"==typeof e?{type:e}:e}function H(e,t){return{value:e,context:t,actions:[],changed:!1,matches:Z(e)}}function W(e,t,n){var r=t,i=!1;return[e.filter((function(e){if("xstate.assign"===e.type){i=!0;var t=Object.assign({},r);return"function"==typeof e.assignment?t=e.assignment(r,n):Object.keys(e.assignment).forEach((function(i){t[i]="function"==typeof e.assignment[i]?e.assignment[i](r,n):e.assignment[i]})),r=t,!1}return!0})),r,i]}var G=function(e,t){return e.actions.forEach((function(n){var r=n.exec;return r&&r(e.context,t)}))};var V={map:{},getId:function(e){return e&&e.__sn?e.__sn.id:-1},getNode:function(e){return V.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete V.map[t],e.childNodes&&e.childNodes.forEach((function(e){return V.removeNodeFromMap(e)}))},has:function(e){return V.map.hasOwnProperty(e)}};function Y(e){switch(e.type){case E.DomContentLoaded:case E.Load:case E.PageChange:case E.Custom:return!1;case E.FullSnapshot:case E.Meta:return!0}switch(e.data.source){case S.MouseMove:case S.MouseInteraction:case S.TouchMove:case S.MediaInteraction:return!1;case S.ViewportResize:case S.StyleSheetRule:case S.Scroll:case S.Input:return!0}return!0}var X=function(){function e(){this.reset()}return e.prototype.add=function(e){var t=this.indexes.get(e.parentId),n={id:e.node.id,mutation:e,children:[],texts:[],attributes:[]};t?(n.parent=t,t.children[n.id]=n):this.tree[n.id]=n,this.indexes.set(n.id,n)},e.prototype.remove=function(e){var t=this,n=this.indexes.get(e.parentId),r=this.indexes.get(e.id),i=function(e){t.removeIdSet.add(e);var n=V.getNode(e);null==n||n.childNodes.forEach((function(e){return i(e.__sn.id)}))},a=function(n){t.removeIdSet.add(n.id),Object.values(n.children).forEach((function(e){return a(e)}));var r=t.indexes.get(n.id);if(r){var i=r.parent;i&&(delete r.parent,delete i.children[r.id],t.indexes.delete(e.id))}};r?n?(delete r.parent,delete n.children[r.id],this.indexes.delete(e.id),a(r)):(delete this.tree[r.id],this.indexes.delete(r.id),a(r)):(this.removeNodeMutations.push(e),i(e.id))},e.prototype.text=function(e){var t=this.indexes.get(e.id);t?t.texts.push(e):this.textMutations.push(e)},e.prototype.attribute=function(e){var t=this.indexes.get(e.id);t?t.attributes.push(e):this.attributeMutations.push(e)},e.prototype.scroll=function(e){this.scrollMap.set(e.id,e)},e.prototype.input=function(e){this.inputMap.set(e.id,e)},e.prototype.flush=function(){var e,t,n,r,i=this,o=this.tree,s=this.removeNodeMutations,l=this.textMutations,c=this.attributeMutations,u={source:S.Mutation,removes:s,texts:l,attributes:c,adds:[]},f=function(e,t){t&&i.removeIdSet.add(e.id),u.texts=u.texts.concat(t?[]:e.texts).filter((function(e){return!i.removeIdSet.has(e.id)})),u.attributes=u.attributes.concat(t?[]:e.attributes).filter((function(e){return!i.removeIdSet.has(e.id)})),i.removeIdSet.has(e.id)||i.removeIdSet.has(e.mutation.parentId)||t?Object.values(e.children).forEach((function(e){return f(e,!0)})):(u.adds.push(e.mutation),e.children&&Object.values(e.children).forEach((function(e){return f(e,!1)})))};Object.values(o).forEach((function(e){return f(e,!1)}));try{for(var d=a(this.scrollMap.keys()),h=d.next();!h.done;h=d.next()){var p=h.value;this.removeIdSet.has(p)&&this.scrollMap.delete(p)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}try{for(var m=a(this.inputMap.keys()),v=m.next();!v.done;v=m.next()){p=v.value;this.removeIdSet.has(p)&&this.inputMap.delete(p)}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}var y=new Map(this.scrollMap),g=new Map(this.inputMap);return this.reset(),{mutationData:u,scrollMap:y,inputMap:g}},e.prototype.reset=function(){this.tree=[],this.indexes=new Map,this.removeNodeMutations=[],this.textMutations=[],this.attributeMutations=[],this.removeIdSet=new Set,this.scrollMap=new Map,this.inputMap=new Map},e}();function K(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.type===E.Meta&&r.timestamp<=t)return e.slice(n)}return e}function $(e,t){var r=t.getCastFn,i=t.emitter;return function(e){var t=e.initialState,n=D.NotStarted,r=new Set,i={_machine:e,send:function(i){n===D.Running&&(t=e.transition(t,i),G(t,j(i)),r.forEach((function(e){return e(t)})))},subscribe:function(e){return r.add(e),e(t),{unsubscribe:function(){return r.delete(e)}}},start:function(r){if(r){var a="object"==typeof r?r:{context:e.config.context,value:r};t={value:a.value,actions:[],context:a.context,matches:Z(a.value)}}return n=D.Running,G(t,P),i},stop:function(){return n=D.Stopped,r.clear(),i},get state(){return t},get status(){return n}};return i}(function(e,t){void 0===t&&(t={});var n=R(W(B(e.states[e.initial].entry).map((function(e){return z(e,t.actions)})),e.context,P),2),r=n[0],i=n[1],a={config:e,_options:t,initialState:{value:e.initial,actions:r,context:i,matches:Z(e.initial)},transition:function(t,n){var r,i,o="string"==typeof t?{value:t,context:e.context}:t,s=o.value,l=o.context,c=j(n),u=e.states[s];if(u.on){var f=B(u.on[c.type]);try{for(var d=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(f),h=d.next();!h.done;h=d.next()){var p=h.value;if(void 0===p)return H(s,l);var m="string"==typeof p?{target:p}:p,v=m.target,y=m.actions,g=void 0===y?[]:y,b=m.cond,w=void 0===b?function(){return!0}:b,x=void 0===v,k=null!=v?v:s,_=e.states[k];if(w(l,c)){var E=R(W((x?B(g):[].concat(u.exit,g,_.entry).filter((function(e){return e}))).map((function(e){return z(e,a._options.actions)})),l,c),3),S=E[0],M=E[1],T=E[2],C=null!=v?v:s;return{value:C,context:M,actions:S,changed:v!==s||S.length>0||T,matches:Z(C)}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}return H(s,l)}};return a}({id:"player",context:e,initial:"inited",states:{inited:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},TO_LIVE:{target:"live",actions:["startLive"]}}},playing:{on:{PAUSE:{target:"paused",actions:["pause"]},PLAY:{target:"playing",actions:["recordTimeOffset","play"]},FAST_FORWARD:"skipping",CAST_EVENT:{target:"playing",actions:"castEvent"},ADD_EVENTS:{target:"playing",actions:["addEvents","recordTimeOffset"]}}},paused:{on:{RESUME:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},ADD_EVENTS:{target:"paused",actions:["addEvents"]}}},skipping:{on:{BACK_TO_NORMAL:"playing"}},ended:{on:{REPLAY:{target:"playing",actions:["recordTimeOffset","play"]},ADD_EVENTS:{target:"playing",actions:["addEvents","recordTimeOffset","play"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]}}}}},{actions:{castEvent:U({lastPlayedEvent:function(t,n){return"CAST_EVENT"===n.type?n.payload.event:e.lastPlayedEvent}}),recordTimeOffset:U((function(e,t){var r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),n(n({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})})),play:function(e){var t,n,o=e.timer,s=e.events,l=e.baselineTime;e.lastPlayedEvent,o.clear();var c=K(s,l),u=new Array,f=function(e){var t=e.timestamp<l;if(t&&!Y(e))return"continue";var n=r(e,t);t?n():u.push({doAction:function(){n(),i.emit(I.EventCast,e)},delay:F(e,l)})};try{for(var d=a(c),h=d.next();!h.done;h=d.next()){f(h.value)}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}i.emit(I.Flush),o.addActions(u),o.start()},pause:function(e){e.timer.clear()},startLive:U({baselineTime:function(e,t){return e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now()}}),addEvent:U((function(e,t){var a=e.baselineTime,o=e.timer,s=e.events;if("ADD_EVENT"===t.type){var l=t.payload.event;s.push(l);var c=l.timestamp<a,u=r(l,c);c?u():o.addAction({doAction:function(){u(),i.emit(I.EventCast,l)},delay:F(l,a)})}return n(n({},e),{events:s})})),addEvents:U((function(e,t){var o,s,l=e.timer,c=e.events,u=e.baselineTime,f=e.lastPlayedEvent;if("ADD_EVENTS"===t.type){var d=t.payload.events;if(Array.isArray(d)&&d.length){c=c.concat(d);var h=K(d,u),p=new Array,m=function(e){if(f&&f.timestamp>u&&(e.timestamp<=f.timestamp||e===f))return"continue";var t=e.timestamp<u;if(t&&!Y(e))return"continue";var n=r(e,t);t?n():p.push({doAction:function(){n(),i.emit(I.EventCast,e)},delay:F(e,u)})};try{for(var v=a(h),y=v.next();!y.done;y=v.next()){m(y.value)}}catch(e){o={error:e}}finally{try{y&&!y.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}i.emit(I.AddEvents),l.addActions(p)}}return n(n({},e),{events:c})}))}}))}for(var q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Q=0;Q<q.length;Q++)J[q.charCodeAt(Q)]=Q;var ee=function(e){var t,n,r,i,a,o=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),u=new Uint8Array(c);for(t=0;t<s;t+=4)n=J[e.charCodeAt(t)],r=J[e.charCodeAt(t+1)],i=J[e.charCodeAt(t+2)],a=J[e.charCodeAt(t+3)],u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|i>>2,u[l++]=(3&i)<<6|63&a;return c},te=new Map;function ne(e,t){var n=te.get(e);return n||(n=new Map,te.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}function re(e,t,n){var a=this;return function(o){return r(a,void 0,Promise,(function(){var r,a,l,c,u,f,d,h,p,m,v;return i(this,(function(i){switch(i.label){case 0:return o&&"object"==typeof o&&"rr_type"in o?(n&&(n.isUnchanged=!1),"ImageBitmap"===o.rr_type&&"args"in o?[4,re(e,t,n)(o.args)]:[3,3]):[3,11];case 1:return l=i.sent(),[4,createImageBitmap.apply(null,l)];case 2:return[2,i.sent()];case 3:return"index"in o?n||null===t?[2,o]:(a=o.rr_type,r=o.index,[2,ne(t,a)[r]]):[3,4];case 4:return"args"in o?(a=o.rr_type,l=o.args,c=window[a],f=(u=c.bind).apply,d=[c],h=[[void 0]],[4,Promise.all(l.map(re(e,t,n)))]):[3,6];case 5:return[2,new(f.apply(u,d.concat([s.apply(void 0,h.concat([i.sent()]))])))];case 6:return"base64"in o?[2,ee(o.base64)]:[3,7];case 7:return"src"in o?(p=e.get(o.src))?[2,p]:((m=new Image).src=o.src,e.set(o.src,m),[2,m]):[3,8];case 8:return"data"in o&&"Blob"===o.rr_type?[4,Promise.all(o.data.map(re(e,t,n)))]:[3,10];case 9:return v=i.sent(),[2,new Blob(v,{type:o.type})];case 10:return[3,13];case 11:return Array.isArray(o)?[4,Promise.all(o.map(re(e,t,n)))]:[3,13];case 12:return[2,i.sent()];case 13:return[2,o]}}))}))}}var ie=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function ae(e){var t=e.mutation,n=e.target,a=e.type,o=e.imageMap,s=e.errorHandler;return r(this,void 0,Promise,(function(){var e,r,l,c,u;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),(e=function(e,t){try{return t===A.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch(e){return null}}(n,a))?t.setter?(e[t.property]=t.args[0],[2]):(r=e[t.property],[4,Promise.all(t.args.map(re(o,e)))]):[2];case 1:return l=i.sent(),c=r.apply(e,l),function(e,t){if(null==t?void 0:t.constructor){var n=t.constructor.name;if(ie.includes(n)){var r=ne(e,n);r.includes(t)||r.push(t)}}}(e,c),!1,[3,3];case 2:return u=i.sent(),s(t,u),[3,3];case 3:return[2]}}))}))}function oe(e){var t=e.event,n=e.mutation,a=e.target,o=e.imageMap,s=e.errorHandler;return r(this,void 0,Promise,(function(){var e,r,l,c;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e=a.getContext("2d"),n.setter?(e[n.property]=n.args[0],[2]):(r=e[n.property],"drawImage"!==n.property||"string"!=typeof n.args[0]?[3,1]:(o.get(t),r.apply(e,n.args),[3,3]));case 1:return[4,Promise.all(n.args.map(re(o,e)))];case 2:l=i.sent(),r.apply(e,l),i.label=3;case 3:return[3,5];case 4:return c=i.sent(),s(n,c),[3,5];case 5:return[2]}}))}))}var se=w||x,le={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"},ce={normalSpeed:1,speed:1,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"mem-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,mouseTail:le,forceSkipInactive:!1,mode:"player"},ue=function(){function e(e,n){var r=this;if(this.mouseTail=null,this.tailPositions=[],this.emitter=se(),this.normalSpeed=-1,this.legacy_missingNodeRetryMap={},this.unloadStylesheetMap={},this.imageMap=new Map,this.canvasEventMap=new Map,!(null==n?void 0:n.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");this.config=Object.assign({},ce,n),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.emitter.on(I.Resize,this.handleResize),O(),"NodeList"in window&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),this.setupDom(),this.treeIndex=new X,this.fragmentParentMap=new Map,this.emitter.on(I.Flush,(function(){var e,n,i,s,l,c,u=r.treeIndex.flush(),f=u.scrollMap,d=u.inputMap;try{for(var h=a(f.values()),p=h.next();!p.done;p=h.next()){var m=p.value;r.applyScroll(m)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(e)throw e.error}}try{for(var v=a(d.values()),y=v.next();!y.done;y=v.next()){m=y.value;r.applyInput(m)}}catch(e){i={error:e}}finally{try{y&&!y.done&&(s=v.return)&&s.call(v)}finally{if(i)throw i.error}}try{for(var g=a(r.fragmentParentMap.entries()),b=g.next();!b.done;b=g.next()){var w=o(b.value,2),x=w[0],k=w[1];V.map[k.__sn.id]=k,k.__sn.type===t.Element&&"textarea"===k.__sn.tagName&&x.textContent&&(k.value=x.textContent),k.appendChild(x)}}catch(e){l={error:e}}finally{try{b&&!b.done&&(c=g.return)&&c.call(g)}finally{if(l)throw l.error}}r.fragmentParentMap.clear()})),this.emitter.on(I.EventCast,(function(e){r.timeDisplayer&&(r.timeDisplayer.innerText=function(e,t){var n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(var r in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1===RegExp.$1.length?n[r]:("00"+n[r]).substr((""+n[r]).length)));return t}(new Date(e.timestamp),"yyyy/M/d hh:mm:ss"))})),this.service=$({events:e.map((function(e){return n&&n.unpackFn?n.unpackFn(e):e})),timer:new L(this.config),speed:(null==n?void 0:n.speed)||ce.speed,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,emitter:this.emitter}),this.service.start(),this.service.subscribe((function(e){e.changed}));var i=this.service.state.context.events,s=i.find((function(e){return e.type===E.Meta})),l=i.find((function(e){return e.type===E.FullSnapshot}));if(s){var c=s.data,u=c.width,f=c.height;this.emitter.emit(I.Resize,{width:u,height:f})}l&&this.rebuildFullSnapshot(l)}return Object.defineProperty(e.prototype,"timer",{get:function(){return this.service.state.context.timer},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){this.emitter.on(e,t)},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach((function(n){t.config[n]=e[n]})),this.config.skipInactive||(this.normalSpeed=-1),!("normalSpeed"in e)&&"speed"in e&&(this.config.normalSpeed=e.speed),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))},e.prototype.getMetaData=function(){var e=this.service.state.context.events,t=e[0],n=e[e.length-1];return{startTime:t.timestamp,endTime:n.timestamp,totalTime:n.timestamp-t.timestamp}},e.prototype.getCurrentTime=function(){return this.timer.timeOffset+this.getTimeOffset()},e.prototype.getTimeOffset=function(){var e=this.service.state.context;return e.baselineTime-e.events[0].timestamp},e.prototype.play=function(e){void 0===e&&(e=0),this.nextUserInteractionEvent=null,this.restoreSpeed(),"ended"===this.service.state.value&&(this.service.state.context.lastPlayedEvent=null,this.service.send({type:"REPLAY",payload:{timeOffset:e}})),"paused"===this.service.state.value?this.service.send({type:"RESUME",payload:{timeOffset:e}}):this.service.send({type:"PLAY",payload:{timeOffset:e}}),this.emitter.emit(I.Start)},e.prototype.pause=function(){this.service.send({type:"PAUSE"}),this.emitter.emit(I.Pause)},e.prototype.resume=function(e){void 0===e&&(e=0),this.service.send({type:"RESUME",payload:{timeOffset:e}}),this.emitter.emit(I.Resume)},e.prototype.startLive=function(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})},e.prototype.addEvent=function(e){var t=this,n=this.config.unpackFn?this.config.unpackFn(e):e;Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENT",payload:{event:n}})}))},e.prototype.addEvents=function(e){var t=this,n=e.map((function(e){return t.config.unpackFn?t.config.unpackFn(e):e}));Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENTS",payload:{events:n}})}))},e.prototype.enableInteract=function(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"},e.prototype.disableInteract=function(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"},e.prototype.setupDom=function(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.timeDisplayer=document.createElement("span");var e=document.createElement("div");e.classList.add("replayer-time"),e.appendChild(this.timeDisplayer),this.wrapper.appendChild(e),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");var t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){var t,n;this.iframe.style.display="inherit";try{for(var r=a([this.mouseTail,this.iframe]),i=r.next();!i.done;i=r.next()){var o=i.value;o&&(o.setAttribute("width",String(e.width)),o.setAttribute("height",String(e.height)))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},e.prototype.getCastFn=function(e,t){var n,r=this;void 0===t&&(t=!1);var i=function(){if(!t){for(var n=r.service.state.context.events,i=0,a=0,o=n.length;a<o;a++)if(n[a]===e){i=a;break}if(r.config.forceSkipInactive)if(n[i+1]&&n[i+1].timestamp-e.timestamp>3e5)return void r.play(n[i+1].timestamp-n[0].timestamp);if(e===r.nextUserInteractionEvent&&(r.nextUserInteractionEvent=null,r.restoreSpeed()),r.config.skipInactive&&!r.nextUserInteractionEvent){var s=r.service.state.context.events;for(a=i+1,o=s.length;a<o;a++){var l=s[a];if(r.isUserInteraction(l)||l.type===E.FullSnapshot){l.delay-e.delay>1e4*r.config.speed&&(r.nextUserInteractionEvent=l);break}}if(r.nextUserInteractionEvent){r.normalSpeed=r.config.normalSpeed;var c=r.nextUserInteractionEvent.delay-e.delay,u={speed:Math.min(Math.round(c/5e3),3600),normalSpeed:r.normalSpeed};r.setConfig(u),r.emitter.emit(I.SkipStart,u)}}}};switch(e.type){case E.DomContentLoaded:case E.Load:case E.PageChange:break;case E.Custom:n=function(){r.emitter.emit(I.CustomEvent,e)};break;case E.Meta:n=function(){return r.emitter.emit(I.Resize,{width:e.data.width,height:e.data.height})};break;case E.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset),i()};break;case E.IncrementalSnapshot:n=function(){try{r.applyIncremental(e,t)}catch(e){console.error(e)}i()}}return function(){var t=r.service.state.context.events;n&&n(),r.service.send({type:"CAST_EVENT",payload:{event:e}}),e===t[t.length-1]&&(r.restoreSpeed(),r.service.send("END"),r.emitter.emit(I.Finish))}},e.prototype.rebuildFullSnapshot=function(e){if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={},V.map=b(e.data.node,this.iframe.contentDocument,!0,this.config.cdnHttps)[1];var t=document.createElement("style"),n=this.iframe.contentDocument,r=n.documentElement,i=n.head;r.insertBefore(t,i);for(var a=function(e){var t=["iframe, ."+e.blockClass+" { background: #ccc }","noscript { display: none !important; }"];return"page"===e.mode&&(t.push(".mem-replayer-show { display: block !important; }"),t.push(".mem-replayer-hide { display: none !important; }"),t.push("::-webkit-scrollbar { display: none; }")),t}({blockClass:this.config.blockClass,mode:this.config.mode}).concat(this.config.insertStyleRules),o=0;o<a.length;o++)t.sheet.insertRule(a[o],o);this.emitter.emit(I.FullsnapshotRebuilded,e),"page"!==this.config.mode&&this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()},e.prototype.waitForStylesheetLoad=function(){var e,t=this,n=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(n){var r,i=new Set,a=this.service.state,o=n.querySelectorAll('link[rel="stylesheet"]');(o=Array.prototype.filter.call(o,(function(e){return!!t.unloadStylesheetMap[e.href]}))).forEach((function(e){e.sheet||(i.add(e),t.unloadStylesheetMap[e.href]=1,e.addEventListener("load",(function(){i.delete(e),0===i.size&&-1!==r&&(a.matches("playing")&&t.resume(t.getCurrentTime()),t.emitter.emit(I.LoadStylesheetEnd),r&&window.clearTimeout(r))})))})),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(I.LoadStylesheetStart),r=window.setTimeout((function(){a.matches("playing")&&t.resume(t.getCurrentTime()),r=-1}),this.config.loadTimeout))}},e.prototype.preloadAllImages=function(){return r(this,void 0,Promise,(function(){var e,t,n,r,o,s,l,c,u,f=this;return i(this,(function(i){this.service.state,e=function(){f.service.state},this.emitter.on(I.Start,e),this.emitter.on(I.Pause,e),t=[],n=function(e){e.type===E.IncrementalSnapshot&&e.data.source===S.CanvasMutation&&(t.push(r.deserializeAndPreloadCanvasEvents(e.data,e)),("commands"in e.data?e.data.commands:[e.data]).forEach((function(t){f.preloadImages(t,e)})))},r=this;try{for(o=a(this.service.state.context.events),s=o.next();!s.done;s=o.next())l=s.value,n(l)}catch(e){c={error:e}}finally{try{s&&!s.done&&(u=o.return)&&u.call(o)}finally{if(c)throw c.error}}return[2,Promise.all(t)]}))}))},e.prototype.preloadImages=function(e,t){if("drawImage"===e.property&&"string"==typeof e.args[0]&&!this.imageMap.has(t)){var n=document.createElement("canvas"),r=n.getContext("2d"),i=null==r?void 0:r.createImageData(n.width,n.height);null==i||i.data,JSON.parse(e.args[0]),null==r||r.putImageData(i,0,0)}},e.prototype.deserializeAndPreloadCanvasEvents=function(e,t){return r(this,void 0,void 0,(function(){var a,o,s,l=this;return i(this,(function(c){switch(c.label){case 0:return this.canvasEventMap.has(t)?[3,4]:(a={isUnchanged:!0},"commands"in e?[4,Promise.all(e.commands.map((function(e){return r(l,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,Promise.all(e.args.map(re(this.imageMap,null,a)))];case 1:return t=r.sent(),[2,n(n({},e),{args:t})]}}))}))})))]:[3,2]);case 1:return o=c.sent(),!1===a.isUnchanged&&this.canvasEventMap.set(t,n(n({},e),{commands:o})),[3,4];case 2:return[4,Promise.all(e.args.map(re(this.imageMap,null,a)))];case 3:s=c.sent(),!1===a.isUnchanged&&this.canvasEventMap.set(t,n(n({},e),{args:s})),c.label=4;case 4:return[2]}}))}))},e.prototype.applyIncremental=function(e,t){var n=this,a=this.service.state.context.baselineTime,o=e.data;switch(o.source){case S.Mutation:t&&(o.adds.forEach((function(e){return n.treeIndex.add(e)})),o.texts.forEach((function(e){return n.treeIndex.text(e)})),o.attributes.forEach((function(e){return n.treeIndex.attribute(e)})),o.removes.forEach((function(e){return n.treeIndex.remove(e)}))),this.applyMutation(o,t);break;case S.Drag:case S.TouchMove:case S.MouseMove:if(t){var s=o.positions[o.positions.length-1];this.moveAndHover(o,s.x,s.y,s.id,t)}else o.positions.forEach((function(r){var i={doAction:function(){n.moveAndHover(o,r.x,r.y,r.id,t)},delay:r.timeOffset+e.timestamp-a};n.timer.addAction(i)}));break;case S.MouseInteraction:if(-1===o.id)break;var l=new Event(C[o.type].toLowerCase());if(!(f=V.getNode(o.id)))return this.debugNodeNotFound(o,o.id);this.emitter.emit(I.MouseInteraction,{type:o.type,target:f});var c=this.config.triggerFocus;switch(o.type){case C.Blur:"blur"in f&&f.blur();break;case C.Focus:c&&f.focus&&f.focus({preventScroll:!0});break;case C.Click:case C.TouchStart:case C.TouchEnd:t||(this.moveAndHover(o,o.x,o.y,o.id,t),this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:f.dispatchEvent(l)}break;case S.Scroll:if(-1===o.id)break;if(t){this.treeIndex.scroll(o);break}this.applyScroll(o);break;case S.ViewportResize:o.rotate&&this.emitter.emit(I.Resize,{width:o.width,height:o.height});break;case S.Input:if(-1===o.id)break;if(t){this.treeIndex.input(o);break}this.applyInput(o);break;case S.StyleSheetRule:if(!(f=V.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var u=f.sheet;o.adds&&o.adds.forEach((function(e){var t=e.rule,n=e.index,r=void 0===n?void 0:Math.min(n,u.rules.length);try{u.insertRule(t,r)}catch(e){}})),o.removes&&o.removes.forEach((function(e){var t=e.index;u.deleteRule(t)}));break;case S.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;var f;if(!(f=V.getNode(o.id)))return this.debugNodeNotFound(o,o.id);!function(e){var t=e.event,n=e.mutation,a=e.target,o=e.imageMap,s=e.canvasEventMap,l=e.errorHandler;r(this,void 0,Promise,(function(){var e,r,c,u,f;return i(this,(function(i){switch(i.label){case 0:if(i.trys.push([0,10,,11]),e=s.get(t)||n,r="commands"in e?e.commands:[e],![A.WebGL,A.WebGL2].includes(n.type))return[3,5];c=0,i.label=1;case 1:return c<r.length?[4,ae({mutation:u=r[c],type:n.type,target:a,imageMap:o,errorHandler:l})]:[3,4];case 2:i.sent(),i.label=3;case 3:return c++,[3,1];case 4:return[2];case 5:c=0,i.label=6;case 6:return c<r.length?(u=r[c],[4,oe({event:t,mutation:u,target:a,imageMap:o,errorHandler:l})]):[3,9];case 7:i.sent(),i.label=8;case 8:return c++,[3,6];case 9:return[3,11];case 10:return f=i.sent(),l(n,f),[3,11];case 11:return[2]}}))}))}({event:e,mutation:o,target:f,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)});break;case S.UserDefinedEvent:if(o.evt===M.LivePlay){var d=this.iframe.contentDocument;if(!d||!o.selector||!o.url)return;var h=d.querySelector(o.selector);h&&h.tagName&&"video"===h.tagName.toLowerCase()&&(h.setAttribute("src",o.url),h.play())}}},e.prototype.applyMutation=function(e,t){var r=this;e.removes.forEach((function(t){var n=V.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);var i=V.getNode(t.parentId);if(!i)return r.warnNodeNotFound(e,t.parentId);if(V.removeNodeFromMap(n),i){var a=r.fragmentParentMap.get(i);a&&a.contains(n)?a.removeChild(n):i.removeChild(n)}}));var i=n({},this.legacy_missingNodeRetryMap),a=[],o=function(e){if(!r.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");var n=V.getNode(e.parentId);if(!n)return a.push(e);var o=r.iframe.contentDocument.contains(n);if(t&&o){var s=document.createDocumentFragment();for(V.map[e.parentId]=s,r.fragmentParentMap.set(s,n);n.firstChild;)s.appendChild(n.firstChild);n=s}var l=null,c=null;if(e.previousId&&(l=V.getNode(e.previousId)),e.nextId&&(c=V.getNode(e.nextId)),null!==e.nextId&&-1!==e.nextId&&!c)return a.push(e);if(!V.has(e.node.id)){var u=g(e.node,r.iframe.contentDocument,V.map,!0,!0,r.config.cdnHttps);-1!==e.previousId&&-1!==e.nextId?(l&&l.nextSibling&&l.nextSibling.parentNode?n.insertBefore(u,l.nextSibling):c&&c.parentNode?n.contains(c)?n.insertBefore(u,c):n.insertBefore(u,null):n.appendChild(u),(e.previousId||e.nextId)&&r.legacy_resolveMissingNode(i,n,u,e)):i[e.node.id]={node:u,mutation:e}}};for(e.adds.forEach((function(e){o(e)}));a.length;){if(a.every((function(e){return!Boolean(V.getNode(e.parentId))})))return a.forEach((function(t){return r.warnNodeNotFound(e,t.node.id)}));var s=a.shift();o(s)}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),e.texts.forEach((function(t){var n=V.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);r.fragmentParentMap.has(n)&&(n=r.fragmentParentMap.get(n)),n.textContent=t.value})),e.attributes.forEach((function(t){var n=V.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);for(var i in r.fragmentParentMap.has(n)&&(n=r.fragmentParentMap.get(n)),t.attributes)if("string"==typeof i){if(t.attributes.hasOwnProperty("_memimage_"+i))continue;var a=t.attributes[i];i=i.replace("_memimage_",""),null!==a?"video"===n.tagName&&"mem_placeholder"===i?n.style.background="center / cover no-repeat url("+a+")":n.setAttribute(i,a):n.removeAttribute(i)}}))},e.prototype.applyScroll=function(e){var t=V.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);if(t===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:"smooth"});else try{t.scrollTop=e.y,t.scrollLeft=e.x}catch(e){}},e.prototype.applyInput=function(e){var t=V.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}},e.prototype.legacy_resolveMissingNode=function(e,t,n,r){var i=r.previousId,a=r.nextId,o=i&&e[i],s=a&&e[a];if(o){var l=o,c=l.node,u=l.mutation;t.insertBefore(c,n),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(s){var f=s;c=f.node,u=f.mutation;t.insertBefore(c,n.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}},e.prototype.moveAndHover=function(e,t,n,r,i){this.mouse.style.left=t+"px",this.mouse.style.top=n+"px";var a=V.getNode(r);if(!a)return this.debugNodeNotFound(e,r);var o=function e(t,n){var r,i,a=null===(i=null===(r=t.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===i?void 0:i.frameElement;if(!a||a===n)return{x:0,y:0,relativeScale:1,absoluteScale:1};var o=a.getBoundingClientRect(),s=e(a,n),l=o.height/a.clientHeight;return{x:o.x*s.relativeScale+s.x,y:o.y*s.relativeScale+s.y,relativeScale:l,absoluteScale:s.absoluteScale*l}}(a,this.iframe),s=t*o.absoluteScale+o.x,l=n*o.absoluteScale+o.y;this.mouse.style.left=s+"px",this.mouse.style.top=l+"px",i||this.drawMouseTail({x:s,y:l}),this.hoverElements(a)},e.prototype.drawMouseTail=function(e){var t=this;if(this.mouseTail){var n=!0===this.config.mouseTail?le:Object.assign({},le,this.config.mouseTail),r=n.lineCap,i=n.lineWidth,a=n.strokeStyle,o=n.duration,s=function(){if(t.mouseTail){var e=t.mouseTail.getContext("2d");e&&t.tailPositions.length&&(e.clearRect(0,0,t.mouseTail.width,t.mouseTail.height),e.beginPath(),e.lineWidth=i,e.lineCap=r,e.strokeStyle=a,e.moveTo(t.tailPositions[0].x,t.tailPositions[0].y),t.tailPositions.forEach((function(t){return e.lineTo(t.x,t.y)})),e.stroke())}};this.tailPositions.push(e),s(),setTimeout((function(){t.tailPositions=t.tailPositions.filter((function(t){return t!==e})),s()}),o/this.config.speed)}},e.prototype.hoverElements=function(e){var t;null===(t=this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((function(e){e.classList.remove(":hover")}));for(var n=e;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement},e.prototype.isUserInteraction=function(e){return e.type===E.IncrementalSnapshot&&(e.data.source>S.Mutation&&e.data.source<=S.Input)},e.prototype.restoreSpeed=function(){if(-1!==this.normalSpeed){var e={speed:this.normalSpeed};this.setConfig(e),this.emitter.emit(I.SkipEnd,e),this.normalSpeed=-1}},e.prototype.warnNodeNotFound=function(e,t){this.config.showWarning&&console.warn("[replayer]","Node with id '"+t+"' not found in",e)},e.prototype.warnCanvasMutationFailed=function(e,t){console.warn("Has error on canvas update",t,"canvas mutation:",e)},e.prototype.debugNodeNotFound=function(e,t){this.config.showDebug&&console.log("[replayer]","Node with id '"+t+"' not found in",e)},e}(),fe=_((function(e,t){e.exports=function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){if(!s&&k)return k();if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,n,r)}return n[o].exports}for(var a=k,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var a={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){var t,n,r,i,a,o;for(r=0,t=0,n=e.length;t<n;t++)r+=e[t].length;for(o=new Uint8Array(r),i=0,t=0,n=e.length;t<n;t++)a=e[t],o.set(a,i),i+=a.length;return o}},o={arraySet:function(e,t,n,r,i){for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,a)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(r)},{}],2:[function(e,t,n){var r=e("./common"),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){a=!1}for(var o=new r.Buf8(256),s=0;s<256;s++)o[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&a||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o<t;o++)n+=String.fromCharCode(e[o]);return n}o[254]=o[254]=1,n.string2buf=function(e){var t,n,i,a,o,s=e.length,l=0;for(a=0;a<s;a++)55296==(64512&(n=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(i=e.charCodeAt(a+1)))&&(n=65536+(n-55296<<10)+(i-56320),a++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new r.Buf8(l),o=0,a=0;o<l;a++)55296==(64512&(n=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(i=e.charCodeAt(a+1)))&&(n=65536+(n-55296<<10)+(i-56320),a++),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,r,i,a,s=t||e.length,c=new Array(2*s);for(r=0,n=0;n<s;)if((i=e[n++])<128)c[r++]=i;else if((a=o[i])>4)c[r++]=65533,n+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&n<s;)i=i<<6|63&e[n++],a--;a>1?c[r++]=65533:i<65536?c[r++]=i:(i-=65536,c[r++]=55296|i>>10&1023,c[r++]=56320|1023&i)}return l(c,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+t[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0}},{}],4:[function(e,t,n){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,n){var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s<o;s++)e=e>>>8^a[255&(e^t[s])];return-1^e}},{}],6:[function(e,t,n){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],7:[function(e,t,n){t.exports=function(e,t){var n,r,i,a,o,s,l,c,u,f,d,h,p,m,v,y,g,b,w,x,k,_,E,S,M;n=e.state,r=e.next_in,S=e.input,i=r+(e.avail_in-5),a=e.next_out,M=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),l=n.dmax,c=n.wsize,u=n.whave,f=n.wnext,d=n.window,h=n.hold,p=n.bits,m=n.lencode,v=n.distcode,y=(1<<n.lenbits)-1,g=(1<<n.distbits)-1;e:do{p<15&&(h+=S[r++]<<p,p+=8,h+=S[r++]<<p,p+=8),b=m[h&y];t:for(;;){if(h>>>=w=b>>>24,p-=w,0==(w=b>>>16&255))M[a++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=m[(65535&b)+(h&(1<<w)-1)];continue t}if(32&w){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}x=65535&b,(w&=15)&&(p<w&&(h+=S[r++]<<p,p+=8),x+=h&(1<<w)-1,h>>>=w,p-=w),p<15&&(h+=S[r++]<<p,p+=8,h+=S[r++]<<p,p+=8),b=v[h&g];n:for(;;){if(h>>>=w=b>>>24,p-=w,!(16&(w=b>>>16&255))){if(0==(64&w)){b=v[(65535&b)+(h&(1<<w)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(k=65535&b,p<(w&=15)&&(h+=S[r++]<<p,(p+=8)<w&&(h+=S[r++]<<p,p+=8)),(k+=h&(1<<w)-1)>l){e.msg="invalid distance too far back",n.mode=30;break e}if(h>>>=w,p-=w,k>(w=a-o)){if((w=k-w)>u&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(_=0,E=d,0===f){if(_+=c-w,w<x){x-=w;do{M[a++]=d[_++]}while(--w);_=a-k,E=M}}else if(f<w){if(_+=c+f-w,(w-=f)<x){x-=w;do{M[a++]=d[_++]}while(--w);if(_=0,f<x){x-=w=f;do{M[a++]=d[_++]}while(--w);_=a-k,E=M}}}else if(_+=f-w,w<x){x-=w;do{M[a++]=d[_++]}while(--w);_=a-k,E=M}for(;x>2;)M[a++]=E[_++],M[a++]=E[_++],M[a++]=E[_++],x-=3;x&&(M[a++]=E[_++],x>1&&(M[a++]=E[_++]))}else{_=a-k;do{M[a++]=M[_++],M[a++]=M[_++],M[a++]=M[_++],x-=3}while(x>2);x&&(M[a++]=M[_++],x>1&&(M[a++]=M[_++]))}break}}break}}while(r<i&&a<s);r-=x=p>>3,h&=(1<<(p-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=a<s?s-a+257:257-(a-s),n.hold=h,n.bits=p}},{}],8:[function(e,t,n){var r=e("../utils/common"),i=e("./adler32"),a=e("./crc32"),o=e("./inffast"),s=e("./inftrees");function l(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):-2}function f(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):-2}function d(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,f(e))):-2}function h(e,t){var n,r;return e?(r=new c,e.state=r,r.window=null,0!==(n=d(e,t))&&(e.state=null),n):-2}var p,m,v=!0;function y(e){if(v){var t;for(p=new r.Buf32(512),m=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(s(1,e.lens,0,288,p,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,m,0,e.work,{bits:5}),v=!1}e.lencode=p,e.lenbits=9,e.distcode=m,e.distbits=5}function g(e,t,n,i){var a,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),i>=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>i&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}n.inflateReset=f,n.inflateReset2=d,n.inflateResetKeep=u,n.inflateInit=function(e){return h(e,15)},n.inflateInit2=h,n.inflate=function(e,t){var n,c,u,f,d,h,p,m,v,b,w,x,k,_,E,S,M,T,C,A,N,I,O,D,L=0,F=new r.Buf8(4),R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(n=e.state).mode&&(n.mode=13),d=e.next_out,u=e.output,p=e.avail_out,f=e.next_in,c=e.input,h=e.avail_in,m=n.hold,v=n.bits,b=h,w=p,I=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;v<16;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(2&n.wrap&&35615===m){n.check=0,F[0]=255&m,F[1]=m>>>8&255,n.check=a(n.check,F,2,0),m=0,v=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&m)<<8)+(m>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&m)){e.msg="unknown compression method",n.mode=30;break}if(v-=4,N=8+(15&(m>>>=4)),0===n.wbits)n.wbits=N;else if(N>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<N,e.adler=n.check=1,n.mode=512&m?10:12,m=0,v=0;break;case 2:for(;v<16;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(n.flags=m,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=m>>8&1),512&n.flags&&(F[0]=255&m,F[1]=m>>>8&255,n.check=a(n.check,F,2,0)),m=0,v=0,n.mode=3;case 3:for(;v<32;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}n.head&&(n.head.time=m),512&n.flags&&(F[0]=255&m,F[1]=m>>>8&255,F[2]=m>>>16&255,F[3]=m>>>24&255,n.check=a(n.check,F,4,0)),m=0,v=0,n.mode=4;case 4:for(;v<16;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}n.head&&(n.head.xflags=255&m,n.head.os=m>>8),512&n.flags&&(F[0]=255&m,F[1]=m>>>8&255,n.check=a(n.check,F,2,0)),m=0,v=0,n.mode=5;case 5:if(1024&n.flags){for(;v<16;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}n.length=m,n.head&&(n.head.extra_len=m),512&n.flags&&(F[0]=255&m,F[1]=m>>>8&255,n.check=a(n.check,F,2,0)),m=0,v=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((x=n.length)>h&&(x=h),x&&(n.head&&(N=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,c,f,x,N)),512&n.flags&&(n.check=a(n.check,c,x,f)),h-=x,f+=x,n.length-=x),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===h)break e;x=0;do{N=c[f+x++],n.head&&N&&n.length<65536&&(n.head.name+=String.fromCharCode(N))}while(N&&x<h);if(512&n.flags&&(n.check=a(n.check,c,x,f)),h-=x,f+=x,N)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===h)break e;x=0;do{N=c[f+x++],n.head&&N&&n.length<65536&&(n.head.comment+=String.fromCharCode(N))}while(N&&x<h);if(512&n.flags&&(n.check=a(n.check,c,x,f)),h-=x,f+=x,N)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;v<16;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(m!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}m=0,v=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;v<32;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}e.adler=n.check=l(m),m=0,v=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=d,e.avail_out=p,e.next_in=f,e.avail_in=h,n.hold=m,n.bits=v,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){m>>>=7&v,v-=7&v,n.mode=27;break}for(;v<3;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}switch(n.last=1&m,v-=1,3&(m>>>=1)){case 0:n.mode=14;break;case 1:if(y(n),n.mode=20,6===t){m>>>=2,v-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}m>>>=2,v-=2;break;case 14:for(m>>>=7&v,v-=7&v;v<32;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if((65535&m)!=(m>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&m,m=0,v=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(x=n.length){if(x>h&&(x=h),x>p&&(x=p),0===x)break e;r.arraySet(u,c,f,x,d),h-=x,f+=x,p-=x,d+=x,n.length-=x;break}n.mode=12;break;case 17:for(;v<14;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(n.nlen=257+(31&m),m>>>=5,v-=5,n.ndist=1+(31&m),m>>>=5,v-=5,n.ncode=4+(15&m),m>>>=4,v-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;v<3;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}n.lens[R[n.have++]]=7&m,m>>>=3,v-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,O={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,O),n.lenbits=O.bits,I){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;S=(L=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,M=65535&L,!((E=L>>>24)<=v);){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(M<16)m>>>=E,v-=E,n.lens[n.have++]=M;else{if(16===M){for(D=E+2;v<D;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(m>>>=E,v-=E,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}N=n.lens[n.have-1],x=3+(3&m),m>>>=2,v-=2}else if(17===M){for(D=E+3;v<D;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}v-=E,N=0,x=3+(7&(m>>>=E)),m>>>=3,v-=3}else{for(D=E+7;v<D;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}v-=E,N=0,x=11+(127&(m>>>=E)),m>>>=7,v-=7}if(n.have+x>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;x--;)n.lens[n.have++]=N}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,O={bits:n.lenbits},I=s(1,n.lens,0,n.nlen,n.lencode,0,n.work,O),n.lenbits=O.bits,I){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,O={bits:n.distbits},I=s(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,O),n.distbits=O.bits,I){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(h>=6&&p>=258){e.next_out=d,e.avail_out=p,e.next_in=f,e.avail_in=h,n.hold=m,n.bits=v,o(e,w),d=e.next_out,u=e.output,p=e.avail_out,f=e.next_in,c=e.input,h=e.avail_in,m=n.hold,v=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;S=(L=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,M=65535&L,!((E=L>>>24)<=v);){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(S&&0==(240&S)){for(T=E,C=S,A=M;S=(L=n.lencode[A+((m&(1<<T+C)-1)>>T)])>>>16&255,M=65535&L,!(T+(E=L>>>24)<=v);){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}m>>>=T,v-=T,n.back+=T}if(m>>>=E,v-=E,n.back+=E,n.length=M,0===S){n.mode=26;break}if(32&S){n.back=-1,n.mode=12;break}if(64&S){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&S,n.mode=22;case 22:if(n.extra){for(D=n.extra;v<D;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}n.length+=m&(1<<n.extra)-1,m>>>=n.extra,v-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;S=(L=n.distcode[m&(1<<n.distbits)-1])>>>16&255,M=65535&L,!((E=L>>>24)<=v);){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(0==(240&S)){for(T=E,C=S,A=M;S=(L=n.distcode[A+((m&(1<<T+C)-1)>>T)])>>>16&255,M=65535&L,!(T+(E=L>>>24)<=v);){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}m>>>=T,v-=T,n.back+=T}if(m>>>=E,v-=E,n.back+=E,64&S){e.msg="invalid distance code",n.mode=30;break}n.offset=M,n.extra=15&S,n.mode=24;case 24:if(n.extra){for(D=n.extra;v<D;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}n.offset+=m&(1<<n.extra)-1,m>>>=n.extra,v-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===p)break e;if(x=w-p,n.offset>x){if((x=n.offset-x)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}x>n.wnext?(x-=n.wnext,k=n.wsize-x):k=n.wnext-x,x>n.length&&(x=n.length),_=n.window}else _=u,k=d-n.offset,x=n.length;x>p&&(x=p),p-=x,n.length-=x;do{u[d++]=_[k++]}while(--x);0===n.length&&(n.mode=21);break;case 26:if(0===p)break e;u[d++]=n.length,p--,n.mode=21;break;case 27:if(n.wrap){for(;v<32;){if(0===h)break e;h--,m|=c[f++]<<v,v+=8}if(w-=p,e.total_out+=w,n.total+=w,w&&(e.adler=n.check=n.flags?a(n.check,u,w,d-w):i(n.check,u,w,d-w)),w=p,(n.flags?m:l(m))!==n.check){e.msg="incorrect data check",n.mode=30;break}m=0,v=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;v<32;){if(0===h)break e;h--,m+=c[f++]<<v,v+=8}if(m!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}m=0,v=0}n.mode=29;case 29:I=1;break e;case 30:I=-3;break e;case 31:return-4;case 32:default:return-2}return e.next_out=d,e.avail_out=p,e.next_in=f,e.avail_in=h,n.hold=m,n.bits=v,(n.wsize||w!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&g(e,e.output,e.next_out,w-e.avail_out),b-=e.avail_in,w-=e.avail_out,e.total_in+=b,e.total_out+=w,n.total+=w,n.wrap&&w&&(e.adler=n.check=n.flags?a(n.check,u,w,e.next_out-w):i(n.check,u,w,e.next_out-w)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0===b&&0===w||4===t)&&0===I&&(I=-5),I},n.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},n.inflateGetHeader=function(e,t){var n;return e&&e.state?0==(2&(n=e.state).wrap)?-2:(n.head=t,t.done=!1,0):-2},n.inflateSetDictionary=function(e,t){var n,r=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?-2:11===n.mode&&i(1,t,r,0)!==n.check?-3:g(e,t,r,r)?(n.mode=31,-4):(n.havedict=1,0):-2},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(e,t,n){var r=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,l,c,u,f,d){var h,p,m,v,y,g,b,w,x,k=d.bits,_=0,E=0,S=0,M=0,T=0,C=0,A=0,N=0,I=0,O=0,D=null,L=0,F=new r.Buf16(16),R=new r.Buf16(16),P=null,B=0;for(_=0;_<=15;_++)F[_]=0;for(E=0;E<l;E++)F[t[n+E]]++;for(T=k,M=15;M>=1&&0===F[M];M--);if(T>M&&(T=M),0===M)return c[u++]=20971520,c[u++]=20971520,d.bits=1,0;for(S=1;S<M&&0===F[S];S++);for(T<S&&(T=S),N=1,_=1;_<=15;_++)if(N<<=1,(N-=F[_])<0)return-1;if(N>0&&(0===e||1!==M))return-1;for(R[1]=0,_=1;_<15;_++)R[_+1]=R[_]+F[_];for(E=0;E<l;E++)0!==t[n+E]&&(f[R[t[n+E]]++]=E);if(0===e?(D=P=f,g=19):1===e?(D=i,L-=257,P=a,B-=257,g=256):(D=o,P=s,g=-1),O=0,E=0,_=S,y=u,C=T,A=0,m=-1,v=(I=1<<T)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){b=_-A,f[E]<g?(w=0,x=f[E]):f[E]>g?(w=P[B+f[E]],x=D[L+f[E]]):(w=96,x=0),h=1<<_-A,S=p=1<<C;do{c[y+(O>>A)+(p-=h)]=b<<24|w<<16|x|0}while(0!==p);for(h=1<<_-1;O&h;)h>>=1;if(0!==h?(O&=h-1,O+=h):O=0,E++,0==--F[_]){if(_===M)break;_=t[n+f[E]]}if(_>T&&(O&v)!==m){for(0===A&&(A=T),y+=S,N=1<<(C=_-A);C+A<M&&!((N-=F[C+A])<=0);)C++,N<<=1;if(I+=1<<C,1===e&&I>852||2===e&&I>592)return 1;c[m=O&v]=T<<24|C<<16|y-u|0}}return 0!==O&&(c[y+O]=_-A<<24|64<<16|0),d.bits=T,0}},{"../utils/common":1}],10:[function(e,t,n){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/lib/inflate.js":[function(e,t,n){var r=e("./zlib/inflate"),i=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/constants"),s=e("./zlib/messages"),l=e("./zlib/zstream"),c=e("./zlib/gzheader"),u=Object.prototype.toString;function f(e){if(!(this instanceof f))return new f(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(s[n]);if(this.header=new c,r.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=a.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=r.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(s[n])}function d(e,t){var n=new f(t);if(n.push(e,!0),n.err)throw n.msg||s[n.err];return n.result}f.prototype.push=function(e,t){var n,s,l,c,f,d=this.strm,h=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;s=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=a.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new i.Buf8(h),d.next_out=0,d.avail_out=h),(n=r.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&p&&(n=r.inflateSetDictionary(this.strm,p)),n===o.Z_BUF_ERROR&&!0===m&&(n=o.Z_OK,m=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&n!==o.Z_STREAM_END&&(0!==d.avail_in||s!==o.Z_FINISH&&s!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=a.utf8border(d.output,d.next_out),c=d.next_out-l,f=a.buf2string(d.output,l),d.next_out=c,d.avail_out=h-c,c&&i.arraySet(d.output,d.output,l,c,0),this.onData(f)):this.onData(i.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(s=o.Z_FINISH),s===o.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):s!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),d.avail_out=0,!0)},f.prototype.onData=function(e){this.chunks.push(e)},f.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=f,n.inflate=d,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},n.ungzip=d},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")})).inflate;return e.Replayer=ue,e.unpack=function(e){if("string"!=typeof e)return e;try{if((t=JSON.parse(e)).timestamp)return t}catch(e){}try{var t;if("v1"===(t=JSON.parse(fe(e,{to:"string"}))).v)return t;throw new Error("These events were packed with packer "+t.v+" which is incompatible with current packer v1.")}catch(e){throw console.error(e),new Error("Unknown data format.")}},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=memento-core-replay-unpack.min.js.map