Skip to content

The free and privacy-friendly screen recorder with no limits 🎥

Improved chunk handling in the sandboxed environment

Alyssa X19ae779504b3
diff --git a/build/manifest.json b/build/manifest.json
index d8345f3..238bb3f 100644
--- a/build/manifest.json
+++ b/build/manifest.json
@@ -1 +1 @@
-{"description":"__MSG_extDesc__","version":"3.1.14","manifest_version":3,"name":"__MSG_extName__","default_locale":"en","background":{"service_worker":"background.bundle.js"},"action":{"default_icon":"assets/img/icon-34.png"},"icons":{"128":"assets/img/icon-128.png"},"host_permissions":["<all_urls>"],"content_scripts":[{"matches":["<all_urls>"],"js":["contentScript.bundle.js"],"css":["assets/fonts/fonts.css"]}],"web_accessible_resources":[{"resources":["content.styles.css","blank.mp4","playground.html","editor.html","assets/*","setup.html","worker.js","vendor/*","recorder.html","recorderoffscreen.html","sandbox.html","wrapper.html","camera.html","permissions.html","region.html","waveform.html","playground.html","editorfallback.html","download.html","*"],"matches":["<all_urls>"]}],"oauth2":{"client_id":"560517327251-m7n1k3kddknu7s9s4ejvrs1bj91gutd7.apps.googleusercontent.com","scopes":["https://www.googleapis.com/auth/drive.file"]},"cross_origin_embedder_policy":{"value":"require-corp"},"cross_origin_opener_policy":{"value":"same-origin"},"content_security_policy":{"sandbox":"sandbox allow-scripts allow-modals allow-popups; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; object-src 'self';worker-src 'self' blob: ;","extension_pages":"script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; media-src 'self' data: blob: *;"},"sandbox":{"pages":["editor.html"]},"commands":{"start-recording":{"suggested_key":{"default":"Alt+Shift+G"},"description":"Start recording"},"cancel-recording":{"suggested_key":{"default":"Alt+Shift+X"},"description":"Cancel recording"},"pause-recording":{"suggested_key":{"default":"Alt+Shift+M"},"description":"Pause/Resume recording"}},"permissions":["identity","activeTab","storage","unlimitedStorage","downloads","tabs","tabCapture","scripting"],"optional_permissions":["offscreen","desktopCapture","alarms"]}
\ No newline at end of file
+{"description":"__MSG_extDesc__","version":"3.1.15","manifest_version":3,"name":"__MSG_extName__","default_locale":"en","background":{"service_worker":"background.bundle.js"},"action":{"default_icon":"assets/img/icon-34.png"},"icons":{"128":"assets/img/icon-128.png"},"host_permissions":["<all_urls>"],"content_scripts":[{"matches":["<all_urls>"],"js":["contentScript.bundle.js"],"css":["assets/fonts/fonts.css"]}],"web_accessible_resources":[{"resources":["content.styles.css","blank.mp4","playground.html","editor.html","assets/*","setup.html","worker.js","vendor/*","recorder.html","recorderoffscreen.html","sandbox.html","wrapper.html","camera.html","permissions.html","region.html","waveform.html","playground.html","editorfallback.html","download.html","*"],"matches":["<all_urls>"]}],"oauth2":{"client_id":"560517327251-m7n1k3kddknu7s9s4ejvrs1bj91gutd7.apps.googleusercontent.com","scopes":["https://www.googleapis.com/auth/drive.file"]},"cross_origin_embedder_policy":{"value":"require-corp"},"cross_origin_opener_policy":{"value":"same-origin"},"content_security_policy":{"sandbox":"sandbox allow-scripts allow-modals allow-popups; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; object-src 'self';worker-src 'self' blob: ;","extension_pages":"script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; media-src 'self' data: blob: *;"},"sandbox":{"pages":["editor.html"]},"commands":{"start-recording":{"suggested_key":{"default":"Alt+Shift+G"},"description":"Start recording"},"cancel-recording":{"suggested_key":{"default":"Alt+Shift+X"},"description":"Cancel recording"},"pause-recording":{"suggested_key":{"default":"Alt+Shift+M"},"description":"Pause/Resume recording"}},"permissions":["identity","activeTab","storage","unlimitedStorage","downloads","tabs","tabCapture","scripting"],"optional_permissions":["offscreen","desktopCapture","alarms"]}
\ No newline at end of file
diff --git a/build/sandbox.bundle.js b/build/sandbox.bundle.js
index 387e05b..2f19ac7 100644
--- a/build/sandbox.bundle.js
+++ b/build/sandbox.bundle.js
@@ -73,4 +73,4 @@ n(7418);var r=n(7294),i=60103;if(60107,"function"==typeof Symbol&&Symbol.for){va
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var n,r,i,o;if("object"==typeof performance&&"function"==typeof performance.now){var a=performance;t.unstable_now=function(){return a.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var c=null,u=null,d=function(){if(null!==c)try{var e=t.unstable_now();c(!0,e),c=null}catch(e){throw setTimeout(d,0),e}};n=function(e){null!==c?setTimeout(n,0,e):(c=e,setTimeout(d,0))},r=function(e,t){u=setTimeout(e,t)},i=function(){clearTimeout(u)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var f=window.setTimeout,p=window.clearTimeout;if("undefined"!=typeof console){var h=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof h&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var m=!1,g=null,v=-1,y=5,b=0;t.unstable_shouldYield=function(){return t.unstable_now()>=b},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):y=0<e?Math.floor(1e3/e):5};var w=new MessageChannel,x=w.port2;w.port1.onmessage=function(){if(null!==g){var e=t.unstable_now();b=e+y;try{g(!0,e)?x.postMessage(null):(m=!1,g=null)}catch(e){throw x.postMessage(null),e}}else m=!1},n=function(e){g=e,m||(m=!0,x.postMessage(null))},r=function(e,n){v=f((function(){e(t.unstable_now())}),n)},i=function(){p(v),v=-1}}function _(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,i=e[r];if(!(void 0!==i&&0<S(i,t)))break e;e[r]=t,e[n]=i,n=r}}function k(e){return void 0===(e=e[0])?null:e}function E(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length;r<i;){var o=2*(r+1)-1,a=e[o],s=o+1,l=e[s];if(void 0!==a&&0>S(a,n))void 0!==l&&0>S(l,a)?(e[r]=l,e[s]=n,r=s):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==l&&0>S(l,n)))break e;e[r]=l,e[s]=n,r=s}}}return t}return null}function S(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var C=[],T=[],A=1,O=null,P=3,M=!1,N=!1,L=!1;function I(e){for(var t=k(T);null!==t;){if(null===t.callback)E(T);else{if(!(t.startTime<=e))break;E(T),t.sortIndex=t.expirationTime,_(C,t)}t=k(T)}}function D(e){if(L=!1,I(e),!N)if(null!==k(C))N=!0,n(R);else{var t=k(T);null!==t&&r(D,t.startTime-e)}}function R(e,n){N=!1,L&&(L=!1,i()),M=!0;var o=P;try{for(I(n),O=k(C);null!==O&&(!(O.expirationTime>n)||e&&!t.unstable_shouldYield());){var a=O.callback;if("function"==typeof a){O.callback=null,P=O.priorityLevel;var s=a(O.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?O.callback=s:O===k(C)&&E(C),I(n)}else E(C);O=k(C)}if(null!==O)var l=!0;else{var c=k(T);null!==c&&r(D,c.startTime-n),l=!1}return l}finally{O=null,P=o,M=!1}}var B=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){N||M||(N=!0,n(R))},t.unstable_getCurrentPriorityLevel=function(){return P},t.unstable_getFirstCallbackNode=function(){return k(C)},t.unstable_next=function(e){switch(P){case 1:case 2:case 3:var t=3;break;default:t=P}var n=P;P=t;try{return e()}finally{P=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=B,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=P;P=e;try{return t()}finally{P=n}},t.unstable_scheduleCallback=function(e,o,a){var s=t.unstable_now();switch("object"==typeof a&&null!==a?a="number"==typeof(a=a.delay)&&0<a?s+a:s:a=s,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return e={id:A++,callback:o,priorityLevel:e,startTime:a,expirationTime:l=a+l,sortIndex:-1},a>s?(e.sortIndex=a,_(T,e),null===k(C)&&e===k(T)&&(L?i():L=!0,r(D,a-s))):(e.sortIndex=l,_(C,e),N||M||(N=!0,n(R))),e},t.unstable_wrapCallback=function(e){var t=P;return function(){var n=P;P=t;try{return e.apply(this,arguments)}finally{P=n}}}},3840:(e,t,n)=>{"use strict";e.exports=n(53)},3379:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var o={},a=[],s=0;s<e.length;s++){var l=e[s],c=r.base?l[0]+r.base:l[0],u=o[c]||0,d="".concat(c," ").concat(u);o[c]=u+1;var f=n(d),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==f)t[f].references++,t[f].updater(p);else{var h=i(p,r);r.byIndex=s,t.splice(s,0,{identifier:d,updater:h,references:1})}a.push(d)}return a}function i(e,t){var n=t.domAPI(t);n.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,i){var o=r(e=e||[],i=i||{});return function(e){e=e||[];for(var a=0;a<o.length;a++){var s=n(o[a]);t[s].references--}for(var l=r(e,i),c=0;c<o.length;c++){var u=n(o[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=l}}},569:e=>{"use strict";var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},4990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2800:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(1166),o=n(3210),a=n(3210),s=n(4370);!function(e){e[e.STATE_TAG=1]="STATE_TAG",e[e.STATE_SIZE=2]="STATE_SIZE",e[e.STATE_CONTENT=3]="STATE_CONTENT"}(r||(r={}));var l=function(){function e(){this._buffer=new o.Buffer(0),this._tag_stack=[],this._state=r.STATE_TAG,this._cursor=0,this._total=0,this._schema=s.byEbmlID,this._result=[]}return e.prototype.decode=function(e){this.readChunk(e);var t=this._result;return this._result=[],t},e.prototype.readChunk=function(e){for(this._buffer=a.concat([this._buffer,new o.Buffer(e)]);this._cursor<this._buffer.length&&(this._state!==r.STATE_TAG||this.readTag())&&(this._state!==r.STATE_SIZE||this.readSize())&&(this._state!==r.STATE_CONTENT||this.readContent()););},e.prototype.getSchemaInfo=function(e){return this._schema[e]||{name:"unknown",level:-1,type:"unknown",description:"unknown"}},e.prototype.readTag=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,o.readVint)(this._buffer,this._cursor);if(null==e)return!1;var t=this._buffer.slice(this._cursor,this._cursor+e.length).reduce((function(e,t,n,r){return e+t*Math.pow(16,2*(r.length-1-n))}),0),n=this.getSchemaInfo(t),i={EBML_ID:t.toString(16),schema:n,type:n.type,name:n.name,level:n.level,tagStart:this._total,tagEnd:this._total+e.length,sizeStart:this._total+e.length,sizeEnd:null,dataStart:null,dataEnd:null,dataSize:null,data:null};return this._tag_stack.push(i),this._cursor+=e.length,this._total+=e.length,this._state=r.STATE_SIZE,!0},e.prototype.readSize=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,o.readVint)(this._buffer,this._cursor);if(null==e)return!1;var t=this._tag_stack[this._tag_stack.length-1];return t.sizeEnd=t.sizeStart+e.length,t.dataStart=t.sizeEnd,t.dataSize=e.value,-1===e.value?(t.dataEnd=-1,"m"===t.type&&(t.unknownSize=!0)):t.dataEnd=t.sizeEnd+e.value,this._cursor+=e.length,this._total+=e.length,this._state=r.STATE_CONTENT,!0},e.prototype.readContent=function(){var e=this._tag_stack[this._tag_stack.length-1];if("m"===e.type){if(e.isEnd=!1,this._result.push(e),this._state=r.STATE_TAG,0===e.dataSize){var t=Object.assign({},e,{isEnd:!0});this._result.push(t),this._tag_stack.pop()}return!0}if(this._buffer.length<this._cursor+e.dataSize)return!1;var n=this._buffer.slice(this._cursor,this._cursor+e.dataSize);switch(this._buffer=this._buffer.slice(this._cursor+e.dataSize),e.data=n,e.type){case"u":e.value=n.readUIntBE(0,n.length);break;case"i":e.value=n.readIntBE(0,n.length);break;case"f":e.value=4===e.dataSize?n.readFloatBE(0):8===e.dataSize?n.readDoubleBE(0):(console.warn("cannot read ".concat(e.dataSize," octets float. failback to 0")),0);break;case"s":e.value=n.toString("ascii");break;case"8":e.value=n.toString("utf8");break;case"b":e.value=n;break;case"d":e.value=(0,o.convertEBMLDateToJSDate)(new i.Int64BE(n).toNumber())}if(null===e.value)throw new Error("unknown tag type:"+e.type);for(this._result.push(e),this._total+=e.dataSize,this._state=r.STATE_TAG,this._cursor=0,this._tag_stack.pop();this._tag_stack.length>0;){var a=this._tag_stack[this._tag_stack.length-1];if(a.dataEnd<0)return this._tag_stack.pop(),!0;if(this._total<a.dataEnd)break;if("m"!==a.type)throw new Error("parent element is not master element");t=Object.assign({},a,{isEnd:!0});this._result.push(t),this._tag_stack.pop()}return!0},e}();t.default=l},8031:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3210),i=n(3210),o=n(4370),a=function(){function e(){this._schema=o.byEbmlID,this._buffers=[],this._stack=[]}return e.prototype.encode=function(e){var t=this;return r.concat(e.reduce((function(e,n){return e.concat(t.encodeChunk(n))}),[])).buffer},e.prototype.encodeChunk=function(e){return"m"===e.type?e.isEnd?this.endTag(e):this.startTag(e):(e.data=i.Buffer.from(e.data),this.writeTag(e)),this.flush()},e.prototype.flush=function(){var e=this._buffers;return this._buffers=[],e},e.prototype.getSchemaInfo=function(e){for(var t=Object.keys(this._schema).map(Number),n=0;n<t.length;n++){var r=t[n];if(this._schema[r].name===e)return new i.Buffer(r.toString(16),"hex")}return null},e.prototype.writeTag=function(e){var t=e.name,n=this.getSchemaInfo(t),i=e.data;if(null==n)throw new Error("No schema entry found for "+t);var o=r.encodeTag(n,i);this._stack.length>0?this._stack[this._stack.length-1].children.push({tagId:n,elm:e,children:[],data:o}):this._buffers=this._buffers.concat(o)},e.prototype.startTag=function(e){var t=e.name,n=this.getSchemaInfo(t);if(null==n)throw new Error("No schema entry found for "+t);if(e.unknownSize){var o=r.encodeTag(n,new i.Buffer(0),e.unknownSize);this._buffers=this._buffers.concat(o)}else{var a={tagId:n,elm:e,children:[],data:null};this._stack.length>0&&this._stack[this._stack.length-1].children.push(a),this._stack.push(a)}},e.prototype.endTag=function(e){e.name;var t=this._stack.pop();if(null==t)throw new Error("EBML structure is broken");if(t.elm.name!==e.name)throw new Error("EBML structure is broken");var n=t.children.reduce((function(e,t){if(null===t.data)throw new Error("EBML structure is broken");return e.concat(t.data)}),[]),i=r.concat(n);"m"===t.elm.type?t.data=r.encodeTag(t.tagId,i,t.elm.unknownSize):t.data=r.encodeTag(t.tagId,i),this._stack.length<1&&(this._buffers=this._buffers.concat(t.data))},e}();t.default=a},1381:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(7187),a=n(3210),s=function(e){function t(){var t=e.call(this)||this;return t.logGroup="",t.hasLoggingStarted=!1,t.metadataloaded=!1,t.chunks=[],t.stack=[],t.segmentOffset=0,t.last2SimpleBlockVideoTrackTimecode=[0,0],t.last2SimpleBlockAudioTrackTimecode=[0,0],t.lastClusterTimecode=0,t.lastClusterPosition=0,t.timecodeScale=1e6,t.metadataSize=0,t.metadatas=[],t.cues=[],t.firstVideoBlockRead=!1,t.firstAudioBlockRead=!1,t.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null},t.trackTypes=[],t.trackDefaultDuration=[],t.trackCodecDelay=[],t.trackInfo={type:"nothing"},t.ended=!1,t.logging=!1,t.use_duration_every_simpleblock=!1,t.use_webp=!1,t.use_segment_info=!0,t.drop_default_duration=!0,t}return i(t,e),t.prototype.stop=function(){for(this.ended=!0,this.emit_segment_info();this.stack.length;)this.stack.pop(),this.logging&&console.groupEnd();this.logging&&this.hasLoggingStarted&&this.logGroup&&console.groupEnd()},t.prototype.emit_segment_info=function(){var e=this.chunks;if(this.chunks=[],this.metadataloaded){if(!this.use_segment_info)return;var t=this.lastClusterTimecode,n=this.duration,r=this.timecodeScale;this.emit("cluster",{timecode:t,data:e}),this.emit("duration",{timecodeScale:r,duration:n})}else{this.metadataloaded=!0,this.metadatas=e;var i=this.trackTypes.indexOf(1),o=this.trackTypes.indexOf(2);if(this.trackInfo=i>=0&&o>=0?{type:"both",trackNumber:i}:i>=0?{type:"video",trackNumber:i}:o>=0?{type:"audio",trackNumber:o}:{type:"nothing"},!this.use_segment_info)return;this.emit("metadata",{data:e,metadataSize:this.metadataSize})}},t.prototype.read=function(e){var t=this,n=!1;if(!this.ended){if("m"===e.type)if(e.isEnd)this.stack.pop();else{var r=this.stack[this.stack.length-1];if(null!=r&&r.level>=e.level){this.stack.pop(),this.logging&&console.groupEnd(),r.dataEnd=e.dataEnd,r.dataSize=e.dataEnd-r.dataStart,r.unknownSize=!1;var i=Object.assign({},r,{name:r.name,type:r.type,isEnd:!0});this.chunks.push(i)}this.stack.push(e)}if("m"===e.type&&"Segment"==e.name)0!=this.segmentOffset&&console.warn("Multiple segments detected!"),this.segmentOffset=e.dataStart,this.emit("segment_offset",this.segmentOffset);else if("b"===e.type&&"SimpleBlock"===e.name){var o=a.ebmlBlock(e.data),s=o.timecode,l=o.trackNumber,c=o.frames;if(1===this.trackTypes[l]){if(!this.firstVideoBlockRead&&(this.firstVideoBlockRead=!0,"both"===this.trackInfo.type||"video"===this.trackInfo.type)){var u=this.lastClusterTimecode+s;this.cues.push({CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit("cue_info",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit("cue",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockVideoTrackTimecode=[this.last2SimpleBlockVideoTrackTimecode[1],s]}else if(2===this.trackTypes[l]){if(!this.firstAudioBlockRead&&(this.firstAudioBlockRead=!0,"audio"===this.trackInfo.type)){u=this.lastClusterTimecode+s;this.cues.push({CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit("cue_info",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit("cue",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockAudioTrackTimecode=[this.last2SimpleBlockAudioTrackTimecode[1],s]}this.use_duration_every_simpleblock&&this.emit("duration",{timecodeScale:this.timecodeScale,duration:this.duration}),this.use_webp&&c.forEach((function(e){if("9d012a"===e.slice(3,6).toString("hex")){var n=a.VP8BitStreamToRiffWebPBuffer(e),r=new Blob([n],{type:"image/webp"}),i=t.duration;t.emit("webp",{currentTime:i,webp:r})}}))}else"m"===e.type&&"Cluster"===e.name&&!1===e.isEnd?(this.firstVideoBlockRead=!1,this.firstAudioBlockRead=!1,this.emit_segment_info(),this.emit("cluster_ptr",e.tagStart),this.lastClusterPosition=e.tagStart):"u"===e.type&&"Timecode"===e.name?this.lastClusterTimecode=e.value:"u"===e.type&&"TimecodeScale"===e.name?this.timecodeScale=e.value:"m"===e.type&&"TrackEntry"===e.name?e.isEnd?(this.trackTypes[this.currentTrack.TrackNumber]=this.currentTrack.TrackType,this.trackDefaultDuration[this.currentTrack.TrackNumber]=this.currentTrack.DefaultDuration,this.trackCodecDelay[this.currentTrack.TrackNumber]=this.currentTrack.CodecDelay):this.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null}:"u"===e.type&&"TrackType"===e.name?this.currentTrack.TrackType=e.value:"u"===e.type&&"TrackNumber"===e.name?this.currentTrack.TrackNumber=e.value:"u"===e.type&&"CodecDelay"===e.name?this.currentTrack.CodecDelay=e.value:"u"===e.type&&"DefaultDuration"===e.name?this.drop_default_duration?(console.warn("DefaultDuration detected!, remove it"),n=!0):this.currentTrack.DefaultDuration=e.value:"unknown"===e.name&&console.warn(e);!this.metadataloaded&&e.dataEnd>0&&(this.metadataSize=e.dataEnd),n||this.chunks.push(e),this.logging&&this.put(e)}},Object.defineProperty(t.prototype,"duration",{get:function(){if("nothing"===this.trackInfo.type)return console.warn("no video, no audio track"),0;var e=0,t=0,n=0,r=this.trackDefaultDuration[this.trackInfo.trackNumber];if("number"==typeof r)e=r;else if("both"===this.trackInfo.type)this.last2SimpleBlockAudioTrackTimecode[1]>this.last2SimpleBlockVideoTrackTimecode[1]?(e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackTypes.indexOf(2)])&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]):(e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackTypes.indexOf(1)])&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]);else if("video"===this.trackInfo.type){e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackInfo.trackNumber])&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]}else if("audio"===this.trackInfo.type){var i;e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackInfo.trackNumber])&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]}var o=((this.lastClusterTimecode+n)*this.timecodeScale+e-t)/this.timecodeScale;return Math.floor(o)},enumerable:!1,configurable:!0}),t.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},t.prototype.put=function(e){this.hasLoggingStarted||(this.hasLoggingStarted=!0,this.logging&&this.logGroup&&console.groupCollapsed(this.logGroup)),"m"===e.type?e.isEnd?console.groupEnd():console.group(e.name+":"+e.tagStart):"b"===e.type?console.log(e.name,e.type):console.log(e.name,e.tagStart,e.type,e.value)},t}(o.EventEmitter);t.default=s},4370:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.byEbmlID=void 0,t.byEbmlID={128:{name:"ChapterDisplay",level:4,type:"m",multiple:!0,minver:1,webm:!0,description:"Contains all possible strings to use for the chapter display."},131:{name:"TrackType",level:3,type:"u",mandatory:!0,minver:1,range:"1-254",description:"A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control)."},133:{name:"ChapString",cppname:"ChapterString",level:5,type:"8",mandatory:!0,minver:1,webm:!0,description:"Contains the string to use as the chapter atom."},134:{name:"CodecID",level:3,type:"s",mandatory:!0,minver:1,description:"An ID corresponding to the codec, see the codec page for more info."},136:{name:"FlagDefault",cppname:"TrackFlagDefault",level:3,type:"u",mandatory:!0,minver:1,default:1,range:"0-1",description:"Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference. (1 bit)"},137:{name:"ChapterTrackNumber",level:5,type:"u",mandatory:!0,multiple:!0,minver:1,webm:!1,range:"not 0",description:"UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks."},145:{name:"ChapterTimeStart",level:4,type:"u",mandatory:!0,minver:1,webm:!0,description:"Timestamp of the start of Chapter (not scaled)."},146:{name:"ChapterTimeEnd",level:4,type:"u",minver:1,webm:!1,description:"Timestamp of the end of Chapter (timestamp excluded, not scaled)."},150:{name:"CueRefTime",level:5,type:"u",mandatory:!0,minver:2,webm:!1,description:"Timestamp of the referenced Block."},151:{name:"CueRefCluster",level:5,type:"u",mandatory:!0,webm:!1,description:"The Position of the Cluster containing the referenced Block."},152:{name:"ChapterFlagHidden",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:0,range:"0-1",description:"If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)"},16980:{name:"ContentCompAlgo",level:6,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"The compression algorithm used. Algorithms that have been specified so far are: 0 - zlib, 3 - Header Stripping"},16981:{name:"ContentCompSettings",level:6,type:"b",minver:1,webm:!1,description:"Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track."},17026:{name:"DocType",level:1,type:"s",mandatory:!0,default:"matroska",minver:1,description:"A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files."},17029:{name:"DocTypeReadVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The minimum DocType version an interpreter has to support to read this file."},17030:{name:"EBMLVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The version of EBML parser used to create the file."},17031:{name:"DocTypeVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The version of DocType interpreter used to create the file."},17476:{name:"SegmentFamily",level:2,type:"b",multiple:!0,minver:1,webm:!1,bytesize:16,description:"A randomly generated unique ID that all segments related to each other must use (128 bits)."},17505:{name:"DateUTC",level:2,type:"d",minver:1,description:"Date of the origin of timestamp (value 0), i.e. production date."},17540:{name:"TagDefault",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"0-1",description:"Indication to know if this is the default/original language to use for the given tag. (1 bit)"},17541:{name:"TagBinary",level:4,type:"b",minver:1,webm:!1,description:"The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString."},17543:{name:"TagString",level:4,type:"8",minver:1,webm:!1,description:"The value of the Element."},17545:{name:"Duration",level:2,type:"f",minver:1,range:"> 0",description:"Duration of the segment (based on TimecodeScale)."},17816:{name:"ChapterFlagEnabled",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"0-1",description:"Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter (see flag notes). (1 bit)"},18016:{name:"FileMimeType",level:3,type:"s",mandatory:!0,minver:1,webm:!1,description:"MIME type of the file."},18017:{name:"FileUsedStartTime",level:3,type:"u",divx:!0,description:"DivX font extension"},18018:{name:"FileUsedEndTime",level:3,type:"u",divx:!0,description:"DivX font extension"},18037:{name:"FileReferral",level:3,type:"b",webm:!1,description:"A binary value that a track/codec can refer to when the attachment is needed."},20529:{name:"ContentEncodingOrder",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment."},20530:{name:"ContentEncodingScope",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"not 0",description:"A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: 1 - all frame contents, 2 - the track's private data, 4 - the next ContentEncoding (next ContentEncodingOrder. Either the data inside ContentCompression and/or ContentEncryption)"},20531:{name:"ContentEncodingType",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"A value describing what kind of transformation has been done. Possible values: 0 - compression, 1 - encryption"},20532:{name:"ContentCompression",level:5,type:"m",minver:1,webm:!1,description:"Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking."},20533:{name:"ContentEncryption",level:5,type:"m",minver:1,webm:!1,description:"Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise."},21368:{name:"CueBlockNumber",level:4,type:"u",minver:1,default:1,range:"not 0",description:"Number of the Block in the specified Cluster."},22100:{name:"ChapterStringUID",level:4,type:"8",mandatory:!1,minver:3,webm:!0,description:"A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage."},22337:{name:"WritingApp",level:2,type:"8",mandatory:!0,minver:1,description:'Writing application ("mkvmerge-0.3.3").'},22612:{name:"SilentTracks",cppname:"ClusterSilentTracks",level:2,type:"m",minver:1,webm:!1,description:"The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use."},25152:{name:"ContentEncoding",level:4,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"Settings for one content encoding like compression or encryption."},25188:{name:"BitDepth",cppname:"AudioBitDepth",level:4,type:"u",minver:1,range:"not 0",description:"Bits per sample, mostly used for PCM."},25906:{name:"SignedElement",level:3,type:"b",multiple:!0,webm:!1,description:"An element ID whose data will be used to compute the signature."},26148:{name:"TrackTranslate",level:3,type:"m",multiple:!0,minver:1,webm:!1,description:"The track identification for the given Chapter Codec."},26897:{name:"ChapProcessCommand",cppname:"ChapterProcessCommand",level:5,type:"m",multiple:!0,minver:1,webm:!1,description:"Contains all the commands associated to the Atom."},26914:{name:"ChapProcessTime",cppname:"ChapterProcessTime",level:6,type:"u",mandatory:!0,minver:1,webm:!1,description:"Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter)."},26916:{name:"ChapterTranslate",level:2,type:"m",multiple:!0,minver:1,webm:!1,description:"A tuple of corresponding ID used by chapter codecs to represent this segment."},26931:{name:"ChapProcessData",cppname:"ChapterProcessData",level:6,type:"b",mandatory:!0,minver:1,webm:!1,description:"Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands."},26948:{name:"ChapProcess",cppname:"ChapterProcess",level:4,type:"m",multiple:!0,minver:1,webm:!1,description:"Contains all the commands associated to the Atom."},26965:{name:"ChapProcessCodecID",cppname:"ChapterProcessCodecID",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later."},29555:{name:"Tag",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"Element containing elements specific to Tracks/Chapters."},29572:{name:"SegmentFilename",level:2,type:"8",minver:1,webm:!1,description:"A filename corresponding to this segment."},29766:{name:"AttachmentLink",cppname:"TrackAttachmentLink",level:3,type:"u",minver:1,webm:!1,range:"not 0",description:"The UID of an attachment that is used by this codec."},2459272:{name:"CodecName",level:3,type:"8",minver:1,description:"A human-readable string specifying the codec."},408125543:{name:"Segment",level:"0",type:"m",mandatory:!0,multiple:!0,minver:1,description:"This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment."},17530:{name:"TagLanguage",level:4,type:"s",mandatory:!0,minver:1,webm:!1,default:"und",description:"Specifies the language of the tag specified, in the Matroska languages form."},17827:{name:"TagName",level:4,type:"8",mandatory:!0,minver:1,webm:!1,description:"The name of the Tag that is going to be stored."},26568:{name:"SimpleTag",cppname:"TagSimple",level:3,recursive:"1",type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"Contains general information about the target."},25542:{name:"TagAttachmentUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,default:0,description:"A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment."},25540:{name:"TagChapterUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,default:0,description:"A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment."},25545:{name:"TagEditionUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,default:0,description:"A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment."},25541:{name:"TagTrackUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,default:0,description:"A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment."},25546:{name:"TargetType",cppname:"TagTargetType",level:4,type:"s",minver:1,webm:!1,strong:"informational",description:'An string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).'},26826:{name:"TargetTypeValue",cppname:"TagTargetTypeValue",level:4,type:"u",minver:1,webm:!1,default:50,description:"A number to indicate the logical level of the target (see TargetType)."},25536:{name:"Targets",cppname:"TagTargets",level:3,type:"m",mandatory:!0,minver:1,webm:!1,description:"Contain all UIDs where the specified meta data apply. It is empty to describe everything in the segment."},307544935:{name:"Tags",level:1,type:"m",multiple:!0,minver:1,webm:!1,description:"Element containing elements specific to Tracks/Chapters. A list of valid tags can be found here."},17677:{name:"ChapProcessPrivate",cppname:"ChapterProcessPrivate",level:5,type:"b",minver:1,webm:!1,description:'Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.'},17278:{name:"ChapCountry",cppname:"ChapterCountry",level:5,type:"s",multiple:!0,minver:1,webm:!1,description:"The countries corresponding to the string, same 2 octets as in Internet domains."},17276:{name:"ChapLanguage",cppname:"ChapterLanguage",level:5,type:"s",mandatory:!0,multiple:!0,minver:1,webm:!0,default:"eng",description:"The languages corresponding to the string, in the bibliographic ISO-639-2 form."},143:{name:"ChapterTrack",level:4,type:"m",minver:1,webm:!1,description:"List of tracks on which the chapter applies. If this element is not present, all tracks apply"},25539:{name:"ChapterPhysicalEquiv",level:4,type:"u",minver:1,webm:!1,description:'Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.'},28348:{name:"ChapterSegmentEditionUID",level:4,type:"u",minver:1,webm:!1,range:"not 0",description:"The EditionUID to play from the segment linked in ChapterSegmentUID."},28263:{name:"ChapterSegmentUID",level:4,type:"b",minver:1,webm:!1,range:">0",bytesize:16,description:"A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used."},29636:{name:"ChapterUID",level:4,type:"u",mandatory:!0,minver:1,webm:!0,range:"not 0",description:"A unique ID to identify the Chapter."},182:{name:"ChapterAtom",level:3,recursive:"1",type:"m",mandatory:!0,multiple:!0,minver:1,webm:!0,description:"Contains the atom information to use as the chapter atom (apply to all tracks)."},17885:{name:"EditionFlagOrdered",level:3,type:"u",minver:1,webm:!1,default:0,range:"0-1",description:"Specify if the chapters can be defined multiple times and the order to play them is enforced. (1 bit)"},17883:{name:"EditionFlagDefault",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,range:"0-1",description:"If a flag is set (1) the edition should be used as the default one. (1 bit)"},17853:{name:"EditionFlagHidden",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,range:"0-1",description:"If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)"},17852:{name:"EditionUID",level:3,type:"u",minver:1,webm:!1,range:"not 0",description:"A unique ID to identify the edition. It's useful for tagging an edition."},17849:{name:"EditionEntry",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!0,description:"Contains all information about a segment edition."},272869232:{name:"Chapters",level:1,type:"m",minver:1,webm:!0,description:"A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation."},18094:{name:"FileUID",level:3,type:"u",mandatory:!0,minver:1,webm:!1,range:"not 0",description:"Unique ID representing the file, as random as possible."},18012:{name:"FileData",level:3,type:"b",mandatory:!0,minver:1,webm:!1,description:"The data of the file."},18030:{name:"FileName",level:3,type:"8",mandatory:!0,minver:1,webm:!1,description:"Filename of the attached file."},18046:{name:"FileDescription",level:3,type:"8",minver:1,webm:!1,description:"A human-friendly name for the attached file."},24999:{name:"AttachedFile",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"An attached file."},423732329:{name:"Attachments",level:1,type:"m",minver:1,webm:!1,description:"Contain attached files."},235:{name:"CueRefCodecState",level:5,type:"u",webm:!1,default:0,description:"The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry."},21343:{name:"CueRefNumber",level:5,type:"u",webm:!1,default:1,range:"not 0",description:"Number of the referenced Block of Track X in the specified Cluster."},219:{name:"CueReference",level:4,type:"m",multiple:!0,minver:2,webm:!1,description:"The Clusters containing the required referenced Blocks."},234:{name:"CueCodecState",level:4,type:"u",minver:2,webm:!1,default:0,description:"The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry."},178:{name:"CueDuration",level:4,type:"u",mandatory:!1,minver:4,webm:!1,description:"The duration of the block according to the segment time base. If missing the track's DefaultDuration does not apply and no duration information is available in terms of the cues."},240:{name:"CueRelativePosition",level:4,type:"u",mandatory:!1,minver:4,webm:!1,description:"The relative position of the referenced block inside the cluster with 0 being the first possible position for an element inside that cluster.",position:"clusterRelative"},241:{name:"CueClusterPosition",level:4,type:"u",mandatory:!0,minver:1,description:"The position of the Cluster containing the required Block.",position:"segment"},247:{name:"CueTrack",level:4,type:"u",mandatory:!0,minver:1,range:"not 0",description:"The track for which a position is given."},183:{name:"CueTrackPositions",level:3,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Contain positions for different tracks corresponding to the timestamp."},179:{name:"CueTime",level:3,type:"u",mandatory:!0,minver:1,description:"Absolute timestamp according to the segment time base."},187:{name:"CuePoint",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Contains all information relative to a seek point in the segment."},475249515:{name:"Cues",level:1,type:"m",minver:1,description:'A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams.'},18406:{name:"ContentSigHashAlgo",level:6,type:"u",minver:1,webm:!1,default:0,description:"The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - SHA1-160 2 - MD5"},18405:{name:"ContentSigAlgo",level:6,type:"u",minver:1,webm:!1,default:0,description:"The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - RSA"},18404:{name:"ContentSigKeyID",level:6,type:"b",minver:1,webm:!1,description:"This is the ID of the private key the data was signed with."},18403:{name:"ContentSignature",level:6,type:"b",minver:1,webm:!1,description:"A cryptographic signature of the contents."},18402:{name:"ContentEncKeyID",level:6,type:"b",minver:1,webm:!1,description:"For public key algorithms this is the ID of the public key the the data was encrypted with."},18401:{name:"ContentEncAlgo",level:6,type:"u",minver:1,webm:!1,default:0,description:"The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: 1 - DES, 2 - 3DES, 3 - Twofish, 4 - Blowfish, 5 - AES"},28032:{name:"ContentEncodings",level:3,type:"m",minver:1,webm:!1,description:"Settings for several content encoding mechanisms like compression or encryption."},196:{name:"TrickMasterTrackSegmentUID",level:3,type:"b",divx:!0,bytesize:16,description:"DivX trick track extenstions"},199:{name:"TrickMasterTrackUID",level:3,type:"u",divx:!0,description:"DivX trick track extenstions"},198:{name:"TrickTrackFlag",level:3,type:"u",divx:!0,default:0,description:"DivX trick track extenstions"},193:{name:"TrickTrackSegmentUID",level:3,type:"b",divx:!0,bytesize:16,description:"DivX trick track extenstions"},192:{name:"TrickTrackUID",level:3,type:"u",divx:!0,description:"DivX trick track extenstions"},237:{name:"TrackJoinUID",level:5,type:"u",mandatory:!0,multiple:!0,minver:3,webm:!1,range:"not 0",description:"The trackUID number of a track whose blocks are used to create this virtual track."},233:{name:"TrackJoinBlocks",level:4,type:"m",minver:3,webm:!1,description:"Contains the list of all tracks whose Blocks need to be combined to create this virtual track"},230:{name:"TrackPlaneType",level:6,type:"u",mandatory:!0,minver:3,webm:!1,description:"The kind of plane this track corresponds to (0: left eye, 1: right eye, 2: background)."},229:{name:"TrackPlaneUID",level:6,type:"u",mandatory:!0,minver:3,webm:!1,range:"not 0",description:"The trackUID number of the track representing the plane."},228:{name:"TrackPlane",level:5,type:"m",mandatory:!0,multiple:!0,minver:3,webm:!1,description:"Contains a video plane track that need to be combined to create this 3D track"},227:{name:"TrackCombinePlanes",level:4,type:"m",minver:3,webm:!1,description:"Contains the list of all video plane tracks that need to be combined to create this 3D track"},226:{name:"TrackOperation",level:3,type:"m",minver:3,webm:!1,description:"Operation that needs to be applied on tracks to create this virtual track. For more details look at the Specification Notes on the subject."},32123:{name:"ChannelPositions",cppname:"AudioPosition",level:4,type:"b",webm:!1,description:"Table of horizontal angles for each successive channel, see appendix."},159:{name:"Channels",cppname:"AudioChannels",level:4,type:"u",mandatory:!0,minver:1,default:1,range:"not 0",description:"Numbers of channels in the track."},30901:{name:"OutputSamplingFrequency",cppname:"AudioOutputSamplingFreq",level:4,type:"f",minver:1,default:"Sampling Frequency",range:"> 0",description:"Real output sampling frequency in Hz (used for SBR techniques)."},181:{name:"SamplingFrequency",cppname:"AudioSamplingFreq",level:4,type:"f",mandatory:!0,minver:1,default:8e3,range:"> 0",description:"Sampling frequency in Hz."},225:{name:"Audio",cppname:"TrackAudio",level:3,type:"m",minver:1,description:"Audio settings."},2327523:{name:"FrameRate",cppname:"VideoFrameRate",level:4,type:"f",range:"> 0",strong:"Informational",description:"Number of frames per second. only."},3126563:{name:"GammaValue",cppname:"VideoGamma",level:4,type:"f",webm:!1,range:"> 0",description:"Gamma Value."},3061028:{name:"ColourSpace",cppname:"VideoColourSpace",level:4,type:"b",minver:1,webm:!1,bytesize:4,description:"Same value as in AVI (32 bits)."},21683:{name:"AspectRatioType",cppname:"VideoAspectRatio",level:4,type:"u",minver:1,default:0,description:"Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed)."},21682:{name:"DisplayUnit",cppname:"VideoDisplayUnit",level:4,type:"u",minver:1,default:0,description:"How DisplayWidth & DisplayHeight should be interpreted (0: pixels, 1: centimeters, 2: inches, 3: Display Aspect Ratio)."},21690:{name:"DisplayHeight",cppname:"VideoDisplayHeight",level:4,type:"u",minver:1,default:"PixelHeight",range:"not 0",description:"Height of the video frames to display. The default value is only valid when DisplayUnit is 0."},21680:{name:"DisplayWidth",cppname:"VideoDisplayWidth",level:4,type:"u",minver:1,default:"PixelWidth",range:"not 0",description:"Width of the video frames to display. The default value is only valid when DisplayUnit is 0."},21725:{name:"PixelCropRight",cppname:"VideoPixelCropRight",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove on the right of the image."},21708:{name:"PixelCropLeft",cppname:"VideoPixelCropLeft",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove on the left of the image."},21691:{name:"PixelCropTop",cppname:"VideoPixelCropTop",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove at the top of the image."},21674:{name:"PixelCropBottom",cppname:"VideoPixelCropBottom",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove at the bottom of the image (for HDTV content)."},186:{name:"PixelHeight",cppname:"VideoPixelHeight",level:4,type:"u",mandatory:!0,minver:1,range:"not 0",description:"Height of the encoded video frames in pixels."},176:{name:"PixelWidth",cppname:"VideoPixelWidth",level:4,type:"u",mandatory:!0,minver:1,range:"not 0",description:"Width of the encoded video frames in pixels."},21433:{name:"OldStereoMode",level:4,type:"u",maxver:"0",webm:!1,divx:!1,description:"DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska. (0: mono, 1: right eye, 2: left eye, 3: both eyes)."},21440:{name:"AlphaMode",cppname:"VideoAlphaMode",level:4,type:"u",minver:3,webm:!0,default:0,description:"Alpha Video Mode. Presence of this element indicates that the BlockAdditional element could contain Alpha data."},21432:{name:"StereoMode",cppname:"VideoStereoMode",level:4,type:"u",minver:3,webm:!0,default:0,description:"Stereo-3D video mode (0: mono, 1: side by side (left eye is first), 2: top-bottom (right eye is first), 3: top-bottom (left eye is first), 4: checkboard (right is first), 5: checkboard (left is first), 6: row interleaved (right is first), 7: row interleaved (left is first), 8: column interleaved (right is first), 9: column interleaved (left is first), 10: anaglyph (cyan/red), 11: side by side (right eye is first), 12: anaglyph (green/magenta), 13 both eyes laced in one Block (left eye is first), 14 both eyes laced in one Block (right eye is first)) . There are some more details on 3D support in the Specification Notes."},154:{name:"FlagInterlaced",cppname:"VideoFlagInterlaced",level:4,type:"u",mandatory:!0,minver:2,webm:!0,default:0,range:"0-1",description:"Set if the video is interlaced. (1 bit)"},224:{name:"Video",cppname:"TrackVideo",level:3,type:"m",minver:1,description:"Video settings."},26277:{name:"TrackTranslateTrackID",level:4,type:"b",mandatory:!0,minver:1,webm:!1,description:"The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used."},26303:{name:"TrackTranslateCodec",level:4,type:"u",mandatory:!0,minver:1,webm:!1,description:"The chapter codec using this ID (0: Matroska Script, 1: DVD-menu)."},26364:{name:"TrackTranslateEditionUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,description:"Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment."},22203:{name:"SeekPreRoll",level:3,type:"u",mandatory:!0,multiple:!1,default:0,minver:4,webm:!0,description:"After a discontinuity, SeekPreRoll is the duration in nanoseconds of the data the decoder must decode before the decoded data is valid."},22186:{name:"CodecDelay",level:3,type:"u",multiple:!1,default:0,minver:4,webm:!0,description:"CodecDelay is The codec-built-in delay in nanoseconds. This value must be subtracted from each block timestamp in order to get the actual timestamp. The value should be small so the muxing of tracks with the same actual timestamp are in the same Cluster."},28587:{name:"TrackOverlay",level:3,type:"u",multiple:!0,minver:1,webm:!1,description:"Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc."},170:{name:"CodecDecodeAll",level:3,type:"u",mandatory:!0,minver:2,webm:!1,default:1,range:"0-1",description:"The codec can decode potentially damaged data (1 bit)."},2536e3:{name:"CodecDownloadURL",level:3,type:"s",multiple:!0,webm:!1,description:"A URL to download about the codec used."},3883072:{name:"CodecInfoURL",level:3,type:"s",multiple:!0,webm:!1,description:"A URL to find information about the codec used."},3839639:{name:"CodecSettings",level:3,type:"8",webm:!1,description:"A string describing the encoding setting used."},25506:{name:"CodecPrivate",level:3,type:"b",minver:1,description:"Private data only known to the codec."},2274716:{name:"Language",cppname:"TrackLanguage",level:3,type:"s",minver:1,default:"eng",description:"Specifies the language of the track in the Matroska languages form."},21358:{name:"Name",cppname:"TrackName",level:3,type:"8",minver:1,description:"A human-readable track name."},21998:{name:"MaxBlockAdditionID",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"The maximum value of BlockAdditions for this track."},21375:{name:"TrackOffset",level:3,type:"i",webm:!1,default:0,description:"A value to add to the Block's Timestamp. This can be used to adjust the playback offset of a track."},2306383:{name:"TrackTimecodeScale",level:3,type:"f",mandatory:!0,minver:1,maxver:"3",webm:!1,default:1,range:"> 0",description:"DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs)."},2313850:{name:"DefaultDecodedFieldDuration",cppname:"TrackDefaultDecodedFieldDuration",level:3,type:"u",minver:4,range:"not 0",description:"The period in nanoseconds (not scaled by TimcodeScale)\nbetween two successive fields at the output of the decoding process (see the notes)"},2352003:{name:"DefaultDuration",cppname:"TrackDefaultDuration",level:3,type:"u",minver:1,range:"not 0",description:"Number of nanoseconds (not scaled via TimecodeScale) per frame ('frame' in the Matroska sense -- one element put into a (Simple)Block)."},28152:{name:"MaxCache",cppname:"TrackMaxCache",level:3,type:"u",minver:1,webm:!1,description:"The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed."},28135:{name:"MinCache",cppname:"TrackMinCache",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used."},156:{name:"FlagLacing",cppname:"TrackFlagLacing",level:3,type:"u",mandatory:!0,minver:1,default:1,range:"0-1",description:"Set if the track may contain blocks using lacing. (1 bit)"},21930:{name:"FlagForced",cppname:"TrackFlagForced",level:3,type:"u",mandatory:!0,minver:1,default:0,range:"0-1",description:"Set if that track MUST be active during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. (1 bit)"},185:{name:"FlagEnabled",cppname:"TrackFlagEnabled",level:3,type:"u",mandatory:!0,minver:2,webm:!0,default:1,range:"0-1",description:"Set if the track is usable. (1 bit)"},29637:{name:"TrackUID",level:3,type:"u",mandatory:!0,minver:1,range:"not 0",description:"A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file."},215:{name:"TrackNumber",level:3,type:"u",mandatory:!0,minver:1,range:"not 0",description:"The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number)."},174:{name:"TrackEntry",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Describes a track with all elements."},374648427:{name:"Tracks",level:1,type:"m",multiple:!0,minver:1,description:"A top-level block of information with many tracks described."},175:{name:"EncryptedBlock",level:2,type:"b",multiple:!0,webm:!1,description:"Similar to EncryptedBlock Structure)"},202:{name:"ReferenceTimeCode",level:4,type:"u",multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:"DivX trick track extenstions"},201:{name:"ReferenceOffset",level:4,type:"u",multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:"DivX trick track extenstions"},200:{name:"ReferenceFrame",level:3,type:"m",multiple:!1,minver:0,webm:!1,divx:!0,description:"DivX trick track extenstions"},207:{name:"SliceDuration",level:5,type:"u",default:0,description:"The (scaled) duration to apply to the element."},206:{name:"Delay",cppname:"SliceDelay",level:5,type:"u",default:0,description:"The (scaled) delay to apply to the element."},203:{name:"BlockAdditionID",cppname:"SliceBlockAddID",level:5,type:"u",default:0,description:"The ID of the BlockAdditional element (0 is the main Block)."},205:{name:"FrameNumber",cppname:"SliceFrameNumber",level:5,type:"u",default:0,description:"The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame)."},204:{name:"LaceNumber",cppname:"SliceLaceNumber",level:5,type:"u",minver:1,default:0,divx:!1,description:"The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback."},232:{name:"TimeSlice",level:4,type:"m",multiple:!0,minver:1,divx:!1,description:"Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback."},142:{name:"Slices",level:3,type:"m",minver:1,divx:!1,description:"Contains slices description."},30114:{name:"DiscardPadding",level:3,type:"i",minver:4,webm:!0,description:"Duration in nanoseconds of the silent data added to the Block (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and should be discarded during playback."},164:{name:"CodecState",level:3,type:"b",minver:2,webm:!1,description:"The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry."},253:{name:"ReferenceVirtual",level:3,type:"i",webm:!1,description:"Relative position of the data that should be in position of the virtual block."},251:{name:"ReferenceBlock",level:3,type:"i",multiple:!0,minver:1,description:"Timestamp of another frame used as a reference (ie: B or P frame). The timestamp is relative to the block it's attached to."},250:{name:"ReferencePriority",cppname:"FlagReferenced",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced."},155:{name:"BlockDuration",level:3,type:"u",minver:1,default:"TrackDuration",description:'The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track (but can be omitted as other default values). When not written and with no DefaultDuration, the value is assumed to be the difference between the timestamp of this Block and the timestamp of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. When set to 0 that means the frame is not a keyframe.'},165:{name:"BlockAdditional",level:5,type:"b",mandatory:!0,minver:1,webm:!1,description:"Interpreted by the codec as it wishes (using the BlockAddID)."},238:{name:"BlockAddID",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"not 0",description:"An ID to identify the BlockAdditional level."},166:{name:"BlockMore",level:4,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"Contain the BlockAdditional and some parameters."},30113:{name:"BlockAdditions",level:3,type:"m",minver:1,webm:!1,description:"Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data."},162:{name:"BlockVirtual",level:3,type:"b",webm:!1,description:"A Block with no data. It must be stored in the stream at the place the real Block should be in display order. (see Block Virtual)"},161:{name:"Block",level:3,type:"b",mandatory:!0,minver:1,description:"Block containing the actual data to be rendered and a timestamp relative to the Cluster Timecode. (see Block Structure)"},160:{name:"BlockGroup",level:2,type:"m",multiple:!0,minver:1,description:"Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock."},163:{name:"SimpleBlock",level:2,type:"b",multiple:!0,minver:2,webm:!0,divx:!0,description:"Similar to SimpleBlock Structure"},171:{name:"PrevSize",cppname:"ClusterPrevSize",level:2,type:"u",minver:1,description:"Size of the previous Cluster, in octets. Can be useful for backward playing.",position:"prevCluster"},167:{name:"Position",cppname:"ClusterPosition",level:2,type:"u",minver:1,webm:!1,description:"The Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.",position:"segment"},22743:{name:"SilentTrackNumber",cppname:"ClusterSilentTrackNumber",level:3,type:"u",multiple:!0,minver:1,webm:!1,description:"One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster."},231:{name:"Timecode",cppname:"ClusterTimecode",level:2,type:"u",mandatory:!0,minver:1,description:"Absolute timestamp of the cluster (based on TimecodeScale)."},524531317:{name:"Cluster",level:1,type:"m",multiple:!0,minver:1,description:"The lower level element containing the (monolithic) Block structure."},19840:{name:"MuxingApp",level:2,type:"8",mandatory:!0,minver:1,description:'Muxing application or library ("libmatroska-0.4.3").'},31657:{name:"Title",level:2,type:"8",minver:1,webm:!1,description:"General name of the segment."},2807730:{name:"TimecodeScaleDenominator",level:2,type:"u",mandatory:!0,minver:4,default:"1000000000",description:"Timestamp scale numerator, see TimecodeScale."},2807729:{name:"TimecodeScale",level:2,type:"u",mandatory:!0,minver:1,default:"1000000",description:"Timestamp scale in nanoseconds (1.000.000 means all timestamps in the segment are expressed in milliseconds)."},27045:{name:"ChapterTranslateID",level:3,type:"b",mandatory:!0,minver:1,webm:!1,description:"The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used."},27071:{name:"ChapterTranslateCodec",level:3,type:"u",mandatory:!0,minver:1,webm:!1,description:"The chapter codec using this ID (0: Matroska Script, 1: DVD-menu)."},27132:{name:"ChapterTranslateEditionUID",level:3,type:"u",multiple:!0,minver:1,webm:!1,description:"Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment."},4096955:{name:"NextFilename",level:2,type:"8",minver:1,webm:!1,description:"An escaped filename corresponding to the next segment."},4110627:{name:"NextUID",level:2,type:"b",minver:1,webm:!1,bytesize:16,description:"A unique ID to identify the next chained segment (128 bits)."},3965867:{name:"PrevFilename",level:2,type:"8",minver:1,webm:!1,description:"An escaped filename corresponding to the previous segment."},3979555:{name:"PrevUID",level:2,type:"b",minver:1,webm:!1,bytesize:16,description:"A unique ID to identify the previous chained segment (128 bits)."},29604:{name:"SegmentUID",level:2,type:"b",minver:1,webm:!1,range:"not 0",bytesize:16,description:"A randomly generated unique ID to identify the current segment between many others (128 bits)."},357149030:{name:"Info",level:1,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Contains miscellaneous general information and statistics on the file."},21420:{name:"SeekPosition",level:3,type:"u",mandatory:!0,minver:1,description:"The position of the element in the segment in octets (0 = first level 1 element).",position:"segment"},21419:{name:"SeekID",level:3,type:"b",mandatory:!0,minver:1,description:"The binary ID corresponding to the element name.",type2:"ebmlID"},19899:{name:"Seek",cppname:"SeekPoint",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Contains a single seek entry to an EBML element."},290298740:{name:"SeekHead",cppname:"SeekHeader",level:1,type:"m",multiple:!0,minver:1,description:"Contains the position of other level 1 elements."},32379:{name:"SignatureElementList",level:2,type:"m",multiple:!0,webm:!1,i:"Cluster|Block|BlockAdditional",description:"A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption."},32347:{name:"SignatureElements",level:1,type:"m",webm:!1,description:"Contains elements that will be used to compute the signature."},32437:{name:"Signature",level:1,type:"b",webm:!1,description:"The signature of the data (until a new."},32421:{name:"SignaturePublicKey",level:1,type:"b",webm:!1,description:"The public key to use with the algorithm (in the case of a PKI-based signature)."},32410:{name:"SignatureHash",level:1,type:"u",webm:!1,description:"Hash algorithm used (1=SHA1-160, 2=MD5)."},32394:{name:"SignatureAlgo",level:1,type:"u",webm:!1,description:"Signature algorithm used (1=RSA, 2=elliptic)."},458458727:{name:"SignatureSlot",level:-1,type:"m",multiple:!0,webm:!1,description:"Contain signature of some (coming) elements in the stream."},191:{name:"CRC-32",level:-1,type:"b",minver:1,webm:!1,description:"The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian",crc:!0},236:{name:"Void",level:-1,type:"b",minver:1,description:"Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use."},17139:{name:"EBMLMaxSizeLength",level:1,type:"u",mandatory:!0,default:8,minver:1,description:"The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid."},17138:{name:"EBMLMaxIDLength",level:1,type:"u",mandatory:!0,default:4,minver:1,description:"The maximum length of the IDs you'll find in this file (4 or less in Matroska)."},17143:{name:"EBMLReadVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The minimum EBML version a parser has to support to read this file."},440786851:{name:"EBML",level:"0",type:"m",mandatory:!0,multiple:!0,minver:1,description:"Set the EBML characteristics of the data to follow. Each EBML document has to start with this."},21936:{name:"Colour",level:"4",type:"m",mandatory:!0,multiple:!0,description:"Settings describing the colour format."},21937:{name:"MatrixCoefficients",level:"5",type:"u",mandatory:!0,multiple:!0,description:"The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273."},21945:{name:"Range",level:"5",type:"u",mandatory:!0,multiple:!0,description:"Clipping of the color ranges."},21946:{name:"TransferCharacteristics",level:"5",type:"u",mandatory:!0,multiple:!0,description:"The transfer characteristics of the video."},21947:{name:"Primaries",level:"5",type:"u",mandatory:!0,multiple:!0,description:"The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273."}}},1384:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.tools=t.Reader=t.Encoder=t.Decoder=void 0,i(n(4990),t);var o=n(2800);t.Decoder=o.default;var a=n(8031);t.Encoder=a.default;var s=n(1381);t.Reader=s.default;var l=n(3210);t.tools=l},190:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)},i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3210),a=function(){function e(){}return e.readVint=function(t,n){void 0===n&&(n=0);var r=8-Math.floor(Math.log2(t[n]));if(r>8){var i=e.readHexString(t,n,n+r);throw new Error("Unrepresentable length: ".concat(r," ").concat(i))}if(n+r>t.length)return null;for(var o=t[n]&(1<<8-r)-1,a=1;a<r;a+=1){if(7===a&&o>=Math.pow(2,8)&&t[n+7]>0)return{length:r,value:-1};o*=Math.pow(2,8),o+=t[n+a]}return{length:r,value:o}},e.writeVint=function(e){if(e<0||e>Math.pow(2,53))throw new Error("Unrepresentable value: ".concat(e));var t=1;for(t=1;t<=8&&!(e<Math.pow(2,7*t)-1);t+=1);for(var n=o.Buffer.alloc(t),r=e,i=1;i<=t;i+=1){var a=255&r;n[t-i]=a,r-=a,r/=Math.pow(2,8)}return n[0]|=1<<8-t,n},e.concatenate=function(e,t){return e||t?e&&0!==e.byteLength?t&&0!==t.byteLength?o.Buffer.from(i(i([],e,!0),t,!0)):e:t:o.Buffer.from([])},e.readHexString=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),Array.from(e.slice(t,n)).map((function(e){return Number(e).toString(16)})).reduce((function(e,t){return"".concat(e).concat(t.padStart(2,"0"))}),"")},e.readUtf8=function(e){try{return o.Buffer.from(e).toString("utf8")}catch(e){return null}},e.readUnsigned=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return n.getUint8(0);case 2:return n.getUint16(0);case 4:return n.getUint32(0)}return t.byteLength<=6?t.reduce((function(e,t){return 256*e+t}),0):e.readHexString(t,0,t.byteLength)},e.readSigned=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:return NaN}},e.readFloat=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return t.getFloat32(0);case 8:return t.getFloat64(0);default:return NaN}},e.readDate=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return new Date(n.getUint8(0));case 2:return new Date(n.getUint16(0));case 4:return new Date(n.getUint32(0));case 8:return new Date(Number.parseInt(e.readHexString(t),16));default:return new Date(0)}},e.readDataFromTag=function(t,n){var i,o=t.type,a=t.name,s=t.track,l=t.discardable||!1,c=t.keyframe||!1,u=null;switch(o){case"u":i=e.readUnsigned(n);break;case"f":i=e.readFloat(n);break;case"i":i=e.readSigned(n);break;case"s":i=String.fromCharCode.apply(String,n);break;case"8":i=e.readUtf8(n);break;case"d":i=e.readDate(n)}if("SimpleBlock"===a||"Block"===a){var d=0,f=e.readVint(n,d),p=f.length;d+=p,s=f.value,i=e.readSigned(n.subarray(d,d+2)),d+=2,"SimpleBlock"===a&&(c=Boolean(128&n[p+2]),l=Boolean(1&n[p+2])),d+=1,u=n.subarray(d)}return r(r({},t),{data:n,discardable:l,keyframe:c,payload:u,track:s,value:i})},e}();t.default=a},3210:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertEBMLDateToJSDate=t.createFloatBuffer=t.createIntBuffer=t.createUIntBuffer=t.encodeValueToBuffer=t.concat=t.putRefinedMetaData=t.extractElement=t.removeElement=t.makeMetadataSeekable=t.createRIFFChunk=t.VP8BitStreamToRiffWebPBuffer=t.WebPBlockFilter=t.encodeTag=t.readBlock=t.ebmlBlock=t.writeVint=t.readVint=t.Buffer=void 0;var r=n(1166),i=n(8031),o=n(8764),a=n(190),s=n(1586);function l(e,n){var r=new t.Buffer(4);return r.writeUInt32LE(n.byteLength,0),h([new t.Buffer(e.substr(0,4),"ascii"),r,n,new t.Buffer(n.byteLength%2==0?0:1)])}function c(e,t){for(var n=-1,r=0;r<t.length;r++){var i=t[r];if(i.name===e){if("m"!==i.type)return void t.splice(r,1);if(i.isEnd){if(-1==n)throw new Error("Detected ".concat(e," closing element before finding the start"));return void t.splice(n,r-n+1)}n=r}}}function u(e,t){for(var n=[],r=-1,i=0;i<t.length;i++){var o=t[i];if(o.name===e){if("m"!==o.type){n.push(t[i]);break}if(o.isEnd){if(-1==r)throw new Error("Detected ".concat(e," closing element before finding the start"));n=t.slice(r,i+1);break}r=i}}return n}function d(e){var t=new i.default;return e.reduce((function(e,n){return e.concat(t.encode([n]))}),[]).reduce((function(e,t){return e+t.byteLength}),0)}function f(e,n,r){var i=r.duration,o=r.clusterPtrs,a=r.cues,s=e.slice(0);if("number"==typeof i){var l=!1;s.forEach((function(e){"f"===e.type&&"Duration"===e.name&&(l=!0,e.data=v(i,8))})),l||p(s,"Info",[{name:"Duration",type:"f",data:v(i,8)}])}Array.isArray(a)&&p(s,"Cues",function(e,t){var n=[];return e.forEach((function(e){var r=e.CueTrack,i=e.CueClusterPosition,o=e.CueTime;n.push({name:"CuePoint",type:"m",isEnd:!1}),n.push({name:"CueTime",type:"u",data:m(o)}),n.push({name:"CueTrackPositions",type:"m",isEnd:!1}),n.push({name:"CueTrack",type:"u",data:m(r)}),n.push({name:"CueClusterPosition",type:"u",data:m(i+t)}),n.push({name:"CueTrackPositions",type:"m",isEnd:!0}),n.push({name:"CuePoint",type:"m",isEnd:!0})})),n}(a,n));var c=[];return Array.isArray(o)&&(console.warn("append cluster pointers to seekhead is deprecated. please use cues"),c=function(e,n){var r=[];return e.forEach((function(e){r.push({name:"Seek",type:"m",isEnd:!1}),r.push({name:"SeekID",type:"b",data:new t.Buffer([31,67,182,117])}),r.push({name:"SeekPosition",type:"u",data:m(e+n)}),r.push({name:"Seek",type:"m",isEnd:!0})})),r}(o,n)),p(s,"SeekHead",c,!0),s}function p(e,t,n,r){void 0===r&&(r=!1);for(var i=-1,o=0;o<e.length;o++){var a=e[o];if("m"===a.type&&a.name===t&&!1===a.isEnd){i=o;break}}i>=0?Array.prototype.splice.apply(e,[i+1,0].concat(n)):r?[].concat([{name:t,type:"m",isEnd:!1}],n,[{name:t,type:"m",isEnd:!0}]).reverse().forEach((function(t){e.unshift(t)})):(e.push({name:t,type:"m",isEnd:!1}),n.forEach((function(t){e.push(t)})),e.push({name:t,type:"m",isEnd:!0}))}function h(e){return t.Buffer.concat(e)}function m(e){for(var n=1;e>=Math.pow(2,8*n);n++);if(n>=7)return console.warn("7bit or more bigger uint not supported."),new r.Uint64BE(e).toBuffer();var i=new t.Buffer(n);return i.writeUIntBE(e,0,n),i}function g(e){for(var n=1;e>=Math.pow(2,8*n);n++);if(n>=7)return console.warn("7bit or more bigger uint not supported."),new r.Int64BE(e).toBuffer();var i=new t.Buffer(n);return i.writeIntBE(e,0,n),i}function v(e,n){var r;if(void 0===n&&(n=8),8===n)return(r=new t.Buffer(8)).writeDoubleBE(e,0),r;if(4===n)return(r=new t.Buffer(4)).writeFloatBE(e,0),r;throw new Error("float type bits must 4bytes or 8bytes")}t.Buffer=o.Buffer,t.readVint=a.default.readVint,t.writeVint=a.default.writeVint,t.ebmlBlock=s,t.readBlock=function(e){return(0,t.ebmlBlock)(new t.Buffer(e))},t.encodeTag=function(e,n,r){return void 0===r&&(r=!1),h([e,r?new t.Buffer("01ffffffffffffff","hex"):(0,t.writeVint)(n.length),n])},t.WebPBlockFilter=function(e){return e.reduce((function(e,n){return"b"!==n.type||"SimpleBlock"!==n.name?e:(0,t.ebmlBlock)(n.data).frames.some((function(e){return"9d012a"===e.slice(3,6).toString("hex")}))?e.concat(n):e}),[])},t.VP8BitStreamToRiffWebPBuffer=function(e){var n=l("VP8 ",e);return l("RIFF",h([new t.Buffer("WEBP","ascii"),n]))},t.createRIFFChunk=l,t.makeMetadataSeekable=function(e,n,r){var o=u("EBML",e),a=d(o)+12,s=e[e.length-1].dataEnd-a,l=u("Info",e);c("Duration",l),l.splice(1,0,{name:"Duration",type:"f",data:v(n,8)});for(var f=d(l),p=u("Tracks",e),h=d(p),g=47,y=[],b=5+15*r.length,w=[],x=-1,_=function(e){var n=g,i=n+f,o=i+h,l=o+b-s;if((y=[]).push({name:"SeekHead",type:"m",isEnd:!1}),y.push({name:"Seek",type:"m",isEnd:!1}),y.push({name:"SeekID",type:"b",data:new t.Buffer([21,73,169,102])}),y.push({name:"SeekPosition",type:"u",data:m(n)}),y.push({name:"Seek",type:"m",isEnd:!0}),y.push({name:"Seek",type:"m",isEnd:!1}),y.push({name:"SeekID",type:"b",data:new t.Buffer([22,84,174,107])}),y.push({name:"SeekPosition",type:"u",data:m(i)}),y.push({name:"Seek",type:"m",isEnd:!0}),y.push({name:"Seek",type:"m",isEnd:!1}),y.push({name:"SeekID",type:"b",data:new t.Buffer([28,83,187,107])}),y.push({name:"SeekPosition",type:"u",data:m(o)}),y.push({name:"Seek",type:"m",isEnd:!0}),y.push({name:"SeekHead",type:"m",isEnd:!0}),g=d(y),(w=[]).push({name:"Cues",type:"m",isEnd:!1}),r.forEach((function(e){var t=e.CueTrack,n=e.CueClusterPosition,r=e.CueTime;w.push({name:"CuePoint",type:"m",isEnd:!1}),w.push({name:"CueTime",type:"u",data:m(r)}),w.push({name:"CueTrackPositions",type:"m",isEnd:!1}),w.push({name:"CueTrack",type:"u",data:m(t)}),n-=a,n+=l,w.push({name:"CueClusterPosition",type:"u",data:m(n)}),w.push({name:"CueTrackPositions",type:"m",isEnd:!0}),w.push({name:"CuePoint",type:"m",isEnd:!0})})),w.push({name:"Cues",type:"m",isEnd:!0}),b=d(w),x===l)return"break";if(x=l,9===e)throw new Error("Failed to converge to a stable metadata size")},k=0;k<10;k++){if("break"===_(k))break}var E=[].concat.apply([],[o,{name:"Segment",type:"m",isEnd:!1,unknownSize:!0},y,l,p,w]);return(new i.default).encode(E)},t.removeElement=c,t.extractElement=u,t.putRefinedMetaData=function(e,n){Array.isArray(n.cueInfos)&&!Array.isArray(n.cues)&&(console.warn("putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues"),n.cues=n.cueInfos);for(var r=[],o=[],a=0;a<e.length;a++){var s=e[a];if("m"===s.type&&"Segment"===s.name){if(r=e.slice(0,a),o=e.slice(a),s.unknownSize){o.shift();break}throw new Error("this metadata is not streaming webm file")}}if(!(o[o.length-1].dataEnd>0))throw new Error("metadata dataEnd has wrong number");var l,c=o[o.length-1].dataEnd,u=r[r.length-1].dataEnd,d=(new i.default).encode(r).byteLength-u,p=c-o[0].tagStart,h=(o[0].tagStart,o[0].tagStart,new t.Buffer([24,83,128,103])),m=new t.Buffer("01ffffffffffffff","hex"),g=h.byteLength+m.byteLength,v=p;for(l=1;l<20;l++){var y=f(o,d+(u+g+v-c),n),b=(new i.default).encode(y).byteLength;if(b===v)return(new i.default).encode([].concat(r,[{type:"m",name:"Segment",isEnd:!1,unknownSize:!0}],y));v=b}throw new Error("unable to refine metadata, stable size could not be found in "+l+" iterations!")},t.concat=h,t.encodeValueToBuffer=function(e){var n=new t.Buffer(0);if("m"===e.type)return e;switch(e.type){case"u":n=m(e.value);break;case"i":n=g(e.value);break;case"f":n=v(e.value);break;case"s":n=new t.Buffer(e.value,"ascii");break;case"8":n=new t.Buffer(e.value,"utf8");break;case"b":n=e.value;break;case"d":n=new r.Int64BE(e.value.getTime().toString()).toBuffer()}return Object.assign({},e,{data:n})},t.createUIntBuffer=m,t.createIntBuffer=g,t.createFloatBuffer=v,t.convertEBMLDateToJSDate=function(e){return e instanceof Date?e:new Date(new Date("2001-01-01T00:00:00.000Z").getTime()+Number(e)/1e3/1e3)}},8246:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1384);t.default=function(e){return r(this,void 0,void 0,(function(){var t,n,r,a,s,l,c,u,d,f,p;return i(this,(function(i){switch(i.label){case 0:if(!e)throw Error("call to fixWebmDuration requires a blob");t=new o.Decoder,n=new o.Reader,r=e.stream(),a=r.getReader(),i.label=1;case 1:return[4,a.read()];case 2:return s=i.sent(),l=s.done,c=s.value,l?(n.stop(),[3,3]):((u=null==(u=t.decode(c))?void 0:u.filter((function(e){return"unknown"!==e.type}))).forEach((function(e){n.read(e)})),c=null,[3,1]);case 3:return d=o.tools.makeMetadataSeekable(n.metadatas,n.duration,n.cues),f=new Blob([d],{type:e.type}),p=e.slice(n.metadataSize),[2,new Blob([f,p],{type:e.type})]}}))}))}}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var o=r[e]={id:e,exports:{}};return n[e].call(o.exports,o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&r&&n;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>a[e]=()=>n[e]));return a.default=()=>n,i.d(o,a),o},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0,(()=>{"use strict";var e=i(7294),t=i.t(e,2),n=i(9060),r=i(3379),o=i.n(r),a=i(7795),s=i.n(a),l=i(569),c=i.n(l),u=i(3565),d=i.n(u),f=i(9216),p=i.n(f),h=i(4589),m=i.n(h),g=i(8629),v={};v.styleTagTransform=m(),v.setAttributes=d(),v.insert=c().bind(null,"head"),v.domAPI=s(),v.insertStyleElement=p();o()(g.Z,v);g.Z&&g.Z.locals&&g.Z.locals;var y=i(6668),b={};b.styleTagTransform=m(),b.setAttributes=d(),b.insert=c().bind(null,"head"),b.domAPI=s(),b.insertStyleElement=p();o()(y.Z,b);y.Z&&y.Z.locals&&y.Z.locals;var w=i(24),x={};x.styleTagTransform=m(),x.setAttributes=d(),x.insert=c().bind(null,"head"),x.domAPI=s(),x.insertStyleElement=p();o()(w.Z,x);const _=w.Z&&w.Z.locals?w.Z.locals:void 0;var k=i(6027),E=i.n(k),S=i(8246),C=i.n(S),T=i(9483),A=i.n(T);function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}function P(e){return function(e){if(Array.isArray(e))return z(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){L(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function L(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==O(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==O(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===O(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */I=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new M(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(N([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==O(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function N(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(O(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=N,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:N(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function D(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){D(o,r,i,a,s,"next",e)}function s(e){D(o,r,i,a,s,"throw",e)}a(void 0)}))}}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||j(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(e,t):void 0}}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}A().config({driver:A().INDEXEDDB,name:"screenity",version:1});var U=A().createInstance({name:"chunks",storeName:"keyvaluepairs"}),F=(0,e.createContext)();const W=function(t){var n=(0,e.useRef)([]),r=(0,e.useRef)(!1),i=(0,e.useRef)(0),o=B((0,e.useState)({time:0,editLimit:420,blob:null,webm:null,originalBlob:null,updatePlayerTime:!1,start:0,end:1,trimming:!1,cutting:!1,muting:!1,history:[{}],redoHistory:[],undoDisabled:!0,redoDisabled:!0,duration:0,mode:"player",ffmpegLoaded:!1,frame:null,getFrame:null,isFfmpegRunning:!1,reencoding:!1,prevWidth:0,width:0,prevHeight:0,height:0,top:0,left:0,fromCropper:!1,base64:null,saveDrive:!1,downloading:!1,downloadingWEBM:!1,downloadingGIF:!1,volume:1,cropPreset:"none",replaceAudio:!1,title:null,ready:!1,mp4ready:!1,saved:!1,iframeRef:null,offline:!1,updateChrome:!1,driveEnabled:!1,hasBeenEdited:!1,dragInteracted:!1,noffmpeg:!1,openModal:null,rawBlob:null,override:!1,fallback:!1,chunkCount:0,chunkIndex:0}),2),a=o[0],s=o[1],l=(0,e.useRef)(a),c=function(){var e=R(I().mark((function e(){var t,n,r;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,U.ready();case 3:return e.next=5,U.iterate((function(e){t.push(e)}));case 5:t.sort((function(e,t){var n,r;return(null!==(n=e.timestamp)&&void 0!==n?n:0)-(null!==(r=t.timestamp)&&void 0!==r?r:0)})),n=t.map((function(e){return e.chunk instanceof Blob?e.chunk:new Blob([e.chunk])})),r=new Blob(n,{type:"video/webm"}),h(r);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){l.current=a}),[a]),(0,e.useEffect)((function(){var e=(new Date).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0});s((function(t){return N(N({},t),{},{title:"Screenity video - ".concat(e)})}))}),[]),(0,e.useEffect)((function(){a.saved?window.onbeforeunload=null:window.onbeforeunload=function(){return!0}}),[a.saved]);var u=(0,e.useCallback)((function(){s((function(e){return N(N({},e),{},{history:[].concat(P(e.history),[e]),redoHistory:[]})}))}),[a]),d=(0,e.useCallback)((function(){if(a.history.length>1){var e=a.history[a.history.length-2],t=a.history.slice(0,-1);s((function(n){return N(N(N({},n),e),{},{history:t,redoHistory:[a].concat(P(a.redoHistory))})}))}}),[a]),f=(0,e.useCallback)((function(){if(a.redoHistory.length>0){var e=a.redoHistory[0],t=a.redoHistory.slice(1);s((function(n){return N(N(N({},n),e),{},{history:[].concat(P(a.history),[a]),redoHistory:t})}))}}),[a]),p=function(e){var t=e.match(/^data:(.*?);base64,/);if(null!==t){for(var n=t[1],r=atob(e.slice(t[0].length)),i=new Uint8Array(r.length),o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return new Blob([i],{type:n})}for(var a=atob(e),s=new Uint8Array(a.length),l=0;l<a.length;l++)s[l]=a.charCodeAt(l);return s};(0,e.useEffect)((function(){if(a.blob){var e=document.createElement("video");e.preload="metadata",e.onloadedmetadata=R(I().mark((function t(){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:s((function(t){return N(N({},t),{},{duration:e.duration,width:e.videoWidth,height:e.videoHeight,prevWidth:e.videoWidth,prevHeight:e.videoHeight})})),URL.revokeObjectURL(e.src),e.remove();case 3:case"end":return t.stop()}}),t)}))),e.src=URL.createObjectURL(a.blob)}}),[a.blob]);var h=function(){var e=R(I().mark((function e(t){var r,i,o,a,c,u,d,f,p,h;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t||new Blob(n.current,{type:"video/webm; codecs=vp8, opus"}),e.next=3,chrome.storage.local.get("recordingDuration");case 3:return i=e.sent,o=i.recordingDuration,e.next=7,chrome.storage.local.get("token");case 7:if(a=e.sent,c=a.token,u=!1,c&&null!==c&&(u=!0),s((function(e){return N(N({},e),{},{rawBlob:r,duration:o/1e3})})),d=navigator.userAgent.match(/Windows NT 10.0/),e.prev=13,!(o>0&&null!==o)){e.next=31;break}if(d){e.next=19;break}E()(r,o,function(){var e=R(I().mark((function e(t){var n;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(l.current.fallback||l.current.updateChrome||l.current.noffmpeg||l.current.duration>l.current.editLimit&&!l.current.override)){e.next=4;break}return s((function(e){return N(N({},e),{},{webm:t,ready:!0})})),chrome.runtime.sendMessage({type:"recording-complete"}),e.abrupt("return");case 4:(n=new FileReader).onloadend=function(){var e=n.result;s((function(t){return N(N({},t),{},{base64:e,driveEnabled:u})}))},n.readAsDataURL(t);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{logger:!1}),e.next=29;break;case 19:return e.next=21,C()(r,{type:"video/webm; codecs=vp8, opus"});case 21:if(f=e.sent,!(l.current.fallback||l.current.updateChrome||l.current.noffmpeg||l.current.duration>l.current.editLimit&&!l.current.override)){e.next=26;break}return s((function(e){return N(N({},e),{},{webm:f,ready:!0})})),chrome.runtime.sendMessage({type:"recording-complete"}),e.abrupt("return");case 26:(p=new FileReader).onloadend=function(){var e=p.result;s((function(t){return N(N({},t),{},{base64:e,driveEnabled:u})}))},p.readAsDataURL(f);case 29:e.next=38;break;case 31:if(!(l.current.fallback||l.current.updateChrome||l.current.noffmpeg||l.current.duration>l.current.editLimit&&!l.current.override)){e.next=35;break}return s((function(e){return N(N({},e),{},{webm:r,ready:!0})})),chrome.runtime.sendMessage({type:"recording-complete"}),e.abrupt("return");case 35:(h=new FileReader).onloadend=function(){var e=h.result;s((function(t){return N(N({},t),{},{base64:e,driveEnabled:u})}))},h.readAsDataURL(r);case 38:e.next=44;break;case 40:e.prev=40,e.t0=e.catch(13),s((function(e){return N(N({},e),{},{webm:r,ready:!0})})),chrome.runtime.sendMessage({type:"recording-complete"});case 44:case"end":return e.stop()}}),e,null,[[13,40]])})));return function(t){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){i.current=a.chunkCount}),[a.chunkCount]);var m=function(){var e=R(I().mark((function e(t,r){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(){var e=R(I().mark((function e(t){var r;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(l.current.chunkIndex>=i.current)){e.next=3;break}return console.warn("Too many chunks received"),e.abrupt("return",Promise.resolve());case 3:return r=p(t.chunk),n.current.push(r),s((function(e){return N(N({},e),{},{chunkIndex:e.chunkIndex+1})})),e.abrupt("return",Promise.resolve());case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())).then((function(){r({status:"ok"})})).catch((function(e){console.error("Error processing batch",e)}));case 2:return e.abrupt("return",!0);case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){var e=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);e&&parseInt(e[2],10)<109&&s((function(e){return N(N({},e),{},{updateChrome:!0,noffmpeg:!0})}))}),[]);var g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;r.current||(r.current=!0,s((function(e){return N(N({},e),{},{override:t.override})})),"function"==typeof l.current.openModal&&chrome.storage.local.get("memoryError",(function(e){e.memoryError&&null!==e.memoryError&&(chrome.storage.local.set({memoryError:!1}),l.current.openModal(chrome.i18n.getMessage("memoryLimitTitle"),chrome.i18n.getMessage("memoryLimitDescription"),chrome.i18n.getMessage("understoodButton"),null,(function(){}),(function(){}),null,chrome.i18n.getMessage("learnMoreDot"),(function(){chrome.runtime.sendMessage({type:"memory-limit-help"})})))})),h(),null!==e&&e({status:"ok"}))},v=(0,e.useCallback)((function(e,t,n){var r=e;if("chunk-count"===r.type)s((function(e){return N(N({},e),{},{chunkCount:r.count,override:r.override})}));else{if("new-chunk-tab"===r.type)return m(r.chunks,n);if("make-video-tab"===r.type)return void g(n,r);"saved-to-drive"===r.type?s((function(e){return N(N({},e),{},{saveDrive:!1,driveEnabled:!0,saved:!0})})):"restore-recording"===r.type?(s((function(e){return N(N({},e),{},{fallback:!0,isFfmpegRunning:!1,noffmpeg:!0,ffmpegLoaded:!0,ffmpeg:!0})})),c()):"large-recording"===r.type?(s((function(e){return N(N({},e),{},{isFfmpegRunning:!1,noffmpeg:!0,ffmpegLoaded:!0,ffmpeg:!0})})),c()):"fallback-recording"===r.type&&s((function(e){return N(N({},e),{},{fallback:!0,isFfmpegRunning:!1,noffmpeg:!0,ffmpegLoaded:!0,ffmpeg:!0})}))}}),[r.current,n.current,a,l.current]);(0,e.useEffect)((function(){return chrome.runtime.onMessage.addListener(v),function(){chrome.runtime.onMessage.removeListener(v)}}),[]);var y=function(){var e=R(I().mark((function e(t){var n,r,i,o,l,c,u,d,f,h;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"updated-blob"===t.data.type?(n=t.data.base64,r=new Blob([p(n)],{type:"video/mp4"}),s((function(e){return N(N({},e),{},{blob:r,mp4ready:!0,hasBeenEdited:!0,isFfmpegRunning:!1,reencoding:!1,trimming:!1,cutting:!1,muting:!1,cropping:!1})})),(i=document.createElement("video")).preload="metadata",i.onloadedmetadata=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s((function(e){return N(N({},e),{},{duration:i.duration,width:i.videoWidth,height:i.videoHeight,start:0,end:1})})),t.data.addToHistory&&a.addToHistory(),URL.revokeObjectURL(i.src),i.remove();case 4:case"end":return e.stop()}}),e)}))),i.src=URL.createObjectURL(r),a.originalBlob||s((function(e){return N(N({},e),{},{originalBlob:r})}))):"download-mp4"===t.data.type?(o=t.data.base64,l=new Blob([p(o)],{type:"video/mp4"}),c=URL.createObjectURL(l),O(c,".mp4"),s((function(e){return N(N({},e),{},{saved:!0,isFfmpegRunning:!1,downloading:!1})}))):"download-gif"===t.data.type?(u=t.data.base64,d=new Blob([p(u)],{type:"image/gif"}),f=URL.createObjectURL(d),O(f,".gif"),s((function(e){return N(N({},e),{},{saved:!0,isFfmpegRunning:!1,downloadingGIF:!1})}))):"new-frame"===t.data.type?(h=URL.createObjectURL(t.data.frame),s((function(e){return N(N({},e),{},{frame:h,isFfmpegRunning:!1})}))):"ffmpeg-loaded"===t.data.type?s((function(e){return N(N({},e),{},{ffmpeg:!0,ffmpegLoaded:!0,isFfmpegRunning:!1})})):"ffmpeg-load-error"===t.data.type?s((function(e){return N(N({},e),{},{ffmpeg:!0,noffmpeg:!0,ffmpegLoaded:!0,isFfmpegRunning:!1})})):"crop-update"===t.data.type&&s((function(e){return N(N({},e),{},{mode:"player",start:0,end:1})}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){return window.addEventListener("message",y),function(){return window.removeEventListener("message",y)}}),[y]);var b=function(e){window.parent.postMessage(e,"*")},w=function(){var e=R(I().mark((function e(){var t;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a.fallback||a.noffmpeg||a.duration>a.editLimit&&!a.override)){e.next=2;break}return e.abrupt("return");case 2:t=new Blob([p(a.base64)],{type:"video/webm"}),s((function(e){return N(N({},e),{},{webm:t,ready:!0})})),a.offline&&!0===a.ffmpeg||!a.updateChrome&&(a.duration<=a.editLimit||a.override)&&b({type:"base64-to-blob",base64:a.base64}),chrome.runtime.sendMessage({type:"recording-complete"});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){a.base64&&a.ffmpeg&&a.ffmpegLoaded&&w()}),[a.base64,a.ffmpeg,a.ffmpegLoaded]);var x=(0,e.useCallback)(R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a.blob){e.next=2;break}return e.abrupt("return");case 2:if(a.ffmpeg){e.next=4;break}return e.abrupt("return");case 4:if(!a.isFfmpegRunning){e.next=6;break}return e.abrupt("return");case 6:s((function(e){return N(N({},e),{},{isFfmpegRunning:!0})})),b({type:"get-frame",time:0,blob:a.blob});case 8:case"end":return e.stop()}}),e)}))),[a.blob,a.ffmpeg,a.isFfmpegRunning]),_=function(){var e=R(I().mark((function e(t,n,r){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>a.editLimit)||a.override){e.next=4;break}return e.abrupt("return");case 4:s((function(e){return N(N({},e),{},{isFfmpegRunning:!0})})),b({type:"add-audio-to-video",blob:t,audio:n,duration:a.duration,volume:r,replaceAudio:a.replaceAudio});case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),k=function(){var e=R(I().mark((function e(t){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>a.editLimit)||a.override){e.next=4;break}return e.abrupt("return");case 4:s(t?function(e){return N(N({},e),{},{cutting:!0})}:function(e){return N(N({},e),{},{trimming:!0})}),s((function(e){return N(N({},e),{},{isFfmpegRunning:!0})})),b({type:"cut-video",blob:a.blob,startTime:a.start*a.duration,endTime:a.end*a.duration,cut:t,duration:a.duration,encode:!1});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.muting){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>a.editLimit)||a.override){e.next=4;break}return e.abrupt("return");case 4:s((function(e){return N(N({},e),{},{muting:!0,isFfmpegRunning:!0})})),b({type:"mute-video",blob:a.blob,startTime:a.start*a.duration,endTime:a.end*a.duration,duration:a.duration});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),T=function(){var e=R(I().mark((function e(t,n,r,i){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.cropping){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>a.editLimit)||a.override){e.next=4;break}return e.abrupt("return");case 4:return s((function(e){return N(N({},e),{},{cropping:!0,isFfmpegRunning:!0})})),b({type:"crop-video",blob:a.blob,x:t,y:n,width:r,height:i}),e.abrupt("return",!0);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),A=function(){var e=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning){e.next=2;break}return e.abrupt("return");case 2:return s((function(e){return N(N({},e),{},{isFfmpegRunning:!0,reencoding:!0})})),b({type:"reencode-video",blob:a.blob,duration:a.duration}),e.abrupt("return",!0);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),O=function(){var e=R(I().mark((function e(t,n){var r,i,o,a,s;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.current.title.replace(/[\/\\:?~<>|*]/g," ").trim()+n,i=function(){try{URL.revokeObjectURL(t)}catch(e){}},e.t1=navigator.brave,!e.t1){e.next=7;break}return e.next=6,navigator.brave.isBrave();case 6:e.t1=e.sent;case 7:if(e.t0=e.t1,e.t0){e.next=10;break}e.t0=!1;case 10:if(!e.t0){e.next=20;break}return e.next=13,fetch(t);case 13:return o=e.sent,e.next=16,o.blob();case 16:return a=e.sent,e.next=19,new Promise((function(e){var t=new FileReader;t.onloadend=function(){chrome.runtime.sendMessage({type:"request-download",base64:t.result,title:r}),i(),e()},t.readAsDataURL(a)}));case 19:return e.abrupt("return");case 20:return e.next=22,new Promise((function(e,n){chrome.downloads.download({url:t,filename:r,saveAs:!0},(function(t){chrome.runtime.lastError||!t?n(chrome.runtime.lastError||new Error("Download failed")):e(t)}))}));case 22:return s=e.sent,e.next=25,new Promise((function(e){var n=function(){var o=R(I().mark((function o(a){var l,c,u,d;return I().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(a.id===s&&a.state){o.next=2;break}return o.abrupt("return");case 2:if(c=function(){chrome.downloads.onChanged.removeListener(n),i(),e()},"interrupted"!==a.state.current||"USER_CANCELED"===(null===(l=a.error)||void 0===l?void 0:l.current)){o.next=18;break}return o.prev=4,o.next=7,fetch(t);case 7:return u=o.sent,o.next=10,u.blob();case 10:return d=o.sent,o.next=13,new Promise((function(e){var t=new FileReader;t.onloadend=function(){chrome.runtime.sendMessage({type:"request-download",base64:t.result,title:r}),e()},t.readAsDataURL(d)}));case 13:return o.prev=13,c(),o.finish(13);case 16:o.next=19;break;case 18:"complete"!==a.state.current&&"interrupted"!==a.state.current||c();case 19:case"end":return o.stop()}}),o,null,[[4,,13,16]])})));return function(e){return o.apply(this,arguments)}}();chrome.downloads.onChanged.addListener(n)}));case 25:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),M=function(){var e=R(I().mark((function e(){var t;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.downloading){e.next=2;break}return e.abrupt("return");case 2:s((function(e){return N(N({},e),{},{downloading:!0,isFfmpegRunning:!0})})),t=URL.createObjectURL(a.blob),O(t,".mp4"),s((function(e){return N(N({},e),{},{downloading:!1,isFfmpegRunning:!1,saved:!0})}));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=R(I().mark((function e(){var t;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.downloadingWEBM){e.next=2;break}return e.abrupt("return");case 2:s((function(e){return N(N({},e),{},{downloadingWEBM:!0,isFfmpegRunning:!0})})),t=URL.createObjectURL(a.webm),O(t,".webm"),s((function(e){return N(N({},e),{},{downloadingWEBM:!1,isFfmpegRunning:!1,saved:!0})}));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),D=function(){var e=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.downloading){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>30)){e.next=4;break}return e.abrupt("return");case 4:s((function(e){return N(N({},e),{},{downloadingGIF:!0,isFfmpegRunning:!0})})),b({type:"to-gif",blob:a.blob});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),j=function(){var e=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:b({type:"load-ffmpeg"});case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return a.undo=d,a.redo=f,a.addToHistory=u,a.handleTrim=k,a.handleMute=S,a.download=M,a.handleCrop=T,a.handleReencode=A,a.getFrame=x,a.downloadGIF=D,a.downloadWEBM=L,a.addAudio=_,a.loadFFmpeg=j,e.createElement(F.Provider,{value:[a,s]},t.children)};function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function V(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */V=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==H(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(H(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function q(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach((function(t){Z(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Z(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==H(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==H(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===H(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const K=function(){var t=Y((0,e.useContext)(F),2),n=t[0],r=t[1],i=function(){var e,t=(e=V().mark((function e(){return V().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.handleReencode();case 2:r((function(e){return $($({},e),{},{mode:"player",start:0,end:1})}));case 3:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){q(o,r,i,a,s,"next",e)}function s(e){q(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return e.createElement("div",{className:_.editorNav},e.createElement("div",{className:_.navWrap},e.createElement("div",{className:_.editorNavLeft,onClick:function(){chrome.runtime.sendMessage({type:"open-home"})}},e.createElement("img",{src:"/assets/editor/logo.svg",alt:"Logo"})),e.createElement("div",{className:_.editorNavCenter},e.createElement("div",{className:_.editorNavTitle},chrome.i18n.getMessage("sandboxEditorMainTitle")," ",e.createElement("span",{className:_.beta},"BETA"))),e.createElement("div",{className:_.editorNavRight},e.createElement("button",{className:"button simpleButton blackButton",onClick:function(){r((function(e){return $($({},e),{},{mode:"player",blob:n.originalBlob,start:0,end:1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorCancelButton")),e.createElement("button",{className:"button secondaryButton",onClick:function(){r((function(e){return $($({},e),{},{blob:n.originalBlob,start:0,end:1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorRevertButton")),e.createElement("button",{className:"button primaryButton",onClick:i,disabled:n.isFfmpegRunning},n.reencoding?chrome.i18n.getMessage("sandboxEditorSaveProgressButton"):chrome.i18n.getMessage("sandboxEditorSaveButton")))))};var Q=i(5893),J=i(1443),ee=i.n(J),te=i(5697),ne=i.n(te);const re=(e,t)=>{const n=new(ee())(".plyr-react",t.options||{});return t.source&&(n.source=t.source),n},ie=e=>{e&&e.destroy()},oe=()=>{},ae=e=>e?()=>({plyr:e}):()=>new Proxy({plyr:{source:null}},{get:(e,t)=>"plyr"===t?e[t]:oe});function se(t,n,r=null){return function(t,n,r=[]){const[i,o]=(0,e.useState)(null),a=(0,e.useRef)(null),{instantiate:s,destroy:l,getAPI:c,params:u}=n;(0,e.useEffect)((()=>{const e=s(a.current,u);return o(e),()=>{l&&l(e,u)}}),r);const d=(0,e.useMemo)((()=>c(i,u)),[i]);return(0,e.useImperativeHandle)(t,d,[d]),a}(t,{instantiate:re,getAPI:ae,destroy:ie,params:n},r||[n.options,n.source])}const le=e.forwardRef(((e,t)=>{const{source:n,options:r=null,...i}=e,o=se(t,{source:n,options:r});return(0,Q.jsx)("video",{ref:o,className:"plyr-react plyr",...i})}));function ce(e){return ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ce(e)}function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ce(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ce(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ce(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}le.displayName="Plyr",le.defaultProps={options:{controls:["rewind","play","fast-forward","progress","current-time","duration","mute","volume","settings","fullscreen"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop"}},source:{type:"video",sources:[{src:"https://cdn.plyr.io/static/blank.mp4",type:"video/mp4",size:720},{src:"https://cdn.plyr.io/static/blank.mp4",type:"video/mp4",size:1080}]}},le.propTypes={options:ne().object,source:ne().any};const me=function(t){var n=pe((0,e.useContext)(F),2),r=n[0],i=n[1],o=(0,e.useRef)(null),a=pe((0,e.useState)(null),2),s=a[0],l=a[1],c=pe((0,e.useState)(null),2),u=c[0],d=c[1],f=pe((0,e.useState)(!1),2),p=f[0],h=f[1];(0,e.useEffect)((function(){o.current&&o.current.plyr&&r.updatePlayerTime&&(o.current.plyr.currentTime=r.time)}),[r.time]);var m=(0,e.useMemo)((function(){return{controls:["play","mute","captions","settings","pip","fullscreen"],ratio:"16:9",blankVideo:"chrome-extension://"+chrome.i18n.getMessage("@@extension_id")+"/assets/blank.mp4",keyboard:{global:!0}}}),[]);(0,e.useEffect)((function(){if(r.blob){var e=URL.createObjectURL(r.blob);return d({type:"video",sources:[{src:e,type:"video/mp4"}]}),l(e),function(){URL.revokeObjectURL(e)}}}),[r.blob,o]),(0,e.useEffect)((function(){return o.current&&o.current.plyr&&o.current.plyr.on("timeupdate",(function(){i((function(e){return de(de({},e),{},{time:o.current.plyr.currentTime,updatePlayerTime:!1})}))})),function(){o.current&&o.current.plyr&&o.current.plyr.off("timeupdate")}}),[o]);return(0,e.useEffect)((function(){if(!p){var e=function(e){o.current&&o.current.plyr&&(h(!0),o.current.plyr.on("timeupdate",(function(){i((function(e){return de(de({},e),{},{time:o.current.plyr.currentTime,updatePlayerTime:!1})}))})))};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}}),[p]),e.createElement("div",{className:"videoPlayer"},e.createElement("div",{className:"playerWrap",onClick:function(){p||o.current&&o.current.plyr&&(h(!0),o.current.plyr.on("timeupdate",(function(){i((function(e){return de(de({},e),{},{time:o.current.plyr.currentTime,updatePlayerTime:!1})}))})))}},s&&e.createElement(le,{ref:o,id:"plyr-player",source:u,options:m})),e.createElement("style",null,"\n\t\t\t\t\t.plyr {\n\t\t\t\t\t\theight: 90%!important;\n\t\t\t\t\t}\n\t\t\t\t\t@media (max-width: 900px) {\n\t\t\t\t\t\t.videoPlayer {\n\t\t\t\t\t\t\theight: 100%!important;\n\t\t\t\t\t\t\ttop: 40px!important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.playerWrap {\n\t\t\t\t\t\t\theight: calc(100% - 300px)!important;\n\t\t\t\t\t\t}\n\t\t\t\t\t"))};var ge=i(3661),ve={};ve.styleTagTransform=m(),ve.setAttributes=d(),ve.insert=c().bind(null,"head"),ve.domAPI=s(),ve.insertStyleElement=p();o()(ge.Z,ve);const ye=ge.Z&&ge.Z.locals?ge.Z.locals:void 0;var be=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))};const we={decode:function(e,t){return be(this,void 0,void 0,(function*(){const n=new AudioContext({sampleRate:t});return n.decodeAudioData(e).finally((()=>n.close()))}))},createBuffer:function(e,t){return"number"==typeof e[0]&&(e=[e]),function(e){const t=e[0];if(t.some((e=>e>1||e<-1))){const n=t.length;let r=0;for(let e=0;e<n;e++){const n=Math.abs(t[e]);n>r&&(r=n)}for(const t of e)for(let e=0;e<n;e++)t[e]/=r}}(e),{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:t=>null==e?void 0:e[t],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};var xe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))};const _e={fetchBlob:function(e,t,n){return xe(this,void 0,void 0,(function*(){const r=yield fetch(e,n);return function(e,t){xe(this,void 0,void 0,(function*(){if(!e.body||!e.headers)return;const n=e.body.getReader(),r=Number(e.headers.get("Content-Length"))||0;let i=0;const o=e=>xe(this,void 0,void 0,(function*(){i+=(null==e?void 0:e.length)||0;const n=Math.round(i/r*100);t(n)})),a=()=>xe(this,void 0,void 0,(function*(){let e;try{e=yield n.read()}catch(e){return}e.done||(o(e.value),yield a())}));a()}))}(r.clone(),t),r.blob()}))}};const ke=class{constructor(){this.listeners={},this.on=this.addEventListener,this.un=this.removeEventListener}addEventListener(e,t,n){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),null==n?void 0:n.once){const n=()=>{this.removeEventListener(e,n),this.removeEventListener(e,t)};return this.addEventListener(e,n),n}return()=>this.removeEventListener(e,t)}removeEventListener(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)}once(e,t){return this.on(e,t,{once:!0})}unAll(){this.listeners={}}emit(e,...t){this.listeners[e]&&this.listeners[e].forEach((e=>e(...t)))}};const Ee=class extends ke{constructor(e){super(),this.isExternalMedia=!1,e.media?(this.media=e.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),e.mediaControls&&(this.media.controls=!0),e.autoplay&&(this.media.autoplay=!0),null!=e.playbackRate&&this.onceMediaEvent("canplay",(()=>{null!=e.playbackRate&&(this.media.playbackRate=e.playbackRate)}))}onMediaEvent(e,t,n){return this.media.addEventListener(e,t,n),()=>this.media.removeEventListener(e,t)}onceMediaEvent(e,t){return this.onMediaEvent(e,t,{once:!0})}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const e=this.getSrc();e.startsWith("blob:")&&URL.revokeObjectURL(e)}setSrc(e,t){if(this.getSrc()===e)return;this.revokeSrc();const n=t instanceof Blob?URL.createObjectURL(t):e;this.media.src=n,this.media.load()}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(e){this.media=e}play(){return this.media.play()}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(e){this.media.currentTime=e}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(e){this.media.volume=e}getMuted(){return this.media.muted}setMuted(e){this.media.muted=e}getPlaybackRate(){return this.media.playbackRate}setPlaybackRate(e,t){null!=t&&(this.media.preservesPitch=t),this.media.playbackRate=e}getMediaElement(){return this.media}setSinkId(e){return this.media.setSinkId(e)}};class Se extends ke{constructor(e,t){super(),this.timeouts=[],this.isScrolling=!1,this.audioData=null,this.resizeObserver=null,this.isDragging=!1,this.options=e;const n=this.parentFromOptionsContainer(e.container);this.parent=n;const[r,i]=this.initHtml();n.appendChild(r),this.container=r,this.scrollContainer=i.querySelector(".scroll"),this.wrapper=i.querySelector(".wrapper"),this.canvasWrapper=i.querySelector(".canvases"),this.progressWrapper=i.querySelector(".progress"),this.cursor=i.querySelector(".cursor"),t&&i.appendChild(t),this.initEvents()}parentFromOptionsContainer(e){let t;if("string"==typeof e?t=document.querySelector(e):e instanceof HTMLElement&&(t=e),!t)throw new Error("Container not found");return t}initEvents(){const e=e=>{const t=this.wrapper.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientX-t.left;return[n/t.width,r/t.height]};this.wrapper.addEventListener("click",(t=>{const[n,r]=e(t);this.emit("click",n,r)})),this.wrapper.addEventListener("dblclick",(t=>{const[n,r]=e(t);this.emit("dblclick",n,r)})),this.options.dragToSeek&&this.initDrag(),this.scrollContainer.addEventListener("scroll",(()=>{const{scrollLeft:e,scrollWidth:t,clientWidth:n}=this.scrollContainer,r=e/t,i=(e+n)/t;this.emit("scroll",r,i)}));const t=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{t((()=>this.reRender()))})),this.resizeObserver.observe(this.scrollContainer)}initDrag(){!function(e,t,n,r,i=5){let o=()=>{};if(!e)return o;const a=a=>{if(2===a.button)return;a.preventDefault(),a.stopPropagation(),e.style.touchAction="none";let s=a.clientX,l=a.clientY,c=!1;const u=r=>{r.preventDefault(),r.stopPropagation();const o=r.clientX,a=r.clientY;if(c||Math.abs(o-s)>=i||Math.abs(a-l)>=i){const{left:r,top:i}=e.getBoundingClientRect();c||(c=!0,null==n||n(s-r,l-i)),t(o-s,a-l,o-r,a-i),s=o,l=a}},d=e=>{c&&(e.preventDefault(),e.stopPropagation())},f=()=>{e.style.touchAction="",c&&(null==r||r()),o()};document.addEventListener("pointermove",u),document.addEventListener("pointerup",f),document.addEventListener("pointerleave",f),document.addEventListener("click",d,!0),o=()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",f),document.removeEventListener("pointerleave",f),setTimeout((()=>{document.removeEventListener("click",d,!0)}),10)}};e.addEventListener("pointerdown",a)}(this.wrapper,((e,t,n)=>{this.emit("drag",Math.max(0,Math.min(1,n/this.wrapper.getBoundingClientRect().width)))}),(()=>this.isDragging=!0),(()=>this.isDragging=!1))}getHeight(){return null==this.options.height?128:isNaN(Number(this.options.height))?"auto"===this.options.height&&this.parent.clientHeight||128:Number(this.options.height)}initHtml(){const e=document.createElement("div"),t=e.attachShadow({mode:"open"});return t.innerHTML=`\n <style>\n :host {\n user-select: none;\n min-width: 1px;\n }\n :host audio {\n display: block;\n width: 100%;\n }\n :host .scroll {\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n position: relative;\n }\n :host .noScrollbar {\n scrollbar-color: transparent;\n scrollbar-width: none;\n }\n :host .noScrollbar::-webkit-scrollbar {\n display: none;\n -webkit-appearance: none;\n }\n :host .wrapper {\n position: relative;\n overflow: visible;\n z-index: 2;\n }\n :host .canvases {\n min-height: ${this.getHeight()}px;\n }\n :host .canvases > div {\n position: relative;\n }\n :host canvas {\n display: block;\n position: absolute;\n top: 0;\n image-rendering: pixelated;\n }\n :host .progress {\n pointer-events: none;\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n overflow: hidden;\n }\n :host .progress > div {\n position: relative;\n }\n :host .cursor {\n pointer-events: none;\n position: absolute;\n z-index: 5;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: 2px;\n }\n </style>\n\n <div class="scroll" part="scroll">\n <div class="wrapper" part="wrapper">\n <div class="canvases"></div>\n <div class="progress" part="progress"></div>\n <div class="cursor" part="cursor"></div>\n </div>\n </div>\n `,[e,t]}setOptions(e){if(this.options.container!==e.container){const t=this.parentFromOptionsContainer(e.container);t.appendChild(this.container),this.parent=t}e.dragToSeek&&!this.options.dragToSeek&&this.initDrag(),this.options=e,this.reRender()}getWrapper(){return this.wrapper}getScroll(){return this.scrollContainer.scrollLeft}destroy(){var e;this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect()}createDelay(e=10){const t={};return this.timeouts.push(t),n=>{t.timeout&&clearTimeout(t.timeout),t.timeout=setTimeout(n,e)}}convertColorValues(e){if(!Array.isArray(e))return e||"";if(e.length<2)return e[0]||"";const t=document.createElement("canvas"),n=t.getContext("2d").createLinearGradient(0,0,0,t.height),r=1/(e.length-1);return e.forEach(((e,t)=>{const i=t*r;n.addColorStop(i,e)})),n}renderBarWaveform(e,t,n,r){const i=e[0],o=e[1]||e[0],a=i.length,{width:s,height:l}=n.canvas,c=l/2,u=window.devicePixelRatio||1,d=t.barWidth?t.barWidth*u:1,f=t.barGap?t.barGap*u:t.barWidth?d/2:0,p=t.barRadius||0,h=s/(d+f)/a,m=p&&"roundRect"in n?"roundRect":"rect";n.beginPath();let g=0,v=0,y=0;for(let e=0;e<=a;e++){const a=Math.round(e*h);if(a>g){const e=Math.round(v*c*r),i=e+Math.round(y*c*r)||1;let o=c-e;"top"===t.barAlign?o=0:"bottom"===t.barAlign&&(o=l-i),n[m](g*(d+f),o,d,i,p),g=a,v=0,y=0}const s=Math.abs(i[e]||0),u=Math.abs(o[e]||0);s>v&&(v=s),u>y&&(y=u)}n.fill(),n.closePath()}renderLineWaveform(e,t,n,r){const i=t=>{const i=e[t]||e[0],o=i.length,{height:a}=n.canvas,s=a/2,l=n.canvas.width/o;n.moveTo(0,s);let c=0,u=0;for(let e=0;e<=o;e++){const o=Math.round(e*l);if(o>c){const e=s+(Math.round(u*s*r)||1)*(0===t?-1:1);n.lineTo(c,e),c=o,u=0}const a=Math.abs(i[e]||0);a>u&&(u=a)}n.lineTo(c,s)};n.beginPath(),i(0),i(1),n.fill(),n.closePath()}renderWaveform(e,t,n){if(n.fillStyle=this.convertColorValues(t.waveColor),t.renderFunction)return void t.renderFunction(e,n);let r=t.barHeight||1;if(t.normalize){const t=Array.from(e[0]).reduce(((e,t)=>Math.max(e,Math.abs(t))),0);r=t?1/t:1}t.barWidth||t.barGap||t.barAlign?this.renderBarWaveform(e,t,n,r):this.renderLineWaveform(e,t,n,r)}renderSingleCanvas(e,t,n,r,i,o,a,s){const l=window.devicePixelRatio||1,c=document.createElement("canvas"),u=e[0].length;c.width=Math.round(n*(o-i)/u),c.height=r*l,c.style.width=`${Math.floor(c.width/l)}px`,c.style.height=`${r}px`,c.style.left=`${Math.floor(i*n/l/u)}px`,a.appendChild(c);const d=c.getContext("2d");if(this.renderWaveform(e.map((e=>e.slice(i,o))),t,d),c.width>0&&c.height>0){const e=c.cloneNode(),n=e.getContext("2d");n.drawImage(c,0,0),n.globalCompositeOperation="source-in",n.fillStyle=this.convertColorValues(t.progressColor),n.fillRect(0,0,c.width,c.height),s.appendChild(e)}}renderChannel(e,t,n){const r=document.createElement("div"),i=this.getHeight();r.style.height=`${i}px`,this.canvasWrapper.style.minHeight=`${i}px`,this.canvasWrapper.appendChild(r);const o=r.cloneNode();this.progressWrapper.appendChild(o);const{scrollLeft:a,scrollWidth:s,clientWidth:l}=this.scrollContainer,c=e[0].length,u=c/s;let d=Math.min(Se.MAX_CANVAS_WIDTH,l);if(t.barWidth||t.barGap){const e=t.barWidth||.5,n=e+(t.barGap||e/2);d%n!=0&&(d=Math.floor(d/n)*n)}const f=Math.floor(Math.abs(a)*u),p=Math.floor(f+d*u),h=p-f,m=(a,s)=>{this.renderSingleCanvas(e,t,n,i,Math.max(0,a),Math.min(s,c),r,o)},g=this.createDelay(),v=this.createDelay(),y=(e,t)=>{m(e,t),e>0&&g((()=>{y(e-h,t-h)}))},b=(e,t)=>{m(e,t),t<c&&v((()=>{b(e+h,t+h)}))};y(f,p),p<c&&b(p,p+h)}render(e){this.timeouts.forEach((e=>e.timeout&&clearTimeout(e.timeout))),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.wrapper.style.width="",null!=this.options.width&&(this.scrollContainer.style.width="number"==typeof this.options.width?`${this.options.width}px`:this.options.width);const t=window.devicePixelRatio||1,n=this.scrollContainer.clientWidth,r=Math.ceil(e.duration*(this.options.minPxPerSec||0));this.isScrolling=r>n;const i=this.options.fillParent&&!this.isScrolling,o=(i?n:r)*t;if(this.wrapper.style.width=i?"100%":`${r}px`,this.scrollContainer.style.overflowX=this.isScrolling?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.options.splitChannels)for(let t=0;t<e.numberOfChannels;t++){const n=Object.assign(Object.assign({},this.options),this.options.splitChannels[t]);this.renderChannel([e.getChannelData(t)],n,o)}else{const t=[e.getChannelData(0)];e.numberOfChannels>1&&t.push(e.getChannelData(1)),this.renderChannel(t,this.options,o)}this.audioData=e,this.emit("render")}reRender(){if(!this.audioData)return;const e=this.progressWrapper.clientWidth;this.render(this.audioData);const t=this.progressWrapper.clientWidth;this.scrollContainer.scrollLeft+=t-e}zoom(e){this.options.minPxPerSec=e,this.reRender()}scrollIntoView(e,t=!1){const{clientWidth:n,scrollLeft:r,scrollWidth:i}=this.scrollContainer,o=i*e,a=n/2;if(o>r+(t&&this.options.autoCenter&&!this.isDragging?a:n)||o<r)if(this.options.autoCenter&&!this.isDragging){const e=a/20;o-(r+a)>=e&&o<r+n?this.scrollContainer.scrollLeft+=e:this.scrollContainer.scrollLeft=o-a}else if(this.isDragging){const e=10;this.scrollContainer.scrollLeft=o<r?o-e:o-n+e}else this.scrollContainer.scrollLeft=o;{const{scrollLeft:e}=this.scrollContainer,t=e/i,r=(e+n)/i;this.emit("scroll",t,r)}}renderProgress(e,t){if(isNaN(e))return;const n=100*e;this.canvasWrapper.style.clipPath=`polygon(${n}% 0, 100% 0, 100% 100%, ${n}% 100%)`,this.progressWrapper.style.width=`${n}%`,this.cursor.style.left=`${n}%`,this.cursor.style.marginLeft=100===Math.round(n)?`-${this.options.cursorWidth}px`:"",this.isScrolling&&this.options.autoScroll&&this.scrollIntoView(e,t)}}Se.MAX_CANVAS_WIDTH=4e3;const Ce=Se;const Te=class extends ke{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",(()=>{requestAnimationFrame((()=>{this.emit("tick")}))})),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}};var Ae=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))};const Oe=class extends ke{constructor(e=new AudioContext){super(),this.bufferNode=null,this.autoplay=!1,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.audioContext=e,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return Ae(this,void 0,void 0,(function*(){}))}get src(){return this.currentSrc}set src(e){this.currentSrc=e,fetch(e).then((e=>e.arrayBuffer())).then((e=>this.audioContext.decodeAudioData(e))).then((e=>{this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play()}))}_play(){var e;this.paused&&(this.paused=!1,null===(e=this.bufferNode)||void 0===e||e.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.bufferNode.buffer=this.buffer,this.bufferNode.connect(this.gainNode),this.playedDuration>=this.duration&&(this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,this.playedDuration),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))})}_pause(){var e;this.paused||(this.paused=!0,null===(e=this.bufferNode)||void 0===e||e.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime)}play(){return Ae(this,void 0,void 0,(function*(){this._play(),this.emit("play")}))}pause(){this._pause(),this.emit("pause")}stopAt(e){var t,n;const r=e-this.currentTime;null===(t=this.bufferNode)||void 0===t||t.stop(this.audioContext.currentTime+r),null===(n=this.bufferNode)||void 0===n||n.addEventListener("ended",(()=>{this.bufferNode=null,this.pause()}),{once:!0})}setSinkId(e){return Ae(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(e)}))}get playbackRate(){var e,t;return null!==(t=null===(e=this.bufferNode)||void 0===e?void 0:e.playbackRate.value)&&void 0!==t?t:1}set playbackRate(e){this.bufferNode&&(this.bufferNode.playbackRate.value=e)}get currentTime(){return this.paused?this.playedDuration:this.playedDuration+this.audioContext.currentTime-this.playStartTime}set currentTime(e){this.emit("seeking"),this.paused?this.playedDuration=e:(this._pause(),this.playedDuration=e,this._play()),this.emit("timeupdate")}get duration(){var e;return(null===(e=this.buffer)||void 0===e?void 0:e.duration)||0}get volume(){return this.gainNode.gain.value}set volume(e){this.gainNode.gain.value=e,this.emit("volumechange")}get muted(){return this._muted}set muted(e){this._muted!==e&&(this._muted=e,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}getGainNode(){return this.gainNode}};var Pe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))};const Me={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class Ne extends Ee{static create(e){return new Ne(e)}constructor(e){const t=e.media||("WebAudio"===e.backend?new Oe:void 0);super({media:t,mediaControls:e.mediaControls,autoplay:e.autoplay,playbackRate:e.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.options=Object.assign({},Me,e),this.timer=new Te;const n=t?void 0:this.getMediaElement();this.renderer=new Ce(this.options,n),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const r=this.options.url||this.getSrc()||"";(r||this.options.peaks&&this.options.duration)&&this.load(r,this.options.peaks,this.options.duration)}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{const e=this.getCurrentTime();this.renderer.renderProgress(e/this.getDuration(),!0),this.emit("timeupdate",e),this.emit("audioprocess",e)})))}initPlayerEvents(){this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{const e=this.getCurrentTime();this.renderer.renderProgress(e/this.getDuration(),this.isPlaying()),this.emit("timeupdate",e)})),this.onMediaEvent("play",(()=>{this.emit("play"),this.timer.start()})),this.onMediaEvent("pause",(()=>{this.emit("pause"),this.timer.stop()})),this.onMediaEvent("emptied",(()=>{this.timer.stop()})),this.onMediaEvent("ended",(()=>{this.emit("finish")})),this.onMediaEvent("seeking",(()=>{this.emit("seeking",this.getCurrentTime())})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((e,t)=>{this.options.interact&&(this.seekTo(e),this.emit("interaction",e*this.getDuration()),this.emit("click",e,t))})),this.renderer.on("dblclick",((e,t)=>{this.emit("dblclick",e,t)})),this.renderer.on("scroll",((e,t)=>{const n=this.getDuration();this.emit("scroll",e*n,t*n)})),this.renderer.on("render",(()=>{this.emit("redraw")})));{let e;this.subscriptions.push(this.renderer.on("drag",(t=>{this.options.interact&&(this.renderer.renderProgress(t),clearTimeout(e),e=setTimeout((()=>{this.seekTo(t)}),this.isPlaying()?0:200),this.emit("interaction",t*this.getDuration()),this.emit("drag",t))})))}}initPlugins(){var e;(null===(e=this.options.plugins)||void 0===e?void 0:e.length)&&this.options.plugins.forEach((e=>{this.registerPlugin(e)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((e=>e())),this.mediaSubscriptions=[]}setOptions(e){this.options=Object.assign({},this.options,e),this.renderer.setOptions(this.options),e.audioRate&&this.setPlaybackRate(e.audioRate),null!=e.mediaControls&&(this.getMediaElement().controls=e.mediaControls)}registerPlugin(e){return e.init(this),this.plugins.push(e),this.subscriptions.push(e.once("destroy",(()=>{this.plugins=this.plugins.filter((t=>t!==e))}))),e}getWrapper(){return this.renderer.getWrapper()}getScroll(){return this.renderer.getScroll()}getActivePlugins(){return this.plugins}loadAudio(e,t,n,r){return Pe(this,void 0,void 0,(function*(){if(this.emit("load",e),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!t&&!n){const n=e=>this.emit("loading",e);t=yield _e.fetchBlob(e,n,this.options.fetchParams)}this.setSrc(e,t);const i=(yield Promise.resolve(r||this.getDuration()))||(yield new Promise((e=>{this.onceMediaEvent("loadedmetadata",(()=>e(this.getDuration())))})));if(n)this.decodedData=we.createBuffer(n,i||0);else if(t){const e=yield t.arrayBuffer();this.decodedData=yield we.decode(e,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())}))}load(e,t,n){return Pe(this,void 0,void 0,(function*(){yield this.loadAudio(e,void 0,t,n)}))}loadBlob(e,t,n){return Pe(this,void 0,void 0,(function*(){yield this.loadAudio("blob",e,t,n)}))}zoom(e){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(e),this.emit("zoom",e)}getDecodedData(){return this.decodedData}exportPeaks({channels:e=2,maxLength:t=8e3,precision:n=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const r=Math.min(e,this.decodedData.numberOfChannels),i=[];for(let e=0;e<r;e++){const r=this.decodedData.getChannelData(e),o=[],a=Math.round(r.length/t);for(let e=0;e<t;e++){const t=r.slice(e*a,(e+1)*a),i=Math.max(...t);o.push(Math.round(i*n)/n)}i.push(o)}return i}getDuration(){let e=super.getDuration()||0;return 0!==e&&e!==1/0||!this.decodedData||(e=this.decodedData.duration),e}toggleInteraction(e){this.options.interact=e}seekTo(e){const t=this.getDuration()*e;this.setTime(t)}playPause(){return Pe(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(e){this.setTime(this.getCurrentTime()+e)}empty(){this.load("",[[0]],.001)}setMediaElement(e){this.unsubscribePlayerEvents(),super.setMediaElement(e),this.initPlayerEvents()}destroy(){this.emit("destroy"),this.plugins.forEach((e=>e.destroy())),this.subscriptions.forEach((e=>e())),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}const Le=Ne;var Ie=i(497),De={};De.styleTagTransform=m(),De.setAttributes=d(),De.insert=c().bind(null,"head"),De.domAPI=s(),De.insertStyleElement=p();o()(Ie.Z,De);const Re=Ie.Z&&Ie.Z.locals?Ie.Z.locals:void 0;function Be(e){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(e)}function je(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */je=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==Be(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Be(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Be(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Be(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Be(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function We(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function He(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){We(o,r,i,a,s,"next",e)}function s(e){We(o,r,i,a,s,"throw",e)}a(void 0)}))}}function Ve(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Ge=function(t){var n=Ve((0,e.useContext)(F),2),r=n[0],i=n[1],o=(0,e.useRef)(null),a=(0,e.useRef)(null),s=(0,e.useRef)(null),l=(0,e.useRef)(null),c=Ve((0,e.useState)(!1),2),u=c[0],d=c[1],f=(0,e.useRef)(!1);function p(e){return h.apply(this,arguments)}function h(){return(h=He(je().mark((function e(t){return je().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=new FileReader;r.onloadend=function(){r.result instanceof ArrayBuffer?e(r.result):n(new Error("Failed to convert Blob to ArrayBuffer"))},r.onerror=n,r.readAsArrayBuffer(t)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var m=function(){var e=He(je().mark((function e(t){var n;return je().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o.current=Le.create({container:a.current,waveColor:"#C4C5CE",progressColor:"#9596A2",interpolation:"cubic",height:"auto",cursorWidth:0}),e.next=4,p(t);case 4:n=e.sent,o.current.loadBlob(new Blob([n],{type:"audio/wav"})),o.current.on("seeking",(function(e){var t=a.current.getBoundingClientRect().width*(e/o.current.getDuration());s.current.style.left="".concat(t,"px"),i((function(t){return Ue(Ue({},t),{},{time:e,updatePlayerTime:!0})}))})),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),console.error("Error loading waveform:",e.t0);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}(),g=function(){f.current||d(!0)},v=function(e){var t=a.current.getBoundingClientRect(),n=e.clientX-t.left;t.width;l.current.style.left="".concat(n,"px")},y=function(){d(!1)},b=function(e){a.current.contains(e.target)||(f.current=!0,d(!1))},w=function(){f.current=!1};return(0,e.useEffect)((function(){if(r.blob){m(r.blob);var e=a.current;return e.addEventListener("mouseover",g),e.addEventListener("mousemove",v),e.addEventListener("mouseleave",y),document.addEventListener("mousedown",b),document.addEventListener("mouseup",w),o.current&&o.current.on("seek",(function(e){var t=a.current.getBoundingClientRect(),n=t.width*e;s.current.style.left="".concat(n+t.left,"px")})),function(){o.current&&o.current.destroy(),e.removeEventListener("mouseenter",g),e.removeEventListener("mousemove",v),e.removeEventListener("mouseleave",y),document.removeEventListener("mousedown",b),document.removeEventListener("mouseup",w)}}}),[r.blob]),(0,e.useEffect)((function(){if(r.blob&&!r.updatePlayerTime&&null!==a.current){var e=document.createElement("video");e.preload="metadata",e.onloadedmetadata=He(je().mark((function t(){var n,i;return je().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=a.current.getBoundingClientRect(),i=n.width*(r.time/e.duration),s.current.style.left="".concat(i,"px"),URL.revokeObjectURL(e.src),e.remove();case 5:case"end":return t.stop()}}),t)}))),e.src=URL.createObjectURL(r.blob)}}),[r.time,r.blob,a.current]),e.createElement("div",{style:{height:"100%"}},e.createElement("div",{className:Re.cursor,ref:s}),e.createElement("div",{className:Re.ghostCursor,style:u?{opacity:1}:{opacity:0},ref:l}),e.createElement("div",{className:Re.waveform,ref:a}))};function $e(e){return $e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$e(e)}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){Xe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Xe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==$e(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==$e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===$e(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Qe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Qe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Je=function(t){var n=Ke((0,e.useContext)(F),2),r=n[0],i=n[1],o=(0,e.useRef)(null),a=(0,e.useRef)(null),s=(0,e.useRef)(null),l=(0,e.useRef)(!1),c=(0,e.useRef)(null),u=function(e,t){e.preventDefault(),l.current=!0,c.current=t,document.addEventListener("mousemove",d),document.addEventListener("mouseup",f)},d=function(e){if(l.current){var t=o.current.getBoundingClientRect(),n=t.width,a=(e.clientX-t.left)/n;if("start"===c.current){a+=0;var s=Math.max(Math.min(a,r.end-.02),0);i((function(e){return Ye(Ye({},e),{},{start:s})}))}else if("end"===c.current){a-=0;var u=Math.min(Math.max(a,r.start+.02),1);i((function(e){return Ye(Ye({},e),{},{end:u})}))}}},f=function e(){l.current=!1,c.current=null,r.addToHistory(),i((function(e){return Ye(Ye({},e),{},{dragInteracted:!0})})),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",e)};return(0,e.useEffect)((function(){a.current.style.left="calc(".concat(100*r.start,"%)"),s.current.style.left="".concat(100*r.end,"%")}),[r.start,r.end]),e.createElement("div",null,e.createElement("div",{className:ye.trimmerContainer,ref:o},e.createElement("div",{className:ye.trimWrap},e.createElement("div",{className:ye.leftOverlay,style:{width:"".concat(100*r.start,"%")}}),e.createElement("div",{className:ye.rightOverlay,style:{width:"".concat(100*(1-r.end),"%")}}),e.createElement("div",{className:ye.trimSection,style:{width:"".concat(100*(r.end-r.start),"%"),left:"".concat(100*r.start,"%")}}),e.createElement("div",{className:ye.trimmer},e.createElement("div",{className:"".concat(ye.handle," ").concat(ye.startHandle),onMouseDown:function(e){return u(e,"start")},ref:a}),e.createElement("div",{className:"".concat(ye.handle," ").concat(ye.endHandle),onMouseDown:function(e){return u(e,"end")},ref:s}))),e.createElement(Ge,null)))};var et=i(2827),tt={};tt.styleTagTransform=m(),tt.setAttributes=d(),tt.insert=c().bind(null,"head"),tt.domAPI=s(),tt.insertStyleElement=p();o()(et.Z,tt);const nt=et.Z&&et.Z.locals?et.Z.locals:void 0;function rt(){return rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},rt.apply(this,arguments)}function it(e,t){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},it(e,t)}var ot=function(e,t){return ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ot(e,t)};function at(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}ot(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var st=function(){return st=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},st.apply(this,arguments)};function lt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function ct(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))}function ut(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}Object.create;function dt(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function ft(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function pt(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}Object.create;"function"==typeof SuppressedError&&SuppressedError;var ht=i(7811),mt=new Map,gt=function(e){return e.cloneNode(!0)},vt=function(){return"file:"===window.location.protocol},yt=function(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){try{if(!/\.svg/i.test(e)&&2===r.readyState){var t=r.getResponseHeader("Content-Type");if(!t)throw new Error("Content type not found");var i=(0,ht.Q)(t).type;if("image/svg+xml"!==i&&"text/plain"!==i)throw new Error("Invalid content type: ".concat(i))}if(4===r.readyState){if(404===r.status||null===r.responseXML)throw new Error(vt()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+e);if(!(200===r.status||vt()&&0===r.status))throw new Error("There was a problem injecting the SVG: "+r.status+" "+r.statusText);n(null,r)}}catch(e){if(r.abort(),!(e instanceof Error))throw e;n(e,r)}},r.open("GET",e),r.withCredentials=t,r.overrideMimeType&&r.overrideMimeType("text/xml"),r.send()},bt={},wt=function(e,t){bt[e]=bt[e]||[],bt[e].push(t)},xt=function(e,t,n){if(mt.has(e)){var r=mt.get(e);if(void 0===r)return void wt(e,n);if(r instanceof SVGSVGElement)return void n(null,gt(r))}mt.set(e,void 0),wt(e,n),yt(e,t,(function(t,n){var r;t?mt.set(e,t):(null===(r=n.responseXML)||void 0===r?void 0:r.documentElement)instanceof SVGSVGElement&&mt.set(e,n.responseXML.documentElement),function(e){for(var t=function(t,n){setTimeout((function(){if(Array.isArray(bt[e])){var n=mt.get(e),r=bt[e][t];n instanceof SVGSVGElement&&r(null,gt(n)),n instanceof Error&&r(n),t===bt[e].length-1&&delete bt[e]}}),0)},n=0,r=bt[e].length;n<r;n++)t(n)}(e)}))},_t=function(e,t,n){yt(e,t,(function(e,t){var r;e?n(e):(null===(r=t.responseXML)||void 0===r?void 0:r.documentElement)instanceof SVGSVGElement&&n(null,t.responseXML.documentElement)}))},kt=0,Et=[],St={},Ct="http://www.w3.org/1999/xlink",Tt=function(e,t,n,r,i,o,a){var s=e.getAttribute("data-src")||e.getAttribute("src");if(s){if(-1!==Et.indexOf(e))return Et.splice(Et.indexOf(e),1),void(e=null);Et.push(e),e.setAttribute("src",""),(r?xt:_t)(s,i,(function(r,i){if(!i)return Et.splice(Et.indexOf(e),1),e=null,void a(r);var l=e.getAttribute("id");l&&i.setAttribute("id",l);var c=e.getAttribute("title");c&&i.setAttribute("title",c);var u=e.getAttribute("width");u&&i.setAttribute("width",u);var d=e.getAttribute("height");d&&i.setAttribute("height",d);var f=Array.from(new Set(pt(pt(pt([],(i.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(e.getAttribute("class")||"").split(" "),!0))).join(" ").trim();i.setAttribute("class",f);var p=e.getAttribute("style");p&&i.setAttribute("style",p),i.setAttribute("data-src",s);var h=[].filter.call(e.attributes,(function(e){return/^data-\w[\w-]*$/.test(e.name)}));if(Array.prototype.forEach.call(h,(function(e){e.name&&e.value&&i.setAttribute(e.name,e.value)})),n){var m,g,v,y,b,w={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]};Object.keys(w).forEach((function(e){m=e,v=w[e];for(var t=function(e,t){var n;y=g[e].id,b=y+"-"+ ++kt,Array.prototype.forEach.call(v,(function(e){for(var t=0,r=(n=i.querySelectorAll("["+e+'*="'+y+'"]')).length;t<r;t++){var o=n[t].getAttribute(e);o&&!o.match(new RegExp('url\\("?#'+y+'"?\\)'))||n[t].setAttribute(e,"url(#"+b+")")}}));for(var r=i.querySelectorAll("[*|href]"),o=[],a=0,s=r.length;a<s;a++){var l=r[a].getAttributeNS(Ct,"href");l&&l.toString()==="#"+g[e].id&&o.push(r[a])}for(var c=0,u=o.length;c<u;c++)o[c].setAttributeNS(Ct,"href","#"+b);g[e].id=b},n=0,r=(g=i.querySelectorAll(m+"[id]")).length;n<r;n++)t(n)}))}i.removeAttribute("xmlns:a");for(var x,_,k=i.querySelectorAll("script"),E=[],S=0,C=k.length;S<C;S++)(_=k[S].getAttribute("type"))&&"application/ecmascript"!==_&&"application/javascript"!==_&&"text/javascript"!==_||((x=k[S].innerText||k[S].textContent)&&E.push(x),i.removeChild(k[S]));if(E.length>0&&("always"===t||"once"===t&&!St[s])){for(var T=0,A=E.length;T<A;T++)new Function(E[T])(window);St[s]=!0}var O=i.querySelectorAll("style");if(Array.prototype.forEach.call(O,(function(e){e.textContent+=""})),i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("xmlns:xlink",Ct),o(i),!e.parentNode)return Et.splice(Et.indexOf(e),1),e=null,void a(new Error("Parent node is null"));e.parentNode.replaceChild(i,e),Et.splice(Et.indexOf(e),1),e=null,a(null,i)}))}else a(new Error("Invalid data-src or src attribute"))},At=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Ot="http://www.w3.org/2000/svg",Pt="http://www.w3.org/1999/xlink",Mt=function(t){var n,r;function i(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=t.call.apply(t,[this].concat(r))||this).initialState={hasError:!1,isLoading:!0},e.state=e.initialState,e._isMounted=!1,e.reactWrapper=void 0,e.nonReactWrapper=void 0,e.refCallback=function(t){e.reactWrapper=t},e}r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,it(n,r);var o=i.prototype;return o.renderSVG=function(){var e,t=this;if(this.reactWrapper instanceof(e=this.reactWrapper,((null==e?void 0:e.ownerDocument)||document).defaultView||window).Node){var n,r,i=this.props,o=i.desc,a=i.evalScripts,s=i.httpRequestWithCredentials,l=i.renumerateIRIElements,c=i.src,u=i.title,d=i.useRequestCache,f=this.props.onError,p=this.props.beforeInjection,h=this.props.afterInjection,m=this.props.wrapper;"svg"===m?((n=document.createElementNS(Ot,m)).setAttribute("xmlns",Ot),n.setAttribute("xmlns:xlink",Pt),r=document.createElementNS(Ot,m)):(n=document.createElement(m),r=document.createElement(m)),n.appendChild(r),r.dataset.src=c,this.nonReactWrapper=this.reactWrapper.appendChild(n);var g=function(e){t.removeSVG(),t._isMounted?t.setState((function(){return{hasError:!0,isLoading:!1}}),(function(){f(e)})):f(e)};!function(e,t){var n=void 0===t?{}:t,r=n.afterAll,i=void 0===r?function(){}:r,o=n.afterEach,a=void 0===o?function(){}:o,s=n.beforeEach,l=void 0===s?function(){}:s,c=n.cacheRequests,u=void 0===c||c,d=n.evalScripts,f=void 0===d?"never":d,p=n.httpRequestWithCredentials,h=void 0!==p&&p,m=n.renumerateIRIElements,g=void 0===m||m;if(e&&"length"in e)for(var v=0,y=0,b=e.length;y<b;y++)Tt(e[y],f,g,u,h,l,(function(t,n){a(t,n),e&&"length"in e&&e.length===++v&&i(v)}));else e?Tt(e,f,g,u,h,l,(function(t,n){a(t,n),i(1),e=null})):i(0)}(r,{afterEach:function(e,n){e?g(e):t._isMounted&&t.setState((function(){return{isLoading:!1}}),(function(){try{h(n)}catch(e){g(e)}}))},beforeEach:function(e){if(e.setAttribute("role","img"),o){var t=e.querySelector(":scope > desc");t&&e.removeChild(t);var n=document.createElement("desc");n.innerHTML=o,e.prepend(n)}if(u){var r=e.querySelector(":scope > title");r&&e.removeChild(r);var i=document.createElement("title");i.innerHTML=u,e.prepend(i)}try{p(e)}catch(e){g(e)}},cacheRequests:d,evalScripts:a,httpRequestWithCredentials:s,renumerateIRIElements:l})}},o.removeSVG=function(){var e;null!=(e=this.nonReactWrapper)&&e.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},o.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},o.componentDidUpdate=function(e){var t=this;(function(e,t){for(var n in e)if(!(n in t))return!0;for(var r in t)if(e[r]!==t[r])return!0;return!1})(rt({},e),this.props)&&this.setState((function(){return t.initialState}),(function(){t.removeSVG(),t.renderSVG()}))},o.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},o.render=function(){var t=this.props;t.afterInjection,t.beforeInjection,t.desc,t.evalScripts;var n=t.fallback;t.httpRequestWithCredentials;var r=t.loading;t.renumerateIRIElements,t.src,t.title,t.useRequestCache;var i=t.wrapper,o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(t,At),a=i;return e.createElement(a,rt({},o,{ref:this.refCallback},"svg"===i?{xmlns:Ot,xmlnsXlink:Pt}:{}),this.state.isLoading&&r&&e.createElement(r,null),this.state.hasError&&n&&e.createElement(n,null))},i}(e.Component);function Nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Lt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Mt.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"},Mt.propTypes={afterInjection:te.func,beforeInjection:te.func,desc:te.string,evalScripts:te.oneOf(["always","once","never"]),fallback:te.oneOfType([te.func,te.object,te.string]),httpRequestWithCredentials:te.bool,loading:te.oneOfType([te.func,te.object,te.string]),onError:te.func,renumerateIRIElements:te.bool,src:te.string.isRequired,title:te.string,useRequestCache:te.bool,wrapper:te.oneOf(["div","span","svg"])};var It="/assets/",Dt=It+"editor/icons/trim.svg",Rt=It+"editor/icons/trash.svg",Bt=It+"editor/icons/mute.svg",jt=It+"editor/icons/undo.svg",zt=It+"editor/icons/redo.svg",Ut=It+"editor/icons/time.svg";const Ft=function(t){var n=Nt((0,e.useContext)(F),2),r=n[0],i=(n[1],Nt((0,e.useState)(!0),2)),o=i[0],a=i[1],s=Nt((0,e.useState)(!0),2),l=s[0],c=s[1],u=Nt((0,e.useState)(0),2),d=u[0],f=u[1],p=Nt((0,e.useState)(0),2),h=p[0],m=p[1];(0,e.useEffect)((function(){f(r.start*r.duration),m(r.end*r.duration)}),[r.duration,r.start,r.end]),(0,e.useEffect)((function(){r.history.length>2?a(!1):a(!0)}),[r.history]),(0,e.useEffect)((function(){r.redoHistory.length>0?c(!1):c(!0)}),[r.redoHistory]);var g=function(e){var t=Math.floor(e/60),n=Math.floor(e-60*t);return n<10?"".concat(t,":0").concat(n):"".concat(t,":").concat(n)};return e.createElement("div",{className:nt.trimWrap},e.createElement("div",{className:nt.controls},e.createElement("div",{className:nt.actions},e.createElement("button",{className:"button secondaryButton",onClick:function(){return r.handleTrim(!1)},disabled:r.isFfmpegRunning||0===r.start&&1===r.end},e.createElement(Mt,{src:Dt}),r.trimming?chrome.i18n.getMessage("sandboxEditorTrimProgressButton"):chrome.i18n.getMessage("sandboxEditorTrimButton")),e.createElement("button",{className:"button secondaryButton",disabled:0===r.start&&1===r.end||r.isFfmpegRunning,onClick:function(){return r.handleTrim(!0)}},e.createElement(Mt,{src:Rt}),r.cutting?chrome.i18n.getMessage("sandboxEditorCutProgressButton"):chrome.i18n.getMessage("sandboxEditorCutButton")),e.createElement("button",{className:"button secondaryButton",onClick:function(){return r.handleMute()},disabled:r.isFfmpegRunning},e.createElement(Mt,{src:Bt}),r.muting?chrome.i18n.getMessage("sandboxEditorMuteProgressButton"):chrome.i18n.getMessage("sandboxEditorMuteButton"))),e.createElement("div",{className:nt.timeWrap},e.createElement(Mt,{src:Ut}),e.createElement("span",null,g(d)+" - "+g(h))),e.createElement("div",{className:nt.controlsRight},e.createElement("button",{className:"button simpleButton",onClick:function(){return r.undo()},disabled:o||r.isFfmpegRunning},e.createElement(Mt,{src:jt}),chrome.i18n.getMessage("undoLabel")),e.createElement("button",{className:"button simpleButton",onClick:function(){return r.redo()},disabled:l||r.isFfmpegRunning},e.createElement(Mt,{src:zt}),chrome.i18n.getMessage("redoLabel")))),e.createElement(Je,null),(!r.dragInteracted||r.duration>3)&&e.createElement("div",{className:nt.trimInfo},e.createElement("div",{className:nt.trimInfoLeft},e.createElement(Mt,{src:It+"editor/icons/alert.svg"})),e.createElement("div",{className:nt.trimInfoRight},chrome.i18n.getMessage("sandboxEditorTrimInfo"),e.createElement("div",{className:nt.trimInfoLink,onClick:function(){chrome.runtime.sendMessage({type:"trim-info"})}},chrome.i18n.getMessage("learnMoreDot")))),r.dragInteracted&&r.duration<=3&&e.createElement("div",{className:nt.trimInfo},e.createElement("div",{className:nt.trimInfoLeft},e.createElement(Mt,{src:It+"editor/icons/alert.svg"})),e.createElement("div",{className:nt.trimInfoRight},chrome.i18n.getMessage("sandboxEditorTooSmallInfo"),e.createElement("div",{className:nt.trimInfoLink,onClick:function(){chrome.runtime.sendMessage({type:"trim-info"})}},chrome.i18n.getMessage("learnMoreDot")))))};var Wt=i(893),Ht={};Ht.styleTagTransform=m(),Ht.setAttributes=d(),Ht.insert=c().bind(null,"head"),Ht.domAPI=s(),Ht.insertStyleElement=p();o()(Wt.Z,Ht);const Vt=Wt.Z&&Wt.Z.locals?Wt.Z.locals:void 0;const qt=function(){return e.createElement("button",{className:Vt.HelpButton,"aria-label":"Help button",onClick:function(){chrome.runtime.sendMessage({type:"open-help"})}},e.createElement(Mt,{src:"/assets/editor/icons/help.svg",width:"18px",height:"18px"}))};function Gt(e){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gt(e)}function $t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$t(Object(n),!0).forEach((function(t){Yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Yt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Gt(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Gt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Gt(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Qt=function(t){t.ffmpeg;var n=Xt((0,e.useContext)(F),2),r=n[0],i=n[1],o=function(e,t){i((function(n){return Zt(Zt({},n),{},{updatePlayerTime:t,time:e})}))};return(0,e.useEffect)((function(){i((function(e){return Zt(Zt({},e),{},{history:[{}],redoHistory:[]})})),r.addToHistory()}),[]),e.createElement("div",null,e.createElement(K,null),e.createElement(me,{onSeek:o}),e.createElement(Ft,{blob:r.blob,onSeek:o}),e.createElement(qt,null))};var Jt=i(1559),en={};en.styleTagTransform=m(),en.setAttributes=d(),en.insert=c().bind(null,"head"),en.domAPI=s(),en.insertStyleElement=p();o()(Jt.Z,en);const tn=Jt.Z&&Jt.Z.locals?Jt.Z.locals:void 0;function nn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var on="/assets/",an=on+"editor/icons/help-nav.svg",sn=on+"editor/icons/heart.svg";const ln=function(){var t=nn((0,e.useContext)(F),2),n=t[0],r=(t[1],(0,e.useRef)(null));return(0,e.useEffect)((function(){r.current=n}),[n]),e.createElement("div",{className:tn.nav},e.createElement("div",{className:tn.navWrap},e.createElement("div",{onClick:function(){chrome.runtime.sendMessage({type:"open-home"})},"aria-label":"home",className:tn.navLeft},e.createElement("img",{src:on+"editor/logo.svg",alt:"Screenity Logo"})),e.createElement("div",{className:tn.navRight},e.createElement("button",{className:"button simpleButton blueButton",onClick:function(){chrome.runtime.sendMessage({type:"open-help"})}},e.createElement(Mt,{src:an}),chrome.i18n.getMessage("getHelpNav")),e.createElement("button",{className:"button primaryButton",onClick:function(){chrome.runtime.sendMessage({type:"follow-twitter"})}},e.createElement(Mt,{src:sn})," ",chrome.i18n.getMessage("followForUpdates")))))};function cn(e){return cn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cn(e)}function un(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */un=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==cn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(cn(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function dn(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){hn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==cn(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==cn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===cn(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return gn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const vn=function(){var t=mn((0,e.useContext)(F),2),n=t[0],r=t[1],i=function(){var e,t=(e=un().mark((function e(){return un().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.handleCrop(n.left,n.top,n.width,n.height);case 1:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){dn(o,r,i,a,s,"next",e)}function s(e){dn(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return e.createElement("div",{className:_.editorNav},e.createElement("div",{className:_.navWrap},e.createElement("div",{className:_.editorNavLeft,onClick:function(){chrome.runtime.sendMessage({type:"open-home"})}},e.createElement("img",{src:"/assets/editor/logo.svg",alt:"Logo"})),e.createElement("div",{className:_.editorNavCenter},e.createElement("div",{className:_.editorNavTitle},chrome.i18n.getMessage("sandboxEditorMainTitle")+" "," ",e.createElement("span",{className:_.beta},"BETA"))),e.createElement("div",{className:_.editorNavRight},e.createElement("button",{className:"button simpleButton blackButton",onClick:function(){r((function(e){return pn(pn({},e),{},{mode:"player",blob:n.originalBlob,start:0,end:1,width:n.prevWidth,height:n.prevHeight,left:0,top:0,fromCropper:!1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorCancelButton")),e.createElement("button",{className:"button secondaryButton",onClick:function(){r((function(e){return pn(pn({},e),{},{blob:n.originalBlob,start:0,end:1,width:n.prevWidth,height:n.prevHeight,left:0,top:0,fromCropper:!1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorResetButton")),e.createElement("button",{className:"button primaryButton",onClick:i,disabled:n.isFfmpegRunning},n.cropping?chrome.i18n.getMessage("sandboxEditorSaveProgressButton"):chrome.i18n.getMessage("sandboxEditorSaveButton")))))};function yn(e){return yn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yn(e)}function bn(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */bn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==yn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(yn(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function wn(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xn(Object(n),!0).forEach((function(t){kn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function kn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==yn(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==yn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===yn(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function En(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Sn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Cn=function(){var t=En((0,e.useContext)(F),2),n=t[0],r=t[1],i=function(){var e,t=(e=bn().mark((function e(){return bn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r((function(e){return _n(_n({},e),{},{mode:"player",start:0,end:1})}));case 1:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){wn(o,r,i,a,s,"next",e)}function s(e){wn(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return e.createElement("div",{className:_.editorNav},e.createElement("div",{className:_.navWrap},e.createElement("div",{className:_.editorNavLeft,onClick:function(){chrome.runtime.sendMessage({type:"open-home"})}},e.createElement("img",{src:"/assets/editor/logo.svg",alt:"Logo"})),e.createElement("div",{className:_.editorNavCenter},e.createElement("div",{className:_.editorNavTitle},chrome.i18n.getMessage("sandboxEditorMainTitle")+" "," ",e.createElement("span",{className:_.beta},"BETA"))),e.createElement("div",{className:_.editorNavRight},e.createElement("button",{className:"button simpleButton blackButton",onClick:function(){r((function(e){return _n(_n({},e),{},{mode:"player",blob:n.originalBlob,start:0,end:1,width:n.prevWidth,height:n.prevHeight,left:0,top:0,fromCropper:!1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorCancelButton")),e.createElement("button",{className:"button secondaryButton",onClick:function(){r((function(e){return _n(_n({},e),{},{blob:n.originalBlob,start:0,end:1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorRevertButton")),e.createElement("button",{className:"button primaryButton",onClick:i,disabled:n.isFfmpegRunning},n.cropping?chrome.i18n.getMessage("sandboxEditorSaveProgressButton"):chrome.i18n.getMessage("sandboxEditorSaveButton")))))};var Tn=i(3049),An={};An.styleTagTransform=m(),An.setAttributes=d(),An.insert=c().bind(null,"head"),An.domAPI=s(),An.insertStyleElement=p();o()(Tn.Z,An);const On=Tn.Z&&Tn.Z.locals?Tn.Z.locals:void 0;var Pn=i(5733),Mn=i.n(Pn),Nn=i(3562),Ln={};Ln.styleTagTransform=m(),Ln.setAttributes=d(),Ln.insert=c().bind(null,"head"),Ln.domAPI=s(),Ln.insertStyleElement=p();o()(Nn.Z,Ln);Nn.Z&&Nn.Z.locals&&Nn.Z.locals;function In(e){return In="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},In(e)}function Dn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dn(Object(n),!0).forEach((function(t){Bn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Bn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==In(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==In(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===In(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return zn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Un="chrome-extension://"+chrome.i18n.getMessage("@@extension_id")+"/assets/";const Fn=function(t){var n=jn((0,e.useContext)(F),2),r=n[0],i=n[1];return e.createElement("div",null,e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Un+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("croppingInfoTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("videoProcessingLabelDescription"))),e.createElement("div",{className:On.buttonRight,onClick:function(){chrome.runtime.sendMessage({type:"upgrade-info"})}},chrome.i18n.getMessage("learnMoreLabel"))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxCropTitle")),e.createElement("div",{className:On.inputs},e.createElement("div",{className:On.input},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("widthLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||i((function(e){return Rn(Rn({},e),{},{width:parseFloat(t),cropPreset:"none",fromCropper:!1})}))}(e)},onBlur:function(e){""===e.target.value&&i((function(e){return Rn(Rn({},e),{},{width:0})}))},value:r.width}),e.createElement("span",null,"px")),e.createElement("div",{className:On.input},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("heightLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||i((function(e){return Rn(Rn({},e),{},{height:parseFloat(t),cropPreset:"none",fromCropper:!1})}))}(e)},value:r.height,onBlur:function(e){""===e.target.value&&i((function(e){return Rn(Rn({},e),{},{height:0})}))}}),e.createElement("span",null,"px"))),e.createElement("div",{className:On.inputs},e.createElement("div",{className:On.input},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("leftLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||i((function(e){return Rn(Rn({},e),{},{left:parseFloat(t),fromCropper:!1})}))}(e)},onBlur:function(e){""===e.target.value&&i((function(e){return Rn(Rn({},e),{},{left:0})}))},value:r.left}),e.createElement("span",null,"px")),e.createElement("div",{className:On.input},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("topLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||i((function(e){return Rn(Rn({},e),{},{top:parseFloat(t),fromCropper:!1})}))}(e)},onBlur:function(e){""===e.target.value&&i((function(e){return Rn(Rn({},e),{},{top:0})}))},value:r.top}),e.createElement("span",null,"px")))))};function Wn(e,[t,n]){return Math.min(n,Math.max(t,e))}function Hn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function Vn(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function qn(...t){return(0,e.useCallback)(Vn(...t),t)}function Gn(t,n=[]){let r=[];const i=()=>{const n=r.map((t=>(0,e.createContext)(t)));return function(r){const i=(null==r?void 0:r[t])||n;return(0,e.useMemo)((()=>({[`__scope${t}`]:{...r,[t]:i}})),[r,i])}};return i.scopeName=t,[function(n,i){const o=(0,e.createContext)(i),a=r.length;function s(n){const{scope:r,children:i,...s}=n,l=(null==r?void 0:r[t][a])||o,c=(0,e.useMemo)((()=>s),Object.values(s));return(0,e.createElement)(l.Provider,{value:c},i)}return r=[...r,i],s.displayName=n+"Provider",[s,function(r,s){const l=(null==s?void 0:s[t][a])||o,c=(0,e.useContext)(l);if(c)return c;if(void 0!==i)return i;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},$n(i,...n)]}function $n(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(t){const i=r.reduce(((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]})),{});return(0,e.useMemo)((()=>({[`__scope${n.scopeName}`]:i})),[i])}};return r.scopeName=n.scopeName,r}function Zn(t){const n=(0,e.useRef)(t);return(0,e.useEffect)((()=>{n.current=t})),(0,e.useMemo)((()=>(...e)=>{var t;if("function"==typeof(t=n.current))return null===(t=n.current)||void 0===t?void 0:t.call(n,...e)}),[])}function Yn({prop:t,defaultProp:n,onChange:r=(()=>{})}){const[i,o]=function({defaultProp:t,onChange:n}){const r=(0,e.useState)(t),[i]=r,o=(0,e.useRef)(i),a=Zn(n);return(0,e.useEffect)((()=>{o.current!==i&&(a(i),o.current=i)}),[i,o,a]),r}({defaultProp:n,onChange:r}),a=void 0!==t,s=a?t:i,l=Zn(r);return[s,(0,e.useCallback)((e=>{if(a){const n="function"==typeof e?e(t):e;n!==t&&l(n)}else o(e)}),[a,t,o,l])]}const Xn=(0,e.createContext)(void 0);function Kn(t){const n=(0,e.useRef)({value:t,previous:t});return(0,e.useMemo)((()=>(n.current.value!==t&&(n.current.previous=n.current.value,n.current.value=t),n.current.previous)),[t])}const Qn=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?e.useLayoutEffect:()=>{};function Jn(t){const[n,r]=(0,e.useState)(void 0);return Qn((()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver((e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[0];let i,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,o=t.blockSize}else i=t.offsetWidth,o=t.offsetHeight;r({width:i,height:o})}));return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}r(void 0)}),[t]),n}const er=(0,e.forwardRef)(((t,n)=>{const{children:r,...i}=t,o=e.Children.toArray(r),a=o.find(rr);if(a){const t=a.props.children,r=o.map((n=>n===a?e.Children.count(t)>1?e.Children.only(null):(0,e.isValidElement)(t)?t.props.children:null:n));return(0,e.createElement)(tr,rt({},i,{ref:n}),(0,e.isValidElement)(t)?(0,e.cloneElement)(t,void 0,r):null)}return(0,e.createElement)(tr,rt({},i,{ref:n}),r)}));er.displayName="Slot";const tr=(0,e.forwardRef)(((t,n)=>{const{children:r,...i}=t;return(0,e.isValidElement)(r)?(0,e.cloneElement)(r,{...ir(i,r.props),ref:n?Vn(n,r.ref):r.ref}):e.Children.count(r)>1?e.Children.only(null):null}));tr.displayName="SlotClone";const nr=({children:t})=>(0,e.createElement)(e.Fragment,null,t);function rr(t){return(0,e.isValidElement)(t)&&t.type===nr}function ir(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{o(...e),i(...e)}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}const or=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((t,n)=>{const r=(0,e.forwardRef)(((t,r)=>{const{asChild:i,...o}=t,a=i?er:n;return(0,e.useEffect)((()=>{window[Symbol.for("radix-ui")]=!0}),[]),(0,e.createElement)(a,rt({},o,{ref:r}))}));return r.displayName=`Primitive.${n}`,{...t,[n]:r}}),{});const ar=["PageUp","PageDown"],sr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lr={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},cr="Slider",[ur,dr,fr]=function(t){const n=t+"CollectionProvider",[r,i]=Gn(n),[o,a]=r(n,{collectionRef:{current:null},itemMap:new Map}),s=t=>{const{scope:n,children:r}=t,i=e.useRef(null),a=e.useRef(new Map).current;return e.createElement(o,{scope:n,itemMap:a,collectionRef:i},r)},l=t+"CollectionSlot",c=e.forwardRef(((t,n)=>{const{scope:r,children:i}=t,o=qn(n,a(l,r).collectionRef);return e.createElement(er,{ref:o},i)})),u=t+"CollectionItemSlot",d="data-radix-collection-item",f=e.forwardRef(((t,n)=>{const{scope:r,children:i,...o}=t,s=e.useRef(null),l=qn(n,s),c=a(u,r);return e.useEffect((()=>(c.itemMap.set(s,{ref:s,...o}),()=>{c.itemMap.delete(s)}))),e.createElement(er,{[d]:"",ref:l},i)}));return[{Provider:s,Slot:c,ItemSlot:f},function(n){const r=a(t+"CollectionConsumer",n);return e.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(cr),[pr,hr]=Gn(cr,[fr]),[mr,gr]=pr(cr),vr=(0,e.forwardRef)(((t,n)=>{const{name:r,min:i=0,max:o=100,step:a=1,orientation:s="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[i],value:d,onValueChange:f=(()=>{}),onValueCommit:p=(()=>{}),inverted:h=!1,...m}=t,[g,v]=(0,e.useState)(null),y=qn(n,(e=>v(e))),b=(0,e.useRef)(new Set),w=(0,e.useRef)(0),x="horizontal"===s,_=!g||Boolean(g.closest("form")),k=x?wr:xr,[E=[],S]=Yn({prop:d,defaultProp:u,onChange:e=>{var t;null===(t=[...b.current][w.current])||void 0===t||t.focus(),f(e)}}),C=(0,e.useRef)(E);function T(e,t,{commit:n}={commit:!1}){const r=function(e){return(String(e).split(".")[1]||"").length}(a),s=function(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}(Math.round((e-i)/a)*a+i,r),l=Wn(s,[i,o]);S(((e=[])=>{const r=function(e=[],t,n){const r=[...e];return r[n]=t,r.sort(((e,t)=>e-t))}(e,l,t);if(function(e,t){if(t>0){const n=function(e){return e.slice(0,-1).map(((t,n)=>e[n+1]-t))}(e);return Math.min(...n)>=t}return!0}(r,c*a)){w.current=r.indexOf(l);const t=String(r)!==String(e);return t&&n&&p(r),t?r:e}return e}))}return(0,e.createElement)(mr,{scope:t.__scopeSlider,disabled:l,min:i,max:o,valueIndexToChangeRef:w,thumbs:b.current,values:E,orientation:s},(0,e.createElement)(ur.Provider,{scope:t.__scopeSlider},(0,e.createElement)(ur.Slot,{scope:t.__scopeSlider},(0,e.createElement)(k,rt({"aria-disabled":l,"data-disabled":l?"":void 0},m,{ref:y,onPointerDown:Hn(m.onPointerDown,(()=>{l||(C.current=E)})),min:i,max:o,inverted:h,onSlideStart:l?void 0:function(e){const t=function(e,t){if(1===e.length)return 0;const n=e.map((e=>Math.abs(e-t))),r=Math.min(...n);return n.indexOf(r)}(E,e);T(e,t)},onSlideMove:l?void 0:function(e){T(e,w.current)},onSlideEnd:l?void 0:function(){const e=C.current[w.current];E[w.current]!==e&&p(E)},onHomeKeyDown:()=>!l&&T(i,0,{commit:!0}),onEndKeyDown:()=>!l&&T(o,E.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!l){const n=ar.includes(e.key)||e.shiftKey&&sr.includes(e.key)?10:1,r=w.current;T(E[r]+a*n*t,r,{commit:!0})}}})))),_&&E.map(((t,n)=>(0,e.createElement)(Pr,{key:n,name:r?r+(E.length>1?"[]":""):void 0,value:t}))))})),[yr,br]=pr(cr,{startEdge:"left",endEdge:"right",size:"width",direction:1}),wr=(0,e.forwardRef)(((t,n)=>{const{min:r,max:i,dir:o,inverted:a,onSlideStart:s,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=t,[f,p]=(0,e.useState)(null),h=qn(n,(e=>p(e))),m=(0,e.useRef)(),g=function(t){const n=(0,e.useContext)(Xn);return t||n||"ltr"}(o),v="ltr"===g,y=v&&!a||!v&&a;function b(e){const t=m.current||f.getBoundingClientRect(),n=Nr([0,t.width],y?[r,i]:[i,r]);return m.current=t,n(e-t.left)}return(0,e.createElement)(yr,{scope:t.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width"},(0,e.createElement)(_r,rt({dir:g,"data-orientation":"horizontal"},d,{ref:h,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{const t=b(e.clientX);null==s||s(t)},onSlideMove:e=>{const t=b(e.clientX);null==l||l(t)},onSlideEnd:()=>{m.current=void 0,null==c||c()},onStepKeyDown:e=>{const t=lr[y?"from-left":"from-right"].includes(e.key);null==u||u({event:e,direction:t?-1:1})}})))})),xr=(0,e.forwardRef)(((t,n)=>{const{min:r,max:i,inverted:o,onSlideStart:a,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=t,d=(0,e.useRef)(null),f=qn(n,d),p=(0,e.useRef)(),h=!o;function m(e){const t=p.current||d.current.getBoundingClientRect(),n=Nr([0,t.height],h?[i,r]:[r,i]);return p.current=t,n(e-t.top)}return(0,e.createElement)(yr,{scope:t.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1},(0,e.createElement)(_r,rt({"data-orientation":"vertical"},u,{ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{const t=m(e.clientY);null==a||a(t)},onSlideMove:e=>{const t=m(e.clientY);null==s||s(t)},onSlideEnd:()=>{p.current=void 0,null==l||l()},onStepKeyDown:e=>{const t=lr[h?"from-bottom":"from-top"].includes(e.key);null==c||c({event:e,direction:t?-1:1})}})))})),_r=(0,e.forwardRef)(((t,n)=>{const{__scopeSlider:r,onSlideStart:i,onSlideMove:o,onSlideEnd:a,onHomeKeyDown:s,onEndKeyDown:l,onStepKeyDown:c,...u}=t,d=gr(cr,r);return(0,e.createElement)(or.span,rt({},u,{ref:n,onKeyDown:Hn(t.onKeyDown,(e=>{"Home"===e.key?(s(e),e.preventDefault()):"End"===e.key?(l(e),e.preventDefault()):ar.concat(sr).includes(e.key)&&(c(e),e.preventDefault())})),onPointerDown:Hn(t.onPointerDown,(e=>{const t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),d.thumbs.has(t)?t.focus():i(e)})),onPointerMove:Hn(t.onPointerMove,(e=>{e.target.hasPointerCapture(e.pointerId)&&o(e)})),onPointerUp:Hn(t.onPointerUp,(e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))}))}))})),kr="SliderTrack",Er=(0,e.forwardRef)(((t,n)=>{const{__scopeSlider:r,...i}=t,o=gr(kr,r);return(0,e.createElement)(or.span,rt({"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation},i,{ref:n}))})),Sr="SliderRange",Cr=(0,e.forwardRef)(((t,n)=>{const{__scopeSlider:r,...i}=t,o=gr(Sr,r),a=br(Sr,r),s=qn(n,(0,e.useRef)(null)),l=o.values.length,c=o.values.map((e=>Mr(e,o.min,o.max))),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return(0,e.createElement)(or.span,rt({"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0},i,{ref:s,style:{...t.style,[a.startEdge]:u+"%",[a.endEdge]:d+"%"}}))})),Tr="SliderThumb",Ar=(0,e.forwardRef)(((t,n)=>{const r=dr(t.__scopeSlider),[i,o]=(0,e.useState)(null),a=qn(n,(e=>o(e))),s=(0,e.useMemo)((()=>i?r().findIndex((e=>e.ref.current===i)):-1),[r,i]);return(0,e.createElement)(Or,rt({},t,{ref:a,index:s}))})),Or=(0,e.forwardRef)(((t,n)=>{const{__scopeSlider:r,index:i,...o}=t,a=gr(Tr,r),s=br(Tr,r),[l,c]=(0,e.useState)(null),u=qn(n,(e=>c(e))),d=Jn(l),f=a.values[i],p=void 0===f?0:Mr(f,a.min,a.max),h=function(e,t){return t>2?`Value ${e+1} of ${t}`:2===t?["Minimum","Maximum"][e]:void 0}(i,a.values.length),m=null==d?void 0:d[s.size],g=m?function(e,t,n){const r=e/2,i=Nr([0,50],[0,r]);return(r-i(t)*n)*n}(m,p,s.direction):0;return(0,e.useEffect)((()=>{if(l)return a.thumbs.add(l),()=>{a.thumbs.delete(l)}}),[l,a.thumbs]),(0,e.createElement)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${p}% + ${g}px)`}},(0,e.createElement)(ur.ItemSlot,{scope:t.__scopeSlider},(0,e.createElement)(or.span,rt({role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":a.min,"aria-valuenow":f,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0},o,{ref:u,style:void 0===f?{display:"none"}:t.style,onFocus:Hn(t.onFocus,(()=>{a.valueIndexToChangeRef.current=i}))}))))})),Pr=t=>{const{value:n,...r}=t,i=(0,e.useRef)(null),o=Kn(n);return(0,e.useEffect)((()=>{const e=i.current,t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(o!==n&&r){const t=new Event("input",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}}),[o,n]),(0,e.createElement)("input",rt({style:{display:"none"}},r,{ref:i,defaultValue:n}))};function Mr(e,t,n){return Wn(100/(n-t)*(e-t),[0,100])}function Nr(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}const Lr=vr,Ir=Er,Dr=Cr,Rr=Ar,Br="Switch",[jr,zr]=Gn(Br),[Ur,Fr]=jr(Br),Wr=(0,e.forwardRef)(((t,n)=>{const{__scopeSwitch:r,name:i,checked:o,defaultChecked:a,required:s,disabled:l,value:c="on",onCheckedChange:u,...d}=t,[f,p]=(0,e.useState)(null),h=qn(n,(e=>p(e))),m=(0,e.useRef)(!1),g=!f||Boolean(f.closest("form")),[v=!1,y]=Yn({prop:o,defaultProp:a,onChange:u});return(0,e.createElement)(Ur,{scope:r,checked:v,disabled:l},(0,e.createElement)(or.button,rt({type:"button",role:"switch","aria-checked":v,"aria-required":s,"data-state":Gr(v),"data-disabled":l?"":void 0,disabled:l,value:c},d,{ref:h,onClick:Hn(t.onClick,(e=>{y((e=>!e)),g&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())}))})),g&&(0,e.createElement)(qr,{control:f,bubbles:!m.current,name:i,value:c,checked:v,required:s,disabled:l,style:{transform:"translateX(-100%)"}}))})),Hr="SwitchThumb",Vr=(0,e.forwardRef)(((t,n)=>{const{__scopeSwitch:r,...i}=t,o=Fr(Hr,r);return(0,e.createElement)(or.span,rt({"data-state":Gr(o.checked),"data-disabled":o.disabled?"":void 0},i,{ref:n}))})),qr=t=>{const{control:n,checked:r,bubbles:i=!0,...o}=t,a=(0,e.useRef)(null),s=Kn(r),l=Jn(n);return(0,e.useEffect)((()=>{const e=a.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==r&&n){const t=new Event("click",{bubbles:i});n.call(e,r),e.dispatchEvent(t)}}),[s,r,i]),(0,e.createElement)("input",rt({type:"checkbox","aria-hidden":!0,defaultChecked:r},o,{tabIndex:-1,ref:a,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function Gr(e){return e?"checked":"unchecked"}const $r=Wr,Zr=Vr;var Yr=i(5175),Xr={};Xr.styleTagTransform=m(),Xr.setAttributes=d(),Xr.insert=c().bind(null,"head"),Xr.domAPI=s(),Xr.insertStyleElement=p();o()(Yr.Z,Xr);const Kr=Yr.Z&&Yr.Z.locals?Yr.Z.locals:void 0;function Qr(e){return Qr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qr(e)}function Jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ei(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jr(Object(n),!0).forEach((function(t){ti(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ti(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Qr(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Qr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Qr(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ri(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ri(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const ii=function(){var t=ni((0,e.useContext)(F),2),n=t[0],r=t[1];return e.createElement("form",null,e.createElement("div",{className:Kr.SwitchRow},e.createElement("label",{className:Kr.Label,htmlFor:"replaceAudio",style:{paddingRight:15}},chrome.i18n.getMessage("replaceAudioEditor")),e.createElement($r,{className:Kr.SwitchRoot,checked:n.replaceAudio,onCheckedChange:function(e){r((function(t){return ei(ei({},t),{},{replaceAudio:e})}))}},e.createElement(Zr,{className:Kr.SwitchThumb}))))};function oi(e){return oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oi(e)}function ai(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ai=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==oi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(oi(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function si(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function li(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){si(o,r,i,a,s,"next",e)}function s(e){si(o,r,i,a,s,"throw",e)}a(void 0)}))}}function ci(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ui(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ci(Object(n),!0).forEach((function(t){di(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ci(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function di(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==oi(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==oi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===oi(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return pi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pi(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var hi="/assets/";const mi=function(t){var n=fi((0,e.useContext)(F),2),r=n[0],i=n[1],o=fi((0,e.useState)(null),2),a=o[0],s=o[1],l=(0,e.useRef)(null),c=(0,e.useRef)(null);(0,e.useEffect)((function(){r.blob!==l.current&&(l.current=r.blob,s(null),i((function(e){return ui(ui({},e),{},{volume:1})})))}),[]);var u=function(){var e=li(ai().mark((function e(t){var n;return ai().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.target.files[0]).type.includes("audio")&&0!==n.size){e.next=3;break}return e.abrupt("return");case 3:r.addAudio(r.blob,n,r.volume),s(n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),d=function(){var e=li(ai().mark((function e(){return ai().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i((function(e){return ui(ui({},e),{},{blob:l.current})})),r.addAudio(l.current,a,r.volume);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return e.createElement("div",null,e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},"Audio upload"),e.createElement("input",{type:"file",accept:"audio/*",onChange:u,style:{display:"none"},ref:c}),!a&&e.createElement("div",{className:On.uploadArea,onClick:function(){return c.current.click()}},e.createElement(Mt,{src:hi+"editor/icons/upload.svg"}),e.createElement("div",{className:On.uploadDetails},e.createElement("div",{className:On.uploadText},chrome.i18n.getMessage("sandboxAudioDragAndDrop")),e.createElement("div",{className:On.uploadDescription},chrome.i18n.getMessage("sandboxAudioOrBrowse")))),a&&e.createElement("div",{className:On.audioDetails},e.createElement("div",{className:On.audioDetailsLeft},e.createElement(Mt,{src:hi+"editor/icons/attachment.svg"})),e.createElement("div",{className:On.audioDetailsMiddle},e.createElement("span",null,a.name)),e.createElement("div",{className:On.audioDetailsRight},e.createElement(Mt,{src:hi+"editor/icons/cross.svg",onClick:function(){s(null),i((function(e){return ui(ui({},e),{},{blob:l.current})})),c.current.value=null}})))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxAudioSettingsTitle")),e.createElement("div",{className:On.inputs},e.createElement("div",{className:"".concat(On.input," ").concat(On.inputVolume)},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("sandboxAudioVolumeLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||t>100||i((function(e){return ui(ui({},e),{},{volume:parseFloat(t)/100})}))}(e)},value:Math.round(100*r.volume),onBlur:function(e){""===e.target.value&&i((function(e){return ui(ui({},e),{},{volume:0})}))}}),e.createElement("span",null,"%")),e.createElement(Lr,{className:On.SliderRoot,max:100,step:1,onValueChange:function(e){i((function(t){return ui(ui({},t),{},{volume:Math.round(e)/100})}))},value:[100*r.volume]},e.createElement(Ir,{className:On.SliderTrack},e.createElement(Dr,{className:On.SliderRange})),e.createElement(Rr,{className:On.SliderThumb,"aria-label":"Volume"}))),e.createElement(ii,null),e.createElement("button",{className:["button","primaryButton",On.updateButton].join(" "),onClick:d,disabled:r.isFfmpegRunning||!a},chrome.i18n.getMessage("sandboxAudioUpdateButton"))))};function gi(e){return gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gi(e)}function vi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */vi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==gi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(gi(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function yi(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function bi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(n),!0).forEach((function(t){xi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==gi(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==gi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===gi(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ki(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ki(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ki(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ei="chrome-extension://"+chrome.i18n.getMessage("@@extension_id")+"/assets/";const Si=function(){var t=_i((0,e.useContext)(F),2),n=t[0],r=t[1],i=_i((0,e.useState)(!1),2),o=(i[0],i[1],(0,e.useRef)(n)),a=(0,e.useRef)([]);(0,e.useEffect)((function(){console.error=function(e){a.current.push(e)}}),[]),(0,e.useEffect)((function(){o.current=n}),[n]);var s=function(){var e,t=(e=vi().mark((function e(){return vi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n.duration>n.editLimit)||n.override){e.next=2;break}return e.abrupt("return");case 2:if(n.mp4ready){e.next=4;break}return e.abrupt("return");case 4:r((function(e){return wi(wi({},e),{},{mode:"audio"})})),n.hasBeenEdited||r((function(e){return wi(wi({},e),{},{hasBeenEdited:!0})}));case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){yi(o,r,i,a,s,"next",e)}function s(e){yi(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return e.createElement("div",{className:On.panel},"audio"===n.mode&&e.createElement(mi,null),"crop"===n.mode&&e.createElement(Fn,null),"player"===n.mode&&e.createElement("div",null,!n.fallback&&n.offline&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/no-internet.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("offlineLabelTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("offlineLabelDescription"))),e.createElement("div",{className:On.buttonRight},chrome.i18n.getMessage("offlineLabelTryAgain"))),n.fallback&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("recoveryModeTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("overLimitLabelDescription")))),!n.fallback&&n.updateChrome&&!n.offline&&n.duration<=n.editLimit&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("updateChromeLabelTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("updateChromeLabelDescription"))),e.createElement("div",{className:On.buttonRight,onClick:function(){chrome.runtime.sendMessage({type:"chrome-update-info"})}},chrome.i18n.getMessage("learnMoreLabel"))),!n.fallback&&n.duration>n.editLimit&&!n.override&&!n.offline&&!n.updateChrome&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("overLimitLabelTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("overLimitLabelDescription"))),e.createElement("div",{className:On.buttonRight,onClick:function(){"function"==typeof n.openModal&&n.openModal(chrome.i18n.getMessage("overLimitModalTitle"),chrome.i18n.getMessage("overLimitModalDescription"),chrome.i18n.getMessage("overLimitModalButton"),chrome.i18n.getMessage("sandboxEditorCancelButton"),(function(){r((function(e){return wi(wi({},e),{},{saved:!0})})),chrome.runtime.sendMessage({type:"force-processing"})}),(function(){}),null,chrome.i18n.getMessage("overLimitModalLearnMore"),(function(){chrome.runtime.sendMessage({type:"upgrade-info"})}))}},chrome.i18n.getMessage("learnMoreLabel"))),(!n.mp4ready||n.isFfmpegRunning)&&(n.duration<=n.editLimit||n.override)&&!n.offline&&!n.updateChrome&&!n.noffmpeg&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("videoProcessingLabelTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("videoProcessingLabelDescription"))),e.createElement("div",{className:On.buttonRight,onClick:function(){chrome.runtime.sendMessage({type:"open-processing-info"})}},chrome.i18n.getMessage("learnMoreLabel"))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxEditTitle")),e.createElement("div",{className:On.buttonWrap},e.createElement("div",{role:"button",className:On.button,onClick:function(){n.duration>n.editLimit&&!n.override||n.mp4ready&&(r((function(e){return wi(wi({},e),{},{mode:"edit",dragInteracted:!1})})),n.hasBeenEdited||r((function(e){return wi(wi({},e),{},{hasBeenEdited:!0})})))},disabled:n.duration>n.editLimit&&!n.override||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/trim.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("editButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready?chrome.i18n.getMessage("editButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:function(){n.duration>n.editLimit&&!n.override||n.mp4ready&&(r((function(e){return wi(wi({},e),{},{mode:"crop"})})),n.hasBeenEdited||r((function(e){return wi(wi({},e),{},{hasBeenEdited:!0})})))},disabled:n.duration>n.editLimit&&!n.override||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/crop.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("cropButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready?chrome.i18n.getMessage("cropButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:s,disabled:n.duration>n.editLimit&&!n.override||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/audio.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("addAudioButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready?chrome.i18n.getMessage("addAudioButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxSaveTitle")),n.driveEnabled&&e.createElement("div",{className:On.buttonLogout,onClick:function(){chrome.runtime.sendMessage({type:"sign-out-drive"}),r((function(e){return wi(wi({},e),{},{driveEnabled:!1})}))}},chrome.i18n.getMessage("signOutDriveLabel")),e.createElement("div",{className:On.buttonWrap},e.createElement("div",{role:"button",className:On.button,onClick:function(){if(r((function(e){return wi(wi({},e),{},{saveDrive:!0})})),!n.noffmpeg&&n.mp4ready&&n.blob){var e=new FileReader;e.onload=function(){var t=e.result.split(",")[1];chrome.runtime.sendMessage({type:"save-to-drive",base64:t,title:n.title}).then((function(e){"ew"===e.status&&r((function(e){return wi(wi({},e),{},{saveDrive:!1})}))}))},!n.noffmpeg&&n.mp4ready&&n.blob?e.readAsDataURL(n.blob):e.readAsDataURL(n.webm)}else chrome.runtime.sendMessage({type:"save-to-drive-fallback",title:n.title}).then((function(e){"ew"===e.status&&r((function(e){return wi(wi({},e),{},{saveDrive:!1})}))}))},disabled:n.saveDrive},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/drive.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.saveDrive?chrome.i18n.getMessage("savingDriveLabel"):n.driveEnabled?chrome.i18n.getMessage("saveDriveButtonTitle"):chrome.i18n.getMessage("signInDriveLabel")),e.createElement("div",{className:On.buttonDescription},n.offline?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome?chrome.i18n.getMessage("notAvailableLabel"):chrome.i18n.getMessage("saveDriveButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxExportTitle")),e.createElement("div",{className:On.buttonWrap},n.fallback&&e.createElement("div",{role:"button",className:On.button,onClick:function(){return n.downloadWEBM()},disabled:n.isFfmpegRunning},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/download.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.downloadingWEBM?chrome.i18n.getMessage("downloadingLabel"):chrome.i18n.getMessage("downloadWEBMButtonTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("downloadWEBMButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:function(){n.mp4ready&&n.download()},disabled:n.isFfmpegRunning||n.noffmpeg||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/download.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.downloading?chrome.i18n.getMessage("downloadingLabel"):chrome.i18n.getMessage("downloadMP4ButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready&&!n.isFfmpegRunning?chrome.i18n.getMessage("downloadMP4ButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),!n.fallback&&e.createElement("div",{role:"button",className:On.button,onClick:function(){return n.downloadWEBM()},disabled:n.isFfmpegRunning},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/download.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.downloadingWEBM?chrome.i18n.getMessage("downloadingLabel"):chrome.i18n.getMessage("downloadWEBMButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.isFfmpegRunning?chrome.i18n.getMessage("preparingLabel"):chrome.i18n.getMessage("downloadWEBMButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:function(){n.mp4ready&&n.downloadGIF()},disabled:n.isFfmpegRunning||n.duration>30||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/gif.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.downloadingGIF?chrome.i18n.getMessage("downloadingLabel"):chrome.i18n.getMessage("downloadGIFButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready?chrome.i18n.getMessage("downloadGIFButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxAdvancedTitle")),e.createElement("div",{className:On.buttonWrap},e.createElement("div",{role:"button",className:On.button,onClick:function(){"function"==typeof o.current.openModal&&o.current.openModal(chrome.i18n.getMessage("rawRecordingModalTitle"),chrome.i18n.getMessage("rawRecordingModalDescription"),chrome.i18n.getMessage("rawRecordingModalButton"),chrome.i18n.getMessage("sandboxEditorCancelButton"),(function(){var e=o.current.rawBlob,t=window.URL.createObjectURL(e);chrome.downloads.download({url:t,filename:"raw-recording.webm"},(function(){window.URL.revokeObjectURL(t)}))}),(function(){}))}},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/download.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("rawRecordingButtonTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("rawRecordingButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:function(){"function"==typeof o.current.openModal&&o.current.openModal(chrome.i18n.getMessage("troubleshootModalTitle"),chrome.i18n.getMessage("troubleshootModalDescription"),chrome.i18n.getMessage("troubleshootModalButton"),chrome.i18n.getMessage("sandboxEditorCancelButton"),(function(){var e=navigator.userAgent,t={};chrome.runtime.getPlatformInfo((function(n){t=n;var r=chrome.runtime.getManifest().version,i=o.current.rawBlob,a={userAgent:e,platformInfo:t,manifestInfo:r,contentState:o.current},s=new(Mn());s.file("recording.webm",i),s.file("troubleshooting.json",JSON.stringify(a)),s.generateAsync({type:"blob"}).then((function(e){var t=window.URL.createObjectURL(e);chrome.downloads.download({url:t,filename:"troubleshooting.zip"},(function(){window.URL.revokeObjectURL(t)}))}))}))}),(function(){}))}},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/flag.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("troubleshootButtonTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("troubleshootButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"})))))))};var Ci=i(9146),Ti={};Ti.styleTagTransform=m(),Ti.setAttributes=d(),Ti.insert=c().bind(null,"head"),Ti.domAPI=s(),Ti.insertStyleElement=p();o()(Ci.Z,Ti);const Ai=Ci.Z&&Ci.Z.locals?Ci.Z.locals:void 0;var Oi=i(4917),Pi={};Pi.styleTagTransform=m(),Pi.setAttributes=d(),Pi.insert=c().bind(null,"head"),Pi.domAPI=s(),Pi.insertStyleElement=p();o()(Oi.Z,Pi);Oi.Z&&Oi.Z.locals&&Oi.Z.locals;var Mi=i(13),Ni={};Ni.styleTagTransform=m(),Ni.setAttributes=d(),Ni.insert=c().bind(null,"head"),Ni.domAPI=s(),Ni.insertStyleElement=p();o()(Mi.Z,Ni);const Li=Mi.Z&&Mi.Z.locals?Mi.Z.locals:void 0;var Ii=i(9147),Di={};Di.styleTagTransform=m(),Di.setAttributes=d(),Di.insert=c().bind(null,"head"),Di.domAPI=s(),Di.insertStyleElement=p();o()(Ii.Z,Di);const Ri=Ii.Z&&Ii.Z.locals?Ii.Z.locals:void 0;function Bi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ji(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ji(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ji(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const zi=function(t){t.showShare;var n=t.setShowShare,r=Bi((0,e.useContext)(F),2);r[0],r[1];return e.createElement("div",{className:Ri.modalWrap},e.createElement("div",{className:Ri.modal},e.createElement("div",{className:Ri.close,onClick:function(){n(!1)}},e.createElement(Mt,{src:"/assets/editor/icons/close-button.svg",width:"16px",height:"16px"})),e.createElement("div",{className:Ri.emoji},"👋"),e.createElement("div",{className:Ri.title},chrome.i18n.getMessage("shareModalSandboxTitle")),e.createElement("div",{className:Ri.subtitle},chrome.i18n.getMessage("shareModalSandboxDescription")),e.createElement("div",{className:Ri.button,onClick:function(){chrome.runtime.sendMessage({type:"join-waitlist"}),n(!1)}},chrome.i18n.getMessage("shareModalSandboxButton"))),e.createElement("div",{className:Ri.modalBackground,onClick:function(){n(!1)}}))};function Ui(e){return Ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ui(e)}function Fi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Wi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fi(Object(n),!0).forEach((function(t){Hi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ui(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ui(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ui(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qi(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Gi="/assets/";const $i=function(){var t=Vi((0,e.useState)(!1),2),n=t[0],r=t[1],i=Vi((0,e.useContext)(F),2),o=i[0],a=i[1],s=(0,e.useRef)(null),l=Vi((0,e.useState)(!0),2),c=l[0],u=l[1],d=Vi((0,e.useState)(o.title),2),f=d[0],p=d[1],h=Vi((0,e.useState)(o.title),2),m=h[0],g=h[1];(0,e.useEffect)((function(){p(o.title),o.title.length>80?g(o.title.slice(0,80)+"..."):g(o.title)}),[o.title]);return(0,e.useEffect)((function(){c||(s.current.focus(),s.current.select())}),[c]),(0,e.useEffect)((function(){var e=function(e){"Enter"===e.key?(u(!0),a((function(e){return Wi(Wi({},e),{},{title:f})}))):"Escape"===e.key&&(u(!0),p(o.title))};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[f]),e.createElement("div",{className:Li.TitleParent},n&&e.createElement(zi,{showShare:n,setShowShare:r}),e.createElement("div",{className:Li.TitleWrap},c?e.createElement(e.Fragment,null,e.createElement("h1",{onClick:function(){u(!1)}},m," ",e.createElement(Mt,{src:Gi+"editor/icons/pencil.svg",className:Li.pencil,styles:{display:"inline-block"}})),e.createElement("div",{className:Li.shareButton,onClick:function(){r(!0)}},e.createElement(Mt,{src:Gi+"editor/icons/link.svg",className:Li.shareIcon}),chrome.i18n.getMessage("shareSandboxButton"))):e.createElement("input",{type:"text",value:f,onChange:function(e){p(e.target.value)},onBlur:function(){u(!0),a((function(e){return Wi(Wi({},e),{},{title:f})}))},ref:s})))};function Zi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||Yi(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yi(e,t){if(e){if("string"==typeof e)return Xi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xi(e,t):void 0}}function Xi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Ki=function(t){var n=Zi((0,e.useContext)(F),2),r=n[0],i=(n[1],(0,e.useRef)(null)),o=Zi((0,e.useState)(null),2),a=o[0],s=o[1],l=Zi((0,e.useState)(null),2),c=l[0],u=l[1],d=(0,e.useRef)(r),f=(0,e.useRef)(null);(0,e.useEffect)((function(){d.current=r}),[r]),(0,e.useEffect)((function(){i.current&&i.current.plyr&&r.updatePlayerTime&&(i.current.plyr.currentTime=r.time)}),[r.time]);var p=(0,e.useMemo)((function(){return{controls:["play","rewind","fast-forward","progress","current-time","duration","mute","captions","settings","pip","fullscreen"],urls:null,ratio:"16:9",blankVideo:"chrome-extension://"+chrome.i18n.getMessage("@@extension_id")+"/assets/blank.mp4",keyboard:{global:!0}}}),[]);return(0,e.useEffect)((function(){if(r.webm||r.blob){var e;r.blob?(f.current&&(f.current.style.display="none",f.current.remove()),e=r.blob):r.webm&&(e=r.webm);var t=URL.createObjectURL(e);return u({type:"video",sources:[{src:t,type:r.blob?"video/mp4":"video/webm"}]}),s(t),function(){URL.revokeObjectURL(t)}}}),[r.webm,r.blob,r.hasBeenEdited,i]),(0,e.useEffect)((function(){if(!d.current.mp4ready&&!d.current.blob){var e=new MutationObserver((function(e,t){var n,r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Yi(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(e);try{for(r.s();!(n=r.n()).done;){n.value;!document.querySelector(".plyr--video")||d.current.mp4ready||d.current.blob||f.current||d.current.noffmpeg||d.current.duration>d.current.editLimit&&!d.current.override||(f.current=document.createElement("div"),f.current.classList.add("videoBanner"),f.current.innerHTML="<img src='"+chrome.runtime.getURL("assets/editor/icons/alert-white.svg")+"'/> <span>"+chrome.i18n.getMessage("processingBannerEditor")+"</span>",document.querySelector(".plyr--video").appendChild(f.current))}}catch(e){r.e(e)}finally{r.f()}}));return e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),function(){e.disconnect(),f.current&&(f.current.style.display="none",f.current.remove(),f.current=null)}}}),[]),e.createElement("div",{className:"videoPlayer"},e.createElement("div",{className:"playerWrap"},a&&e.createElement(le,{ref:i,id:"plyr-player",source:c,options:p}),"player"===r.mode&&e.createElement($i,null)),e.createElement("style",null,"\n\t\t\t\t\t@media (max-width: 900px) {\n\t\t\t\t\t\t.videoPlayer {\n\t\t\t\t\t\t\tposition: relative!important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t"))};function Qi(e){return e.moveCoordinates||e.resizeCoordinates||e.transformImage.move||e.transformImage.rotate||e.transformImage.flip||e.transformImage.scale}function Ji(e,t){var n,r;return e&&t?(n=""+e+t[0].toUpperCase()+t.slice(1),r=e+"-"+t):(n=e||t,r=e||t),{camelCase:n,snakeCase:r}}function eo(e){return/^blob:/.test(e)}function to(e){return eo(e)||function(e){return/^data:/.test(e)}(e)}function no(e){if(to(e))return!1;var t=window.location,n=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(e)||[],r={protocol:n[1]||"",host:n[2]||"",port:n[3]||""},i=function(e){return e.port||("http"===(e.protocol||t.protocol)?80:433)};return!(!r.protocol&&!r.host&&!r.port||Boolean(r.protocol&&r.protocol==t.protocol&&r.host&&r.host==t.host&&r.host&&i(r)==i(t)))}function ro(e){return"function"==typeof e}function io(e){return void 0===e}var oo=function(e){return null!==e&&"object"==typeof e};function ao(e,t,n){void 0===n&&(n={});var r={};return oo(e)?(Object.keys(t).forEach((function(i){io(e[i])?r[i]=t[i]:oo(t[i])?oo(e[i])?r[i]=ao(e[i],t[i],n[i]):r[i]=e[i]?t[i]:n[i]:!0===t[i]||!1===t[i]?r[i]=Boolean(e[i]):r[i]=e[i]})),r):e?t:n}function so(e){var t=Number(e);return Number.isNaN(t)?e:t}function lo(e){return!0===e||!1===e}function co(e){return"number"==typeof e}function uo(e){return e!=e}function fo(e){return co(e)&&!uo(e)||function(e){return"string"==typeof e}(e)&&!Number.isNaN(parseFloat(e))&&isFinite(parseFloat(e))}function po(e,t){return Math.sqrt(Math.pow(e.left-t.left,2)+Math.pow(e.top-t.top,2))}function ho(e,t,n){return void 0===n&&(n=.001),Math.abs(t-e)<n}function mo(e,t,n){return!ho(e,t,n)&&e>t}function go(e,t,n){return!ho(e,t,n)&&e<t}function vo(e){return new Promise((function(t){setTimeout((function(){t()}),e)}))}function yo(e){if(!oo(e))return e;var t={};return Array.isArray(e)?t=e.map((function(e){return yo(e)})):Object.keys(e).forEach((function(n){return t[n]=yo(e[n])})),t}function bo(e,t,n){if(void 0===n&&(n=.001),co(e)&&co(t)&&ho(e,t,n))return!0;if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,i=void 0;if(Array.isArray(e)){if((r=e.length)!=t.length)return!1;for(i=r;0!=i--;)if(!bo(e[i],t[i],n))return!1;return!0}if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var o=Object.keys(e);if((r=o.length)!==Object.keys(t).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,o[i]))return!1;for(i=r;0!=i--;){var a=o[i];if(!bo(e[a],t[a],n))return!1}return!0}return e!=e&&t!=t}function wo(e){return"west"===e||"south"===e||"north"===e||"east"===e}function xo(e,t){var n,r;function i(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=Date.now()-n,l=ro(t)?t():t||0;s<l&&s>=0?r=setTimeout((function(){return i.apply(void 0,o)}),l-s):e.apply(void 0,o)}function o(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];n=Date.now(),r=setTimeout((function(){return i.apply(void 0,e)}),ro(t)?t():t||0)}return o.clear=function(){clearTimeout(r)},o}var _o,ko,Eo,So=["left","right","top","bottom"],Co=["left","right"],To=["top","bottom"];function Ao(e,t){return{left:e.left-t.left,top:e.top-t.top}}function Oo(e){return{left:e.left+e.width/2,top:e.top+e.height/2}}function Po(e,t){return Math.pow(e.width-t.width,2)+Math.pow(e.height-t.height,2)}function Mo(e,t){return{left:e.left-t.left,top:e.top-t.top,width:e.width+t.left+t.right,height:e.height+t.top+t.bottom}}function No(e){return{left:-e.left,top:-e.top}}function Lo(e,t){return st(st({},e),{left:e.left+t.left,top:e.top+t.top})}function Io(e){return{left:e.left,top:e.top,right:e.left+e.width,bottom:e.top+e.height}}function Do(e,t,n,r){if(1!==t){if("left"in e||"top"in e){if(n){var i=Oo(e);return{width:e.width*t,height:e.height*t,left:e.left+e.width*(1-t)/2+(n.left-i.left)*(r||1-t),top:e.top+e.height*(1-t)/2+(n.top-i.top)*(r||1-t)}}return{width:e.width*t,height:e.height*t,left:e.left+e.width*(1-t)/2,top:e.top+e.height*(1-t)/2}}return{width:e.width*t,height:e.height*t}}return e}function Ro(e){return e.width/e.height}function Bo(e,t){return Math.min(t.maxWidth?t.maxWidth/e.width:1/0,t.maxHeight?t.maxHeight/e.height:1/0)}function jo(e,t){var n;return t.minimum&&go(e,t.minimum)?n=t.minimum:t.maximum&&mo(e,t.maximum)&&(n=t.maximum),n}function zo(e,t){var n=Ro(e),r=1;return t.minWidth>0&&t.minHeight>0?n>t.minWidth/t.minHeight?e.height<t.minHeight&&(r=t.minHeight/e.height):e.width<t.minWidth&&(r=t.minWidth/e.width):t.minWidth>0?e.width<t.minWidth&&(r=t.minWidth/e.width):t.minHeight>0&&e.height<t.minHeight&&(r=t.minHeight/e.height),t.maxWidth<1/0&&t.maxHeight<1/0?n>t.maxWidth/t.maxHeight?e.width>t.maxWidth&&(r=t.maxWidth/e.width):e.height>t.maxHeight&&(r=t.maxHeight/e.height):t.maxWidth<1/0?e.width>t.maxWidth&&(r=t.maxWidth/e.width):t.maxHeight<1/0&&e.height>t.maxHeight&&(r=t.maxHeight/e.height),r}function Uo(e,t){var n={left:0,top:0,right:0,bottom:0};return So.forEach((function(r){var i=t[r],o=Io(e)[r];n[r]=void 0!==i&&void 0!==o?"left"===r||"top"===r?Math.max(0,i-o):Math.max(0,o-i):0})),n}function Fo(e,t){return Do(e,zo(e,t))}function Wo(e,t){var n=t*Math.PI/180;return{width:Math.abs(e.width*Math.cos(n))+Math.abs(e.height*Math.sin(n)),height:Math.abs(e.width*Math.sin(n))+Math.abs(e.height*Math.cos(n))}}function Ho(e,t,n){var r=t*Math.PI/180;return n?{left:(e.left-n.left)*Math.cos(r)-(e.top-n.top)*Math.sin(r)+n.left,top:(e.left-n.left)*Math.sin(r)+(e.top-n.top)*Math.cos(r)+n.top}:{left:e.left*Math.cos(r)-e.top*Math.sin(r),top:e.left*Math.sin(r)+e.top*Math.cos(r)}}function Vo(e){return{minWidth:0,minHeight:0,maxWidth:void 0!==e.right&&void 0!==e.left?e.right-e.left:1/0,maxHeight:void 0!==e.bottom&&void 0!==e.top?e.bottom-e.top:1/0}}function qo(e,t){var n={};return So.forEach((function(r){var i=e[r],o=t[r];void 0!==i&&void 0!==o?n[r]="left"===r||"top"===r?Math.max(i,o):Math.min(i,o):void 0!==o?n[r]=o:void 0!==i&&(n[r]=i)})),n}function Go(e,t){var n={left:0,top:0},r=Uo(e,t);return r.left&&r.left>0?n.left=r.left:r.right&&r.right>0&&(n.left=-r.right),r.top&&r.top>0?n.top=r.top:r.bottom&&r.bottom>0&&(n.top=-r.bottom),n}function $o(e,t){return Lo(e,Go(e,t))}function Zo(e){return void 0===e&&(e={}),co(e)?{minimum:e,maximum:e}:{minimum:fo(e.minimum)?e.minimum:0,maximum:fo(e.maximum)?e.maximum:1/0}}function Yo(e,t){return(io(t.maxWidth)||!mo(e.width,t.maxWidth))&&(io(t.maxHeight)||!mo(e.height,t.maxHeight))&&(io(t.minHeight)||!go(e.height,t.minHeight))&&(io(t.minWidth)||!go(e.width,t.minWidth))}function Xo(e,t){return(io(t.left)||!go(e.left,t.left))&&(io(t.top)||!go(e.top,t.top))&&(io(t.right)||!mo(e.left+e.width,t.right))&&(io(t.bottom)||!mo(e.top+e.height,t.bottom))}function Ko(e){var t=st({},e);return t.minWidth>t.maxWidth&&(t.minWidth=t.maxWidth),t.minHeight>t.maxHeight&&(t.minHeight=t.maxHeight),t}function Qo(e,t){var n=e,r=st({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},t);return Ko({maxHeight:Math.min(n.maxHeight,r.maxHeight),minHeight:Math.max(n.minHeight,r.minHeight),maxWidth:Math.min(n.maxWidth,r.maxWidth),minWidth:Math.max(n.minWidth,r.minWidth)})}function Jo(e){return Boolean(e&&e.visibleArea&&e.coordinates)}function ea(e,t){return function(e,t){var n=ro(t.areaSizeRestrictions)?t.areaSizeRestrictions(e,t):t.areaSizeRestrictions;return n.maxWidth<1/0&&n.maxHeight<1/0&&(Ro(e.boundary)>n.maxWidth/n.maxHeight?n.maxHeight=n.maxWidth/Ro(e.boundary):n.maxWidth=n.maxHeight*Ro(e.boundary)),Ko(n)}(e,t)}function ta(e,t){return ro(t.areaPositionRestrictions)?t.areaPositionRestrictions(e,t):t.areaPositionRestrictions}function na(e,t){return function(e,t){var n=ro(t.sizeRestrictions)?t.sizeRestrictions(e,t):t.sizeRestrictions,r=ra(e,t),i={minWidth:fo(n.minWidth)?so(n.minWidth):0,minHeight:fo(n.minHeight)?so(n.minHeight):0,maxWidth:fo(n.maxWidth)?so(n.maxWidth):1/0,maxHeight:fo(n.maxHeight)?so(n.maxHeight):1/0};return void 0!==r.left&&void 0!==r.right&&(i.maxWidth=Math.min(i.maxWidth,r.right-r.left)),void 0!==r.bottom&&void 0!==r.top&&(i.maxHeight=Math.min(i.maxHeight,r.bottom-r.top)),Ko(i)}(e,t)}function ra(e,t){return ro(t.positionRestrictions)?t.positionRestrictions(e,t):t.positionRestrictions}function ia(e){return e.visibleArea?e.visibleArea.width/e.boundary.width:0}function oa(e){if(Jo(e)){var t=e.coordinates,n=t.width,r=t.height,i=t.left,o=t.top,a=ia(e);return{width:n/a,height:r/a,left:(i-e.visibleArea.left)/a,top:(o-e.visibleArea.top)/a}}return{left:0,top:0,width:0,height:0}}function aa(e,t){return Zo(ro(t.aspectRatio)?t.aspectRatio(e,t):t.aspectRatio)}function sa(e,t){return ro(t.defaultCoordinates)?t.defaultCoordinates(e,t):t.defaultCoordinates}function la(e,t){return ro(t.defaultVisibleArea)?t.defaultVisibleArea(e,t):t.defaultVisibleArea}function ca(e){return e.imageSize&&e.imageSize.width&&e.imageSize.height?Wo(e.imageSize,e.transforms.rotate):{width:0,height:0}}function ua(e,t){return!Jo(e)||!jo(Ro(e.coordinates),aa(e,t))&&Yo(e.visibleArea,ea(e,t))&&Yo(e.coordinates,na(e,t))&&Xo(e.visibleArea,ta(e,t))&&Xo(e.coordinates,ra(e,t))}function da(e){return yo(e)}function fa(e){var t=e.width,n=e.height,r=e.sizeRestrictions||{minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},i=Zo(e.aspectRatio),o={width:Math.max(r.minWidth,Math.min(r.maxWidth,t)),height:Math.max(r.minHeight,Math.min(r.maxHeight,n))},a=[o];return i&&[i.minimum,i.maximum].forEach((function(e){e&&a.push({width:o.width,height:o.width/e},{width:o.height*e,height:o.height})})),function(e,t,n,r){var i=function(i){return e.reduce((function(e,o){var a=ro(n)?n(o):n,s=a.maxHeight,l=a.maxWidth,c=a.minWidth,u=a.minHeight,d=Zo(ro(r)?r(o):r);return Yo(o,i?{maxWidth:l,maxHeight:s}:{maxWidth:l,maxHeight:s,minWidth:c,minHeight:u})&&!jo(Ro(o),d)&&o.width&&o.height&&(!e||go(Po(o,t),Po(e,t)))?o:e}),null)};return i()||i(!0)}(a=a.map((function(e){return Fo(e,r)})),{width:t,height:n},r,i)}function pa(e,t){var n=da(e);if(e.visibleArea){var r=ea(e,t);n.visibleArea=st(st({},e.visibleArea),fa({width:e.visibleArea.width,height:e.visibleArea.height,aspectRatio:{minimum:Ro(n.boundary),maximum:Ro(n.boundary)},sizeRestrictions:r})),n.visibleArea=Lo(n.visibleArea,Ao(Oo(e.visibleArea),Oo(n.visibleArea))),n.visibleArea=$o(n.visibleArea,ta(n,t))}return n}function ha(e,t,n){var r=Lo(e,t);return n?$o(r,n):r}function ma(e,t,n,r){void 0===r&&(r=!0);var i=!1===r?_o.unsafe:!0===r?_o.zoom:r,o=aa(e,t),a=na(e,t);e.visibleArea&&i===_o.limit&&(a=st(st({},a),{minWidth:Math.min(e.visibleArea.width,a.minWidth),minHeight:Math.min(e.visibleArea.height,a.minHeight),maxWidth:Math.min(e.visibleArea.width,a.maxWidth),maxHeight:Math.min(e.visibleArea.height,a.maxHeight)}));var s=ra(e,t);e.visibleArea&&i===_o.limit&&(s=qo(s,Io(e.visibleArea)));var l=function(e,t){return ha(e,{left:t.left-(e.left||0),top:t.top-(e.top||0)},s)},c=e.coordinates?st({},e.coordinates):{left:0,top:0,width:0,height:0};(Array.isArray(n)?n:[n]).forEach((function(n){var r;(r="function"==typeof n?n(st(st({},e),{coordinates:c}),t):n)&&(io(r.width)&&io(r.height)||(c=function(e,t){var n=st(st(st({},e),fa({width:t.width,height:t.height,sizeRestrictions:a,aspectRatio:o})),{left:0,top:0});return l(n,{left:e.left||0,top:e.top||0})}(c,st(st({},c),r))),io(r.left)&&io(r.top)||(c=l(c,st(st({},c),r))))}));var u=st(st({},da(e)),{coordinates:c});if(u.visibleArea&&i===_o.zoom){var d=Math.max(0,u.coordinates.width-u.visibleArea.width),f=Math.max(0,u.coordinates.height-u.visibleArea.height),p=ea(e,t),h=d>f?u.coordinates.width/u.visibleArea.width:u.coordinates.height/u.visibleArea.height;return h>1&&(u.visibleArea=Do(u.visibleArea,Math.min(h,Bo(u.visibleArea,p)))),u.visibleArea=Lo(u.visibleArea,No(Go(u.coordinates,Io(u.visibleArea)))),pa(u,t)}return u}function ga(e,t){if(e.coordinates){var n=da(e),r=aa(e,t),i=na(e,t);return n.coordinates=st(st({},e.coordinates),fa({width:e.coordinates.width,height:e.coordinates.height,aspectRatio:r,sizeRestrictions:e.visibleArea?{maxWidth:Math.min(e.visibleArea.width,i.maxWidth),maxHeight:Math.min(e.visibleArea.height,i.maxHeight),minHeight:Math.min(e.visibleArea.height,i.minHeight),minWidth:Math.min(e.visibleArea.width,i.minWidth)}:i})),n.coordinates=Lo(n.coordinates,Ao(Oo(e.coordinates),Oo(n.coordinates))),n.coordinates=$o(n.coordinates,e.visibleArea?qo(Io(e.visibleArea),ra(n,t)):ra(n,t)),n}return e}function va(e,t,n,r){void 0===r&&(r=!0);var i=st(st({},da(e)),{visibleArea:n});return i=pa(i,t),r&&(i=ga(i,t)),i}function ya(e,t){var n,r,i,o,a,s=e.boundary,l=e.image,c={boundary:{width:s.width,height:s.height},imageSize:{width:l.width,height:l.height},transforms:{rotate:(null===(n=l.transforms)||void 0===n?void 0:n.rotate)||0,flip:{horizontal:(null===(i=null===(r=l.transforms)||void 0===r?void 0:r.flip)||void 0===i?void 0:i.horizontal)||!1,vertical:(null===(a=null===(o=l.transforms)||void 0===o?void 0:o.flip)||void 0===a?void 0:a.vertical)||!1}},visibleArea:null,coordinates:null};return t.defaultTransforms&&(c.transforms=function(e,t){var n=st(st({},e.transforms),{flip:st({},e.transforms.flip)});if(t.defaultTransforms){var r=ro(t.defaultTransforms)?t.defaultTransforms(e,t):t.defaultTransforms;co(r.rotate)&&(n.rotate=r.rotate),r.flip&&(lo(r.flip.horizontal)&&(n.flip.horizontal=r.flip.horizontal),lo(r.flip.vertical)&&(n.flip.vertical=r.flip.vertical))}return n}(c,t)),c=t.priority===Eo.visibleArea?ma(c=va(c,t,la(c,t),!1),t,sa(c,t),_o.limit):va(c=ma(c,t,sa(c,t),_o.unsafe),t,la(c,t),!0)}function ba(e,t,n){if(Jo(e)){var r=da(e);return r.coordinates=Lo(r.coordinates,n),r.coordinates=$o(r.coordinates,qo(Io(r.visibleArea),ra(r,t))),r}return e}function wa(e){var t=e.coordinates,n=e.directions,r=e.positionRestrictions,i=e.sizeRestrictions,o=e.preserveRatio,a=e.allowedDirections,s=e.compensate,l=void 0===s||s,c=st({},n),u=Mo(t,c).width,d=Mo(t,c).height;u<0&&(c.left<0&&c.right<0?(c.left=-(t.width-i.minWidth)/(c.left/c.right),c.right=-(t.width-i.minWidth)/(c.right/c.left)):c.left<0?c.left=-(t.width-i.minWidth):c.right<0&&(c.right=-(t.width-i.minWidth))),d<0&&(c.top<0&&c.bottom<0?(c.top=-(t.height-i.minHeight)/(c.top/c.bottom),c.bottom=-(t.height-i.minHeight)/(c.bottom/c.top)):c.top<0?c.top=-(t.height-i.minHeight):c.bottom<0&&(c.bottom=-(t.height-i.minHeight)));var f=Uo(Mo(t,c),r),p=So.every((function(e){return!mo(f[(t=e,{left:"right",top:"bottom",right:"left",bottom:"top"}[t])],0)||a[e];var t}));l&&p&&(f.left&&f.left>0&&0===f.right?(c.right+=f.left,c.left-=f.left):f.right&&f.right>0&&0===f.left&&(c.left+=f.right,c.right-=f.right),f.top&&f.top>0&&0===f.bottom?(c.bottom+=f.top,c.top-=f.top):f.bottom&&f.bottom>0&&0===f.top&&(c.top+=f.bottom,c.bottom-=f.bottom),f=Uo(Mo(t,c),r));var h={width:1/0,height:1/0,left:1/0,right:1/0,top:1/0,bottom:1/0};if(So.forEach((function(e){var t=f[e];t&&c[e]&&(h[e]=Math.max(0,1-t/c[e]))})),o){var m=Math.min.apply(Math,So.map((function(e){return h[e]})));m!==1/0&&So.forEach((function(e){c[e]*=m}))}else So.forEach((function(e){h[e]!==1/0&&(c[e]*=h[e])}));if(u=Mo(t,c).width,d=Mo(t,c).height,c.right+c.left&&(u>i.maxWidth?h.width=(i.maxWidth-t.width)/(c.right+c.left):u<i.minWidth&&(h.width=(i.minWidth-t.width)/(c.right+c.left))),c.bottom+c.top&&(d>i.maxHeight?h.height=(i.maxHeight-t.height)/(c.bottom+c.top):d<i.minHeight&&(h.height=(i.minHeight-t.height)/(c.bottom+c.top))),o){var g=Math.min(h.width,h.height);g!==1/0&&So.forEach((function(e){c[e]*=g}))}else h.width!==1/0&&Co.forEach((function(e){c[e]*=h.width})),h.height!==1/0&&To.forEach((function(e){c[e]*=h.height}));return c}function xa(e,t,n){return ho(t+n,0)?e/2:ho(t,0)?0:ho(n,0)?e:e*Math.abs(t/(t+n))}function _a(e,t){var n=t.toLowerCase();return{left:e.left+e.width*(-1!==n.indexOf("west")?1:-1!==n.indexOf("east")?0:.5),top:e.top+e.height*(-1!==n.indexOf("north")?1:-1!==n.indexOf("south")?0:.5)}}function ka(e){var t=e.toLowerCase();return{left:-1===t.indexOf("east"),top:-1===t.indexOf("south"),right:-1===t.indexOf("west"),bottom:-1===t.indexOf("north")}}function Ea(e,t,n,r,i){var o=r.reference,a=function(e,t){var n=e.toLowerCase(),r={left:-1===n.indexOf("west")?t.left:-t.left,top:-t.top,right:t.left,bottom:t.top};["north","south","center"].every((function(e){return-1===n.indexOf(e)}))&&(r.top=0,r.bottom=0),["west","east","center"].every((function(e){return-1===n.indexOf(e)}))&&(r.left=0,r.right=0);var i=ka(e);return So.forEach((function(e){i[e]||(r[e]=0)})),r}(t,n),s=ka(t),l=function(e,t,n,r){var i=r.aspectRatio,o=r.positionRestrictions,a=r.sizeRestrictions,s=st({},e);t=st({},t);var l=n.allowedDirections||{left:!0,right:!0,bottom:!0,top:!0};e.width<a.minWidth&&(t.left=0,t.right=0),e.height<a.minHeight&&(t.top=0,t.bottom=0),So.forEach((function(e){l[e]||(t[e]=0)}));var c=Mo(s,t=wa({coordinates:s,directions:t,sizeRestrictions:a,positionRestrictions:o,allowedDirections:l})).width,u=Mo(s,t).height,d=n.preserveAspectRatio?Ro(s):jo(c/u,i);if(d){var f=n.respectDirection;if("width"!==f&&"height"!==f&&(f=s.width>=s.height||1===d?"width":"height"),"width"===f){var p=c/d-s.height;if(l.top&&l.bottom){var h=t.top,m=t.bottom;t.bottom=xa(p,m,h),t.top=xa(p,h,m)}else l.bottom?t.bottom=p:l.top?t.top=p:l.right?t.right=0:l.left&&(t.left=0)}else if("height"===f){var g=s.width-u*d;if(l.left&&l.right){var v=t.left,y=t.right;t.left=-xa(g,v,y),t.right=-xa(g,y,v)}else l.left?t.left=-g:l.right?t.right=-g:l.top?t.top=0:l.bottom&&(t.bottom=0)}t=wa({directions:t,coordinates:s,sizeRestrictions:a,positionRestrictions:o,preserveRatio:!0,compensate:n.compensate,allowedDirections:l})}return c=Mo(s,t).width,u=Mo(s,t).height,(d=n.preserveAspectRatio?Ro(s):jo(c/u,i))&&mo(Math.abs(d-c/u),0)&&So.forEach((function(e){t[e]=0})),ha({width:e.width+t.right+t.left,height:e.height+t.top+t.bottom,left:e.left,top:e.top},{left:-t.left,top:-t.top},o)}(e,a,st(st({},r),{allowedDirections:s}),i);return o&&(l=Lo(l,Ao(_a(o,t),_a(l,t)))),$o(l,i.positionRestrictions)}function Sa(e,t,n,r,i){var o=function(e){return e.coordinates?Math.min(e.coordinates.width,e.coordinates.height,20*ia(e)):1}(e),a=na(e,t);return Jo(e)?st(st({},da(e)),{coordinates:Ea(e.coordinates,n,r,i,{positionRestrictions:qo(ra(e,t),Io(e.visibleArea)),sizeRestrictions:{maxWidth:Math.min(a.maxWidth,e.visibleArea.width),maxHeight:Math.min(a.maxHeight,e.visibleArea.height),minWidth:Math.max(Math.min(a.minWidth,e.visibleArea.width),o),minHeight:Math.max(Math.min(a.minHeight,e.visibleArea.height),o)},aspectRatio:aa(e,t)})}):e}function Ca(e,t,n){var r=st(st({},da(e)),{boundary:n});if(r.visibleArea&&r.coordinates&&e.visibleArea){r.visibleArea.height=r.visibleArea.width/Ro(n),r.visibleArea.top+=(e.visibleArea.height-r.visibleArea.height)/2;var i=na(r,t);(Math.max(i.minHeight,r.coordinates.height)-r.visibleArea.height>0||Math.max(i.minWidth,r.coordinates.width)-r.visibleArea.width>0)&&(r.visibleArea=Do(r.visibleArea,Math.max(Math.max(i.minHeight,r.coordinates.height)/r.visibleArea.height,Math.max(i.minWidth,r.coordinates.width)/r.visibleArea.width))),r.visibleArea=Fo(r.visibleArea,ea(r,t));var o=No(Go(r.coordinates,Io(r.visibleArea)));r.visibleArea.width<r.coordinates.width&&(o.left=0),r.visibleArea.height<r.coordinates.height&&(o.top=0),r.visibleArea=Lo(r.visibleArea,o),r.visibleArea=$o(r.visibleArea,ta(r,t)),r=ga(r,t)}return r}function Ta(e,t,n){return n.rotate&&(e=function(e,t,n){if(Jo(e)){var r=da(e),i=co(n)?n:n.angle,o=Ho(Oo(st({left:0,top:0},ca(e))),i);r.transforms.rotate+=i,r.coordinates=st(st({},fa({sizeRestrictions:na(r,t),aspectRatio:aa(r,t),width:r.coordinates.width,height:r.coordinates.height})),Ho(Oo(r.coordinates),i));var a=!co(n)&&n.center?n.center:Oo(e.coordinates),s=Ao(Oo(e.coordinates),Ho(Oo(e.coordinates),i,a)),l=ca(r);return r.coordinates.left-=o.left-l.width/2+r.coordinates.width/2-s.left,r.coordinates.top-=o.top-l.height/2+r.coordinates.height/2-s.top,r.visibleArea=Fo(r.visibleArea,Qo(ea(r,t),{minWidth:r.coordinates.width,minHeight:r.coordinates.height})),r.coordinates=$o(r.coordinates,ra(r,t)),r.visibleArea=Lo(r.visibleArea,Ao(Oo(r.coordinates),Oo(e.coordinates))),r.visibleArea=$o(r.visibleArea,ta(r,t)),r}return e}(e,t,n.rotate)),n.flip&&(e=function(e,t,n,r){if(Jo(e)){var i=da(e),o=e.transforms.rotate,a=ca(e),s={horizontal:n,vertical:r};if(s.horizontal||s.vertical){var l=Ho({left:a.width/2,top:a.height/2},-o),c=Ho(Oo(i.coordinates),-o),u=Ho({left:s.horizontal?l.left-(c.left-l.left):c.left,top:s.vertical?l.top-(c.top-l.top):c.top},o);i.coordinates=Lo(i.coordinates,Ao(u,Oo(i.coordinates))),c=Ho(Oo(i.visibleArea),-o),u=Ho({left:s.horizontal?l.left-(c.left-l.left):c.left,top:s.vertical?l.top-(c.top-l.top):c.top},o),i.visibleArea=Lo(i.visibleArea,Ao(u,Oo(i.visibleArea))),i.visibleArea=$o(i.visibleArea,ta(i,t))}return s.horizontal&&(i.transforms.flip.horizontal=!e.transforms.flip.horizontal),s.vertical&&(i.transforms.flip.vertical=!e.transforms.flip.vertical),i}return e}(e,t,n.flip.horizontal,n.flip.vertical)),(n.move||n.scale)&&(e=function(e,t,n){var r,i,o,a=n.scale,s=void 0===a?1:a,l=n.move,c=void 0===l?{}:l;if(Jo(e)){var u=da(e),d=1/(co(s)?s:s.factor),f=co(s)?void 0:s.center,p=!ho(d,1),h=1,m=1;u.visibleArea=Lo(u.visibleArea,{left:c.left||0,top:c.top||0});var g=na(u,t),v=ra(u,t),y=ea(u,t),b={stencil:{minimum:Math.max(g.minWidth?g.minWidth/u.coordinates.width:0,g.minHeight?g.minHeight/u.coordinates.height:0),maximum:Math.min(g.maxWidth?g.maxWidth/u.coordinates.width:1/0,g.maxHeight?g.maxHeight/u.coordinates.height:1/0,Bo(u.coordinates,Vo(v)))},area:{maximum:Bo(u.visibleArea,y),minimum:(i=u.visibleArea,o=y,Math.max(o.minWidth?o.minWidth/i.width:0,o.minHeight?o.minHeight/i.height:0))}};d&&p&&(d<1?(m=Math.max(d,Math.max(b.area.minimum,b.stencil.minimum)))>1&&(m=1):d>1&&(m=Math.min(d,Math.min(b.area.maximum,b.stencil.maximum)))<1&&(m=1)),m&&(u.visibleArea=Do(u.visibleArea,m,f));var w={left:e.coordinates.left-e.visibleArea.left,right:e.visibleArea.width+e.visibleArea.left-(e.coordinates.width+e.coordinates.left),top:e.coordinates.top-e.visibleArea.top,bottom:e.visibleArea.height+e.visibleArea.top-(e.coordinates.height+e.coordinates.top)};return u.visibleArea=$o(u.visibleArea,{left:void 0!==v.left?v.left-w.left*m:void 0,top:void 0!==v.top?v.top-w.top*m:void 0,bottom:void 0!==v.bottom?v.bottom+w.bottom*m:void 0,right:void 0!==v.right?v.right+w.right*m:void 0}),u.visibleArea=$o(u.visibleArea,ta(u,t)),u.coordinates.width=u.coordinates.width*m,u.coordinates.height=u.coordinates.height*m,u.coordinates.left=u.visibleArea.left+w.left*m,u.coordinates.top=u.visibleArea.top+w.top*m,u.coordinates=$o(u.coordinates,qo(Io(u.visibleArea),v)),p&&d&&(null===(r=t.transformImage)||void 0===r?void 0:r.adjustStencil)&&(d>1?h=Math.min(b.area.maximum,d)/m:d<1&&(h=Math.max(u.coordinates.height/u.visibleArea.height,u.coordinates.width/u.visibleArea.width,d/m)),1!==h&&(u.visibleArea=Do(u.visibleArea,h,d>1?f:Oo(u.coordinates)),u.visibleArea=$o(u.visibleArea,ta(u,t)),u.visibleArea=Lo(u.visibleArea,No(Go(u.coordinates,Io(u.visibleArea)))))),u}return e}(e,t,n)),e}function Aa(e,t){if(Jo(e)){var n=da(e),r=aa(e,t),i=na(e,t),o=ea(e,t),a=jo(Ro(e.coordinates),r),s=a?{height:e.coordinates.height,width:e.coordinates.height*a}:e.coordinates;n.coordinates=st(st({},n.coordinates),fa({width:s.width,height:s.height,aspectRatio:r,sizeRestrictions:Qo(o,i)})),n.coordinates=Lo(n.coordinates,Ao(Oo(e.coordinates),Oo(n.coordinates)));var l=Math.max(n.coordinates.width/n.visibleArea.width,n.coordinates.height/n.visibleArea.height,1);return n.visibleArea=st(st({},e.visibleArea),fa({width:e.visibleArea.width*l,height:e.visibleArea.height*l,aspectRatio:{minimum:Ro(n.boundary),maximum:Ro(n.boundary)},sizeRestrictions:o})),n.visibleArea=Lo(n.visibleArea,Ao(Oo(e.visibleArea),Oo(n.visibleArea))),n.visibleArea=$o(n.visibleArea,ta(n,t)),n.coordinates=$o(n.coordinates,qo(Io(n.visibleArea),ra(n,t))),n}return e}function Oa(e,t){var n=ia(e);return e.visibleArea?{left:t.left*n+e.visibleArea.left,top:t.top*n+e.visibleArea.top}:t}function Pa(e,t){if(e){var n=Math.abs(e.transforms.rotate%180);return n<=45||n>=135?t:{horizontal:t.vertical,vertical:t.horizontal}}return t}function Ma(e,t){var n=ia(e);return{left:co(t.left)?t.left*n:0,top:co(t.top)?t.top*n:0}}function Na(e,t){if(e&&t){var n=t();n&&e(n)}}function La(e,t){e.forEach((function(e){Na(e,t)}))}!function(e){e.limit="limit",e.zoom="zoom",e.unsafe="unsafe"}(_o||(_o={})),function(e){e.fillArea="fillArea",e.fitArea="fitArea",e.stencil="stencil",e.none="none"}(ko||(ko={})),function(e){e.coordinates="coordinates",e.visibleArea="visibleArea"}(Eo||(Eo={}));var Ia=function(){var e=this;this.getTransitions=function(){var t=e.getData(),n=e.getProps().transitions;return st(st({},ao(n,{timingFunction:"ease-in-out",duration:350})),{active:t.transitions})},this.getInteractions=function(){return yo(e.getData().interactions)},this.hasInteractions=function(){return Qi(e.getData().interactions)},this.startTransitions=function(){var t=e.getProps(),n=t.onTransitionsStart,r=t.onUpdate,i=t.getInstance,o=e.getData(),a=o.transitions,s=lt(o,["transitions"]);e.setData(st(st({},s),{transitions:!0})),a||La([n,r],i),e.endTransitions()},this.endTransitions=xo((function(){var t=e.getProps(),n=t.onTransitionsEnd,r=t.onUpdate,i=t.getInstance;e.setData(st(st({},e.getData()),{transitions:!1})),La([n,r],i)}),(function(){return e.getTransitions().duration})),this.applyPostProcess=function(t,n){var r,i=e.getProps(),o=i.settings,a=i.postProcess,s=t.name,l=t.interaction,c=void 0!==l&&l,u=t.transitions,d=void 0!==u&&u,f=t.immediately,p={name:s,interaction:c,transitions:d,immediately:void 0!==f&&f};return r=a,Array.isArray(r)?a.reduce((function(e,t){return t(e,o,p)}),n):ro(a)?a(n,o,p):n},this.updateState=function(t,n,r){void 0===n&&(n={}),void 0===r&&(r=[]);var i=n.transitions,o=void 0!==i&&i,a=e.getProps(),s=a.onTransitionsStart,l=a.getInstance,c=a.onChange,u=a.onUpdate,d=a.settings,f=e.getData(),p=ro(t)?t(f.state,d):t,h=p?.001*ia(p):.001,m=!bo(f.state,p,h),g=["coordinates","boundary","visibleArea","imageSize","transforms"].some((function(e){var t;return!bo(null===(t=f.state)||void 0===t?void 0:t[e],null==p?void 0:p[e],h)})),v=f;m&&(o&&g&&e.endTransitions(),v=st(st({},v),{state:da(p),transitions:o&&g}),e.setData(v),Na(c,l)),v.transitions&&!f.transitions&&Na(s,l),La(ft(r,[u]),l)},this.setInteractions=function(t){var n=e.getProps(),r=n.onInteractionStart,i=n.onInteractionEnd,o=n.getInstance,a=e.getInteractions(),s=st(st({},a),t);if(bo(a,s)||e.setData(st(st({},e.getData()),{interactions:s})),Qi(a)!==Qi(s))if(Qi(a)){var l=e.getData().state;e.updateState((function(){return l&&e.applyPostProcess({name:"interactionEnd",immediately:!0,transitions:!0},l)}),{transitions:!0},[i])}else Na(r,o)},this.resetState=function(t,n){e.updateState(e.createDefaultState(t,n))},this.clear=function(){e.updateState(null)},this.reconcileState=function(t){void 0===t&&(t={});var n=e.getProps(),r=n.reconcileStateAlgorithm,i=n.settings,o=e.getData().state,a=t.transitions,s=void 0!==a&&a;if(o&&!ua(o,i)){var l=(r||Aa)(o,i);l=e.applyPostProcess({name:"reconcileState",immediately:!0,transitions:s},l),e.updateState(l,{transitions:s})}},this.transformImage=function(t,n){void 0===n&&(n={});var r=n.transitions,i=void 0===r||r,o=n.interaction,a=void 0===o||o,s=n.immediately,l=void 0!==s&&s,c=n.normalize,u=void 0===c||c,d=e.getProps(),f=d.transformImageAlgorithm,p=d.onTransformImage,h=d.onTransformImageEnd,m=d.settings,g=e.getData().state,v=[];if(g){u&&(t=function(e,t){return t.scale&&(t.scale={factor:co(t.scale)?t.scale:t.scale.factor,center:!co(t.scale)&&t.scale.center?Oa(e,t.scale.center):void 0}),t.rotate&&(t.rotate={angle:co(t.rotate)?t.rotate:t.rotate.angle,center:!co(t.rotate)&&t.rotate.center?Oa(e,t.rotate.center):void 0}),t.move&&(t.move=Ma(e,t.move)),t}(g,t));var y=e.applyPostProcess({name:"transformImage",transitions:i,immediately:l},(f||Ta)(g,m,t));v.push(p),a?e.setInteractions({transformImage:{rotate:!io(t.rotate),flip:!io(t.flip),scale:!io(t.scale),move:!io(t.move)}}):(y=e.applyPostProcess({name:"transformImageEnd",transitions:i,immediately:!0},y),v.push(h)),e.updateState(y,{transitions:l&&i},v)}},this.transformImageEnd=function(t){void 0===t&&(t={});var n=t.immediately,r=void 0===n||n,i=t.transitions,o=void 0===i||i,a=e.getData().state,s=e.getProps().onTransformImageEnd;e.updateState((function(){return a&&e.applyPostProcess({name:"transformImageEnd",immediately:r,transitions:o},a)}),{transitions:o},[s]),e.setInteractions({transformImage:{rotate:!1,flip:!1,scale:!1,move:!1}})},this.zoomImage=function(t,n){void 0===n&&(n={});var r=n.interaction,i=void 0!==r&&r,o=n.immediately,a=void 0===o||o,s=n.transitions,l=void 0===s||s,c=n.normalize,u=void 0!==c&&c;e.transformImage({scale:t},{interaction:i,immediately:a,transitions:l,normalize:u})},this.moveImage=function(t,n,r){void 0===r&&(r={});var i=r.interaction,o=void 0!==i&&i,a=r.immediately,s=void 0===a||a,l=r.transitions,c=void 0===l||l,u=r.normalize,d=void 0!==u&&u;e.transformImage({move:{left:t,top:n}},{interaction:o,immediately:s,transitions:c,normalize:d})},this.flipImage=function(t,n,r){void 0===r&&(r={});var i=r.interaction,o=void 0!==i&&i,a=r.immediately,s=void 0===a||a,l=r.transitions,c=void 0===l||l,u=r.normalize,d=void 0===u||u,f=e.getState(),p={horizontal:t,vertical:n};e.transformImage({flip:f&&d?Pa(f,p):p},{interaction:o,immediately:s,transitions:c})},this.rotateImage=function(t,n){void 0===n&&(n={});var r=n.interaction,i=void 0!==r&&r,o=n.immediately,a=void 0===o||o,s=n.transitions,l=void 0===s||s,c=n.normalize,u=void 0!==c&&c;e.transformImage({rotate:t},{interaction:i,immediately:a,transitions:l,normalize:u})},this.reset=function(t,n){e.resetState(t,n)},this.setState=function(t,n){void 0===n&&(n={});var r=e.getSettings(),i=e.getData().state,o=n.transitions,a=void 0===o||o,s=n.immediately,l=void 0!==s&&s,c=n.interaction,u=void 0!==c&&c,d=n.postprocess,f=void 0!==d&&d,p=t&&(ro(t)?t(i,r):st(st({},i),t));e.updateState((function(){return f?p&&e.applyPostProcess({name:"setState",immediately:l,transitions:a,interaction:u},p):p}),{transitions:a})},this.setCoordinates=function(t,n){void 0===n&&(n={});var r=e.getData().state,i=e.getProps(),o=i.setCoordinatesAlgorithm,a=i.settings,s=n.transitions,l=void 0===s||s,c=n.immediately,u=void 0===c||c;e.updateState((function(){return r&&e.applyPostProcess({name:"setCoordinates",immediately:u,transitions:l},(o||ma)(r,a,t,_o.zoom))}),{transitions:l})},this.setVisibleArea=function(t,n){void 0===n&&(n={});var r=n.transitions,i=void 0===r||r,o=n.immediately,a=void 0===o||o,s=e.getData().state,l=e.getProps(),c=l.setVisibleAreaAlgorithm,u=l.settings;e.updateState((function(){return s&&e.applyPostProcess({name:"setVisibleArea",immediately:a,transitions:i},(c||va)(s,u,t))}),{transitions:i})},this.setBoundary=function(t,n){void 0===n&&(n={});var r=e.getData().state,i=e.getProps(),o=i.setBoundaryAlgorithm,a=i.settings,s=n.transitions,l=void 0!==s&&s,c=n.immediately,u=void 0===c||c;t?e.updateState((function(){return r&&e.applyPostProcess({name:"setBoundary",immediately:u,transitions:l},(o||Ca)(r,a,t))})):e.updateState(null)},this.moveCoordinates=function(t,n){void 0===n&&(n={});var r=e.getData(),i=e.getProps(),o=i.moveCoordinatesAlgorithm,a=i.onMove,s=i.onMoveEnd,l=i.settings,c=n.interaction,u=void 0===c||c,d=n.transitions,f=void 0!==d&&d,p=n.immediately,h=void 0!==p&&p,m=n.normalize,g=void 0===m||m,v=[];if(!r.transitions&&r.state){var y=g?Ma(r.state,t):function(e){return{left:co(e.left)?e.left:0,top:co(e.top)?e.top:0}}(t),b=e.applyPostProcess({name:"moveCoordinates",interaction:u,immediately:h,transitions:f},(o||ba)(r.state,l,y));v.push(a),u?e.setInteractions({moveCoordinates:!0}):(b=e.applyPostProcess({name:"moveCoordinatesEnd",interaction:u,immediately:h,transitions:f},b),v.push(s)),e.updateState(b,{transitions:h&&f},v)}},this.moveCoordinatesEnd=function(t){void 0===t&&(t={});var n=e.getData().state,r=e.getProps().onMoveEnd,i=t.transitions,o=void 0===i||i,a=t.immediately,s=void 0!==a&&a;e.updateState((function(){return n&&e.applyPostProcess({name:"moveCoordinatesEnd",transitions:o,immediately:s},n)}),{transitions:o},[r]),e.setInteractions({moveCoordinates:!1})},this.resizeCoordinates=function(t,n,r,i){void 0===i&&(i={});var o=e.getData().state,a=e.getProps(),s=a.resizeCoordinatesAlgorithm,l=a.onResize,c=a.onResizeEnd,u=a.settings,d=i.interaction,f=void 0===d||d,p=i.transitions,h=void 0!==p&&p,m=i.immediately,g=void 0!==m&&m,v=i.normalize,y=void 0===v||v;if(!e.getTransitions().active&&o){var b=[],w=y?function(e,t){var n=ia(e);return{left:co(t.left)?t.left*n:0,top:co(t.top)?t.top*n:0,right:co(t.right)?t.right*n:0,bottom:co(t.bottom)?t.bottom*n:0}}(o,n):function(e){return{left:co(e.left)?e.left:0,top:co(e.top)?e.top:0,right:co(e.right)?e.right:0,bottom:co(e.bottom)?e.bottom:0}}(n),x=e.applyPostProcess({name:"resizeCoordinates",interaction:f,immediately:g,transitions:h},(s||Sa)(o,u,t,w,oo(r)?r:{}));b.push(l),f?e.setInteractions({resizeCoordinates:!0}):(x=e.applyPostProcess({name:"resizeCoordinatesEnd",interaction:f,immediately:g,transitions:h},x),b.push(c)),e.updateState(x,{transitions:g&&h},b)}},this.resizeCoordinatesEnd=function(t){void 0===t&&(t={});var n=e.getProps().onResizeEnd,r=e.getData().state,i=t.transitions,o=void 0===i||i,a=t.immediately,s=void 0!==a&&a;e.updateState((function(){return r&&e.applyPostProcess({name:"resizeCoordinatesEnd",transitions:o,immediately:s},r)}),{transitions:o},[n]),e.setInteractions({resizeCoordinates:!1})},this.getStencilCoordinates=function(){return oa(e.getData().state)},this.getCoordinates=function(t){void 0===t&&(t={});var n=e.getData().state,r=e.getProps().settings;if(n&&n.coordinates){var i=t.round;return void 0===i||i?function(e,t){if(Jo(e)){var n=na(e,t),r=ra(e,t),i={width:Math.round(e.coordinates.width),height:Math.round(e.coordinates.height),left:Math.round(e.coordinates.left),top:Math.round(e.coordinates.top)};return i.width>n.maxWidth?i.width=Math.floor(e.coordinates.width):i.width<n.minWidth&&(i.width=Math.ceil(e.coordinates.width)),i.height>n.maxHeight?i.height=Math.floor(e.coordinates.height):i.height<n.minHeight&&(i.height=Math.ceil(e.coordinates.height)),$o(i,r)}return null}(n,r):st({},n.coordinates)}return null},this.getVisibleArea=function(){var t=e.getData().state;return(null==t?void 0:t.visibleArea)?st({},t.visibleArea):null},this.getSettings=function(){var t=e.getProps().settings;return st({},t)},this.getState=function(){return da(e.getData().state)},this.getTransforms=function(){var t=e.getData().state;return t?yo(t.transforms):{rotate:0,flip:{horizontal:!1,vertical:!1}}},this.createDefaultState=function(t,n){var r=e.getProps(),i=r.createStateAlgorithm,o=r.settings;return e.applyPostProcess({name:"createState",immediately:!0,transitions:!1},(i||ya)({image:n,boundary:t},o))},this.isConsistent=function(){var t=e.getData().state,n=e.getProps().settings;return!t||ua(t,n)}};function Da(e,t){var n,r=e.imageSize,i=e.visibleArea,o=na(e,t),a=aa(e,t);if(i)n=i;else{var s=Vo(ra(e,t));n={width:Math.max(s.minWidth,Math.min(s.maxWidth,r.width)),height:Math.max(s.minHeight,Math.min(s.maxHeight,r.height))}}var l=Math.min(a.maximum||1/0,Math.max(a.minimum||0,Ro(n))),c=n.width<n.height?{width:.8*n.width,height:.8*n.width/l}:{height:.8*n.height,width:.8*n.height*l};return fa(st(st({},c),{aspectRatio:a,sizeRestrictions:o}))}function Ra(e,t){return function(e){return{minWidth:fo(e.minWidth)?so(e.minWidth):0,minHeight:fo(e.minHeight)?so(e.minHeight):0,maxWidth:fo(e.maxWidth)?so(e.maxWidth):1/0,maxHeight:fo(e.maxHeight)?so(e.maxHeight):1/0}}(t)}function Ba(e){var t=e.visibleArea,n=e.coordinates,r=t||ca(e);return{left:(t?t.left:0)+r.width/2-(n?n.width/2:0),top:(t?t.top:0)+r.height/2-(n?n.height/2:0)}}function ja(e){return function(t,n){var r=ro(e)?e(t,n):e;return Qo(Ra(0,n),r)}}function za(e){return st(st({},e),{sizeRestrictions:function(t,n){return e.sizeRestrictions?ro(e.sizeRestrictions)?e.sizeRestrictions(t,n):e.sizeRestrictions:Ra(0,n)},areaPositionRestrictions:function(t,n){return e.areaPositionRestrictions?ro(e.areaPositionRestrictions)?e.areaPositionRestrictions(t,n):e.areaPositionRestrictions:function(e,t){var n=e.visibleArea,r=e.boundary,i=t.imageRestriction,o=ca(e),a={};return i===ko.fillArea?a={left:0,top:0,right:o.width,bottom:o.height}:i===ko.fitArea&&(Ro(r)>Ro(o)?(a={top:0,bottom:o.height},n&&(n.width>o.width?(a.left=-(n.width-o.width)/2,a.right=o.width-a.left):(a.left=0,a.right=o.width))):(a={left:0,right:o.width},n&&(n.height>o.height?(a.top=-(n.height-o.height)/2,a.bottom=o.height-a.top):(a.top=0,a.bottom=o.height)))),a}(t,n)},areaSizeRestrictions:function(t,n){return e.areaSizeRestrictions?ro(e.areaSizeRestrictions)?e.areaSizeRestrictions(t,n):e.areaSizeRestrictions:function(e,t){var n=e.boundary,r=t.imageRestriction,i=ca(e),o={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0};return r===ko.fillArea?(o.maxWidth=i.width,o.maxHeight=i.height):r===ko.fitArea&&(Ro(n)>Ro(i)?(o.maxHeight=i.height,o.maxWidth=i.height*Ro(n)):(o.maxWidth=i.width,o.maxHeight=i.width/Ro(n))),o}(t,n)},positionRestrictions:function(t,n){return e.positionRestrictions?ro(e.positionRestrictions)?e.positionRestrictions(t,n):e.positionRestrictions:function(e,t){var n=ca(e),r={};return t.imageRestriction&&"none"!==t.imageRestriction&&(r={left:0,top:0,right:n.width,bottom:n.height}),r}(t,n)},defaultCoordinates:function(t,n){if(e.defaultCoordinates)return ro(e.defaultCoordinates)?e.defaultCoordinates(t,n):e.defaultCoordinates;var r=e.defaultSize;r||(r=Da);var i=ro(r)?r(t,n):r,o=e.defaultPosition||Ba;return[i,function(e){return st({},ro(o)?o(e,n):o)}]},defaultVisibleArea:function(t,n){return e.defaultVisibleArea?ro(e.defaultVisibleArea)?e.defaultVisibleArea(t,n):e.defaultVisibleArea:function(e,t){var n=e.coordinates,r=e.boundary,i=ca(e),o=Ro(r);if(n){var a={height:Math.max(n.height,i.height),width:Math.max(n.width,i.width)},s={left:0,top:0,width:Ro(a)>o?a.width:a.height*o,height:Ro(a)>o?a.width/o:a.height};(s=Fo(s,ea(e,t))).left=n.left+n.width/2-s.width/2,s.top=n.top+n.height/2-s.height/2;var l=Uo(n,Io(st({left:0,top:0},i))),c={};return!l.left&&!l.right&&s.width<=i.width&&(c.left=0,c.right=i.width),!l.top&&!l.bottom&&s.height<=i.height&&(c.top=0,c.bottom=i.height),$o(s,c)}var u=Ro(i),d={height:u<o?i.height:i.width/o,width:u<o?i.height*o:i.width};return{left:i.width/2-d.width/2,top:i.height/2-d.height/2,width:d.width,height:d.height}}(t,n)},aspectRatio:function(t,n){return Zo(ro(e.aspectRatio)?e.aspectRatio(t,n):e.aspectRatio)}})}var Ua=4;function Fa(e){return new Promise((function(t,n){try{if(e)if(/^data:/i.test(e))t(function(e){e=e.replace(/^data:([^;]+);base64,/gim,"");for(var t=atob(e),n=t.length,r=new ArrayBuffer(n),i=new Uint8Array(r),o=0;o<n;o++)i[o]=t.charCodeAt(o);return r}(e));else if(/^blob:/i.test(e)){var r=new FileReader;r.onload=function(e){var n;t(null===(n=e.target)||void 0===n?void 0:n.result)},o=e,a=function(e){r.readAsArrayBuffer(e)},(s=new XMLHttpRequest).open("GET",o,!0),s.responseType="blob",s.onload=function(){200!=this.status&&0!==this.status||a(this.response)},s.send()}else{var i=new XMLHttpRequest;i.onreadystatechange=function(){i.readyState===Ua&&(200===i.status||0===i.status?t(i.response):n("Warning: could not load an image to parse its orientation"))},i.onprogress=function(){"image/jpeg"!==i.getResponseHeader("content-type")&&i.abort()},i.withCredentials=!1,i.open("GET",e,!0),i.responseType="arraybuffer",i.send(null)}else n("Error: the image is empty")}catch(e){n(e)}var o,a,s}))}function Wa(e){var t=e.rotate,n=void 0===t?0:t,r=e.flip,i=void 0===r?{horizontal:!1,vertical:!1}:r,o=e.scale,a=void 0===o?1:o;return" rotate("+n+"deg) scaleX("+a*(i.horizontal?-1:1)+") scaleY("+a*(i.vertical?-1:1)+")"}function Ha(e){try{var t,n=new DataView(e),r=void 0,i=void 0,o=void 0,a=void 0;if(255===n.getUint8(0)&&216===n.getUint8(1))for(var s=n.byteLength,l=2;l+1<s;){if(255===n.getUint8(l)&&225===n.getUint8(l+1)){o=l;break}l++}if(o&&(r=o+10,"Exif"===function(e,t,n){var r,i="";for(r=t,n+=t;r<n;r++)i+=String.fromCharCode(e.getUint8(r));return i}(n,o+4,4))){var c=n.getUint16(r);if(((i=18761===c)||19789===c)&&42===n.getUint16(r+2,i)){var u=n.getUint32(r+4,i);u>=8&&(a=r+u)}}if(a)for(var d=n.getUint16(a,i),f=0;f<d;f++){l=a+12*f+2;if(274===n.getUint16(l,i)){l+=8,t=n.getUint16(l,i),n.setUint16(l,1,i);break}}return t}catch(e){return null}}function Va(e){var t=e.src,n=e.arrayBuffer,r=void 0===n?null:n,i=e.orientation,o=void 0===i?null:i,a={src:t,arrayBuffer:r,revoke:!1,transforms:{flip:{horizontal:!1,vertical:!1},rotate:0}};return r&&o&&o>1?eo(t)||!to(t)?(a.src=URL.createObjectURL(new Blob([r])),a.revoke=!0):a.src=function(e){for(var t=[],n=new Uint8Array(e);n.length>0;){var r=n.subarray(0,8192);t.push(String.fromCharCode.apply(null,Array.from?Array.from(r):r.slice())),n=n.subarray(8192)}return"data:image/jpeg;base64,"+btoa(t.join(""))}(r):a.src=t,o&&(a.transforms=function(e){var t={flip:{horizontal:!1,vertical:!1},rotate:0};if(e)switch(e){case 2:t.flip.horizontal=!0;break;case 3:t.rotate=-180;break;case 4:t.flip.vertical=!0;break;case 5:t.rotate=90,t.flip.vertical=!0;break;case 6:t.rotate=90;break;case 7:t.rotate=90,t.flip.horizontal=!0;break;case 8:t.rotate=-90}return t}(o)),a}function qa(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});var n=t.checkOrientation,r=t.parse;return new Promise((function(t){n||r?Fa(e).then((function(n){var r=Ha(n);t(Va(n?{src:e,arrayBuffer:n,orientation:r}:{src:e,arrayBuffer:null,orientation:null}))})).catch((function(n){console.warn(n),t(Va({src:e}))})):t(Va({src:e}))}))}(e,st(st({},t),{crossOrigin:no(e)&&t.crossOrigin})).then((function(e){return new Promise((function(n,r){(function(e,t){return void 0===t&&(t={}),new Promise((function(n,r){var i=document.createElement("img");t.crossOrigin&&(i.crossOrigin=!0!==t.crossOrigin?t.crossOrigin:"anonymous"),i.src=e,i.style.visibility="hidden",i.style.position="fixed",document.body.appendChild(i),i.complete?(n(i),document.body.removeChild(i)):(i.addEventListener("load",(function(){n(i),document.body.removeChild(i)})),i.addEventListener("error",(function(){r(null),document.body.removeChild(i)})))}))})(e.src,t).then((function(t){n(st(st({},e),{width:t.naturalWidth,height:t.naturalHeight}))})).catch((function(){r(null)}))}))}))}function Ga(e,t,n,r,i){void 0===i&&(i=null);var o=e.width>e.height?{width:Math.min(512,e.width),height:Math.min(512,e.width)/(e.width/e.height)}:{height:Math.min(512,e.height),width:Math.min(512,e.height)*(e.width/e.height)},a=ca(t),s={rotate:t.transforms.rotate,flip:{horizontal:t.transforms.flip.horizontal,vertical:t.transforms.flip.vertical},translateX:n.left/r,translateY:n.top/r,scale:1/r},l={left:(o.width-a.width)/(2*r),top:(o.height-a.height)/(2*r)},c={left:(1-1/r)*o.width/2,top:(1-1/r)*o.height/2},u=st(st({},s),{scale:s.scale*(e.width/o.width)}),d={width:o.width+"px",height:o.height+"px",left:"0px",top:"0px",transition:"none",transform:"translate3d("+(-l.left-c.left-s.translateX)+"px, "+(-l.top-c.top-s.translateY)+"px, 0px)"+Wa(u),willChange:"none"};return i&&i.active&&(d.willChange="transform",d.transition=i.duration+"ms "+i.timingFunction),d}function $a(e,t,n){t.style.width="0px",t.style.height="0px",t.style.width=Math.max(e.clientWidth,n.width)+"px";var r=n.width/n.height;t.style.height=Math.max(e.clientHeight,t.clientWidth/r)+"px",t.style.width=t.clientHeight*r+"px"}function Za(e,t,n){t.style.width="0px",t.style.height="0px",t.style.width=Math.max(e.getBoundingClientRect().width,n.width)+"px";var r=n.width/n.height;t.style.height=Math.max(e.getBoundingClientRect().height,t.getBoundingClientRect().width/r)+"px",t.style.width=t.getBoundingClientRect().height*r+"px",t.clientWidth/t.clientHeight>e.clientWidth/e.clientHeight?t.clientWidth>e.clientWidth&&(t.style.width=e.clientWidth+"px",t.style.height=e.clientWidth/r+"px"):t.clientHeight>e.clientHeight&&(t.style.height=e.clientHeight+"px",t.style.width=e.clientHeight*r+"px")}function Ya(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Xa(e,t,n,r,i){if(Jo(e)){var o=e.transforms,a=e.coordinates,s=0!==o.rotate||o.flip.horizontal||o.flip.vertical?function(e,t,n){var r=n.rotate,i=n.flip,o={width:"naturalWidth"in t?t.naturalWidth:t.width,height:"naturalHeight"in t?t.naturalHeight:t.height},a=Wo(o,r),s=e.getContext("2d");if(e.height=a.height,e.width=a.width,s){s.save();var l=Ho(Oo(st({left:0,top:0},o)),r);s.translate(-(l.left-a.width/2),-(l.top-a.height/2)),s.rotate(r*Math.PI/180),s.translate(i.horizontal?o.width:0,i.vertical?o.height:0),s.scale(i.horizontal?-1:1,i.vertical?-1:1),s.drawImage(t,0,0,o.width,o.height),s.restore()}return e}(r,t,o):t,l=st({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,maxArea:1/0,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",fillColor:"transparent"},i),c=function(e){return e.find((function(e){return fo(e)}))},u=fa({sizeRestrictions:{minWidth:c([l.width,l.minWidth])||0,minHeight:c([l.height,l.minHeight])||0,maxWidth:c([l.width,l.maxWidth])||1/0,maxHeight:c([l.height,l.maxHeight])||1/0},width:a.width,height:a.height,aspectRatio:{minimum:a.width/a.height,maximum:a.width/a.height}});if(l.maxArea&&u.width*u.height>l.maxArea){var d=Math.sqrt(l.maxArea/(u.width*u.height));u={width:Math.round(d*u.width),height:Math.round(d*u.height)}}return function(e,t,n,r,i){e.width=r?r.width:n.width,e.height=r?r.height:n.height;var o=e.getContext("2d");if(o){o.clearRect(0,0,e.width,e.height),i&&(i.imageSmoothingEnabled&&(o.imageSmoothingEnabled=i.imageSmoothingEnabled),i.imageSmoothingQuality&&(o.imageSmoothingQuality=i.imageSmoothingQuality),i.fillColor&&(o.fillStyle=i.fillColor,o.fillRect(0,0,e.width,e.height),o.save()));var a=n.left<0?-n.left:0,s=n.top<0?-n.top:0;o.drawImage(t,n.left+a,n.top+s,n.width,n.height,a,s,e.width,e.height)}return e}(n,s,a,u,l)}return null}var Ka={linear:function(e){return e},"ease-in":function(e){return Math.pow(e,1.675)},"ease-out":function(e){return 1-Math.pow(1-e,1.675)},"ease-in-out":function(e){return.5*(Math.sin((e-.5)*Math.PI)+1)}},Qa=function(){function e(){this.active=!1}return e.prototype.start=function(e){var t;this.onStart=e.onStart,this.onProgress=e.onProgress,this.onStop=e.onStop,this.active||null===(t=this.onStart)||void 0===t||t.call(this),this.id&&window.cancelAnimationFrame(this.id),this.startTime=performance.now(),this.timingFunction=e.timingFunction,this.endTime=this.startTime+e.duration,this.active=!0,this.animate()},e.prototype.animate=function(){var e=this;if(this.startTime&&this.endTime){var t=Ka[this.timingFunction];t||(t=Ka["ease-out"]);var n=1-(this.endTime-performance.now())/(this.endTime-this.startTime),r=Math.min(1,t(n));this.onProgress&&this.onProgress(r),n<1?this.id=window.requestAnimationFrame((function(){return e.animate()})):this.stop()}else this.stop()},e.prototype.stop=function(){this.active=!1,this.id&&window.cancelAnimationFrame(this.id),this.onStop&&this.onStop()},e}();function Ja(e,t){var n=t.getBoundingClientRect(),r=n.left,i=n.top,o={left:0,top:0},a=0;return e.forEach((function(t){o.left+=(t.clientX-r)/e.length,o.top+=(t.clientY-i)/e.length})),e.forEach((function(e){a+=po({left:o.left,top:o.top},{left:e.clientX-r,top:e.clientY-i})})),{centerMass:o,spread:a,count:e.length}}function es(e,t,n){void 0===n&&(n=.1);var r,i,o=t.getBoundingClientRect(),a=o.left,s=o.top;return{scale:{factor:1-n*(r=e.deltaY||e.detail||e.wheelDelta,0===(i=+r)||uo(i)?i:i>0?1:-1),center:{left:e.clientX-a,top:e.clientY-s}}}}function ts(e,t){return e.aspectRatio?{}:{aspectRatio:Zo(ro(t.aspectRatio)?t.aspectRatio():t.aspectRatio)}}var ns=i(4184),rs=i.n(ns);function is(e,t){var n=ts({},t);return{stencilSize:function(t,r){var i,o,a=ro(e.stencilSize)?e.stencilSize(t,r):e.stencilSize;return fa(st(st({},a),{aspectRatio:(i=n.aspectRatio,o=Zo(Ro(a)),o?i?{minimum:Math.min(i.maximum,Math.max(i.minimum,o.minimum)),maximum:Math.max(i.minimum,Math.min(i.maximum,o.maximum))}:o:i)}))}}}function os(e,t){var n=e.boundary,r=ro(t.stencilSize)?t.stencilSize(e,t):t.stencilSize;return(r.width>n.width||r.height>n.height)&&(r=fa({sizeRestrictions:{maxWidth:n.width,maxHeight:n.height,minWidth:0,minHeight:0},width:r.width,height:r.height,aspectRatio:{minimum:Ro(r),maximum:Ro(r)}})),r}function as(e,t){var n=os(e,st(st({},t),{stencilSize:t.stencilSize})),r=ea(e,t);return{maxWidth:r.maxWidth*n.width/e.boundary.width,maxHeight:r.maxHeight*n.height/e.boundary.height,minWidth:0,minHeight:0}}function ss(e,t){var n,r,i=e.imageSize,o=e.visibleArea,a=e.boundary,s=na(e,t),l=aa(e,t),c=ro(t.stencilSize)?t.stencilSize(e,t):t.stencilSize,u=o||i;return Ro(u)>Ro(a)?r=(n=c.height*u.height/a.height)*Ro(c):n=(r=c.width*u.width/a.width)/Ro(c),fa({width:r,height:n,aspectRatio:l,sizeRestrictions:s})}function ls(e,t){var n=Ro(os(e,t));return{minimum:n,maximum:n}}function cs(e,t,n){return n&&n.immediately?function(e,t){if(Jo(e)){var n=da(e),r=os(e,t);n.visibleArea=Do(n.visibleArea,n.coordinates.width*n.boundary.width/(n.visibleArea.width*r.width));var i=zo(n.visibleArea,ea(n,t));return 1!==i&&(n.visibleArea=Do(n.visibleArea,i),n.coordinates=Do(n.coordinates,i)),n.visibleArea=Lo(n.visibleArea,Ao(Oo(n.coordinates),Oo(n.visibleArea))),n.visibleArea=$o(n.visibleArea,ta(n,t)),n.coordinates=$o(n.coordinates,qo(Io(n.visibleArea),ta(n,t))),n}return e}(e,t):e}function us(e,t,n){return n.immediately?function(e,t){if(Jo(e)){var n=da(e),r={width:0,height:0};Ro(n.boundary)>Ro(n.coordinates)?(r.height=.8*n.boundary.height,r.width=r.height*Ro(n.coordinates)):(r.width=.8*n.boundary.width,r.height=r.width*Ro(n.coordinates)),n.visibleArea=Do(n.visibleArea,n.coordinates.width*n.boundary.width/(n.visibleArea.width*r.width));var i=zo(n.visibleArea,ea(n,t));return n.visibleArea=Do(n.visibleArea,i),1!==i&&(r.height/=i,r.width/=i),n.visibleArea=Lo(n.visibleArea,Ao(Oo(n.coordinates),Oo(n.visibleArea))),n.visibleArea=$o(n.visibleArea,ta(n,t)),n.coordinates=$o(n.coordinates,qo(Io(n.visibleArea),ra(n,t))),n}return e}(e,t):e}function ds(){var t=(0,e.useRef)([]);return function(e){-1===t.current.indexOf(e)&&t.current.push(e)}}var fs=function(t,n){var r,i=(r=(0,e.useRef)(!0)).current?(r.current=!1,!0):r.current;(0,e.useEffect)((function(){if(!i)return t()}),n)};var ps=function(e){function t(t,n){var r=e.call(this)||this;return r.props=t,r.notify=n,r.data={state:null,transitions:!1,interactions:{moveCoordinates:!1,resizeCoordinates:!1,transformImage:{rotate:!1,move:!1,scale:!1,flip:!1}}},r}return at(t,e),t.prototype.getProps=function(){return this.props()},t.prototype.setData=function(e){this.data=e,this.notify()},t.prototype.getData=function(){return this.data},t}(Ia);function hs(){var t=dt((0,e.useState)({}),2);t[0];var n=t[1];return function(){n({})}}function ms(t){var n=hs(),r=function(t){var n=(0,e.useRef)(t);return n.current=t,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.current.apply(n,pt([],dt(e),!1))}}((function(){var e=t(),n=e.settings,r=lt(e,["settings"]),i=st({imageRestriction:ko.fitArea,transformImage:{adjustStencil:!0}},n),o=st({transitions:!0},r);return st({settings:st(st({},i),za(i))},o)}));return(0,e.useRef)(new ps(r,n)).current}var gs=function(t){var n=(0,e.useRef)(t),r=function(){n.current&&n.current()};(0,e.useEffect)((function(){n.current=t}),[t]),(0,e.useEffect)((function(){return window.addEventListener("resize",r),window.addEventListener("orientationchange",r),function(){window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r)}}),[])};function vs(t){var n=this,r=t(),i=r.src,o=r.onReady,a=r.onError,s=r.onUpdate,l=r.canvas,c=void 0===l||l,u=r.unloadTime,d=void 0===u?500:u,f=r.crossOrigin,p=void 0===f||f,h=r.checkOrientation,m=void 0===h||h,g=r.autoReconcileState,v=void 0===g||g,y=(0,e.useRef)(null),b=(0,e.useRef)(null),w=(0,e.useRef)(null),x=(0,e.useRef)(null),_=dt(function(t){var n=dt((0,e.useState)(t),2),r=n[0],i=n[1],o=dt((0,e.useState)(null),2),a=o[0],s=o[1],l=(0,e.useRef)(t);return fs((function(){a&&a(r,l.current)}),[a]),[r,function(e,t){l.current=r,i(e),s((function(){return t}))}]}(null),2),k=_[0],E=_[1],S=ms((function(){return st(st({},t()),{getInstance:function(){return x.current}})})),C=function(t){var n=t.src,r=t.onLoadingStart,i=t.onLoadingEnd,o=t.onError,a=t.onLoad,s=t.crossOrigin,l=t.checkOrientation,c=t.canvas,u=t.unloadTime,d=dt((0,e.useState)(!1),2),f=d[0],p=d[1],h=dt((0,e.useState)(!1),2),m=h[0],g=h[1],v=dt((0,e.useState)(null),2),y=v[0],b=v[1],w=(0,e.useRef)(null);return(0,e.useEffect)((function(){if(w.current!==n)if(w.current=n||null,g(!1),n){p(!0),null==r||r();var e=[qa(n,{crossOrigin:io(s)?c:s,checkOrientation:l})];m&&u&&e.push(vo(u)),Promise.all(e).then((function(e){var t=dt(e,1)[0];w.current===n&&(b(t),null==a||a(t))})).catch((function(){w.current===n&&(null==o||o())})).finally((function(){w.current===n&&(null==i||i(),p(!1))}))}else u?vo(u).then((function(){b(null)})):b(null)}),[n]),(0,e.useEffect)((function(){y&&g(!0)}),[y]),{isLoading:function(){return f},isLoaded:function(){return m},getImage:function(){return y},setImage:b}}({src:i,crossOrigin:p,checkOrientation:m,unloadTime:d,canvas:c,onLoad:function(){x.current&&(null==o||o(x.current))},onError:function(){x.current&&(null==a||a(x.current))}}),T=function(t,n){void 0===n&&(n=!0);var r=dt((0,e.useState)(n),2),i=r[0],o=r[1];return(0,e.useLayoutEffect)((function(){i&&!t.hasInteractions()&&t.reconcileState()})),{pause:function(){o(!1)},resume:function(){o(!0)}}}(S,v),A=function(){return ct(n,void 0,void 0,(function(){var e,t,n;return ut(this,(function(r){switch(r.label){case 0:return b.current?(T.pause(),e=C.getImage(),[4,null===(n=b.current)||void 0===n?void 0:n.stretchTo(e)]):[3,2];case 1:t=r.sent(),E(e,(function(){t&&e?S.reset(t,e):S.clear()})),T.resume(),r.label=2;case 2:return[2]}}))}))},O=function(){return ct(n,void 0,void 0,(function(){var e,t,n,r;return ut(this,(function(i){switch(i.label){case 0:return b.current?(T.pause(),e=C.getImage(),[4,null===(r=b.current)||void 0===r?void 0:r.stretchTo(e)]):[3,2];case 1:(t=i.sent())&&e?(n=S.getState())?t.width===n.boundary.width&&t.height===n.boundary.height||(S.setBoundary(t),S.reconcileState()):S.reset(t,e):S.clear(),T.resume(),i.label=2;case 2:return[2]}}))}))},P={reset:function(){return A()},refresh:function(){return O()},setImage:function(e){return E(e)},reconcileState:S.reconcileState,moveCoordinates:S.moveCoordinates,moveCoordinatesEnd:S.moveCoordinatesEnd,resizeCoordinates:S.resizeCoordinates,clear:S.clear,resizeCoordinatesEnd:S.resizeCoordinatesEnd,moveImage:S.moveImage,flipImage:S.flipImage,zoomImage:S.zoomImage,rotateImage:S.rotateImage,transformImage:S.transformImage,transformImageEnd:S.transformImageEnd,setCoordinates:S.setCoordinates,setVisibleArea:S.setVisibleArea,startTransitions:S.startTransitions,setState:S.setState,hasInteractions:S.hasInteractions,getStencilCoordinates:S.getStencilCoordinates,getCoordinates:S.getCoordinates,getVisibleArea:S.getVisibleArea,getTransforms:S.getTransforms,getTransitions:S.getTransitions,getInteractions:S.getInteractions,getSettings:S.getSettings,getState:S.getState,getDefaultState:function(){var e=S.getState(),t=C.getImage();return e&&t?S.createDefaultState(e.boundary,t):null},getCanvas:function(e){var t=S.getState();return y.current&&w.current&&t?w.current.draw(t,y.current,e):null},getImage:function(){return k?st({},k):null},isLoading:C.isLoading,isLoaded:C.isLoaded};return gs((function(){O()})),fs((function(){A()}),[C.getImage()]),fs((function(){x.current&&(null==s||s(x.current))}),[C.isLoaded(),C.isLoading()]),(0,e.useImperativeHandle)(x,(function(){return P})),{cropper:P,refs:{image:y,boundary:b,canvas:w},image:k}}var ys=(0,e.forwardRef)((function(t,n){var r=t.className,i=t.style,o=t.stretcherClassName,a=t.contentClassName,s=t.stretchAlgorithm,l=void 0===s?$a:s,c=t.sizeAlgorithm,u=void 0===c?Ya:c,d=t.children,f=(0,e.useRef)(null),p=(0,e.useRef)(null);return(0,e.useImperativeHandle)(n,(function(){return{reset:function(){var e=f.current;e&&(e.style.height="",e.style.width="")},stretchTo:function(e){var t=f.current,n=p.current;if((null==e?void 0:e.width)&&(null==e?void 0:e.height)&&t&&n){l(n,t,e);var r=u(n,e);return Promise.resolve(r.width&&r.height?r:null)}return t&&(t.style.height="",t.style.width=""),Promise.resolve(null)}}})),e.createElement("div",{ref:p,style:i,className:rs()("advanced-cropper-boundary",r)},e.createElement("div",{ref:f,className:rs()(["advanced-cropper-boundary__stretcher",o])}),e.createElement("div",{className:rs()(["advanced-cropper-boundary__content",a])},d))}));ys.displayName="StretchableBoundary";var bs=function(t){var n=t.visible,r=t.className,i=t.style,o=t.children;return e.createElement("div",{style:i,className:rs()(r,"advanced-cropper-fade",Boolean(n)&&"advanced-cropper-fade--visible")},o)},ws=function(t){var n=t.cropper,r=t.children,i=t.className,o=t.style,a=n?n.getState():null,s=!!n&&n.isLoaded();return e.createElement("div",{className:rs()(i,"advanced-cropper-wrapper"),style:o},e.createElement(bs,{visible:a&&s,className:"advanced-cropper-wrapper__fade"},r))};function xs(e){e.preventDefault()}var _s=(0,e.forwardRef)((function(t,n){var r=t.className,i=t.style,o=t.cropper,a=t.crossOrigin,s=void 0===a||a,l=o.getState(),c=o.getTransitions(),u=o.getImage(),d=u&&l?function(e,t,n){return void 0===n&&(n=null),e&&t&&t.visibleArea?Ga(e,t,t.visibleArea,ia(t),n):{}}(u,l,c):{},f=u?u.src:void 0;return f?e.createElement("img",{key:f,ref:n,className:rs()("advanced-cropper-background-image",r),src:f,crossOrigin:!0===s?"anonymous":s||void 0,style:st(st({},d),i),onMouseDown:xs}):null}));_s.displayName="CropperBackgroundImage";var ks=(0,e.forwardRef)((function(t,n){var r=(0,e.useRef)(null),i=(0,e.useRef)(null);return(0,e.useImperativeHandle)(n,(function(){return{draw:function(e,t,n){return void 0===n&&(n={}),t&&r.current&&i.current?Xa(e,t,r.current,i.current,n):null}}})),e.createElement(e.Fragment,null,e.createElement("canvas",{className:"advanced-cropper-canvas",ref:r}),e.createElement("canvas",{className:"advanced-cropper-canvas",ref:i}))}));ks.displayName="CropperCanvas";var Es=function(t){function n(n){var r=t.call(this,n)||this;return r.processMove=function(e,t){var n,i=r.container.current;if(i&&r.touches.length){var o=i.getBoundingClientRect(),a=o.left,s=o.top;if(1===r.touches.length&&1===t.length&&r.props.onMove){var l={left:Math.abs(t[0].clientX-r.anchor.left-a)<Math.abs(r.touches[0].clientX-r.anchor.left-a),top:Math.abs(t[0].clientY-r.anchor.top-s)<Math.abs(r.touches[0].clientY-r.anchor.top-s)},c={left:0,top:0};r.props.useAnchor&&l.left||(c.left=t[0].clientX-r.touches[0].clientX),r.props.useAnchor&&l.top||(c.top=t[0].clientY-r.touches[0].clientY),null===(n=r.props)||void 0===n||n.onMove(c,e),r.touches=pt([],dt(t),!1)}}},r.processEnd=function(){var e=r.props,t=e.onMoveEnd,n=e.onLeave;!r.props.disabled&&r.touches.length&&(null==t||t()),r.hovered&&(null==n||n(),r.hovered=!1),r.touches=[]},r.initAnchor=function(e){var t=r.container.current;if(t){var n=t.getBoundingClientRect(),i=n.left,o=n.top;r.anchor={left:e.clientX-i,top:e.clientY-o}}},r.onMouseOver=function(){var e=r.props,t=e.onEnter,n=e.disabled;r.hovered||n||(r.hovered=!0,null==t||t())},r.onMouseLeave=function(){var e=r.props.onLeave;r.hovered&&!r.touches.length&&(r.hovered=!1,null==e||e())},r.onTouchStart=function(e){var t=r.props,n=t.onEnter,i=t.onMoveStart,o=t.disabled;if(e.cancelable){r.touches=Array.from(e.touches);var a=!o&&1===e.touches.length;a&&(r.touches=Array.from(e.touches),null==i||i()),r.hovered||o||(r.hovered=!0,null==n||n()),(r.started||a)&&(e.preventDefault(),e.stopPropagation())}},r.onTouchEnd=function(){r.started=!1,r.processEnd()},r.onTouchMove=function(e){r.touches.length>=1&&(r.started?(r.processMove(e,Array.from(e.touches)),e.preventDefault(),e.stopPropagation()):po({left:r.touches[0].clientX,top:r.touches[0].clientY},{left:e.touches[0].clientX,top:e.touches[0].clientY})>(r.props.activationDistance||0)&&(r.initAnchor({clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}),r.started=!0))},r.onMouseDown=function(e){var t=r.props,n=t.onMoveStart;if(!t.disabled&&0===e.button){var i={clientX:e.clientX,clientY:e.clientY};r.touches=[i],r.initAnchor(i),e.stopPropagation(),null==n||n()}},r.onMouseMove=function(e){!r.props.disabled&&r.touches.length&&(r.processMove(e,[{clientX:e.clientX,clientY:e.clientY}]),e.preventDefault&&e.cancelable&&e.preventDefault(),e.stopPropagation())},r.onMouseUp=function(){r.processEnd()},r.touches=[],r.hovered=!1,r.started=!1,r.anchor={left:0,top:0},r.container=(0,e.createRef)(),r}return at(n,t),n.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var e=this.container.current;e&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("mousedown",this.onMouseDown))},n.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var e=this.container.current;e&&(e.addEventListener("touchstart",this.onTouchStart,{passive:!1}),e.addEventListener("mousedown",this.onMouseDown,{passive:!1}))},n.prototype.componentDidUpdate=function(e){this.props.disabled&&!e.disabled&&(this.touches=[])},n.prototype.render=function(){var t=this.props,n=t.children,r=t.className;return e.createElement("div",{className:rs()("advanced-cropper-draggable-element",r),ref:this.container,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},n)},n.defaultProps={disabled:!1,activationDistance:30,useAnchor:!0,rerender:!0},n}(e.Component),Ss=function(t){var n=t.position,r=t.className,i=t.disabled,o=t.onDrag,a=t.onDragEnd,s=t.onLeave,l=t.onEnter,c=t.children;return e.createElement(Es,{className:rs()(["advanced-cropper-line-wrapper",n&&"advanced-cropper-line-wrapper--".concat(n),i&&"advanced-cropper-line-wrapper--disabled",r]),disabled:i,onMove:o,onMoveEnd:a,onLeave:s,onEnter:l,activationDistance:0},e.createElement("div",{className:rs()(["advanced-cropper-line-wrapper__content",n&&"advanced-cropper-line-wrapper__content--".concat(n)])},c))},Cs=function(t){var n,r,i=t.position,o=t.hoverClassName,a=t.wrapperClassName,s=t.defaultClassName,l=t.disabled,c=t.onMove,u=t.onMoveEnd,d=dt((0,e.useState)(!1),2),f=d[0],p=d[1];return e.createElement(Ss,{className:rs()("advanced-cropper-simple-line-wrapper",a,(n={},n["advanced-cropper-simple-line-wrapper--".concat(i)]=!!i,n)),position:i,disabled:l,onDrag:c,onDragEnd:u,onLeave:function(){p(!1)},onEnter:function(){p(!0)}},e.createElement("div",{className:rs()("advanced-cropper-simple-line",f&&"advanced-cropper-simple-line--hover",s,f&&o,(r={},r["advanced-cropper-simple-line--".concat(i)]=!!i,r))}))},Ts=function(t){var n=t.horizontalPosition,r=t.verticalPosition,i=t.className,o=t.disabled,a=t.onDrag,s=t.onDragEnd,l=t.onLeave,c=t.onEnter,u=t.children,d=t.style,f=n||r?Ji(n,r).snakeCase:null;return e.createElement("div",{style:d,className:rs()(i,"advanced-cropper-handler-wrapper",f&&"advanced-cropper-handler-wrapper--".concat(f),o&&"advanced-cropper-handler-wrapper--disabled")},e.createElement(Es,{className:"advanced-cropper-handler-wrapper__draggable",disabled:o,onMove:a,onMoveEnd:s,onLeave:l,onEnter:c,activationDistance:0},u))},As=function(t){var n,r=t.verticalPosition,i=t.horizontalPosition,o=t.hoverClassName,a=t.wrapperClassName,s=t.defaultClassName,l=t.wrapperStyle,c=t.disabled,u=t.onMove,d=t.onMoveEnd,f=dt((0,e.useState)(!1),2),p=f[0],h=f[1];return e.createElement(Ts,{style:l,className:rs()("advanced-cropper-simple-handler-wrapper",a,r&&"advanced-cropper-simple-handler-wrapper--".concat(r),i&&"advanced-cropper-simple-handler-wrapper--".concat(i),i&&r&&"advanced-cropper-simple-handler-wrapper--".concat(i,"-").concat(r),p&&"advanced-cropper-simple-handler-wrapper--hover"),verticalPosition:r,horizontalPosition:i,disabled:c,onDrag:u,onDragEnd:d,onLeave:function(){h(!1)},onEnter:function(){h(!0)}},e.createElement("div",{className:rs()("advanced-cropper-simple-handler",p&&"advanced-cropper-simple-handler--hover",s,p&&o,(n={},n["advanced-cropper-simple-handler--".concat(r)]=!!r,n["advanced-cropper-simple-handler--".concat(i)]=!!i,n["advanced-cropper-simple-handler--".concat(i,"-").concat(r)]=i&&r,n))}))},Os=["east","west",null],Ps=["south","north",null],Ms=function(t){var n=t.style,r=t.className,i=t.children,o=t.onResize,a=t.onResizeEnd,s=t.handlerComponent,l=void 0===s?As:s,c=t.handlers,u=void 0===c?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:c,d=t.handlerClassNames,f=void 0===d?{}:d,p=t.handlerWrapperClassNames,h=void 0===p?{}:p,m=t.lines,g=void 0===m?{west:!0,north:!0,east:!0,south:!0}:m,v=t.lineComponent,y=void 0===v?Cs:v,b=t.lineClassNames,w=void 0===b?{}:b,x=t.lineWrapperClassNames,_=void 0===x?{}:x,k=t.disabled,E=void 0!==k&&k,S=t.reference,C=void 0===S?null:S,T=dt((0,e.useState)(null),2),A=T[0],O=T[1],P=(0,e.useMemo)((function(){var e=[];return Os.forEach((function(t){Ps.forEach((function(n){if(t!==n){var r=Ji(t,n),i=r.snakeCase,o=r.camelCase;i&&o&&e.push({name:o,className:i,verticalPosition:n,horizontalPosition:t})}}))})),e}),[]),M=(0,e.useMemo)((function(){var e=[];return P.forEach((function(t){wo(t.name)&&(oo(g)?g[t.name]:g)&&e.push({name:t.name,component:y,className:rs()(w.default,w[t.name],E&&w.disabled),wrapperClassName:rs()("advanced-cropper-bounding-box__line","advanced-cropper-bounding-box__line--".concat(t.name),_.default,_[t.name],E&&_.disabled),hoverClassName:w.hover,verticalPosition:t.verticalPosition,horizontalPosition:t.horizontalPosition,disabled:E})})),e}),[P,g,y,w,_,E]),N=(0,e.useMemo)((function(){var e=[];return P.forEach((function(t){(oo(u)?u[t.name]:u)&&e.push({name:t.name,component:l,className:rs()(f.default,f[t.name]),containerClassName:rs()("advanced-cropper-bounding-box__handler-wrapper","advanced-cropper-bounding-box__handler-wrapper--".concat(t.className)),wrapperClassName:rs()("advanced-cropper-bounding-box__handler","advanced-cropper-bounding-box__handler--".concat(t.className),h.default,h[t.name]),hoverClassName:f.hover,verticalPosition:t.verticalPosition,horizontalPosition:t.horizontalPosition,disabled:E})})),e}),[P,u,l,f,h,E]),L=function(e,t){return function(n,r){var i,a={left:n.left,top:n.top};if(!t&&e?i="width":t&&!e&&(i="height"),!E){if(o){var s=Ji(e,t).camelCase;s&&o(s,a,{reference:A||C,preserveAspectRatio:r&&r.shiftKey,respectDirection:i,compensate:!0})}A||O(C)}}},I=function(){null==a||a(),O(null)};return e.createElement("div",{className:rs()("advanced-cropper-bounding-box",r),style:n},i,e.createElement("div",null,M.map((function(t){return e.createElement(t.component,{key:t.name,defaultClassName:t.className,hoverClassName:t.hoverClassName,wrapperClassName:t.wrapperClassName,position:t.name,disabled:t.disabled,onMove:L(t.horizontalPosition,t.verticalPosition),onMoveEnd:I})}))),e.createElement("div",null,N.map((function(t){var n=e.createElement(t.component,{defaultClassName:t.className,hoverClassName:t.hoverClassName,wrapperClassName:t.wrapperClassName,horizontalPosition:t.horizontalPosition,verticalPosition:t.verticalPosition,disabled:t.disabled,onMove:L(t.horizontalPosition,t.verticalPosition),onMoveEnd:I});return e.createElement("div",{key:t.name,className:t.containerClassName},n)}))))},Ns=function(t){var n=t.className,r=t.children;return e.createElement("div",{className:rs()("advanced-cropper-stencil-overlay",n)},r)};var Ls=function(t){var n=t.className,r=t.transitions,i=t.children,o=lt(t,["className","transitions","children"]),a=(0,e.useRef)(null),s=(0,e.useRef)(o),l=dt((0,e.useState)(o),2),c=l[0],u=l[1],d=dt(function(t){void 0===t&&(t=null);var n=(0,e.useRef)(new Qa),r=dt((0,e.useState)(!1),2),i=r[0],o=r[1];return[function(e){t&&t.active?n.current.start(st(st({},t),{onStart:function(){o(!0)},onProgress:function(t){e(t)},onStop:function(){o(!1)}})):n.current.active||e(1)},i]}(r),2),f=d[0],p=d[1];(0,e.useLayoutEffect)((function(){if(!bo(c,o)){u(o);var e=p?st({},s.current):c;f((function(t){["left","top","height","width"].forEach((function(n){var r=o[n],i=e[n];s.current[n]=co(i)&&co(r)?i+(r-i)*t:r})),a.current&&(a.current.style.width="".concat(s.current.width,"px"),a.current.style.height="".concat(s.current.height,"px"),a.current.style.transform="translate3d(".concat(s.current.left,"px, ").concat(s.current.top,"px, 0px)"))}))}}),[c,p,o.width,o.height,o.top,o.left]);var h=p?s.current:o,m={left:0,top:0,width:"".concat(h.width,"px"),height:"".concat(h.height,"px"),transform:"translate3d(".concat(h.left,"px, ").concat(h.top,"px, 0px)")};return e.createElement("div",{ref:a,className:rs()("advanced-cropper-artificial-transition",n),style:m},i)},Is=function(t){var n=t.className,r=t.transitions,i=t.width,o=t.height,a=t.left,s=t.top,l=t.children;return e.createElement(Ls,{className:rs()("advanced-cropper-stencil-wrapper",n),transitions:r,width:i,height:o,top:s,left:a},l)},Ds=function(t){var n=t.columns,r=void 0===n?3:n,i=t.rows,o=void 0===i?3:i,a=t.visible,s=void 0!==a&&a,l=t.className,c=[],u=dt((0,e.useState)(r),2),d=u[0],f=u[1],p=dt((0,e.useState)(o),2),h=p[0],m=p[1];fs((function(){s&&(m(o),f(r))}),[s,r,o]);for(var g=0;g<h;g++){for(var v=[],y=0;y<d;y++)v.push(e.createElement("div",{key:y,className:rs()("advanced-cropper-stencil-grid__cell",0===g&&"advanced-cropper-stencil-grid__cell--top",g===h-1&&"advanced-cropper-stencil-grid__cell--bottom",0===y&&"advanced-cropper-stencil-grid__cell--left",y===d-1&&"advanced-cropper-stencil-grid__cell--right")}));c.push(e.createElement("div",{key:g,className:"advanced-cropper-stencil-grid__row"},v))}return e.createElement("div",{className:rs()("advanced-cropper-stencil-grid",s&&"advanced-cropper-stencil-grid--visible",l)},c)},Rs=(0,e.forwardRef)((function(t,n){var r=t.cropper,i=t.coordinates,o=t.aspectRatio,a=t.minAspectRatio,s=t.maxAspectRatio,l=t.handlerComponent,c=void 0===l?As:l,u=t.handlers,d=void 0===u?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:u,f=t.handlerClassNames,p=void 0===f?{}:f,h=t.handlerWrapperClassNames,m=void 0===h?{}:h,g=t.lines,v=void 0===g?{west:!0,north:!0,east:!0,south:!0}:g,y=t.lineComponent,b=void 0===y?Cs:y,w=t.lineClassNames,x=void 0===w?{}:w,_=t.lineWrapperClassNames,k=void 0===_?{}:_,E=t.resizable,S=void 0===E||E,C=t.movable,T=void 0===C||C,A=t.grid,O=t.gridClassName,P=t.className,M=t.movingClassName,N=t.resizingClassName,L=t.previewClassName,I=t.boundingBoxClassName,D=t.overlayClassName,R=t.draggableAreaClassName,B=r.getState(),j=r.getTransitions(),z=r.getInteractions();(0,e.useImperativeHandle)(n,(function(){return{aspectRatio:Zo(o||{minimum:a,maximum:s})}}));var U=i?ro(i)?i(B):i:oa(B),F=U.width,W=U.height,H=U.left,V=U.top;return B&&e.createElement(Is,{className:rs()("advanced-cropper-rectangle-stencil",P,z.moveCoordinates&&M,z.resizeCoordinates&&N,{"advanced-cropper-rectangle-stencil--movable":T,"advanced-cropper-rectangle-stencil--moving":z.moveCoordinates,"advanced-cropper-rectangle-stencil--resizable":S,"advanced-cropper-rectangle-stencil--resizing":z.resizeCoordinates}),width:F,height:W,left:H,top:V,transitions:j},e.createElement(Ms,{reference:B.coordinates,className:rs()(I,"advanced-cropper-rectangle-stencil__bounding-box"),handlers:d,handlerComponent:c,handlerClassNames:p,handlerWrapperClassNames:m,lines:v,lineComponent:b,lineClassNames:x,lineWrapperClassNames:k,onResize:function(e,t,n){r&&S&&r.resizeCoordinates(e,t,n)},onResizeEnd:function(){r&&r.resizeCoordinatesEnd()},disabled:!S},e.createElement(Es,{disabled:!T,onMove:function(e){r&&T&&r.moveCoordinates(e)},onMoveEnd:function(){r&&r.moveCoordinatesEnd()},className:rs()("advanced-cropper-rectangle-stencil__draggable-area",R)},e.createElement(Ns,{className:rs()("advanced-cropper-rectangle-stencil__overlay",D)},A&&e.createElement(Ds,{visible:r.hasInteractions(),columns:z.transformImage.rotate?9:3,rows:z.transformImage.rotate?9:3,className:rs()("advanced-cropper-rectangle-stencil__grid",O)}),e.createElement("div",{className:rs()("advanced-cropper-rectangle-stencil__preview",L)})))))}));Rs.displayName="RectangleStencil";var Bs,js=function(){function e(e){var t=e.active;this.active=t,this.defaultPrevented=!1}return e.prototype.preventDefault=function(){this.defaultPrevented=!0},e}(),zs=function(t){function n(n){var r=t.call(this,n)||this;return r.processMove=function(e){var t=r.props,n=t.onTransform,i=t.touchScale,o=t.touchMove,a=t.touchRotate,s=r.container.current;s&&n&&(n(function(e,t,n,r){var i,o,a;if(void 0===r&&(r={}),1===t.length&&1===e.length)r.move&&(i={left:t[0].clientX-e[0].clientX,top:t[0].clientY-e[0].clientY});else if(e.length>1){var s=Ja(t,n),l=Ja(e,n);if(r.rotate&&2===t.length&&2===e.length){var c={left:[e[0].clientX-e[1].clientX,t[0].clientX-t[1].clientX],top:[e[0].clientY-e[1].clientY,t[0].clientY-t[1].clientY]},u=c.left[0]*c.top[1]-c.left[1]*c.top[0],d=c.left[0]*c.left[1]+c.top[0]*c.top[1];if(!ho(d,0)&&!ho(u,0)){var f=-180*Math.atan2(u,d)/Math.PI;a={center:l.centerMass,angle:f}}}r.move&&(i={left:s.centerMass.left-l.centerMass.left,top:s.centerMass.top-l.centerMass.top}),r.scale&&(o={factor:l.spread/s.spread,center:l.centerMass})}return{move:i,scale:o,rotate:a}}(e,r.touches,s,{scale:i,rotate:a,move:o})),r.touches=e)},r.processEnd=function(){var e=r.props.onTransformEnd;r.transforming&&(r.transforming=!1,e&&e())},r.processStart=function(){r.transforming=!0,r.debouncedProcessEnd.clear()},r.processEvent=function(e){var t=r.props,n=t.onEvent,i=t.disabled,o=new js({active:r.transforming});return n?n(o,e):(e.preventDefault(),e.stopPropagation()),!i&&!o.defaultPrevented},r.onWheel=function(e){var t=r.props,n=t.onTransform,i=t.wheelScale,o=r.container.current;i&&r.processEvent(e)&&(r.processStart(),n&&o&&n(es(e,o,!0===i?.1:i.ratio)),r.touches.length||r.debouncedProcessEnd())},r.onTouchStart=function(e){var t=r.props,n=t.touchMove,i=t.touchScale,o=t.touchRotate;if(e.cancelable&&(n||(i||o)&&e.touches.length>1)&&r.processEvent(e)){var a=r.container.current;if(a){var s=a.getBoundingClientRect(),l=s.left,c=s.top,u=s.bottom,d=s.right;r.touches=Array.from(e.touches).filter((function(e){return e.clientX>l&&e.clientX<d&&e.clientY>c&&e.clientY<u}))}}},r.onTouchEnd=function(e){0===e.touches.length&&(r.touches=[],r.processEnd())},r.onTouchMove=function(e){if(r.touches.length){var t=pt([],dt(e.touches),!1).filter((function(e){return!e.identifier||r.touches.find((function(t){return t.identifier===e.identifier}))}));r.processEvent(e)&&(r.processMove(t),r.processStart())}},r.onMouseDown=function(e){if(r.props.mouseMove&&"buttons"in e&&1===e.buttons&&r.processEvent(e)){var t={clientX:e.clientX,clientY:e.clientY};r.touches=[t],r.processStart()}},r.onMouseMove=function(e){r.touches.length&&r.processEvent(e)&&r.processMove([{clientX:e.clientX,clientY:e.clientY}])},r.onMouseUp=function(){r.touches=[],r.processEnd()},r.transforming=!1,r.touches=[],r.anchor={left:0,top:0},r.container=(0,e.createRef)(),r.debouncedProcessEnd=xo(r.processEnd,n.timeout),r}return at(n,t),n.prototype.shouldComponentUpdate=function(){return!0},n.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var e=this.container.current;e&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("wheel",this.onWheel))},n.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var e=this.container.current;e&&(e.addEventListener("touchstart",this.onTouchStart,{passive:!1}),e.addEventListener("mousedown",this.onMouseDown,{passive:!1}),e.addEventListener("wheel",this.onWheel,{passive:!1}))},n.prototype.render=function(){var t=this.props,n=t.className,r=t.children,i=t.style;return e.createElement("div",{className:n,style:i,ref:this.container},r)},n.defaultProps={touchMove:!0,mouseMove:!0,touchScale:!0,touchRotate:!1,wheelScale:!0,timeout:500},n}(e.Component),Us=function(t){var n=t.scaleImage,r=void 0===n||n,i=t.moveImage,o=void 0===i||i,a=t.rotateImage,s=void 0!==a&&a,l=t.children,c=t.className,u=t.style,d=t.cropper,f=t.timeout,p=d.getTransitions(),h=function(t){return(0,e.useMemo)((function(){return ao(t,{touch:!0},{touch:!1})}),[t])}(s),m=function(t){return(0,e.useMemo)((function(){return ao(t,{touch:!0,wheel:{ratio:.1}},{touch:!1,wheel:!1})}),[t])}(r),g=function(t){return(0,e.useMemo)((function(){return ao(t,{touch:!0,mouse:!0},{touch:!1,mouse:!1})}),[t])}(o);return e.createElement(zs,{className:c,style:u,onTransform:d.transformImage,onTransformEnd:d.transformImageEnd,touchMove:g.touch,mouseMove:g.mouse,touchScale:m.touch,wheelScale:m.wheel,touchRotate:h.touch,disabled:p.active,timeout:f},l)},Fs=(Bs=function(t,n){var r=t.style,i=t.className,o=t.stencilComponent,a=void 0===o?Rs:o,s=t.stencilConstraints,l=void 0===s?ts:s,c=t.stencilProps,u=void 0===c?{}:c,d=t.wrapperComponent,f=void 0===d?ws:d,p=t.wrapperProps,h=void 0===p?{}:p,m=t.backgroundComponent,g=void 0===m?_s:m,v=t.backgroundProps,y=void 0===v?{}:v,b=t.backgroundClassName,w=t.backgroundWrapperComponent,x=void 0===w?Us:w,_=t.backgroundWrapperProps,k=void 0===_?{}:_,E=t.boundaryComponent,S=void 0===E?ys:E,C=t.boundaryProps,T=t.boundaryClassName,A=t.canvas,O=void 0===A||A,P=t.crossOrigin,M=void 0===P||P,N=t.settings,L=lt(t,["style","className","stencilComponent","stencilConstraints","stencilProps","wrapperComponent","wrapperProps","backgroundComponent","backgroundProps","backgroundClassName","backgroundWrapperComponent","backgroundWrapperProps","boundaryComponent","boundaryProps","boundaryClassName","canvas","crossOrigin","settings"]),I=(0,e.useRef)(null),D=vs((function(){return st(st({},L),{crossOrigin:M,stencilProps:u,canvas:O,settings:st(st({},N),l(N,st(st({},u),I.current)))})})),R=D.cropper,B=D.image,j=D.refs,z=a,U=f,F=x,W=g,H=S;(0,e.useImperativeHandle)(n,(function(){return R}));var V={loading:R.isLoading(),loaded:R.isLoaded()};return e.createElement(U,st({},h,{className:rs()("advanced-cropper",i),cropper:R,style:r},V),e.createElement(H,st({},C,{ref:j.boundary,className:rs()("advanced-cropper__boundary",T)}),e.createElement(F,st({},k,{cropper:R,className:"advanced-cropper__background-wrapper"}),R.getState()&&e.createElement(W,st({},y,{ref:j.image,crossOrigin:M,cropper:R,className:rs()("advanced-cropper__background",b)})),e.createElement(z,st({},u,{ref:I,cropper:R,image:B}))),O&&e.createElement(ks,{ref:j.canvas})))},(0,e.forwardRef)(Bs)),Ws=["transformImage","moveCoordinates","resizeCoordinates","defaultCoordinates","defaultVisibleArea","areaPositionRestrictions","areaSizeRestrictions","sizeRestrictions","positionRestrictions","aspectRatio","minWidth","minHeight","maxWidth","maxHeight","defaultSize","defaultPosition","defaultTransforms","imageRestriction","priority"];function Hs(e,t){void 0===t&&(t=Ws);var n={settings:{},props:{}};return Object.keys(e).forEach((function(r){t.some((function(e){return e===r}))?n.settings[r]=e[r]:n.props[r]=e[r]})),n}var Vs=(0,e.forwardRef)((function(t,n){var r=Hs(t,pt(pt([],dt(Ws),!1),["stencilSize"],!1));return e.createElement(Fs,st({postProcess:cs,stencilConstraints:is},r.props,{settings:st(st({defaultSize:ss,aspectRatio:ls,sizeRestrictions:ja(as)},r.settings),{transformImage:st(st({},r.settings.transformImage),{adjustStencil:!1})}),ref:n}))}));Vs.displayName="FixedCropper";var qs=(0,e.forwardRef)((function(t,n){var r=Hs(t),i=r.props,o=r.settings,a=o.stencilSize,s=o.autoZoom,l=lt(o,["stencilSize","autoZoom"]),c=ds();return io(s)||(i.postProcess||a?c("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function."):(c("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function. The 'postProcess' automatically set to 'hybridAutoZoom'"),i.postProcess=us)),io(a)?e.createElement(Fs,st({},i,{ref:n,settings:l})):(c("prop 'stencilSize' is deprecated for <Cropper/> component now and will be removed, use <FixedCropper/> component instead."),e.createElement(Vs,st({ref:n,stencilSize:a},l,i)))}));qs.displayName="CropperComponent";var Gs=(0,e.forwardRef)((function(t,n){var r=t.cropper,i=t.coordinates,o=t.handlerComponent,a=void 0===o?As:o,s=t.handlers,l=void 0===s?{eastNorth:!0,westNorth:!0,westSouth:!0,eastSouth:!0}:s,c=t.handlerClassNames,u=void 0===c?{}:c,d=t.handlerWrapperClassNames,f=void 0===d?{}:d,p=t.lines,h=void 0===p?{west:!0,north:!0,east:!0,south:!0}:p,m=t.lineComponent,g=void 0===m?Cs:m,v=t.lineClassNames,y=void 0===v?{}:v,b=t.lineWrapperClassNames,w=void 0===b?{}:b,x=t.resizable,_=void 0===x||x,k=t.movable,E=void 0===k||k,S=t.grid,C=t.gridClassName,T=t.className,A=t.movingClassName,O=t.resizingClassName,P=t.previewClassName,M=t.boundingBoxClassName,N=t.overlayClassName,L=t.draggableAreaClassName,I=r.getState(),D=r.getTransitions(),R=r.getInteractions();(0,e.useImperativeHandle)(n,(function(){return{aspectRatio:1,boundingBox:"circle"}}));var B=i?ro(i)?i(I):i:oa(I),j=B.width,z=B.height,U=B.left,F=B.top;return I&&e.createElement(Is,{className:rs()("advanced-cropper-circle-stencil",T,R.moveCoordinates&&A,R.resizeCoordinates&&O,{"advanced-cropper-circle-stencil--movable":E,"advanced-cropper-circle-stencil--moving":R.moveCoordinates,"advanced-cropper-circle-stencil--resizable":_,"advanced-cropper-circle-stencil--resizing":R.resizeCoordinates}),width:j,height:z,left:U,top:F,transitions:D},e.createElement(Ms,{reference:I.coordinates,className:rs()(M,"advanced-cropper-circle-stencil__bounding-box"),handlers:l,handlerComponent:a,handlerClassNames:u,handlerWrapperClassNames:f,lines:h,lineComponent:g,lineClassNames:y,lineWrapperClassNames:w,onResize:function(e,t,n){r&&_&&r.resizeCoordinates(e,t,n)},onResizeEnd:function(){r&&r.resizeCoordinatesEnd()},disabled:!_},e.createElement(Es,{disabled:!E,onMove:function(e){r&&E&&r.moveCoordinates(e)},onMoveEnd:function(){r&&r.moveCoordinatesEnd()},className:rs()("advanced-cropper-circle-stencil__draggable-area",L)},e.createElement(Ns,{className:rs()("advanced-cropper-circle-stencil__overlay",N)},S&&e.createElement(Ds,{visible:r.hasInteractions(),columns:R.transformImage.rotate?9:3,rows:R.transformImage.rotate?9:3,className:rs()("advanced-cropper-circle-stencil__grid",C)}),e.createElement("div",{className:rs()("advanced-cropper-circle-stencil__preview",P)})))))}));Gs.displayName="CircleStencil",(0,e.forwardRef)((function(t,n){var r=t.src,i=t.crossOrigin,o=void 0===i||i,a=lt(t,["src","crossOrigin"]);return r?e.createElement("img",st({key:r,ref:n,src:r,className:rs()("advanced-cropper-source"),crossOrigin:!0===o?"anonymous":o||void 0},a)):null})).displayName="CropperSource";var $s=function(t){var n=t.children,r=t.cropper,i=t.className,o=t.style;return e.createElement("div",{className:rs()(i,"cropper-preview-wrapper"),style:o},e.createElement(bs,{visible:null==r?void 0:r.isLoaded(),className:"cropper-preview-wrapper__fade"},n))},Zs=function(t){var n=t.className,r=t.cropper,i=t.crossOrigin,o=void 0===i||i,a=t.size,s=t.style,l=r.getState(),c=r.getTransitions(),u=r.getImage(),d=a&&u&&(null==l?void 0:l.coordinates)?function(e,t,n,r){return void 0===r&&(r=null),e&&t&&t.visibleArea&&t.coordinates?Ga(e,t,t.coordinates,Ro(t.coordinates)>Ro(n)?t.coordinates.width/n.width:t.coordinates.height/n.height,r):{}}(u,l,a,c):{},f=u?u.src:void 0;return f?e.createElement("img",{key:f,className:rs()("advanced-cropper-background-image",n),src:f,crossOrigin:!0===o?"anonymous":o||void 0,style:st(st({},d),s),onMouseDown:xs}):null};(0,e.forwardRef)((function(t,n){var r,i,o,a,s=t.className,l=t.contentClassName,c=t.state,u=void 0===c?null:c,d=t.image,f=void 0===d?null:d,p=t.transitions,h=void 0===p?null:p,m=t.backgroundComponent,g=void 0===m?Zs:m,v=t.backgroundProps,y=t.backgroundClassName,b=t.boundaryComponent,w=void 0===b?ys:b,x=t.boundaryProps,_=t.boundaryClassName,k=t.wrapperComponent,E=void 0===k?$s:k,S=t.wrapperProps,C=t.loaded,T=void 0===C||C,A=t.loading,O=void 0!==A&&A,P=t.style,M=t.cropper,N=hs(),L=(0,e.useRef)(null),I=M||{current:{getState:function(){return u},getTransitions:function(){return h},getImage:function(){return f},isLoaded:function(){return T},isLoading:function(){return O}}},D=dt((0,e.useState)(null),2),R=D[0],B=D[1],j=null===(i=null===(r=I.current)||void 0===r?void 0:r.getState())||void 0===i?void 0:i.coordinates,z=null===(a=null===(o=I.current)||void 0===o?void 0:o.getImage())||void 0===a?void 0:a.src,U=R?{width:"".concat(R.width,"px"),height:"".concat(R.height,"px")}:{},F=function(){L.current&&j&&L.current.stretchTo(j).then((function(e){e&&j?mo(Ro(j),Ro(e))?B({width:e.width,height:e.width/Ro(j)}):B({width:e.height*Ro(j),height:e.height}):B(null)})),N()};gs(F),(0,e.useLayoutEffect)(F,[null==j?void 0:j.height,null==j?void 0:j.width]),(0,e.useImperativeHandle)(n,(function(){return{refresh:N}}));var W=E,H=g,V=w;return e.createElement(W,st({},S,{className:rs()(s,"advanced-cropper-preview"),cropper:I.current,style:P}),e.createElement(V,st({ref:L,stretchAlgorithm:Za},x,{className:rs()("advanced-cropper-preview__boundary",_)}),e.createElement("div",{className:rs()(l,"advanced-cropper-preview__content"),style:U},I.current&&e.createElement(H,st({},v,{cropper:I.current,size:R,className:rs()(y,"advanced-cropper-preview__image",z&&"advanced-cropper-preview__image--visible")})))))}));var Ys=i(3516),Xs={};Xs.styleTagTransform=m(),Xs.setAttributes=d(),Xs.insert=c().bind(null,"head"),Xs.domAPI=s(),Xs.insertStyleElement=p();o()(Ys.Z,Xs);Ys.Z&&Ys.Z.locals&&Ys.Z.locals;function Ks(e){return Ks="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(e)}function Qs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Js(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qs(Object(n),!0).forEach((function(t){el(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function el(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ks(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ks(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ks(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return nl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nl(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const rl=function(){var t=tl((0,e.useContext)(F),2),n=t[0],r=t[1],i=tl((0,e.useState)(null),2),o=i[0],a=i[1],s=(0,e.useRef)(null);(0,e.useEffect)((function(){s.current&&s.current.getCoordinates()&&(n.fromCropper||(s.current.setCoordinates({top:n.top,left:n.left,width:n.width,height:n.height}),n.top!=s.current.getCoordinates().top&&r((function(e){return Js(Js({},e),{},{top:s.current.getCoordinates().top})})),n.left!=s.current.getCoordinates().left&&r((function(e){return Js(Js({},e),{},{left:s.current.getCoordinates().left})})),n.width!=s.current.getCoordinates().width&&r((function(e){return Js(Js({},e),{},{width:s.current.getCoordinates().width})})),n.height!=s.current.getCoordinates().height&&r((function(e){return Js(Js({},e),{},{height:s.current.getCoordinates().height})}))))}),[n.width,n.height,n.top,n.left]);return(0,e.useEffect)((function(){n.blob&&a(n.frame)}),[n.frame]),e.createElement("div",null,e.createElement(qs,{src:o,ref:s,onChange:function(e){e&&r((function(t){return Js(Js({},t),{},{top:e.getCoordinates().top,left:e.getCoordinates().left,width:e.getCoordinates().width,height:e.getCoordinates().height,fromCropper:!0})}))},className:"cropper",stencilProps:{grid:!0},defaultSize:{width:n.width,height:n.height},backgroundWrapperClassName:"CropperBackgroundWrapper",width:n.width,height:n.height,transitions:!1,style:{transition:"none"}}))};function il(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ol(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ol(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ol(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const al=function(){var t=il((0,e.useContext)(F),2),n=t[0];t[1];return e.createElement("div",{className:Ai.content},e.createElement("div",{className:Ai.wrap},"audio"===n.mode&&e.createElement(Ki,null),"player"===n.mode&&e.createElement(Ki,null),"crop"===n.mode&&e.createElement(rl,null)),e.createElement(qt,null))};var sl=i(930),ll={};ll.styleTagTransform=m(),ll.setAttributes=d(),ll.insert=c().bind(null,"head"),ll.domAPI=s(),ll.insertStyleElement=p();o()(sl.Z,ll);const cl=sl.Z&&sl.Z.locals?sl.Z.locals:void 0;function ul(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return dl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dl(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const fl=function(){var t=ul((0,e.useContext)(F),2),n=t[0];t[1];return e.createElement("div",{className:cl.layout},"crop"===n.mode&&e.createElement(vn,null),"player"===n.mode&&e.createElement(ln,null),"audio"===n.mode&&e.createElement(Cn,null),e.createElement("div",{className:cl.content},e.createElement(al,null),e.createElement(Si,null)))},pl=t["useId".toString()]||(()=>{});let hl=0;function ml(t){const[n,r]=e.useState(pl());return Qn((()=>{t||r((e=>null!=e?e:String(hl++)))}),[t]),t||(n?`radix-${n}`:"")}const gl="dismissableLayer.update",vl="dismissableLayer.pointerDownOutside",yl="dismissableLayer.focusOutside";let bl;const wl=(0,e.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),xl=(0,e.forwardRef)(((t,n)=>{var r;const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=t,d=(0,e.useContext)(wl),[f,p]=(0,e.useState)(null),h=null!==(r=null==f?void 0:f.ownerDocument)&&void 0!==r?r:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,m]=(0,e.useState)({}),g=qn(n,(e=>p(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=f?v.indexOf(f):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,_=w>=b,k=function(t,n=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const r=Zn(t),i=(0,e.useRef)(!1),o=(0,e.useRef)((()=>{}));return(0,e.useEffect)((()=>{const e=e=>{if(e.target&&!i.current){const t={originalEvent:e};function a(){kl(vl,r,t,{discrete:!0})}"touch"===e.pointerType?(n.removeEventListener("click",o.current),o.current=a,n.addEventListener("click",o.current,{once:!0})):a()}else n.removeEventListener("click",o.current);i.current=!1},t=window.setTimeout((()=>{n.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",o.current)}}),[n,r]),{onPointerDownCapture:()=>i.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(null==a||a(e),null==l||l(e),e.defaultPrevented||null==c||c())}),h),E=function(t,n=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const r=Zn(t),i=(0,e.useRef)(!1);return(0,e.useEffect)((()=>{const e=e=>{if(e.target&&!i.current){kl(yl,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)}),[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(null==s||s(e),null==l||l(e),e.defaultPrevented||null==c||c())}),h);return function(t,n=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const r=Zn(t);(0,e.useEffect)((()=>{const e=e=>{"Escape"===e.key&&r(e)};return n.addEventListener("keydown",e),()=>n.removeEventListener("keydown",e)}),[r,n])}((e=>{w===d.layers.size-1&&(null==o||o(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),(0,e.useEffect)((()=>{if(f)return i&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(bl=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),_l(),()=>{i&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=bl)}}),[f,h,i,d]),(0,e.useEffect)((()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),_l())}),[f,d]),(0,e.useEffect)((()=>{const e=()=>m({});return document.addEventListener(gl,e),()=>document.removeEventListener(gl,e)}),[]),(0,e.createElement)(or.div,rt({},u,{ref:g,style:{pointerEvents:x?_?"auto":"none":void 0,...t.style},onFocusCapture:Hn(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Hn(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Hn(t.onPointerDownCapture,k.onPointerDownCapture)}))}));function _l(){const e=new CustomEvent(gl);document.dispatchEvent(e)}function kl(e,t,r,{discrete:i}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),i?function(e,t){e&&(0,n.flushSync)((()=>e.dispatchEvent(t)))}(o,a):o.dispatchEvent(a)}const El="focusScope.autoFocusOnMount",Sl="focusScope.autoFocusOnUnmount",Cl={bubbles:!1,cancelable:!0},Tl=(0,e.forwardRef)(((t,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=t,[l,c]=(0,e.useState)(null),u=Zn(o),d=Zn(a),f=(0,e.useRef)(null),p=qn(n,(e=>c(e))),h=(0,e.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,e.useEffect)((()=>{if(i){function e(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?f.current=t:Ml(f.current,{select:!0})}function t(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Ml(f.current,{select:!0}))}function n(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Ml(l)}document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[i,l,h.paused]),(0,e.useEffect)((()=>{if(l){Nl.add(h);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(El,Cl);l.addEventListener(El,u),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ml(r,{select:t}),document.activeElement!==n)return}((e=Al(l),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Ml(l))}return()=>{l.removeEventListener(El,u),setTimeout((()=>{const e=new CustomEvent(Sl,Cl);l.addEventListener(Sl,d),l.dispatchEvent(e),e.defaultPrevented||Ml(null!=t?t:document.body,{select:!0}),l.removeEventListener(Sl,d),Nl.remove(h)}),0)}}var e}),[l,u,d,h]);const m=(0,e.useCallback)((e=>{if(!r&&!i)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[i,o]=function(e){const t=Al(e),n=Ol(t,e),r=Ol(t.reverse(),e);return[n,r]}(t);i&&o?e.shiftKey||n!==o?e.shiftKey&&n===i&&(e.preventDefault(),r&&Ml(o,{select:!0})):(e.preventDefault(),r&&Ml(i,{select:!0})):n===t&&e.preventDefault()}}),[r,i,h.paused]);return(0,e.createElement)(or.div,rt({tabIndex:-1},s,{ref:p,onKeyDown:m}))}));function Al(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ol(e,t){for(const n of e)if(!Pl(n,{upTo:t}))return n}function Pl(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Ml(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const Nl=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=Ll(e,t),e.unshift(t)},remove(t){var n;e=Ll(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function Ll(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}const Il=(0,e.forwardRef)(((t,r)=>{var i;const{container:o=(null===globalThis||void 0===globalThis||null===(i=globalThis.document)||void 0===i?void 0:i.body),...a}=t;return o?n.createPortal((0,e.createElement)(or.div,rt({},a,{ref:r})),o):null}));const Dl=t=>{const{present:r,children:i}=t,o=function(t){const[r,i]=(0,e.useState)(),o=(0,e.useRef)({}),a=(0,e.useRef)(t),s=(0,e.useRef)("none"),l=t?"mounted":"unmounted",[c,u]=function(t,n){return(0,e.useReducer)(((e,t)=>{const r=n[e][t];return null!=r?r:e}),t)}(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,e.useEffect)((()=>{const e=Rl(o.current);s.current="mounted"===c?e:"none"}),[c]),Qn((()=>{const e=o.current,n=a.current;if(n!==t){const r=s.current,i=Rl(e);if(t)u("MOUNT");else if("none"===i||"none"===(null==e?void 0:e.display))u("UNMOUNT");else{u(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}a.current=t}}),[t,u]),Qn((()=>{if(r){const e=e=>{const t=Rl(o.current).includes(e.animationName);e.target===r&&t&&(0,n.flushSync)((()=>u("ANIMATION_END")))},t=e=>{e.target===r&&(s.current=Rl(o.current))};return r.addEventListener("animationstart",t),r.addEventListener("animationcancel",e),r.addEventListener("animationend",e),()=>{r.removeEventListener("animationstart",t),r.removeEventListener("animationcancel",e),r.removeEventListener("animationend",e)}}u("ANIMATION_END")}),[r,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:(0,e.useCallback)((e=>{e&&(o.current=getComputedStyle(e)),i(e)}),[])}}(r),a="function"==typeof i?i({present:o.isPresent}):e.Children.only(i),s=qn(o.ref,a.ref);return"function"==typeof i||o.isPresent?(0,e.cloneElement)(a,{ref:s}):null};function Rl(e){return(null==e?void 0:e.animationName)||"none"}Dl.displayName="Presence";let Bl=0;function jl(){(0,e.useEffect)((()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:zl()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:zl()),Bl++,()=>{1===Bl&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),Bl--}}),[])}function zl(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Ul="right-scroll-bar-position",Fl="width-before-scroll-bar";function Wl(t,n){return r=n||null,i=function(e){return t.forEach((function(t){return function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}(t,e)}))},(o=(0,e.useState)((function(){return{value:r,callback:i,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}}))[0]).callback=i,o.facade;var r,i,o}function Hl(e){return e}function Vl(e,t){void 0===t&&(t=Hl);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter((function(e){return e!==i}))}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var o=function(){var n=t;t=[],n.forEach(e)},a=function(){return Promise.resolve().then(o)};a(),n={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),n}}}}}var ql=function(e){void 0===e&&(e={});var t=Vl(null);return t.options=st({async:!0,ssr:!1},e),t}(),Gl=function(){},$l=e.forwardRef((function(t,n){var r=e.useRef(null),i=e.useState({onScrollCapture:Gl,onWheelCapture:Gl,onTouchMoveCapture:Gl}),o=i[0],a=i[1],s=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,p=t.sideCar,h=t.noIsolation,m=t.inert,g=t.allowPinchZoom,v=t.as,y=void 0===v?"div":v,b=lt(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),w=p,x=Wl([r,n]),_=st(st({},b),o);return e.createElement(e.Fragment,null,d&&e.createElement(w,{sideCar:ql,removeScrollBar:u,shards:f,noIsolation:h,inert:m,setCallbacks:a,allowPinchZoom:!!g,lockRef:r}),s?e.cloneElement(e.Children.only(l),st(st({},_),{ref:x})):e.createElement(y,st({},_,{className:c,ref:x}),l))}));$l.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},$l.classNames={fullWidth:Fl,zeroRight:Ul};var Zl,Yl=function(t){var n=t.sideCar,r=lt(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return e.createElement(i,st({},r))};Yl.isSideCarExport=!0;function Xl(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Zl||i.nc;return t&&e.setAttribute("nonce",t),e}var Kl=function(){var e=0,t=null;return{add:function(n){var r,i;0==e&&(t=Xl())&&(i=n,(r=t).styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ql=function(){var t,n=(t=Kl(),function(n,r){e.useEffect((function(){return t.add(n),function(){t.remove()}}),[n&&r])});return function(e){var t=e.styles,r=e.dynamic;return n(t,r),null}},Jl={left:0,top:0,right:0,gap:0},ec=function(e){return parseInt(e||"",10)||0},tc=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Jl;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[ec(n),ec(r),ec(i)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},nc=Ql(),rc=function(e,t,n,r){var i=e.left,o=e.top,a=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(a,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Ul," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Fl," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Ul," .").concat(Ul," {\n right: 0 ").concat(r,";\n }\n \n .").concat(Fl," .").concat(Fl," {\n margin-right: 0 ").concat(r,";\n }\n \n body {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},ic=function(t){var n=t.noRelative,r=t.noImportant,i=t.gapMode,o=void 0===i?"margin":i,a=e.useMemo((function(){return tc(o)}),[o]);return e.createElement(nc,{styles:rc(a,!n,o,r?"":"!important")})},oc=!1;if("undefined"!=typeof window)try{var ac=Object.defineProperty({},"passive",{get:function(){return oc=!0,!0}});window.addEventListener("test",ac,ac),window.removeEventListener("test",ac,ac)}catch(e){oc=!1}var sc=!!oc&&{passive:!1},lc=function(e,t){var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},cc=function(e,t){var n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),uc(e,n)){var r=dc(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},uc=function(e,t){return"v"===e?function(e){return lc(e,"overflowY")}(t):function(e){return lc(e,"overflowX")}(t)},dc=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},fc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pc=function(e){return[e.deltaX,e.deltaY]},hc=function(e){return e&&"current"in e?e.current:e},mc=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},gc=0,vc=[];const yc=(bc=function(t){var n=e.useRef([]),r=e.useRef([0,0]),i=e.useRef(),o=e.useState(gc++)[0],a=e.useState((function(){return Ql()}))[0],s=e.useRef(t);e.useEffect((function(){s.current=t}),[t]),e.useEffect((function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var e=pt([t.lockRef.current],(t.shards||[]).map(hc),!0).filter(Boolean);return e.forEach((function(e){return e.classList.add("allow-interactivity-".concat(o))})),function(){document.body.classList.remove("block-interactivity-".concat(o)),e.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(o))}))}}}),[t.inert,t.lockRef.current,t.shards]);var l=e.useCallback((function(e,t){if("touches"in e&&2===e.touches.length)return!s.current.allowPinchZoom;var n,o=fc(e),a=r.current,l="deltaX"in e?e.deltaX:a[0]-o[0],c="deltaY"in e?e.deltaY:a[1]-o[1],u=e.target,d=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=cc(d,u);if(!f)return!0;if(f?n=d:(n="v"===d?"h":"v",f=cc(d,u)),!f)return!1;if(!i.current&&"changedTouches"in e&&(l||c)&&(i.current=n),!n)return!0;var p=i.current||n;return function(e,t,n,r,i){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=o*r,s=n.target,l=t.contains(s),c=!1,u=a>0,d=0,f=0;do{var p=dc(e,s),h=p[0],m=p[1]-p[2]-o*h;(h||m)&&uc(e,s)&&(d+=m,f+=h),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(i&&0===d||!i&&a>d)||!u&&(i&&0===f||!i&&-a>f))&&(c=!0),c}(p,t,e,"h"===p?l:c,!0)}),[]),c=e.useCallback((function(e){var t=e;if(vc.length&&vc[vc.length-1]===a){var r="deltaY"in t?pc(t):fc(t),i=n.current.filter((function(e){return e.name===t.type&&e.target===t.target&&(n=e.delta,i=r,n[0]===i[0]&&n[1]===i[1]);var n,i}))[0];if(i&&i.should)t.cancelable&&t.preventDefault();else if(!i){var o=(s.current.shards||[]).map(hc).filter(Boolean).filter((function(e){return e.contains(t.target)}));(o.length>0?l(t,o[0]):!s.current.noIsolation)&&t.cancelable&&t.preventDefault()}}}),[]),u=e.useCallback((function(e,t,r,i){var o={name:e,delta:t,target:r,should:i};n.current.push(o),setTimeout((function(){n.current=n.current.filter((function(e){return e!==o}))}),1)}),[]),d=e.useCallback((function(e){r.current=fc(e),i.current=void 0}),[]),f=e.useCallback((function(e){u(e.type,pc(e),e.target,l(e,t.lockRef.current))}),[]),p=e.useCallback((function(e){u(e.type,fc(e),e.target,l(e,t.lockRef.current))}),[]);e.useEffect((function(){return vc.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,sc),document.addEventListener("touchmove",c,sc),document.addEventListener("touchstart",d,sc),function(){vc=vc.filter((function(e){return e!==a})),document.removeEventListener("wheel",c,sc),document.removeEventListener("touchmove",c,sc),document.removeEventListener("touchstart",d,sc)}}),[]);var h=t.removeScrollBar,m=t.inert;return e.createElement(e.Fragment,null,m?e.createElement(a,{styles:mc(o)}):null,h?e.createElement(ic,{gapMode:"margin"}):null)},ql.useMedium(bc),Yl);var bc,wc=e.forwardRef((function(t,n){return e.createElement($l,st({},t,{ref:n,sideCar:yc}))}));wc.classNames=$l.classNames;const xc=wc;var _c=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},kc=new WeakMap,Ec=new WeakMap,Sc={},Cc=0,Tc=function(e){return e&&(e.host||Tc(e.parentNode))},Ac=function(e,t,n,r){var i=function(e,t){return t.map((function(t){if(e.contains(t))return t;var n=Tc(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)})).filter((function(e){return Boolean(e)}))}(t,Array.isArray(e)?e:[e]);Sc[n]||(Sc[n]=new WeakMap);var o=Sc[n],a=[],s=new Set,l=new Set(i),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};i.forEach(c);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,(function(e){if(s.has(e))u(e);else{var t=e.getAttribute(r),i=null!==t&&"false"!==t,l=(kc.get(e)||0)+1,c=(o.get(e)||0)+1;kc.set(e,l),o.set(e,c),a.push(e),1===l&&i&&Ec.set(e,!0),1===c&&e.setAttribute(n,"true"),i||e.setAttribute(r,"true")}}))};return u(t),s.clear(),Cc++,function(){a.forEach((function(e){var t=kc.get(e)-1,i=o.get(e)-1;kc.set(e,t),o.set(e,i),t||(Ec.has(e)||e.removeAttribute(r),Ec.delete(e)),i||e.removeAttribute(n)})),--Cc||(kc=new WeakMap,kc=new WeakMap,Ec=new WeakMap,Sc={})}},Oc=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||_c(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Ac(r,i,n,"aria-hidden")):function(){return null}};const Pc="Dialog",[Mc,Nc]=Gn(Pc),[Lc,Ic]=Mc(Pc),Dc=t=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:o,onOpenChange:a,modal:s=!0}=t,l=(0,e.useRef)(null),c=(0,e.useRef)(null),[u=!1,d]=Yn({prop:i,defaultProp:o,onChange:a});return(0,e.createElement)(Lc,{scope:n,triggerRef:l,contentRef:c,contentId:ml(),titleId:ml(),descriptionId:ml(),open:u,onOpenChange:d,onOpenToggle:(0,e.useCallback)((()=>d((e=>!e))),[d]),modal:s},r)},Rc="DialogTrigger",Bc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(Rc,r),a=qn(n,o.triggerRef);return(0,e.createElement)(or.button,rt({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":nu(o.open)},i,{ref:a,onClick:Hn(t.onClick,o.onOpenToggle)}))})),jc="DialogPortal",[zc,Uc]=Mc(jc,{forceMount:void 0}),Fc=t=>{const{__scopeDialog:n,forceMount:r,children:i,container:o}=t,a=Ic(jc,n);return(0,e.createElement)(zc,{scope:n,forceMount:r},e.Children.map(i,(t=>(0,e.createElement)(Dl,{present:r||a.open},(0,e.createElement)(Il,{asChild:!0,container:o},t)))))},Wc="DialogOverlay",Hc=(0,e.forwardRef)(((t,n)=>{const r=Uc(Wc,t.__scopeDialog),{forceMount:i=r.forceMount,...o}=t,a=Ic(Wc,t.__scopeDialog);return a.modal?(0,e.createElement)(Dl,{present:i||a.open},(0,e.createElement)(Vc,rt({},o,{ref:n}))):null})),Vc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(Wc,r);return(0,e.createElement)(xc,{as:er,allowPinchZoom:!0,shards:[o.contentRef]},(0,e.createElement)(or.div,rt({"data-state":nu(o.open)},i,{ref:n,style:{pointerEvents:"auto",...i.style}})))})),qc="DialogContent",Gc=(0,e.forwardRef)(((t,n)=>{const r=Uc(qc,t.__scopeDialog),{forceMount:i=r.forceMount,...o}=t,a=Ic(qc,t.__scopeDialog);return(0,e.createElement)(Dl,{present:i||a.open},a.modal?(0,e.createElement)($c,rt({},o,{ref:n})):(0,e.createElement)(Zc,rt({},o,{ref:n})))})),$c=(0,e.forwardRef)(((t,n)=>{const r=Ic(qc,t.__scopeDialog),i=(0,e.useRef)(null),o=qn(n,r.contentRef,i);return(0,e.useEffect)((()=>{const e=i.current;if(e)return Oc(e)}),[]),(0,e.createElement)(Yc,rt({},t,{ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hn(t.onCloseAutoFocus,(e=>{var t;e.preventDefault(),null===(t=r.triggerRef.current)||void 0===t||t.focus()})),onPointerDownOutside:Hn(t.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()})),onFocusOutside:Hn(t.onFocusOutside,(e=>e.preventDefault()))}))})),Zc=(0,e.forwardRef)(((t,n)=>{const r=Ic(qc,t.__scopeDialog),i=(0,e.useRef)(!1),o=(0,e.useRef)(!1);return(0,e.createElement)(Yc,rt({},t,{ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{var n,a;(null===(n=t.onCloseAutoFocus)||void 0===n||n.call(t,e),e.defaultPrevented)||(i.current||null===(a=r.triggerRef.current)||void 0===a||a.focus(),e.preventDefault());i.current=!1,o.current=!1},onInteractOutside:e=>{var n,a;null===(n=t.onInteractOutside)||void 0===n||n.call(t,e),e.defaultPrevented||(i.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const s=e.target;(null===(a=r.triggerRef.current)||void 0===a?void 0:a.contains(s))&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}}))})),Yc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,...s}=t,l=Ic(qc,r),c=qn(n,(0,e.useRef)(null));return jl(),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Tl,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:a},(0,e.createElement)(xl,rt({role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":nu(l.open)},s,{ref:c,onDismiss:()=>l.onOpenChange(!1)}))),!1)})),Xc="DialogTitle",Kc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(Xc,r);return(0,e.createElement)(or.h2,rt({id:o.titleId},i,{ref:n}))})),Qc="DialogDescription",Jc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(Qc,r);return(0,e.createElement)(or.p,rt({id:o.descriptionId},i,{ref:n}))})),eu="DialogClose",tu=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(eu,r);return(0,e.createElement)(or.button,rt({type:"button"},i,{ref:n,onClick:Hn(t.onClick,(()=>o.onOpenChange(!1)))}))}));function nu(e){return e?"open":"closed"}const ru="DialogTitleWarning",[iu,ou]=function(t,n){const r=(0,e.createContext)(n);function i(t){const{children:n,...i}=t,o=(0,e.useMemo)((()=>i),Object.values(i));return(0,e.createElement)(r.Provider,{value:o},n)}return i.displayName=t+"Provider",[i,function(i){const o=(0,e.useContext)(r);if(o)return o;if(void 0!==n)return n;throw new Error(`\`${i}\` must be used within \`${t}\``)}]}(ru,{contentName:qc,titleName:Xc,docsSlug:"dialog"}),au=Dc,su=Bc,lu=Fc,cu=Hc,uu=Gc,du=Kc,fu=Jc,pu=tu,hu="AlertDialog",[mu,gu]=Gn(hu,[Nc]),vu=Nc(),yu=t=>{const{__scopeAlertDialog:n,...r}=t,i=vu(n);return(0,e.createElement)(au,rt({},i,r,{modal:!0}))},bu=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(su,rt({},o,i,{ref:n}))})),wu=t=>{const{__scopeAlertDialog:n,...r}=t,i=vu(n);return(0,e.createElement)(lu,rt({},i,r))},xu=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(cu,rt({},o,i,{ref:n}))})),_u="AlertDialogContent",[ku,Eu]=mu(_u),Su=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,children:i,...o}=t,a=vu(r),s=qn(n,(0,e.useRef)(null)),l=(0,e.useRef)(null);return(0,e.createElement)(iu,{contentName:_u,titleName:Cu,docsSlug:"alert-dialog"},(0,e.createElement)(ku,{scope:r,cancelRef:l},(0,e.createElement)(uu,rt({role:"alertdialog"},a,o,{ref:s,onOpenAutoFocus:Hn(o.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=l.current)||void 0===t||t.focus({preventScroll:!0})})),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()}),(0,e.createElement)(nr,null,i),!1)))})),Cu="AlertDialogTitle",Tu=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(du,rt({},o,i,{ref:n}))})),Au=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(fu,rt({},o,i,{ref:n}))})),Ou=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(pu,rt({},o,i,{ref:n}))})),Pu="AlertDialogCancel",Mu=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,{cancelRef:o}=Eu(Pu,r),a=vu(r),s=qn(n,o);return(0,e.createElement)(pu,rt({},a,i,{ref:s}))})),Nu=yu,Lu=bu,Iu=wu,Du=xu,Ru=Su,Bu=Ou,ju=Mu,zu=Tu,Uu=Au;function Fu(e){return Fu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fu(e)}function Wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wu(Object(n),!0).forEach((function(t){Vu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Fu(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Fu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Fu(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Gu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gu(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const $u=function(t){var n=qu((0,e.useContext)(F),2),r=(n[0],n[1]),i=qu((0,e.useState)("Test"),2),o=i[0],a=i[1],s=qu((0,e.useState)("Description here"),2),l=s[0],c=s[1],u=qu((0,e.useState)("Submit"),2),d=u[0],f=u[1],p=qu((0,e.useState)("Cancel"),2),h=p[0],m=p[1],g=qu((0,e.useState)((function(){})),2),v=g[0],y=g[1],b=qu((0,e.useState)((function(){})),2),w=b[0],x=b[1],_=qu((0,e.useState)(!1),2),k=_[0],E=_[1],S=qu((0,e.useState)(null),2),C=S[0],T=S[1],A=qu((0,e.useState)(null),2),O=A[0],P=A[1],M=qu((0,e.useState)((function(){})),2),N=M[0],L=M[1],I=qu((0,e.useState)(!1),2),D=I[0],R=I[1],B=qu((0,e.useState)(!1),2),j=B[0],z=B[1],U=qu((0,e.useState)((function(){})),2),W=U[0],H=U[1],V=(0,e.useCallback)((function(e,t,n,r,i,o){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,d=arguments.length>9&&void 0!==arguments[9]&&arguments[9],p=arguments.length>10&&void 0!==arguments[10]&&arguments[10],h=arguments.length>11&&void 0!==arguments[11]?arguments[11]:function(){};a(e),c(t),f(n),m(r),E(!0),y((function(){return i})),x((function(){return o})),T(s),P(l),L((function(){return u})),R(d),z(p),H((function(){return h}))}));return(0,e.useEffect)((function(){return r((function(e){return Hu(Hu({},e),{},{openModal:V})})),function(){r((function(e){return Hu(Hu({},e),{},{openModal:null})}))}}),[]),e.createElement(Nu,{open:k,onOpenChange:function(e){E(e)}},e.createElement(Lu,{asChild:!0}),e.createElement(Iu,null,e.createElement(Du,{className:"AlertDialogOverlay"}),e.createElement(Ru,{className:"AlertDialogContent"},e.createElement(zu,{className:"AlertDialogTitle"},o),e.createElement(Uu,{className:"AlertDialogDescription"},l,O&&" ",O&&e.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),e.stopPropagation(),N()},target:"_blank"},O)),C&&e.createElement("img",{src:C,style:{width:"100%",marginBottom:15,marginTop:5,borderRadius:"15px"}}),e.createElement("div",{style:{display:"flex",gap:12,justifyContent:"flex-end"}},j&&e.createElement("button",{className:"SideButtonModal",onClick:function(){W(),E(!1)}},j),h&&e.createElement(ju,{asChild:!0},e.createElement("button",{className:"Button grey",onClick:function(){return w()}},h)),d&&e.createElement(Bu,{asChild:!0},e.createElement("button",{className:D?"Button blue":"Button red",onClick:function(){return v()}},d))))))};function Zu(e){return Zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zu(e)}function Yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yu(Object(n),!0).forEach((function(t){Ku(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ku(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Zu(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Zu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Zu(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||Ju(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ju(e,t){if(e){if("string"==typeof e)return ed(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ed(e,t):void 0}}function ed(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const td=function(){var t=Qu((0,e.useContext)(F),2),n=t[0],r=t[1],i=(0,e.useRef)(null),o=(0,e.useRef)("");return(0,e.useEffect)((function(){var e,t=!!(e=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./))&&parseInt(e[2],10);t&&t>110?n.loadFFmpeg():r((function(e){return Xu(Xu({},e),{},{updateChrome:!0,ffmpeg:!0})}))}),[]),(0,e.useEffect)((function(){n.blob&&n.ffmpeg&&(n.frame||n.getFrame())}),[n.blob,n.ffmpeg]),(0,e.useEffect)((function(){if(i&&(i.current&&!(navigator.platform.toUpperCase().indexOf("MAC")>=0))){var e=i.current;e.querySelectorAll("*").forEach((function(e){e.classList.add("screenity-scrollbar")}));var t=new MutationObserver((function(e){var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Ju(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;if("childList"===r.type){var i=Array.from(r.addedNodes),o=Array.from(r.removedNodes);i.forEach((function(e){e.nodeType===Node.ELEMENT_NODE&&e.classList.add("screenity-scrollbar")})),o.forEach((function(e){e.nodeType===Node.ELEMENT_NODE&&e.classList.remove("screenity-scrollbar")}))}}}catch(e){n.e(e)}finally{n.f()}}));return t.observe(e,{childList:!0,subtree:!0}),function(){t.disconnect()}}}),[i.current]),(0,e.useEffect)((function(){n.chunkCount>0&&(o.current="(".concat(Math.min(100,Math.round(n.chunkIndex/n.chunkCount*100)),"%)"))}),[n.chunkIndex,n.chunkCount]),e.createElement("div",{ref:i},e.createElement($u,null),e.createElement("video",null),n.ffmpeg&&n.ready&&"edit"===n.mode&&e.createElement(Qt,null),"edit"!=n.mode&&n.ready&&e.createElement(fl,null),!n.ready&&e.createElement("div",{className:"wrap"},e.createElement("img",{className:"logo",src:"/assets/logo-text.svg"}),e.createElement("div",{className:"middle-area"},e.createElement("img",{src:"/assets/record-tab-active.svg"}),e.createElement("div",{className:"title"},chrome.i18n.getMessage("sandboxProgressTitle")+" "+o.current),e.createElement("div",{className:"subtitle"},chrome.i18n.getMessage("sandboxProgressDescription")),"function"==typeof n.openModal&&e.createElement("div",{className:"button-stop",onClick:function(){n.openModal(chrome.i18n.getMessage("havingIssuesModalTitle"),chrome.i18n.getMessage("havingIssuesModalDescription"),chrome.i18n.getMessage("restoreRecording"),chrome.i18n.getMessage("havingIssuesModalButton2"),(function(){chrome.runtime.sendMessage({type:"restore-recording"})}),(function(){chrome.runtime.sendMessage({type:"report-bug"})}))}},chrome.i18n.getMessage("havingIssuesButton"))),e.createElement(qt,null),e.createElement("div",{className:"setupBackgroundSVG"})),e.createElement("style",null,'\n\t\t\t\t\n\t\t\t\t.wrap {\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t}\n\t\t\t\t.setupBackgroundSVG {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\ttop: 0px;\n\t\t\t\t\tleft: 0px;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbackground: url(/assets/helper/pattern-svg.svg) repeat;\n\t\t\t\t\tbackground-size: 62px 23.5px;\n\t\t\t\t\tanimation: moveBackground 138s linear infinite;\n\t\t\t\t}\n\t\t\t\t.button-stop {\n\t\t\t\t\tpadding: 10px 20px;\n\t\t\t\t\tbackground: #FFF;\n\t\t\t\t\tborder-radius: 30px;\n\t\t\t\t\tcolor: #29292F;\n\t\t\t\t\tfont-size: 14px;\n\t\t\t\t\tfont-weight: 500;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\tmargin-top: 0px;\n\t\t\t\t\tborder: 1px solid #E8E8E8;\n\t\t\t\t\tmargin-left: auto;\n\t\t\t\t\tmargin-right: auto;\n\t\t\t\t\tz-index: 999999;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t@keyframes moveBackground {\n\t\t\t\t\t0% {\n\t\t\t\t\t\tbackground-position: 0 0;\n\t\t\t\t\t}\n\t\t\t\t\t100% {\n\t\t\t\t\t\tbackground-position: 100% 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t.logo {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tbottom: 30px;\n\t\t\t\t\tleft: 0px;\n\t\t\t\t\tright: 0px;\n\t\t\t\t\tmargin: auto;\n\t\t\t\t\twidth: 120px;\n\t\t\t\t}\n\t\t\t\t.wrap {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbackground-color: #F6F7FB;\n\t\t\t\t}\n\t\t\t\t\t.middle-area {\n\t\t\t\t\t\tdisplay: flex;\n\t\t\t\t\t\tflex-direction: column;\n\t\t\t\t\t\talign-items: center;\n\t\t\t\t\t\tjustify-content: center;\n\t\t\t\t\t\theight: 100%;\n\t\t\t\t\t\tfont-family: Satoshi Medium, sans-serif;\n\t\t\t\t\t}\n\t\t\t\t\t.middle-area img {\n\t\t\t\t\t\twidth: 40px;\n\t\t\t\t\t\tmargin-bottom: 20px;\n\t\t\t\t\t}\n\t\t\t\t\t.title {\n\t\t\t\t\t\tfont-size: 24px;\n\t\t\t\t\t\tfont-weight: 700;\n\t\t\t\t\t\tcolor: #1A1A1A;\n\t\t\t\t\t\tmargin-bottom: 14px;\n\t\t\t\t\t\tfont-family: Satoshi-Medium, sans-serif;\n\t\t\t\t\t\ttext-align: center;\n\t\t\t\t\t}\n\t\t\t\t\t.subtitle {\n\t\t\t\t\t\tfont-size: 14px;\n\t\t\t\t\t\tfont-weight: 400;\n\t\t\t\t\t\tcolor: #6E7684;\n\t\t\t\t\t\tmargin-bottom: 24px;\n\t\t\t\t\t\tfont-family: Satoshi-Medium, sans-serif;\n\t\t\t\t\t\ttext-align: center;\n\t\t\t\t\t}\n\n\n.screenity-scrollbar *::-webkit-scrollbar, .screenity-scrollbar::-webkit-scrollbar {\n background-color: rgba(0,0,0,0);\n width: 16px;\n height: 16px;\n z-index: 999999;\n}\n.screenity-scrollbar *::-webkit-scrollbar-track, .screenity-scrollbar::-webkit-scrollbar-track {\n background-color: rgba(0,0,0,0);\n}\n.screenity-scrollbar *::-webkit-scrollbar-thumb, .screenity-scrollbar::-webkit-scrollbar-thumb {\n background-color: rgba(0,0,0,0);\n border-radius:16px;\n border:0px solid #fff;\n}\n.screenity-scrollbar *::-webkit-scrollbar-button, .screenity-scrollbar::-webkit-scrollbar-button {\n display:none;\n}\n.screenity-scrollbar *:hover::-webkit-scrollbar-thumb, .screenity-scrollbar:hover::-webkit-scrollbar-thumb {\n background-color: #a0a0a5;\n border:4px solid #fff;\n}\n::-webkit-scrollbar-thumb *:hover, ::-webkit-scrollbar-thumb:hover {\n background-color:#a0a0a5;\n border:4px solid #f4f4f4\n}\n.videoBanner {\n\theight: 40px!important;\n\twidth: 100%!important;\n\tposition: absolute!important;\n\ttop: 0px!important;\n\tleft: 0px!important;\n\tbackground-color: #3080F8!important;\n\tcolor: #FFF!important;\n\tfont-family: "Satoshi-Medium"!important;\n\tz-index: 99999999999!important;\n\ttext-align: center!important;\n\tdisplay: flex!important;\n\talign-items: center!important;\n\tjustify-content: center!important;\n\tflex-direction: row!important;\n\tgap: 6px!important;\n}\n\t\t\t\t\t\n\t\t\t\t\t'))};(0,n.render)(e.createElement(W,null,e.createElement(td,null)),window.document.querySelector("#app-container"))})()})();
\ No newline at end of file
+ */var n,r,i,o;if("object"==typeof performance&&"function"==typeof performance.now){var a=performance;t.unstable_now=function(){return a.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var c=null,u=null,d=function(){if(null!==c)try{var e=t.unstable_now();c(!0,e),c=null}catch(e){throw setTimeout(d,0),e}};n=function(e){null!==c?setTimeout(n,0,e):(c=e,setTimeout(d,0))},r=function(e,t){u=setTimeout(e,t)},i=function(){clearTimeout(u)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var f=window.setTimeout,p=window.clearTimeout;if("undefined"!=typeof console){var h=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof h&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var m=!1,g=null,v=-1,y=5,b=0;t.unstable_shouldYield=function(){return t.unstable_now()>=b},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):y=0<e?Math.floor(1e3/e):5};var w=new MessageChannel,x=w.port2;w.port1.onmessage=function(){if(null!==g){var e=t.unstable_now();b=e+y;try{g(!0,e)?x.postMessage(null):(m=!1,g=null)}catch(e){throw x.postMessage(null),e}}else m=!1},n=function(e){g=e,m||(m=!0,x.postMessage(null))},r=function(e,n){v=f((function(){e(t.unstable_now())}),n)},i=function(){p(v),v=-1}}function _(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,i=e[r];if(!(void 0!==i&&0<S(i,t)))break e;e[r]=t,e[n]=i,n=r}}function k(e){return void 0===(e=e[0])?null:e}function E(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length;r<i;){var o=2*(r+1)-1,a=e[o],s=o+1,l=e[s];if(void 0!==a&&0>S(a,n))void 0!==l&&0>S(l,a)?(e[r]=l,e[s]=n,r=s):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==l&&0>S(l,n)))break e;e[r]=l,e[s]=n,r=s}}}return t}return null}function S(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var C=[],T=[],A=1,O=null,P=3,M=!1,N=!1,L=!1;function I(e){for(var t=k(T);null!==t;){if(null===t.callback)E(T);else{if(!(t.startTime<=e))break;E(T),t.sortIndex=t.expirationTime,_(C,t)}t=k(T)}}function D(e){if(L=!1,I(e),!N)if(null!==k(C))N=!0,n(R);else{var t=k(T);null!==t&&r(D,t.startTime-e)}}function R(e,n){N=!1,L&&(L=!1,i()),M=!0;var o=P;try{for(I(n),O=k(C);null!==O&&(!(O.expirationTime>n)||e&&!t.unstable_shouldYield());){var a=O.callback;if("function"==typeof a){O.callback=null,P=O.priorityLevel;var s=a(O.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?O.callback=s:O===k(C)&&E(C),I(n)}else E(C);O=k(C)}if(null!==O)var l=!0;else{var c=k(T);null!==c&&r(D,c.startTime-n),l=!1}return l}finally{O=null,P=o,M=!1}}var B=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){N||M||(N=!0,n(R))},t.unstable_getCurrentPriorityLevel=function(){return P},t.unstable_getFirstCallbackNode=function(){return k(C)},t.unstable_next=function(e){switch(P){case 1:case 2:case 3:var t=3;break;default:t=P}var n=P;P=t;try{return e()}finally{P=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=B,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=P;P=e;try{return t()}finally{P=n}},t.unstable_scheduleCallback=function(e,o,a){var s=t.unstable_now();switch("object"==typeof a&&null!==a?a="number"==typeof(a=a.delay)&&0<a?s+a:s:a=s,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return e={id:A++,callback:o,priorityLevel:e,startTime:a,expirationTime:l=a+l,sortIndex:-1},a>s?(e.sortIndex=a,_(T,e),null===k(C)&&e===k(T)&&(L?i():L=!0,r(D,a-s))):(e.sortIndex=l,_(C,e),N||M||(N=!0,n(R))),e},t.unstable_wrapCallback=function(e){var t=P;return function(){var n=P;P=t;try{return e.apply(this,arguments)}finally{P=n}}}},3840:(e,t,n)=>{"use strict";e.exports=n(53)},3379:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var o={},a=[],s=0;s<e.length;s++){var l=e[s],c=r.base?l[0]+r.base:l[0],u=o[c]||0,d="".concat(c," ").concat(u);o[c]=u+1;var f=n(d),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==f)t[f].references++,t[f].updater(p);else{var h=i(p,r);r.byIndex=s,t.splice(s,0,{identifier:d,updater:h,references:1})}a.push(d)}return a}function i(e,t){var n=t.domAPI(t);n.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,i){var o=r(e=e||[],i=i||{});return function(e){e=e||[];for(var a=0;a<o.length;a++){var s=n(o[a]);t[s].references--}for(var l=r(e,i),c=0;c<o.length;c++){var u=n(o[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=l}}},569:e=>{"use strict";var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},4990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2800:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(1166),o=n(3210),a=n(3210),s=n(4370);!function(e){e[e.STATE_TAG=1]="STATE_TAG",e[e.STATE_SIZE=2]="STATE_SIZE",e[e.STATE_CONTENT=3]="STATE_CONTENT"}(r||(r={}));var l=function(){function e(){this._buffer=new o.Buffer(0),this._tag_stack=[],this._state=r.STATE_TAG,this._cursor=0,this._total=0,this._schema=s.byEbmlID,this._result=[]}return e.prototype.decode=function(e){this.readChunk(e);var t=this._result;return this._result=[],t},e.prototype.readChunk=function(e){for(this._buffer=a.concat([this._buffer,new o.Buffer(e)]);this._cursor<this._buffer.length&&(this._state!==r.STATE_TAG||this.readTag())&&(this._state!==r.STATE_SIZE||this.readSize())&&(this._state!==r.STATE_CONTENT||this.readContent()););},e.prototype.getSchemaInfo=function(e){return this._schema[e]||{name:"unknown",level:-1,type:"unknown",description:"unknown"}},e.prototype.readTag=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,o.readVint)(this._buffer,this._cursor);if(null==e)return!1;var t=this._buffer.slice(this._cursor,this._cursor+e.length).reduce((function(e,t,n,r){return e+t*Math.pow(16,2*(r.length-1-n))}),0),n=this.getSchemaInfo(t),i={EBML_ID:t.toString(16),schema:n,type:n.type,name:n.name,level:n.level,tagStart:this._total,tagEnd:this._total+e.length,sizeStart:this._total+e.length,sizeEnd:null,dataStart:null,dataEnd:null,dataSize:null,data:null};return this._tag_stack.push(i),this._cursor+=e.length,this._total+=e.length,this._state=r.STATE_SIZE,!0},e.prototype.readSize=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,o.readVint)(this._buffer,this._cursor);if(null==e)return!1;var t=this._tag_stack[this._tag_stack.length-1];return t.sizeEnd=t.sizeStart+e.length,t.dataStart=t.sizeEnd,t.dataSize=e.value,-1===e.value?(t.dataEnd=-1,"m"===t.type&&(t.unknownSize=!0)):t.dataEnd=t.sizeEnd+e.value,this._cursor+=e.length,this._total+=e.length,this._state=r.STATE_CONTENT,!0},e.prototype.readContent=function(){var e=this._tag_stack[this._tag_stack.length-1];if("m"===e.type){if(e.isEnd=!1,this._result.push(e),this._state=r.STATE_TAG,0===e.dataSize){var t=Object.assign({},e,{isEnd:!0});this._result.push(t),this._tag_stack.pop()}return!0}if(this._buffer.length<this._cursor+e.dataSize)return!1;var n=this._buffer.slice(this._cursor,this._cursor+e.dataSize);switch(this._buffer=this._buffer.slice(this._cursor+e.dataSize),e.data=n,e.type){case"u":e.value=n.readUIntBE(0,n.length);break;case"i":e.value=n.readIntBE(0,n.length);break;case"f":e.value=4===e.dataSize?n.readFloatBE(0):8===e.dataSize?n.readDoubleBE(0):(console.warn("cannot read ".concat(e.dataSize," octets float. failback to 0")),0);break;case"s":e.value=n.toString("ascii");break;case"8":e.value=n.toString("utf8");break;case"b":e.value=n;break;case"d":e.value=(0,o.convertEBMLDateToJSDate)(new i.Int64BE(n).toNumber())}if(null===e.value)throw new Error("unknown tag type:"+e.type);for(this._result.push(e),this._total+=e.dataSize,this._state=r.STATE_TAG,this._cursor=0,this._tag_stack.pop();this._tag_stack.length>0;){var a=this._tag_stack[this._tag_stack.length-1];if(a.dataEnd<0)return this._tag_stack.pop(),!0;if(this._total<a.dataEnd)break;if("m"!==a.type)throw new Error("parent element is not master element");t=Object.assign({},a,{isEnd:!0});this._result.push(t),this._tag_stack.pop()}return!0},e}();t.default=l},8031:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3210),i=n(3210),o=n(4370),a=function(){function e(){this._schema=o.byEbmlID,this._buffers=[],this._stack=[]}return e.prototype.encode=function(e){var t=this;return r.concat(e.reduce((function(e,n){return e.concat(t.encodeChunk(n))}),[])).buffer},e.prototype.encodeChunk=function(e){return"m"===e.type?e.isEnd?this.endTag(e):this.startTag(e):(e.data=i.Buffer.from(e.data),this.writeTag(e)),this.flush()},e.prototype.flush=function(){var e=this._buffers;return this._buffers=[],e},e.prototype.getSchemaInfo=function(e){for(var t=Object.keys(this._schema).map(Number),n=0;n<t.length;n++){var r=t[n];if(this._schema[r].name===e)return new i.Buffer(r.toString(16),"hex")}return null},e.prototype.writeTag=function(e){var t=e.name,n=this.getSchemaInfo(t),i=e.data;if(null==n)throw new Error("No schema entry found for "+t);var o=r.encodeTag(n,i);this._stack.length>0?this._stack[this._stack.length-1].children.push({tagId:n,elm:e,children:[],data:o}):this._buffers=this._buffers.concat(o)},e.prototype.startTag=function(e){var t=e.name,n=this.getSchemaInfo(t);if(null==n)throw new Error("No schema entry found for "+t);if(e.unknownSize){var o=r.encodeTag(n,new i.Buffer(0),e.unknownSize);this._buffers=this._buffers.concat(o)}else{var a={tagId:n,elm:e,children:[],data:null};this._stack.length>0&&this._stack[this._stack.length-1].children.push(a),this._stack.push(a)}},e.prototype.endTag=function(e){e.name;var t=this._stack.pop();if(null==t)throw new Error("EBML structure is broken");if(t.elm.name!==e.name)throw new Error("EBML structure is broken");var n=t.children.reduce((function(e,t){if(null===t.data)throw new Error("EBML structure is broken");return e.concat(t.data)}),[]),i=r.concat(n);"m"===t.elm.type?t.data=r.encodeTag(t.tagId,i,t.elm.unknownSize):t.data=r.encodeTag(t.tagId,i),this._stack.length<1&&(this._buffers=this._buffers.concat(t.data))},e}();t.default=a},1381:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(7187),a=n(3210),s=function(e){function t(){var t=e.call(this)||this;return t.logGroup="",t.hasLoggingStarted=!1,t.metadataloaded=!1,t.chunks=[],t.stack=[],t.segmentOffset=0,t.last2SimpleBlockVideoTrackTimecode=[0,0],t.last2SimpleBlockAudioTrackTimecode=[0,0],t.lastClusterTimecode=0,t.lastClusterPosition=0,t.timecodeScale=1e6,t.metadataSize=0,t.metadatas=[],t.cues=[],t.firstVideoBlockRead=!1,t.firstAudioBlockRead=!1,t.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null},t.trackTypes=[],t.trackDefaultDuration=[],t.trackCodecDelay=[],t.trackInfo={type:"nothing"},t.ended=!1,t.logging=!1,t.use_duration_every_simpleblock=!1,t.use_webp=!1,t.use_segment_info=!0,t.drop_default_duration=!0,t}return i(t,e),t.prototype.stop=function(){for(this.ended=!0,this.emit_segment_info();this.stack.length;)this.stack.pop(),this.logging&&console.groupEnd();this.logging&&this.hasLoggingStarted&&this.logGroup&&console.groupEnd()},t.prototype.emit_segment_info=function(){var e=this.chunks;if(this.chunks=[],this.metadataloaded){if(!this.use_segment_info)return;var t=this.lastClusterTimecode,n=this.duration,r=this.timecodeScale;this.emit("cluster",{timecode:t,data:e}),this.emit("duration",{timecodeScale:r,duration:n})}else{this.metadataloaded=!0,this.metadatas=e;var i=this.trackTypes.indexOf(1),o=this.trackTypes.indexOf(2);if(this.trackInfo=i>=0&&o>=0?{type:"both",trackNumber:i}:i>=0?{type:"video",trackNumber:i}:o>=0?{type:"audio",trackNumber:o}:{type:"nothing"},!this.use_segment_info)return;this.emit("metadata",{data:e,metadataSize:this.metadataSize})}},t.prototype.read=function(e){var t=this,n=!1;if(!this.ended){if("m"===e.type)if(e.isEnd)this.stack.pop();else{var r=this.stack[this.stack.length-1];if(null!=r&&r.level>=e.level){this.stack.pop(),this.logging&&console.groupEnd(),r.dataEnd=e.dataEnd,r.dataSize=e.dataEnd-r.dataStart,r.unknownSize=!1;var i=Object.assign({},r,{name:r.name,type:r.type,isEnd:!0});this.chunks.push(i)}this.stack.push(e)}if("m"===e.type&&"Segment"==e.name)0!=this.segmentOffset&&console.warn("Multiple segments detected!"),this.segmentOffset=e.dataStart,this.emit("segment_offset",this.segmentOffset);else if("b"===e.type&&"SimpleBlock"===e.name){var o=a.ebmlBlock(e.data),s=o.timecode,l=o.trackNumber,c=o.frames;if(1===this.trackTypes[l]){if(!this.firstVideoBlockRead&&(this.firstVideoBlockRead=!0,"both"===this.trackInfo.type||"video"===this.trackInfo.type)){var u=this.lastClusterTimecode+s;this.cues.push({CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit("cue_info",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit("cue",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockVideoTrackTimecode=[this.last2SimpleBlockVideoTrackTimecode[1],s]}else if(2===this.trackTypes[l]){if(!this.firstAudioBlockRead&&(this.firstAudioBlockRead=!0,"audio"===this.trackInfo.type)){u=this.lastClusterTimecode+s;this.cues.push({CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit("cue_info",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit("cue",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockAudioTrackTimecode=[this.last2SimpleBlockAudioTrackTimecode[1],s]}this.use_duration_every_simpleblock&&this.emit("duration",{timecodeScale:this.timecodeScale,duration:this.duration}),this.use_webp&&c.forEach((function(e){if("9d012a"===e.slice(3,6).toString("hex")){var n=a.VP8BitStreamToRiffWebPBuffer(e),r=new Blob([n],{type:"image/webp"}),i=t.duration;t.emit("webp",{currentTime:i,webp:r})}}))}else"m"===e.type&&"Cluster"===e.name&&!1===e.isEnd?(this.firstVideoBlockRead=!1,this.firstAudioBlockRead=!1,this.emit_segment_info(),this.emit("cluster_ptr",e.tagStart),this.lastClusterPosition=e.tagStart):"u"===e.type&&"Timecode"===e.name?this.lastClusterTimecode=e.value:"u"===e.type&&"TimecodeScale"===e.name?this.timecodeScale=e.value:"m"===e.type&&"TrackEntry"===e.name?e.isEnd?(this.trackTypes[this.currentTrack.TrackNumber]=this.currentTrack.TrackType,this.trackDefaultDuration[this.currentTrack.TrackNumber]=this.currentTrack.DefaultDuration,this.trackCodecDelay[this.currentTrack.TrackNumber]=this.currentTrack.CodecDelay):this.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null}:"u"===e.type&&"TrackType"===e.name?this.currentTrack.TrackType=e.value:"u"===e.type&&"TrackNumber"===e.name?this.currentTrack.TrackNumber=e.value:"u"===e.type&&"CodecDelay"===e.name?this.currentTrack.CodecDelay=e.value:"u"===e.type&&"DefaultDuration"===e.name?this.drop_default_duration?(console.warn("DefaultDuration detected!, remove it"),n=!0):this.currentTrack.DefaultDuration=e.value:"unknown"===e.name&&console.warn(e);!this.metadataloaded&&e.dataEnd>0&&(this.metadataSize=e.dataEnd),n||this.chunks.push(e),this.logging&&this.put(e)}},Object.defineProperty(t.prototype,"duration",{get:function(){if("nothing"===this.trackInfo.type)return console.warn("no video, no audio track"),0;var e=0,t=0,n=0,r=this.trackDefaultDuration[this.trackInfo.trackNumber];if("number"==typeof r)e=r;else if("both"===this.trackInfo.type)this.last2SimpleBlockAudioTrackTimecode[1]>this.last2SimpleBlockVideoTrackTimecode[1]?(e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackTypes.indexOf(2)])&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]):(e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackTypes.indexOf(1)])&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]);else if("video"===this.trackInfo.type){e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackInfo.trackNumber])&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]}else if("audio"===this.trackInfo.type){var i;e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackInfo.trackNumber])&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]}var o=((this.lastClusterTimecode+n)*this.timecodeScale+e-t)/this.timecodeScale;return Math.floor(o)},enumerable:!1,configurable:!0}),t.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},t.prototype.put=function(e){this.hasLoggingStarted||(this.hasLoggingStarted=!0,this.logging&&this.logGroup&&console.groupCollapsed(this.logGroup)),"m"===e.type?e.isEnd?console.groupEnd():console.group(e.name+":"+e.tagStart):"b"===e.type?console.log(e.name,e.type):console.log(e.name,e.tagStart,e.type,e.value)},t}(o.EventEmitter);t.default=s},4370:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.byEbmlID=void 0,t.byEbmlID={128:{name:"ChapterDisplay",level:4,type:"m",multiple:!0,minver:1,webm:!0,description:"Contains all possible strings to use for the chapter display."},131:{name:"TrackType",level:3,type:"u",mandatory:!0,minver:1,range:"1-254",description:"A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control)."},133:{name:"ChapString",cppname:"ChapterString",level:5,type:"8",mandatory:!0,minver:1,webm:!0,description:"Contains the string to use as the chapter atom."},134:{name:"CodecID",level:3,type:"s",mandatory:!0,minver:1,description:"An ID corresponding to the codec, see the codec page for more info."},136:{name:"FlagDefault",cppname:"TrackFlagDefault",level:3,type:"u",mandatory:!0,minver:1,default:1,range:"0-1",description:"Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference. (1 bit)"},137:{name:"ChapterTrackNumber",level:5,type:"u",mandatory:!0,multiple:!0,minver:1,webm:!1,range:"not 0",description:"UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks."},145:{name:"ChapterTimeStart",level:4,type:"u",mandatory:!0,minver:1,webm:!0,description:"Timestamp of the start of Chapter (not scaled)."},146:{name:"ChapterTimeEnd",level:4,type:"u",minver:1,webm:!1,description:"Timestamp of the end of Chapter (timestamp excluded, not scaled)."},150:{name:"CueRefTime",level:5,type:"u",mandatory:!0,minver:2,webm:!1,description:"Timestamp of the referenced Block."},151:{name:"CueRefCluster",level:5,type:"u",mandatory:!0,webm:!1,description:"The Position of the Cluster containing the referenced Block."},152:{name:"ChapterFlagHidden",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:0,range:"0-1",description:"If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)"},16980:{name:"ContentCompAlgo",level:6,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"The compression algorithm used. Algorithms that have been specified so far are: 0 - zlib, 3 - Header Stripping"},16981:{name:"ContentCompSettings",level:6,type:"b",minver:1,webm:!1,description:"Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track."},17026:{name:"DocType",level:1,type:"s",mandatory:!0,default:"matroska",minver:1,description:"A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files."},17029:{name:"DocTypeReadVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The minimum DocType version an interpreter has to support to read this file."},17030:{name:"EBMLVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The version of EBML parser used to create the file."},17031:{name:"DocTypeVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The version of DocType interpreter used to create the file."},17476:{name:"SegmentFamily",level:2,type:"b",multiple:!0,minver:1,webm:!1,bytesize:16,description:"A randomly generated unique ID that all segments related to each other must use (128 bits)."},17505:{name:"DateUTC",level:2,type:"d",minver:1,description:"Date of the origin of timestamp (value 0), i.e. production date."},17540:{name:"TagDefault",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"0-1",description:"Indication to know if this is the default/original language to use for the given tag. (1 bit)"},17541:{name:"TagBinary",level:4,type:"b",minver:1,webm:!1,description:"The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString."},17543:{name:"TagString",level:4,type:"8",minver:1,webm:!1,description:"The value of the Element."},17545:{name:"Duration",level:2,type:"f",minver:1,range:"> 0",description:"Duration of the segment (based on TimecodeScale)."},17816:{name:"ChapterFlagEnabled",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"0-1",description:"Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter (see flag notes). (1 bit)"},18016:{name:"FileMimeType",level:3,type:"s",mandatory:!0,minver:1,webm:!1,description:"MIME type of the file."},18017:{name:"FileUsedStartTime",level:3,type:"u",divx:!0,description:"DivX font extension"},18018:{name:"FileUsedEndTime",level:3,type:"u",divx:!0,description:"DivX font extension"},18037:{name:"FileReferral",level:3,type:"b",webm:!1,description:"A binary value that a track/codec can refer to when the attachment is needed."},20529:{name:"ContentEncodingOrder",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment."},20530:{name:"ContentEncodingScope",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"not 0",description:"A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: 1 - all frame contents, 2 - the track's private data, 4 - the next ContentEncoding (next ContentEncodingOrder. Either the data inside ContentCompression and/or ContentEncryption)"},20531:{name:"ContentEncodingType",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"A value describing what kind of transformation has been done. Possible values: 0 - compression, 1 - encryption"},20532:{name:"ContentCompression",level:5,type:"m",minver:1,webm:!1,description:"Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking."},20533:{name:"ContentEncryption",level:5,type:"m",minver:1,webm:!1,description:"Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise."},21368:{name:"CueBlockNumber",level:4,type:"u",minver:1,default:1,range:"not 0",description:"Number of the Block in the specified Cluster."},22100:{name:"ChapterStringUID",level:4,type:"8",mandatory:!1,minver:3,webm:!0,description:"A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage."},22337:{name:"WritingApp",level:2,type:"8",mandatory:!0,minver:1,description:'Writing application ("mkvmerge-0.3.3").'},22612:{name:"SilentTracks",cppname:"ClusterSilentTracks",level:2,type:"m",minver:1,webm:!1,description:"The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use."},25152:{name:"ContentEncoding",level:4,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"Settings for one content encoding like compression or encryption."},25188:{name:"BitDepth",cppname:"AudioBitDepth",level:4,type:"u",minver:1,range:"not 0",description:"Bits per sample, mostly used for PCM."},25906:{name:"SignedElement",level:3,type:"b",multiple:!0,webm:!1,description:"An element ID whose data will be used to compute the signature."},26148:{name:"TrackTranslate",level:3,type:"m",multiple:!0,minver:1,webm:!1,description:"The track identification for the given Chapter Codec."},26897:{name:"ChapProcessCommand",cppname:"ChapterProcessCommand",level:5,type:"m",multiple:!0,minver:1,webm:!1,description:"Contains all the commands associated to the Atom."},26914:{name:"ChapProcessTime",cppname:"ChapterProcessTime",level:6,type:"u",mandatory:!0,minver:1,webm:!1,description:"Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter)."},26916:{name:"ChapterTranslate",level:2,type:"m",multiple:!0,minver:1,webm:!1,description:"A tuple of corresponding ID used by chapter codecs to represent this segment."},26931:{name:"ChapProcessData",cppname:"ChapterProcessData",level:6,type:"b",mandatory:!0,minver:1,webm:!1,description:"Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands."},26948:{name:"ChapProcess",cppname:"ChapterProcess",level:4,type:"m",multiple:!0,minver:1,webm:!1,description:"Contains all the commands associated to the Atom."},26965:{name:"ChapProcessCodecID",cppname:"ChapterProcessCodecID",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later."},29555:{name:"Tag",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"Element containing elements specific to Tracks/Chapters."},29572:{name:"SegmentFilename",level:2,type:"8",minver:1,webm:!1,description:"A filename corresponding to this segment."},29766:{name:"AttachmentLink",cppname:"TrackAttachmentLink",level:3,type:"u",minver:1,webm:!1,range:"not 0",description:"The UID of an attachment that is used by this codec."},2459272:{name:"CodecName",level:3,type:"8",minver:1,description:"A human-readable string specifying the codec."},408125543:{name:"Segment",level:"0",type:"m",mandatory:!0,multiple:!0,minver:1,description:"This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment."},17530:{name:"TagLanguage",level:4,type:"s",mandatory:!0,minver:1,webm:!1,default:"und",description:"Specifies the language of the tag specified, in the Matroska languages form."},17827:{name:"TagName",level:4,type:"8",mandatory:!0,minver:1,webm:!1,description:"The name of the Tag that is going to be stored."},26568:{name:"SimpleTag",cppname:"TagSimple",level:3,recursive:"1",type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"Contains general information about the target."},25542:{name:"TagAttachmentUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,default:0,description:"A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment."},25540:{name:"TagChapterUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,default:0,description:"A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment."},25545:{name:"TagEditionUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,default:0,description:"A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment."},25541:{name:"TagTrackUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,default:0,description:"A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment."},25546:{name:"TargetType",cppname:"TagTargetType",level:4,type:"s",minver:1,webm:!1,strong:"informational",description:'An string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).'},26826:{name:"TargetTypeValue",cppname:"TagTargetTypeValue",level:4,type:"u",minver:1,webm:!1,default:50,description:"A number to indicate the logical level of the target (see TargetType)."},25536:{name:"Targets",cppname:"TagTargets",level:3,type:"m",mandatory:!0,minver:1,webm:!1,description:"Contain all UIDs where the specified meta data apply. It is empty to describe everything in the segment."},307544935:{name:"Tags",level:1,type:"m",multiple:!0,minver:1,webm:!1,description:"Element containing elements specific to Tracks/Chapters. A list of valid tags can be found here."},17677:{name:"ChapProcessPrivate",cppname:"ChapterProcessPrivate",level:5,type:"b",minver:1,webm:!1,description:'Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.'},17278:{name:"ChapCountry",cppname:"ChapterCountry",level:5,type:"s",multiple:!0,minver:1,webm:!1,description:"The countries corresponding to the string, same 2 octets as in Internet domains."},17276:{name:"ChapLanguage",cppname:"ChapterLanguage",level:5,type:"s",mandatory:!0,multiple:!0,minver:1,webm:!0,default:"eng",description:"The languages corresponding to the string, in the bibliographic ISO-639-2 form."},143:{name:"ChapterTrack",level:4,type:"m",minver:1,webm:!1,description:"List of tracks on which the chapter applies. If this element is not present, all tracks apply"},25539:{name:"ChapterPhysicalEquiv",level:4,type:"u",minver:1,webm:!1,description:'Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.'},28348:{name:"ChapterSegmentEditionUID",level:4,type:"u",minver:1,webm:!1,range:"not 0",description:"The EditionUID to play from the segment linked in ChapterSegmentUID."},28263:{name:"ChapterSegmentUID",level:4,type:"b",minver:1,webm:!1,range:">0",bytesize:16,description:"A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used."},29636:{name:"ChapterUID",level:4,type:"u",mandatory:!0,minver:1,webm:!0,range:"not 0",description:"A unique ID to identify the Chapter."},182:{name:"ChapterAtom",level:3,recursive:"1",type:"m",mandatory:!0,multiple:!0,minver:1,webm:!0,description:"Contains the atom information to use as the chapter atom (apply to all tracks)."},17885:{name:"EditionFlagOrdered",level:3,type:"u",minver:1,webm:!1,default:0,range:"0-1",description:"Specify if the chapters can be defined multiple times and the order to play them is enforced. (1 bit)"},17883:{name:"EditionFlagDefault",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,range:"0-1",description:"If a flag is set (1) the edition should be used as the default one. (1 bit)"},17853:{name:"EditionFlagHidden",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,range:"0-1",description:"If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)"},17852:{name:"EditionUID",level:3,type:"u",minver:1,webm:!1,range:"not 0",description:"A unique ID to identify the edition. It's useful for tagging an edition."},17849:{name:"EditionEntry",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!0,description:"Contains all information about a segment edition."},272869232:{name:"Chapters",level:1,type:"m",minver:1,webm:!0,description:"A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation."},18094:{name:"FileUID",level:3,type:"u",mandatory:!0,minver:1,webm:!1,range:"not 0",description:"Unique ID representing the file, as random as possible."},18012:{name:"FileData",level:3,type:"b",mandatory:!0,minver:1,webm:!1,description:"The data of the file."},18030:{name:"FileName",level:3,type:"8",mandatory:!0,minver:1,webm:!1,description:"Filename of the attached file."},18046:{name:"FileDescription",level:3,type:"8",minver:1,webm:!1,description:"A human-friendly name for the attached file."},24999:{name:"AttachedFile",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"An attached file."},423732329:{name:"Attachments",level:1,type:"m",minver:1,webm:!1,description:"Contain attached files."},235:{name:"CueRefCodecState",level:5,type:"u",webm:!1,default:0,description:"The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry."},21343:{name:"CueRefNumber",level:5,type:"u",webm:!1,default:1,range:"not 0",description:"Number of the referenced Block of Track X in the specified Cluster."},219:{name:"CueReference",level:4,type:"m",multiple:!0,minver:2,webm:!1,description:"The Clusters containing the required referenced Blocks."},234:{name:"CueCodecState",level:4,type:"u",minver:2,webm:!1,default:0,description:"The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry."},178:{name:"CueDuration",level:4,type:"u",mandatory:!1,minver:4,webm:!1,description:"The duration of the block according to the segment time base. If missing the track's DefaultDuration does not apply and no duration information is available in terms of the cues."},240:{name:"CueRelativePosition",level:4,type:"u",mandatory:!1,minver:4,webm:!1,description:"The relative position of the referenced block inside the cluster with 0 being the first possible position for an element inside that cluster.",position:"clusterRelative"},241:{name:"CueClusterPosition",level:4,type:"u",mandatory:!0,minver:1,description:"The position of the Cluster containing the required Block.",position:"segment"},247:{name:"CueTrack",level:4,type:"u",mandatory:!0,minver:1,range:"not 0",description:"The track for which a position is given."},183:{name:"CueTrackPositions",level:3,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Contain positions for different tracks corresponding to the timestamp."},179:{name:"CueTime",level:3,type:"u",mandatory:!0,minver:1,description:"Absolute timestamp according to the segment time base."},187:{name:"CuePoint",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Contains all information relative to a seek point in the segment."},475249515:{name:"Cues",level:1,type:"m",minver:1,description:'A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams.'},18406:{name:"ContentSigHashAlgo",level:6,type:"u",minver:1,webm:!1,default:0,description:"The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - SHA1-160 2 - MD5"},18405:{name:"ContentSigAlgo",level:6,type:"u",minver:1,webm:!1,default:0,description:"The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - RSA"},18404:{name:"ContentSigKeyID",level:6,type:"b",minver:1,webm:!1,description:"This is the ID of the private key the data was signed with."},18403:{name:"ContentSignature",level:6,type:"b",minver:1,webm:!1,description:"A cryptographic signature of the contents."},18402:{name:"ContentEncKeyID",level:6,type:"b",minver:1,webm:!1,description:"For public key algorithms this is the ID of the public key the the data was encrypted with."},18401:{name:"ContentEncAlgo",level:6,type:"u",minver:1,webm:!1,default:0,description:"The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: 1 - DES, 2 - 3DES, 3 - Twofish, 4 - Blowfish, 5 - AES"},28032:{name:"ContentEncodings",level:3,type:"m",minver:1,webm:!1,description:"Settings for several content encoding mechanisms like compression or encryption."},196:{name:"TrickMasterTrackSegmentUID",level:3,type:"b",divx:!0,bytesize:16,description:"DivX trick track extenstions"},199:{name:"TrickMasterTrackUID",level:3,type:"u",divx:!0,description:"DivX trick track extenstions"},198:{name:"TrickTrackFlag",level:3,type:"u",divx:!0,default:0,description:"DivX trick track extenstions"},193:{name:"TrickTrackSegmentUID",level:3,type:"b",divx:!0,bytesize:16,description:"DivX trick track extenstions"},192:{name:"TrickTrackUID",level:3,type:"u",divx:!0,description:"DivX trick track extenstions"},237:{name:"TrackJoinUID",level:5,type:"u",mandatory:!0,multiple:!0,minver:3,webm:!1,range:"not 0",description:"The trackUID number of a track whose blocks are used to create this virtual track."},233:{name:"TrackJoinBlocks",level:4,type:"m",minver:3,webm:!1,description:"Contains the list of all tracks whose Blocks need to be combined to create this virtual track"},230:{name:"TrackPlaneType",level:6,type:"u",mandatory:!0,minver:3,webm:!1,description:"The kind of plane this track corresponds to (0: left eye, 1: right eye, 2: background)."},229:{name:"TrackPlaneUID",level:6,type:"u",mandatory:!0,minver:3,webm:!1,range:"not 0",description:"The trackUID number of the track representing the plane."},228:{name:"TrackPlane",level:5,type:"m",mandatory:!0,multiple:!0,minver:3,webm:!1,description:"Contains a video plane track that need to be combined to create this 3D track"},227:{name:"TrackCombinePlanes",level:4,type:"m",minver:3,webm:!1,description:"Contains the list of all video plane tracks that need to be combined to create this 3D track"},226:{name:"TrackOperation",level:3,type:"m",minver:3,webm:!1,description:"Operation that needs to be applied on tracks to create this virtual track. For more details look at the Specification Notes on the subject."},32123:{name:"ChannelPositions",cppname:"AudioPosition",level:4,type:"b",webm:!1,description:"Table of horizontal angles for each successive channel, see appendix."},159:{name:"Channels",cppname:"AudioChannels",level:4,type:"u",mandatory:!0,minver:1,default:1,range:"not 0",description:"Numbers of channels in the track."},30901:{name:"OutputSamplingFrequency",cppname:"AudioOutputSamplingFreq",level:4,type:"f",minver:1,default:"Sampling Frequency",range:"> 0",description:"Real output sampling frequency in Hz (used for SBR techniques)."},181:{name:"SamplingFrequency",cppname:"AudioSamplingFreq",level:4,type:"f",mandatory:!0,minver:1,default:8e3,range:"> 0",description:"Sampling frequency in Hz."},225:{name:"Audio",cppname:"TrackAudio",level:3,type:"m",minver:1,description:"Audio settings."},2327523:{name:"FrameRate",cppname:"VideoFrameRate",level:4,type:"f",range:"> 0",strong:"Informational",description:"Number of frames per second. only."},3126563:{name:"GammaValue",cppname:"VideoGamma",level:4,type:"f",webm:!1,range:"> 0",description:"Gamma Value."},3061028:{name:"ColourSpace",cppname:"VideoColourSpace",level:4,type:"b",minver:1,webm:!1,bytesize:4,description:"Same value as in AVI (32 bits)."},21683:{name:"AspectRatioType",cppname:"VideoAspectRatio",level:4,type:"u",minver:1,default:0,description:"Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed)."},21682:{name:"DisplayUnit",cppname:"VideoDisplayUnit",level:4,type:"u",minver:1,default:0,description:"How DisplayWidth & DisplayHeight should be interpreted (0: pixels, 1: centimeters, 2: inches, 3: Display Aspect Ratio)."},21690:{name:"DisplayHeight",cppname:"VideoDisplayHeight",level:4,type:"u",minver:1,default:"PixelHeight",range:"not 0",description:"Height of the video frames to display. The default value is only valid when DisplayUnit is 0."},21680:{name:"DisplayWidth",cppname:"VideoDisplayWidth",level:4,type:"u",minver:1,default:"PixelWidth",range:"not 0",description:"Width of the video frames to display. The default value is only valid when DisplayUnit is 0."},21725:{name:"PixelCropRight",cppname:"VideoPixelCropRight",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove on the right of the image."},21708:{name:"PixelCropLeft",cppname:"VideoPixelCropLeft",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove on the left of the image."},21691:{name:"PixelCropTop",cppname:"VideoPixelCropTop",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove at the top of the image."},21674:{name:"PixelCropBottom",cppname:"VideoPixelCropBottom",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove at the bottom of the image (for HDTV content)."},186:{name:"PixelHeight",cppname:"VideoPixelHeight",level:4,type:"u",mandatory:!0,minver:1,range:"not 0",description:"Height of the encoded video frames in pixels."},176:{name:"PixelWidth",cppname:"VideoPixelWidth",level:4,type:"u",mandatory:!0,minver:1,range:"not 0",description:"Width of the encoded video frames in pixels."},21433:{name:"OldStereoMode",level:4,type:"u",maxver:"0",webm:!1,divx:!1,description:"DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska. (0: mono, 1: right eye, 2: left eye, 3: both eyes)."},21440:{name:"AlphaMode",cppname:"VideoAlphaMode",level:4,type:"u",minver:3,webm:!0,default:0,description:"Alpha Video Mode. Presence of this element indicates that the BlockAdditional element could contain Alpha data."},21432:{name:"StereoMode",cppname:"VideoStereoMode",level:4,type:"u",minver:3,webm:!0,default:0,description:"Stereo-3D video mode (0: mono, 1: side by side (left eye is first), 2: top-bottom (right eye is first), 3: top-bottom (left eye is first), 4: checkboard (right is first), 5: checkboard (left is first), 6: row interleaved (right is first), 7: row interleaved (left is first), 8: column interleaved (right is first), 9: column interleaved (left is first), 10: anaglyph (cyan/red), 11: side by side (right eye is first), 12: anaglyph (green/magenta), 13 both eyes laced in one Block (left eye is first), 14 both eyes laced in one Block (right eye is first)) . There are some more details on 3D support in the Specification Notes."},154:{name:"FlagInterlaced",cppname:"VideoFlagInterlaced",level:4,type:"u",mandatory:!0,minver:2,webm:!0,default:0,range:"0-1",description:"Set if the video is interlaced. (1 bit)"},224:{name:"Video",cppname:"TrackVideo",level:3,type:"m",minver:1,description:"Video settings."},26277:{name:"TrackTranslateTrackID",level:4,type:"b",mandatory:!0,minver:1,webm:!1,description:"The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used."},26303:{name:"TrackTranslateCodec",level:4,type:"u",mandatory:!0,minver:1,webm:!1,description:"The chapter codec using this ID (0: Matroska Script, 1: DVD-menu)."},26364:{name:"TrackTranslateEditionUID",level:4,type:"u",multiple:!0,minver:1,webm:!1,description:"Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment."},22203:{name:"SeekPreRoll",level:3,type:"u",mandatory:!0,multiple:!1,default:0,minver:4,webm:!0,description:"After a discontinuity, SeekPreRoll is the duration in nanoseconds of the data the decoder must decode before the decoded data is valid."},22186:{name:"CodecDelay",level:3,type:"u",multiple:!1,default:0,minver:4,webm:!0,description:"CodecDelay is The codec-built-in delay in nanoseconds. This value must be subtracted from each block timestamp in order to get the actual timestamp. The value should be small so the muxing of tracks with the same actual timestamp are in the same Cluster."},28587:{name:"TrackOverlay",level:3,type:"u",multiple:!0,minver:1,webm:!1,description:"Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc."},170:{name:"CodecDecodeAll",level:3,type:"u",mandatory:!0,minver:2,webm:!1,default:1,range:"0-1",description:"The codec can decode potentially damaged data (1 bit)."},2536e3:{name:"CodecDownloadURL",level:3,type:"s",multiple:!0,webm:!1,description:"A URL to download about the codec used."},3883072:{name:"CodecInfoURL",level:3,type:"s",multiple:!0,webm:!1,description:"A URL to find information about the codec used."},3839639:{name:"CodecSettings",level:3,type:"8",webm:!1,description:"A string describing the encoding setting used."},25506:{name:"CodecPrivate",level:3,type:"b",minver:1,description:"Private data only known to the codec."},2274716:{name:"Language",cppname:"TrackLanguage",level:3,type:"s",minver:1,default:"eng",description:"Specifies the language of the track in the Matroska languages form."},21358:{name:"Name",cppname:"TrackName",level:3,type:"8",minver:1,description:"A human-readable track name."},21998:{name:"MaxBlockAdditionID",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"The maximum value of BlockAdditions for this track."},21375:{name:"TrackOffset",level:3,type:"i",webm:!1,default:0,description:"A value to add to the Block's Timestamp. This can be used to adjust the playback offset of a track."},2306383:{name:"TrackTimecodeScale",level:3,type:"f",mandatory:!0,minver:1,maxver:"3",webm:!1,default:1,range:"> 0",description:"DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs)."},2313850:{name:"DefaultDecodedFieldDuration",cppname:"TrackDefaultDecodedFieldDuration",level:3,type:"u",minver:4,range:"not 0",description:"The period in nanoseconds (not scaled by TimcodeScale)\nbetween two successive fields at the output of the decoding process (see the notes)"},2352003:{name:"DefaultDuration",cppname:"TrackDefaultDuration",level:3,type:"u",minver:1,range:"not 0",description:"Number of nanoseconds (not scaled via TimecodeScale) per frame ('frame' in the Matroska sense -- one element put into a (Simple)Block)."},28152:{name:"MaxCache",cppname:"TrackMaxCache",level:3,type:"u",minver:1,webm:!1,description:"The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed."},28135:{name:"MinCache",cppname:"TrackMinCache",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used."},156:{name:"FlagLacing",cppname:"TrackFlagLacing",level:3,type:"u",mandatory:!0,minver:1,default:1,range:"0-1",description:"Set if the track may contain blocks using lacing. (1 bit)"},21930:{name:"FlagForced",cppname:"TrackFlagForced",level:3,type:"u",mandatory:!0,minver:1,default:0,range:"0-1",description:"Set if that track MUST be active during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. (1 bit)"},185:{name:"FlagEnabled",cppname:"TrackFlagEnabled",level:3,type:"u",mandatory:!0,minver:2,webm:!0,default:1,range:"0-1",description:"Set if the track is usable. (1 bit)"},29637:{name:"TrackUID",level:3,type:"u",mandatory:!0,minver:1,range:"not 0",description:"A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file."},215:{name:"TrackNumber",level:3,type:"u",mandatory:!0,minver:1,range:"not 0",description:"The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number)."},174:{name:"TrackEntry",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Describes a track with all elements."},374648427:{name:"Tracks",level:1,type:"m",multiple:!0,minver:1,description:"A top-level block of information with many tracks described."},175:{name:"EncryptedBlock",level:2,type:"b",multiple:!0,webm:!1,description:"Similar to EncryptedBlock Structure)"},202:{name:"ReferenceTimeCode",level:4,type:"u",multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:"DivX trick track extenstions"},201:{name:"ReferenceOffset",level:4,type:"u",multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:"DivX trick track extenstions"},200:{name:"ReferenceFrame",level:3,type:"m",multiple:!1,minver:0,webm:!1,divx:!0,description:"DivX trick track extenstions"},207:{name:"SliceDuration",level:5,type:"u",default:0,description:"The (scaled) duration to apply to the element."},206:{name:"Delay",cppname:"SliceDelay",level:5,type:"u",default:0,description:"The (scaled) delay to apply to the element."},203:{name:"BlockAdditionID",cppname:"SliceBlockAddID",level:5,type:"u",default:0,description:"The ID of the BlockAdditional element (0 is the main Block)."},205:{name:"FrameNumber",cppname:"SliceFrameNumber",level:5,type:"u",default:0,description:"The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame)."},204:{name:"LaceNumber",cppname:"SliceLaceNumber",level:5,type:"u",minver:1,default:0,divx:!1,description:"The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback."},232:{name:"TimeSlice",level:4,type:"m",multiple:!0,minver:1,divx:!1,description:"Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback."},142:{name:"Slices",level:3,type:"m",minver:1,divx:!1,description:"Contains slices description."},30114:{name:"DiscardPadding",level:3,type:"i",minver:4,webm:!0,description:"Duration in nanoseconds of the silent data added to the Block (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and should be discarded during playback."},164:{name:"CodecState",level:3,type:"b",minver:2,webm:!1,description:"The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry."},253:{name:"ReferenceVirtual",level:3,type:"i",webm:!1,description:"Relative position of the data that should be in position of the virtual block."},251:{name:"ReferenceBlock",level:3,type:"i",multiple:!0,minver:1,description:"Timestamp of another frame used as a reference (ie: B or P frame). The timestamp is relative to the block it's attached to."},250:{name:"ReferencePriority",cppname:"FlagReferenced",level:3,type:"u",mandatory:!0,minver:1,webm:!1,default:0,description:"This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced."},155:{name:"BlockDuration",level:3,type:"u",minver:1,default:"TrackDuration",description:'The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track (but can be omitted as other default values). When not written and with no DefaultDuration, the value is assumed to be the difference between the timestamp of this Block and the timestamp of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. When set to 0 that means the frame is not a keyframe.'},165:{name:"BlockAdditional",level:5,type:"b",mandatory:!0,minver:1,webm:!1,description:"Interpreted by the codec as it wishes (using the BlockAddID)."},238:{name:"BlockAddID",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"not 0",description:"An ID to identify the BlockAdditional level."},166:{name:"BlockMore",level:4,type:"m",mandatory:!0,multiple:!0,minver:1,webm:!1,description:"Contain the BlockAdditional and some parameters."},30113:{name:"BlockAdditions",level:3,type:"m",minver:1,webm:!1,description:"Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data."},162:{name:"BlockVirtual",level:3,type:"b",webm:!1,description:"A Block with no data. It must be stored in the stream at the place the real Block should be in display order. (see Block Virtual)"},161:{name:"Block",level:3,type:"b",mandatory:!0,minver:1,description:"Block containing the actual data to be rendered and a timestamp relative to the Cluster Timecode. (see Block Structure)"},160:{name:"BlockGroup",level:2,type:"m",multiple:!0,minver:1,description:"Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock."},163:{name:"SimpleBlock",level:2,type:"b",multiple:!0,minver:2,webm:!0,divx:!0,description:"Similar to SimpleBlock Structure"},171:{name:"PrevSize",cppname:"ClusterPrevSize",level:2,type:"u",minver:1,description:"Size of the previous Cluster, in octets. Can be useful for backward playing.",position:"prevCluster"},167:{name:"Position",cppname:"ClusterPosition",level:2,type:"u",minver:1,webm:!1,description:"The Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.",position:"segment"},22743:{name:"SilentTrackNumber",cppname:"ClusterSilentTrackNumber",level:3,type:"u",multiple:!0,minver:1,webm:!1,description:"One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster."},231:{name:"Timecode",cppname:"ClusterTimecode",level:2,type:"u",mandatory:!0,minver:1,description:"Absolute timestamp of the cluster (based on TimecodeScale)."},524531317:{name:"Cluster",level:1,type:"m",multiple:!0,minver:1,description:"The lower level element containing the (monolithic) Block structure."},19840:{name:"MuxingApp",level:2,type:"8",mandatory:!0,minver:1,description:'Muxing application or library ("libmatroska-0.4.3").'},31657:{name:"Title",level:2,type:"8",minver:1,webm:!1,description:"General name of the segment."},2807730:{name:"TimecodeScaleDenominator",level:2,type:"u",mandatory:!0,minver:4,default:"1000000000",description:"Timestamp scale numerator, see TimecodeScale."},2807729:{name:"TimecodeScale",level:2,type:"u",mandatory:!0,minver:1,default:"1000000",description:"Timestamp scale in nanoseconds (1.000.000 means all timestamps in the segment are expressed in milliseconds)."},27045:{name:"ChapterTranslateID",level:3,type:"b",mandatory:!0,minver:1,webm:!1,description:"The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used."},27071:{name:"ChapterTranslateCodec",level:3,type:"u",mandatory:!0,minver:1,webm:!1,description:"The chapter codec using this ID (0: Matroska Script, 1: DVD-menu)."},27132:{name:"ChapterTranslateEditionUID",level:3,type:"u",multiple:!0,minver:1,webm:!1,description:"Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment."},4096955:{name:"NextFilename",level:2,type:"8",minver:1,webm:!1,description:"An escaped filename corresponding to the next segment."},4110627:{name:"NextUID",level:2,type:"b",minver:1,webm:!1,bytesize:16,description:"A unique ID to identify the next chained segment (128 bits)."},3965867:{name:"PrevFilename",level:2,type:"8",minver:1,webm:!1,description:"An escaped filename corresponding to the previous segment."},3979555:{name:"PrevUID",level:2,type:"b",minver:1,webm:!1,bytesize:16,description:"A unique ID to identify the previous chained segment (128 bits)."},29604:{name:"SegmentUID",level:2,type:"b",minver:1,webm:!1,range:"not 0",bytesize:16,description:"A randomly generated unique ID to identify the current segment between many others (128 bits)."},357149030:{name:"Info",level:1,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Contains miscellaneous general information and statistics on the file."},21420:{name:"SeekPosition",level:3,type:"u",mandatory:!0,minver:1,description:"The position of the element in the segment in octets (0 = first level 1 element).",position:"segment"},21419:{name:"SeekID",level:3,type:"b",mandatory:!0,minver:1,description:"The binary ID corresponding to the element name.",type2:"ebmlID"},19899:{name:"Seek",cppname:"SeekPoint",level:2,type:"m",mandatory:!0,multiple:!0,minver:1,description:"Contains a single seek entry to an EBML element."},290298740:{name:"SeekHead",cppname:"SeekHeader",level:1,type:"m",multiple:!0,minver:1,description:"Contains the position of other level 1 elements."},32379:{name:"SignatureElementList",level:2,type:"m",multiple:!0,webm:!1,i:"Cluster|Block|BlockAdditional",description:"A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption."},32347:{name:"SignatureElements",level:1,type:"m",webm:!1,description:"Contains elements that will be used to compute the signature."},32437:{name:"Signature",level:1,type:"b",webm:!1,description:"The signature of the data (until a new."},32421:{name:"SignaturePublicKey",level:1,type:"b",webm:!1,description:"The public key to use with the algorithm (in the case of a PKI-based signature)."},32410:{name:"SignatureHash",level:1,type:"u",webm:!1,description:"Hash algorithm used (1=SHA1-160, 2=MD5)."},32394:{name:"SignatureAlgo",level:1,type:"u",webm:!1,description:"Signature algorithm used (1=RSA, 2=elliptic)."},458458727:{name:"SignatureSlot",level:-1,type:"m",multiple:!0,webm:!1,description:"Contain signature of some (coming) elements in the stream."},191:{name:"CRC-32",level:-1,type:"b",minver:1,webm:!1,description:"The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian",crc:!0},236:{name:"Void",level:-1,type:"b",minver:1,description:"Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use."},17139:{name:"EBMLMaxSizeLength",level:1,type:"u",mandatory:!0,default:8,minver:1,description:"The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid."},17138:{name:"EBMLMaxIDLength",level:1,type:"u",mandatory:!0,default:4,minver:1,description:"The maximum length of the IDs you'll find in this file (4 or less in Matroska)."},17143:{name:"EBMLReadVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The minimum EBML version a parser has to support to read this file."},440786851:{name:"EBML",level:"0",type:"m",mandatory:!0,multiple:!0,minver:1,description:"Set the EBML characteristics of the data to follow. Each EBML document has to start with this."},21936:{name:"Colour",level:"4",type:"m",mandatory:!0,multiple:!0,description:"Settings describing the colour format."},21937:{name:"MatrixCoefficients",level:"5",type:"u",mandatory:!0,multiple:!0,description:"The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273."},21945:{name:"Range",level:"5",type:"u",mandatory:!0,multiple:!0,description:"Clipping of the color ranges."},21946:{name:"TransferCharacteristics",level:"5",type:"u",mandatory:!0,multiple:!0,description:"The transfer characteristics of the video."},21947:{name:"Primaries",level:"5",type:"u",mandatory:!0,multiple:!0,description:"The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273."}}},1384:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.tools=t.Reader=t.Encoder=t.Decoder=void 0,i(n(4990),t);var o=n(2800);t.Decoder=o.default;var a=n(8031);t.Encoder=a.default;var s=n(1381);t.Reader=s.default;var l=n(3210);t.tools=l},190:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)},i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3210),a=function(){function e(){}return e.readVint=function(t,n){void 0===n&&(n=0);var r=8-Math.floor(Math.log2(t[n]));if(r>8){var i=e.readHexString(t,n,n+r);throw new Error("Unrepresentable length: ".concat(r," ").concat(i))}if(n+r>t.length)return null;for(var o=t[n]&(1<<8-r)-1,a=1;a<r;a+=1){if(7===a&&o>=Math.pow(2,8)&&t[n+7]>0)return{length:r,value:-1};o*=Math.pow(2,8),o+=t[n+a]}return{length:r,value:o}},e.writeVint=function(e){if(e<0||e>Math.pow(2,53))throw new Error("Unrepresentable value: ".concat(e));var t=1;for(t=1;t<=8&&!(e<Math.pow(2,7*t)-1);t+=1);for(var n=o.Buffer.alloc(t),r=e,i=1;i<=t;i+=1){var a=255&r;n[t-i]=a,r-=a,r/=Math.pow(2,8)}return n[0]|=1<<8-t,n},e.concatenate=function(e,t){return e||t?e&&0!==e.byteLength?t&&0!==t.byteLength?o.Buffer.from(i(i([],e,!0),t,!0)):e:t:o.Buffer.from([])},e.readHexString=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),Array.from(e.slice(t,n)).map((function(e){return Number(e).toString(16)})).reduce((function(e,t){return"".concat(e).concat(t.padStart(2,"0"))}),"")},e.readUtf8=function(e){try{return o.Buffer.from(e).toString("utf8")}catch(e){return null}},e.readUnsigned=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return n.getUint8(0);case 2:return n.getUint16(0);case 4:return n.getUint32(0)}return t.byteLength<=6?t.reduce((function(e,t){return 256*e+t}),0):e.readHexString(t,0,t.byteLength)},e.readSigned=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:return NaN}},e.readFloat=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return t.getFloat32(0);case 8:return t.getFloat64(0);default:return NaN}},e.readDate=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return new Date(n.getUint8(0));case 2:return new Date(n.getUint16(0));case 4:return new Date(n.getUint32(0));case 8:return new Date(Number.parseInt(e.readHexString(t),16));default:return new Date(0)}},e.readDataFromTag=function(t,n){var i,o=t.type,a=t.name,s=t.track,l=t.discardable||!1,c=t.keyframe||!1,u=null;switch(o){case"u":i=e.readUnsigned(n);break;case"f":i=e.readFloat(n);break;case"i":i=e.readSigned(n);break;case"s":i=String.fromCharCode.apply(String,n);break;case"8":i=e.readUtf8(n);break;case"d":i=e.readDate(n)}if("SimpleBlock"===a||"Block"===a){var d=0,f=e.readVint(n,d),p=f.length;d+=p,s=f.value,i=e.readSigned(n.subarray(d,d+2)),d+=2,"SimpleBlock"===a&&(c=Boolean(128&n[p+2]),l=Boolean(1&n[p+2])),d+=1,u=n.subarray(d)}return r(r({},t),{data:n,discardable:l,keyframe:c,payload:u,track:s,value:i})},e}();t.default=a},3210:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertEBMLDateToJSDate=t.createFloatBuffer=t.createIntBuffer=t.createUIntBuffer=t.encodeValueToBuffer=t.concat=t.putRefinedMetaData=t.extractElement=t.removeElement=t.makeMetadataSeekable=t.createRIFFChunk=t.VP8BitStreamToRiffWebPBuffer=t.WebPBlockFilter=t.encodeTag=t.readBlock=t.ebmlBlock=t.writeVint=t.readVint=t.Buffer=void 0;var r=n(1166),i=n(8031),o=n(8764),a=n(190),s=n(1586);function l(e,n){var r=new t.Buffer(4);return r.writeUInt32LE(n.byteLength,0),h([new t.Buffer(e.substr(0,4),"ascii"),r,n,new t.Buffer(n.byteLength%2==0?0:1)])}function c(e,t){for(var n=-1,r=0;r<t.length;r++){var i=t[r];if(i.name===e){if("m"!==i.type)return void t.splice(r,1);if(i.isEnd){if(-1==n)throw new Error("Detected ".concat(e," closing element before finding the start"));return void t.splice(n,r-n+1)}n=r}}}function u(e,t){for(var n=[],r=-1,i=0;i<t.length;i++){var o=t[i];if(o.name===e){if("m"!==o.type){n.push(t[i]);break}if(o.isEnd){if(-1==r)throw new Error("Detected ".concat(e," closing element before finding the start"));n=t.slice(r,i+1);break}r=i}}return n}function d(e){var t=new i.default;return e.reduce((function(e,n){return e.concat(t.encode([n]))}),[]).reduce((function(e,t){return e+t.byteLength}),0)}function f(e,n,r){var i=r.duration,o=r.clusterPtrs,a=r.cues,s=e.slice(0);if("number"==typeof i){var l=!1;s.forEach((function(e){"f"===e.type&&"Duration"===e.name&&(l=!0,e.data=v(i,8))})),l||p(s,"Info",[{name:"Duration",type:"f",data:v(i,8)}])}Array.isArray(a)&&p(s,"Cues",function(e,t){var n=[];return e.forEach((function(e){var r=e.CueTrack,i=e.CueClusterPosition,o=e.CueTime;n.push({name:"CuePoint",type:"m",isEnd:!1}),n.push({name:"CueTime",type:"u",data:m(o)}),n.push({name:"CueTrackPositions",type:"m",isEnd:!1}),n.push({name:"CueTrack",type:"u",data:m(r)}),n.push({name:"CueClusterPosition",type:"u",data:m(i+t)}),n.push({name:"CueTrackPositions",type:"m",isEnd:!0}),n.push({name:"CuePoint",type:"m",isEnd:!0})})),n}(a,n));var c=[];return Array.isArray(o)&&(console.warn("append cluster pointers to seekhead is deprecated. please use cues"),c=function(e,n){var r=[];return e.forEach((function(e){r.push({name:"Seek",type:"m",isEnd:!1}),r.push({name:"SeekID",type:"b",data:new t.Buffer([31,67,182,117])}),r.push({name:"SeekPosition",type:"u",data:m(e+n)}),r.push({name:"Seek",type:"m",isEnd:!0})})),r}(o,n)),p(s,"SeekHead",c,!0),s}function p(e,t,n,r){void 0===r&&(r=!1);for(var i=-1,o=0;o<e.length;o++){var a=e[o];if("m"===a.type&&a.name===t&&!1===a.isEnd){i=o;break}}i>=0?Array.prototype.splice.apply(e,[i+1,0].concat(n)):r?[].concat([{name:t,type:"m",isEnd:!1}],n,[{name:t,type:"m",isEnd:!0}]).reverse().forEach((function(t){e.unshift(t)})):(e.push({name:t,type:"m",isEnd:!1}),n.forEach((function(t){e.push(t)})),e.push({name:t,type:"m",isEnd:!0}))}function h(e){return t.Buffer.concat(e)}function m(e){for(var n=1;e>=Math.pow(2,8*n);n++);if(n>=7)return console.warn("7bit or more bigger uint not supported."),new r.Uint64BE(e).toBuffer();var i=new t.Buffer(n);return i.writeUIntBE(e,0,n),i}function g(e){for(var n=1;e>=Math.pow(2,8*n);n++);if(n>=7)return console.warn("7bit or more bigger uint not supported."),new r.Int64BE(e).toBuffer();var i=new t.Buffer(n);return i.writeIntBE(e,0,n),i}function v(e,n){var r;if(void 0===n&&(n=8),8===n)return(r=new t.Buffer(8)).writeDoubleBE(e,0),r;if(4===n)return(r=new t.Buffer(4)).writeFloatBE(e,0),r;throw new Error("float type bits must 4bytes or 8bytes")}t.Buffer=o.Buffer,t.readVint=a.default.readVint,t.writeVint=a.default.writeVint,t.ebmlBlock=s,t.readBlock=function(e){return(0,t.ebmlBlock)(new t.Buffer(e))},t.encodeTag=function(e,n,r){return void 0===r&&(r=!1),h([e,r?new t.Buffer("01ffffffffffffff","hex"):(0,t.writeVint)(n.length),n])},t.WebPBlockFilter=function(e){return e.reduce((function(e,n){return"b"!==n.type||"SimpleBlock"!==n.name?e:(0,t.ebmlBlock)(n.data).frames.some((function(e){return"9d012a"===e.slice(3,6).toString("hex")}))?e.concat(n):e}),[])},t.VP8BitStreamToRiffWebPBuffer=function(e){var n=l("VP8 ",e);return l("RIFF",h([new t.Buffer("WEBP","ascii"),n]))},t.createRIFFChunk=l,t.makeMetadataSeekable=function(e,n,r){var o=u("EBML",e),a=d(o)+12,s=e[e.length-1].dataEnd-a,l=u("Info",e);c("Duration",l),l.splice(1,0,{name:"Duration",type:"f",data:v(n,8)});for(var f=d(l),p=u("Tracks",e),h=d(p),g=47,y=[],b=5+15*r.length,w=[],x=-1,_=function(e){var n=g,i=n+f,o=i+h,l=o+b-s;if((y=[]).push({name:"SeekHead",type:"m",isEnd:!1}),y.push({name:"Seek",type:"m",isEnd:!1}),y.push({name:"SeekID",type:"b",data:new t.Buffer([21,73,169,102])}),y.push({name:"SeekPosition",type:"u",data:m(n)}),y.push({name:"Seek",type:"m",isEnd:!0}),y.push({name:"Seek",type:"m",isEnd:!1}),y.push({name:"SeekID",type:"b",data:new t.Buffer([22,84,174,107])}),y.push({name:"SeekPosition",type:"u",data:m(i)}),y.push({name:"Seek",type:"m",isEnd:!0}),y.push({name:"Seek",type:"m",isEnd:!1}),y.push({name:"SeekID",type:"b",data:new t.Buffer([28,83,187,107])}),y.push({name:"SeekPosition",type:"u",data:m(o)}),y.push({name:"Seek",type:"m",isEnd:!0}),y.push({name:"SeekHead",type:"m",isEnd:!0}),g=d(y),(w=[]).push({name:"Cues",type:"m",isEnd:!1}),r.forEach((function(e){var t=e.CueTrack,n=e.CueClusterPosition,r=e.CueTime;w.push({name:"CuePoint",type:"m",isEnd:!1}),w.push({name:"CueTime",type:"u",data:m(r)}),w.push({name:"CueTrackPositions",type:"m",isEnd:!1}),w.push({name:"CueTrack",type:"u",data:m(t)}),n-=a,n+=l,w.push({name:"CueClusterPosition",type:"u",data:m(n)}),w.push({name:"CueTrackPositions",type:"m",isEnd:!0}),w.push({name:"CuePoint",type:"m",isEnd:!0})})),w.push({name:"Cues",type:"m",isEnd:!0}),b=d(w),x===l)return"break";if(x=l,9===e)throw new Error("Failed to converge to a stable metadata size")},k=0;k<10;k++){if("break"===_(k))break}var E=[].concat.apply([],[o,{name:"Segment",type:"m",isEnd:!1,unknownSize:!0},y,l,p,w]);return(new i.default).encode(E)},t.removeElement=c,t.extractElement=u,t.putRefinedMetaData=function(e,n){Array.isArray(n.cueInfos)&&!Array.isArray(n.cues)&&(console.warn("putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues"),n.cues=n.cueInfos);for(var r=[],o=[],a=0;a<e.length;a++){var s=e[a];if("m"===s.type&&"Segment"===s.name){if(r=e.slice(0,a),o=e.slice(a),s.unknownSize){o.shift();break}throw new Error("this metadata is not streaming webm file")}}if(!(o[o.length-1].dataEnd>0))throw new Error("metadata dataEnd has wrong number");var l,c=o[o.length-1].dataEnd,u=r[r.length-1].dataEnd,d=(new i.default).encode(r).byteLength-u,p=c-o[0].tagStart,h=(o[0].tagStart,o[0].tagStart,new t.Buffer([24,83,128,103])),m=new t.Buffer("01ffffffffffffff","hex"),g=h.byteLength+m.byteLength,v=p;for(l=1;l<20;l++){var y=f(o,d+(u+g+v-c),n),b=(new i.default).encode(y).byteLength;if(b===v)return(new i.default).encode([].concat(r,[{type:"m",name:"Segment",isEnd:!1,unknownSize:!0}],y));v=b}throw new Error("unable to refine metadata, stable size could not be found in "+l+" iterations!")},t.concat=h,t.encodeValueToBuffer=function(e){var n=new t.Buffer(0);if("m"===e.type)return e;switch(e.type){case"u":n=m(e.value);break;case"i":n=g(e.value);break;case"f":n=v(e.value);break;case"s":n=new t.Buffer(e.value,"ascii");break;case"8":n=new t.Buffer(e.value,"utf8");break;case"b":n=e.value;break;case"d":n=new r.Int64BE(e.value.getTime().toString()).toBuffer()}return Object.assign({},e,{data:n})},t.createUIntBuffer=m,t.createIntBuffer=g,t.createFloatBuffer=v,t.convertEBMLDateToJSDate=function(e){return e instanceof Date?e:new Date(new Date("2001-01-01T00:00:00.000Z").getTime()+Number(e)/1e3/1e3)}},8246:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1384);t.default=function(e){return r(this,void 0,void 0,(function(){var t,n,r,a,s,l,c,u,d,f,p;return i(this,(function(i){switch(i.label){case 0:if(!e)throw Error("call to fixWebmDuration requires a blob");t=new o.Decoder,n=new o.Reader,r=e.stream(),a=r.getReader(),i.label=1;case 1:return[4,a.read()];case 2:return s=i.sent(),l=s.done,c=s.value,l?(n.stop(),[3,3]):((u=null==(u=t.decode(c))?void 0:u.filter((function(e){return"unknown"!==e.type}))).forEach((function(e){n.read(e)})),c=null,[3,1]);case 3:return d=o.tools.makeMetadataSeekable(n.metadatas,n.duration,n.cues),f=new Blob([d],{type:e.type}),p=e.slice(n.metadataSize),[2,new Blob([f,p],{type:e.type})]}}))}))}}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var o=r[e]={id:e,exports:{}};return n[e].call(o.exports,o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&r&&n;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>a[e]=()=>n[e]));return a.default=()=>n,i.d(o,a),o},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0,(()=>{"use strict";var e=i(7294),t=i.t(e,2),n=i(9060),r=i(3379),o=i.n(r),a=i(7795),s=i.n(a),l=i(569),c=i.n(l),u=i(3565),d=i.n(u),f=i(9216),p=i.n(f),h=i(4589),m=i.n(h),g=i(8629),v={};v.styleTagTransform=m(),v.setAttributes=d(),v.insert=c().bind(null,"head"),v.domAPI=s(),v.insertStyleElement=p();o()(g.Z,v);g.Z&&g.Z.locals&&g.Z.locals;var y=i(6668),b={};b.styleTagTransform=m(),b.setAttributes=d(),b.insert=c().bind(null,"head"),b.domAPI=s(),b.insertStyleElement=p();o()(y.Z,b);y.Z&&y.Z.locals&&y.Z.locals;var w=i(24),x={};x.styleTagTransform=m(),x.setAttributes=d(),x.insert=c().bind(null,"head"),x.domAPI=s(),x.insertStyleElement=p();o()(w.Z,x);const _=w.Z&&w.Z.locals?w.Z.locals:void 0;var k=i(6027),E=i.n(k),S=i(8246),C=i.n(S),T=i(9483),A=i.n(T);function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}function P(e){return function(e){if(Array.isArray(e))return z(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){L(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function L(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==O(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==O(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===O(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */I=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new M(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(N([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==O(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function N(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(O(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=N,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:N(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function D(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){D(o,r,i,a,s,"next",e)}function s(e){D(o,r,i,a,s,"throw",e)}a(void 0)}))}}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||j(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(e,t):void 0}}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}A().config({driver:A().INDEXEDDB,name:"screenity",version:1});var U=A().createInstance({name:"chunks",storeName:"keyvaluepairs"}),F=(0,e.createContext)();const W=function(t){var n=(0,e.useRef)([]),r=(0,e.useRef)(!1),i=(0,e.useRef)(0),o=B((0,e.useState)({time:0,editLimit:420,blob:null,webm:null,originalBlob:null,updatePlayerTime:!1,start:0,end:1,trimming:!1,cutting:!1,muting:!1,history:[{}],redoHistory:[],undoDisabled:!0,redoDisabled:!0,duration:0,mode:"player",ffmpegLoaded:!1,frame:null,getFrame:null,isFfmpegRunning:!1,reencoding:!1,prevWidth:0,width:0,prevHeight:0,height:0,top:0,left:0,fromCropper:!1,base64:null,saveDrive:!1,downloading:!1,downloadingWEBM:!1,downloadingGIF:!1,volume:1,cropPreset:"none",replaceAudio:!1,title:null,ready:!1,mp4ready:!1,saved:!1,iframeRef:null,offline:!1,updateChrome:!1,driveEnabled:!1,hasBeenEdited:!1,dragInteracted:!1,noffmpeg:!1,openModal:null,rawBlob:null,override:!1,fallback:!1,chunkCount:0,chunkIndex:0}),2),a=o[0],s=o[1],l=(0,e.useRef)(a),c=function(){var e=R(I().mark((function e(){var t,n,r;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,U.ready();case 3:return e.next=5,U.iterate((function(e){t.push(e)}));case 5:t.sort((function(e,t){var n,r;return(null!==(n=e.timestamp)&&void 0!==n?n:0)-(null!==(r=t.timestamp)&&void 0!==r?r:0)})),n=t.map((function(e){return e.chunk instanceof Blob?e.chunk:new Blob([e.chunk])})),r=new Blob(n,{type:"video/webm"}),h(r);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){l.current=a}),[a]),(0,e.useEffect)((function(){var e=(new Date).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0});s((function(t){return N(N({},t),{},{title:"Screenity video - ".concat(e)})}))}),[]),(0,e.useEffect)((function(){a.saved?window.onbeforeunload=null:window.onbeforeunload=function(){return!0}}),[a.saved]);var u=(0,e.useCallback)((function(){s((function(e){return N(N({},e),{},{history:[].concat(P(e.history),[e]),redoHistory:[]})}))}),[a]),d=(0,e.useCallback)((function(){if(a.history.length>1){var e=a.history[a.history.length-2],t=a.history.slice(0,-1);s((function(n){return N(N(N({},n),e),{},{history:t,redoHistory:[a].concat(P(a.redoHistory))})}))}}),[a]),f=(0,e.useCallback)((function(){if(a.redoHistory.length>0){var e=a.redoHistory[0],t=a.redoHistory.slice(1);s((function(n){return N(N(N({},n),e),{},{history:[].concat(P(a.history),[a]),redoHistory:t})}))}}),[a]),p=function(e){var t=e.match(/^data:(.*?);base64,/);if(null!==t){for(var n=t[1],r=atob(e.slice(t[0].length)),i=new Uint8Array(r.length),o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return new Blob([i],{type:n})}for(var a=atob(e),s=new Uint8Array(a.length),l=0;l<a.length;l++)s[l]=a.charCodeAt(l);return s};(0,e.useEffect)((function(){if(a.blob){var e=document.createElement("video");e.preload="metadata",e.onloadedmetadata=R(I().mark((function t(){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:s((function(t){return N(N({},t),{},{duration:e.duration,width:e.videoWidth,height:e.videoHeight,prevWidth:e.videoWidth,prevHeight:e.videoHeight})})),URL.revokeObjectURL(e.src),e.remove();case 3:case"end":return t.stop()}}),t)}))),e.src=URL.createObjectURL(a.blob)}}),[a.blob]);var h=function(){var e=R(I().mark((function e(t){var r,i,o,a,c,u,d,f,p,h;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t||new Blob(n.current,{type:"video/webm; codecs=vp8, opus"}),e.next=3,chrome.storage.local.get("recordingDuration");case 3:return i=e.sent,o=i.recordingDuration,e.next=7,chrome.storage.local.get("token");case 7:if(a=e.sent,c=a.token,u=!1,c&&null!==c&&(u=!0),s((function(e){return N(N({},e),{},{rawBlob:r,duration:o/1e3})})),d=navigator.userAgent.match(/Windows NT 10.0/),e.prev=13,!(o>0&&null!==o)){e.next=31;break}if(d){e.next=19;break}E()(r,o,function(){var e=R(I().mark((function e(t){var n;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(l.current.fallback||l.current.updateChrome||l.current.noffmpeg||l.current.duration>l.current.editLimit&&!l.current.override)){e.next=4;break}return s((function(e){return N(N({},e),{},{webm:t,ready:!0})})),chrome.runtime.sendMessage({type:"recording-complete"}),e.abrupt("return");case 4:(n=new FileReader).onloadend=function(){var e=n.result;s((function(t){return N(N({},t),{},{base64:e,driveEnabled:u})}))},n.readAsDataURL(t);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{logger:!1}),e.next=29;break;case 19:return e.next=21,C()(r,{type:"video/webm; codecs=vp8, opus"});case 21:if(f=e.sent,!(l.current.fallback||l.current.updateChrome||l.current.noffmpeg||l.current.duration>l.current.editLimit&&!l.current.override)){e.next=26;break}return s((function(e){return N(N({},e),{},{webm:f,ready:!0})})),chrome.runtime.sendMessage({type:"recording-complete"}),e.abrupt("return");case 26:(p=new FileReader).onloadend=function(){var e=p.result;s((function(t){return N(N({},t),{},{base64:e,driveEnabled:u})}))},p.readAsDataURL(f);case 29:e.next=38;break;case 31:if(!(l.current.fallback||l.current.updateChrome||l.current.noffmpeg||l.current.duration>l.current.editLimit&&!l.current.override)){e.next=35;break}return s((function(e){return N(N({},e),{},{webm:r,ready:!0})})),chrome.runtime.sendMessage({type:"recording-complete"}),e.abrupt("return");case 35:(h=new FileReader).onloadend=function(){var e=h.result;s((function(t){return N(N({},t),{},{base64:e,driveEnabled:u})}))},h.readAsDataURL(r);case 38:e.next=44;break;case 40:e.prev=40,e.t0=e.catch(13),s((function(e){return N(N({},e),{},{webm:r,ready:!0})})),chrome.runtime.sendMessage({type:"recording-complete"});case 44:case"end":return e.stop()}}),e,null,[[13,40]])})));return function(t){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){i.current=a.chunkCount}),[a.chunkCount]);(0,e.useEffect)((function(){var e=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);e&&parseInt(e[2],10)<109&&s((function(e){return N(N({},e),{},{updateChrome:!0,noffmpeg:!0})}))}),[]);var m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;r.current||(r.current=!0,s((function(e){return N(N({},e),{},{override:t.override})})),"function"==typeof l.current.openModal&&chrome.storage.local.get("memoryError",(function(e){e.memoryError&&null!==e.memoryError&&(chrome.storage.local.set({memoryError:!1}),l.current.openModal(chrome.i18n.getMessage("memoryLimitTitle"),chrome.i18n.getMessage("memoryLimitDescription"),chrome.i18n.getMessage("understoodButton"),null,(function(){}),(function(){}),null,chrome.i18n.getMessage("learnMoreDot"),(function(){chrome.runtime.sendMessage({type:"memory-limit-help"})})))})),h(),null!==e&&e({status:"ok"}))},g=(0,e.useCallback)((function(e,t,r){var o=e;if("chunk-count"===o.type)s((function(e){return N(N({},e),{},{chunkCount:o.count,override:o.override})}));else{if("new-chunk-tab"===o.type)return function(e,t){return R(I().mark((function r(){return I().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,Promise.all(e.map(function(){var e=R(I().mark((function e(t){var r;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(l.current.chunkIndex>=i.current)){e.next=3;break}return console.warn("Too many chunks received"),e.abrupt("return");case 3:r=p(t.chunk),n.current.push(r),s((function(e){return N(N({},e),{},{chunkIndex:e.chunkIndex+1})}));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:t({status:"ok"}),r.next=9;break;case 6:r.prev=6,r.t0=r.catch(0),console.error("Error processing batch",r.t0);case 9:case"end":return r.stop()}}),r,null,[[0,6]])})))(),!0}(o.chunks,r);if("make-video-tab"===o.type)return m(r,o),!0;"saved-to-drive"===o.type?s((function(e){return N(N({},e),{},{saveDrive:!1,driveEnabled:!0,saved:!0})})):"restore-recording"===o.type?(s((function(e){return N(N({},e),{},{fallback:!0,isFfmpegRunning:!1,noffmpeg:!0,ffmpegLoaded:!0,ffmpeg:!0})})),c()):"large-recording"===o.type?(s((function(e){return N(N({},e),{},{isFfmpegRunning:!1,noffmpeg:!0,ffmpegLoaded:!0,ffmpeg:!0})})),c()):"fallback-recording"===o.type&&s((function(e){return N(N({},e),{},{fallback:!0,isFfmpegRunning:!1,noffmpeg:!0,ffmpegLoaded:!0,ffmpeg:!0})}))}}),[r.current,n.current,a,l.current]);(0,e.useEffect)((function(){var e=function(e,t,n){return!0===g(e,t,n)};return chrome.runtime.onMessage.addListener(e),function(){chrome.runtime.onMessage.removeListener(e)}}),[]);var v=function(){var e=R(I().mark((function e(t){var n,r,i,o,l,c,u,d,f,h;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"updated-blob"===t.data.type?(n=t.data.base64,r=new Blob([p(n)],{type:"video/mp4"}),s((function(e){return N(N({},e),{},{blob:r,mp4ready:!0,hasBeenEdited:!0,isFfmpegRunning:!1,reencoding:!1,trimming:!1,cutting:!1,muting:!1,cropping:!1})})),(i=document.createElement("video")).preload="metadata",i.onloadedmetadata=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s((function(e){return N(N({},e),{},{duration:i.duration,width:i.videoWidth,height:i.videoHeight,start:0,end:1})})),t.data.addToHistory&&a.addToHistory(),URL.revokeObjectURL(i.src),i.remove();case 4:case"end":return e.stop()}}),e)}))),i.src=URL.createObjectURL(r),a.originalBlob||s((function(e){return N(N({},e),{},{originalBlob:r})}))):"download-mp4"===t.data.type?(o=t.data.base64,l=new Blob([p(o)],{type:"video/mp4"}),c=URL.createObjectURL(l),A(c,".mp4"),s((function(e){return N(N({},e),{},{saved:!0,isFfmpegRunning:!1,downloading:!1})}))):"download-gif"===t.data.type?(u=t.data.base64,d=new Blob([p(u)],{type:"image/gif"}),f=URL.createObjectURL(d),A(f,".gif"),s((function(e){return N(N({},e),{},{saved:!0,isFfmpegRunning:!1,downloadingGIF:!1})}))):"new-frame"===t.data.type?(h=URL.createObjectURL(t.data.frame),s((function(e){return N(N({},e),{},{frame:h,isFfmpegRunning:!1})}))):"ffmpeg-loaded"===t.data.type?s((function(e){return N(N({},e),{},{ffmpeg:!0,ffmpegLoaded:!0,isFfmpegRunning:!1})})):"ffmpeg-load-error"===t.data.type?s((function(e){return N(N({},e),{},{ffmpeg:!0,noffmpeg:!0,ffmpegLoaded:!0,isFfmpegRunning:!1})})):"crop-update"===t.data.type&&s((function(e){return N(N({},e),{},{mode:"player",start:0,end:1})}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){return window.addEventListener("message",v),function(){return window.removeEventListener("message",v)}}),[v]);var y=function(e){window.parent.postMessage(e,"*")},b=function(){var e=R(I().mark((function e(){var t;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a.fallback||a.noffmpeg||a.duration>a.editLimit&&!a.override)){e.next=2;break}return e.abrupt("return");case 2:t=new Blob([p(a.base64)],{type:"video/webm"}),s((function(e){return N(N({},e),{},{webm:t,ready:!0})})),a.offline&&!0===a.ffmpeg||!a.updateChrome&&(a.duration<=a.editLimit||a.override)&&y({type:"base64-to-blob",base64:a.base64}),chrome.runtime.sendMessage({type:"recording-complete"});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,e.useEffect)((function(){a.base64&&a.ffmpeg&&a.ffmpegLoaded&&b()}),[a.base64,a.ffmpeg,a.ffmpegLoaded]);var w=(0,e.useCallback)(R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a.blob){e.next=2;break}return e.abrupt("return");case 2:if(a.ffmpeg){e.next=4;break}return e.abrupt("return");case 4:if(!a.isFfmpegRunning){e.next=6;break}return e.abrupt("return");case 6:s((function(e){return N(N({},e),{},{isFfmpegRunning:!0})})),y({type:"get-frame",time:0,blob:a.blob});case 8:case"end":return e.stop()}}),e)}))),[a.blob,a.ffmpeg,a.isFfmpegRunning]),x=function(){var e=R(I().mark((function e(t,n,r){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>a.editLimit)||a.override){e.next=4;break}return e.abrupt("return");case 4:s((function(e){return N(N({},e),{},{isFfmpegRunning:!0})})),y({type:"add-audio-to-video",blob:t,audio:n,duration:a.duration,volume:r,replaceAudio:a.replaceAudio});case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),_=function(){var e=R(I().mark((function e(t){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>a.editLimit)||a.override){e.next=4;break}return e.abrupt("return");case 4:s(t?function(e){return N(N({},e),{},{cutting:!0})}:function(e){return N(N({},e),{},{trimming:!0})}),s((function(e){return N(N({},e),{},{isFfmpegRunning:!0})})),y({type:"cut-video",blob:a.blob,startTime:a.start*a.duration,endTime:a.end*a.duration,cut:t,duration:a.duration,encode:!1});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),k=function(){var e=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.muting){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>a.editLimit)||a.override){e.next=4;break}return e.abrupt("return");case 4:s((function(e){return N(N({},e),{},{muting:!0,isFfmpegRunning:!0})})),y({type:"mute-video",blob:a.blob,startTime:a.start*a.duration,endTime:a.end*a.duration,duration:a.duration});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=function(){var e=R(I().mark((function e(t,n,r,i){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.cropping){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>a.editLimit)||a.override){e.next=4;break}return e.abrupt("return");case 4:return s((function(e){return N(N({},e),{},{cropping:!0,isFfmpegRunning:!0})})),y({type:"crop-video",blob:a.blob,x:t,y:n,width:r,height:i}),e.abrupt("return",!0);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),T=function(){var e=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning){e.next=2;break}return e.abrupt("return");case 2:return s((function(e){return N(N({},e),{},{isFfmpegRunning:!0,reencoding:!0})})),y({type:"reencode-video",blob:a.blob,duration:a.duration}),e.abrupt("return",!0);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),A=function(){var e=R(I().mark((function e(t,n){var r,i,o,a,s;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.current.title.replace(/[\/\\:?~<>|*]/g," ").trim()+n,i=function(){try{URL.revokeObjectURL(t)}catch(e){}},e.t1=navigator.brave,!e.t1){e.next=7;break}return e.next=6,navigator.brave.isBrave();case 6:e.t1=e.sent;case 7:if(e.t0=e.t1,e.t0){e.next=10;break}e.t0=!1;case 10:if(!e.t0){e.next=20;break}return e.next=13,fetch(t);case 13:return o=e.sent,e.next=16,o.blob();case 16:return a=e.sent,e.next=19,new Promise((function(e){var t=new FileReader;t.onloadend=function(){chrome.runtime.sendMessage({type:"request-download",base64:t.result,title:r}),i(),e()},t.readAsDataURL(a)}));case 19:return e.abrupt("return");case 20:return e.next=22,new Promise((function(e,n){chrome.downloads.download({url:t,filename:r,saveAs:!0},(function(t){chrome.runtime.lastError||!t?n(chrome.runtime.lastError||new Error("Download failed")):e(t)}))}));case 22:return s=e.sent,e.next=25,new Promise((function(e){var n=function(){var o=R(I().mark((function o(a){var l,c,u,d;return I().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(a.id===s&&a.state){o.next=2;break}return o.abrupt("return");case 2:if(c=function(){chrome.downloads.onChanged.removeListener(n),i(),e()},"interrupted"!==a.state.current||"USER_CANCELED"===(null===(l=a.error)||void 0===l?void 0:l.current)){o.next=18;break}return o.prev=4,o.next=7,fetch(t);case 7:return u=o.sent,o.next=10,u.blob();case 10:return d=o.sent,o.next=13,new Promise((function(e){var t=new FileReader;t.onloadend=function(){chrome.runtime.sendMessage({type:"request-download",base64:t.result,title:r}),e()},t.readAsDataURL(d)}));case 13:return o.prev=13,c(),o.finish(13);case 16:o.next=19;break;case 18:"complete"!==a.state.current&&"interrupted"!==a.state.current||c();case 19:case"end":return o.stop()}}),o,null,[[4,,13,16]])})));return function(e){return o.apply(this,arguments)}}();chrome.downloads.onChanged.addListener(n)}));case 25:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),O=function(){var e=R(I().mark((function e(){var t;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.downloading){e.next=2;break}return e.abrupt("return");case 2:s((function(e){return N(N({},e),{},{downloading:!0,isFfmpegRunning:!0})})),t=URL.createObjectURL(a.blob),A(t,".mp4"),s((function(e){return N(N({},e),{},{downloading:!1,isFfmpegRunning:!1,saved:!0})}));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),M=function(){var e=R(I().mark((function e(){var t;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.downloadingWEBM){e.next=2;break}return e.abrupt("return");case 2:s((function(e){return N(N({},e),{},{downloadingWEBM:!0,isFfmpegRunning:!0})})),t=URL.createObjectURL(a.webm),A(t,".webm"),s((function(e){return N(N({},e),{},{downloadingWEBM:!1,isFfmpegRunning:!1,saved:!0})}));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.isFfmpegRunning&&!a.downloading){e.next=2;break}return e.abrupt("return");case 2:if(!(a.duration>30)){e.next=4;break}return e.abrupt("return");case 4:s((function(e){return N(N({},e),{},{downloadingGIF:!0,isFfmpegRunning:!0})})),y({type:"to-gif",blob:a.blob});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),D=function(){var e=R(I().mark((function e(){return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:y({type:"load-ffmpeg"});case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return a.undo=d,a.redo=f,a.addToHistory=u,a.handleTrim=_,a.handleMute=k,a.download=O,a.handleCrop=S,a.handleReencode=T,a.getFrame=w,a.downloadGIF=L,a.downloadWEBM=M,a.addAudio=x,a.loadFFmpeg=D,e.createElement(F.Provider,{value:[a,s]},t.children)};function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function V(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */V=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==H(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(H(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function q(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach((function(t){Z(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Z(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==H(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==H(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===H(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const K=function(){var t=Y((0,e.useContext)(F),2),n=t[0],r=t[1],i=function(){var e,t=(e=V().mark((function e(){return V().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.handleReencode();case 2:r((function(e){return $($({},e),{},{mode:"player",start:0,end:1})}));case 3:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){q(o,r,i,a,s,"next",e)}function s(e){q(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return e.createElement("div",{className:_.editorNav},e.createElement("div",{className:_.navWrap},e.createElement("div",{className:_.editorNavLeft,onClick:function(){chrome.runtime.sendMessage({type:"open-home"})}},e.createElement("img",{src:"/assets/editor/logo.svg",alt:"Logo"})),e.createElement("div",{className:_.editorNavCenter},e.createElement("div",{className:_.editorNavTitle},chrome.i18n.getMessage("sandboxEditorMainTitle")," ",e.createElement("span",{className:_.beta},"BETA"))),e.createElement("div",{className:_.editorNavRight},e.createElement("button",{className:"button simpleButton blackButton",onClick:function(){r((function(e){return $($({},e),{},{mode:"player",blob:n.originalBlob,start:0,end:1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorCancelButton")),e.createElement("button",{className:"button secondaryButton",onClick:function(){r((function(e){return $($({},e),{},{blob:n.originalBlob,start:0,end:1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorRevertButton")),e.createElement("button",{className:"button primaryButton",onClick:i,disabled:n.isFfmpegRunning},n.reencoding?chrome.i18n.getMessage("sandboxEditorSaveProgressButton"):chrome.i18n.getMessage("sandboxEditorSaveButton")))))};var Q=i(5893),J=i(1443),ee=i.n(J),te=i(5697),ne=i.n(te);const re=(e,t)=>{const n=new(ee())(".plyr-react",t.options||{});return t.source&&(n.source=t.source),n},ie=e=>{e&&e.destroy()},oe=()=>{},ae=e=>e?()=>({plyr:e}):()=>new Proxy({plyr:{source:null}},{get:(e,t)=>"plyr"===t?e[t]:oe});function se(t,n,r=null){return function(t,n,r=[]){const[i,o]=(0,e.useState)(null),a=(0,e.useRef)(null),{instantiate:s,destroy:l,getAPI:c,params:u}=n;(0,e.useEffect)((()=>{const e=s(a.current,u);return o(e),()=>{l&&l(e,u)}}),r);const d=(0,e.useMemo)((()=>c(i,u)),[i]);return(0,e.useImperativeHandle)(t,d,[d]),a}(t,{instantiate:re,getAPI:ae,destroy:ie,params:n},r||[n.options,n.source])}const le=e.forwardRef(((e,t)=>{const{source:n,options:r=null,...i}=e,o=se(t,{source:n,options:r});return(0,Q.jsx)("video",{ref:o,className:"plyr-react plyr",...i})}));function ce(e){return ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ce(e)}function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ce(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ce(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ce(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}le.displayName="Plyr",le.defaultProps={options:{controls:["rewind","play","fast-forward","progress","current-time","duration","mute","volume","settings","fullscreen"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop"}},source:{type:"video",sources:[{src:"https://cdn.plyr.io/static/blank.mp4",type:"video/mp4",size:720},{src:"https://cdn.plyr.io/static/blank.mp4",type:"video/mp4",size:1080}]}},le.propTypes={options:ne().object,source:ne().any};const me=function(t){var n=pe((0,e.useContext)(F),2),r=n[0],i=n[1],o=(0,e.useRef)(null),a=pe((0,e.useState)(null),2),s=a[0],l=a[1],c=pe((0,e.useState)(null),2),u=c[0],d=c[1],f=pe((0,e.useState)(!1),2),p=f[0],h=f[1];(0,e.useEffect)((function(){o.current&&o.current.plyr&&r.updatePlayerTime&&(o.current.plyr.currentTime=r.time)}),[r.time]);var m=(0,e.useMemo)((function(){return{controls:["play","mute","captions","settings","pip","fullscreen"],ratio:"16:9",blankVideo:"chrome-extension://"+chrome.i18n.getMessage("@@extension_id")+"/assets/blank.mp4",keyboard:{global:!0}}}),[]);(0,e.useEffect)((function(){if(r.blob){var e=URL.createObjectURL(r.blob);return d({type:"video",sources:[{src:e,type:"video/mp4"}]}),l(e),function(){URL.revokeObjectURL(e)}}}),[r.blob,o]),(0,e.useEffect)((function(){return o.current&&o.current.plyr&&o.current.plyr.on("timeupdate",(function(){i((function(e){return de(de({},e),{},{time:o.current.plyr.currentTime,updatePlayerTime:!1})}))})),function(){o.current&&o.current.plyr&&o.current.plyr.off("timeupdate")}}),[o]);return(0,e.useEffect)((function(){if(!p){var e=function(e){o.current&&o.current.plyr&&(h(!0),o.current.plyr.on("timeupdate",(function(){i((function(e){return de(de({},e),{},{time:o.current.plyr.currentTime,updatePlayerTime:!1})}))})))};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}}),[p]),e.createElement("div",{className:"videoPlayer"},e.createElement("div",{className:"playerWrap",onClick:function(){p||o.current&&o.current.plyr&&(h(!0),o.current.plyr.on("timeupdate",(function(){i((function(e){return de(de({},e),{},{time:o.current.plyr.currentTime,updatePlayerTime:!1})}))})))}},s&&e.createElement(le,{ref:o,id:"plyr-player",source:u,options:m})),e.createElement("style",null,"\n\t\t\t\t\t.plyr {\n\t\t\t\t\t\theight: 90%!important;\n\t\t\t\t\t}\n\t\t\t\t\t@media (max-width: 900px) {\n\t\t\t\t\t\t.videoPlayer {\n\t\t\t\t\t\t\theight: 100%!important;\n\t\t\t\t\t\t\ttop: 40px!important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.playerWrap {\n\t\t\t\t\t\t\theight: calc(100% - 300px)!important;\n\t\t\t\t\t\t}\n\t\t\t\t\t"))};var ge=i(3661),ve={};ve.styleTagTransform=m(),ve.setAttributes=d(),ve.insert=c().bind(null,"head"),ve.domAPI=s(),ve.insertStyleElement=p();o()(ge.Z,ve);const ye=ge.Z&&ge.Z.locals?ge.Z.locals:void 0;var be=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))};const we={decode:function(e,t){return be(this,void 0,void 0,(function*(){const n=new AudioContext({sampleRate:t});return n.decodeAudioData(e).finally((()=>n.close()))}))},createBuffer:function(e,t){return"number"==typeof e[0]&&(e=[e]),function(e){const t=e[0];if(t.some((e=>e>1||e<-1))){const n=t.length;let r=0;for(let e=0;e<n;e++){const n=Math.abs(t[e]);n>r&&(r=n)}for(const t of e)for(let e=0;e<n;e++)t[e]/=r}}(e),{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:t=>null==e?void 0:e[t],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};var xe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))};const _e={fetchBlob:function(e,t,n){return xe(this,void 0,void 0,(function*(){const r=yield fetch(e,n);return function(e,t){xe(this,void 0,void 0,(function*(){if(!e.body||!e.headers)return;const n=e.body.getReader(),r=Number(e.headers.get("Content-Length"))||0;let i=0;const o=e=>xe(this,void 0,void 0,(function*(){i+=(null==e?void 0:e.length)||0;const n=Math.round(i/r*100);t(n)})),a=()=>xe(this,void 0,void 0,(function*(){let e;try{e=yield n.read()}catch(e){return}e.done||(o(e.value),yield a())}));a()}))}(r.clone(),t),r.blob()}))}};const ke=class{constructor(){this.listeners={},this.on=this.addEventListener,this.un=this.removeEventListener}addEventListener(e,t,n){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),null==n?void 0:n.once){const n=()=>{this.removeEventListener(e,n),this.removeEventListener(e,t)};return this.addEventListener(e,n),n}return()=>this.removeEventListener(e,t)}removeEventListener(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)}once(e,t){return this.on(e,t,{once:!0})}unAll(){this.listeners={}}emit(e,...t){this.listeners[e]&&this.listeners[e].forEach((e=>e(...t)))}};const Ee=class extends ke{constructor(e){super(),this.isExternalMedia=!1,e.media?(this.media=e.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),e.mediaControls&&(this.media.controls=!0),e.autoplay&&(this.media.autoplay=!0),null!=e.playbackRate&&this.onceMediaEvent("canplay",(()=>{null!=e.playbackRate&&(this.media.playbackRate=e.playbackRate)}))}onMediaEvent(e,t,n){return this.media.addEventListener(e,t,n),()=>this.media.removeEventListener(e,t)}onceMediaEvent(e,t){return this.onMediaEvent(e,t,{once:!0})}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const e=this.getSrc();e.startsWith("blob:")&&URL.revokeObjectURL(e)}setSrc(e,t){if(this.getSrc()===e)return;this.revokeSrc();const n=t instanceof Blob?URL.createObjectURL(t):e;this.media.src=n,this.media.load()}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(e){this.media=e}play(){return this.media.play()}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(e){this.media.currentTime=e}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(e){this.media.volume=e}getMuted(){return this.media.muted}setMuted(e){this.media.muted=e}getPlaybackRate(){return this.media.playbackRate}setPlaybackRate(e,t){null!=t&&(this.media.preservesPitch=t),this.media.playbackRate=e}getMediaElement(){return this.media}setSinkId(e){return this.media.setSinkId(e)}};class Se extends ke{constructor(e,t){super(),this.timeouts=[],this.isScrolling=!1,this.audioData=null,this.resizeObserver=null,this.isDragging=!1,this.options=e;const n=this.parentFromOptionsContainer(e.container);this.parent=n;const[r,i]=this.initHtml();n.appendChild(r),this.container=r,this.scrollContainer=i.querySelector(".scroll"),this.wrapper=i.querySelector(".wrapper"),this.canvasWrapper=i.querySelector(".canvases"),this.progressWrapper=i.querySelector(".progress"),this.cursor=i.querySelector(".cursor"),t&&i.appendChild(t),this.initEvents()}parentFromOptionsContainer(e){let t;if("string"==typeof e?t=document.querySelector(e):e instanceof HTMLElement&&(t=e),!t)throw new Error("Container not found");return t}initEvents(){const e=e=>{const t=this.wrapper.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientX-t.left;return[n/t.width,r/t.height]};this.wrapper.addEventListener("click",(t=>{const[n,r]=e(t);this.emit("click",n,r)})),this.wrapper.addEventListener("dblclick",(t=>{const[n,r]=e(t);this.emit("dblclick",n,r)})),this.options.dragToSeek&&this.initDrag(),this.scrollContainer.addEventListener("scroll",(()=>{const{scrollLeft:e,scrollWidth:t,clientWidth:n}=this.scrollContainer,r=e/t,i=(e+n)/t;this.emit("scroll",r,i)}));const t=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{t((()=>this.reRender()))})),this.resizeObserver.observe(this.scrollContainer)}initDrag(){!function(e,t,n,r,i=5){let o=()=>{};if(!e)return o;const a=a=>{if(2===a.button)return;a.preventDefault(),a.stopPropagation(),e.style.touchAction="none";let s=a.clientX,l=a.clientY,c=!1;const u=r=>{r.preventDefault(),r.stopPropagation();const o=r.clientX,a=r.clientY;if(c||Math.abs(o-s)>=i||Math.abs(a-l)>=i){const{left:r,top:i}=e.getBoundingClientRect();c||(c=!0,null==n||n(s-r,l-i)),t(o-s,a-l,o-r,a-i),s=o,l=a}},d=e=>{c&&(e.preventDefault(),e.stopPropagation())},f=()=>{e.style.touchAction="",c&&(null==r||r()),o()};document.addEventListener("pointermove",u),document.addEventListener("pointerup",f),document.addEventListener("pointerleave",f),document.addEventListener("click",d,!0),o=()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",f),document.removeEventListener("pointerleave",f),setTimeout((()=>{document.removeEventListener("click",d,!0)}),10)}};e.addEventListener("pointerdown",a)}(this.wrapper,((e,t,n)=>{this.emit("drag",Math.max(0,Math.min(1,n/this.wrapper.getBoundingClientRect().width)))}),(()=>this.isDragging=!0),(()=>this.isDragging=!1))}getHeight(){return null==this.options.height?128:isNaN(Number(this.options.height))?"auto"===this.options.height&&this.parent.clientHeight||128:Number(this.options.height)}initHtml(){const e=document.createElement("div"),t=e.attachShadow({mode:"open"});return t.innerHTML=`\n <style>\n :host {\n user-select: none;\n min-width: 1px;\n }\n :host audio {\n display: block;\n width: 100%;\n }\n :host .scroll {\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n position: relative;\n }\n :host .noScrollbar {\n scrollbar-color: transparent;\n scrollbar-width: none;\n }\n :host .noScrollbar::-webkit-scrollbar {\n display: none;\n -webkit-appearance: none;\n }\n :host .wrapper {\n position: relative;\n overflow: visible;\n z-index: 2;\n }\n :host .canvases {\n min-height: ${this.getHeight()}px;\n }\n :host .canvases > div {\n position: relative;\n }\n :host canvas {\n display: block;\n position: absolute;\n top: 0;\n image-rendering: pixelated;\n }\n :host .progress {\n pointer-events: none;\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n overflow: hidden;\n }\n :host .progress > div {\n position: relative;\n }\n :host .cursor {\n pointer-events: none;\n position: absolute;\n z-index: 5;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: 2px;\n }\n </style>\n\n <div class="scroll" part="scroll">\n <div class="wrapper" part="wrapper">\n <div class="canvases"></div>\n <div class="progress" part="progress"></div>\n <div class="cursor" part="cursor"></div>\n </div>\n </div>\n `,[e,t]}setOptions(e){if(this.options.container!==e.container){const t=this.parentFromOptionsContainer(e.container);t.appendChild(this.container),this.parent=t}e.dragToSeek&&!this.options.dragToSeek&&this.initDrag(),this.options=e,this.reRender()}getWrapper(){return this.wrapper}getScroll(){return this.scrollContainer.scrollLeft}destroy(){var e;this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect()}createDelay(e=10){const t={};return this.timeouts.push(t),n=>{t.timeout&&clearTimeout(t.timeout),t.timeout=setTimeout(n,e)}}convertColorValues(e){if(!Array.isArray(e))return e||"";if(e.length<2)return e[0]||"";const t=document.createElement("canvas"),n=t.getContext("2d").createLinearGradient(0,0,0,t.height),r=1/(e.length-1);return e.forEach(((e,t)=>{const i=t*r;n.addColorStop(i,e)})),n}renderBarWaveform(e,t,n,r){const i=e[0],o=e[1]||e[0],a=i.length,{width:s,height:l}=n.canvas,c=l/2,u=window.devicePixelRatio||1,d=t.barWidth?t.barWidth*u:1,f=t.barGap?t.barGap*u:t.barWidth?d/2:0,p=t.barRadius||0,h=s/(d+f)/a,m=p&&"roundRect"in n?"roundRect":"rect";n.beginPath();let g=0,v=0,y=0;for(let e=0;e<=a;e++){const a=Math.round(e*h);if(a>g){const e=Math.round(v*c*r),i=e+Math.round(y*c*r)||1;let o=c-e;"top"===t.barAlign?o=0:"bottom"===t.barAlign&&(o=l-i),n[m](g*(d+f),o,d,i,p),g=a,v=0,y=0}const s=Math.abs(i[e]||0),u=Math.abs(o[e]||0);s>v&&(v=s),u>y&&(y=u)}n.fill(),n.closePath()}renderLineWaveform(e,t,n,r){const i=t=>{const i=e[t]||e[0],o=i.length,{height:a}=n.canvas,s=a/2,l=n.canvas.width/o;n.moveTo(0,s);let c=0,u=0;for(let e=0;e<=o;e++){const o=Math.round(e*l);if(o>c){const e=s+(Math.round(u*s*r)||1)*(0===t?-1:1);n.lineTo(c,e),c=o,u=0}const a=Math.abs(i[e]||0);a>u&&(u=a)}n.lineTo(c,s)};n.beginPath(),i(0),i(1),n.fill(),n.closePath()}renderWaveform(e,t,n){if(n.fillStyle=this.convertColorValues(t.waveColor),t.renderFunction)return void t.renderFunction(e,n);let r=t.barHeight||1;if(t.normalize){const t=Array.from(e[0]).reduce(((e,t)=>Math.max(e,Math.abs(t))),0);r=t?1/t:1}t.barWidth||t.barGap||t.barAlign?this.renderBarWaveform(e,t,n,r):this.renderLineWaveform(e,t,n,r)}renderSingleCanvas(e,t,n,r,i,o,a,s){const l=window.devicePixelRatio||1,c=document.createElement("canvas"),u=e[0].length;c.width=Math.round(n*(o-i)/u),c.height=r*l,c.style.width=`${Math.floor(c.width/l)}px`,c.style.height=`${r}px`,c.style.left=`${Math.floor(i*n/l/u)}px`,a.appendChild(c);const d=c.getContext("2d");if(this.renderWaveform(e.map((e=>e.slice(i,o))),t,d),c.width>0&&c.height>0){const e=c.cloneNode(),n=e.getContext("2d");n.drawImage(c,0,0),n.globalCompositeOperation="source-in",n.fillStyle=this.convertColorValues(t.progressColor),n.fillRect(0,0,c.width,c.height),s.appendChild(e)}}renderChannel(e,t,n){const r=document.createElement("div"),i=this.getHeight();r.style.height=`${i}px`,this.canvasWrapper.style.minHeight=`${i}px`,this.canvasWrapper.appendChild(r);const o=r.cloneNode();this.progressWrapper.appendChild(o);const{scrollLeft:a,scrollWidth:s,clientWidth:l}=this.scrollContainer,c=e[0].length,u=c/s;let d=Math.min(Se.MAX_CANVAS_WIDTH,l);if(t.barWidth||t.barGap){const e=t.barWidth||.5,n=e+(t.barGap||e/2);d%n!=0&&(d=Math.floor(d/n)*n)}const f=Math.floor(Math.abs(a)*u),p=Math.floor(f+d*u),h=p-f,m=(a,s)=>{this.renderSingleCanvas(e,t,n,i,Math.max(0,a),Math.min(s,c),r,o)},g=this.createDelay(),v=this.createDelay(),y=(e,t)=>{m(e,t),e>0&&g((()=>{y(e-h,t-h)}))},b=(e,t)=>{m(e,t),t<c&&v((()=>{b(e+h,t+h)}))};y(f,p),p<c&&b(p,p+h)}render(e){this.timeouts.forEach((e=>e.timeout&&clearTimeout(e.timeout))),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.wrapper.style.width="",null!=this.options.width&&(this.scrollContainer.style.width="number"==typeof this.options.width?`${this.options.width}px`:this.options.width);const t=window.devicePixelRatio||1,n=this.scrollContainer.clientWidth,r=Math.ceil(e.duration*(this.options.minPxPerSec||0));this.isScrolling=r>n;const i=this.options.fillParent&&!this.isScrolling,o=(i?n:r)*t;if(this.wrapper.style.width=i?"100%":`${r}px`,this.scrollContainer.style.overflowX=this.isScrolling?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.options.splitChannels)for(let t=0;t<e.numberOfChannels;t++){const n=Object.assign(Object.assign({},this.options),this.options.splitChannels[t]);this.renderChannel([e.getChannelData(t)],n,o)}else{const t=[e.getChannelData(0)];e.numberOfChannels>1&&t.push(e.getChannelData(1)),this.renderChannel(t,this.options,o)}this.audioData=e,this.emit("render")}reRender(){if(!this.audioData)return;const e=this.progressWrapper.clientWidth;this.render(this.audioData);const t=this.progressWrapper.clientWidth;this.scrollContainer.scrollLeft+=t-e}zoom(e){this.options.minPxPerSec=e,this.reRender()}scrollIntoView(e,t=!1){const{clientWidth:n,scrollLeft:r,scrollWidth:i}=this.scrollContainer,o=i*e,a=n/2;if(o>r+(t&&this.options.autoCenter&&!this.isDragging?a:n)||o<r)if(this.options.autoCenter&&!this.isDragging){const e=a/20;o-(r+a)>=e&&o<r+n?this.scrollContainer.scrollLeft+=e:this.scrollContainer.scrollLeft=o-a}else if(this.isDragging){const e=10;this.scrollContainer.scrollLeft=o<r?o-e:o-n+e}else this.scrollContainer.scrollLeft=o;{const{scrollLeft:e}=this.scrollContainer,t=e/i,r=(e+n)/i;this.emit("scroll",t,r)}}renderProgress(e,t){if(isNaN(e))return;const n=100*e;this.canvasWrapper.style.clipPath=`polygon(${n}% 0, 100% 0, 100% 100%, ${n}% 100%)`,this.progressWrapper.style.width=`${n}%`,this.cursor.style.left=`${n}%`,this.cursor.style.marginLeft=100===Math.round(n)?`-${this.options.cursorWidth}px`:"",this.isScrolling&&this.options.autoScroll&&this.scrollIntoView(e,t)}}Se.MAX_CANVAS_WIDTH=4e3;const Ce=Se;const Te=class extends ke{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",(()=>{requestAnimationFrame((()=>{this.emit("tick")}))})),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}};var Ae=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))};const Oe=class extends ke{constructor(e=new AudioContext){super(),this.bufferNode=null,this.autoplay=!1,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.audioContext=e,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return Ae(this,void 0,void 0,(function*(){}))}get src(){return this.currentSrc}set src(e){this.currentSrc=e,fetch(e).then((e=>e.arrayBuffer())).then((e=>this.audioContext.decodeAudioData(e))).then((e=>{this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play()}))}_play(){var e;this.paused&&(this.paused=!1,null===(e=this.bufferNode)||void 0===e||e.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.bufferNode.buffer=this.buffer,this.bufferNode.connect(this.gainNode),this.playedDuration>=this.duration&&(this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,this.playedDuration),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))})}_pause(){var e;this.paused||(this.paused=!0,null===(e=this.bufferNode)||void 0===e||e.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime)}play(){return Ae(this,void 0,void 0,(function*(){this._play(),this.emit("play")}))}pause(){this._pause(),this.emit("pause")}stopAt(e){var t,n;const r=e-this.currentTime;null===(t=this.bufferNode)||void 0===t||t.stop(this.audioContext.currentTime+r),null===(n=this.bufferNode)||void 0===n||n.addEventListener("ended",(()=>{this.bufferNode=null,this.pause()}),{once:!0})}setSinkId(e){return Ae(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(e)}))}get playbackRate(){var e,t;return null!==(t=null===(e=this.bufferNode)||void 0===e?void 0:e.playbackRate.value)&&void 0!==t?t:1}set playbackRate(e){this.bufferNode&&(this.bufferNode.playbackRate.value=e)}get currentTime(){return this.paused?this.playedDuration:this.playedDuration+this.audioContext.currentTime-this.playStartTime}set currentTime(e){this.emit("seeking"),this.paused?this.playedDuration=e:(this._pause(),this.playedDuration=e,this._play()),this.emit("timeupdate")}get duration(){var e;return(null===(e=this.buffer)||void 0===e?void 0:e.duration)||0}get volume(){return this.gainNode.gain.value}set volume(e){this.gainNode.gain.value=e,this.emit("volumechange")}get muted(){return this._muted}set muted(e){this._muted!==e&&(this._muted=e,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}getGainNode(){return this.gainNode}};var Pe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))};const Me={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class Ne extends Ee{static create(e){return new Ne(e)}constructor(e){const t=e.media||("WebAudio"===e.backend?new Oe:void 0);super({media:t,mediaControls:e.mediaControls,autoplay:e.autoplay,playbackRate:e.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.options=Object.assign({},Me,e),this.timer=new Te;const n=t?void 0:this.getMediaElement();this.renderer=new Ce(this.options,n),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const r=this.options.url||this.getSrc()||"";(r||this.options.peaks&&this.options.duration)&&this.load(r,this.options.peaks,this.options.duration)}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{const e=this.getCurrentTime();this.renderer.renderProgress(e/this.getDuration(),!0),this.emit("timeupdate",e),this.emit("audioprocess",e)})))}initPlayerEvents(){this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{const e=this.getCurrentTime();this.renderer.renderProgress(e/this.getDuration(),this.isPlaying()),this.emit("timeupdate",e)})),this.onMediaEvent("play",(()=>{this.emit("play"),this.timer.start()})),this.onMediaEvent("pause",(()=>{this.emit("pause"),this.timer.stop()})),this.onMediaEvent("emptied",(()=>{this.timer.stop()})),this.onMediaEvent("ended",(()=>{this.emit("finish")})),this.onMediaEvent("seeking",(()=>{this.emit("seeking",this.getCurrentTime())})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((e,t)=>{this.options.interact&&(this.seekTo(e),this.emit("interaction",e*this.getDuration()),this.emit("click",e,t))})),this.renderer.on("dblclick",((e,t)=>{this.emit("dblclick",e,t)})),this.renderer.on("scroll",((e,t)=>{const n=this.getDuration();this.emit("scroll",e*n,t*n)})),this.renderer.on("render",(()=>{this.emit("redraw")})));{let e;this.subscriptions.push(this.renderer.on("drag",(t=>{this.options.interact&&(this.renderer.renderProgress(t),clearTimeout(e),e=setTimeout((()=>{this.seekTo(t)}),this.isPlaying()?0:200),this.emit("interaction",t*this.getDuration()),this.emit("drag",t))})))}}initPlugins(){var e;(null===(e=this.options.plugins)||void 0===e?void 0:e.length)&&this.options.plugins.forEach((e=>{this.registerPlugin(e)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((e=>e())),this.mediaSubscriptions=[]}setOptions(e){this.options=Object.assign({},this.options,e),this.renderer.setOptions(this.options),e.audioRate&&this.setPlaybackRate(e.audioRate),null!=e.mediaControls&&(this.getMediaElement().controls=e.mediaControls)}registerPlugin(e){return e.init(this),this.plugins.push(e),this.subscriptions.push(e.once("destroy",(()=>{this.plugins=this.plugins.filter((t=>t!==e))}))),e}getWrapper(){return this.renderer.getWrapper()}getScroll(){return this.renderer.getScroll()}getActivePlugins(){return this.plugins}loadAudio(e,t,n,r){return Pe(this,void 0,void 0,(function*(){if(this.emit("load",e),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!t&&!n){const n=e=>this.emit("loading",e);t=yield _e.fetchBlob(e,n,this.options.fetchParams)}this.setSrc(e,t);const i=(yield Promise.resolve(r||this.getDuration()))||(yield new Promise((e=>{this.onceMediaEvent("loadedmetadata",(()=>e(this.getDuration())))})));if(n)this.decodedData=we.createBuffer(n,i||0);else if(t){const e=yield t.arrayBuffer();this.decodedData=yield we.decode(e,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())}))}load(e,t,n){return Pe(this,void 0,void 0,(function*(){yield this.loadAudio(e,void 0,t,n)}))}loadBlob(e,t,n){return Pe(this,void 0,void 0,(function*(){yield this.loadAudio("blob",e,t,n)}))}zoom(e){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(e),this.emit("zoom",e)}getDecodedData(){return this.decodedData}exportPeaks({channels:e=2,maxLength:t=8e3,precision:n=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const r=Math.min(e,this.decodedData.numberOfChannels),i=[];for(let e=0;e<r;e++){const r=this.decodedData.getChannelData(e),o=[],a=Math.round(r.length/t);for(let e=0;e<t;e++){const t=r.slice(e*a,(e+1)*a),i=Math.max(...t);o.push(Math.round(i*n)/n)}i.push(o)}return i}getDuration(){let e=super.getDuration()||0;return 0!==e&&e!==1/0||!this.decodedData||(e=this.decodedData.duration),e}toggleInteraction(e){this.options.interact=e}seekTo(e){const t=this.getDuration()*e;this.setTime(t)}playPause(){return Pe(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(e){this.setTime(this.getCurrentTime()+e)}empty(){this.load("",[[0]],.001)}setMediaElement(e){this.unsubscribePlayerEvents(),super.setMediaElement(e),this.initPlayerEvents()}destroy(){this.emit("destroy"),this.plugins.forEach((e=>e.destroy())),this.subscriptions.forEach((e=>e())),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}const Le=Ne;var Ie=i(497),De={};De.styleTagTransform=m(),De.setAttributes=d(),De.insert=c().bind(null,"head"),De.domAPI=s(),De.insertStyleElement=p();o()(Ie.Z,De);const Re=Ie.Z&&Ie.Z.locals?Ie.Z.locals:void 0;function Be(e){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(e)}function je(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */je=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==Be(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Be(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Be(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Be(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Be(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function We(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function He(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){We(o,r,i,a,s,"next",e)}function s(e){We(o,r,i,a,s,"throw",e)}a(void 0)}))}}function Ve(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Ge=function(t){var n=Ve((0,e.useContext)(F),2),r=n[0],i=n[1],o=(0,e.useRef)(null),a=(0,e.useRef)(null),s=(0,e.useRef)(null),l=(0,e.useRef)(null),c=Ve((0,e.useState)(!1),2),u=c[0],d=c[1],f=(0,e.useRef)(!1);function p(e){return h.apply(this,arguments)}function h(){return(h=He(je().mark((function e(t){return je().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=new FileReader;r.onloadend=function(){r.result instanceof ArrayBuffer?e(r.result):n(new Error("Failed to convert Blob to ArrayBuffer"))},r.onerror=n,r.readAsArrayBuffer(t)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var m=function(){var e=He(je().mark((function e(t){var n;return je().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o.current=Le.create({container:a.current,waveColor:"#C4C5CE",progressColor:"#9596A2",interpolation:"cubic",height:"auto",cursorWidth:0}),e.next=4,p(t);case 4:n=e.sent,o.current.loadBlob(new Blob([n],{type:"audio/wav"})),o.current.on("seeking",(function(e){var t=a.current.getBoundingClientRect().width*(e/o.current.getDuration());s.current.style.left="".concat(t,"px"),i((function(t){return Ue(Ue({},t),{},{time:e,updatePlayerTime:!0})}))})),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),console.error("Error loading waveform:",e.t0);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}(),g=function(){f.current||d(!0)},v=function(e){var t=a.current.getBoundingClientRect(),n=e.clientX-t.left;t.width;l.current.style.left="".concat(n,"px")},y=function(){d(!1)},b=function(e){a.current.contains(e.target)||(f.current=!0,d(!1))},w=function(){f.current=!1};return(0,e.useEffect)((function(){if(r.blob){m(r.blob);var e=a.current;return e.addEventListener("mouseover",g),e.addEventListener("mousemove",v),e.addEventListener("mouseleave",y),document.addEventListener("mousedown",b),document.addEventListener("mouseup",w),o.current&&o.current.on("seek",(function(e){var t=a.current.getBoundingClientRect(),n=t.width*e;s.current.style.left="".concat(n+t.left,"px")})),function(){o.current&&o.current.destroy(),e.removeEventListener("mouseenter",g),e.removeEventListener("mousemove",v),e.removeEventListener("mouseleave",y),document.removeEventListener("mousedown",b),document.removeEventListener("mouseup",w)}}}),[r.blob]),(0,e.useEffect)((function(){if(r.blob&&!r.updatePlayerTime&&null!==a.current){var e=document.createElement("video");e.preload="metadata",e.onloadedmetadata=He(je().mark((function t(){var n,i;return je().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=a.current.getBoundingClientRect(),i=n.width*(r.time/e.duration),s.current.style.left="".concat(i,"px"),URL.revokeObjectURL(e.src),e.remove();case 5:case"end":return t.stop()}}),t)}))),e.src=URL.createObjectURL(r.blob)}}),[r.time,r.blob,a.current]),e.createElement("div",{style:{height:"100%"}},e.createElement("div",{className:Re.cursor,ref:s}),e.createElement("div",{className:Re.ghostCursor,style:u?{opacity:1}:{opacity:0},ref:l}),e.createElement("div",{className:Re.waveform,ref:a}))};function $e(e){return $e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$e(e)}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){Xe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Xe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==$e(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==$e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===$e(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Qe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Qe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Je=function(t){var n=Ke((0,e.useContext)(F),2),r=n[0],i=n[1],o=(0,e.useRef)(null),a=(0,e.useRef)(null),s=(0,e.useRef)(null),l=(0,e.useRef)(!1),c=(0,e.useRef)(null),u=function(e,t){e.preventDefault(),l.current=!0,c.current=t,document.addEventListener("mousemove",d),document.addEventListener("mouseup",f)},d=function(e){if(l.current){var t=o.current.getBoundingClientRect(),n=t.width,a=(e.clientX-t.left)/n;if("start"===c.current){a+=0;var s=Math.max(Math.min(a,r.end-.02),0);i((function(e){return Ye(Ye({},e),{},{start:s})}))}else if("end"===c.current){a-=0;var u=Math.min(Math.max(a,r.start+.02),1);i((function(e){return Ye(Ye({},e),{},{end:u})}))}}},f=function e(){l.current=!1,c.current=null,r.addToHistory(),i((function(e){return Ye(Ye({},e),{},{dragInteracted:!0})})),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",e)};return(0,e.useEffect)((function(){a.current.style.left="calc(".concat(100*r.start,"%)"),s.current.style.left="".concat(100*r.end,"%")}),[r.start,r.end]),e.createElement("div",null,e.createElement("div",{className:ye.trimmerContainer,ref:o},e.createElement("div",{className:ye.trimWrap},e.createElement("div",{className:ye.leftOverlay,style:{width:"".concat(100*r.start,"%")}}),e.createElement("div",{className:ye.rightOverlay,style:{width:"".concat(100*(1-r.end),"%")}}),e.createElement("div",{className:ye.trimSection,style:{width:"".concat(100*(r.end-r.start),"%"),left:"".concat(100*r.start,"%")}}),e.createElement("div",{className:ye.trimmer},e.createElement("div",{className:"".concat(ye.handle," ").concat(ye.startHandle),onMouseDown:function(e){return u(e,"start")},ref:a}),e.createElement("div",{className:"".concat(ye.handle," ").concat(ye.endHandle),onMouseDown:function(e){return u(e,"end")},ref:s}))),e.createElement(Ge,null)))};var et=i(2827),tt={};tt.styleTagTransform=m(),tt.setAttributes=d(),tt.insert=c().bind(null,"head"),tt.domAPI=s(),tt.insertStyleElement=p();o()(et.Z,tt);const nt=et.Z&&et.Z.locals?et.Z.locals:void 0;function rt(){return rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},rt.apply(this,arguments)}function it(e,t){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},it(e,t)}var ot=function(e,t){return ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ot(e,t)};function at(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}ot(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var st=function(){return st=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},st.apply(this,arguments)};function lt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function ct(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(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(a,s)}l((r=r.apply(e,t||[])).next())}))}function ut(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}Object.create;function dt(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function ft(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function pt(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}Object.create;"function"==typeof SuppressedError&&SuppressedError;var ht=i(7811),mt=new Map,gt=function(e){return e.cloneNode(!0)},vt=function(){return"file:"===window.location.protocol},yt=function(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){try{if(!/\.svg/i.test(e)&&2===r.readyState){var t=r.getResponseHeader("Content-Type");if(!t)throw new Error("Content type not found");var i=(0,ht.Q)(t).type;if("image/svg+xml"!==i&&"text/plain"!==i)throw new Error("Invalid content type: ".concat(i))}if(4===r.readyState){if(404===r.status||null===r.responseXML)throw new Error(vt()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+e);if(!(200===r.status||vt()&&0===r.status))throw new Error("There was a problem injecting the SVG: "+r.status+" "+r.statusText);n(null,r)}}catch(e){if(r.abort(),!(e instanceof Error))throw e;n(e,r)}},r.open("GET",e),r.withCredentials=t,r.overrideMimeType&&r.overrideMimeType("text/xml"),r.send()},bt={},wt=function(e,t){bt[e]=bt[e]||[],bt[e].push(t)},xt=function(e,t,n){if(mt.has(e)){var r=mt.get(e);if(void 0===r)return void wt(e,n);if(r instanceof SVGSVGElement)return void n(null,gt(r))}mt.set(e,void 0),wt(e,n),yt(e,t,(function(t,n){var r;t?mt.set(e,t):(null===(r=n.responseXML)||void 0===r?void 0:r.documentElement)instanceof SVGSVGElement&&mt.set(e,n.responseXML.documentElement),function(e){for(var t=function(t,n){setTimeout((function(){if(Array.isArray(bt[e])){var n=mt.get(e),r=bt[e][t];n instanceof SVGSVGElement&&r(null,gt(n)),n instanceof Error&&r(n),t===bt[e].length-1&&delete bt[e]}}),0)},n=0,r=bt[e].length;n<r;n++)t(n)}(e)}))},_t=function(e,t,n){yt(e,t,(function(e,t){var r;e?n(e):(null===(r=t.responseXML)||void 0===r?void 0:r.documentElement)instanceof SVGSVGElement&&n(null,t.responseXML.documentElement)}))},kt=0,Et=[],St={},Ct="http://www.w3.org/1999/xlink",Tt=function(e,t,n,r,i,o,a){var s=e.getAttribute("data-src")||e.getAttribute("src");if(s){if(-1!==Et.indexOf(e))return Et.splice(Et.indexOf(e),1),void(e=null);Et.push(e),e.setAttribute("src",""),(r?xt:_t)(s,i,(function(r,i){if(!i)return Et.splice(Et.indexOf(e),1),e=null,void a(r);var l=e.getAttribute("id");l&&i.setAttribute("id",l);var c=e.getAttribute("title");c&&i.setAttribute("title",c);var u=e.getAttribute("width");u&&i.setAttribute("width",u);var d=e.getAttribute("height");d&&i.setAttribute("height",d);var f=Array.from(new Set(pt(pt(pt([],(i.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(e.getAttribute("class")||"").split(" "),!0))).join(" ").trim();i.setAttribute("class",f);var p=e.getAttribute("style");p&&i.setAttribute("style",p),i.setAttribute("data-src",s);var h=[].filter.call(e.attributes,(function(e){return/^data-\w[\w-]*$/.test(e.name)}));if(Array.prototype.forEach.call(h,(function(e){e.name&&e.value&&i.setAttribute(e.name,e.value)})),n){var m,g,v,y,b,w={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]};Object.keys(w).forEach((function(e){m=e,v=w[e];for(var t=function(e,t){var n;y=g[e].id,b=y+"-"+ ++kt,Array.prototype.forEach.call(v,(function(e){for(var t=0,r=(n=i.querySelectorAll("["+e+'*="'+y+'"]')).length;t<r;t++){var o=n[t].getAttribute(e);o&&!o.match(new RegExp('url\\("?#'+y+'"?\\)'))||n[t].setAttribute(e,"url(#"+b+")")}}));for(var r=i.querySelectorAll("[*|href]"),o=[],a=0,s=r.length;a<s;a++){var l=r[a].getAttributeNS(Ct,"href");l&&l.toString()==="#"+g[e].id&&o.push(r[a])}for(var c=0,u=o.length;c<u;c++)o[c].setAttributeNS(Ct,"href","#"+b);g[e].id=b},n=0,r=(g=i.querySelectorAll(m+"[id]")).length;n<r;n++)t(n)}))}i.removeAttribute("xmlns:a");for(var x,_,k=i.querySelectorAll("script"),E=[],S=0,C=k.length;S<C;S++)(_=k[S].getAttribute("type"))&&"application/ecmascript"!==_&&"application/javascript"!==_&&"text/javascript"!==_||((x=k[S].innerText||k[S].textContent)&&E.push(x),i.removeChild(k[S]));if(E.length>0&&("always"===t||"once"===t&&!St[s])){for(var T=0,A=E.length;T<A;T++)new Function(E[T])(window);St[s]=!0}var O=i.querySelectorAll("style");if(Array.prototype.forEach.call(O,(function(e){e.textContent+=""})),i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("xmlns:xlink",Ct),o(i),!e.parentNode)return Et.splice(Et.indexOf(e),1),e=null,void a(new Error("Parent node is null"));e.parentNode.replaceChild(i,e),Et.splice(Et.indexOf(e),1),e=null,a(null,i)}))}else a(new Error("Invalid data-src or src attribute"))},At=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Ot="http://www.w3.org/2000/svg",Pt="http://www.w3.org/1999/xlink",Mt=function(t){var n,r;function i(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=t.call.apply(t,[this].concat(r))||this).initialState={hasError:!1,isLoading:!0},e.state=e.initialState,e._isMounted=!1,e.reactWrapper=void 0,e.nonReactWrapper=void 0,e.refCallback=function(t){e.reactWrapper=t},e}r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,it(n,r);var o=i.prototype;return o.renderSVG=function(){var e,t=this;if(this.reactWrapper instanceof(e=this.reactWrapper,((null==e?void 0:e.ownerDocument)||document).defaultView||window).Node){var n,r,i=this.props,o=i.desc,a=i.evalScripts,s=i.httpRequestWithCredentials,l=i.renumerateIRIElements,c=i.src,u=i.title,d=i.useRequestCache,f=this.props.onError,p=this.props.beforeInjection,h=this.props.afterInjection,m=this.props.wrapper;"svg"===m?((n=document.createElementNS(Ot,m)).setAttribute("xmlns",Ot),n.setAttribute("xmlns:xlink",Pt),r=document.createElementNS(Ot,m)):(n=document.createElement(m),r=document.createElement(m)),n.appendChild(r),r.dataset.src=c,this.nonReactWrapper=this.reactWrapper.appendChild(n);var g=function(e){t.removeSVG(),t._isMounted?t.setState((function(){return{hasError:!0,isLoading:!1}}),(function(){f(e)})):f(e)};!function(e,t){var n=void 0===t?{}:t,r=n.afterAll,i=void 0===r?function(){}:r,o=n.afterEach,a=void 0===o?function(){}:o,s=n.beforeEach,l=void 0===s?function(){}:s,c=n.cacheRequests,u=void 0===c||c,d=n.evalScripts,f=void 0===d?"never":d,p=n.httpRequestWithCredentials,h=void 0!==p&&p,m=n.renumerateIRIElements,g=void 0===m||m;if(e&&"length"in e)for(var v=0,y=0,b=e.length;y<b;y++)Tt(e[y],f,g,u,h,l,(function(t,n){a(t,n),e&&"length"in e&&e.length===++v&&i(v)}));else e?Tt(e,f,g,u,h,l,(function(t,n){a(t,n),i(1),e=null})):i(0)}(r,{afterEach:function(e,n){e?g(e):t._isMounted&&t.setState((function(){return{isLoading:!1}}),(function(){try{h(n)}catch(e){g(e)}}))},beforeEach:function(e){if(e.setAttribute("role","img"),o){var t=e.querySelector(":scope > desc");t&&e.removeChild(t);var n=document.createElement("desc");n.innerHTML=o,e.prepend(n)}if(u){var r=e.querySelector(":scope > title");r&&e.removeChild(r);var i=document.createElement("title");i.innerHTML=u,e.prepend(i)}try{p(e)}catch(e){g(e)}},cacheRequests:d,evalScripts:a,httpRequestWithCredentials:s,renumerateIRIElements:l})}},o.removeSVG=function(){var e;null!=(e=this.nonReactWrapper)&&e.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},o.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},o.componentDidUpdate=function(e){var t=this;(function(e,t){for(var n in e)if(!(n in t))return!0;for(var r in t)if(e[r]!==t[r])return!0;return!1})(rt({},e),this.props)&&this.setState((function(){return t.initialState}),(function(){t.removeSVG(),t.renderSVG()}))},o.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},o.render=function(){var t=this.props;t.afterInjection,t.beforeInjection,t.desc,t.evalScripts;var n=t.fallback;t.httpRequestWithCredentials;var r=t.loading;t.renumerateIRIElements,t.src,t.title,t.useRequestCache;var i=t.wrapper,o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(t,At),a=i;return e.createElement(a,rt({},o,{ref:this.refCallback},"svg"===i?{xmlns:Ot,xmlnsXlink:Pt}:{}),this.state.isLoading&&r&&e.createElement(r,null),this.state.hasError&&n&&e.createElement(n,null))},i}(e.Component);function Nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Lt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Mt.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"},Mt.propTypes={afterInjection:te.func,beforeInjection:te.func,desc:te.string,evalScripts:te.oneOf(["always","once","never"]),fallback:te.oneOfType([te.func,te.object,te.string]),httpRequestWithCredentials:te.bool,loading:te.oneOfType([te.func,te.object,te.string]),onError:te.func,renumerateIRIElements:te.bool,src:te.string.isRequired,title:te.string,useRequestCache:te.bool,wrapper:te.oneOf(["div","span","svg"])};var It="/assets/",Dt=It+"editor/icons/trim.svg",Rt=It+"editor/icons/trash.svg",Bt=It+"editor/icons/mute.svg",jt=It+"editor/icons/undo.svg",zt=It+"editor/icons/redo.svg",Ut=It+"editor/icons/time.svg";const Ft=function(t){var n=Nt((0,e.useContext)(F),2),r=n[0],i=(n[1],Nt((0,e.useState)(!0),2)),o=i[0],a=i[1],s=Nt((0,e.useState)(!0),2),l=s[0],c=s[1],u=Nt((0,e.useState)(0),2),d=u[0],f=u[1],p=Nt((0,e.useState)(0),2),h=p[0],m=p[1];(0,e.useEffect)((function(){f(r.start*r.duration),m(r.end*r.duration)}),[r.duration,r.start,r.end]),(0,e.useEffect)((function(){r.history.length>2?a(!1):a(!0)}),[r.history]),(0,e.useEffect)((function(){r.redoHistory.length>0?c(!1):c(!0)}),[r.redoHistory]);var g=function(e){var t=Math.floor(e/60),n=Math.floor(e-60*t);return n<10?"".concat(t,":0").concat(n):"".concat(t,":").concat(n)};return e.createElement("div",{className:nt.trimWrap},e.createElement("div",{className:nt.controls},e.createElement("div",{className:nt.actions},e.createElement("button",{className:"button secondaryButton",onClick:function(){return r.handleTrim(!1)},disabled:r.isFfmpegRunning||0===r.start&&1===r.end},e.createElement(Mt,{src:Dt}),r.trimming?chrome.i18n.getMessage("sandboxEditorTrimProgressButton"):chrome.i18n.getMessage("sandboxEditorTrimButton")),e.createElement("button",{className:"button secondaryButton",disabled:0===r.start&&1===r.end||r.isFfmpegRunning,onClick:function(){return r.handleTrim(!0)}},e.createElement(Mt,{src:Rt}),r.cutting?chrome.i18n.getMessage("sandboxEditorCutProgressButton"):chrome.i18n.getMessage("sandboxEditorCutButton")),e.createElement("button",{className:"button secondaryButton",onClick:function(){return r.handleMute()},disabled:r.isFfmpegRunning},e.createElement(Mt,{src:Bt}),r.muting?chrome.i18n.getMessage("sandboxEditorMuteProgressButton"):chrome.i18n.getMessage("sandboxEditorMuteButton"))),e.createElement("div",{className:nt.timeWrap},e.createElement(Mt,{src:Ut}),e.createElement("span",null,g(d)+" - "+g(h))),e.createElement("div",{className:nt.controlsRight},e.createElement("button",{className:"button simpleButton",onClick:function(){return r.undo()},disabled:o||r.isFfmpegRunning},e.createElement(Mt,{src:jt}),chrome.i18n.getMessage("undoLabel")),e.createElement("button",{className:"button simpleButton",onClick:function(){return r.redo()},disabled:l||r.isFfmpegRunning},e.createElement(Mt,{src:zt}),chrome.i18n.getMessage("redoLabel")))),e.createElement(Je,null),(!r.dragInteracted||r.duration>3)&&e.createElement("div",{className:nt.trimInfo},e.createElement("div",{className:nt.trimInfoLeft},e.createElement(Mt,{src:It+"editor/icons/alert.svg"})),e.createElement("div",{className:nt.trimInfoRight},chrome.i18n.getMessage("sandboxEditorTrimInfo"),e.createElement("div",{className:nt.trimInfoLink,onClick:function(){chrome.runtime.sendMessage({type:"trim-info"})}},chrome.i18n.getMessage("learnMoreDot")))),r.dragInteracted&&r.duration<=3&&e.createElement("div",{className:nt.trimInfo},e.createElement("div",{className:nt.trimInfoLeft},e.createElement(Mt,{src:It+"editor/icons/alert.svg"})),e.createElement("div",{className:nt.trimInfoRight},chrome.i18n.getMessage("sandboxEditorTooSmallInfo"),e.createElement("div",{className:nt.trimInfoLink,onClick:function(){chrome.runtime.sendMessage({type:"trim-info"})}},chrome.i18n.getMessage("learnMoreDot")))))};var Wt=i(893),Ht={};Ht.styleTagTransform=m(),Ht.setAttributes=d(),Ht.insert=c().bind(null,"head"),Ht.domAPI=s(),Ht.insertStyleElement=p();o()(Wt.Z,Ht);const Vt=Wt.Z&&Wt.Z.locals?Wt.Z.locals:void 0;const qt=function(){return e.createElement("button",{className:Vt.HelpButton,"aria-label":"Help button",onClick:function(){chrome.runtime.sendMessage({type:"open-help"})}},e.createElement(Mt,{src:"/assets/editor/icons/help.svg",width:"18px",height:"18px"}))};function Gt(e){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gt(e)}function $t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$t(Object(n),!0).forEach((function(t){Yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Yt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Gt(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Gt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Gt(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Qt=function(t){t.ffmpeg;var n=Xt((0,e.useContext)(F),2),r=n[0],i=n[1],o=function(e,t){i((function(n){return Zt(Zt({},n),{},{updatePlayerTime:t,time:e})}))};return(0,e.useEffect)((function(){i((function(e){return Zt(Zt({},e),{},{history:[{}],redoHistory:[]})})),r.addToHistory()}),[]),e.createElement("div",null,e.createElement(K,null),e.createElement(me,{onSeek:o}),e.createElement(Ft,{blob:r.blob,onSeek:o}),e.createElement(qt,null))};var Jt=i(1559),en={};en.styleTagTransform=m(),en.setAttributes=d(),en.insert=c().bind(null,"head"),en.domAPI=s(),en.insertStyleElement=p();o()(Jt.Z,en);const tn=Jt.Z&&Jt.Z.locals?Jt.Z.locals:void 0;function nn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var on="/assets/",an=on+"editor/icons/help-nav.svg",sn=on+"editor/icons/heart.svg";const ln=function(){var t=nn((0,e.useContext)(F),2),n=t[0],r=(t[1],(0,e.useRef)(null));return(0,e.useEffect)((function(){r.current=n}),[n]),e.createElement("div",{className:tn.nav},e.createElement("div",{className:tn.navWrap},e.createElement("div",{onClick:function(){chrome.runtime.sendMessage({type:"open-home"})},"aria-label":"home",className:tn.navLeft},e.createElement("img",{src:on+"editor/logo.svg",alt:"Screenity Logo"})),e.createElement("div",{className:tn.navRight},e.createElement("button",{className:"button simpleButton blueButton",onClick:function(){chrome.runtime.sendMessage({type:"open-help"})}},e.createElement(Mt,{src:an}),chrome.i18n.getMessage("getHelpNav")),e.createElement("button",{className:"button primaryButton",onClick:function(){chrome.runtime.sendMessage({type:"follow-twitter"})}},e.createElement(Mt,{src:sn})," ",chrome.i18n.getMessage("followForUpdates")))))};function cn(e){return cn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cn(e)}function un(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */un=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==cn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(cn(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function dn(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){hn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==cn(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==cn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===cn(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return gn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const vn=function(){var t=mn((0,e.useContext)(F),2),n=t[0],r=t[1],i=function(){var e,t=(e=un().mark((function e(){return un().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.handleCrop(n.left,n.top,n.width,n.height);case 1:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){dn(o,r,i,a,s,"next",e)}function s(e){dn(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return e.createElement("div",{className:_.editorNav},e.createElement("div",{className:_.navWrap},e.createElement("div",{className:_.editorNavLeft,onClick:function(){chrome.runtime.sendMessage({type:"open-home"})}},e.createElement("img",{src:"/assets/editor/logo.svg",alt:"Logo"})),e.createElement("div",{className:_.editorNavCenter},e.createElement("div",{className:_.editorNavTitle},chrome.i18n.getMessage("sandboxEditorMainTitle")+" "," ",e.createElement("span",{className:_.beta},"BETA"))),e.createElement("div",{className:_.editorNavRight},e.createElement("button",{className:"button simpleButton blackButton",onClick:function(){r((function(e){return pn(pn({},e),{},{mode:"player",blob:n.originalBlob,start:0,end:1,width:n.prevWidth,height:n.prevHeight,left:0,top:0,fromCropper:!1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorCancelButton")),e.createElement("button",{className:"button secondaryButton",onClick:function(){r((function(e){return pn(pn({},e),{},{blob:n.originalBlob,start:0,end:1,width:n.prevWidth,height:n.prevHeight,left:0,top:0,fromCropper:!1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorResetButton")),e.createElement("button",{className:"button primaryButton",onClick:i,disabled:n.isFfmpegRunning},n.cropping?chrome.i18n.getMessage("sandboxEditorSaveProgressButton"):chrome.i18n.getMessage("sandboxEditorSaveButton")))))};function yn(e){return yn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yn(e)}function bn(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */bn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==yn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(yn(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function wn(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xn(Object(n),!0).forEach((function(t){kn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function kn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==yn(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==yn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===yn(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function En(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Sn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Cn=function(){var t=En((0,e.useContext)(F),2),n=t[0],r=t[1],i=function(){var e,t=(e=bn().mark((function e(){return bn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r((function(e){return _n(_n({},e),{},{mode:"player",start:0,end:1})}));case 1:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){wn(o,r,i,a,s,"next",e)}function s(e){wn(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return e.createElement("div",{className:_.editorNav},e.createElement("div",{className:_.navWrap},e.createElement("div",{className:_.editorNavLeft,onClick:function(){chrome.runtime.sendMessage({type:"open-home"})}},e.createElement("img",{src:"/assets/editor/logo.svg",alt:"Logo"})),e.createElement("div",{className:_.editorNavCenter},e.createElement("div",{className:_.editorNavTitle},chrome.i18n.getMessage("sandboxEditorMainTitle")+" "," ",e.createElement("span",{className:_.beta},"BETA"))),e.createElement("div",{className:_.editorNavRight},e.createElement("button",{className:"button simpleButton blackButton",onClick:function(){r((function(e){return _n(_n({},e),{},{mode:"player",blob:n.originalBlob,start:0,end:1,width:n.prevWidth,height:n.prevHeight,left:0,top:0,fromCropper:!1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorCancelButton")),e.createElement("button",{className:"button secondaryButton",onClick:function(){r((function(e){return _n(_n({},e),{},{blob:n.originalBlob,start:0,end:1})}))},disabled:n.isFfmpegRunning},chrome.i18n.getMessage("sandboxEditorRevertButton")),e.createElement("button",{className:"button primaryButton",onClick:i,disabled:n.isFfmpegRunning},n.cropping?chrome.i18n.getMessage("sandboxEditorSaveProgressButton"):chrome.i18n.getMessage("sandboxEditorSaveButton")))))};var Tn=i(3049),An={};An.styleTagTransform=m(),An.setAttributes=d(),An.insert=c().bind(null,"head"),An.domAPI=s(),An.insertStyleElement=p();o()(Tn.Z,An);const On=Tn.Z&&Tn.Z.locals?Tn.Z.locals:void 0;var Pn=i(5733),Mn=i.n(Pn),Nn=i(3562),Ln={};Ln.styleTagTransform=m(),Ln.setAttributes=d(),Ln.insert=c().bind(null,"head"),Ln.domAPI=s(),Ln.insertStyleElement=p();o()(Nn.Z,Ln);Nn.Z&&Nn.Z.locals&&Nn.Z.locals;function In(e){return In="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},In(e)}function Dn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dn(Object(n),!0).forEach((function(t){Bn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Bn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==In(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==In(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===In(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return zn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Un="chrome-extension://"+chrome.i18n.getMessage("@@extension_id")+"/assets/";const Fn=function(t){var n=jn((0,e.useContext)(F),2),r=n[0],i=n[1];return e.createElement("div",null,e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Un+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("croppingInfoTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("videoProcessingLabelDescription"))),e.createElement("div",{className:On.buttonRight,onClick:function(){chrome.runtime.sendMessage({type:"upgrade-info"})}},chrome.i18n.getMessage("learnMoreLabel"))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxCropTitle")),e.createElement("div",{className:On.inputs},e.createElement("div",{className:On.input},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("widthLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||i((function(e){return Rn(Rn({},e),{},{width:parseFloat(t),cropPreset:"none",fromCropper:!1})}))}(e)},onBlur:function(e){""===e.target.value&&i((function(e){return Rn(Rn({},e),{},{width:0})}))},value:r.width}),e.createElement("span",null,"px")),e.createElement("div",{className:On.input},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("heightLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||i((function(e){return Rn(Rn({},e),{},{height:parseFloat(t),cropPreset:"none",fromCropper:!1})}))}(e)},value:r.height,onBlur:function(e){""===e.target.value&&i((function(e){return Rn(Rn({},e),{},{height:0})}))}}),e.createElement("span",null,"px"))),e.createElement("div",{className:On.inputs},e.createElement("div",{className:On.input},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("leftLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||i((function(e){return Rn(Rn({},e),{},{left:parseFloat(t),fromCropper:!1})}))}(e)},onBlur:function(e){""===e.target.value&&i((function(e){return Rn(Rn({},e),{},{left:0})}))},value:r.left}),e.createElement("span",null,"px")),e.createElement("div",{className:On.input},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("topLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||i((function(e){return Rn(Rn({},e),{},{top:parseFloat(t),fromCropper:!1})}))}(e)},onBlur:function(e){""===e.target.value&&i((function(e){return Rn(Rn({},e),{},{top:0})}))},value:r.top}),e.createElement("span",null,"px")))))};function Wn(e,[t,n]){return Math.min(n,Math.max(t,e))}function Hn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function Vn(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function qn(...t){return(0,e.useCallback)(Vn(...t),t)}function Gn(t,n=[]){let r=[];const i=()=>{const n=r.map((t=>(0,e.createContext)(t)));return function(r){const i=(null==r?void 0:r[t])||n;return(0,e.useMemo)((()=>({[`__scope${t}`]:{...r,[t]:i}})),[r,i])}};return i.scopeName=t,[function(n,i){const o=(0,e.createContext)(i),a=r.length;function s(n){const{scope:r,children:i,...s}=n,l=(null==r?void 0:r[t][a])||o,c=(0,e.useMemo)((()=>s),Object.values(s));return(0,e.createElement)(l.Provider,{value:c},i)}return r=[...r,i],s.displayName=n+"Provider",[s,function(r,s){const l=(null==s?void 0:s[t][a])||o,c=(0,e.useContext)(l);if(c)return c;if(void 0!==i)return i;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},$n(i,...n)]}function $n(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(t){const i=r.reduce(((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]})),{});return(0,e.useMemo)((()=>({[`__scope${n.scopeName}`]:i})),[i])}};return r.scopeName=n.scopeName,r}function Zn(t){const n=(0,e.useRef)(t);return(0,e.useEffect)((()=>{n.current=t})),(0,e.useMemo)((()=>(...e)=>{var t;if("function"==typeof(t=n.current))return null===(t=n.current)||void 0===t?void 0:t.call(n,...e)}),[])}function Yn({prop:t,defaultProp:n,onChange:r=(()=>{})}){const[i,o]=function({defaultProp:t,onChange:n}){const r=(0,e.useState)(t),[i]=r,o=(0,e.useRef)(i),a=Zn(n);return(0,e.useEffect)((()=>{o.current!==i&&(a(i),o.current=i)}),[i,o,a]),r}({defaultProp:n,onChange:r}),a=void 0!==t,s=a?t:i,l=Zn(r);return[s,(0,e.useCallback)((e=>{if(a){const n="function"==typeof e?e(t):e;n!==t&&l(n)}else o(e)}),[a,t,o,l])]}const Xn=(0,e.createContext)(void 0);function Kn(t){const n=(0,e.useRef)({value:t,previous:t});return(0,e.useMemo)((()=>(n.current.value!==t&&(n.current.previous=n.current.value,n.current.value=t),n.current.previous)),[t])}const Qn=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?e.useLayoutEffect:()=>{};function Jn(t){const[n,r]=(0,e.useState)(void 0);return Qn((()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver((e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[0];let i,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,o=t.blockSize}else i=t.offsetWidth,o=t.offsetHeight;r({width:i,height:o})}));return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}r(void 0)}),[t]),n}const er=(0,e.forwardRef)(((t,n)=>{const{children:r,...i}=t,o=e.Children.toArray(r),a=o.find(rr);if(a){const t=a.props.children,r=o.map((n=>n===a?e.Children.count(t)>1?e.Children.only(null):(0,e.isValidElement)(t)?t.props.children:null:n));return(0,e.createElement)(tr,rt({},i,{ref:n}),(0,e.isValidElement)(t)?(0,e.cloneElement)(t,void 0,r):null)}return(0,e.createElement)(tr,rt({},i,{ref:n}),r)}));er.displayName="Slot";const tr=(0,e.forwardRef)(((t,n)=>{const{children:r,...i}=t;return(0,e.isValidElement)(r)?(0,e.cloneElement)(r,{...ir(i,r.props),ref:n?Vn(n,r.ref):r.ref}):e.Children.count(r)>1?e.Children.only(null):null}));tr.displayName="SlotClone";const nr=({children:t})=>(0,e.createElement)(e.Fragment,null,t);function rr(t){return(0,e.isValidElement)(t)&&t.type===nr}function ir(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{o(...e),i(...e)}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}const or=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((t,n)=>{const r=(0,e.forwardRef)(((t,r)=>{const{asChild:i,...o}=t,a=i?er:n;return(0,e.useEffect)((()=>{window[Symbol.for("radix-ui")]=!0}),[]),(0,e.createElement)(a,rt({},o,{ref:r}))}));return r.displayName=`Primitive.${n}`,{...t,[n]:r}}),{});const ar=["PageUp","PageDown"],sr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lr={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},cr="Slider",[ur,dr,fr]=function(t){const n=t+"CollectionProvider",[r,i]=Gn(n),[o,a]=r(n,{collectionRef:{current:null},itemMap:new Map}),s=t=>{const{scope:n,children:r}=t,i=e.useRef(null),a=e.useRef(new Map).current;return e.createElement(o,{scope:n,itemMap:a,collectionRef:i},r)},l=t+"CollectionSlot",c=e.forwardRef(((t,n)=>{const{scope:r,children:i}=t,o=qn(n,a(l,r).collectionRef);return e.createElement(er,{ref:o},i)})),u=t+"CollectionItemSlot",d="data-radix-collection-item",f=e.forwardRef(((t,n)=>{const{scope:r,children:i,...o}=t,s=e.useRef(null),l=qn(n,s),c=a(u,r);return e.useEffect((()=>(c.itemMap.set(s,{ref:s,...o}),()=>{c.itemMap.delete(s)}))),e.createElement(er,{[d]:"",ref:l},i)}));return[{Provider:s,Slot:c,ItemSlot:f},function(n){const r=a(t+"CollectionConsumer",n);return e.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(cr),[pr,hr]=Gn(cr,[fr]),[mr,gr]=pr(cr),vr=(0,e.forwardRef)(((t,n)=>{const{name:r,min:i=0,max:o=100,step:a=1,orientation:s="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[i],value:d,onValueChange:f=(()=>{}),onValueCommit:p=(()=>{}),inverted:h=!1,...m}=t,[g,v]=(0,e.useState)(null),y=qn(n,(e=>v(e))),b=(0,e.useRef)(new Set),w=(0,e.useRef)(0),x="horizontal"===s,_=!g||Boolean(g.closest("form")),k=x?wr:xr,[E=[],S]=Yn({prop:d,defaultProp:u,onChange:e=>{var t;null===(t=[...b.current][w.current])||void 0===t||t.focus(),f(e)}}),C=(0,e.useRef)(E);function T(e,t,{commit:n}={commit:!1}){const r=function(e){return(String(e).split(".")[1]||"").length}(a),s=function(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}(Math.round((e-i)/a)*a+i,r),l=Wn(s,[i,o]);S(((e=[])=>{const r=function(e=[],t,n){const r=[...e];return r[n]=t,r.sort(((e,t)=>e-t))}(e,l,t);if(function(e,t){if(t>0){const n=function(e){return e.slice(0,-1).map(((t,n)=>e[n+1]-t))}(e);return Math.min(...n)>=t}return!0}(r,c*a)){w.current=r.indexOf(l);const t=String(r)!==String(e);return t&&n&&p(r),t?r:e}return e}))}return(0,e.createElement)(mr,{scope:t.__scopeSlider,disabled:l,min:i,max:o,valueIndexToChangeRef:w,thumbs:b.current,values:E,orientation:s},(0,e.createElement)(ur.Provider,{scope:t.__scopeSlider},(0,e.createElement)(ur.Slot,{scope:t.__scopeSlider},(0,e.createElement)(k,rt({"aria-disabled":l,"data-disabled":l?"":void 0},m,{ref:y,onPointerDown:Hn(m.onPointerDown,(()=>{l||(C.current=E)})),min:i,max:o,inverted:h,onSlideStart:l?void 0:function(e){const t=function(e,t){if(1===e.length)return 0;const n=e.map((e=>Math.abs(e-t))),r=Math.min(...n);return n.indexOf(r)}(E,e);T(e,t)},onSlideMove:l?void 0:function(e){T(e,w.current)},onSlideEnd:l?void 0:function(){const e=C.current[w.current];E[w.current]!==e&&p(E)},onHomeKeyDown:()=>!l&&T(i,0,{commit:!0}),onEndKeyDown:()=>!l&&T(o,E.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!l){const n=ar.includes(e.key)||e.shiftKey&&sr.includes(e.key)?10:1,r=w.current;T(E[r]+a*n*t,r,{commit:!0})}}})))),_&&E.map(((t,n)=>(0,e.createElement)(Pr,{key:n,name:r?r+(E.length>1?"[]":""):void 0,value:t}))))})),[yr,br]=pr(cr,{startEdge:"left",endEdge:"right",size:"width",direction:1}),wr=(0,e.forwardRef)(((t,n)=>{const{min:r,max:i,dir:o,inverted:a,onSlideStart:s,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=t,[f,p]=(0,e.useState)(null),h=qn(n,(e=>p(e))),m=(0,e.useRef)(),g=function(t){const n=(0,e.useContext)(Xn);return t||n||"ltr"}(o),v="ltr"===g,y=v&&!a||!v&&a;function b(e){const t=m.current||f.getBoundingClientRect(),n=Nr([0,t.width],y?[r,i]:[i,r]);return m.current=t,n(e-t.left)}return(0,e.createElement)(yr,{scope:t.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width"},(0,e.createElement)(_r,rt({dir:g,"data-orientation":"horizontal"},d,{ref:h,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{const t=b(e.clientX);null==s||s(t)},onSlideMove:e=>{const t=b(e.clientX);null==l||l(t)},onSlideEnd:()=>{m.current=void 0,null==c||c()},onStepKeyDown:e=>{const t=lr[y?"from-left":"from-right"].includes(e.key);null==u||u({event:e,direction:t?-1:1})}})))})),xr=(0,e.forwardRef)(((t,n)=>{const{min:r,max:i,inverted:o,onSlideStart:a,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=t,d=(0,e.useRef)(null),f=qn(n,d),p=(0,e.useRef)(),h=!o;function m(e){const t=p.current||d.current.getBoundingClientRect(),n=Nr([0,t.height],h?[i,r]:[r,i]);return p.current=t,n(e-t.top)}return(0,e.createElement)(yr,{scope:t.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1},(0,e.createElement)(_r,rt({"data-orientation":"vertical"},u,{ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{const t=m(e.clientY);null==a||a(t)},onSlideMove:e=>{const t=m(e.clientY);null==s||s(t)},onSlideEnd:()=>{p.current=void 0,null==l||l()},onStepKeyDown:e=>{const t=lr[h?"from-bottom":"from-top"].includes(e.key);null==c||c({event:e,direction:t?-1:1})}})))})),_r=(0,e.forwardRef)(((t,n)=>{const{__scopeSlider:r,onSlideStart:i,onSlideMove:o,onSlideEnd:a,onHomeKeyDown:s,onEndKeyDown:l,onStepKeyDown:c,...u}=t,d=gr(cr,r);return(0,e.createElement)(or.span,rt({},u,{ref:n,onKeyDown:Hn(t.onKeyDown,(e=>{"Home"===e.key?(s(e),e.preventDefault()):"End"===e.key?(l(e),e.preventDefault()):ar.concat(sr).includes(e.key)&&(c(e),e.preventDefault())})),onPointerDown:Hn(t.onPointerDown,(e=>{const t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),d.thumbs.has(t)?t.focus():i(e)})),onPointerMove:Hn(t.onPointerMove,(e=>{e.target.hasPointerCapture(e.pointerId)&&o(e)})),onPointerUp:Hn(t.onPointerUp,(e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))}))}))})),kr="SliderTrack",Er=(0,e.forwardRef)(((t,n)=>{const{__scopeSlider:r,...i}=t,o=gr(kr,r);return(0,e.createElement)(or.span,rt({"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation},i,{ref:n}))})),Sr="SliderRange",Cr=(0,e.forwardRef)(((t,n)=>{const{__scopeSlider:r,...i}=t,o=gr(Sr,r),a=br(Sr,r),s=qn(n,(0,e.useRef)(null)),l=o.values.length,c=o.values.map((e=>Mr(e,o.min,o.max))),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return(0,e.createElement)(or.span,rt({"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0},i,{ref:s,style:{...t.style,[a.startEdge]:u+"%",[a.endEdge]:d+"%"}}))})),Tr="SliderThumb",Ar=(0,e.forwardRef)(((t,n)=>{const r=dr(t.__scopeSlider),[i,o]=(0,e.useState)(null),a=qn(n,(e=>o(e))),s=(0,e.useMemo)((()=>i?r().findIndex((e=>e.ref.current===i)):-1),[r,i]);return(0,e.createElement)(Or,rt({},t,{ref:a,index:s}))})),Or=(0,e.forwardRef)(((t,n)=>{const{__scopeSlider:r,index:i,...o}=t,a=gr(Tr,r),s=br(Tr,r),[l,c]=(0,e.useState)(null),u=qn(n,(e=>c(e))),d=Jn(l),f=a.values[i],p=void 0===f?0:Mr(f,a.min,a.max),h=function(e,t){return t>2?`Value ${e+1} of ${t}`:2===t?["Minimum","Maximum"][e]:void 0}(i,a.values.length),m=null==d?void 0:d[s.size],g=m?function(e,t,n){const r=e/2,i=Nr([0,50],[0,r]);return(r-i(t)*n)*n}(m,p,s.direction):0;return(0,e.useEffect)((()=>{if(l)return a.thumbs.add(l),()=>{a.thumbs.delete(l)}}),[l,a.thumbs]),(0,e.createElement)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${p}% + ${g}px)`}},(0,e.createElement)(ur.ItemSlot,{scope:t.__scopeSlider},(0,e.createElement)(or.span,rt({role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":a.min,"aria-valuenow":f,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0},o,{ref:u,style:void 0===f?{display:"none"}:t.style,onFocus:Hn(t.onFocus,(()=>{a.valueIndexToChangeRef.current=i}))}))))})),Pr=t=>{const{value:n,...r}=t,i=(0,e.useRef)(null),o=Kn(n);return(0,e.useEffect)((()=>{const e=i.current,t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(o!==n&&r){const t=new Event("input",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}}),[o,n]),(0,e.createElement)("input",rt({style:{display:"none"}},r,{ref:i,defaultValue:n}))};function Mr(e,t,n){return Wn(100/(n-t)*(e-t),[0,100])}function Nr(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}const Lr=vr,Ir=Er,Dr=Cr,Rr=Ar,Br="Switch",[jr,zr]=Gn(Br),[Ur,Fr]=jr(Br),Wr=(0,e.forwardRef)(((t,n)=>{const{__scopeSwitch:r,name:i,checked:o,defaultChecked:a,required:s,disabled:l,value:c="on",onCheckedChange:u,...d}=t,[f,p]=(0,e.useState)(null),h=qn(n,(e=>p(e))),m=(0,e.useRef)(!1),g=!f||Boolean(f.closest("form")),[v=!1,y]=Yn({prop:o,defaultProp:a,onChange:u});return(0,e.createElement)(Ur,{scope:r,checked:v,disabled:l},(0,e.createElement)(or.button,rt({type:"button",role:"switch","aria-checked":v,"aria-required":s,"data-state":Gr(v),"data-disabled":l?"":void 0,disabled:l,value:c},d,{ref:h,onClick:Hn(t.onClick,(e=>{y((e=>!e)),g&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())}))})),g&&(0,e.createElement)(qr,{control:f,bubbles:!m.current,name:i,value:c,checked:v,required:s,disabled:l,style:{transform:"translateX(-100%)"}}))})),Hr="SwitchThumb",Vr=(0,e.forwardRef)(((t,n)=>{const{__scopeSwitch:r,...i}=t,o=Fr(Hr,r);return(0,e.createElement)(or.span,rt({"data-state":Gr(o.checked),"data-disabled":o.disabled?"":void 0},i,{ref:n}))})),qr=t=>{const{control:n,checked:r,bubbles:i=!0,...o}=t,a=(0,e.useRef)(null),s=Kn(r),l=Jn(n);return(0,e.useEffect)((()=>{const e=a.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==r&&n){const t=new Event("click",{bubbles:i});n.call(e,r),e.dispatchEvent(t)}}),[s,r,i]),(0,e.createElement)("input",rt({type:"checkbox","aria-hidden":!0,defaultChecked:r},o,{tabIndex:-1,ref:a,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function Gr(e){return e?"checked":"unchecked"}const $r=Wr,Zr=Vr;var Yr=i(5175),Xr={};Xr.styleTagTransform=m(),Xr.setAttributes=d(),Xr.insert=c().bind(null,"head"),Xr.domAPI=s(),Xr.insertStyleElement=p();o()(Yr.Z,Xr);const Kr=Yr.Z&&Yr.Z.locals?Yr.Z.locals:void 0;function Qr(e){return Qr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qr(e)}function Jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ei(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jr(Object(n),!0).forEach((function(t){ti(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ti(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Qr(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Qr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Qr(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ri(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ri(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const ii=function(){var t=ni((0,e.useContext)(F),2),n=t[0],r=t[1];return e.createElement("form",null,e.createElement("div",{className:Kr.SwitchRow},e.createElement("label",{className:Kr.Label,htmlFor:"replaceAudio",style:{paddingRight:15}},chrome.i18n.getMessage("replaceAudioEditor")),e.createElement($r,{className:Kr.SwitchRoot,checked:n.replaceAudio,onCheckedChange:function(e){r((function(t){return ei(ei({},t),{},{replaceAudio:e})}))}},e.createElement(Zr,{className:Kr.SwitchThumb}))))};function oi(e){return oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oi(e)}function ai(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ai=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==oi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(oi(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function si(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function li(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){si(o,r,i,a,s,"next",e)}function s(e){si(o,r,i,a,s,"throw",e)}a(void 0)}))}}function ci(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ui(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ci(Object(n),!0).forEach((function(t){di(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ci(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function di(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==oi(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==oi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===oi(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return pi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pi(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var hi="/assets/";const mi=function(t){var n=fi((0,e.useContext)(F),2),r=n[0],i=n[1],o=fi((0,e.useState)(null),2),a=o[0],s=o[1],l=(0,e.useRef)(null),c=(0,e.useRef)(null);(0,e.useEffect)((function(){r.blob!==l.current&&(l.current=r.blob,s(null),i((function(e){return ui(ui({},e),{},{volume:1})})))}),[]);var u=function(){var e=li(ai().mark((function e(t){var n;return ai().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.target.files[0]).type.includes("audio")&&0!==n.size){e.next=3;break}return e.abrupt("return");case 3:r.addAudio(r.blob,n,r.volume),s(n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),d=function(){var e=li(ai().mark((function e(){return ai().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i((function(e){return ui(ui({},e),{},{blob:l.current})})),r.addAudio(l.current,a,r.volume);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return e.createElement("div",null,e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},"Audio upload"),e.createElement("input",{type:"file",accept:"audio/*",onChange:u,style:{display:"none"},ref:c}),!a&&e.createElement("div",{className:On.uploadArea,onClick:function(){return c.current.click()}},e.createElement(Mt,{src:hi+"editor/icons/upload.svg"}),e.createElement("div",{className:On.uploadDetails},e.createElement("div",{className:On.uploadText},chrome.i18n.getMessage("sandboxAudioDragAndDrop")),e.createElement("div",{className:On.uploadDescription},chrome.i18n.getMessage("sandboxAudioOrBrowse")))),a&&e.createElement("div",{className:On.audioDetails},e.createElement("div",{className:On.audioDetailsLeft},e.createElement(Mt,{src:hi+"editor/icons/attachment.svg"})),e.createElement("div",{className:On.audioDetailsMiddle},e.createElement("span",null,a.name)),e.createElement("div",{className:On.audioDetailsRight},e.createElement(Mt,{src:hi+"editor/icons/cross.svg",onClick:function(){s(null),i((function(e){return ui(ui({},e),{},{blob:l.current})})),c.current.value=null}})))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxAudioSettingsTitle")),e.createElement("div",{className:On.inputs},e.createElement("div",{className:"".concat(On.input," ").concat(On.inputVolume)},e.createElement("div",{className:On.inputTitle},chrome.i18n.getMessage("sandboxAudioVolumeLabel")),e.createElement("input",{type:"text",className:"input",onChange:function(e){return function(e){var t=e.target.value;isNaN(t)||t<0||t>100||i((function(e){return ui(ui({},e),{},{volume:parseFloat(t)/100})}))}(e)},value:Math.round(100*r.volume),onBlur:function(e){""===e.target.value&&i((function(e){return ui(ui({},e),{},{volume:0})}))}}),e.createElement("span",null,"%")),e.createElement(Lr,{className:On.SliderRoot,max:100,step:1,onValueChange:function(e){i((function(t){return ui(ui({},t),{},{volume:Math.round(e)/100})}))},value:[100*r.volume]},e.createElement(Ir,{className:On.SliderTrack},e.createElement(Dr,{className:On.SliderRange})),e.createElement(Rr,{className:On.SliderThumb,"aria-label":"Volume"}))),e.createElement(ii,null),e.createElement("button",{className:["button","primaryButton",On.updateButton].join(" "),onClick:d,disabled:r.isFfmpegRunning||!a},chrome.i18n.getMessage("sandboxAudioUpdateButton"))))};function gi(e){return gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gi(e)}function vi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */vi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:C(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function v(){}function y(){}function b(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(M([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==gi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=f;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var l=T(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?m:p,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=d(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(gi(t)+" is not iterable")}return y.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(S.prototype),c(S.prototype,s,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),c(k,l,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function yi(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function bi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(n),!0).forEach((function(t){xi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==gi(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==gi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===gi(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ki(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ki(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ki(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ei="chrome-extension://"+chrome.i18n.getMessage("@@extension_id")+"/assets/";const Si=function(){var t=_i((0,e.useContext)(F),2),n=t[0],r=t[1],i=(0,e.useRef)(n),o=(0,e.useRef)([]);(0,e.useEffect)((function(){console.error=function(e){o.current.push(e)}}),[]),(0,e.useEffect)((function(){i.current=n}),[n]);var a=function(){var e,t=(e=vi().mark((function e(){return vi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n.duration>n.editLimit)||n.override){e.next=2;break}return e.abrupt("return");case 2:if(n.mp4ready){e.next=4;break}return e.abrupt("return");case 4:r((function(e){return wi(wi({},e),{},{mode:"audio"})})),n.hasBeenEdited||r((function(e){return wi(wi({},e),{},{hasBeenEdited:!0})}));case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){yi(o,r,i,a,s,"next",e)}function s(e){yi(o,r,i,a,s,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}();return e.createElement("div",{className:On.panel},"audio"===n.mode&&e.createElement(mi,null),"crop"===n.mode&&e.createElement(Fn,null),"player"===n.mode&&e.createElement("div",null,!n.fallback&&n.offline&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/no-internet.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("offlineLabelTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("offlineLabelDescription"))),e.createElement("div",{className:On.buttonRight},chrome.i18n.getMessage("offlineLabelTryAgain"))),n.fallback&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("recoveryModeTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("overLimitLabelDescription")))),!n.fallback&&n.updateChrome&&!n.offline&&n.duration<=n.editLimit&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("updateChromeLabelTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("updateChromeLabelDescription"))),e.createElement("div",{className:On.buttonRight,onClick:function(){chrome.runtime.sendMessage({type:"chrome-update-info"})}},chrome.i18n.getMessage("learnMoreLabel"))),!n.fallback&&n.duration>n.editLimit&&!n.override&&!n.offline&&!n.updateChrome&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("overLimitLabelTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("overLimitLabelDescription"))),e.createElement("div",{className:On.buttonRight,onClick:function(){"function"==typeof n.openModal&&n.openModal(chrome.i18n.getMessage("overLimitModalTitle"),chrome.i18n.getMessage("overLimitModalDescription"),chrome.i18n.getMessage("overLimitModalButton"),chrome.i18n.getMessage("sandboxEditorCancelButton"),(function(){r((function(e){return wi(wi({},e),{},{saved:!0})})),chrome.runtime.sendMessage({type:"force-processing"})}),(function(){}),null,chrome.i18n.getMessage("overLimitModalLearnMore"),(function(){chrome.runtime.sendMessage({type:"upgrade-info"})}))}},chrome.i18n.getMessage("learnMoreLabel"))),(!n.mp4ready||n.isFfmpegRunning)&&(n.duration<=n.editLimit||n.override)&&!n.offline&&!n.updateChrome&&!n.noffmpeg&&e.createElement("div",{className:On.alert},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/alert.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("videoProcessingLabelTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("videoProcessingLabelDescription"))),e.createElement("div",{className:On.buttonRight,onClick:function(){chrome.runtime.sendMessage({type:"open-processing-info"})}},chrome.i18n.getMessage("learnMoreLabel"))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxEditTitle")),e.createElement("div",{className:On.buttonWrap},e.createElement("div",{role:"button",className:On.button,onClick:function(){n.duration>n.editLimit&&!n.override||n.mp4ready&&(r((function(e){return wi(wi({},e),{},{mode:"edit",dragInteracted:!1})})),n.hasBeenEdited||r((function(e){return wi(wi({},e),{},{hasBeenEdited:!0})})))},disabled:n.duration>n.editLimit&&!n.override||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/trim.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("editButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready?chrome.i18n.getMessage("editButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:function(){n.duration>n.editLimit&&!n.override||n.mp4ready&&(r((function(e){return wi(wi({},e),{},{mode:"crop"})})),n.hasBeenEdited||r((function(e){return wi(wi({},e),{},{hasBeenEdited:!0})})))},disabled:n.duration>n.editLimit&&!n.override||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/crop.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("cropButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready?chrome.i18n.getMessage("cropButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:a,disabled:n.duration>n.editLimit&&!n.override||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/audio.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("addAudioButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready?chrome.i18n.getMessage("addAudioButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxSaveTitle")),n.driveEnabled&&e.createElement("div",{className:On.buttonLogout,onClick:function(){chrome.runtime.sendMessage({type:"sign-out-drive"}),r((function(e){return wi(wi({},e),{},{driveEnabled:!1})}))}},chrome.i18n.getMessage("signOutDriveLabel")),e.createElement("div",{className:On.buttonWrap},e.createElement("div",{role:"button",className:On.button,onClick:function(){if(r((function(e){return wi(wi({},e),{},{saveDrive:!0})})),!n.noffmpeg&&n.mp4ready&&n.blob){var e=new FileReader;e.onload=function(){var t=e.result.split(",")[1];chrome.runtime.sendMessage({type:"save-to-drive",base64:t,title:n.title}).then((function(e){"ew"===e.status&&r((function(e){return wi(wi({},e),{},{saveDrive:!1})}))}))},!n.noffmpeg&&n.mp4ready&&n.blob?e.readAsDataURL(n.blob):e.readAsDataURL(n.webm)}else chrome.runtime.sendMessage({type:"save-to-drive-fallback",title:n.title}).then((function(e){"ew"===e.status&&r((function(e){return wi(wi({},e),{},{saveDrive:!1})}))}))},disabled:n.saveDrive},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/drive.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.saveDrive?chrome.i18n.getMessage("savingDriveLabel"):n.driveEnabled?chrome.i18n.getMessage("saveDriveButtonTitle"):chrome.i18n.getMessage("signInDriveLabel")),e.createElement("div",{className:On.buttonDescription},n.offline?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome?chrome.i18n.getMessage("notAvailableLabel"):chrome.i18n.getMessage("saveDriveButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxExportTitle")),e.createElement("div",{className:On.buttonWrap},n.fallback&&e.createElement("div",{role:"button",className:On.button,onClick:function(){return n.downloadWEBM()},disabled:n.isFfmpegRunning},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/download.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.downloadingWEBM?chrome.i18n.getMessage("downloadingLabel"):chrome.i18n.getMessage("downloadWEBMButtonTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("downloadWEBMButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:function(){n.mp4ready&&n.download()},disabled:n.isFfmpegRunning||n.noffmpeg||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/download.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.downloading?chrome.i18n.getMessage("downloadingLabel"):chrome.i18n.getMessage("downloadMP4ButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready&&!n.isFfmpegRunning?chrome.i18n.getMessage("downloadMP4ButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),!n.fallback&&e.createElement("div",{role:"button",className:On.button,onClick:function(){return n.downloadWEBM()},disabled:n.isFfmpegRunning},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/download.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.downloadingWEBM?chrome.i18n.getMessage("downloadingLabel"):chrome.i18n.getMessage("downloadWEBMButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.isFfmpegRunning?chrome.i18n.getMessage("preparingLabel"):chrome.i18n.getMessage("downloadWEBMButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:function(){n.mp4ready&&n.downloadGIF()},disabled:n.isFfmpegRunning||n.duration>30||!n.mp4ready||n.noffmpeg},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/gif.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},n.downloadingGIF?chrome.i18n.getMessage("downloadingLabel"):chrome.i18n.getMessage("downloadGIFButtonTitle")),e.createElement("div",{className:On.buttonDescription},n.offline&&!n.ffmpegLoaded?chrome.i18n.getMessage("noConnectionLabel"):n.updateChrome||n.noffmpeg||n.duration>n.editLimit&&!n.override?chrome.i18n.getMessage("notAvailableLabel"):n.mp4ready?chrome.i18n.getMessage("downloadGIFButtonDescription"):chrome.i18n.getMessage("preparingLabel"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))))),e.createElement("div",{className:On.section},e.createElement("div",{className:On.sectionTitle},chrome.i18n.getMessage("sandboxAdvancedTitle")),e.createElement("div",{className:On.buttonWrap},e.createElement("div",{role:"button",className:On.button,onClick:function(){"function"==typeof i.current.openModal&&i.current.openModal(chrome.i18n.getMessage("rawRecordingModalTitle"),chrome.i18n.getMessage("rawRecordingModalDescription"),chrome.i18n.getMessage("rawRecordingModalButton"),chrome.i18n.getMessage("sandboxEditorCancelButton"),(function(){var e=i.current.rawBlob,t=window.URL.createObjectURL(e);chrome.downloads.download({url:t,filename:"raw-recording.webm"},(function(){window.URL.revokeObjectURL(t)}))}),(function(){}))}},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/download.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("rawRecordingButtonTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("rawRecordingButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"}))),e.createElement("div",{role:"button",className:On.button,onClick:function(){"function"==typeof i.current.openModal&&i.current.openModal(chrome.i18n.getMessage("troubleshootModalTitle"),chrome.i18n.getMessage("troubleshootModalDescription"),chrome.i18n.getMessage("troubleshootModalButton"),chrome.i18n.getMessage("sandboxEditorCancelButton"),(function(){var e=navigator.userAgent,t={};chrome.runtime.getPlatformInfo((function(n){t=n;var r=chrome.runtime.getManifest().version,o=i.current.rawBlob,a={userAgent:e,platformInfo:t,manifestInfo:r,contentState:i.current},s=new(Mn());s.file("recording.webm",o),s.file("troubleshooting.json",JSON.stringify(a)),s.generateAsync({type:"blob"}).then((function(e){var t=window.URL.createObjectURL(e);chrome.downloads.download({url:t,filename:"troubleshooting.zip"},(function(){window.URL.revokeObjectURL(t)}))}))}))}),(function(){}))}},e.createElement("div",{className:On.buttonLeft},e.createElement(Mt,{src:Ei+"editor/icons/flag.svg"})),e.createElement("div",{className:On.buttonMiddle},e.createElement("div",{className:On.buttonTitle},chrome.i18n.getMessage("troubleshootButtonTitle")),e.createElement("div",{className:On.buttonDescription},chrome.i18n.getMessage("troubleshootButtonDescription"))),e.createElement("div",{className:On.buttonRight},e.createElement(Mt,{src:Ei+"editor/icons/right-arrow.svg"})))))))};var Ci=i(9146),Ti={};Ti.styleTagTransform=m(),Ti.setAttributes=d(),Ti.insert=c().bind(null,"head"),Ti.domAPI=s(),Ti.insertStyleElement=p();o()(Ci.Z,Ti);const Ai=Ci.Z&&Ci.Z.locals?Ci.Z.locals:void 0;var Oi=i(4917),Pi={};Pi.styleTagTransform=m(),Pi.setAttributes=d(),Pi.insert=c().bind(null,"head"),Pi.domAPI=s(),Pi.insertStyleElement=p();o()(Oi.Z,Pi);Oi.Z&&Oi.Z.locals&&Oi.Z.locals;var Mi=i(13),Ni={};Ni.styleTagTransform=m(),Ni.setAttributes=d(),Ni.insert=c().bind(null,"head"),Ni.domAPI=s(),Ni.insertStyleElement=p();o()(Mi.Z,Ni);const Li=Mi.Z&&Mi.Z.locals?Mi.Z.locals:void 0;var Ii=i(9147),Di={};Di.styleTagTransform=m(),Di.setAttributes=d(),Di.insert=c().bind(null,"head"),Di.domAPI=s(),Di.insertStyleElement=p();o()(Ii.Z,Di);const Ri=Ii.Z&&Ii.Z.locals?Ii.Z.locals:void 0;function Bi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ji(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ji(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ji(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const zi=function(t){t.showShare;var n=t.setShowShare,r=Bi((0,e.useContext)(F),2);r[0],r[1];return e.createElement("div",{className:Ri.modalWrap},e.createElement("div",{className:Ri.modal},e.createElement("div",{className:Ri.close,onClick:function(){n(!1)}},e.createElement(Mt,{src:"/assets/editor/icons/close-button.svg",width:"16px",height:"16px"})),e.createElement("div",{className:Ri.emoji},"👋"),e.createElement("div",{className:Ri.title},chrome.i18n.getMessage("shareModalSandboxTitle")),e.createElement("div",{className:Ri.subtitle},chrome.i18n.getMessage("shareModalSandboxDescription")),e.createElement("div",{className:Ri.button,onClick:function(){chrome.runtime.sendMessage({type:"join-waitlist"}),n(!1)}},chrome.i18n.getMessage("shareModalSandboxButton"))),e.createElement("div",{className:Ri.modalBackground,onClick:function(){n(!1)}}))};function Ui(e){return Ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ui(e)}function Fi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Wi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fi(Object(n),!0).forEach((function(t){Hi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ui(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ui(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ui(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qi(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Gi="/assets/";const $i=function(){var t=Vi((0,e.useState)(!1),2),n=t[0],r=t[1],i=Vi((0,e.useContext)(F),2),o=i[0],a=i[1],s=(0,e.useRef)(null),l=Vi((0,e.useState)(!0),2),c=l[0],u=l[1],d=Vi((0,e.useState)(o.title),2),f=d[0],p=d[1],h=Vi((0,e.useState)(o.title),2),m=h[0],g=h[1];(0,e.useEffect)((function(){p(o.title),o.title.length>80?g(o.title.slice(0,80)+"..."):g(o.title)}),[o.title]);return(0,e.useEffect)((function(){c||(s.current.focus(),s.current.select())}),[c]),(0,e.useEffect)((function(){var e=function(e){"Enter"===e.key?(u(!0),a((function(e){return Wi(Wi({},e),{},{title:f})}))):"Escape"===e.key&&(u(!0),p(o.title))};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[f]),e.createElement("div",{className:Li.TitleParent},n&&e.createElement(zi,{showShare:n,setShowShare:r}),e.createElement("div",{className:Li.TitleWrap},c?e.createElement(e.Fragment,null,e.createElement("h1",{onClick:function(){u(!1)}},m," ",e.createElement(Mt,{src:Gi+"editor/icons/pencil.svg",className:Li.pencil,styles:{display:"inline-block"}})),e.createElement("div",{className:Li.shareButton,onClick:function(){r(!0)}},e.createElement(Mt,{src:Gi+"editor/icons/link.svg",className:Li.shareIcon}),chrome.i18n.getMessage("shareSandboxButton"))):e.createElement("input",{type:"text",value:f,onChange:function(e){p(e.target.value)},onBlur:function(){u(!0),a((function(e){return Wi(Wi({},e),{},{title:f})}))},ref:s})))};function Zi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||Yi(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yi(e,t){if(e){if("string"==typeof e)return Xi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xi(e,t):void 0}}function Xi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Ki=function(t){var n=Zi((0,e.useContext)(F),2),r=n[0],i=(n[1],(0,e.useRef)(null)),o=Zi((0,e.useState)(null),2),a=o[0],s=o[1],l=Zi((0,e.useState)(null),2),c=l[0],u=l[1],d=(0,e.useRef)(r),f=(0,e.useRef)(null);(0,e.useEffect)((function(){d.current=r}),[r]),(0,e.useEffect)((function(){i.current&&i.current.plyr&&r.updatePlayerTime&&(i.current.plyr.currentTime=r.time)}),[r.time]);var p=(0,e.useMemo)((function(){return{controls:["play","rewind","fast-forward","progress","current-time","duration","mute","captions","settings","pip","fullscreen"],urls:null,ratio:"16:9",blankVideo:"chrome-extension://"+chrome.i18n.getMessage("@@extension_id")+"/assets/blank.mp4",keyboard:{global:!0}}}),[]);return(0,e.useEffect)((function(){if(r.webm||r.blob){var e;r.blob?(f.current&&(f.current.style.display="none",f.current.remove()),e=r.blob):r.webm&&(e=r.webm);var t=URL.createObjectURL(e);return u({type:"video",sources:[{src:t,type:r.blob?"video/mp4":"video/webm"}]}),s(t),function(){URL.revokeObjectURL(t)}}}),[r.webm,r.blob,r.hasBeenEdited,i]),(0,e.useEffect)((function(){if(!d.current.mp4ready&&!d.current.blob){var e=new MutationObserver((function(e,t){var n,r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Yi(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(e);try{for(r.s();!(n=r.n()).done;){n.value;!document.querySelector(".plyr--video")||d.current.mp4ready||d.current.blob||f.current||d.current.noffmpeg||d.current.duration>d.current.editLimit&&!d.current.override||(f.current=document.createElement("div"),f.current.classList.add("videoBanner"),f.current.innerHTML="<img src='"+chrome.runtime.getURL("assets/editor/icons/alert-white.svg")+"'/> <span>"+chrome.i18n.getMessage("processingBannerEditor")+"</span>",document.querySelector(".plyr--video").appendChild(f.current))}}catch(e){r.e(e)}finally{r.f()}}));return e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),function(){e.disconnect(),f.current&&(f.current.style.display="none",f.current.remove(),f.current=null)}}}),[]),e.createElement("div",{className:"videoPlayer"},e.createElement("div",{className:"playerWrap"},a&&e.createElement(le,{ref:i,id:"plyr-player",source:c,options:p}),"player"===r.mode&&e.createElement($i,null)),e.createElement("style",null,"\n\t\t\t\t\t@media (max-width: 900px) {\n\t\t\t\t\t\t.videoPlayer {\n\t\t\t\t\t\t\tposition: relative!important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t"))};function Qi(e){return e.moveCoordinates||e.resizeCoordinates||e.transformImage.move||e.transformImage.rotate||e.transformImage.flip||e.transformImage.scale}function Ji(e,t){var n,r;return e&&t?(n=""+e+t[0].toUpperCase()+t.slice(1),r=e+"-"+t):(n=e||t,r=e||t),{camelCase:n,snakeCase:r}}function eo(e){return/^blob:/.test(e)}function to(e){return eo(e)||function(e){return/^data:/.test(e)}(e)}function no(e){if(to(e))return!1;var t=window.location,n=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(e)||[],r={protocol:n[1]||"",host:n[2]||"",port:n[3]||""},i=function(e){return e.port||("http"===(e.protocol||t.protocol)?80:433)};return!(!r.protocol&&!r.host&&!r.port||Boolean(r.protocol&&r.protocol==t.protocol&&r.host&&r.host==t.host&&r.host&&i(r)==i(t)))}function ro(e){return"function"==typeof e}function io(e){return void 0===e}var oo=function(e){return null!==e&&"object"==typeof e};function ao(e,t,n){void 0===n&&(n={});var r={};return oo(e)?(Object.keys(t).forEach((function(i){io(e[i])?r[i]=t[i]:oo(t[i])?oo(e[i])?r[i]=ao(e[i],t[i],n[i]):r[i]=e[i]?t[i]:n[i]:!0===t[i]||!1===t[i]?r[i]=Boolean(e[i]):r[i]=e[i]})),r):e?t:n}function so(e){var t=Number(e);return Number.isNaN(t)?e:t}function lo(e){return!0===e||!1===e}function co(e){return"number"==typeof e}function uo(e){return e!=e}function fo(e){return co(e)&&!uo(e)||function(e){return"string"==typeof e}(e)&&!Number.isNaN(parseFloat(e))&&isFinite(parseFloat(e))}function po(e,t){return Math.sqrt(Math.pow(e.left-t.left,2)+Math.pow(e.top-t.top,2))}function ho(e,t,n){return void 0===n&&(n=.001),Math.abs(t-e)<n}function mo(e,t,n){return!ho(e,t,n)&&e>t}function go(e,t,n){return!ho(e,t,n)&&e<t}function vo(e){return new Promise((function(t){setTimeout((function(){t()}),e)}))}function yo(e){if(!oo(e))return e;var t={};return Array.isArray(e)?t=e.map((function(e){return yo(e)})):Object.keys(e).forEach((function(n){return t[n]=yo(e[n])})),t}function bo(e,t,n){if(void 0===n&&(n=.001),co(e)&&co(t)&&ho(e,t,n))return!0;if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,i=void 0;if(Array.isArray(e)){if((r=e.length)!=t.length)return!1;for(i=r;0!=i--;)if(!bo(e[i],t[i],n))return!1;return!0}if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var o=Object.keys(e);if((r=o.length)!==Object.keys(t).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,o[i]))return!1;for(i=r;0!=i--;){var a=o[i];if(!bo(e[a],t[a],n))return!1}return!0}return e!=e&&t!=t}function wo(e){return"west"===e||"south"===e||"north"===e||"east"===e}function xo(e,t){var n,r;function i(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=Date.now()-n,l=ro(t)?t():t||0;s<l&&s>=0?r=setTimeout((function(){return i.apply(void 0,o)}),l-s):e.apply(void 0,o)}function o(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];n=Date.now(),r=setTimeout((function(){return i.apply(void 0,e)}),ro(t)?t():t||0)}return o.clear=function(){clearTimeout(r)},o}var _o,ko,Eo,So=["left","right","top","bottom"],Co=["left","right"],To=["top","bottom"];function Ao(e,t){return{left:e.left-t.left,top:e.top-t.top}}function Oo(e){return{left:e.left+e.width/2,top:e.top+e.height/2}}function Po(e,t){return Math.pow(e.width-t.width,2)+Math.pow(e.height-t.height,2)}function Mo(e,t){return{left:e.left-t.left,top:e.top-t.top,width:e.width+t.left+t.right,height:e.height+t.top+t.bottom}}function No(e){return{left:-e.left,top:-e.top}}function Lo(e,t){return st(st({},e),{left:e.left+t.left,top:e.top+t.top})}function Io(e){return{left:e.left,top:e.top,right:e.left+e.width,bottom:e.top+e.height}}function Do(e,t,n,r){if(1!==t){if("left"in e||"top"in e){if(n){var i=Oo(e);return{width:e.width*t,height:e.height*t,left:e.left+e.width*(1-t)/2+(n.left-i.left)*(r||1-t),top:e.top+e.height*(1-t)/2+(n.top-i.top)*(r||1-t)}}return{width:e.width*t,height:e.height*t,left:e.left+e.width*(1-t)/2,top:e.top+e.height*(1-t)/2}}return{width:e.width*t,height:e.height*t}}return e}function Ro(e){return e.width/e.height}function Bo(e,t){return Math.min(t.maxWidth?t.maxWidth/e.width:1/0,t.maxHeight?t.maxHeight/e.height:1/0)}function jo(e,t){var n;return t.minimum&&go(e,t.minimum)?n=t.minimum:t.maximum&&mo(e,t.maximum)&&(n=t.maximum),n}function zo(e,t){var n=Ro(e),r=1;return t.minWidth>0&&t.minHeight>0?n>t.minWidth/t.minHeight?e.height<t.minHeight&&(r=t.minHeight/e.height):e.width<t.minWidth&&(r=t.minWidth/e.width):t.minWidth>0?e.width<t.minWidth&&(r=t.minWidth/e.width):t.minHeight>0&&e.height<t.minHeight&&(r=t.minHeight/e.height),t.maxWidth<1/0&&t.maxHeight<1/0?n>t.maxWidth/t.maxHeight?e.width>t.maxWidth&&(r=t.maxWidth/e.width):e.height>t.maxHeight&&(r=t.maxHeight/e.height):t.maxWidth<1/0?e.width>t.maxWidth&&(r=t.maxWidth/e.width):t.maxHeight<1/0&&e.height>t.maxHeight&&(r=t.maxHeight/e.height),r}function Uo(e,t){var n={left:0,top:0,right:0,bottom:0};return So.forEach((function(r){var i=t[r],o=Io(e)[r];n[r]=void 0!==i&&void 0!==o?"left"===r||"top"===r?Math.max(0,i-o):Math.max(0,o-i):0})),n}function Fo(e,t){return Do(e,zo(e,t))}function Wo(e,t){var n=t*Math.PI/180;return{width:Math.abs(e.width*Math.cos(n))+Math.abs(e.height*Math.sin(n)),height:Math.abs(e.width*Math.sin(n))+Math.abs(e.height*Math.cos(n))}}function Ho(e,t,n){var r=t*Math.PI/180;return n?{left:(e.left-n.left)*Math.cos(r)-(e.top-n.top)*Math.sin(r)+n.left,top:(e.left-n.left)*Math.sin(r)+(e.top-n.top)*Math.cos(r)+n.top}:{left:e.left*Math.cos(r)-e.top*Math.sin(r),top:e.left*Math.sin(r)+e.top*Math.cos(r)}}function Vo(e){return{minWidth:0,minHeight:0,maxWidth:void 0!==e.right&&void 0!==e.left?e.right-e.left:1/0,maxHeight:void 0!==e.bottom&&void 0!==e.top?e.bottom-e.top:1/0}}function qo(e,t){var n={};return So.forEach((function(r){var i=e[r],o=t[r];void 0!==i&&void 0!==o?n[r]="left"===r||"top"===r?Math.max(i,o):Math.min(i,o):void 0!==o?n[r]=o:void 0!==i&&(n[r]=i)})),n}function Go(e,t){var n={left:0,top:0},r=Uo(e,t);return r.left&&r.left>0?n.left=r.left:r.right&&r.right>0&&(n.left=-r.right),r.top&&r.top>0?n.top=r.top:r.bottom&&r.bottom>0&&(n.top=-r.bottom),n}function $o(e,t){return Lo(e,Go(e,t))}function Zo(e){return void 0===e&&(e={}),co(e)?{minimum:e,maximum:e}:{minimum:fo(e.minimum)?e.minimum:0,maximum:fo(e.maximum)?e.maximum:1/0}}function Yo(e,t){return(io(t.maxWidth)||!mo(e.width,t.maxWidth))&&(io(t.maxHeight)||!mo(e.height,t.maxHeight))&&(io(t.minHeight)||!go(e.height,t.minHeight))&&(io(t.minWidth)||!go(e.width,t.minWidth))}function Xo(e,t){return(io(t.left)||!go(e.left,t.left))&&(io(t.top)||!go(e.top,t.top))&&(io(t.right)||!mo(e.left+e.width,t.right))&&(io(t.bottom)||!mo(e.top+e.height,t.bottom))}function Ko(e){var t=st({},e);return t.minWidth>t.maxWidth&&(t.minWidth=t.maxWidth),t.minHeight>t.maxHeight&&(t.minHeight=t.maxHeight),t}function Qo(e,t){var n=e,r=st({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},t);return Ko({maxHeight:Math.min(n.maxHeight,r.maxHeight),minHeight:Math.max(n.minHeight,r.minHeight),maxWidth:Math.min(n.maxWidth,r.maxWidth),minWidth:Math.max(n.minWidth,r.minWidth)})}function Jo(e){return Boolean(e&&e.visibleArea&&e.coordinates)}function ea(e,t){return function(e,t){var n=ro(t.areaSizeRestrictions)?t.areaSizeRestrictions(e,t):t.areaSizeRestrictions;return n.maxWidth<1/0&&n.maxHeight<1/0&&(Ro(e.boundary)>n.maxWidth/n.maxHeight?n.maxHeight=n.maxWidth/Ro(e.boundary):n.maxWidth=n.maxHeight*Ro(e.boundary)),Ko(n)}(e,t)}function ta(e,t){return ro(t.areaPositionRestrictions)?t.areaPositionRestrictions(e,t):t.areaPositionRestrictions}function na(e,t){return function(e,t){var n=ro(t.sizeRestrictions)?t.sizeRestrictions(e,t):t.sizeRestrictions,r=ra(e,t),i={minWidth:fo(n.minWidth)?so(n.minWidth):0,minHeight:fo(n.minHeight)?so(n.minHeight):0,maxWidth:fo(n.maxWidth)?so(n.maxWidth):1/0,maxHeight:fo(n.maxHeight)?so(n.maxHeight):1/0};return void 0!==r.left&&void 0!==r.right&&(i.maxWidth=Math.min(i.maxWidth,r.right-r.left)),void 0!==r.bottom&&void 0!==r.top&&(i.maxHeight=Math.min(i.maxHeight,r.bottom-r.top)),Ko(i)}(e,t)}function ra(e,t){return ro(t.positionRestrictions)?t.positionRestrictions(e,t):t.positionRestrictions}function ia(e){return e.visibleArea?e.visibleArea.width/e.boundary.width:0}function oa(e){if(Jo(e)){var t=e.coordinates,n=t.width,r=t.height,i=t.left,o=t.top,a=ia(e);return{width:n/a,height:r/a,left:(i-e.visibleArea.left)/a,top:(o-e.visibleArea.top)/a}}return{left:0,top:0,width:0,height:0}}function aa(e,t){return Zo(ro(t.aspectRatio)?t.aspectRatio(e,t):t.aspectRatio)}function sa(e,t){return ro(t.defaultCoordinates)?t.defaultCoordinates(e,t):t.defaultCoordinates}function la(e,t){return ro(t.defaultVisibleArea)?t.defaultVisibleArea(e,t):t.defaultVisibleArea}function ca(e){return e.imageSize&&e.imageSize.width&&e.imageSize.height?Wo(e.imageSize,e.transforms.rotate):{width:0,height:0}}function ua(e,t){return!Jo(e)||!jo(Ro(e.coordinates),aa(e,t))&&Yo(e.visibleArea,ea(e,t))&&Yo(e.coordinates,na(e,t))&&Xo(e.visibleArea,ta(e,t))&&Xo(e.coordinates,ra(e,t))}function da(e){return yo(e)}function fa(e){var t=e.width,n=e.height,r=e.sizeRestrictions||{minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},i=Zo(e.aspectRatio),o={width:Math.max(r.minWidth,Math.min(r.maxWidth,t)),height:Math.max(r.minHeight,Math.min(r.maxHeight,n))},a=[o];return i&&[i.minimum,i.maximum].forEach((function(e){e&&a.push({width:o.width,height:o.width/e},{width:o.height*e,height:o.height})})),function(e,t,n,r){var i=function(i){return e.reduce((function(e,o){var a=ro(n)?n(o):n,s=a.maxHeight,l=a.maxWidth,c=a.minWidth,u=a.minHeight,d=Zo(ro(r)?r(o):r);return Yo(o,i?{maxWidth:l,maxHeight:s}:{maxWidth:l,maxHeight:s,minWidth:c,minHeight:u})&&!jo(Ro(o),d)&&o.width&&o.height&&(!e||go(Po(o,t),Po(e,t)))?o:e}),null)};return i()||i(!0)}(a=a.map((function(e){return Fo(e,r)})),{width:t,height:n},r,i)}function pa(e,t){var n=da(e);if(e.visibleArea){var r=ea(e,t);n.visibleArea=st(st({},e.visibleArea),fa({width:e.visibleArea.width,height:e.visibleArea.height,aspectRatio:{minimum:Ro(n.boundary),maximum:Ro(n.boundary)},sizeRestrictions:r})),n.visibleArea=Lo(n.visibleArea,Ao(Oo(e.visibleArea),Oo(n.visibleArea))),n.visibleArea=$o(n.visibleArea,ta(n,t))}return n}function ha(e,t,n){var r=Lo(e,t);return n?$o(r,n):r}function ma(e,t,n,r){void 0===r&&(r=!0);var i=!1===r?_o.unsafe:!0===r?_o.zoom:r,o=aa(e,t),a=na(e,t);e.visibleArea&&i===_o.limit&&(a=st(st({},a),{minWidth:Math.min(e.visibleArea.width,a.minWidth),minHeight:Math.min(e.visibleArea.height,a.minHeight),maxWidth:Math.min(e.visibleArea.width,a.maxWidth),maxHeight:Math.min(e.visibleArea.height,a.maxHeight)}));var s=ra(e,t);e.visibleArea&&i===_o.limit&&(s=qo(s,Io(e.visibleArea)));var l=function(e,t){return ha(e,{left:t.left-(e.left||0),top:t.top-(e.top||0)},s)},c=e.coordinates?st({},e.coordinates):{left:0,top:0,width:0,height:0};(Array.isArray(n)?n:[n]).forEach((function(n){var r;(r="function"==typeof n?n(st(st({},e),{coordinates:c}),t):n)&&(io(r.width)&&io(r.height)||(c=function(e,t){var n=st(st(st({},e),fa({width:t.width,height:t.height,sizeRestrictions:a,aspectRatio:o})),{left:0,top:0});return l(n,{left:e.left||0,top:e.top||0})}(c,st(st({},c),r))),io(r.left)&&io(r.top)||(c=l(c,st(st({},c),r))))}));var u=st(st({},da(e)),{coordinates:c});if(u.visibleArea&&i===_o.zoom){var d=Math.max(0,u.coordinates.width-u.visibleArea.width),f=Math.max(0,u.coordinates.height-u.visibleArea.height),p=ea(e,t),h=d>f?u.coordinates.width/u.visibleArea.width:u.coordinates.height/u.visibleArea.height;return h>1&&(u.visibleArea=Do(u.visibleArea,Math.min(h,Bo(u.visibleArea,p)))),u.visibleArea=Lo(u.visibleArea,No(Go(u.coordinates,Io(u.visibleArea)))),pa(u,t)}return u}function ga(e,t){if(e.coordinates){var n=da(e),r=aa(e,t),i=na(e,t);return n.coordinates=st(st({},e.coordinates),fa({width:e.coordinates.width,height:e.coordinates.height,aspectRatio:r,sizeRestrictions:e.visibleArea?{maxWidth:Math.min(e.visibleArea.width,i.maxWidth),maxHeight:Math.min(e.visibleArea.height,i.maxHeight),minHeight:Math.min(e.visibleArea.height,i.minHeight),minWidth:Math.min(e.visibleArea.width,i.minWidth)}:i})),n.coordinates=Lo(n.coordinates,Ao(Oo(e.coordinates),Oo(n.coordinates))),n.coordinates=$o(n.coordinates,e.visibleArea?qo(Io(e.visibleArea),ra(n,t)):ra(n,t)),n}return e}function va(e,t,n,r){void 0===r&&(r=!0);var i=st(st({},da(e)),{visibleArea:n});return i=pa(i,t),r&&(i=ga(i,t)),i}function ya(e,t){var n,r,i,o,a,s=e.boundary,l=e.image,c={boundary:{width:s.width,height:s.height},imageSize:{width:l.width,height:l.height},transforms:{rotate:(null===(n=l.transforms)||void 0===n?void 0:n.rotate)||0,flip:{horizontal:(null===(i=null===(r=l.transforms)||void 0===r?void 0:r.flip)||void 0===i?void 0:i.horizontal)||!1,vertical:(null===(a=null===(o=l.transforms)||void 0===o?void 0:o.flip)||void 0===a?void 0:a.vertical)||!1}},visibleArea:null,coordinates:null};return t.defaultTransforms&&(c.transforms=function(e,t){var n=st(st({},e.transforms),{flip:st({},e.transforms.flip)});if(t.defaultTransforms){var r=ro(t.defaultTransforms)?t.defaultTransforms(e,t):t.defaultTransforms;co(r.rotate)&&(n.rotate=r.rotate),r.flip&&(lo(r.flip.horizontal)&&(n.flip.horizontal=r.flip.horizontal),lo(r.flip.vertical)&&(n.flip.vertical=r.flip.vertical))}return n}(c,t)),c=t.priority===Eo.visibleArea?ma(c=va(c,t,la(c,t),!1),t,sa(c,t),_o.limit):va(c=ma(c,t,sa(c,t),_o.unsafe),t,la(c,t),!0)}function ba(e,t,n){if(Jo(e)){var r=da(e);return r.coordinates=Lo(r.coordinates,n),r.coordinates=$o(r.coordinates,qo(Io(r.visibleArea),ra(r,t))),r}return e}function wa(e){var t=e.coordinates,n=e.directions,r=e.positionRestrictions,i=e.sizeRestrictions,o=e.preserveRatio,a=e.allowedDirections,s=e.compensate,l=void 0===s||s,c=st({},n),u=Mo(t,c).width,d=Mo(t,c).height;u<0&&(c.left<0&&c.right<0?(c.left=-(t.width-i.minWidth)/(c.left/c.right),c.right=-(t.width-i.minWidth)/(c.right/c.left)):c.left<0?c.left=-(t.width-i.minWidth):c.right<0&&(c.right=-(t.width-i.minWidth))),d<0&&(c.top<0&&c.bottom<0?(c.top=-(t.height-i.minHeight)/(c.top/c.bottom),c.bottom=-(t.height-i.minHeight)/(c.bottom/c.top)):c.top<0?c.top=-(t.height-i.minHeight):c.bottom<0&&(c.bottom=-(t.height-i.minHeight)));var f=Uo(Mo(t,c),r),p=So.every((function(e){return!mo(f[(t=e,{left:"right",top:"bottom",right:"left",bottom:"top"}[t])],0)||a[e];var t}));l&&p&&(f.left&&f.left>0&&0===f.right?(c.right+=f.left,c.left-=f.left):f.right&&f.right>0&&0===f.left&&(c.left+=f.right,c.right-=f.right),f.top&&f.top>0&&0===f.bottom?(c.bottom+=f.top,c.top-=f.top):f.bottom&&f.bottom>0&&0===f.top&&(c.top+=f.bottom,c.bottom-=f.bottom),f=Uo(Mo(t,c),r));var h={width:1/0,height:1/0,left:1/0,right:1/0,top:1/0,bottom:1/0};if(So.forEach((function(e){var t=f[e];t&&c[e]&&(h[e]=Math.max(0,1-t/c[e]))})),o){var m=Math.min.apply(Math,So.map((function(e){return h[e]})));m!==1/0&&So.forEach((function(e){c[e]*=m}))}else So.forEach((function(e){h[e]!==1/0&&(c[e]*=h[e])}));if(u=Mo(t,c).width,d=Mo(t,c).height,c.right+c.left&&(u>i.maxWidth?h.width=(i.maxWidth-t.width)/(c.right+c.left):u<i.minWidth&&(h.width=(i.minWidth-t.width)/(c.right+c.left))),c.bottom+c.top&&(d>i.maxHeight?h.height=(i.maxHeight-t.height)/(c.bottom+c.top):d<i.minHeight&&(h.height=(i.minHeight-t.height)/(c.bottom+c.top))),o){var g=Math.min(h.width,h.height);g!==1/0&&So.forEach((function(e){c[e]*=g}))}else h.width!==1/0&&Co.forEach((function(e){c[e]*=h.width})),h.height!==1/0&&To.forEach((function(e){c[e]*=h.height}));return c}function xa(e,t,n){return ho(t+n,0)?e/2:ho(t,0)?0:ho(n,0)?e:e*Math.abs(t/(t+n))}function _a(e,t){var n=t.toLowerCase();return{left:e.left+e.width*(-1!==n.indexOf("west")?1:-1!==n.indexOf("east")?0:.5),top:e.top+e.height*(-1!==n.indexOf("north")?1:-1!==n.indexOf("south")?0:.5)}}function ka(e){var t=e.toLowerCase();return{left:-1===t.indexOf("east"),top:-1===t.indexOf("south"),right:-1===t.indexOf("west"),bottom:-1===t.indexOf("north")}}function Ea(e,t,n,r,i){var o=r.reference,a=function(e,t){var n=e.toLowerCase(),r={left:-1===n.indexOf("west")?t.left:-t.left,top:-t.top,right:t.left,bottom:t.top};["north","south","center"].every((function(e){return-1===n.indexOf(e)}))&&(r.top=0,r.bottom=0),["west","east","center"].every((function(e){return-1===n.indexOf(e)}))&&(r.left=0,r.right=0);var i=ka(e);return So.forEach((function(e){i[e]||(r[e]=0)})),r}(t,n),s=ka(t),l=function(e,t,n,r){var i=r.aspectRatio,o=r.positionRestrictions,a=r.sizeRestrictions,s=st({},e);t=st({},t);var l=n.allowedDirections||{left:!0,right:!0,bottom:!0,top:!0};e.width<a.minWidth&&(t.left=0,t.right=0),e.height<a.minHeight&&(t.top=0,t.bottom=0),So.forEach((function(e){l[e]||(t[e]=0)}));var c=Mo(s,t=wa({coordinates:s,directions:t,sizeRestrictions:a,positionRestrictions:o,allowedDirections:l})).width,u=Mo(s,t).height,d=n.preserveAspectRatio?Ro(s):jo(c/u,i);if(d){var f=n.respectDirection;if("width"!==f&&"height"!==f&&(f=s.width>=s.height||1===d?"width":"height"),"width"===f){var p=c/d-s.height;if(l.top&&l.bottom){var h=t.top,m=t.bottom;t.bottom=xa(p,m,h),t.top=xa(p,h,m)}else l.bottom?t.bottom=p:l.top?t.top=p:l.right?t.right=0:l.left&&(t.left=0)}else if("height"===f){var g=s.width-u*d;if(l.left&&l.right){var v=t.left,y=t.right;t.left=-xa(g,v,y),t.right=-xa(g,y,v)}else l.left?t.left=-g:l.right?t.right=-g:l.top?t.top=0:l.bottom&&(t.bottom=0)}t=wa({directions:t,coordinates:s,sizeRestrictions:a,positionRestrictions:o,preserveRatio:!0,compensate:n.compensate,allowedDirections:l})}return c=Mo(s,t).width,u=Mo(s,t).height,(d=n.preserveAspectRatio?Ro(s):jo(c/u,i))&&mo(Math.abs(d-c/u),0)&&So.forEach((function(e){t[e]=0})),ha({width:e.width+t.right+t.left,height:e.height+t.top+t.bottom,left:e.left,top:e.top},{left:-t.left,top:-t.top},o)}(e,a,st(st({},r),{allowedDirections:s}),i);return o&&(l=Lo(l,Ao(_a(o,t),_a(l,t)))),$o(l,i.positionRestrictions)}function Sa(e,t,n,r,i){var o=function(e){return e.coordinates?Math.min(e.coordinates.width,e.coordinates.height,20*ia(e)):1}(e),a=na(e,t);return Jo(e)?st(st({},da(e)),{coordinates:Ea(e.coordinates,n,r,i,{positionRestrictions:qo(ra(e,t),Io(e.visibleArea)),sizeRestrictions:{maxWidth:Math.min(a.maxWidth,e.visibleArea.width),maxHeight:Math.min(a.maxHeight,e.visibleArea.height),minWidth:Math.max(Math.min(a.minWidth,e.visibleArea.width),o),minHeight:Math.max(Math.min(a.minHeight,e.visibleArea.height),o)},aspectRatio:aa(e,t)})}):e}function Ca(e,t,n){var r=st(st({},da(e)),{boundary:n});if(r.visibleArea&&r.coordinates&&e.visibleArea){r.visibleArea.height=r.visibleArea.width/Ro(n),r.visibleArea.top+=(e.visibleArea.height-r.visibleArea.height)/2;var i=na(r,t);(Math.max(i.minHeight,r.coordinates.height)-r.visibleArea.height>0||Math.max(i.minWidth,r.coordinates.width)-r.visibleArea.width>0)&&(r.visibleArea=Do(r.visibleArea,Math.max(Math.max(i.minHeight,r.coordinates.height)/r.visibleArea.height,Math.max(i.minWidth,r.coordinates.width)/r.visibleArea.width))),r.visibleArea=Fo(r.visibleArea,ea(r,t));var o=No(Go(r.coordinates,Io(r.visibleArea)));r.visibleArea.width<r.coordinates.width&&(o.left=0),r.visibleArea.height<r.coordinates.height&&(o.top=0),r.visibleArea=Lo(r.visibleArea,o),r.visibleArea=$o(r.visibleArea,ta(r,t)),r=ga(r,t)}return r}function Ta(e,t,n){return n.rotate&&(e=function(e,t,n){if(Jo(e)){var r=da(e),i=co(n)?n:n.angle,o=Ho(Oo(st({left:0,top:0},ca(e))),i);r.transforms.rotate+=i,r.coordinates=st(st({},fa({sizeRestrictions:na(r,t),aspectRatio:aa(r,t),width:r.coordinates.width,height:r.coordinates.height})),Ho(Oo(r.coordinates),i));var a=!co(n)&&n.center?n.center:Oo(e.coordinates),s=Ao(Oo(e.coordinates),Ho(Oo(e.coordinates),i,a)),l=ca(r);return r.coordinates.left-=o.left-l.width/2+r.coordinates.width/2-s.left,r.coordinates.top-=o.top-l.height/2+r.coordinates.height/2-s.top,r.visibleArea=Fo(r.visibleArea,Qo(ea(r,t),{minWidth:r.coordinates.width,minHeight:r.coordinates.height})),r.coordinates=$o(r.coordinates,ra(r,t)),r.visibleArea=Lo(r.visibleArea,Ao(Oo(r.coordinates),Oo(e.coordinates))),r.visibleArea=$o(r.visibleArea,ta(r,t)),r}return e}(e,t,n.rotate)),n.flip&&(e=function(e,t,n,r){if(Jo(e)){var i=da(e),o=e.transforms.rotate,a=ca(e),s={horizontal:n,vertical:r};if(s.horizontal||s.vertical){var l=Ho({left:a.width/2,top:a.height/2},-o),c=Ho(Oo(i.coordinates),-o),u=Ho({left:s.horizontal?l.left-(c.left-l.left):c.left,top:s.vertical?l.top-(c.top-l.top):c.top},o);i.coordinates=Lo(i.coordinates,Ao(u,Oo(i.coordinates))),c=Ho(Oo(i.visibleArea),-o),u=Ho({left:s.horizontal?l.left-(c.left-l.left):c.left,top:s.vertical?l.top-(c.top-l.top):c.top},o),i.visibleArea=Lo(i.visibleArea,Ao(u,Oo(i.visibleArea))),i.visibleArea=$o(i.visibleArea,ta(i,t))}return s.horizontal&&(i.transforms.flip.horizontal=!e.transforms.flip.horizontal),s.vertical&&(i.transforms.flip.vertical=!e.transforms.flip.vertical),i}return e}(e,t,n.flip.horizontal,n.flip.vertical)),(n.move||n.scale)&&(e=function(e,t,n){var r,i,o,a=n.scale,s=void 0===a?1:a,l=n.move,c=void 0===l?{}:l;if(Jo(e)){var u=da(e),d=1/(co(s)?s:s.factor),f=co(s)?void 0:s.center,p=!ho(d,1),h=1,m=1;u.visibleArea=Lo(u.visibleArea,{left:c.left||0,top:c.top||0});var g=na(u,t),v=ra(u,t),y=ea(u,t),b={stencil:{minimum:Math.max(g.minWidth?g.minWidth/u.coordinates.width:0,g.minHeight?g.minHeight/u.coordinates.height:0),maximum:Math.min(g.maxWidth?g.maxWidth/u.coordinates.width:1/0,g.maxHeight?g.maxHeight/u.coordinates.height:1/0,Bo(u.coordinates,Vo(v)))},area:{maximum:Bo(u.visibleArea,y),minimum:(i=u.visibleArea,o=y,Math.max(o.minWidth?o.minWidth/i.width:0,o.minHeight?o.minHeight/i.height:0))}};d&&p&&(d<1?(m=Math.max(d,Math.max(b.area.minimum,b.stencil.minimum)))>1&&(m=1):d>1&&(m=Math.min(d,Math.min(b.area.maximum,b.stencil.maximum)))<1&&(m=1)),m&&(u.visibleArea=Do(u.visibleArea,m,f));var w={left:e.coordinates.left-e.visibleArea.left,right:e.visibleArea.width+e.visibleArea.left-(e.coordinates.width+e.coordinates.left),top:e.coordinates.top-e.visibleArea.top,bottom:e.visibleArea.height+e.visibleArea.top-(e.coordinates.height+e.coordinates.top)};return u.visibleArea=$o(u.visibleArea,{left:void 0!==v.left?v.left-w.left*m:void 0,top:void 0!==v.top?v.top-w.top*m:void 0,bottom:void 0!==v.bottom?v.bottom+w.bottom*m:void 0,right:void 0!==v.right?v.right+w.right*m:void 0}),u.visibleArea=$o(u.visibleArea,ta(u,t)),u.coordinates.width=u.coordinates.width*m,u.coordinates.height=u.coordinates.height*m,u.coordinates.left=u.visibleArea.left+w.left*m,u.coordinates.top=u.visibleArea.top+w.top*m,u.coordinates=$o(u.coordinates,qo(Io(u.visibleArea),v)),p&&d&&(null===(r=t.transformImage)||void 0===r?void 0:r.adjustStencil)&&(d>1?h=Math.min(b.area.maximum,d)/m:d<1&&(h=Math.max(u.coordinates.height/u.visibleArea.height,u.coordinates.width/u.visibleArea.width,d/m)),1!==h&&(u.visibleArea=Do(u.visibleArea,h,d>1?f:Oo(u.coordinates)),u.visibleArea=$o(u.visibleArea,ta(u,t)),u.visibleArea=Lo(u.visibleArea,No(Go(u.coordinates,Io(u.visibleArea)))))),u}return e}(e,t,n)),e}function Aa(e,t){if(Jo(e)){var n=da(e),r=aa(e,t),i=na(e,t),o=ea(e,t),a=jo(Ro(e.coordinates),r),s=a?{height:e.coordinates.height,width:e.coordinates.height*a}:e.coordinates;n.coordinates=st(st({},n.coordinates),fa({width:s.width,height:s.height,aspectRatio:r,sizeRestrictions:Qo(o,i)})),n.coordinates=Lo(n.coordinates,Ao(Oo(e.coordinates),Oo(n.coordinates)));var l=Math.max(n.coordinates.width/n.visibleArea.width,n.coordinates.height/n.visibleArea.height,1);return n.visibleArea=st(st({},e.visibleArea),fa({width:e.visibleArea.width*l,height:e.visibleArea.height*l,aspectRatio:{minimum:Ro(n.boundary),maximum:Ro(n.boundary)},sizeRestrictions:o})),n.visibleArea=Lo(n.visibleArea,Ao(Oo(e.visibleArea),Oo(n.visibleArea))),n.visibleArea=$o(n.visibleArea,ta(n,t)),n.coordinates=$o(n.coordinates,qo(Io(n.visibleArea),ra(n,t))),n}return e}function Oa(e,t){var n=ia(e);return e.visibleArea?{left:t.left*n+e.visibleArea.left,top:t.top*n+e.visibleArea.top}:t}function Pa(e,t){if(e){var n=Math.abs(e.transforms.rotate%180);return n<=45||n>=135?t:{horizontal:t.vertical,vertical:t.horizontal}}return t}function Ma(e,t){var n=ia(e);return{left:co(t.left)?t.left*n:0,top:co(t.top)?t.top*n:0}}function Na(e,t){if(e&&t){var n=t();n&&e(n)}}function La(e,t){e.forEach((function(e){Na(e,t)}))}!function(e){e.limit="limit",e.zoom="zoom",e.unsafe="unsafe"}(_o||(_o={})),function(e){e.fillArea="fillArea",e.fitArea="fitArea",e.stencil="stencil",e.none="none"}(ko||(ko={})),function(e){e.coordinates="coordinates",e.visibleArea="visibleArea"}(Eo||(Eo={}));var Ia=function(){var e=this;this.getTransitions=function(){var t=e.getData(),n=e.getProps().transitions;return st(st({},ao(n,{timingFunction:"ease-in-out",duration:350})),{active:t.transitions})},this.getInteractions=function(){return yo(e.getData().interactions)},this.hasInteractions=function(){return Qi(e.getData().interactions)},this.startTransitions=function(){var t=e.getProps(),n=t.onTransitionsStart,r=t.onUpdate,i=t.getInstance,o=e.getData(),a=o.transitions,s=lt(o,["transitions"]);e.setData(st(st({},s),{transitions:!0})),a||La([n,r],i),e.endTransitions()},this.endTransitions=xo((function(){var t=e.getProps(),n=t.onTransitionsEnd,r=t.onUpdate,i=t.getInstance;e.setData(st(st({},e.getData()),{transitions:!1})),La([n,r],i)}),(function(){return e.getTransitions().duration})),this.applyPostProcess=function(t,n){var r,i=e.getProps(),o=i.settings,a=i.postProcess,s=t.name,l=t.interaction,c=void 0!==l&&l,u=t.transitions,d=void 0!==u&&u,f=t.immediately,p={name:s,interaction:c,transitions:d,immediately:void 0!==f&&f};return r=a,Array.isArray(r)?a.reduce((function(e,t){return t(e,o,p)}),n):ro(a)?a(n,o,p):n},this.updateState=function(t,n,r){void 0===n&&(n={}),void 0===r&&(r=[]);var i=n.transitions,o=void 0!==i&&i,a=e.getProps(),s=a.onTransitionsStart,l=a.getInstance,c=a.onChange,u=a.onUpdate,d=a.settings,f=e.getData(),p=ro(t)?t(f.state,d):t,h=p?.001*ia(p):.001,m=!bo(f.state,p,h),g=["coordinates","boundary","visibleArea","imageSize","transforms"].some((function(e){var t;return!bo(null===(t=f.state)||void 0===t?void 0:t[e],null==p?void 0:p[e],h)})),v=f;m&&(o&&g&&e.endTransitions(),v=st(st({},v),{state:da(p),transitions:o&&g}),e.setData(v),Na(c,l)),v.transitions&&!f.transitions&&Na(s,l),La(ft(r,[u]),l)},this.setInteractions=function(t){var n=e.getProps(),r=n.onInteractionStart,i=n.onInteractionEnd,o=n.getInstance,a=e.getInteractions(),s=st(st({},a),t);if(bo(a,s)||e.setData(st(st({},e.getData()),{interactions:s})),Qi(a)!==Qi(s))if(Qi(a)){var l=e.getData().state;e.updateState((function(){return l&&e.applyPostProcess({name:"interactionEnd",immediately:!0,transitions:!0},l)}),{transitions:!0},[i])}else Na(r,o)},this.resetState=function(t,n){e.updateState(e.createDefaultState(t,n))},this.clear=function(){e.updateState(null)},this.reconcileState=function(t){void 0===t&&(t={});var n=e.getProps(),r=n.reconcileStateAlgorithm,i=n.settings,o=e.getData().state,a=t.transitions,s=void 0!==a&&a;if(o&&!ua(o,i)){var l=(r||Aa)(o,i);l=e.applyPostProcess({name:"reconcileState",immediately:!0,transitions:s},l),e.updateState(l,{transitions:s})}},this.transformImage=function(t,n){void 0===n&&(n={});var r=n.transitions,i=void 0===r||r,o=n.interaction,a=void 0===o||o,s=n.immediately,l=void 0!==s&&s,c=n.normalize,u=void 0===c||c,d=e.getProps(),f=d.transformImageAlgorithm,p=d.onTransformImage,h=d.onTransformImageEnd,m=d.settings,g=e.getData().state,v=[];if(g){u&&(t=function(e,t){return t.scale&&(t.scale={factor:co(t.scale)?t.scale:t.scale.factor,center:!co(t.scale)&&t.scale.center?Oa(e,t.scale.center):void 0}),t.rotate&&(t.rotate={angle:co(t.rotate)?t.rotate:t.rotate.angle,center:!co(t.rotate)&&t.rotate.center?Oa(e,t.rotate.center):void 0}),t.move&&(t.move=Ma(e,t.move)),t}(g,t));var y=e.applyPostProcess({name:"transformImage",transitions:i,immediately:l},(f||Ta)(g,m,t));v.push(p),a?e.setInteractions({transformImage:{rotate:!io(t.rotate),flip:!io(t.flip),scale:!io(t.scale),move:!io(t.move)}}):(y=e.applyPostProcess({name:"transformImageEnd",transitions:i,immediately:!0},y),v.push(h)),e.updateState(y,{transitions:l&&i},v)}},this.transformImageEnd=function(t){void 0===t&&(t={});var n=t.immediately,r=void 0===n||n,i=t.transitions,o=void 0===i||i,a=e.getData().state,s=e.getProps().onTransformImageEnd;e.updateState((function(){return a&&e.applyPostProcess({name:"transformImageEnd",immediately:r,transitions:o},a)}),{transitions:o},[s]),e.setInteractions({transformImage:{rotate:!1,flip:!1,scale:!1,move:!1}})},this.zoomImage=function(t,n){void 0===n&&(n={});var r=n.interaction,i=void 0!==r&&r,o=n.immediately,a=void 0===o||o,s=n.transitions,l=void 0===s||s,c=n.normalize,u=void 0!==c&&c;e.transformImage({scale:t},{interaction:i,immediately:a,transitions:l,normalize:u})},this.moveImage=function(t,n,r){void 0===r&&(r={});var i=r.interaction,o=void 0!==i&&i,a=r.immediately,s=void 0===a||a,l=r.transitions,c=void 0===l||l,u=r.normalize,d=void 0!==u&&u;e.transformImage({move:{left:t,top:n}},{interaction:o,immediately:s,transitions:c,normalize:d})},this.flipImage=function(t,n,r){void 0===r&&(r={});var i=r.interaction,o=void 0!==i&&i,a=r.immediately,s=void 0===a||a,l=r.transitions,c=void 0===l||l,u=r.normalize,d=void 0===u||u,f=e.getState(),p={horizontal:t,vertical:n};e.transformImage({flip:f&&d?Pa(f,p):p},{interaction:o,immediately:s,transitions:c})},this.rotateImage=function(t,n){void 0===n&&(n={});var r=n.interaction,i=void 0!==r&&r,o=n.immediately,a=void 0===o||o,s=n.transitions,l=void 0===s||s,c=n.normalize,u=void 0!==c&&c;e.transformImage({rotate:t},{interaction:i,immediately:a,transitions:l,normalize:u})},this.reset=function(t,n){e.resetState(t,n)},this.setState=function(t,n){void 0===n&&(n={});var r=e.getSettings(),i=e.getData().state,o=n.transitions,a=void 0===o||o,s=n.immediately,l=void 0!==s&&s,c=n.interaction,u=void 0!==c&&c,d=n.postprocess,f=void 0!==d&&d,p=t&&(ro(t)?t(i,r):st(st({},i),t));e.updateState((function(){return f?p&&e.applyPostProcess({name:"setState",immediately:l,transitions:a,interaction:u},p):p}),{transitions:a})},this.setCoordinates=function(t,n){void 0===n&&(n={});var r=e.getData().state,i=e.getProps(),o=i.setCoordinatesAlgorithm,a=i.settings,s=n.transitions,l=void 0===s||s,c=n.immediately,u=void 0===c||c;e.updateState((function(){return r&&e.applyPostProcess({name:"setCoordinates",immediately:u,transitions:l},(o||ma)(r,a,t,_o.zoom))}),{transitions:l})},this.setVisibleArea=function(t,n){void 0===n&&(n={});var r=n.transitions,i=void 0===r||r,o=n.immediately,a=void 0===o||o,s=e.getData().state,l=e.getProps(),c=l.setVisibleAreaAlgorithm,u=l.settings;e.updateState((function(){return s&&e.applyPostProcess({name:"setVisibleArea",immediately:a,transitions:i},(c||va)(s,u,t))}),{transitions:i})},this.setBoundary=function(t,n){void 0===n&&(n={});var r=e.getData().state,i=e.getProps(),o=i.setBoundaryAlgorithm,a=i.settings,s=n.transitions,l=void 0!==s&&s,c=n.immediately,u=void 0===c||c;t?e.updateState((function(){return r&&e.applyPostProcess({name:"setBoundary",immediately:u,transitions:l},(o||Ca)(r,a,t))})):e.updateState(null)},this.moveCoordinates=function(t,n){void 0===n&&(n={});var r=e.getData(),i=e.getProps(),o=i.moveCoordinatesAlgorithm,a=i.onMove,s=i.onMoveEnd,l=i.settings,c=n.interaction,u=void 0===c||c,d=n.transitions,f=void 0!==d&&d,p=n.immediately,h=void 0!==p&&p,m=n.normalize,g=void 0===m||m,v=[];if(!r.transitions&&r.state){var y=g?Ma(r.state,t):function(e){return{left:co(e.left)?e.left:0,top:co(e.top)?e.top:0}}(t),b=e.applyPostProcess({name:"moveCoordinates",interaction:u,immediately:h,transitions:f},(o||ba)(r.state,l,y));v.push(a),u?e.setInteractions({moveCoordinates:!0}):(b=e.applyPostProcess({name:"moveCoordinatesEnd",interaction:u,immediately:h,transitions:f},b),v.push(s)),e.updateState(b,{transitions:h&&f},v)}},this.moveCoordinatesEnd=function(t){void 0===t&&(t={});var n=e.getData().state,r=e.getProps().onMoveEnd,i=t.transitions,o=void 0===i||i,a=t.immediately,s=void 0!==a&&a;e.updateState((function(){return n&&e.applyPostProcess({name:"moveCoordinatesEnd",transitions:o,immediately:s},n)}),{transitions:o},[r]),e.setInteractions({moveCoordinates:!1})},this.resizeCoordinates=function(t,n,r,i){void 0===i&&(i={});var o=e.getData().state,a=e.getProps(),s=a.resizeCoordinatesAlgorithm,l=a.onResize,c=a.onResizeEnd,u=a.settings,d=i.interaction,f=void 0===d||d,p=i.transitions,h=void 0!==p&&p,m=i.immediately,g=void 0!==m&&m,v=i.normalize,y=void 0===v||v;if(!e.getTransitions().active&&o){var b=[],w=y?function(e,t){var n=ia(e);return{left:co(t.left)?t.left*n:0,top:co(t.top)?t.top*n:0,right:co(t.right)?t.right*n:0,bottom:co(t.bottom)?t.bottom*n:0}}(o,n):function(e){return{left:co(e.left)?e.left:0,top:co(e.top)?e.top:0,right:co(e.right)?e.right:0,bottom:co(e.bottom)?e.bottom:0}}(n),x=e.applyPostProcess({name:"resizeCoordinates",interaction:f,immediately:g,transitions:h},(s||Sa)(o,u,t,w,oo(r)?r:{}));b.push(l),f?e.setInteractions({resizeCoordinates:!0}):(x=e.applyPostProcess({name:"resizeCoordinatesEnd",interaction:f,immediately:g,transitions:h},x),b.push(c)),e.updateState(x,{transitions:g&&h},b)}},this.resizeCoordinatesEnd=function(t){void 0===t&&(t={});var n=e.getProps().onResizeEnd,r=e.getData().state,i=t.transitions,o=void 0===i||i,a=t.immediately,s=void 0!==a&&a;e.updateState((function(){return r&&e.applyPostProcess({name:"resizeCoordinatesEnd",transitions:o,immediately:s},r)}),{transitions:o},[n]),e.setInteractions({resizeCoordinates:!1})},this.getStencilCoordinates=function(){return oa(e.getData().state)},this.getCoordinates=function(t){void 0===t&&(t={});var n=e.getData().state,r=e.getProps().settings;if(n&&n.coordinates){var i=t.round;return void 0===i||i?function(e,t){if(Jo(e)){var n=na(e,t),r=ra(e,t),i={width:Math.round(e.coordinates.width),height:Math.round(e.coordinates.height),left:Math.round(e.coordinates.left),top:Math.round(e.coordinates.top)};return i.width>n.maxWidth?i.width=Math.floor(e.coordinates.width):i.width<n.minWidth&&(i.width=Math.ceil(e.coordinates.width)),i.height>n.maxHeight?i.height=Math.floor(e.coordinates.height):i.height<n.minHeight&&(i.height=Math.ceil(e.coordinates.height)),$o(i,r)}return null}(n,r):st({},n.coordinates)}return null},this.getVisibleArea=function(){var t=e.getData().state;return(null==t?void 0:t.visibleArea)?st({},t.visibleArea):null},this.getSettings=function(){var t=e.getProps().settings;return st({},t)},this.getState=function(){return da(e.getData().state)},this.getTransforms=function(){var t=e.getData().state;return t?yo(t.transforms):{rotate:0,flip:{horizontal:!1,vertical:!1}}},this.createDefaultState=function(t,n){var r=e.getProps(),i=r.createStateAlgorithm,o=r.settings;return e.applyPostProcess({name:"createState",immediately:!0,transitions:!1},(i||ya)({image:n,boundary:t},o))},this.isConsistent=function(){var t=e.getData().state,n=e.getProps().settings;return!t||ua(t,n)}};function Da(e,t){var n,r=e.imageSize,i=e.visibleArea,o=na(e,t),a=aa(e,t);if(i)n=i;else{var s=Vo(ra(e,t));n={width:Math.max(s.minWidth,Math.min(s.maxWidth,r.width)),height:Math.max(s.minHeight,Math.min(s.maxHeight,r.height))}}var l=Math.min(a.maximum||1/0,Math.max(a.minimum||0,Ro(n))),c=n.width<n.height?{width:.8*n.width,height:.8*n.width/l}:{height:.8*n.height,width:.8*n.height*l};return fa(st(st({},c),{aspectRatio:a,sizeRestrictions:o}))}function Ra(e,t){return function(e){return{minWidth:fo(e.minWidth)?so(e.minWidth):0,minHeight:fo(e.minHeight)?so(e.minHeight):0,maxWidth:fo(e.maxWidth)?so(e.maxWidth):1/0,maxHeight:fo(e.maxHeight)?so(e.maxHeight):1/0}}(t)}function Ba(e){var t=e.visibleArea,n=e.coordinates,r=t||ca(e);return{left:(t?t.left:0)+r.width/2-(n?n.width/2:0),top:(t?t.top:0)+r.height/2-(n?n.height/2:0)}}function ja(e){return function(t,n){var r=ro(e)?e(t,n):e;return Qo(Ra(0,n),r)}}function za(e){return st(st({},e),{sizeRestrictions:function(t,n){return e.sizeRestrictions?ro(e.sizeRestrictions)?e.sizeRestrictions(t,n):e.sizeRestrictions:Ra(0,n)},areaPositionRestrictions:function(t,n){return e.areaPositionRestrictions?ro(e.areaPositionRestrictions)?e.areaPositionRestrictions(t,n):e.areaPositionRestrictions:function(e,t){var n=e.visibleArea,r=e.boundary,i=t.imageRestriction,o=ca(e),a={};return i===ko.fillArea?a={left:0,top:0,right:o.width,bottom:o.height}:i===ko.fitArea&&(Ro(r)>Ro(o)?(a={top:0,bottom:o.height},n&&(n.width>o.width?(a.left=-(n.width-o.width)/2,a.right=o.width-a.left):(a.left=0,a.right=o.width))):(a={left:0,right:o.width},n&&(n.height>o.height?(a.top=-(n.height-o.height)/2,a.bottom=o.height-a.top):(a.top=0,a.bottom=o.height)))),a}(t,n)},areaSizeRestrictions:function(t,n){return e.areaSizeRestrictions?ro(e.areaSizeRestrictions)?e.areaSizeRestrictions(t,n):e.areaSizeRestrictions:function(e,t){var n=e.boundary,r=t.imageRestriction,i=ca(e),o={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0};return r===ko.fillArea?(o.maxWidth=i.width,o.maxHeight=i.height):r===ko.fitArea&&(Ro(n)>Ro(i)?(o.maxHeight=i.height,o.maxWidth=i.height*Ro(n)):(o.maxWidth=i.width,o.maxHeight=i.width/Ro(n))),o}(t,n)},positionRestrictions:function(t,n){return e.positionRestrictions?ro(e.positionRestrictions)?e.positionRestrictions(t,n):e.positionRestrictions:function(e,t){var n=ca(e),r={};return t.imageRestriction&&"none"!==t.imageRestriction&&(r={left:0,top:0,right:n.width,bottom:n.height}),r}(t,n)},defaultCoordinates:function(t,n){if(e.defaultCoordinates)return ro(e.defaultCoordinates)?e.defaultCoordinates(t,n):e.defaultCoordinates;var r=e.defaultSize;r||(r=Da);var i=ro(r)?r(t,n):r,o=e.defaultPosition||Ba;return[i,function(e){return st({},ro(o)?o(e,n):o)}]},defaultVisibleArea:function(t,n){return e.defaultVisibleArea?ro(e.defaultVisibleArea)?e.defaultVisibleArea(t,n):e.defaultVisibleArea:function(e,t){var n=e.coordinates,r=e.boundary,i=ca(e),o=Ro(r);if(n){var a={height:Math.max(n.height,i.height),width:Math.max(n.width,i.width)},s={left:0,top:0,width:Ro(a)>o?a.width:a.height*o,height:Ro(a)>o?a.width/o:a.height};(s=Fo(s,ea(e,t))).left=n.left+n.width/2-s.width/2,s.top=n.top+n.height/2-s.height/2;var l=Uo(n,Io(st({left:0,top:0},i))),c={};return!l.left&&!l.right&&s.width<=i.width&&(c.left=0,c.right=i.width),!l.top&&!l.bottom&&s.height<=i.height&&(c.top=0,c.bottom=i.height),$o(s,c)}var u=Ro(i),d={height:u<o?i.height:i.width/o,width:u<o?i.height*o:i.width};return{left:i.width/2-d.width/2,top:i.height/2-d.height/2,width:d.width,height:d.height}}(t,n)},aspectRatio:function(t,n){return Zo(ro(e.aspectRatio)?e.aspectRatio(t,n):e.aspectRatio)}})}var Ua=4;function Fa(e){return new Promise((function(t,n){try{if(e)if(/^data:/i.test(e))t(function(e){e=e.replace(/^data:([^;]+);base64,/gim,"");for(var t=atob(e),n=t.length,r=new ArrayBuffer(n),i=new Uint8Array(r),o=0;o<n;o++)i[o]=t.charCodeAt(o);return r}(e));else if(/^blob:/i.test(e)){var r=new FileReader;r.onload=function(e){var n;t(null===(n=e.target)||void 0===n?void 0:n.result)},o=e,a=function(e){r.readAsArrayBuffer(e)},(s=new XMLHttpRequest).open("GET",o,!0),s.responseType="blob",s.onload=function(){200!=this.status&&0!==this.status||a(this.response)},s.send()}else{var i=new XMLHttpRequest;i.onreadystatechange=function(){i.readyState===Ua&&(200===i.status||0===i.status?t(i.response):n("Warning: could not load an image to parse its orientation"))},i.onprogress=function(){"image/jpeg"!==i.getResponseHeader("content-type")&&i.abort()},i.withCredentials=!1,i.open("GET",e,!0),i.responseType="arraybuffer",i.send(null)}else n("Error: the image is empty")}catch(e){n(e)}var o,a,s}))}function Wa(e){var t=e.rotate,n=void 0===t?0:t,r=e.flip,i=void 0===r?{horizontal:!1,vertical:!1}:r,o=e.scale,a=void 0===o?1:o;return" rotate("+n+"deg) scaleX("+a*(i.horizontal?-1:1)+") scaleY("+a*(i.vertical?-1:1)+")"}function Ha(e){try{var t,n=new DataView(e),r=void 0,i=void 0,o=void 0,a=void 0;if(255===n.getUint8(0)&&216===n.getUint8(1))for(var s=n.byteLength,l=2;l+1<s;){if(255===n.getUint8(l)&&225===n.getUint8(l+1)){o=l;break}l++}if(o&&(r=o+10,"Exif"===function(e,t,n){var r,i="";for(r=t,n+=t;r<n;r++)i+=String.fromCharCode(e.getUint8(r));return i}(n,o+4,4))){var c=n.getUint16(r);if(((i=18761===c)||19789===c)&&42===n.getUint16(r+2,i)){var u=n.getUint32(r+4,i);u>=8&&(a=r+u)}}if(a)for(var d=n.getUint16(a,i),f=0;f<d;f++){l=a+12*f+2;if(274===n.getUint16(l,i)){l+=8,t=n.getUint16(l,i),n.setUint16(l,1,i);break}}return t}catch(e){return null}}function Va(e){var t=e.src,n=e.arrayBuffer,r=void 0===n?null:n,i=e.orientation,o=void 0===i?null:i,a={src:t,arrayBuffer:r,revoke:!1,transforms:{flip:{horizontal:!1,vertical:!1},rotate:0}};return r&&o&&o>1?eo(t)||!to(t)?(a.src=URL.createObjectURL(new Blob([r])),a.revoke=!0):a.src=function(e){for(var t=[],n=new Uint8Array(e);n.length>0;){var r=n.subarray(0,8192);t.push(String.fromCharCode.apply(null,Array.from?Array.from(r):r.slice())),n=n.subarray(8192)}return"data:image/jpeg;base64,"+btoa(t.join(""))}(r):a.src=t,o&&(a.transforms=function(e){var t={flip:{horizontal:!1,vertical:!1},rotate:0};if(e)switch(e){case 2:t.flip.horizontal=!0;break;case 3:t.rotate=-180;break;case 4:t.flip.vertical=!0;break;case 5:t.rotate=90,t.flip.vertical=!0;break;case 6:t.rotate=90;break;case 7:t.rotate=90,t.flip.horizontal=!0;break;case 8:t.rotate=-90}return t}(o)),a}function qa(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});var n=t.checkOrientation,r=t.parse;return new Promise((function(t){n||r?Fa(e).then((function(n){var r=Ha(n);t(Va(n?{src:e,arrayBuffer:n,orientation:r}:{src:e,arrayBuffer:null,orientation:null}))})).catch((function(n){console.warn(n),t(Va({src:e}))})):t(Va({src:e}))}))}(e,st(st({},t),{crossOrigin:no(e)&&t.crossOrigin})).then((function(e){return new Promise((function(n,r){(function(e,t){return void 0===t&&(t={}),new Promise((function(n,r){var i=document.createElement("img");t.crossOrigin&&(i.crossOrigin=!0!==t.crossOrigin?t.crossOrigin:"anonymous"),i.src=e,i.style.visibility="hidden",i.style.position="fixed",document.body.appendChild(i),i.complete?(n(i),document.body.removeChild(i)):(i.addEventListener("load",(function(){n(i),document.body.removeChild(i)})),i.addEventListener("error",(function(){r(null),document.body.removeChild(i)})))}))})(e.src,t).then((function(t){n(st(st({},e),{width:t.naturalWidth,height:t.naturalHeight}))})).catch((function(){r(null)}))}))}))}function Ga(e,t,n,r,i){void 0===i&&(i=null);var o=e.width>e.height?{width:Math.min(512,e.width),height:Math.min(512,e.width)/(e.width/e.height)}:{height:Math.min(512,e.height),width:Math.min(512,e.height)*(e.width/e.height)},a=ca(t),s={rotate:t.transforms.rotate,flip:{horizontal:t.transforms.flip.horizontal,vertical:t.transforms.flip.vertical},translateX:n.left/r,translateY:n.top/r,scale:1/r},l={left:(o.width-a.width)/(2*r),top:(o.height-a.height)/(2*r)},c={left:(1-1/r)*o.width/2,top:(1-1/r)*o.height/2},u=st(st({},s),{scale:s.scale*(e.width/o.width)}),d={width:o.width+"px",height:o.height+"px",left:"0px",top:"0px",transition:"none",transform:"translate3d("+(-l.left-c.left-s.translateX)+"px, "+(-l.top-c.top-s.translateY)+"px, 0px)"+Wa(u),willChange:"none"};return i&&i.active&&(d.willChange="transform",d.transition=i.duration+"ms "+i.timingFunction),d}function $a(e,t,n){t.style.width="0px",t.style.height="0px",t.style.width=Math.max(e.clientWidth,n.width)+"px";var r=n.width/n.height;t.style.height=Math.max(e.clientHeight,t.clientWidth/r)+"px",t.style.width=t.clientHeight*r+"px"}function Za(e,t,n){t.style.width="0px",t.style.height="0px",t.style.width=Math.max(e.getBoundingClientRect().width,n.width)+"px";var r=n.width/n.height;t.style.height=Math.max(e.getBoundingClientRect().height,t.getBoundingClientRect().width/r)+"px",t.style.width=t.getBoundingClientRect().height*r+"px",t.clientWidth/t.clientHeight>e.clientWidth/e.clientHeight?t.clientWidth>e.clientWidth&&(t.style.width=e.clientWidth+"px",t.style.height=e.clientWidth/r+"px"):t.clientHeight>e.clientHeight&&(t.style.height=e.clientHeight+"px",t.style.width=e.clientHeight*r+"px")}function Ya(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Xa(e,t,n,r,i){if(Jo(e)){var o=e.transforms,a=e.coordinates,s=0!==o.rotate||o.flip.horizontal||o.flip.vertical?function(e,t,n){var r=n.rotate,i=n.flip,o={width:"naturalWidth"in t?t.naturalWidth:t.width,height:"naturalHeight"in t?t.naturalHeight:t.height},a=Wo(o,r),s=e.getContext("2d");if(e.height=a.height,e.width=a.width,s){s.save();var l=Ho(Oo(st({left:0,top:0},o)),r);s.translate(-(l.left-a.width/2),-(l.top-a.height/2)),s.rotate(r*Math.PI/180),s.translate(i.horizontal?o.width:0,i.vertical?o.height:0),s.scale(i.horizontal?-1:1,i.vertical?-1:1),s.drawImage(t,0,0,o.width,o.height),s.restore()}return e}(r,t,o):t,l=st({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,maxArea:1/0,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",fillColor:"transparent"},i),c=function(e){return e.find((function(e){return fo(e)}))},u=fa({sizeRestrictions:{minWidth:c([l.width,l.minWidth])||0,minHeight:c([l.height,l.minHeight])||0,maxWidth:c([l.width,l.maxWidth])||1/0,maxHeight:c([l.height,l.maxHeight])||1/0},width:a.width,height:a.height,aspectRatio:{minimum:a.width/a.height,maximum:a.width/a.height}});if(l.maxArea&&u.width*u.height>l.maxArea){var d=Math.sqrt(l.maxArea/(u.width*u.height));u={width:Math.round(d*u.width),height:Math.round(d*u.height)}}return function(e,t,n,r,i){e.width=r?r.width:n.width,e.height=r?r.height:n.height;var o=e.getContext("2d");if(o){o.clearRect(0,0,e.width,e.height),i&&(i.imageSmoothingEnabled&&(o.imageSmoothingEnabled=i.imageSmoothingEnabled),i.imageSmoothingQuality&&(o.imageSmoothingQuality=i.imageSmoothingQuality),i.fillColor&&(o.fillStyle=i.fillColor,o.fillRect(0,0,e.width,e.height),o.save()));var a=n.left<0?-n.left:0,s=n.top<0?-n.top:0;o.drawImage(t,n.left+a,n.top+s,n.width,n.height,a,s,e.width,e.height)}return e}(n,s,a,u,l)}return null}var Ka={linear:function(e){return e},"ease-in":function(e){return Math.pow(e,1.675)},"ease-out":function(e){return 1-Math.pow(1-e,1.675)},"ease-in-out":function(e){return.5*(Math.sin((e-.5)*Math.PI)+1)}},Qa=function(){function e(){this.active=!1}return e.prototype.start=function(e){var t;this.onStart=e.onStart,this.onProgress=e.onProgress,this.onStop=e.onStop,this.active||null===(t=this.onStart)||void 0===t||t.call(this),this.id&&window.cancelAnimationFrame(this.id),this.startTime=performance.now(),this.timingFunction=e.timingFunction,this.endTime=this.startTime+e.duration,this.active=!0,this.animate()},e.prototype.animate=function(){var e=this;if(this.startTime&&this.endTime){var t=Ka[this.timingFunction];t||(t=Ka["ease-out"]);var n=1-(this.endTime-performance.now())/(this.endTime-this.startTime),r=Math.min(1,t(n));this.onProgress&&this.onProgress(r),n<1?this.id=window.requestAnimationFrame((function(){return e.animate()})):this.stop()}else this.stop()},e.prototype.stop=function(){this.active=!1,this.id&&window.cancelAnimationFrame(this.id),this.onStop&&this.onStop()},e}();function Ja(e,t){var n=t.getBoundingClientRect(),r=n.left,i=n.top,o={left:0,top:0},a=0;return e.forEach((function(t){o.left+=(t.clientX-r)/e.length,o.top+=(t.clientY-i)/e.length})),e.forEach((function(e){a+=po({left:o.left,top:o.top},{left:e.clientX-r,top:e.clientY-i})})),{centerMass:o,spread:a,count:e.length}}function es(e,t,n){void 0===n&&(n=.1);var r,i,o=t.getBoundingClientRect(),a=o.left,s=o.top;return{scale:{factor:1-n*(r=e.deltaY||e.detail||e.wheelDelta,0===(i=+r)||uo(i)?i:i>0?1:-1),center:{left:e.clientX-a,top:e.clientY-s}}}}function ts(e,t){return e.aspectRatio?{}:{aspectRatio:Zo(ro(t.aspectRatio)?t.aspectRatio():t.aspectRatio)}}var ns=i(4184),rs=i.n(ns);function is(e,t){var n=ts({},t);return{stencilSize:function(t,r){var i,o,a=ro(e.stencilSize)?e.stencilSize(t,r):e.stencilSize;return fa(st(st({},a),{aspectRatio:(i=n.aspectRatio,o=Zo(Ro(a)),o?i?{minimum:Math.min(i.maximum,Math.max(i.minimum,o.minimum)),maximum:Math.max(i.minimum,Math.min(i.maximum,o.maximum))}:o:i)}))}}}function os(e,t){var n=e.boundary,r=ro(t.stencilSize)?t.stencilSize(e,t):t.stencilSize;return(r.width>n.width||r.height>n.height)&&(r=fa({sizeRestrictions:{maxWidth:n.width,maxHeight:n.height,minWidth:0,minHeight:0},width:r.width,height:r.height,aspectRatio:{minimum:Ro(r),maximum:Ro(r)}})),r}function as(e,t){var n=os(e,st(st({},t),{stencilSize:t.stencilSize})),r=ea(e,t);return{maxWidth:r.maxWidth*n.width/e.boundary.width,maxHeight:r.maxHeight*n.height/e.boundary.height,minWidth:0,minHeight:0}}function ss(e,t){var n,r,i=e.imageSize,o=e.visibleArea,a=e.boundary,s=na(e,t),l=aa(e,t),c=ro(t.stencilSize)?t.stencilSize(e,t):t.stencilSize,u=o||i;return Ro(u)>Ro(a)?r=(n=c.height*u.height/a.height)*Ro(c):n=(r=c.width*u.width/a.width)/Ro(c),fa({width:r,height:n,aspectRatio:l,sizeRestrictions:s})}function ls(e,t){var n=Ro(os(e,t));return{minimum:n,maximum:n}}function cs(e,t,n){return n&&n.immediately?function(e,t){if(Jo(e)){var n=da(e),r=os(e,t);n.visibleArea=Do(n.visibleArea,n.coordinates.width*n.boundary.width/(n.visibleArea.width*r.width));var i=zo(n.visibleArea,ea(n,t));return 1!==i&&(n.visibleArea=Do(n.visibleArea,i),n.coordinates=Do(n.coordinates,i)),n.visibleArea=Lo(n.visibleArea,Ao(Oo(n.coordinates),Oo(n.visibleArea))),n.visibleArea=$o(n.visibleArea,ta(n,t)),n.coordinates=$o(n.coordinates,qo(Io(n.visibleArea),ta(n,t))),n}return e}(e,t):e}function us(e,t,n){return n.immediately?function(e,t){if(Jo(e)){var n=da(e),r={width:0,height:0};Ro(n.boundary)>Ro(n.coordinates)?(r.height=.8*n.boundary.height,r.width=r.height*Ro(n.coordinates)):(r.width=.8*n.boundary.width,r.height=r.width*Ro(n.coordinates)),n.visibleArea=Do(n.visibleArea,n.coordinates.width*n.boundary.width/(n.visibleArea.width*r.width));var i=zo(n.visibleArea,ea(n,t));return n.visibleArea=Do(n.visibleArea,i),1!==i&&(r.height/=i,r.width/=i),n.visibleArea=Lo(n.visibleArea,Ao(Oo(n.coordinates),Oo(n.visibleArea))),n.visibleArea=$o(n.visibleArea,ta(n,t)),n.coordinates=$o(n.coordinates,qo(Io(n.visibleArea),ra(n,t))),n}return e}(e,t):e}function ds(){var t=(0,e.useRef)([]);return function(e){-1===t.current.indexOf(e)&&t.current.push(e)}}var fs=function(t,n){var r,i=(r=(0,e.useRef)(!0)).current?(r.current=!1,!0):r.current;(0,e.useEffect)((function(){if(!i)return t()}),n)};var ps=function(e){function t(t,n){var r=e.call(this)||this;return r.props=t,r.notify=n,r.data={state:null,transitions:!1,interactions:{moveCoordinates:!1,resizeCoordinates:!1,transformImage:{rotate:!1,move:!1,scale:!1,flip:!1}}},r}return at(t,e),t.prototype.getProps=function(){return this.props()},t.prototype.setData=function(e){this.data=e,this.notify()},t.prototype.getData=function(){return this.data},t}(Ia);function hs(){var t=dt((0,e.useState)({}),2);t[0];var n=t[1];return function(){n({})}}function ms(t){var n=hs(),r=function(t){var n=(0,e.useRef)(t);return n.current=t,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.current.apply(n,pt([],dt(e),!1))}}((function(){var e=t(),n=e.settings,r=lt(e,["settings"]),i=st({imageRestriction:ko.fitArea,transformImage:{adjustStencil:!0}},n),o=st({transitions:!0},r);return st({settings:st(st({},i),za(i))},o)}));return(0,e.useRef)(new ps(r,n)).current}var gs=function(t){var n=(0,e.useRef)(t),r=function(){n.current&&n.current()};(0,e.useEffect)((function(){n.current=t}),[t]),(0,e.useEffect)((function(){return window.addEventListener("resize",r),window.addEventListener("orientationchange",r),function(){window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r)}}),[])};function vs(t){var n=this,r=t(),i=r.src,o=r.onReady,a=r.onError,s=r.onUpdate,l=r.canvas,c=void 0===l||l,u=r.unloadTime,d=void 0===u?500:u,f=r.crossOrigin,p=void 0===f||f,h=r.checkOrientation,m=void 0===h||h,g=r.autoReconcileState,v=void 0===g||g,y=(0,e.useRef)(null),b=(0,e.useRef)(null),w=(0,e.useRef)(null),x=(0,e.useRef)(null),_=dt(function(t){var n=dt((0,e.useState)(t),2),r=n[0],i=n[1],o=dt((0,e.useState)(null),2),a=o[0],s=o[1],l=(0,e.useRef)(t);return fs((function(){a&&a(r,l.current)}),[a]),[r,function(e,t){l.current=r,i(e),s((function(){return t}))}]}(null),2),k=_[0],E=_[1],S=ms((function(){return st(st({},t()),{getInstance:function(){return x.current}})})),C=function(t){var n=t.src,r=t.onLoadingStart,i=t.onLoadingEnd,o=t.onError,a=t.onLoad,s=t.crossOrigin,l=t.checkOrientation,c=t.canvas,u=t.unloadTime,d=dt((0,e.useState)(!1),2),f=d[0],p=d[1],h=dt((0,e.useState)(!1),2),m=h[0],g=h[1],v=dt((0,e.useState)(null),2),y=v[0],b=v[1],w=(0,e.useRef)(null);return(0,e.useEffect)((function(){if(w.current!==n)if(w.current=n||null,g(!1),n){p(!0),null==r||r();var e=[qa(n,{crossOrigin:io(s)?c:s,checkOrientation:l})];m&&u&&e.push(vo(u)),Promise.all(e).then((function(e){var t=dt(e,1)[0];w.current===n&&(b(t),null==a||a(t))})).catch((function(){w.current===n&&(null==o||o())})).finally((function(){w.current===n&&(null==i||i(),p(!1))}))}else u?vo(u).then((function(){b(null)})):b(null)}),[n]),(0,e.useEffect)((function(){y&&g(!0)}),[y]),{isLoading:function(){return f},isLoaded:function(){return m},getImage:function(){return y},setImage:b}}({src:i,crossOrigin:p,checkOrientation:m,unloadTime:d,canvas:c,onLoad:function(){x.current&&(null==o||o(x.current))},onError:function(){x.current&&(null==a||a(x.current))}}),T=function(t,n){void 0===n&&(n=!0);var r=dt((0,e.useState)(n),2),i=r[0],o=r[1];return(0,e.useLayoutEffect)((function(){i&&!t.hasInteractions()&&t.reconcileState()})),{pause:function(){o(!1)},resume:function(){o(!0)}}}(S,v),A=function(){return ct(n,void 0,void 0,(function(){var e,t,n;return ut(this,(function(r){switch(r.label){case 0:return b.current?(T.pause(),e=C.getImage(),[4,null===(n=b.current)||void 0===n?void 0:n.stretchTo(e)]):[3,2];case 1:t=r.sent(),E(e,(function(){t&&e?S.reset(t,e):S.clear()})),T.resume(),r.label=2;case 2:return[2]}}))}))},O=function(){return ct(n,void 0,void 0,(function(){var e,t,n,r;return ut(this,(function(i){switch(i.label){case 0:return b.current?(T.pause(),e=C.getImage(),[4,null===(r=b.current)||void 0===r?void 0:r.stretchTo(e)]):[3,2];case 1:(t=i.sent())&&e?(n=S.getState())?t.width===n.boundary.width&&t.height===n.boundary.height||(S.setBoundary(t),S.reconcileState()):S.reset(t,e):S.clear(),T.resume(),i.label=2;case 2:return[2]}}))}))},P={reset:function(){return A()},refresh:function(){return O()},setImage:function(e){return E(e)},reconcileState:S.reconcileState,moveCoordinates:S.moveCoordinates,moveCoordinatesEnd:S.moveCoordinatesEnd,resizeCoordinates:S.resizeCoordinates,clear:S.clear,resizeCoordinatesEnd:S.resizeCoordinatesEnd,moveImage:S.moveImage,flipImage:S.flipImage,zoomImage:S.zoomImage,rotateImage:S.rotateImage,transformImage:S.transformImage,transformImageEnd:S.transformImageEnd,setCoordinates:S.setCoordinates,setVisibleArea:S.setVisibleArea,startTransitions:S.startTransitions,setState:S.setState,hasInteractions:S.hasInteractions,getStencilCoordinates:S.getStencilCoordinates,getCoordinates:S.getCoordinates,getVisibleArea:S.getVisibleArea,getTransforms:S.getTransforms,getTransitions:S.getTransitions,getInteractions:S.getInteractions,getSettings:S.getSettings,getState:S.getState,getDefaultState:function(){var e=S.getState(),t=C.getImage();return e&&t?S.createDefaultState(e.boundary,t):null},getCanvas:function(e){var t=S.getState();return y.current&&w.current&&t?w.current.draw(t,y.current,e):null},getImage:function(){return k?st({},k):null},isLoading:C.isLoading,isLoaded:C.isLoaded};return gs((function(){O()})),fs((function(){A()}),[C.getImage()]),fs((function(){x.current&&(null==s||s(x.current))}),[C.isLoaded(),C.isLoading()]),(0,e.useImperativeHandle)(x,(function(){return P})),{cropper:P,refs:{image:y,boundary:b,canvas:w},image:k}}var ys=(0,e.forwardRef)((function(t,n){var r=t.className,i=t.style,o=t.stretcherClassName,a=t.contentClassName,s=t.stretchAlgorithm,l=void 0===s?$a:s,c=t.sizeAlgorithm,u=void 0===c?Ya:c,d=t.children,f=(0,e.useRef)(null),p=(0,e.useRef)(null);return(0,e.useImperativeHandle)(n,(function(){return{reset:function(){var e=f.current;e&&(e.style.height="",e.style.width="")},stretchTo:function(e){var t=f.current,n=p.current;if((null==e?void 0:e.width)&&(null==e?void 0:e.height)&&t&&n){l(n,t,e);var r=u(n,e);return Promise.resolve(r.width&&r.height?r:null)}return t&&(t.style.height="",t.style.width=""),Promise.resolve(null)}}})),e.createElement("div",{ref:p,style:i,className:rs()("advanced-cropper-boundary",r)},e.createElement("div",{ref:f,className:rs()(["advanced-cropper-boundary__stretcher",o])}),e.createElement("div",{className:rs()(["advanced-cropper-boundary__content",a])},d))}));ys.displayName="StretchableBoundary";var bs=function(t){var n=t.visible,r=t.className,i=t.style,o=t.children;return e.createElement("div",{style:i,className:rs()(r,"advanced-cropper-fade",Boolean(n)&&"advanced-cropper-fade--visible")},o)},ws=function(t){var n=t.cropper,r=t.children,i=t.className,o=t.style,a=n?n.getState():null,s=!!n&&n.isLoaded();return e.createElement("div",{className:rs()(i,"advanced-cropper-wrapper"),style:o},e.createElement(bs,{visible:a&&s,className:"advanced-cropper-wrapper__fade"},r))};function xs(e){e.preventDefault()}var _s=(0,e.forwardRef)((function(t,n){var r=t.className,i=t.style,o=t.cropper,a=t.crossOrigin,s=void 0===a||a,l=o.getState(),c=o.getTransitions(),u=o.getImage(),d=u&&l?function(e,t,n){return void 0===n&&(n=null),e&&t&&t.visibleArea?Ga(e,t,t.visibleArea,ia(t),n):{}}(u,l,c):{},f=u?u.src:void 0;return f?e.createElement("img",{key:f,ref:n,className:rs()("advanced-cropper-background-image",r),src:f,crossOrigin:!0===s?"anonymous":s||void 0,style:st(st({},d),i),onMouseDown:xs}):null}));_s.displayName="CropperBackgroundImage";var ks=(0,e.forwardRef)((function(t,n){var r=(0,e.useRef)(null),i=(0,e.useRef)(null);return(0,e.useImperativeHandle)(n,(function(){return{draw:function(e,t,n){return void 0===n&&(n={}),t&&r.current&&i.current?Xa(e,t,r.current,i.current,n):null}}})),e.createElement(e.Fragment,null,e.createElement("canvas",{className:"advanced-cropper-canvas",ref:r}),e.createElement("canvas",{className:"advanced-cropper-canvas",ref:i}))}));ks.displayName="CropperCanvas";var Es=function(t){function n(n){var r=t.call(this,n)||this;return r.processMove=function(e,t){var n,i=r.container.current;if(i&&r.touches.length){var o=i.getBoundingClientRect(),a=o.left,s=o.top;if(1===r.touches.length&&1===t.length&&r.props.onMove){var l={left:Math.abs(t[0].clientX-r.anchor.left-a)<Math.abs(r.touches[0].clientX-r.anchor.left-a),top:Math.abs(t[0].clientY-r.anchor.top-s)<Math.abs(r.touches[0].clientY-r.anchor.top-s)},c={left:0,top:0};r.props.useAnchor&&l.left||(c.left=t[0].clientX-r.touches[0].clientX),r.props.useAnchor&&l.top||(c.top=t[0].clientY-r.touches[0].clientY),null===(n=r.props)||void 0===n||n.onMove(c,e),r.touches=pt([],dt(t),!1)}}},r.processEnd=function(){var e=r.props,t=e.onMoveEnd,n=e.onLeave;!r.props.disabled&&r.touches.length&&(null==t||t()),r.hovered&&(null==n||n(),r.hovered=!1),r.touches=[]},r.initAnchor=function(e){var t=r.container.current;if(t){var n=t.getBoundingClientRect(),i=n.left,o=n.top;r.anchor={left:e.clientX-i,top:e.clientY-o}}},r.onMouseOver=function(){var e=r.props,t=e.onEnter,n=e.disabled;r.hovered||n||(r.hovered=!0,null==t||t())},r.onMouseLeave=function(){var e=r.props.onLeave;r.hovered&&!r.touches.length&&(r.hovered=!1,null==e||e())},r.onTouchStart=function(e){var t=r.props,n=t.onEnter,i=t.onMoveStart,o=t.disabled;if(e.cancelable){r.touches=Array.from(e.touches);var a=!o&&1===e.touches.length;a&&(r.touches=Array.from(e.touches),null==i||i()),r.hovered||o||(r.hovered=!0,null==n||n()),(r.started||a)&&(e.preventDefault(),e.stopPropagation())}},r.onTouchEnd=function(){r.started=!1,r.processEnd()},r.onTouchMove=function(e){r.touches.length>=1&&(r.started?(r.processMove(e,Array.from(e.touches)),e.preventDefault(),e.stopPropagation()):po({left:r.touches[0].clientX,top:r.touches[0].clientY},{left:e.touches[0].clientX,top:e.touches[0].clientY})>(r.props.activationDistance||0)&&(r.initAnchor({clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}),r.started=!0))},r.onMouseDown=function(e){var t=r.props,n=t.onMoveStart;if(!t.disabled&&0===e.button){var i={clientX:e.clientX,clientY:e.clientY};r.touches=[i],r.initAnchor(i),e.stopPropagation(),null==n||n()}},r.onMouseMove=function(e){!r.props.disabled&&r.touches.length&&(r.processMove(e,[{clientX:e.clientX,clientY:e.clientY}]),e.preventDefault&&e.cancelable&&e.preventDefault(),e.stopPropagation())},r.onMouseUp=function(){r.processEnd()},r.touches=[],r.hovered=!1,r.started=!1,r.anchor={left:0,top:0},r.container=(0,e.createRef)(),r}return at(n,t),n.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var e=this.container.current;e&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("mousedown",this.onMouseDown))},n.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var e=this.container.current;e&&(e.addEventListener("touchstart",this.onTouchStart,{passive:!1}),e.addEventListener("mousedown",this.onMouseDown,{passive:!1}))},n.prototype.componentDidUpdate=function(e){this.props.disabled&&!e.disabled&&(this.touches=[])},n.prototype.render=function(){var t=this.props,n=t.children,r=t.className;return e.createElement("div",{className:rs()("advanced-cropper-draggable-element",r),ref:this.container,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},n)},n.defaultProps={disabled:!1,activationDistance:30,useAnchor:!0,rerender:!0},n}(e.Component),Ss=function(t){var n=t.position,r=t.className,i=t.disabled,o=t.onDrag,a=t.onDragEnd,s=t.onLeave,l=t.onEnter,c=t.children;return e.createElement(Es,{className:rs()(["advanced-cropper-line-wrapper",n&&"advanced-cropper-line-wrapper--".concat(n),i&&"advanced-cropper-line-wrapper--disabled",r]),disabled:i,onMove:o,onMoveEnd:a,onLeave:s,onEnter:l,activationDistance:0},e.createElement("div",{className:rs()(["advanced-cropper-line-wrapper__content",n&&"advanced-cropper-line-wrapper__content--".concat(n)])},c))},Cs=function(t){var n,r,i=t.position,o=t.hoverClassName,a=t.wrapperClassName,s=t.defaultClassName,l=t.disabled,c=t.onMove,u=t.onMoveEnd,d=dt((0,e.useState)(!1),2),f=d[0],p=d[1];return e.createElement(Ss,{className:rs()("advanced-cropper-simple-line-wrapper",a,(n={},n["advanced-cropper-simple-line-wrapper--".concat(i)]=!!i,n)),position:i,disabled:l,onDrag:c,onDragEnd:u,onLeave:function(){p(!1)},onEnter:function(){p(!0)}},e.createElement("div",{className:rs()("advanced-cropper-simple-line",f&&"advanced-cropper-simple-line--hover",s,f&&o,(r={},r["advanced-cropper-simple-line--".concat(i)]=!!i,r))}))},Ts=function(t){var n=t.horizontalPosition,r=t.verticalPosition,i=t.className,o=t.disabled,a=t.onDrag,s=t.onDragEnd,l=t.onLeave,c=t.onEnter,u=t.children,d=t.style,f=n||r?Ji(n,r).snakeCase:null;return e.createElement("div",{style:d,className:rs()(i,"advanced-cropper-handler-wrapper",f&&"advanced-cropper-handler-wrapper--".concat(f),o&&"advanced-cropper-handler-wrapper--disabled")},e.createElement(Es,{className:"advanced-cropper-handler-wrapper__draggable",disabled:o,onMove:a,onMoveEnd:s,onLeave:l,onEnter:c,activationDistance:0},u))},As=function(t){var n,r=t.verticalPosition,i=t.horizontalPosition,o=t.hoverClassName,a=t.wrapperClassName,s=t.defaultClassName,l=t.wrapperStyle,c=t.disabled,u=t.onMove,d=t.onMoveEnd,f=dt((0,e.useState)(!1),2),p=f[0],h=f[1];return e.createElement(Ts,{style:l,className:rs()("advanced-cropper-simple-handler-wrapper",a,r&&"advanced-cropper-simple-handler-wrapper--".concat(r),i&&"advanced-cropper-simple-handler-wrapper--".concat(i),i&&r&&"advanced-cropper-simple-handler-wrapper--".concat(i,"-").concat(r),p&&"advanced-cropper-simple-handler-wrapper--hover"),verticalPosition:r,horizontalPosition:i,disabled:c,onDrag:u,onDragEnd:d,onLeave:function(){h(!1)},onEnter:function(){h(!0)}},e.createElement("div",{className:rs()("advanced-cropper-simple-handler",p&&"advanced-cropper-simple-handler--hover",s,p&&o,(n={},n["advanced-cropper-simple-handler--".concat(r)]=!!r,n["advanced-cropper-simple-handler--".concat(i)]=!!i,n["advanced-cropper-simple-handler--".concat(i,"-").concat(r)]=i&&r,n))}))},Os=["east","west",null],Ps=["south","north",null],Ms=function(t){var n=t.style,r=t.className,i=t.children,o=t.onResize,a=t.onResizeEnd,s=t.handlerComponent,l=void 0===s?As:s,c=t.handlers,u=void 0===c?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:c,d=t.handlerClassNames,f=void 0===d?{}:d,p=t.handlerWrapperClassNames,h=void 0===p?{}:p,m=t.lines,g=void 0===m?{west:!0,north:!0,east:!0,south:!0}:m,v=t.lineComponent,y=void 0===v?Cs:v,b=t.lineClassNames,w=void 0===b?{}:b,x=t.lineWrapperClassNames,_=void 0===x?{}:x,k=t.disabled,E=void 0!==k&&k,S=t.reference,C=void 0===S?null:S,T=dt((0,e.useState)(null),2),A=T[0],O=T[1],P=(0,e.useMemo)((function(){var e=[];return Os.forEach((function(t){Ps.forEach((function(n){if(t!==n){var r=Ji(t,n),i=r.snakeCase,o=r.camelCase;i&&o&&e.push({name:o,className:i,verticalPosition:n,horizontalPosition:t})}}))})),e}),[]),M=(0,e.useMemo)((function(){var e=[];return P.forEach((function(t){wo(t.name)&&(oo(g)?g[t.name]:g)&&e.push({name:t.name,component:y,className:rs()(w.default,w[t.name],E&&w.disabled),wrapperClassName:rs()("advanced-cropper-bounding-box__line","advanced-cropper-bounding-box__line--".concat(t.name),_.default,_[t.name],E&&_.disabled),hoverClassName:w.hover,verticalPosition:t.verticalPosition,horizontalPosition:t.horizontalPosition,disabled:E})})),e}),[P,g,y,w,_,E]),N=(0,e.useMemo)((function(){var e=[];return P.forEach((function(t){(oo(u)?u[t.name]:u)&&e.push({name:t.name,component:l,className:rs()(f.default,f[t.name]),containerClassName:rs()("advanced-cropper-bounding-box__handler-wrapper","advanced-cropper-bounding-box__handler-wrapper--".concat(t.className)),wrapperClassName:rs()("advanced-cropper-bounding-box__handler","advanced-cropper-bounding-box__handler--".concat(t.className),h.default,h[t.name]),hoverClassName:f.hover,verticalPosition:t.verticalPosition,horizontalPosition:t.horizontalPosition,disabled:E})})),e}),[P,u,l,f,h,E]),L=function(e,t){return function(n,r){var i,a={left:n.left,top:n.top};if(!t&&e?i="width":t&&!e&&(i="height"),!E){if(o){var s=Ji(e,t).camelCase;s&&o(s,a,{reference:A||C,preserveAspectRatio:r&&r.shiftKey,respectDirection:i,compensate:!0})}A||O(C)}}},I=function(){null==a||a(),O(null)};return e.createElement("div",{className:rs()("advanced-cropper-bounding-box",r),style:n},i,e.createElement("div",null,M.map((function(t){return e.createElement(t.component,{key:t.name,defaultClassName:t.className,hoverClassName:t.hoverClassName,wrapperClassName:t.wrapperClassName,position:t.name,disabled:t.disabled,onMove:L(t.horizontalPosition,t.verticalPosition),onMoveEnd:I})}))),e.createElement("div",null,N.map((function(t){var n=e.createElement(t.component,{defaultClassName:t.className,hoverClassName:t.hoverClassName,wrapperClassName:t.wrapperClassName,horizontalPosition:t.horizontalPosition,verticalPosition:t.verticalPosition,disabled:t.disabled,onMove:L(t.horizontalPosition,t.verticalPosition),onMoveEnd:I});return e.createElement("div",{key:t.name,className:t.containerClassName},n)}))))},Ns=function(t){var n=t.className,r=t.children;return e.createElement("div",{className:rs()("advanced-cropper-stencil-overlay",n)},r)};var Ls=function(t){var n=t.className,r=t.transitions,i=t.children,o=lt(t,["className","transitions","children"]),a=(0,e.useRef)(null),s=(0,e.useRef)(o),l=dt((0,e.useState)(o),2),c=l[0],u=l[1],d=dt(function(t){void 0===t&&(t=null);var n=(0,e.useRef)(new Qa),r=dt((0,e.useState)(!1),2),i=r[0],o=r[1];return[function(e){t&&t.active?n.current.start(st(st({},t),{onStart:function(){o(!0)},onProgress:function(t){e(t)},onStop:function(){o(!1)}})):n.current.active||e(1)},i]}(r),2),f=d[0],p=d[1];(0,e.useLayoutEffect)((function(){if(!bo(c,o)){u(o);var e=p?st({},s.current):c;f((function(t){["left","top","height","width"].forEach((function(n){var r=o[n],i=e[n];s.current[n]=co(i)&&co(r)?i+(r-i)*t:r})),a.current&&(a.current.style.width="".concat(s.current.width,"px"),a.current.style.height="".concat(s.current.height,"px"),a.current.style.transform="translate3d(".concat(s.current.left,"px, ").concat(s.current.top,"px, 0px)"))}))}}),[c,p,o.width,o.height,o.top,o.left]);var h=p?s.current:o,m={left:0,top:0,width:"".concat(h.width,"px"),height:"".concat(h.height,"px"),transform:"translate3d(".concat(h.left,"px, ").concat(h.top,"px, 0px)")};return e.createElement("div",{ref:a,className:rs()("advanced-cropper-artificial-transition",n),style:m},i)},Is=function(t){var n=t.className,r=t.transitions,i=t.width,o=t.height,a=t.left,s=t.top,l=t.children;return e.createElement(Ls,{className:rs()("advanced-cropper-stencil-wrapper",n),transitions:r,width:i,height:o,top:s,left:a},l)},Ds=function(t){var n=t.columns,r=void 0===n?3:n,i=t.rows,o=void 0===i?3:i,a=t.visible,s=void 0!==a&&a,l=t.className,c=[],u=dt((0,e.useState)(r),2),d=u[0],f=u[1],p=dt((0,e.useState)(o),2),h=p[0],m=p[1];fs((function(){s&&(m(o),f(r))}),[s,r,o]);for(var g=0;g<h;g++){for(var v=[],y=0;y<d;y++)v.push(e.createElement("div",{key:y,className:rs()("advanced-cropper-stencil-grid__cell",0===g&&"advanced-cropper-stencil-grid__cell--top",g===h-1&&"advanced-cropper-stencil-grid__cell--bottom",0===y&&"advanced-cropper-stencil-grid__cell--left",y===d-1&&"advanced-cropper-stencil-grid__cell--right")}));c.push(e.createElement("div",{key:g,className:"advanced-cropper-stencil-grid__row"},v))}return e.createElement("div",{className:rs()("advanced-cropper-stencil-grid",s&&"advanced-cropper-stencil-grid--visible",l)},c)},Rs=(0,e.forwardRef)((function(t,n){var r=t.cropper,i=t.coordinates,o=t.aspectRatio,a=t.minAspectRatio,s=t.maxAspectRatio,l=t.handlerComponent,c=void 0===l?As:l,u=t.handlers,d=void 0===u?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:u,f=t.handlerClassNames,p=void 0===f?{}:f,h=t.handlerWrapperClassNames,m=void 0===h?{}:h,g=t.lines,v=void 0===g?{west:!0,north:!0,east:!0,south:!0}:g,y=t.lineComponent,b=void 0===y?Cs:y,w=t.lineClassNames,x=void 0===w?{}:w,_=t.lineWrapperClassNames,k=void 0===_?{}:_,E=t.resizable,S=void 0===E||E,C=t.movable,T=void 0===C||C,A=t.grid,O=t.gridClassName,P=t.className,M=t.movingClassName,N=t.resizingClassName,L=t.previewClassName,I=t.boundingBoxClassName,D=t.overlayClassName,R=t.draggableAreaClassName,B=r.getState(),j=r.getTransitions(),z=r.getInteractions();(0,e.useImperativeHandle)(n,(function(){return{aspectRatio:Zo(o||{minimum:a,maximum:s})}}));var U=i?ro(i)?i(B):i:oa(B),F=U.width,W=U.height,H=U.left,V=U.top;return B&&e.createElement(Is,{className:rs()("advanced-cropper-rectangle-stencil",P,z.moveCoordinates&&M,z.resizeCoordinates&&N,{"advanced-cropper-rectangle-stencil--movable":T,"advanced-cropper-rectangle-stencil--moving":z.moveCoordinates,"advanced-cropper-rectangle-stencil--resizable":S,"advanced-cropper-rectangle-stencil--resizing":z.resizeCoordinates}),width:F,height:W,left:H,top:V,transitions:j},e.createElement(Ms,{reference:B.coordinates,className:rs()(I,"advanced-cropper-rectangle-stencil__bounding-box"),handlers:d,handlerComponent:c,handlerClassNames:p,handlerWrapperClassNames:m,lines:v,lineComponent:b,lineClassNames:x,lineWrapperClassNames:k,onResize:function(e,t,n){r&&S&&r.resizeCoordinates(e,t,n)},onResizeEnd:function(){r&&r.resizeCoordinatesEnd()},disabled:!S},e.createElement(Es,{disabled:!T,onMove:function(e){r&&T&&r.moveCoordinates(e)},onMoveEnd:function(){r&&r.moveCoordinatesEnd()},className:rs()("advanced-cropper-rectangle-stencil__draggable-area",R)},e.createElement(Ns,{className:rs()("advanced-cropper-rectangle-stencil__overlay",D)},A&&e.createElement(Ds,{visible:r.hasInteractions(),columns:z.transformImage.rotate?9:3,rows:z.transformImage.rotate?9:3,className:rs()("advanced-cropper-rectangle-stencil__grid",O)}),e.createElement("div",{className:rs()("advanced-cropper-rectangle-stencil__preview",L)})))))}));Rs.displayName="RectangleStencil";var Bs,js=function(){function e(e){var t=e.active;this.active=t,this.defaultPrevented=!1}return e.prototype.preventDefault=function(){this.defaultPrevented=!0},e}(),zs=function(t){function n(n){var r=t.call(this,n)||this;return r.processMove=function(e){var t=r.props,n=t.onTransform,i=t.touchScale,o=t.touchMove,a=t.touchRotate,s=r.container.current;s&&n&&(n(function(e,t,n,r){var i,o,a;if(void 0===r&&(r={}),1===t.length&&1===e.length)r.move&&(i={left:t[0].clientX-e[0].clientX,top:t[0].clientY-e[0].clientY});else if(e.length>1){var s=Ja(t,n),l=Ja(e,n);if(r.rotate&&2===t.length&&2===e.length){var c={left:[e[0].clientX-e[1].clientX,t[0].clientX-t[1].clientX],top:[e[0].clientY-e[1].clientY,t[0].clientY-t[1].clientY]},u=c.left[0]*c.top[1]-c.left[1]*c.top[0],d=c.left[0]*c.left[1]+c.top[0]*c.top[1];if(!ho(d,0)&&!ho(u,0)){var f=-180*Math.atan2(u,d)/Math.PI;a={center:l.centerMass,angle:f}}}r.move&&(i={left:s.centerMass.left-l.centerMass.left,top:s.centerMass.top-l.centerMass.top}),r.scale&&(o={factor:l.spread/s.spread,center:l.centerMass})}return{move:i,scale:o,rotate:a}}(e,r.touches,s,{scale:i,rotate:a,move:o})),r.touches=e)},r.processEnd=function(){var e=r.props.onTransformEnd;r.transforming&&(r.transforming=!1,e&&e())},r.processStart=function(){r.transforming=!0,r.debouncedProcessEnd.clear()},r.processEvent=function(e){var t=r.props,n=t.onEvent,i=t.disabled,o=new js({active:r.transforming});return n?n(o,e):(e.preventDefault(),e.stopPropagation()),!i&&!o.defaultPrevented},r.onWheel=function(e){var t=r.props,n=t.onTransform,i=t.wheelScale,o=r.container.current;i&&r.processEvent(e)&&(r.processStart(),n&&o&&n(es(e,o,!0===i?.1:i.ratio)),r.touches.length||r.debouncedProcessEnd())},r.onTouchStart=function(e){var t=r.props,n=t.touchMove,i=t.touchScale,o=t.touchRotate;if(e.cancelable&&(n||(i||o)&&e.touches.length>1)&&r.processEvent(e)){var a=r.container.current;if(a){var s=a.getBoundingClientRect(),l=s.left,c=s.top,u=s.bottom,d=s.right;r.touches=Array.from(e.touches).filter((function(e){return e.clientX>l&&e.clientX<d&&e.clientY>c&&e.clientY<u}))}}},r.onTouchEnd=function(e){0===e.touches.length&&(r.touches=[],r.processEnd())},r.onTouchMove=function(e){if(r.touches.length){var t=pt([],dt(e.touches),!1).filter((function(e){return!e.identifier||r.touches.find((function(t){return t.identifier===e.identifier}))}));r.processEvent(e)&&(r.processMove(t),r.processStart())}},r.onMouseDown=function(e){if(r.props.mouseMove&&"buttons"in e&&1===e.buttons&&r.processEvent(e)){var t={clientX:e.clientX,clientY:e.clientY};r.touches=[t],r.processStart()}},r.onMouseMove=function(e){r.touches.length&&r.processEvent(e)&&r.processMove([{clientX:e.clientX,clientY:e.clientY}])},r.onMouseUp=function(){r.touches=[],r.processEnd()},r.transforming=!1,r.touches=[],r.anchor={left:0,top:0},r.container=(0,e.createRef)(),r.debouncedProcessEnd=xo(r.processEnd,n.timeout),r}return at(n,t),n.prototype.shouldComponentUpdate=function(){return!0},n.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var e=this.container.current;e&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("wheel",this.onWheel))},n.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var e=this.container.current;e&&(e.addEventListener("touchstart",this.onTouchStart,{passive:!1}),e.addEventListener("mousedown",this.onMouseDown,{passive:!1}),e.addEventListener("wheel",this.onWheel,{passive:!1}))},n.prototype.render=function(){var t=this.props,n=t.className,r=t.children,i=t.style;return e.createElement("div",{className:n,style:i,ref:this.container},r)},n.defaultProps={touchMove:!0,mouseMove:!0,touchScale:!0,touchRotate:!1,wheelScale:!0,timeout:500},n}(e.Component),Us=function(t){var n=t.scaleImage,r=void 0===n||n,i=t.moveImage,o=void 0===i||i,a=t.rotateImage,s=void 0!==a&&a,l=t.children,c=t.className,u=t.style,d=t.cropper,f=t.timeout,p=d.getTransitions(),h=function(t){return(0,e.useMemo)((function(){return ao(t,{touch:!0},{touch:!1})}),[t])}(s),m=function(t){return(0,e.useMemo)((function(){return ao(t,{touch:!0,wheel:{ratio:.1}},{touch:!1,wheel:!1})}),[t])}(r),g=function(t){return(0,e.useMemo)((function(){return ao(t,{touch:!0,mouse:!0},{touch:!1,mouse:!1})}),[t])}(o);return e.createElement(zs,{className:c,style:u,onTransform:d.transformImage,onTransformEnd:d.transformImageEnd,touchMove:g.touch,mouseMove:g.mouse,touchScale:m.touch,wheelScale:m.wheel,touchRotate:h.touch,disabled:p.active,timeout:f},l)},Fs=(Bs=function(t,n){var r=t.style,i=t.className,o=t.stencilComponent,a=void 0===o?Rs:o,s=t.stencilConstraints,l=void 0===s?ts:s,c=t.stencilProps,u=void 0===c?{}:c,d=t.wrapperComponent,f=void 0===d?ws:d,p=t.wrapperProps,h=void 0===p?{}:p,m=t.backgroundComponent,g=void 0===m?_s:m,v=t.backgroundProps,y=void 0===v?{}:v,b=t.backgroundClassName,w=t.backgroundWrapperComponent,x=void 0===w?Us:w,_=t.backgroundWrapperProps,k=void 0===_?{}:_,E=t.boundaryComponent,S=void 0===E?ys:E,C=t.boundaryProps,T=t.boundaryClassName,A=t.canvas,O=void 0===A||A,P=t.crossOrigin,M=void 0===P||P,N=t.settings,L=lt(t,["style","className","stencilComponent","stencilConstraints","stencilProps","wrapperComponent","wrapperProps","backgroundComponent","backgroundProps","backgroundClassName","backgroundWrapperComponent","backgroundWrapperProps","boundaryComponent","boundaryProps","boundaryClassName","canvas","crossOrigin","settings"]),I=(0,e.useRef)(null),D=vs((function(){return st(st({},L),{crossOrigin:M,stencilProps:u,canvas:O,settings:st(st({},N),l(N,st(st({},u),I.current)))})})),R=D.cropper,B=D.image,j=D.refs,z=a,U=f,F=x,W=g,H=S;(0,e.useImperativeHandle)(n,(function(){return R}));var V={loading:R.isLoading(),loaded:R.isLoaded()};return e.createElement(U,st({},h,{className:rs()("advanced-cropper",i),cropper:R,style:r},V),e.createElement(H,st({},C,{ref:j.boundary,className:rs()("advanced-cropper__boundary",T)}),e.createElement(F,st({},k,{cropper:R,className:"advanced-cropper__background-wrapper"}),R.getState()&&e.createElement(W,st({},y,{ref:j.image,crossOrigin:M,cropper:R,className:rs()("advanced-cropper__background",b)})),e.createElement(z,st({},u,{ref:I,cropper:R,image:B}))),O&&e.createElement(ks,{ref:j.canvas})))},(0,e.forwardRef)(Bs)),Ws=["transformImage","moveCoordinates","resizeCoordinates","defaultCoordinates","defaultVisibleArea","areaPositionRestrictions","areaSizeRestrictions","sizeRestrictions","positionRestrictions","aspectRatio","minWidth","minHeight","maxWidth","maxHeight","defaultSize","defaultPosition","defaultTransforms","imageRestriction","priority"];function Hs(e,t){void 0===t&&(t=Ws);var n={settings:{},props:{}};return Object.keys(e).forEach((function(r){t.some((function(e){return e===r}))?n.settings[r]=e[r]:n.props[r]=e[r]})),n}var Vs=(0,e.forwardRef)((function(t,n){var r=Hs(t,pt(pt([],dt(Ws),!1),["stencilSize"],!1));return e.createElement(Fs,st({postProcess:cs,stencilConstraints:is},r.props,{settings:st(st({defaultSize:ss,aspectRatio:ls,sizeRestrictions:ja(as)},r.settings),{transformImage:st(st({},r.settings.transformImage),{adjustStencil:!1})}),ref:n}))}));Vs.displayName="FixedCropper";var qs=(0,e.forwardRef)((function(t,n){var r=Hs(t),i=r.props,o=r.settings,a=o.stencilSize,s=o.autoZoom,l=lt(o,["stencilSize","autoZoom"]),c=ds();return io(s)||(i.postProcess||a?c("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function."):(c("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function. The 'postProcess' automatically set to 'hybridAutoZoom'"),i.postProcess=us)),io(a)?e.createElement(Fs,st({},i,{ref:n,settings:l})):(c("prop 'stencilSize' is deprecated for <Cropper/> component now and will be removed, use <FixedCropper/> component instead."),e.createElement(Vs,st({ref:n,stencilSize:a},l,i)))}));qs.displayName="CropperComponent";var Gs=(0,e.forwardRef)((function(t,n){var r=t.cropper,i=t.coordinates,o=t.handlerComponent,a=void 0===o?As:o,s=t.handlers,l=void 0===s?{eastNorth:!0,westNorth:!0,westSouth:!0,eastSouth:!0}:s,c=t.handlerClassNames,u=void 0===c?{}:c,d=t.handlerWrapperClassNames,f=void 0===d?{}:d,p=t.lines,h=void 0===p?{west:!0,north:!0,east:!0,south:!0}:p,m=t.lineComponent,g=void 0===m?Cs:m,v=t.lineClassNames,y=void 0===v?{}:v,b=t.lineWrapperClassNames,w=void 0===b?{}:b,x=t.resizable,_=void 0===x||x,k=t.movable,E=void 0===k||k,S=t.grid,C=t.gridClassName,T=t.className,A=t.movingClassName,O=t.resizingClassName,P=t.previewClassName,M=t.boundingBoxClassName,N=t.overlayClassName,L=t.draggableAreaClassName,I=r.getState(),D=r.getTransitions(),R=r.getInteractions();(0,e.useImperativeHandle)(n,(function(){return{aspectRatio:1,boundingBox:"circle"}}));var B=i?ro(i)?i(I):i:oa(I),j=B.width,z=B.height,U=B.left,F=B.top;return I&&e.createElement(Is,{className:rs()("advanced-cropper-circle-stencil",T,R.moveCoordinates&&A,R.resizeCoordinates&&O,{"advanced-cropper-circle-stencil--movable":E,"advanced-cropper-circle-stencil--moving":R.moveCoordinates,"advanced-cropper-circle-stencil--resizable":_,"advanced-cropper-circle-stencil--resizing":R.resizeCoordinates}),width:j,height:z,left:U,top:F,transitions:D},e.createElement(Ms,{reference:I.coordinates,className:rs()(M,"advanced-cropper-circle-stencil__bounding-box"),handlers:l,handlerComponent:a,handlerClassNames:u,handlerWrapperClassNames:f,lines:h,lineComponent:g,lineClassNames:y,lineWrapperClassNames:w,onResize:function(e,t,n){r&&_&&r.resizeCoordinates(e,t,n)},onResizeEnd:function(){r&&r.resizeCoordinatesEnd()},disabled:!_},e.createElement(Es,{disabled:!E,onMove:function(e){r&&E&&r.moveCoordinates(e)},onMoveEnd:function(){r&&r.moveCoordinatesEnd()},className:rs()("advanced-cropper-circle-stencil__draggable-area",L)},e.createElement(Ns,{className:rs()("advanced-cropper-circle-stencil__overlay",N)},S&&e.createElement(Ds,{visible:r.hasInteractions(),columns:R.transformImage.rotate?9:3,rows:R.transformImage.rotate?9:3,className:rs()("advanced-cropper-circle-stencil__grid",C)}),e.createElement("div",{className:rs()("advanced-cropper-circle-stencil__preview",P)})))))}));Gs.displayName="CircleStencil",(0,e.forwardRef)((function(t,n){var r=t.src,i=t.crossOrigin,o=void 0===i||i,a=lt(t,["src","crossOrigin"]);return r?e.createElement("img",st({key:r,ref:n,src:r,className:rs()("advanced-cropper-source"),crossOrigin:!0===o?"anonymous":o||void 0},a)):null})).displayName="CropperSource";var $s=function(t){var n=t.children,r=t.cropper,i=t.className,o=t.style;return e.createElement("div",{className:rs()(i,"cropper-preview-wrapper"),style:o},e.createElement(bs,{visible:null==r?void 0:r.isLoaded(),className:"cropper-preview-wrapper__fade"},n))},Zs=function(t){var n=t.className,r=t.cropper,i=t.crossOrigin,o=void 0===i||i,a=t.size,s=t.style,l=r.getState(),c=r.getTransitions(),u=r.getImage(),d=a&&u&&(null==l?void 0:l.coordinates)?function(e,t,n,r){return void 0===r&&(r=null),e&&t&&t.visibleArea&&t.coordinates?Ga(e,t,t.coordinates,Ro(t.coordinates)>Ro(n)?t.coordinates.width/n.width:t.coordinates.height/n.height,r):{}}(u,l,a,c):{},f=u?u.src:void 0;return f?e.createElement("img",{key:f,className:rs()("advanced-cropper-background-image",n),src:f,crossOrigin:!0===o?"anonymous":o||void 0,style:st(st({},d),s),onMouseDown:xs}):null};(0,e.forwardRef)((function(t,n){var r,i,o,a,s=t.className,l=t.contentClassName,c=t.state,u=void 0===c?null:c,d=t.image,f=void 0===d?null:d,p=t.transitions,h=void 0===p?null:p,m=t.backgroundComponent,g=void 0===m?Zs:m,v=t.backgroundProps,y=t.backgroundClassName,b=t.boundaryComponent,w=void 0===b?ys:b,x=t.boundaryProps,_=t.boundaryClassName,k=t.wrapperComponent,E=void 0===k?$s:k,S=t.wrapperProps,C=t.loaded,T=void 0===C||C,A=t.loading,O=void 0!==A&&A,P=t.style,M=t.cropper,N=hs(),L=(0,e.useRef)(null),I=M||{current:{getState:function(){return u},getTransitions:function(){return h},getImage:function(){return f},isLoaded:function(){return T},isLoading:function(){return O}}},D=dt((0,e.useState)(null),2),R=D[0],B=D[1],j=null===(i=null===(r=I.current)||void 0===r?void 0:r.getState())||void 0===i?void 0:i.coordinates,z=null===(a=null===(o=I.current)||void 0===o?void 0:o.getImage())||void 0===a?void 0:a.src,U=R?{width:"".concat(R.width,"px"),height:"".concat(R.height,"px")}:{},F=function(){L.current&&j&&L.current.stretchTo(j).then((function(e){e&&j?mo(Ro(j),Ro(e))?B({width:e.width,height:e.width/Ro(j)}):B({width:e.height*Ro(j),height:e.height}):B(null)})),N()};gs(F),(0,e.useLayoutEffect)(F,[null==j?void 0:j.height,null==j?void 0:j.width]),(0,e.useImperativeHandle)(n,(function(){return{refresh:N}}));var W=E,H=g,V=w;return e.createElement(W,st({},S,{className:rs()(s,"advanced-cropper-preview"),cropper:I.current,style:P}),e.createElement(V,st({ref:L,stretchAlgorithm:Za},x,{className:rs()("advanced-cropper-preview__boundary",_)}),e.createElement("div",{className:rs()(l,"advanced-cropper-preview__content"),style:U},I.current&&e.createElement(H,st({},v,{cropper:I.current,size:R,className:rs()(y,"advanced-cropper-preview__image",z&&"advanced-cropper-preview__image--visible")})))))}));var Ys=i(3516),Xs={};Xs.styleTagTransform=m(),Xs.setAttributes=d(),Xs.insert=c().bind(null,"head"),Xs.domAPI=s(),Xs.insertStyleElement=p();o()(Ys.Z,Xs);Ys.Z&&Ys.Z.locals&&Ys.Z.locals;function Ks(e){return Ks="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(e)}function Qs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Js(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qs(Object(n),!0).forEach((function(t){el(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function el(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ks(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ks(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ks(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return nl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nl(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const rl=function(){var t=tl((0,e.useContext)(F),2),n=t[0],r=t[1],i=tl((0,e.useState)(null),2),o=i[0],a=i[1],s=(0,e.useRef)(null);(0,e.useEffect)((function(){s.current&&s.current.getCoordinates()&&(n.fromCropper||(s.current.setCoordinates({top:n.top,left:n.left,width:n.width,height:n.height}),n.top!=s.current.getCoordinates().top&&r((function(e){return Js(Js({},e),{},{top:s.current.getCoordinates().top})})),n.left!=s.current.getCoordinates().left&&r((function(e){return Js(Js({},e),{},{left:s.current.getCoordinates().left})})),n.width!=s.current.getCoordinates().width&&r((function(e){return Js(Js({},e),{},{width:s.current.getCoordinates().width})})),n.height!=s.current.getCoordinates().height&&r((function(e){return Js(Js({},e),{},{height:s.current.getCoordinates().height})}))))}),[n.width,n.height,n.top,n.left]);return(0,e.useEffect)((function(){n.blob&&a(n.frame)}),[n.frame]),e.createElement("div",null,e.createElement(qs,{src:o,ref:s,onChange:function(e){e&&r((function(t){return Js(Js({},t),{},{top:e.getCoordinates().top,left:e.getCoordinates().left,width:e.getCoordinates().width,height:e.getCoordinates().height,fromCropper:!0})}))},className:"cropper",stencilProps:{grid:!0},defaultSize:{width:n.width,height:n.height},backgroundWrapperClassName:"CropperBackgroundWrapper",width:n.width,height:n.height,transitions:!1,style:{transition:"none"}}))};function il(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ol(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ol(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ol(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const al=function(){var t=il((0,e.useContext)(F),2),n=t[0];t[1];return e.createElement("div",{className:Ai.content},e.createElement("div",{className:Ai.wrap},"audio"===n.mode&&e.createElement(Ki,null),"player"===n.mode&&e.createElement(Ki,null),"crop"===n.mode&&e.createElement(rl,null)),e.createElement(qt,null))};var sl=i(930),ll={};ll.styleTagTransform=m(),ll.setAttributes=d(),ll.insert=c().bind(null,"head"),ll.domAPI=s(),ll.insertStyleElement=p();o()(sl.Z,ll);const cl=sl.Z&&sl.Z.locals?sl.Z.locals:void 0;function ul(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return dl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dl(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const fl=function(){var t=ul((0,e.useContext)(F),2),n=t[0];t[1];return e.createElement("div",{className:cl.layout},"crop"===n.mode&&e.createElement(vn,null),"player"===n.mode&&e.createElement(ln,null),"audio"===n.mode&&e.createElement(Cn,null),e.createElement("div",{className:cl.content},e.createElement(al,null),e.createElement(Si,null)))},pl=t["useId".toString()]||(()=>{});let hl=0;function ml(t){const[n,r]=e.useState(pl());return Qn((()=>{t||r((e=>null!=e?e:String(hl++)))}),[t]),t||(n?`radix-${n}`:"")}const gl="dismissableLayer.update",vl="dismissableLayer.pointerDownOutside",yl="dismissableLayer.focusOutside";let bl;const wl=(0,e.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),xl=(0,e.forwardRef)(((t,n)=>{var r;const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=t,d=(0,e.useContext)(wl),[f,p]=(0,e.useState)(null),h=null!==(r=null==f?void 0:f.ownerDocument)&&void 0!==r?r:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,m]=(0,e.useState)({}),g=qn(n,(e=>p(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=f?v.indexOf(f):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,_=w>=b,k=function(t,n=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const r=Zn(t),i=(0,e.useRef)(!1),o=(0,e.useRef)((()=>{}));return(0,e.useEffect)((()=>{const e=e=>{if(e.target&&!i.current){const t={originalEvent:e};function a(){kl(vl,r,t,{discrete:!0})}"touch"===e.pointerType?(n.removeEventListener("click",o.current),o.current=a,n.addEventListener("click",o.current,{once:!0})):a()}else n.removeEventListener("click",o.current);i.current=!1},t=window.setTimeout((()=>{n.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",o.current)}}),[n,r]),{onPointerDownCapture:()=>i.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(null==a||a(e),null==l||l(e),e.defaultPrevented||null==c||c())}),h),E=function(t,n=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const r=Zn(t),i=(0,e.useRef)(!1);return(0,e.useEffect)((()=>{const e=e=>{if(e.target&&!i.current){kl(yl,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)}),[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(null==s||s(e),null==l||l(e),e.defaultPrevented||null==c||c())}),h);return function(t,n=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const r=Zn(t);(0,e.useEffect)((()=>{const e=e=>{"Escape"===e.key&&r(e)};return n.addEventListener("keydown",e),()=>n.removeEventListener("keydown",e)}),[r,n])}((e=>{w===d.layers.size-1&&(null==o||o(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),(0,e.useEffect)((()=>{if(f)return i&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(bl=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),_l(),()=>{i&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=bl)}}),[f,h,i,d]),(0,e.useEffect)((()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),_l())}),[f,d]),(0,e.useEffect)((()=>{const e=()=>m({});return document.addEventListener(gl,e),()=>document.removeEventListener(gl,e)}),[]),(0,e.createElement)(or.div,rt({},u,{ref:g,style:{pointerEvents:x?_?"auto":"none":void 0,...t.style},onFocusCapture:Hn(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Hn(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Hn(t.onPointerDownCapture,k.onPointerDownCapture)}))}));function _l(){const e=new CustomEvent(gl);document.dispatchEvent(e)}function kl(e,t,r,{discrete:i}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),i?function(e,t){e&&(0,n.flushSync)((()=>e.dispatchEvent(t)))}(o,a):o.dispatchEvent(a)}const El="focusScope.autoFocusOnMount",Sl="focusScope.autoFocusOnUnmount",Cl={bubbles:!1,cancelable:!0},Tl=(0,e.forwardRef)(((t,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=t,[l,c]=(0,e.useState)(null),u=Zn(o),d=Zn(a),f=(0,e.useRef)(null),p=qn(n,(e=>c(e))),h=(0,e.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,e.useEffect)((()=>{if(i){function e(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?f.current=t:Ml(f.current,{select:!0})}function t(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Ml(f.current,{select:!0}))}function n(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Ml(l)}document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[i,l,h.paused]),(0,e.useEffect)((()=>{if(l){Nl.add(h);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(El,Cl);l.addEventListener(El,u),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ml(r,{select:t}),document.activeElement!==n)return}((e=Al(l),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Ml(l))}return()=>{l.removeEventListener(El,u),setTimeout((()=>{const e=new CustomEvent(Sl,Cl);l.addEventListener(Sl,d),l.dispatchEvent(e),e.defaultPrevented||Ml(null!=t?t:document.body,{select:!0}),l.removeEventListener(Sl,d),Nl.remove(h)}),0)}}var e}),[l,u,d,h]);const m=(0,e.useCallback)((e=>{if(!r&&!i)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[i,o]=function(e){const t=Al(e),n=Ol(t,e),r=Ol(t.reverse(),e);return[n,r]}(t);i&&o?e.shiftKey||n!==o?e.shiftKey&&n===i&&(e.preventDefault(),r&&Ml(o,{select:!0})):(e.preventDefault(),r&&Ml(i,{select:!0})):n===t&&e.preventDefault()}}),[r,i,h.paused]);return(0,e.createElement)(or.div,rt({tabIndex:-1},s,{ref:p,onKeyDown:m}))}));function Al(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ol(e,t){for(const n of e)if(!Pl(n,{upTo:t}))return n}function Pl(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Ml(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const Nl=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=Ll(e,t),e.unshift(t)},remove(t){var n;e=Ll(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function Ll(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}const Il=(0,e.forwardRef)(((t,r)=>{var i;const{container:o=(null===globalThis||void 0===globalThis||null===(i=globalThis.document)||void 0===i?void 0:i.body),...a}=t;return o?n.createPortal((0,e.createElement)(or.div,rt({},a,{ref:r})),o):null}));const Dl=t=>{const{present:r,children:i}=t,o=function(t){const[r,i]=(0,e.useState)(),o=(0,e.useRef)({}),a=(0,e.useRef)(t),s=(0,e.useRef)("none"),l=t?"mounted":"unmounted",[c,u]=function(t,n){return(0,e.useReducer)(((e,t)=>{const r=n[e][t];return null!=r?r:e}),t)}(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,e.useEffect)((()=>{const e=Rl(o.current);s.current="mounted"===c?e:"none"}),[c]),Qn((()=>{const e=o.current,n=a.current;if(n!==t){const r=s.current,i=Rl(e);if(t)u("MOUNT");else if("none"===i||"none"===(null==e?void 0:e.display))u("UNMOUNT");else{u(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}a.current=t}}),[t,u]),Qn((()=>{if(r){const e=e=>{const t=Rl(o.current).includes(e.animationName);e.target===r&&t&&(0,n.flushSync)((()=>u("ANIMATION_END")))},t=e=>{e.target===r&&(s.current=Rl(o.current))};return r.addEventListener("animationstart",t),r.addEventListener("animationcancel",e),r.addEventListener("animationend",e),()=>{r.removeEventListener("animationstart",t),r.removeEventListener("animationcancel",e),r.removeEventListener("animationend",e)}}u("ANIMATION_END")}),[r,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:(0,e.useCallback)((e=>{e&&(o.current=getComputedStyle(e)),i(e)}),[])}}(r),a="function"==typeof i?i({present:o.isPresent}):e.Children.only(i),s=qn(o.ref,a.ref);return"function"==typeof i||o.isPresent?(0,e.cloneElement)(a,{ref:s}):null};function Rl(e){return(null==e?void 0:e.animationName)||"none"}Dl.displayName="Presence";let Bl=0;function jl(){(0,e.useEffect)((()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:zl()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:zl()),Bl++,()=>{1===Bl&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),Bl--}}),[])}function zl(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Ul="right-scroll-bar-position",Fl="width-before-scroll-bar";function Wl(t,n){return r=n||null,i=function(e){return t.forEach((function(t){return function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}(t,e)}))},(o=(0,e.useState)((function(){return{value:r,callback:i,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}}))[0]).callback=i,o.facade;var r,i,o}function Hl(e){return e}function Vl(e,t){void 0===t&&(t=Hl);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter((function(e){return e!==i}))}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var o=function(){var n=t;t=[],n.forEach(e)},a=function(){return Promise.resolve().then(o)};a(),n={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),n}}}}}var ql=function(e){void 0===e&&(e={});var t=Vl(null);return t.options=st({async:!0,ssr:!1},e),t}(),Gl=function(){},$l=e.forwardRef((function(t,n){var r=e.useRef(null),i=e.useState({onScrollCapture:Gl,onWheelCapture:Gl,onTouchMoveCapture:Gl}),o=i[0],a=i[1],s=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,p=t.sideCar,h=t.noIsolation,m=t.inert,g=t.allowPinchZoom,v=t.as,y=void 0===v?"div":v,b=lt(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),w=p,x=Wl([r,n]),_=st(st({},b),o);return e.createElement(e.Fragment,null,d&&e.createElement(w,{sideCar:ql,removeScrollBar:u,shards:f,noIsolation:h,inert:m,setCallbacks:a,allowPinchZoom:!!g,lockRef:r}),s?e.cloneElement(e.Children.only(l),st(st({},_),{ref:x})):e.createElement(y,st({},_,{className:c,ref:x}),l))}));$l.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},$l.classNames={fullWidth:Fl,zeroRight:Ul};var Zl,Yl=function(t){var n=t.sideCar,r=lt(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return e.createElement(i,st({},r))};Yl.isSideCarExport=!0;function Xl(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Zl||i.nc;return t&&e.setAttribute("nonce",t),e}var Kl=function(){var e=0,t=null;return{add:function(n){var r,i;0==e&&(t=Xl())&&(i=n,(r=t).styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ql=function(){var t,n=(t=Kl(),function(n,r){e.useEffect((function(){return t.add(n),function(){t.remove()}}),[n&&r])});return function(e){var t=e.styles,r=e.dynamic;return n(t,r),null}},Jl={left:0,top:0,right:0,gap:0},ec=function(e){return parseInt(e||"",10)||0},tc=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Jl;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[ec(n),ec(r),ec(i)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},nc=Ql(),rc=function(e,t,n,r){var i=e.left,o=e.top,a=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(a,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Ul," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Fl," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Ul," .").concat(Ul," {\n right: 0 ").concat(r,";\n }\n \n .").concat(Fl," .").concat(Fl," {\n margin-right: 0 ").concat(r,";\n }\n \n body {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},ic=function(t){var n=t.noRelative,r=t.noImportant,i=t.gapMode,o=void 0===i?"margin":i,a=e.useMemo((function(){return tc(o)}),[o]);return e.createElement(nc,{styles:rc(a,!n,o,r?"":"!important")})},oc=!1;if("undefined"!=typeof window)try{var ac=Object.defineProperty({},"passive",{get:function(){return oc=!0,!0}});window.addEventListener("test",ac,ac),window.removeEventListener("test",ac,ac)}catch(e){oc=!1}var sc=!!oc&&{passive:!1},lc=function(e,t){var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},cc=function(e,t){var n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),uc(e,n)){var r=dc(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},uc=function(e,t){return"v"===e?function(e){return lc(e,"overflowY")}(t):function(e){return lc(e,"overflowX")}(t)},dc=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},fc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pc=function(e){return[e.deltaX,e.deltaY]},hc=function(e){return e&&"current"in e?e.current:e},mc=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},gc=0,vc=[];const yc=(bc=function(t){var n=e.useRef([]),r=e.useRef([0,0]),i=e.useRef(),o=e.useState(gc++)[0],a=e.useState((function(){return Ql()}))[0],s=e.useRef(t);e.useEffect((function(){s.current=t}),[t]),e.useEffect((function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var e=pt([t.lockRef.current],(t.shards||[]).map(hc),!0).filter(Boolean);return e.forEach((function(e){return e.classList.add("allow-interactivity-".concat(o))})),function(){document.body.classList.remove("block-interactivity-".concat(o)),e.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(o))}))}}}),[t.inert,t.lockRef.current,t.shards]);var l=e.useCallback((function(e,t){if("touches"in e&&2===e.touches.length)return!s.current.allowPinchZoom;var n,o=fc(e),a=r.current,l="deltaX"in e?e.deltaX:a[0]-o[0],c="deltaY"in e?e.deltaY:a[1]-o[1],u=e.target,d=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=cc(d,u);if(!f)return!0;if(f?n=d:(n="v"===d?"h":"v",f=cc(d,u)),!f)return!1;if(!i.current&&"changedTouches"in e&&(l||c)&&(i.current=n),!n)return!0;var p=i.current||n;return function(e,t,n,r,i){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=o*r,s=n.target,l=t.contains(s),c=!1,u=a>0,d=0,f=0;do{var p=dc(e,s),h=p[0],m=p[1]-p[2]-o*h;(h||m)&&uc(e,s)&&(d+=m,f+=h),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(i&&0===d||!i&&a>d)||!u&&(i&&0===f||!i&&-a>f))&&(c=!0),c}(p,t,e,"h"===p?l:c,!0)}),[]),c=e.useCallback((function(e){var t=e;if(vc.length&&vc[vc.length-1]===a){var r="deltaY"in t?pc(t):fc(t),i=n.current.filter((function(e){return e.name===t.type&&e.target===t.target&&(n=e.delta,i=r,n[0]===i[0]&&n[1]===i[1]);var n,i}))[0];if(i&&i.should)t.cancelable&&t.preventDefault();else if(!i){var o=(s.current.shards||[]).map(hc).filter(Boolean).filter((function(e){return e.contains(t.target)}));(o.length>0?l(t,o[0]):!s.current.noIsolation)&&t.cancelable&&t.preventDefault()}}}),[]),u=e.useCallback((function(e,t,r,i){var o={name:e,delta:t,target:r,should:i};n.current.push(o),setTimeout((function(){n.current=n.current.filter((function(e){return e!==o}))}),1)}),[]),d=e.useCallback((function(e){r.current=fc(e),i.current=void 0}),[]),f=e.useCallback((function(e){u(e.type,pc(e),e.target,l(e,t.lockRef.current))}),[]),p=e.useCallback((function(e){u(e.type,fc(e),e.target,l(e,t.lockRef.current))}),[]);e.useEffect((function(){return vc.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,sc),document.addEventListener("touchmove",c,sc),document.addEventListener("touchstart",d,sc),function(){vc=vc.filter((function(e){return e!==a})),document.removeEventListener("wheel",c,sc),document.removeEventListener("touchmove",c,sc),document.removeEventListener("touchstart",d,sc)}}),[]);var h=t.removeScrollBar,m=t.inert;return e.createElement(e.Fragment,null,m?e.createElement(a,{styles:mc(o)}):null,h?e.createElement(ic,{gapMode:"margin"}):null)},ql.useMedium(bc),Yl);var bc,wc=e.forwardRef((function(t,n){return e.createElement($l,st({},t,{ref:n,sideCar:yc}))}));wc.classNames=$l.classNames;const xc=wc;var _c=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},kc=new WeakMap,Ec=new WeakMap,Sc={},Cc=0,Tc=function(e){return e&&(e.host||Tc(e.parentNode))},Ac=function(e,t,n,r){var i=function(e,t){return t.map((function(t){if(e.contains(t))return t;var n=Tc(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)})).filter((function(e){return Boolean(e)}))}(t,Array.isArray(e)?e:[e]);Sc[n]||(Sc[n]=new WeakMap);var o=Sc[n],a=[],s=new Set,l=new Set(i),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};i.forEach(c);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,(function(e){if(s.has(e))u(e);else{var t=e.getAttribute(r),i=null!==t&&"false"!==t,l=(kc.get(e)||0)+1,c=(o.get(e)||0)+1;kc.set(e,l),o.set(e,c),a.push(e),1===l&&i&&Ec.set(e,!0),1===c&&e.setAttribute(n,"true"),i||e.setAttribute(r,"true")}}))};return u(t),s.clear(),Cc++,function(){a.forEach((function(e){var t=kc.get(e)-1,i=o.get(e)-1;kc.set(e,t),o.set(e,i),t||(Ec.has(e)||e.removeAttribute(r),Ec.delete(e)),i||e.removeAttribute(n)})),--Cc||(kc=new WeakMap,kc=new WeakMap,Ec=new WeakMap,Sc={})}},Oc=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||_c(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Ac(r,i,n,"aria-hidden")):function(){return null}};const Pc="Dialog",[Mc,Nc]=Gn(Pc),[Lc,Ic]=Mc(Pc),Dc=t=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:o,onOpenChange:a,modal:s=!0}=t,l=(0,e.useRef)(null),c=(0,e.useRef)(null),[u=!1,d]=Yn({prop:i,defaultProp:o,onChange:a});return(0,e.createElement)(Lc,{scope:n,triggerRef:l,contentRef:c,contentId:ml(),titleId:ml(),descriptionId:ml(),open:u,onOpenChange:d,onOpenToggle:(0,e.useCallback)((()=>d((e=>!e))),[d]),modal:s},r)},Rc="DialogTrigger",Bc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(Rc,r),a=qn(n,o.triggerRef);return(0,e.createElement)(or.button,rt({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":nu(o.open)},i,{ref:a,onClick:Hn(t.onClick,o.onOpenToggle)}))})),jc="DialogPortal",[zc,Uc]=Mc(jc,{forceMount:void 0}),Fc=t=>{const{__scopeDialog:n,forceMount:r,children:i,container:o}=t,a=Ic(jc,n);return(0,e.createElement)(zc,{scope:n,forceMount:r},e.Children.map(i,(t=>(0,e.createElement)(Dl,{present:r||a.open},(0,e.createElement)(Il,{asChild:!0,container:o},t)))))},Wc="DialogOverlay",Hc=(0,e.forwardRef)(((t,n)=>{const r=Uc(Wc,t.__scopeDialog),{forceMount:i=r.forceMount,...o}=t,a=Ic(Wc,t.__scopeDialog);return a.modal?(0,e.createElement)(Dl,{present:i||a.open},(0,e.createElement)(Vc,rt({},o,{ref:n}))):null})),Vc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(Wc,r);return(0,e.createElement)(xc,{as:er,allowPinchZoom:!0,shards:[o.contentRef]},(0,e.createElement)(or.div,rt({"data-state":nu(o.open)},i,{ref:n,style:{pointerEvents:"auto",...i.style}})))})),qc="DialogContent",Gc=(0,e.forwardRef)(((t,n)=>{const r=Uc(qc,t.__scopeDialog),{forceMount:i=r.forceMount,...o}=t,a=Ic(qc,t.__scopeDialog);return(0,e.createElement)(Dl,{present:i||a.open},a.modal?(0,e.createElement)($c,rt({},o,{ref:n})):(0,e.createElement)(Zc,rt({},o,{ref:n})))})),$c=(0,e.forwardRef)(((t,n)=>{const r=Ic(qc,t.__scopeDialog),i=(0,e.useRef)(null),o=qn(n,r.contentRef,i);return(0,e.useEffect)((()=>{const e=i.current;if(e)return Oc(e)}),[]),(0,e.createElement)(Yc,rt({},t,{ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hn(t.onCloseAutoFocus,(e=>{var t;e.preventDefault(),null===(t=r.triggerRef.current)||void 0===t||t.focus()})),onPointerDownOutside:Hn(t.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()})),onFocusOutside:Hn(t.onFocusOutside,(e=>e.preventDefault()))}))})),Zc=(0,e.forwardRef)(((t,n)=>{const r=Ic(qc,t.__scopeDialog),i=(0,e.useRef)(!1),o=(0,e.useRef)(!1);return(0,e.createElement)(Yc,rt({},t,{ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{var n,a;(null===(n=t.onCloseAutoFocus)||void 0===n||n.call(t,e),e.defaultPrevented)||(i.current||null===(a=r.triggerRef.current)||void 0===a||a.focus(),e.preventDefault());i.current=!1,o.current=!1},onInteractOutside:e=>{var n,a;null===(n=t.onInteractOutside)||void 0===n||n.call(t,e),e.defaultPrevented||(i.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const s=e.target;(null===(a=r.triggerRef.current)||void 0===a?void 0:a.contains(s))&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}}))})),Yc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,...s}=t,l=Ic(qc,r),c=qn(n,(0,e.useRef)(null));return jl(),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Tl,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:a},(0,e.createElement)(xl,rt({role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":nu(l.open)},s,{ref:c,onDismiss:()=>l.onOpenChange(!1)}))),!1)})),Xc="DialogTitle",Kc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(Xc,r);return(0,e.createElement)(or.h2,rt({id:o.titleId},i,{ref:n}))})),Qc="DialogDescription",Jc=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(Qc,r);return(0,e.createElement)(or.p,rt({id:o.descriptionId},i,{ref:n}))})),eu="DialogClose",tu=(0,e.forwardRef)(((t,n)=>{const{__scopeDialog:r,...i}=t,o=Ic(eu,r);return(0,e.createElement)(or.button,rt({type:"button"},i,{ref:n,onClick:Hn(t.onClick,(()=>o.onOpenChange(!1)))}))}));function nu(e){return e?"open":"closed"}const ru="DialogTitleWarning",[iu,ou]=function(t,n){const r=(0,e.createContext)(n);function i(t){const{children:n,...i}=t,o=(0,e.useMemo)((()=>i),Object.values(i));return(0,e.createElement)(r.Provider,{value:o},n)}return i.displayName=t+"Provider",[i,function(i){const o=(0,e.useContext)(r);if(o)return o;if(void 0!==n)return n;throw new Error(`\`${i}\` must be used within \`${t}\``)}]}(ru,{contentName:qc,titleName:Xc,docsSlug:"dialog"}),au=Dc,su=Bc,lu=Fc,cu=Hc,uu=Gc,du=Kc,fu=Jc,pu=tu,hu="AlertDialog",[mu,gu]=Gn(hu,[Nc]),vu=Nc(),yu=t=>{const{__scopeAlertDialog:n,...r}=t,i=vu(n);return(0,e.createElement)(au,rt({},i,r,{modal:!0}))},bu=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(su,rt({},o,i,{ref:n}))})),wu=t=>{const{__scopeAlertDialog:n,...r}=t,i=vu(n);return(0,e.createElement)(lu,rt({},i,r))},xu=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(cu,rt({},o,i,{ref:n}))})),_u="AlertDialogContent",[ku,Eu]=mu(_u),Su=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,children:i,...o}=t,a=vu(r),s=qn(n,(0,e.useRef)(null)),l=(0,e.useRef)(null);return(0,e.createElement)(iu,{contentName:_u,titleName:Cu,docsSlug:"alert-dialog"},(0,e.createElement)(ku,{scope:r,cancelRef:l},(0,e.createElement)(uu,rt({role:"alertdialog"},a,o,{ref:s,onOpenAutoFocus:Hn(o.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=l.current)||void 0===t||t.focus({preventScroll:!0})})),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()}),(0,e.createElement)(nr,null,i),!1)))})),Cu="AlertDialogTitle",Tu=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(du,rt({},o,i,{ref:n}))})),Au=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(fu,rt({},o,i,{ref:n}))})),Ou=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,o=vu(r);return(0,e.createElement)(pu,rt({},o,i,{ref:n}))})),Pu="AlertDialogCancel",Mu=(0,e.forwardRef)(((t,n)=>{const{__scopeAlertDialog:r,...i}=t,{cancelRef:o}=Eu(Pu,r),a=vu(r),s=qn(n,o);return(0,e.createElement)(pu,rt({},a,i,{ref:s}))})),Nu=yu,Lu=bu,Iu=wu,Du=xu,Ru=Su,Bu=Ou,ju=Mu,zu=Tu,Uu=Au;function Fu(e){return Fu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fu(e)}function Wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wu(Object(n),!0).forEach((function(t){Vu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Fu(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Fu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Fu(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Gu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gu(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const $u=function(t){var n=qu((0,e.useContext)(F),2),r=(n[0],n[1]),i=qu((0,e.useState)("Test"),2),o=i[0],a=i[1],s=qu((0,e.useState)("Description here"),2),l=s[0],c=s[1],u=qu((0,e.useState)("Submit"),2),d=u[0],f=u[1],p=qu((0,e.useState)("Cancel"),2),h=p[0],m=p[1],g=qu((0,e.useState)((function(){})),2),v=g[0],y=g[1],b=qu((0,e.useState)((function(){})),2),w=b[0],x=b[1],_=qu((0,e.useState)(!1),2),k=_[0],E=_[1],S=qu((0,e.useState)(null),2),C=S[0],T=S[1],A=qu((0,e.useState)(null),2),O=A[0],P=A[1],M=qu((0,e.useState)((function(){})),2),N=M[0],L=M[1],I=qu((0,e.useState)(!1),2),D=I[0],R=I[1],B=qu((0,e.useState)(!1),2),j=B[0],z=B[1],U=qu((0,e.useState)((function(){})),2),W=U[0],H=U[1],V=(0,e.useCallback)((function(e,t,n,r,i,o){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,d=arguments.length>9&&void 0!==arguments[9]&&arguments[9],p=arguments.length>10&&void 0!==arguments[10]&&arguments[10],h=arguments.length>11&&void 0!==arguments[11]?arguments[11]:function(){};a(e),c(t),f(n),m(r),E(!0),y((function(){return i})),x((function(){return o})),T(s),P(l),L((function(){return u})),R(d),z(p),H((function(){return h}))}));return(0,e.useEffect)((function(){return r((function(e){return Hu(Hu({},e),{},{openModal:V})})),function(){r((function(e){return Hu(Hu({},e),{},{openModal:null})}))}}),[]),e.createElement(Nu,{open:k,onOpenChange:function(e){E(e)}},e.createElement(Lu,{asChild:!0}),e.createElement(Iu,null,e.createElement(Du,{className:"AlertDialogOverlay"}),e.createElement(Ru,{className:"AlertDialogContent"},e.createElement(zu,{className:"AlertDialogTitle"},o),e.createElement(Uu,{className:"AlertDialogDescription"},l,O&&" ",O&&e.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),e.stopPropagation(),N()},target:"_blank"},O)),C&&e.createElement("img",{src:C,style:{width:"100%",marginBottom:15,marginTop:5,borderRadius:"15px"}}),e.createElement("div",{style:{display:"flex",gap:12,justifyContent:"flex-end"}},j&&e.createElement("button",{className:"SideButtonModal",onClick:function(){W(),E(!1)}},j),h&&e.createElement(ju,{asChild:!0},e.createElement("button",{className:"Button grey",onClick:function(){return w()}},h)),d&&e.createElement(Bu,{asChild:!0},e.createElement("button",{className:D?"Button blue":"Button red",onClick:function(){return v()}},d))))))};function Zu(e){return Zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zu(e)}function Yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yu(Object(n),!0).forEach((function(t){Ku(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ku(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Zu(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Zu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Zu(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||Ju(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ju(e,t){if(e){if("string"==typeof e)return ed(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ed(e,t):void 0}}function ed(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const td=function(){var t=Qu((0,e.useContext)(F),2),n=t[0],r=t[1],i=(0,e.useRef)(null),o=(0,e.useRef)("");return(0,e.useEffect)((function(){var e,t=!!(e=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./))&&parseInt(e[2],10);t&&t>110?n.loadFFmpeg():r((function(e){return Xu(Xu({},e),{},{updateChrome:!0,ffmpeg:!0})}))}),[]),(0,e.useEffect)((function(){n.blob&&n.ffmpeg&&(n.frame||n.getFrame())}),[n.blob,n.ffmpeg]),(0,e.useEffect)((function(){if(i&&(i.current&&!(navigator.platform.toUpperCase().indexOf("MAC")>=0))){var e=i.current;e.querySelectorAll("*").forEach((function(e){e.classList.add("screenity-scrollbar")}));var t=new MutationObserver((function(e){var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Ju(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;if("childList"===r.type){var i=Array.from(r.addedNodes),o=Array.from(r.removedNodes);i.forEach((function(e){e.nodeType===Node.ELEMENT_NODE&&e.classList.add("screenity-scrollbar")})),o.forEach((function(e){e.nodeType===Node.ELEMENT_NODE&&e.classList.remove("screenity-scrollbar")}))}}}catch(e){n.e(e)}finally{n.f()}}));return t.observe(e,{childList:!0,subtree:!0}),function(){t.disconnect()}}}),[i.current]),(0,e.useEffect)((function(){n.chunkCount>0&&(o.current="(".concat(Math.min(100,Math.round(n.chunkIndex/n.chunkCount*100)),"%)"))}),[n.chunkIndex,n.chunkCount]),e.createElement("div",{ref:i},e.createElement($u,null),e.createElement("video",null),n.ffmpeg&&n.ready&&"edit"===n.mode&&e.createElement(Qt,null),"edit"!=n.mode&&n.ready&&e.createElement(fl,null),!n.ready&&e.createElement("div",{className:"wrap"},e.createElement("img",{className:"logo",src:"/assets/logo-text.svg"}),e.createElement("div",{className:"middle-area"},e.createElement("img",{src:"/assets/record-tab-active.svg"}),e.createElement("div",{className:"title"},chrome.i18n.getMessage("sandboxProgressTitle")+" "+o.current),e.createElement("div",{className:"subtitle"},chrome.i18n.getMessage("sandboxProgressDescription")),"function"==typeof n.openModal&&e.createElement("div",{className:"button-stop",onClick:function(){n.openModal(chrome.i18n.getMessage("havingIssuesModalTitle"),chrome.i18n.getMessage("havingIssuesModalDescription"),chrome.i18n.getMessage("restoreRecording"),chrome.i18n.getMessage("havingIssuesModalButton2"),(function(){chrome.runtime.sendMessage({type:"restore-recording"})}),(function(){chrome.runtime.sendMessage({type:"report-bug"})}))}},chrome.i18n.getMessage("havingIssuesButton"))),e.createElement(qt,null),e.createElement("div",{className:"setupBackgroundSVG"})),e.createElement("style",null,'\n\t\t\t\t\n\t\t\t\t.wrap {\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t}\n\t\t\t\t.setupBackgroundSVG {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\ttop: 0px;\n\t\t\t\t\tleft: 0px;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbackground: url(/assets/helper/pattern-svg.svg) repeat;\n\t\t\t\t\tbackground-size: 62px 23.5px;\n\t\t\t\t\tanimation: moveBackground 138s linear infinite;\n\t\t\t\t}\n\t\t\t\t.button-stop {\n\t\t\t\t\tpadding: 10px 20px;\n\t\t\t\t\tbackground: #FFF;\n\t\t\t\t\tborder-radius: 30px;\n\t\t\t\t\tcolor: #29292F;\n\t\t\t\t\tfont-size: 14px;\n\t\t\t\t\tfont-weight: 500;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\tmargin-top: 0px;\n\t\t\t\t\tborder: 1px solid #E8E8E8;\n\t\t\t\t\tmargin-left: auto;\n\t\t\t\t\tmargin-right: auto;\n\t\t\t\t\tz-index: 999999;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t@keyframes moveBackground {\n\t\t\t\t\t0% {\n\t\t\t\t\t\tbackground-position: 0 0;\n\t\t\t\t\t}\n\t\t\t\t\t100% {\n\t\t\t\t\t\tbackground-position: 100% 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t.logo {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tbottom: 30px;\n\t\t\t\t\tleft: 0px;\n\t\t\t\t\tright: 0px;\n\t\t\t\t\tmargin: auto;\n\t\t\t\t\twidth: 120px;\n\t\t\t\t}\n\t\t\t\t.wrap {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbackground-color: #F6F7FB;\n\t\t\t\t}\n\t\t\t\t\t.middle-area {\n\t\t\t\t\t\tdisplay: flex;\n\t\t\t\t\t\tflex-direction: column;\n\t\t\t\t\t\talign-items: center;\n\t\t\t\t\t\tjustify-content: center;\n\t\t\t\t\t\theight: 100%;\n\t\t\t\t\t\tfont-family: Satoshi Medium, sans-serif;\n\t\t\t\t\t}\n\t\t\t\t\t.middle-area img {\n\t\t\t\t\t\twidth: 40px;\n\t\t\t\t\t\tmargin-bottom: 20px;\n\t\t\t\t\t}\n\t\t\t\t\t.title {\n\t\t\t\t\t\tfont-size: 24px;\n\t\t\t\t\t\tfont-weight: 700;\n\t\t\t\t\t\tcolor: #1A1A1A;\n\t\t\t\t\t\tmargin-bottom: 14px;\n\t\t\t\t\t\tfont-family: Satoshi-Medium, sans-serif;\n\t\t\t\t\t\ttext-align: center;\n\t\t\t\t\t}\n\t\t\t\t\t.subtitle {\n\t\t\t\t\t\tfont-size: 14px;\n\t\t\t\t\t\tfont-weight: 400;\n\t\t\t\t\t\tcolor: #6E7684;\n\t\t\t\t\t\tmargin-bottom: 24px;\n\t\t\t\t\t\tfont-family: Satoshi-Medium, sans-serif;\n\t\t\t\t\t\ttext-align: center;\n\t\t\t\t\t}\n\n\n.screenity-scrollbar *::-webkit-scrollbar, .screenity-scrollbar::-webkit-scrollbar {\n background-color: rgba(0,0,0,0);\n width: 16px;\n height: 16px;\n z-index: 999999;\n}\n.screenity-scrollbar *::-webkit-scrollbar-track, .screenity-scrollbar::-webkit-scrollbar-track {\n background-color: rgba(0,0,0,0);\n}\n.screenity-scrollbar *::-webkit-scrollbar-thumb, .screenity-scrollbar::-webkit-scrollbar-thumb {\n background-color: rgba(0,0,0,0);\n border-radius:16px;\n border:0px solid #fff;\n}\n.screenity-scrollbar *::-webkit-scrollbar-button, .screenity-scrollbar::-webkit-scrollbar-button {\n display:none;\n}\n.screenity-scrollbar *:hover::-webkit-scrollbar-thumb, .screenity-scrollbar:hover::-webkit-scrollbar-thumb {\n background-color: #a0a0a5;\n border:4px solid #fff;\n}\n::-webkit-scrollbar-thumb *:hover, ::-webkit-scrollbar-thumb:hover {\n background-color:#a0a0a5;\n border:4px solid #f4f4f4\n}\n.videoBanner {\n\theight: 40px!important;\n\twidth: 100%!important;\n\tposition: absolute!important;\n\ttop: 0px!important;\n\tleft: 0px!important;\n\tbackground-color: #3080F8!important;\n\tcolor: #FFF!important;\n\tfont-family: "Satoshi-Medium"!important;\n\tz-index: 99999999999!important;\n\ttext-align: center!important;\n\tdisplay: flex!important;\n\talign-items: center!important;\n\tjustify-content: center!important;\n\tflex-direction: row!important;\n\tgap: 6px!important;\n}\n\t\t\t\t\t\n\t\t\t\t\t'))};(0,n.render)(e.createElement(W,null,e.createElement(td,null)),window.document.querySelector("#app-container"))})()})();
\ No newline at end of file
diff --git a/src/manifest.json b/src/manifest.json
index 52b3aef..32a2e7b 100755
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -3,7 +3,7 @@
"name": "__MSG_extName__",
"description": "__MSG_extDesc__",
"default_locale": "en",
- "version": "3.1.14",
+ "version": "3.1.15",
"background": {
"service_worker": "background.bundle.js"
},
diff --git a/src/pages/Sandbox/context/ContentState.jsx b/src/pages/Sandbox/context/ContentState.jsx
index af81de5..15adfba 100644
--- a/src/pages/Sandbox/context/ContentState.jsx
+++ b/src/pages/Sandbox/context/ContentState.jsx
@@ -397,38 +397,35 @@ const ContentState = (props) => {
chunkCount.current = contentState.chunkCount;
}, [contentState.chunkCount]);
- const handleBatch = async (chunks, sendResponse) => {
- // Process chunks with a promise to ensure all async operations are completed
- await Promise.all(
- chunks.map(async (chunk) => {
- if (contentStateRef.current.chunkIndex >= chunkCount.current) {
- console.warn("Too many chunks received");
- // Handling for too many chunks
- return Promise.resolve(); // Resolve early for this case
- }
+ const handleBatch = (chunks, sendResponse) => {
+ // Process chunks asynchronously, but do not make this function async
+ (async () => {
+ try {
+ await Promise.all(
+ chunks.map(async (chunk) => {
+ if (contentStateRef.current.chunkIndex >= chunkCount.current) {
+ console.warn("Too many chunks received");
+ return; // Skip processing
+ }
- const chunkData = base64ToUint8Array(chunk.chunk);
- videoChunks.current.push(chunkData);
+ const chunkData = base64ToUint8Array(chunk.chunk);
+ videoChunks.current.push(chunkData);
- // Assuming setContentState doesn't need to be awaited
- setContentState((prevState) => ({
- ...prevState,
- chunkIndex: prevState.chunkIndex + 1,
- }));
+ setContentState((prevState) => ({
+ ...prevState,
+ chunkIndex: prevState.chunkIndex + 1,
+ }));
+ })
+ );
- return Promise.resolve(); // Resolve after processing each chunk
- })
- )
- .then(() => {
- // Only send response after all chunks are processed
sendResponse({ status: "ok" });
- })
- .catch((error) => {
+ } catch (error) {
console.error("Error processing batch", error);
- // Handle error scenario, possibly notify sender of failure
- });
+ // Optionally send error back: sendResponse({ status: "error", error })
+ }
+ })();
- return true; // Keep the messaging channel open for the response
+ return true; // Synchronously tell Chrome to keep the port open
};
// Check Chrome version
@@ -486,7 +483,7 @@ const ContentState = (props) => {
} else if (message.type === "make-video-tab") {
makeVideoTab(sendResponse, message);
- return;
+ return true;
} else if (message.type === "saved-to-drive") {
setContentState((prevContentState) => ({
...prevContentState,
@@ -535,10 +532,15 @@ const ContentState = (props) => {
);
useEffect(() => {
- chrome.runtime.onMessage.addListener(onChromeMessage);
+ const messageListener = (message, sender, sendResponse) => {
+ const shouldKeepPortOpen = onChromeMessage(message, sender, sendResponse);
+ return shouldKeepPortOpen === true;
+ };
+
+ chrome.runtime.onMessage.addListener(messageListener);
return () => {
- chrome.runtime.onMessage.removeListener(onChromeMessage);
+ chrome.runtime.onMessage.removeListener(messageListener);
};
}, []);
diff --git a/src/pages/Sandbox/layout/player/RightPanel.js b/src/pages/Sandbox/layout/player/RightPanel.js
index 572847e..97f33ad 100644
--- a/src/pages/Sandbox/layout/player/RightPanel.js
+++ b/src/pages/Sandbox/layout/player/RightPanel.js
@@ -5,7 +5,7 @@ import JSZip from "jszip";
import { ReactSVG } from "react-svg";
-const URL =
+const EXT_URL =
"chrome-extension://" + chrome.i18n.getMessage("@@extension_id") + "/assets/";
// Components
@@ -17,7 +17,6 @@ import { ContentStateContext } from "../../context/ContentState"; // Import the
const RightPanel = () => {
const [contentState, setContentState] = useContext(ContentStateContext); // Access the ContentState context
- const [webmFallback, setWebmFallback] = useState(false);
const contentStateRef = useRef(contentState);
const consoleErrorRef = useRef([]);
@@ -238,7 +237,7 @@ const RightPanel = () => {
{!contentState.fallback && contentState.offline && (
<div className={styles.alert}>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/no-internet.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/no-internet.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -256,7 +255,7 @@ const RightPanel = () => {
{contentState.fallback && (
<div className={styles.alert}>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/alert.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/alert.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -274,7 +273,7 @@ const RightPanel = () => {
contentState.duration <= contentState.editLimit && (
<div className={styles.alert}>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/alert.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/alert.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -301,7 +300,7 @@ const RightPanel = () => {
!contentState.updateChrome && (
<div className={styles.alert}>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/alert.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/alert.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -352,7 +351,7 @@ const RightPanel = () => {
!contentState.noffmpeg && (
<div className={styles.alert}>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/alert.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/alert.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -374,7 +373,6 @@ const RightPanel = () => {
</div>
</div>
)}
-
<div className={styles.section}>
<div className={styles.sectionTitle}>
{chrome.i18n.getMessage("sandboxEditTitle")}
@@ -392,7 +390,7 @@ const RightPanel = () => {
}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/trim.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/trim.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -412,7 +410,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
<div
@@ -427,7 +425,7 @@ const RightPanel = () => {
}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/crop.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/crop.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -447,7 +445,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
<div
@@ -462,7 +460,7 @@ const RightPanel = () => {
}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/audio.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/audio.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -482,7 +480,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
</div>
@@ -509,7 +507,7 @@ const RightPanel = () => {
disabled={contentState.saveDrive}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/drive.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/drive.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -528,7 +526,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
</div>
@@ -546,7 +544,7 @@ const RightPanel = () => {
disabled={contentState.isFfmpegRunning}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/download.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/download.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -559,7 +557,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
)}
@@ -578,7 +576,7 @@ const RightPanel = () => {
}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/download.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/download.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -600,7 +598,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
{!contentState.fallback && (
@@ -611,7 +609,7 @@ const RightPanel = () => {
disabled={contentState.isFfmpegRunning}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/download.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/download.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -628,7 +626,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
)}
@@ -647,7 +645,7 @@ const RightPanel = () => {
}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/gif.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/gif.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -669,7 +667,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
</div>
@@ -688,7 +686,7 @@ const RightPanel = () => {
}}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/download.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/download.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -699,7 +697,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
<div
@@ -710,7 +708,7 @@ const RightPanel = () => {
}}
>
<div className={styles.buttonLeft}>
- <ReactSVG src={URL + "editor/icons/flag.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/flag.svg"} />
</div>
<div className={styles.buttonMiddle}>
<div className={styles.buttonTitle}>
@@ -721,7 +719,7 @@ const RightPanel = () => {
</div>
</div>
<div className={styles.buttonRight}>
- <ReactSVG src={URL + "editor/icons/right-arrow.svg"} />
+ <ReactSVG src={EXT_URL + "editor/icons/right-arrow.svg"} />
</div>
</div>
</div>