var h1=Object.defineProperty,d1=Object.defineProperties;var p1=Object.getOwnPropertyDescriptors;var fs=Object.getOwnPropertySymbols;var bh=Object.prototype.hasOwnProperty,wh=Object.prototype.propertyIsEnumerable;var g1=r=>{throw TypeError(r)},dn=Math.pow,au=(r,t,e)=>t in r?h1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,st=(r,t)=>{for(var e in t||(t={}))bh.call(t,e)&&au(r,e,t[e]);if(fs)for(var e of fs(t))wh.call(t,e)&&au(r,e,t[e]);return r},Ut=(r,t)=>d1(r,p1(t));var hs=(r,t)=>{var e={};for(var n in r)bh.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&fs)for(var n of fs(r))t.indexOf(n)<0&&wh.call(r,n)&&(e[n]=r[n]);return e};var Se=(r,t,e)=>au(r,typeof t!="symbol"?t+"":t,e);var Xo=(r,t,e)=>t.has(r)?g1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e);var tt=(r,t,e)=>new Promise((n,i)=>{var l=d=>{try{h(e.next(d))}catch(g){i(g)}},c=d=>{try{h(e.throw(d))}catch(g){i(g)}},h=d=>d.done?n(d.value):Promise.resolve(d.value).then(l,c);h((e=e.apply(r,t)).next())});function m1(r,t){for(var e=0;en[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var bt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function v1(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var y1={};/*! * howler.js v2.2.4 * howlerjs.com * * (c) 2013-2020, James Simpson of GoldFire Studios * goldfirestudios.com * * MIT License */(function(r){(function(){var t=function(){this.init()};t.prototype={init:function(){var a=this||e;return a._counter=1e3,a._html5AudioPool=[],a.html5PoolSize=10,a._codecs={},a._howls=[],a._muted=!1,a._volume=1,a._canPlayEvent="canplaythrough",a._navigator=typeof window!="undefined"&&window.navigator?window.navigator:null,a.masterGain=null,a.noAudio=!1,a.usingWebAudio=!0,a.autoSuspend=!0,a.ctx=null,a.autoUnlock=!0,a._setup(),a},volume:function(a){var u=this||e;if(a=parseFloat(a),u.ctx||p(),typeof a!="undefined"&&a>=0&&a<=1){if(u._volume=a,u._muted)return u;u.usingWebAudio&&u.masterGain.gain.setValueAtTime(a,e.ctx.currentTime);for(var f=0;f=0;u--)a._howls[u].unload();return a.usingWebAudio&&a.ctx&&typeof a.ctx.close!="undefined"&&(a.ctx.close(),a.ctx=null,p()),a},codecs:function(a){return(this||e)._codecs[a.replace(/^x-/,"")]},_setup:function(){var a=this||e;if(a.state=a.ctx&&a.ctx.state||"suspended",a._autoSuspend(),!a.usingWebAudio)if(typeof Audio!="undefined")try{var u=new Audio;typeof u.oncanplaythrough=="undefined"&&(a._canPlayEvent="canplay")}catch(f){a.noAudio=!0}else a.noAudio=!0;try{var u=new Audio;u.muted&&(a.noAudio=!0)}catch(f){}return a.noAudio||a._setupCodecs(),a},_setupCodecs:function(){var a=this||e,u=null;try{u=typeof Audio!="undefined"?new Audio:null}catch(x){return a}if(!u||typeof u.canPlayType!="function")return a;var f=u.canPlayType("audio/mpeg;").replace(/^no$/,""),y=a._navigator?a._navigator.userAgent:"",_=y.match(/OPR\/(\d+)/g),b=_&&parseInt(_[0].split("/")[1],10)<33,v=y.indexOf("Safari")!==-1&&y.indexOf("Chrome")===-1,w=y.match(/Version\/(.*?) /),T=v&&w&&parseInt(w[1],10)<15;return a._codecs={mp3:!!(!b&&(f||u.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!f,opus:!!u.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!u.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!u.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(u.canPlayType('audio/wav; codecs="1"')||u.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!u.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!u.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(u.canPlayType("audio/x-m4a;")||u.canPlayType("audio/m4a;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(u.canPlayType("audio/x-m4b;")||u.canPlayType("audio/m4b;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(u.canPlayType("audio/x-mp4;")||u.canPlayType("audio/mp4;")||u.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!T&&u.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!T&&u.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!u.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(u.canPlayType("audio/x-flac;")||u.canPlayType("audio/flac;")).replace(/^no$/,"")},a},_unlockAudio:function(){var a=this||e;if(!(a._audioUnlocked||!a.ctx)){a._audioUnlocked=!1,a.autoUnlock=!1,!a._mobileUnloaded&&a.ctx.sampleRate!==44100&&(a._mobileUnloaded=!0,a.unload()),a._scratchBuffer=a.ctx.createBuffer(1,1,22050);var u=function(f){for(;a._html5AudioPool.length0?v._seek:f._sprite[a][0]/1e3),x=Math.max(0,(f._sprite[a][0]+f._sprite[a][1])/1e3-T),S=x*1e3/Math.abs(v._rate),C=f._sprite[a][0]/1e3,A=(f._sprite[a][0]+f._sprite[a][1])/1e3;v._sprite=a,v._ended=!1;var R=function(){v._paused=!1,v._seek=T,v._start=C,v._stop=A,v._loop=!!(v._loop||f._sprite[a][2])};if(T>=A){f._ended(v);return}var L=v._node;if(f._webAudio){var M=function(){f._playLock=!1,R(),f._refreshBuffer(v);var j=v._muted||f._muted?0:v._volume;L.gain.setValueAtTime(j,e.ctx.currentTime),v._playStart=e.ctx.currentTime,typeof L.bufferSource.start=="undefined"?v._loop?L.bufferSource.noteGrainOn(0,T,86400):L.bufferSource.noteGrainOn(0,T,x):v._loop?L.bufferSource.start(0,T,86400):L.bufferSource.start(0,T,x),S!==1/0&&(f._endTimers[v._id]=setTimeout(f._ended.bind(f,v),S)),u||setTimeout(function(){f._emit("play",v._id),f._loadQueue()},0)};e.state==="running"&&e.ctx.state!=="interrupted"?M():(f._playLock=!0,f.once("resume",M),f._clearTimer(v._id))}else{var k=function(){L.currentTime=T,L.muted=v._muted||f._muted||e._muted||L.muted,L.volume=v._volume*e.volume(),L.playbackRate=v._rate;try{var j=L.play();if(j&&typeof Promise!="undefined"&&(j instanceof Promise||typeof j.then=="function")?(f._playLock=!0,R(),j.then(function(){f._playLock=!1,L._unlocked=!0,u?f._loadQueue():f._emit("play",v._id)}).catch(function(){f._playLock=!1,f._emit("playerror",v._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),v._ended=!0,v._paused=!0})):u||(f._playLock=!1,R(),f._emit("play",v._id)),L.playbackRate=v._rate,L.paused){f._emit("playerror",v._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}a!=="__default"||v._loop?f._endTimers[v._id]=setTimeout(f._ended.bind(f,v),S):(f._endTimers[v._id]=function(){f._ended(v),L.removeEventListener("ended",f._endTimers[v._id],!1)},L.addEventListener("ended",f._endTimers[v._id],!1))}catch(W){f._emit("playerror",v._id,W)}};L.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(L.src=f._src,L.load());var P=window&&window.ejecta||!L.readyState&&e._navigator.isCocoonJS;if(L.readyState>=3||P)k();else{f._playLock=!0,f._state="loading";var I=function(){f._state="loaded",k(),L.removeEventListener(e._canPlayEvent,I,!1)};L.addEventListener(e._canPlayEvent,I,!1),f._clearTimer(v._id)}}return v._id},pause:function(a){var u=this;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"pause",action:function(){u.pause(a)}}),u;for(var f=u._getSoundIds(a),y=0;y=0?y=parseInt(u[0],10):f=parseFloat(u[0])}else u.length>=2&&(f=parseFloat(u[0]),y=parseInt(u[1],10));var v;if(typeof f!="undefined"&&f>=0&&f<=1){if(a._state!=="loaded"||a._playLock)return a._queue.push({event:"volume",action:function(){a.volume.apply(a,u)}}),a;typeof y=="undefined"&&(a._volume=f),y=a._getSoundIds(y);for(var w=0;w0?y/x:y),C=Date.now();a._fadeTo=f,a._interval=setInterval(function(){var A=(Date.now()-C)/y;C=Date.now(),w+=T*A,w=Math.round(w*100)/100,T<0?w=Math.max(f,w):w=Math.min(f,w),v._webAudio?a._volume=w:v.volume(w,a._id,!0),b&&(v._volume=w),(fu&&w>=f)&&(clearInterval(a._interval),a._interval=null,a._fadeTo=null,v.volume(f,a._id),v._emit("fade",a._id))},S)},_stopFade:function(a){var u=this,f=u._soundById(a);return f&&f._interval&&(u._webAudio&&f._node.gain.cancelScheduledValues(e.ctx.currentTime),clearInterval(f._interval),f._interval=null,u.volume(f._fadeTo,a),f._fadeTo=null,u._emit("fade",a)),u},loop:function(){var a=this,u=arguments,f,y,_;if(u.length===0)return a._loop;if(u.length===1)if(typeof u[0]=="boolean")f=u[0],a._loop=f;else return _=a._soundById(parseInt(u[0],10)),_?_._loop:!1;else u.length===2&&(f=u[0],y=parseInt(u[1],10));for(var b=a._getSoundIds(y),v=0;v=0?y=parseInt(u[0],10):f=parseFloat(u[0])}else u.length===2&&(f=parseFloat(u[0]),y=parseInt(u[1],10));var v;if(typeof f=="number"){if(a._state!=="loaded"||a._playLock)return a._queue.push({event:"rate",action:function(){a.rate.apply(a,u)}}),a;typeof y=="undefined"&&(a._rate=f),y=a._getSoundIds(y);for(var w=0;w=0?y=parseInt(u[0],10):a._sounds.length&&(y=a._sounds[0]._id,f=parseFloat(u[0]))}else u.length===2&&(f=parseFloat(u[0]),y=parseInt(u[1],10));if(typeof y=="undefined")return 0;if(typeof f=="number"&&(a._state!=="loaded"||a._playLock))return a._queue.push({event:"seek",action:function(){a.seek.apply(a,u)}}),a;var v=a._soundById(y);if(v)if(typeof f=="number"&&f>=0){var w=a.playing(y);w&&a.pause(y,!0),v._seek=f,v._ended=!1,a._clearTimer(y),!a._webAudio&&v._node&&!isNaN(v._node.duration)&&(v._node.currentTime=f);var T=function(){w&&a.play(y,!0),a._emit("seek",y)};if(w&&!a._webAudio){var x=function(){a._playLock?setTimeout(x,0):T()};setTimeout(x,0)}else T()}else if(a._webAudio){var S=a.playing(y)?e.ctx.currentTime-v._playStart:0,C=v._rateSeek?v._rateSeek-v._seek:0;return v._seek+(C+S*Math.abs(v._rate))}else return v._node.currentTime;return a},playing:function(a){var u=this;if(typeof a=="number"){var f=u._soundById(a);return f?!f._paused:!1}for(var y=0;y=0&&e._howls.splice(y,1);var _=!0;for(f=0;f=0){_=!1;break}return l&&_&&delete l[a._src],e.noAudio=!1,a._state="unloaded",a._sounds=[],a=null,null},on:function(a,u,f,y){var _=this,b=_["_on"+a];return typeof u=="function"&&b.push(y?{id:f,fn:u,once:y}:{id:f,fn:u}),_},off:function(a,u,f){var y=this,_=y["_on"+a],b=0;if(typeof u=="number"&&(f=u,u=null),u||f)for(b=0;b<_.length;b++){var v=f===_[b].id;if(u===_[b].fn&&v||!u&&v){_.splice(b,1);break}}else if(a)y["_on"+a]=[];else{var w=Object.keys(y);for(b=0;b=0;b--)(!_[b].id||_[b].id===u||a==="load")&&(setTimeout(function(v){v.call(this,u,f)}.bind(y,_[b].fn),0),_[b].once&&y.off(a,_[b].fn,_[b].id));return y._loadQueue(a),y},_loadQueue:function(a){var u=this;if(u._queue.length>0){var f=u._queue[0];f.event===a&&(u._queue.shift(),u._loadQueue()),a||f.action()}return u},_ended:function(a){var u=this,f=a._sprite;if(!u._webAudio&&a._node&&!a._node.paused&&!a._node.ended&&a._node.currentTime=0;y--){if(f<=u)return;a._sounds[y]._ended&&(a._webAudio&&a._sounds[y]._node&&a._sounds[y]._node.disconnect(0),a._sounds.splice(y,1),f--)}}},_getSoundIds:function(a){var u=this;if(typeof a=="undefined"){for(var f=[],y=0;y=0;if(!a.bufferSource)return u;if(e._scratchBuffer&&a.bufferSource&&(a.bufferSource.onended=null,a.bufferSource.disconnect(0),f))try{a.bufferSource.buffer=e._scratchBuffer}catch(y){}return a.bufferSource=null,u},_clearSound:function(a){var u=/MSIE |Trident\//.test(e._navigator&&e._navigator.userAgent);u||(a.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var i=function(a){this._parent=a,this.init()};i.prototype={init:function(){var a=this,u=a._parent;return a._muted=u._muted,a._loop=u._loop,a._volume=u._volume,a._rate=u._rate,a._seek=0,a._paused=!0,a._ended=!0,a._sprite="__default",a._id=++e._counter,u._sounds.push(a),a.create(),a},create:function(){var a=this,u=a._parent,f=e._muted||a._muted||a._parent._muted?0:a._volume;return u._webAudio?(a._node=typeof e.ctx.createGain=="undefined"?e.ctx.createGainNode():e.ctx.createGain(),a._node.gain.setValueAtTime(f,e.ctx.currentTime),a._node.paused=!0,a._node.connect(e.masterGain)):e.noAudio||(a._node=e._obtainHtml5Audio(),a._errorFn=a._errorListener.bind(a),a._node.addEventListener("error",a._errorFn,!1),a._loadFn=a._loadListener.bind(a),a._node.addEventListener(e._canPlayEvent,a._loadFn,!1),a._endFn=a._endListener.bind(a),a._node.addEventListener("ended",a._endFn,!1),a._node.src=u._src,a._node.preload=u._preload===!0?"auto":u._preload,a._node.volume=f*e.volume(),a._node.load()),a},reset:function(){var a=this,u=a._parent;return a._muted=u._muted,a._loop=u._loop,a._volume=u._volume,a._rate=u._rate,a._seek=0,a._rateSeek=0,a._paused=!0,a._ended=!0,a._sprite="__default",a._id=++e._counter,a},_errorListener:function(){var a=this;a._parent._emit("loaderror",a._id,a._node.error?a._node.error.code:0),a._node.removeEventListener("error",a._errorFn,!1)},_loadListener:function(){var a=this,u=a._parent;u._duration=Math.ceil(a._node.duration*10)/10,Object.keys(u._sprite).length===0&&(u._sprite={__default:[0,u._duration*1e3]}),u._state!=="loaded"&&(u._state="loaded",u._emit("load"),u._loadQueue()),a._node.removeEventListener(e._canPlayEvent,a._loadFn,!1)},_endListener:function(){var a=this,u=a._parent;u._duration===1/0&&(u._duration=Math.ceil(a._node.duration*10)/10,u._sprite.__default[1]===1/0&&(u._sprite.__default[1]=u._duration*1e3),u._ended(a)),a._node.removeEventListener("ended",a._endFn,!1)}};var l={},c=function(a){var u=a._src;if(l[u]){a._duration=l[u].duration,g(a);return}if(/^data:[^;]+;base64,/.test(u)){for(var f=atob(u.split(",")[1]),y=new Uint8Array(f.length),_=0;_0?(l[u._src]=_,g(u,_)):f()};typeof Promise!="undefined"&&e.ctx.decodeAudioData.length===1?e.ctx.decodeAudioData(a).then(y).catch(f):e.ctx.decodeAudioData(a,y,f)},g=function(a,u){u&&!a._duration&&(a._duration=u.duration),Object.keys(a._sprite).length===0&&(a._sprite={__default:[0,a._duration*1e3]}),a._state!=="loaded"&&(a._state="loaded",a._emit("load"),a._loadQueue())},p=function(){if(e.usingWebAudio){try{typeof AudioContext!="undefined"?e.ctx=new AudioContext:typeof webkitAudioContext!="undefined"?e.ctx=new webkitAudioContext:e.usingWebAudio=!1}catch(_){e.usingWebAudio=!1}e.ctx||(e.usingWebAudio=!1);var a=/iP(hone|od|ad)/.test(e._navigator&&e._navigator.platform),u=e._navigator&&e._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),f=u?parseInt(u[1],10):null;if(a&&f&&f<9){var y=/safari/.test(e._navigator&&e._navigator.userAgent.toLowerCase());e._navigator&&!y&&(e.usingWebAudio=!1)}e.usingWebAudio&&(e.masterGain=typeof e.ctx.createGain=="undefined"?e.ctx.createGainNode():e.ctx.createGain(),e.masterGain.gain.setValueAtTime(e._muted?0:e._volume,e.ctx.currentTime),e.masterGain.connect(e.ctx.destination)),e._setup()}};r.Howler=e,r.Howl=n,typeof bt!="undefined"?(bt.HowlerGlobal=t,bt.Howler=e,bt.Howl=n,bt.Sound=i):typeof window!="undefined"&&(window.HowlerGlobal=t,window.Howler=e,window.Howl=n,window.Sound=i)})();/*! * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. * * howler.js v2.2.4 * howlerjs.com * * (c) 2013-2020, James Simpson of GoldFire Studios * goldfirestudios.com * * MIT License */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var i=n._howls.length-1;i>=0;i--)n._howls[i].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,i){var l=this;if(!l.ctx||!l.ctx.listener)return l;if(n=typeof n!="number"?l._pos[1]:n,i=typeof i!="number"?l._pos[2]:i,typeof e=="number")l._pos=[e,n,i],typeof l.ctx.listener.positionX!="undefined"?(l.ctx.listener.positionX.setTargetAtTime(l._pos[0],Howler.ctx.currentTime,.1),l.ctx.listener.positionY.setTargetAtTime(l._pos[1],Howler.ctx.currentTime,.1),l.ctx.listener.positionZ.setTargetAtTime(l._pos[2],Howler.ctx.currentTime,.1)):l.ctx.listener.setPosition(l._pos[0],l._pos[1],l._pos[2]);else return l._pos;return l},HowlerGlobal.prototype.orientation=function(e,n,i,l,c,h){var d=this;if(!d.ctx||!d.ctx.listener)return d;var g=d._orientation;if(n=typeof n!="number"?g[1]:n,i=typeof i!="number"?g[2]:i,l=typeof l!="number"?g[3]:l,c=typeof c!="number"?g[4]:c,h=typeof h!="number"?g[5]:h,typeof e=="number")d._orientation=[e,n,i,l,c,h],typeof d.ctx.listener.forwardX!="undefined"?(d.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),d.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),d.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),d.ctx.listener.upX.setTargetAtTime(l,Howler.ctx.currentTime,.1),d.ctx.listener.upY.setTargetAtTime(c,Howler.ctx.currentTime,.1),d.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):d.ctx.listener.setOrientation(e,n,i,l,c,h);else return g;return d},Howl.prototype.init=function(e){return function(n){var i=this;return i._orientation=n.orientation||[1,0,0],i._stereo=n.stereo||null,i._pos=n.pos||null,i._pannerAttr={coneInnerAngle:typeof n.coneInnerAngle!="undefined"?n.coneInnerAngle:360,coneOuterAngle:typeof n.coneOuterAngle!="undefined"?n.coneOuterAngle:360,coneOuterGain:typeof n.coneOuterGain!="undefined"?n.coneOuterGain:0,distanceModel:typeof n.distanceModel!="undefined"?n.distanceModel:"inverse",maxDistance:typeof n.maxDistance!="undefined"?n.maxDistance:1e4,panningModel:typeof n.panningModel!="undefined"?n.panningModel:"HRTF",refDistance:typeof n.refDistance!="undefined"?n.refDistance:1,rolloffFactor:typeof n.rolloffFactor!="undefined"?n.rolloffFactor:1},i._onstereo=n.onstereo?[{fn:n.onstereo}]:[],i._onpos=n.onpos?[{fn:n.onpos}]:[],i._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,n){var i=this;if(!i._webAudio)return i;if(i._state!=="loaded")return i._queue.push({event:"stereo",action:function(){i.stereo(e,n)}}),i;var l=typeof Howler.ctx.createStereoPanner=="undefined"?"spatial":"stereo";if(typeof n=="undefined")if(typeof e=="number")i._stereo=e,i._pos=[e,0,0];else return i._stereo;for(var c=i._getSoundIds(n),h=0;h0){const t=new Uint8Array(this._pieces);this._parts.push(t),this._pieces=[]}}toArrayBuffer(){const t=[];for(const e of this._parts)t.push(e);return b1(t).buffer}}function b1(r){let t=0;for(const i of r)t+=i.byteLength;const e=new Uint8Array(t);let n=0;for(const i of r){const l=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);e.set(l,n),n+=i.byteLength}return e}function vd(r){return new w1(r).unpack()}function yd(r){const t=new x1,e=t.pack(r);return e instanceof Promise?e.then(()=>t.getBuffer()):t.getBuffer()}class w1{constructor(t){this.index=0,this.dataBuffer=t,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){const t=this.unpack_uint8();if(t<128)return t;if((t^224)<32)return(t^224)-32;let e;if((e=t^160)<=15)return this.unpack_raw(e);if((e=t^176)<=15)return this.unpack_string(e);if((e=t^144)<=15)return this.unpack_array(e);if((e=t^128)<=15)return this.unpack_map(e);switch(t){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}}unpack_uint8(){const t=this.dataView[this.index]&255;return this.index++,t}unpack_uint16(){const t=this.read(2),e=(t[0]&255)*256+(t[1]&255);return this.index+=2,e}unpack_uint32(){const t=this.read(4),e=((t[0]*256+t[1])*256+t[2])*256+t[3];return this.index+=4,e}unpack_uint64(){const t=this.read(8),e=((((((t[0]*256+t[1])*256+t[2])*256+t[3])*256+t[4])*256+t[5])*256+t[6])*256+t[7];return this.index+=8,e}unpack_int8(){const t=this.unpack_uint8();return t<128?t:t-256}unpack_int16(){const t=this.unpack_uint16();return t<32768?t:t-65536}unpack_int32(){const t=this.unpack_uint32();return t>31,n=(t>>23&255)-127,i=t&8388607|8388608;return(e===0?1:-1)*i*dn(2,n-23)}unpack_double(){const t=this.unpack_uint32(),e=this.unpack_uint32(),n=t>>31,i=(t>>20&2047)-1023,c=(t&1048575|1048576)*dn(2,i-20)+e*dn(2,i-52);return(n===0?1:-1)*c}read(t){const e=this.index;if(e+t<=this.length)return this.dataView.subarray(e,e+t);throw new Error("BinaryPackFailure: read index out of range")}}class x1{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(t){if(typeof t=="string")this.pack_string(t);else if(typeof t=="number")Math.floor(t)===t?this.pack_integer(t):this.pack_double(t);else if(typeof t=="boolean")t===!0?this._bufferBuilder.append(195):t===!1&&this._bufferBuilder.append(194);else if(t===void 0)this._bufferBuilder.append(192);else if(typeof t=="object")if(t===null)this._bufferBuilder.append(192);else{const e=t.constructor;if(t instanceof Array){const n=this.pack_array(t);if(n instanceof Promise)return n.then(()=>this._bufferBuilder.flush())}else if(t instanceof ArrayBuffer)this.pack_bin(new Uint8Array(t));else if("BYTES_PER_ELEMENT"in t){const n=t;this.pack_bin(new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}else if(t instanceof Date)this.pack_string(t.toString());else{if(t instanceof Blob)return t.arrayBuffer().then(n=>{this.pack_bin(new Uint8Array(n)),this._bufferBuilder.flush()});if(e==Object||e.toString().startsWith("class")){const n=this.pack_object(t);if(n instanceof Promise)return n.then(()=>this._bufferBuilder.flush())}else throw new Error(`Type "${e.toString()}" not yet supported`)}}else throw new Error(`Type "${typeof t}" not yet supported`);this._bufferBuilder.flush()}pack_bin(t){const e=t.length;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this._bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this._bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this._bufferBuilder.append_buffer(t)}pack_string(t){const e=this._textEncoder.encode(t),n=e.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(217),this.pack_uint32(n);else throw new Error("Invalid length");this._bufferBuilder.append_buffer(e)}pack_array(t){const e=t.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this._bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this._bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");const n=i=>{if(in(i+1)):n(i+1)}};return n(0)}pack_integer(t){if(t>=-32&&t<=127)this._bufferBuilder.append(t&255);else if(t>=0&&t<=255)this._bufferBuilder.append(204),this.pack_uint8(t);else if(t>=-128&&t<=127)this._bufferBuilder.append(208),this.pack_int8(t);else if(t>=0&&t<=65535)this._bufferBuilder.append(205),this.pack_uint16(t);else if(t>=-32768&&t<=32767)this._bufferBuilder.append(209),this.pack_int16(t);else if(t>=0&&t<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(t);else if(t>=-2147483648&&t<=2147483647)this._bufferBuilder.append(210),this.pack_int32(t);else if(t>=-9223372036854776e3&&t<=9223372036854776e3)this._bufferBuilder.append(211),this.pack_int64(t);else if(t>=0&&t<=18446744073709552e3)this._bufferBuilder.append(207),this.pack_uint64(t);else throw new Error("Invalid integer")}pack_double(t){let e=0;t<0&&(e=1,t=-t);const n=Math.floor(Math.log(t)/Math.LN2),i=t/dn(2,n)-1,l=Math.floor(i*dn(2,52)),c=dn(2,32),h=e<<31|n+1023<<20|l/c&1048575,d=l%c;this._bufferBuilder.append(203),this.pack_int32(h),this.pack_int32(d)}pack_object(t){const e=Object.keys(t),n=e.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else if(n<=4294967295)this._bufferBuilder.append(223),this.pack_uint32(n);else throw new Error("Invalid length");const i=l=>{if(li(l+1))}return i(l+1)}};return i(0)}pack_uint8(t){this._bufferBuilder.append(t)}pack_uint16(t){this._bufferBuilder.append(t>>8),this._bufferBuilder.append(t&255)}pack_uint32(t){const e=t&4294967295;this._bufferBuilder.append((e&4278190080)>>>24),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255)}pack_uint64(t){const e=t/4294967296,n=t%dn(2,32);this._bufferBuilder.append((e&4278190080)>>>24),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}pack_int8(t){this._bufferBuilder.append(t&255)}pack_int16(t){this._bufferBuilder.append((t&65280)>>8),this._bufferBuilder.append(t&255)}pack_int32(t){this._bufferBuilder.append(t>>>24&255),this._bufferBuilder.append((t&16711680)>>>16),this._bufferBuilder.append((t&65280)>>>8),this._bufferBuilder.append(t&255)}pack_int64(t){const e=Math.floor(t/4294967296),n=t%dn(2,32);this._bufferBuilder.append((e&4278190080)>>>24),this._bufferBuilder.append((e&16711680)>>>16),this._bufferBuilder.append((e&65280)>>>8),this._bufferBuilder.append(e&255),this._bufferBuilder.append((n&4278190080)>>>24),this._bufferBuilder.append((n&16711680)>>>16),this._bufferBuilder.append((n&65280)>>>8),this._bufferBuilder.append(n&255)}constructor(){this._bufferBuilder=new _1,this._textEncoder=new TextEncoder}}let _d=!0,bd=!0;function na(r,t,e){const n=r.match(t);return n&&n.length>=e&&parseFloat(n[e],10)}function bi(r,t,e){if(!r.RTCPeerConnection)return;const n=r.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(c,h){if(c!==t)return i.apply(this,arguments);const d=g=>{const p=e(g);p&&(h.handleEvent?h.handleEvent(p):h(p))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(h,d),i.apply(this,[c,d])};const l=n.removeEventListener;n.removeEventListener=function(c,h){if(c!==t||!this._eventMap||!this._eventMap[t])return l.apply(this,arguments);if(!this._eventMap[t].has(h))return l.apply(this,arguments);const d=this._eventMap[t].get(h);return this._eventMap[t].delete(h),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,l.apply(this,[c,d])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(c){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),c&&this.addEventListener(t,this["_on"+t]=c)},enumerable:!0,configurable:!0})}function T1(r){return typeof r!="boolean"?new Error("Argument type: "+typeof r+". Please use a boolean."):(_d=r,r?"adapter.js logging disabled":"adapter.js logging enabled")}function S1(r){return typeof r!="boolean"?new Error("Argument type: "+typeof r+". Please use a boolean."):(bd=!r,"adapter.js deprecation warnings "+(r?"disabled":"enabled"))}function wd(){if(typeof window=="object"){if(_d)return;typeof console!="undefined"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Xu(r,t){bd&&console.warn(r+" is deprecated, please use "+t+" instead.")}function O1(r){const t={browser:null,version:null};if(typeof r=="undefined"||!r.navigator||!r.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:e}=r;if(e.userAgentData&&e.userAgentData.brands){const n=e.userAgentData.brands.find(i=>i.brand==="Chromium");if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(e.mozGetUserMedia)t.browser="firefox",t.version=parseInt(na(e.userAgent,/Firefox\/(\d+)\./,1));else if(e.webkitGetUserMedia||r.isSecureContext===!1&&r.webkitRTCPeerConnection)t.browser="chrome",t.version=parseInt(na(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(r.RTCPeerConnection&&e.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser="safari",t.version=parseInt(na(e.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=r.RTCRtpTransceiver&&"currentDirection"in r.RTCRtpTransceiver.prototype,t._safariVersion=na(e.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser="Not a supported browser.",t;return t}function xh(r){return Object.prototype.toString.call(r)==="[object Object]"}function xd(r){return xh(r)?Object.keys(r).reduce(function(t,e){const n=xh(r[e]),i=n?xd(r[e]):r[e],l=n&&!Object.keys(i).length;return i===void 0||l?t:Object.assign(t,{[e]:i})},{}):r}function wu(r,t,e){!t||e.has(t.id)||(e.set(t.id,t),Object.keys(t).forEach(n=>{n.endsWith("Id")?wu(r,r.get(t[n]),e):n.endsWith("Ids")&&t[n].forEach(i=>{wu(r,r.get(i),e)})}))}function Th(r,t,e){const n=e?"outbound-rtp":"inbound-rtp",i=new Map;if(t===null)return i;const l=[];return r.forEach(c=>{c.type==="track"&&c.trackIdentifier===t.id&&l.push(c)}),l.forEach(c=>{r.forEach(h=>{h.type===n&&h.trackId===c.id&&wu(r,h,i)})}),i}const Sh=wd;function Td(r,t){const e=r&&r.navigator;if(!e.mediaDevices)return;const n=function(h){if(typeof h!="object"||h.mandatory||h.optional)return h;const d={};return Object.keys(h).forEach(g=>{if(g==="require"||g==="advanced"||g==="mediaSource")return;const p=typeof h[g]=="object"?h[g]:{ideal:h[g]};p.exact!==void 0&&typeof p.exact=="number"&&(p.min=p.max=p.exact);const a=function(u,f){return u?u+f.charAt(0).toUpperCase()+f.slice(1):f==="deviceId"?"sourceId":f};if(p.ideal!==void 0){d.optional=d.optional||[];let u={};typeof p.ideal=="number"?(u[a("min",g)]=p.ideal,d.optional.push(u),u={},u[a("max",g)]=p.ideal,d.optional.push(u)):(u[a("",g)]=p.ideal,d.optional.push(u))}p.exact!==void 0&&typeof p.exact!="number"?(d.mandatory=d.mandatory||{},d.mandatory[a("",g)]=p.exact):["min","max"].forEach(u=>{p[u]!==void 0&&(d.mandatory=d.mandatory||{},d.mandatory[a(u,g)]=p[u])})}),h.advanced&&(d.optional=(d.optional||[]).concat(h.advanced)),d},i=function(h,d){if(t.version>=61)return d(h);if(h=JSON.parse(JSON.stringify(h)),h&&typeof h.audio=="object"){const g=function(p,a,u){a in p&&!(u in p)&&(p[u]=p[a],delete p[a])};h=JSON.parse(JSON.stringify(h)),g(h.audio,"autoGainControl","googAutoGainControl"),g(h.audio,"noiseSuppression","googNoiseSuppression"),h.audio=n(h.audio)}if(h&&typeof h.video=="object"){let g=h.video.facingMode;g=g&&(typeof g=="object"?g:{ideal:g});const p=t.version<66;if(g&&(g.exact==="user"||g.exact==="environment"||g.ideal==="user"||g.ideal==="environment")&&!(e.mediaDevices.getSupportedConstraints&&e.mediaDevices.getSupportedConstraints().facingMode&&!p)){delete h.video.facingMode;let a;if(g.exact==="environment"||g.ideal==="environment"?a=["back","rear"]:(g.exact==="user"||g.ideal==="user")&&(a=["front"]),a)return e.mediaDevices.enumerateDevices().then(u=>{u=u.filter(y=>y.kind==="videoinput");let f=u.find(y=>a.some(_=>y.label.toLowerCase().includes(_)));return!f&&u.length&&a.includes("back")&&(f=u[u.length-1]),f&&(h.video.deviceId=g.exact?{exact:f.deviceId}:{ideal:f.deviceId}),h.video=n(h.video),Sh("chrome: "+JSON.stringify(h)),d(h)})}h.video=n(h.video)}return Sh("chrome: "+JSON.stringify(h)),d(h)},l=function(h){return t.version>=64?h:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[h.name]||h.name,message:h.message,constraint:h.constraint||h.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},c=function(h,d,g){i(h,p=>{e.webkitGetUserMedia(p,d,a=>{g&&g(l(a))})})};if(e.getUserMedia=c.bind(e),e.mediaDevices.getUserMedia){const h=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(d){return i(d,g=>h(g).then(p=>{if(g.audio&&!p.getAudioTracks().length||g.video&&!p.getVideoTracks().length)throw p.getTracks().forEach(a=>{a.stop()}),new DOMException("","NotFoundError");return p},p=>Promise.reject(l(p))))}}}function Sd(r){r.MediaStream=r.MediaStream||r.webkitMediaStream}function Od(r){if(typeof r=="object"&&r.RTCPeerConnection&&!("ontrack"in r.RTCPeerConnection.prototype)){Object.defineProperty(r.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=r.RTCPeerConnection.prototype.setRemoteDescription;r.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",i=>{let l;r.RTCPeerConnection.prototype.getReceivers?l=this.getReceivers().find(h=>h.track&&h.track.id===i.track.id):l={track:i.track};const c=new Event("track");c.track=i.track,c.receiver=l,c.transceiver={receiver:l},c.streams=[n.stream],this.dispatchEvent(c)}),n.stream.getTracks().forEach(i=>{let l;r.RTCPeerConnection.prototype.getReceivers?l=this.getReceivers().find(h=>h.track&&h.track.id===i.id):l={track:i};const c=new Event("track");c.track=i,c.receiver=l,c.transceiver={receiver:l},c.streams=[n.stream],this.dispatchEvent(c)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else bi(r,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function Ed(r){if(typeof r=="object"&&r.RTCPeerConnection&&!("getSenders"in r.RTCPeerConnection.prototype)&&"createDTMFSender"in r.RTCPeerConnection.prototype){const t=function(i,l){return{track:l,get dtmf(){return this._dtmf===void 0&&(l.kind==="audio"?this._dtmf=i.createDTMFSender(l):this._dtmf=null),this._dtmf},_pc:i}};if(!r.RTCPeerConnection.prototype.getSenders){r.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=r.RTCPeerConnection.prototype.addTrack;r.RTCPeerConnection.prototype.addTrack=function(h,d){let g=i.apply(this,arguments);return g||(g=t(this,h),this._senders.push(g)),g};const l=r.RTCPeerConnection.prototype.removeTrack;r.RTCPeerConnection.prototype.removeTrack=function(h){l.apply(this,arguments);const d=this._senders.indexOf(h);d!==-1&&this._senders.splice(d,1)}}const e=r.RTCPeerConnection.prototype.addStream;r.RTCPeerConnection.prototype.addStream=function(l){this._senders=this._senders||[],e.apply(this,[l]),l.getTracks().forEach(c=>{this._senders.push(t(this,c))})};const n=r.RTCPeerConnection.prototype.removeStream;r.RTCPeerConnection.prototype.removeStream=function(l){this._senders=this._senders||[],n.apply(this,[l]),l.getTracks().forEach(c=>{const h=this._senders.find(d=>d.track===c);h&&this._senders.splice(this._senders.indexOf(h),1)})}}else if(typeof r=="object"&&r.RTCPeerConnection&&"getSenders"in r.RTCPeerConnection.prototype&&"createDTMFSender"in r.RTCPeerConnection.prototype&&r.RTCRtpSender&&!("dtmf"in r.RTCRtpSender.prototype)){const t=r.RTCPeerConnection.prototype.getSenders;r.RTCPeerConnection.prototype.getSenders=function(){const n=t.apply(this,[]);return n.forEach(i=>i._pc=this),n},Object.defineProperty(r.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ad(r){if(!(typeof r=="object"&&r.RTCPeerConnection&&r.RTCRtpSender&&r.RTCRtpReceiver))return;if(!("getStats"in r.RTCRtpSender.prototype)){const e=r.RTCPeerConnection.prototype.getSenders;e&&(r.RTCPeerConnection.prototype.getSenders=function(){const l=e.apply(this,[]);return l.forEach(c=>c._pc=this),l});const n=r.RTCPeerConnection.prototype.addTrack;n&&(r.RTCPeerConnection.prototype.addTrack=function(){const l=n.apply(this,arguments);return l._pc=this,l}),r.RTCRtpSender.prototype.getStats=function(){const l=this;return this._pc.getStats().then(c=>Th(c,l.track,!0))}}if(!("getStats"in r.RTCRtpReceiver.prototype)){const e=r.RTCPeerConnection.prototype.getReceivers;e&&(r.RTCPeerConnection.prototype.getReceivers=function(){const i=e.apply(this,[]);return i.forEach(l=>l._pc=this),i}),bi(r,"track",n=>(n.receiver._pc=n.srcElement,n)),r.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(l=>Th(l,i.track,!1))}}if(!("getStats"in r.RTCRtpSender.prototype&&"getStats"in r.RTCRtpReceiver.prototype))return;const t=r.RTCPeerConnection.prototype.getStats;r.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof r.MediaStreamTrack){const n=arguments[0];let i,l,c;return this.getSenders().forEach(h=>{h.track===n&&(i?c=!0:i=h)}),this.getReceivers().forEach(h=>(h.track===n&&(l?c=!0:l=h),h.track===n)),c||i&&l?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():l?l.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Cd(r){r.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(c=>this._shimmedLocalStreams[c][0])};const t=r.RTCPeerConnection.prototype.addTrack;r.RTCPeerConnection.prototype.addTrack=function(c,h){if(!h)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const d=t.apply(this,arguments);return this._shimmedLocalStreams[h.id]?this._shimmedLocalStreams[h.id].indexOf(d)===-1&&this._shimmedLocalStreams[h.id].push(d):this._shimmedLocalStreams[h.id]=[h,d],d};const e=r.RTCPeerConnection.prototype.addStream;r.RTCPeerConnection.prototype.addStream=function(c){this._shimmedLocalStreams=this._shimmedLocalStreams||{},c.getTracks().forEach(g=>{if(this.getSenders().find(a=>a.track===g))throw new DOMException("Track already exists.","InvalidAccessError")});const h=this.getSenders();e.apply(this,arguments);const d=this.getSenders().filter(g=>h.indexOf(g)===-1);this._shimmedLocalStreams[c.id]=[c].concat(d)};const n=r.RTCPeerConnection.prototype.removeStream;r.RTCPeerConnection.prototype.removeStream=function(c){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[c.id],n.apply(this,arguments)};const i=r.RTCPeerConnection.prototype.removeTrack;r.RTCPeerConnection.prototype.removeTrack=function(c){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},c&&Object.keys(this._shimmedLocalStreams).forEach(h=>{const d=this._shimmedLocalStreams[h].indexOf(c);d!==-1&&this._shimmedLocalStreams[h].splice(d,1),this._shimmedLocalStreams[h].length===1&&delete this._shimmedLocalStreams[h]}),i.apply(this,arguments)}}function kd(r,t){if(!r.RTCPeerConnection)return;if(r.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Cd(r);const e=r.RTCPeerConnection.prototype.getLocalStreams;r.RTCPeerConnection.prototype.getLocalStreams=function(){const p=e.apply(this);return this._reverseStreams=this._reverseStreams||{},p.map(a=>this._reverseStreams[a.id])};const n=r.RTCPeerConnection.prototype.addStream;r.RTCPeerConnection.prototype.addStream=function(p){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},p.getTracks().forEach(a=>{if(this.getSenders().find(f=>f.track===a))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[p.id]){const a=new r.MediaStream(p.getTracks());this._streams[p.id]=a,this._reverseStreams[a.id]=p,p=a}n.apply(this,[p])};const i=r.RTCPeerConnection.prototype.removeStream;r.RTCPeerConnection.prototype.removeStream=function(p){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[p.id]||p]),delete this._reverseStreams[this._streams[p.id]?this._streams[p.id].id:p.id],delete this._streams[p.id]},r.RTCPeerConnection.prototype.addTrack=function(p,a){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const u=[].slice.call(arguments,1);if(u.length!==1||!u[0].getTracks().find(_=>_===p))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(_=>_.track===p))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const y=this._streams[a.id];if(y)y.addTrack(p),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const _=new r.MediaStream([p]);this._streams[a.id]=_,this._reverseStreams[_.id]=a,this.addStream(_)}return this.getSenders().find(_=>_.track===p)};function l(g,p){let a=p.sdp;return Object.keys(g._reverseStreams||[]).forEach(u=>{const f=g._reverseStreams[u],y=g._streams[f.id];a=a.replace(new RegExp(y.id,"g"),f.id)}),new RTCSessionDescription({type:p.type,sdp:a})}function c(g,p){let a=p.sdp;return Object.keys(g._reverseStreams||[]).forEach(u=>{const f=g._reverseStreams[u],y=g._streams[f.id];a=a.replace(new RegExp(f.id,"g"),y.id)}),new RTCSessionDescription({type:p.type,sdp:a})}["createOffer","createAnswer"].forEach(function(g){const p=r.RTCPeerConnection.prototype[g],a={[g](){const u=arguments;return arguments.length&&typeof arguments[0]=="function"?p.apply(this,[y=>{const _=l(this,y);u[0].apply(null,[_])},y=>{u[1]&&u[1].apply(null,y)},arguments[2]]):p.apply(this,arguments).then(y=>l(this,y))}};r.RTCPeerConnection.prototype[g]=a[g]});const h=r.RTCPeerConnection.prototype.setLocalDescription;r.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?h.apply(this,arguments):(arguments[0]=c(this,arguments[0]),h.apply(this,arguments))};const d=Object.getOwnPropertyDescriptor(r.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(r.RTCPeerConnection.prototype,"localDescription",{get(){const g=d.get.apply(this);return g.type===""?g:l(this,g)}}),r.RTCPeerConnection.prototype.removeTrack=function(p){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!p._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(p._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let u;Object.keys(this._streams).forEach(f=>{this._streams[f].getTracks().find(_=>p.track===_)&&(u=this._streams[f])}),u&&(u.getTracks().length===1?this.removeStream(this._reverseStreams[u.id]):u.removeTrack(p.track),this.dispatchEvent(new Event("negotiationneeded")))}}function xu(r,t){!r.RTCPeerConnection&&r.webkitRTCPeerConnection&&(r.RTCPeerConnection=r.webkitRTCPeerConnection),r.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){const n=r.RTCPeerConnection.prototype[e],i={[e](){return arguments[0]=new(e==="addIceCandidate"?r.RTCIceCandidate:r.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};r.RTCPeerConnection.prototype[e]=i[e]})}function Pd(r,t){bi(r,"negotiationneeded",e=>{const n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return e})}const Oh=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:Pd,shimAddTrackRemoveTrack:kd,shimAddTrackRemoveTrackWithNative:Cd,shimGetSendersWithDtmf:Ed,shimGetUserMedia:Td,shimMediaStream:Sd,shimOnTrack:Od,shimPeerConnection:xu,shimSenderReceiverGetStats:Ad},Symbol.toStringTag,{value:"Module"}));function Rd(r,t){const e=r&&r.navigator,n=r&&r.MediaStreamTrack;if(e.getUserMedia=function(i,l,c){Xu("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),e.mediaDevices.getUserMedia(i).then(l,c)},!(t.version>55&&"autoGainControl"in e.mediaDevices.getSupportedConstraints())){const i=function(c,h,d){h in c&&!(d in c)&&(c[d]=c[h],delete c[h])},l=e.mediaDevices.getUserMedia.bind(e.mediaDevices);if(e.mediaDevices.getUserMedia=function(c){return typeof c=="object"&&typeof c.audio=="object"&&(c=JSON.parse(JSON.stringify(c)),i(c.audio,"autoGainControl","mozAutoGainControl"),i(c.audio,"noiseSuppression","mozNoiseSuppression")),l(c)},n&&n.prototype.getSettings){const c=n.prototype.getSettings;n.prototype.getSettings=function(){const h=c.apply(this,arguments);return i(h,"mozAutoGainControl","autoGainControl"),i(h,"mozNoiseSuppression","noiseSuppression"),h}}if(n&&n.prototype.applyConstraints){const c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(h){return this.kind==="audio"&&typeof h=="object"&&(h=JSON.parse(JSON.stringify(h)),i(h,"autoGainControl","mozAutoGainControl"),i(h,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[h])}}}}function E1(r,t){r.navigator.mediaDevices&&"getDisplayMedia"in r.navigator.mediaDevices||r.navigator.mediaDevices&&(r.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,r.navigator.mediaDevices.getUserMedia(n)})}function Md(r){typeof r=="object"&&r.RTCTrackEvent&&"receiver"in r.RTCTrackEvent.prototype&&!("transceiver"in r.RTCTrackEvent.prototype)&&Object.defineProperty(r.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Tu(r,t){if(typeof r!="object"||!(r.RTCPeerConnection||r.mozRTCPeerConnection))return;!r.RTCPeerConnection&&r.mozRTCPeerConnection&&(r.RTCPeerConnection=r.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const l=r.RTCPeerConnection.prototype[i],c={[i](){return arguments[0]=new(i==="addIceCandidate"?r.RTCIceCandidate:r.RTCSessionDescription)(arguments[0]),l.apply(this,arguments)}};r.RTCPeerConnection.prototype[i]=c[i]});const e={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=r.RTCPeerConnection.prototype.getStats;r.RTCPeerConnection.prototype.getStats=function(){const[l,c,h]=arguments;return n.apply(this,[l||null]).then(d=>{if(t.version<53&&!c)try{d.forEach(g=>{g.type=e[g.type]||g.type})}catch(g){if(g.name!=="TypeError")throw g;d.forEach((p,a)=>{d.set(a,Object.assign({},p,{type:e[p.type]||p.type}))})}return d}).then(c,h)}}function Dd(r){if(!(typeof r=="object"&&r.RTCPeerConnection&&r.RTCRtpSender)||r.RTCRtpSender&&"getStats"in r.RTCRtpSender.prototype)return;const t=r.RTCPeerConnection.prototype.getSenders;t&&(r.RTCPeerConnection.prototype.getSenders=function(){const i=t.apply(this,[]);return i.forEach(l=>l._pc=this),i});const e=r.RTCPeerConnection.prototype.addTrack;e&&(r.RTCPeerConnection.prototype.addTrack=function(){const i=e.apply(this,arguments);return i._pc=this,i}),r.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Ld(r){if(!(typeof r=="object"&&r.RTCPeerConnection&&r.RTCRtpSender)||r.RTCRtpSender&&"getStats"in r.RTCRtpReceiver.prototype)return;const t=r.RTCPeerConnection.prototype.getReceivers;t&&(r.RTCPeerConnection.prototype.getReceivers=function(){const n=t.apply(this,[]);return n.forEach(i=>i._pc=this),n}),bi(r,"track",e=>(e.receiver._pc=e.srcElement,e)),r.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Id(r){!r.RTCPeerConnection||"removeStream"in r.RTCPeerConnection.prototype||(r.RTCPeerConnection.prototype.removeStream=function(e){Xu("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&e.getTracks().includes(n.track)&&this.removeTrack(n)})})}function Nd(r){r.DataChannel&&!r.RTCDataChannel&&(r.RTCDataChannel=r.DataChannel)}function Bd(r){if(!(typeof r=="object"&&r.RTCPeerConnection))return;const t=r.RTCPeerConnection.prototype.addTransceiver;t&&(r.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const i=n.length>0;i&&n.forEach(c=>{if("rid"in c&&!/^[a-z0-9]{0,16}$/i.test(c.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in c&&!(parseFloat(c.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in c&&!(parseFloat(c.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const l=t.apply(this,arguments);if(i){const{sender:c}=l,h=c.getParameters();(!("encodings"in h)||h.encodings.length===1&&Object.keys(h.encodings[0]).length===0)&&(h.encodings=n,c.sendEncodings=n,this.setParametersPromises.push(c.setParameters(h).then(()=>{delete c.sendEncodings}).catch(()=>{delete c.sendEncodings})))}return l})}function Fd(r){if(!(typeof r=="object"&&r.RTCRtpSender))return;const t=r.RTCRtpSender.prototype.getParameters;t&&(r.RTCRtpSender.prototype.getParameters=function(){const n=t.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function qd(r){if(!(typeof r=="object"&&r.RTCPeerConnection))return;const t=r.RTCPeerConnection.prototype.createOffer;r.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function jd(r){if(!(typeof r=="object"&&r.RTCPeerConnection))return;const t=r.RTCPeerConnection.prototype.createAnswer;r.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}const Eh=Object.freeze(Object.defineProperty({__proto__:null,shimAddTransceiver:Bd,shimCreateAnswer:jd,shimCreateOffer:qd,shimGetDisplayMedia:E1,shimGetParameters:Fd,shimGetUserMedia:Rd,shimOnTrack:Md,shimPeerConnection:Tu,shimRTCDataChannel:Nd,shimReceiverGetStats:Ld,shimRemoveStream:Id,shimSenderGetStats:Dd},Symbol.toStringTag,{value:"Module"}));function $d(r){if(!(typeof r!="object"||!r.RTCPeerConnection)){if("getLocalStreams"in r.RTCPeerConnection.prototype||(r.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in r.RTCPeerConnection.prototype)){const t=r.RTCPeerConnection.prototype.addTrack;r.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(i=>t.call(this,i,n)),n.getVideoTracks().forEach(i=>t.call(this,i,n))},r.RTCPeerConnection.prototype.addTrack=function(n,...i){return i&&i.forEach(l=>{this._localStreams?this._localStreams.includes(l)||this._localStreams.push(l):this._localStreams=[l]}),t.apply(this,arguments)}}"removeStream"in r.RTCPeerConnection.prototype||(r.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(e);if(n===-1)return;this._localStreams.splice(n,1);const i=e.getTracks();this.getSenders().forEach(l=>{i.includes(l.track)&&this.removeTrack(l)})})}}function Ud(r){if(!(typeof r!="object"||!r.RTCPeerConnection)&&("getRemoteStreams"in r.RTCPeerConnection.prototype||(r.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in r.RTCPeerConnection.prototype))){Object.defineProperty(r.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const l=new Event("addstream");l.stream=i,this.dispatchEvent(l)})})}});const t=r.RTCPeerConnection.prototype.setRemoteDescription;r.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(l=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(l)>=0)return;n._remoteStreams.push(l);const c=new Event("addstream");c.stream=l,n.dispatchEvent(c)})}),t.apply(n,arguments)}}}function Hd(r){if(typeof r!="object"||!r.RTCPeerConnection)return;const t=r.RTCPeerConnection.prototype,e=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,l=t.setRemoteDescription,c=t.addIceCandidate;t.createOffer=function(g,p){const a=arguments.length>=2?arguments[2]:arguments[0],u=e.apply(this,[a]);return p?(u.then(g,p),Promise.resolve()):u},t.createAnswer=function(g,p){const a=arguments.length>=2?arguments[2]:arguments[0],u=n.apply(this,[a]);return p?(u.then(g,p),Promise.resolve()):u};let h=function(d,g,p){const a=i.apply(this,[d]);return p?(a.then(g,p),Promise.resolve()):a};t.setLocalDescription=h,h=function(d,g,p){const a=l.apply(this,[d]);return p?(a.then(g,p),Promise.resolve()):a},t.setRemoteDescription=h,h=function(d,g,p){const a=c.apply(this,[d]);return p?(a.then(g,p),Promise.resolve()):a},t.addIceCandidate=h}function Wd(r){const t=r&&r.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=i=>n(zd(i))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(n,i,l){t.mediaDevices.getUserMedia(n).then(i,l)}.bind(t))}function zd(r){return r&&r.video!==void 0?Object.assign({},r,{video:xd(r.video)}):r}function Gd(r){if(!r.RTCPeerConnection)return;const t=r.RTCPeerConnection;r.RTCPeerConnection=function(n,i){if(n&&n.iceServers){const l=[];for(let c=0;cc.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo!="undefined"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const l=this.getTransceivers().find(c=>c.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&l?l.direction==="sendrecv"?l.setDirection?l.setDirection("sendonly"):l.direction="sendonly":l.direction==="recvonly"&&(l.setDirection?l.setDirection("inactive"):l.direction="inactive"):n.offerToReceiveVideo===!0&&!l&&this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Kd(r){typeof r!="object"||r.AudioContext||(r.AudioContext=r.webkitAudioContext)}const Ah=Object.freeze(Object.defineProperty({__proto__:null,shimAudioContext:Kd,shimCallbacksAPI:Hd,shimConstraints:zd,shimCreateOfferLegacy:Vd,shimGetUserMedia:Wd,shimLocalStreamsAPI:$d,shimRTCIceServerUrls:Gd,shimRemoteStreamsAPI:Ud,shimTrackEventTransceiver:Yd},Symbol.toStringTag,{value:"Module"}));var Xd={exports:{}};(function(r){const t={};t.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split(` `).map(n=>n.trim())},t.splitSections=function(e){return e.split(` m=`).map((i,l)=>(l>0?"m="+i:i).trim()+`\r `)},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter(i=>i.indexOf(n)===0)},t.parseCandidate=function(e){let n;e.indexOf("a=candidate:")===0?n=e.substring(12).split(" "):n=e.substring(10).split(" ");const i={foundation:n[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let l=8;l0?n[0].split("/")[1]:"sendrecv",uri:n[1],attributes:n.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&e.direction!=="sendrecv"?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+`\r `},t.parseFmtp=function(e){const n={};let i;const l=e.substring(e.indexOf(" ")+1).split(";");for(let c=0;c{e.parameters[c]!==void 0?l.push(c+"="+e.parameters[c]):l.push(c)}),n+="a=fmtp:"+i+" "+l.join(";")+`\r `}return n},t.parseRtcpFb=function(e){const n=e.substring(e.indexOf(" ")+1).split(" ");return{type:n.shift(),parameter:n.join(" ")}},t.writeRtcpFb=function(e){let n="",i=e.payloadType;return e.preferredPayloadType!==void 0&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(l=>{n+="a=rtcp-fb:"+i+" "+l.type+(l.parameter&&l.parameter.length?" "+l.parameter:"")+`\r `}),n},t.parseSsrcMedia=function(e){const n=e.indexOf(" "),i={ssrc:parseInt(e.substring(7,n),10)},l=e.indexOf(":",n);return l>-1?(i.attribute=e.substring(n+1,l),i.value=e.substring(l+1)):i.attribute=e.substring(n+1),i},t.parseSsrcGroup=function(e){const n=e.substring(13).split(" ");return{semantics:n.shift(),ssrcs:n.map(i=>parseInt(i,10))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const n=e.substring(14).split(" ");return{algorithm:n[0].toLowerCase(),value:n[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,n){let i="a=setup:"+n+`\r `;return e.fingerprints.forEach(l=>{i+="a=fingerprint:"+l.algorithm+" "+l.value+`\r `}),i},t.parseCryptoLine=function(e){const n=e.substring(9).split(" ");return{tag:parseInt(n[0],10),cryptoSuite:n[1],keyParams:n[2],sessionParams:n.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+(typeof e.keyParams=="object"?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+`\r `},t.parseCryptoKeyParams=function(e){if(e.indexOf("inline:")!==0)return null;const n=e.substring(7).split("|");return{keyMethod:"inline",keySalt:n[0],lifeTime:n[1],mkiValue:n[2]?n[2].split(":")[0]:void 0,mkiLength:n[2]?n[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const i=t.matchPrefix(e+n,"a=ice-ufrag:")[0],l=t.matchPrefix(e+n,"a=ice-pwd:")[0];return i&&l?{usernameFragment:i.substring(12),password:l.substring(10)}:null},t.writeIceParameters=function(e){let n="a=ice-ufrag:"+e.usernameFragment+`\r a=ice-pwd:`+e.password+`\r `;return e.iceLite&&(n+=`a=ice-lite\r `),n},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},l=t.splitLines(e)[0].split(" ");n.profile=l[2];for(let h=3;h{n.headerExtensions.push(t.parseExtmap(h))});const c=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach(h=>{c.forEach(d=>{h.rtcpFeedback.find(p=>p.type===d.type&&p.parameter===d.parameter)||h.rtcpFeedback.push(d)})}),n},t.writeRtpDescription=function(e,n){let i="";i+="m="+e+" ",i+=n.codecs.length>0?"9":"0",i+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=n.codecs.map(c=>c.preferredPayloadType!==void 0?c.preferredPayloadType:c.payloadType).join(" ")+`\r `,i+=`c=IN IP4 0.0.0.0\r `,i+=`a=rtcp:9 IN IP4 0.0.0.0\r `,n.codecs.forEach(c=>{i+=t.writeRtpMap(c),i+=t.writeFmtp(c),i+=t.writeRtcpFb(c)});let l=0;return n.codecs.forEach(c=>{c.maxptime>l&&(l=c.maxptime)}),l>0&&(i+="a=maxptime:"+l+`\r `),n.headerExtensions&&n.headerExtensions.forEach(c=>{i+=t.writeExtmap(c)}),i},t.parseRtpEncodingParameters=function(e){const n=[],i=t.parseRtpParameters(e),l=i.fecMechanisms.indexOf("RED")!==-1,c=i.fecMechanisms.indexOf("ULPFEC")!==-1,h=t.matchPrefix(e,"a=ssrc:").map(u=>t.parseSsrcMedia(u)).filter(u=>u.attribute==="cname"),d=h.length>0&&h[0].ssrc;let g;const p=t.matchPrefix(e,"a=ssrc-group:FID").map(u=>u.substring(17).split(" ").map(y=>parseInt(y,10)));p.length>0&&p[0].length>1&&p[0][0]===d&&(g=p[0][1]),i.codecs.forEach(u=>{if(u.name.toUpperCase()==="RTX"&&u.parameters.apt){let f={ssrc:d,codecPayloadType:parseInt(u.parameters.apt,10)};d&&g&&(f.rtx={ssrc:g}),n.push(f),l&&(f=JSON.parse(JSON.stringify(f)),f.fec={ssrc:d,mechanism:c?"red+ulpfec":"red"},n.push(f))}}),n.length===0&&d&&n.push({ssrc:d});let a=t.matchPrefix(e,"b=");return a.length&&(a[0].indexOf("b=TIAS:")===0?a=parseInt(a[0].substring(7),10):a[0].indexOf("b=AS:")===0?a=parseInt(a[0].substring(5),10)*1e3*.95-50*40*8:a=void 0,n.forEach(u=>{u.maxBitrate=a})),n},t.parseRtcpParameters=function(e){const n={},i=t.matchPrefix(e,"a=ssrc:").map(h=>t.parseSsrcMedia(h)).filter(h=>h.attribute==="cname")[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);const l=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=l.length>0,n.compound=l.length===0;const c=t.matchPrefix(e,"a=rtcp-mux");return n.mux=c.length>0,n},t.writeRtcpParameters=function(e){let n="";return e.reducedSize&&(n+=`a=rtcp-rsize\r `),e.mux&&(n+=`a=rtcp-mux\r `),e.ssrc!==void 0&&e.cname&&(n+="a=ssrc:"+e.ssrc+" cname:"+e.cname+`\r `),n},t.parseMsid=function(e){let n;const i=t.matchPrefix(e,"a=msid:");if(i.length===1)return n=i[0].substring(7).split(" "),{stream:n[0],track:n[1]};const l=t.matchPrefix(e,"a=ssrc:").map(c=>t.parseSsrcMedia(c)).filter(c=>c.attribute==="msid");if(l.length>0)return n=l[0].value.split(" "),{stream:n[0],track:n[1]}},t.parseSctpDescription=function(e){const n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");let l;i.length>0&&(l=parseInt(i[0].substring(19),10)),isNaN(l)&&(l=65536);const c=t.matchPrefix(e,"a=sctp-port:");if(c.length>0)return{port:parseInt(c[0].substring(12),10),protocol:n.fmt,maxMessageSize:l};const h=t.matchPrefix(e,"a=sctpmap:");if(h.length>0){const d=h[0].substring(10).split(" ");return{port:parseInt(d[0],10),protocol:d[1],maxMessageSize:l}}},t.writeSctpDescription=function(e,n){let i=[];return e.protocol!=="DTLS/SCTP"?i=["m="+e.kind+" 9 "+e.protocol+" "+n.protocol+`\r `,`c=IN IP4 0.0.0.0\r `,"a=sctp-port:"+n.port+`\r `]:i=["m="+e.kind+" 9 "+e.protocol+" "+n.port+`\r `,`c=IN IP4 0.0.0.0\r `,"a=sctpmap:"+n.port+" "+n.protocol+` 65535\r `],n.maxMessageSize!==void 0&&i.push("a=max-message-size:"+n.maxMessageSize+`\r `),i.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,i){let l;const c=n!==void 0?n:2;return e?l=e:l=t.generateSessionId(),`v=0\r o=`+(i||"thisisadapterortc")+" "+l+" "+c+` IN IP4 127.0.0.1\r s=-\r t=0 0\r `},t.getDirection=function(e,n){const i=t.splitLines(e);for(let l=0;l(e.candidate&&Object.defineProperty(e,"candidate",{value:new r.RTCIceCandidate(e.candidate),writable:"false"}),e))}function Su(r){!r.RTCIceCandidate||r.RTCIceCandidate&&"relayProtocol"in r.RTCIceCandidate.prototype||bi(r,"icecandidate",t=>{if(t.candidate){const e=ro.parseCandidate(t.candidate.candidate);e.type==="relay"&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[e.priority>>24])}return t})}function bs(r,t){if(!r.RTCPeerConnection)return;"sctp"in r.RTCPeerConnection.prototype||Object.defineProperty(r.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp=="undefined"?null:this._sctp}});const e=function(h){if(!h||!h.sdp)return!1;const d=ro.splitSections(h.sdp);return d.shift(),d.some(g=>{const p=ro.parseMLine(g);return p&&p.kind==="application"&&p.protocol.indexOf("SCTP")!==-1})},n=function(h){const d=h.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(d===null||d.length<2)return-1;const g=parseInt(d[1],10);return g!==g?-1:g},i=function(h){let d=65536;return t.browser==="firefox"&&(t.version<57?h===-1?d=16384:d=2147483637:t.version<60?d=t.version===57?65535:65536:d=2147483637),d},l=function(h,d){let g=65536;t.browser==="firefox"&&t.version===57&&(g=65535);const p=ro.matchPrefix(h.sdp,"a=max-message-size:");return p.length>0?g=parseInt(p[0].substring(19),10):t.browser==="firefox"&&d!==-1&&(g=2147483637),g},c=r.RTCPeerConnection.prototype.setRemoteDescription;r.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,t.browser==="chrome"&&t.version>=76){const{sdpSemantics:d}=this.getConfiguration();d==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp=="undefined"?null:this._sctp},enumerable:!0,configurable:!0})}if(e(arguments[0])){const d=n(arguments[0]),g=i(d),p=l(arguments[0],d);let a;g===0&&p===0?a=Number.POSITIVE_INFINITY:g===0||p===0?a=Math.max(g,p):a=Math.min(g,p);const u={};Object.defineProperty(u,"maxMessageSize",{get(){return a}}),this._sctp=u}return c.apply(this,arguments)}}function ws(r){if(!(r.RTCPeerConnection&&"createDataChannel"in r.RTCPeerConnection.prototype))return;function t(n,i){const l=n.send;n.send=function(){const h=arguments[0],d=h.length||h.size||h.byteLength;if(n.readyState==="open"&&i.sctp&&d>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return l.apply(n,arguments)}}const e=r.RTCPeerConnection.prototype.createDataChannel;r.RTCPeerConnection.prototype.createDataChannel=function(){const i=e.apply(this,arguments);return t(i,this),i},bi(r,"datachannel",n=>(t(n.channel,n.target),n))}function Ou(r){if(!r.RTCPeerConnection||"connectionState"in r.RTCPeerConnection.prototype)return;const t=r.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const l=i.target;if(l._lastConnectionState!==l.connectionState){l._lastConnectionState=l.connectionState;const c=new Event("connectionstatechange",i);l.dispatchEvent(c)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function Eu(r,t){if(!r.RTCPeerConnection||t.browser==="chrome"&&t.version>=71||t.browser==="safari"&&t._safariVersion>=13.1)return;const e=r.RTCPeerConnection.prototype.setRemoteDescription;r.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(` a=extmap-allow-mixed`)!==-1){const l=i.sdp.split(` `).filter(c=>c.trim()!=="a=extmap-allow-mixed").join(` `);r.RTCSessionDescription&&i instanceof r.RTCSessionDescription?arguments[0]=new r.RTCSessionDescription({type:i.type,sdp:l}):i.sdp=l}return e.apply(this,arguments)}}function xs(r,t){if(!(r.RTCPeerConnection&&r.RTCPeerConnection.prototype))return;const e=r.RTCPeerConnection.prototype.addIceCandidate;!e||e.length===0||(r.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser==="chrome"&&t.version<78||t.browser==="firefox"&&t.version<68||t.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():e.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Ts(r,t){if(!(r.RTCPeerConnection&&r.RTCPeerConnection.prototype))return;const e=r.RTCPeerConnection.prototype.setLocalDescription;!e||e.length===0||(r.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return e.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?e.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(c=>e.apply(this,[c]))})}const C1=Object.freeze(Object.defineProperty({__proto__:null,removeExtmapAllowMixed:Eu,shimAddIceCandidateNullOrEmpty:xs,shimConnectionState:Ou,shimMaxMessageSize:bs,shimParameterlessSetLocalDescription:Ts,shimRTCIceCandidate:_s,shimRTCIceCandidateRelayProtocol:Su,shimSendThrowTypeError:ws},Symbol.toStringTag,{value:"Module"}));function k1({window:r}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const e=wd,n=O1(r),i={browserDetails:n,commonShim:C1,extractVersion:na,disableLog:T1,disableWarnings:S1,sdp:A1};switch(n.browser){case"chrome":if(!Oh||!xu||!t.shimChrome)return e("Chrome shim is not included in this adapter release."),i;if(n.version===null)return e("Chrome shim can not determine version, not shimming."),i;e("adapter.js shimming chrome."),i.browserShim=Oh,xs(r,n),Ts(r),Td(r,n),Sd(r),xu(r,n),Od(r),kd(r,n),Ed(r),Ad(r),Pd(r,n),_s(r),Su(r),Ou(r),bs(r,n),ws(r),Eu(r,n);break;case"firefox":if(!Eh||!Tu||!t.shimFirefox)return e("Firefox shim is not included in this adapter release."),i;e("adapter.js shimming firefox."),i.browserShim=Eh,xs(r,n),Ts(r),Rd(r,n),Tu(r,n),Md(r),Id(r),Dd(r),Ld(r),Nd(r),Bd(r),Fd(r),qd(r),jd(r),_s(r),Ou(r),bs(r,n),ws(r);break;case"safari":if(!Ah||!t.shimSafari)return e("Safari shim is not included in this adapter release."),i;e("adapter.js shimming safari."),i.browserShim=Ah,xs(r,n),Ts(r),Gd(r),Vd(r),Hd(r),$d(r),Ud(r),Yd(r),Wd(r),Kd(r),_s(r),Su(r),bs(r,n),ws(r),Eu(r,n);break;default:e("Unsupported browser!");break}return i}const Ch=k1({window:typeof window=="undefined"?void 0:window});function wi(r,t,e,n){Object.defineProperty(r,t,{get:e,set:n,enumerable:!0,configurable:!0})}class Qd{constructor(){this.chunkedMTU=16300,this._dataCount=1,this.chunk=t=>{const e=[],n=t.byteLength,i=Math.ceil(n/this.chunkedMTU);let l=0,c=0;for(;c=this.minChromeVersion:r==="firefox"?t>=this.minFirefoxVersion:r==="safari"?!this.isIOS&&t>=this.minSafariVersion:!1:!1}getBrowser(){return su.browserDetails.browser}getVersion(){return su.browserDetails.version||0}isUnifiedPlanSupported(){const r=this.getBrowser(),t=su.browserDetails.version||0;if(r==="chrome"&&t=this.minFirefoxVersion)return!0;if(!window.RTCRtpTransceiver||!("currentDirection"in RTCRtpTransceiver.prototype))return!1;let e,n=!1;try{e=new RTCPeerConnection,e.addTransceiver("audio"),n=!0}catch(i){}finally{e&&e.close()}return n}toString(){return`Supports: browser:${this.getBrowser()} version:${this.getVersion()} isIOS:${this.isIOS} isWebRTCSupported:${this.isWebRTCSupported()} isBrowserSupported:${this.isBrowserSupported()} isUnifiedPlanSupported:${this.isUnifiedPlanSupported()}`}constructor(){this.isIOS=typeof navigator!="undefined"?["iPad","iPhone","iPod"].includes(navigator.platform):!1,this.supportedBrowsers=["firefox","chrome","safari"],this.minFirefoxVersion=59,this.minChromeVersion=72,this.minSafariVersion=605}},R1=r=>!r||/^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(r),Jd=()=>Math.random().toString(36).slice(2),kh={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:["turn:eu-0.turn.peerjs.com:3478","turn:us-0.turn.peerjs.com:3478"],username:"peerjs",credential:"peerjsp"}],sdpSemantics:"unified-plan"};class M1 extends Qd{noop(){}blobToArrayBuffer(t,e){const n=new FileReader;return n.onload=function(i){i.target&&e(i.target.result)},n.readAsArrayBuffer(t),n}binaryStringToArrayBuffer(t){const e=new Uint8Array(t.length);for(let n=0;n=3&&this._print(3,...t)}warn(...t){this._logLevel>=2&&this._print(2,...t)}error(...t){this._logLevel>=1&&this._print(1,...t)}setLogFunction(t){this._print=t}_print(t,...e){const n=[D1,...e];for(const i in n)n[i]instanceof Error&&(n[i]="("+n[i].name+") "+n[i].message);t>=3?console.log(...n):t>=2?console.warn("WARNING",...n):t>=1&&console.error("ERROR",...n)}constructor(){this._logLevel=0}}var Ce=new L1,Zu={},I1=Object.prototype.hasOwnProperty,ln="~";function ua(){}Object.create&&(ua.prototype=Object.create(null),new ua().__proto__||(ln=!1));function N1(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function ep(r,t,e,n,i){if(typeof e!="function")throw new TypeError("The listener must be a function");var l=new N1(e,n||r,i),c=ln?ln+t:t;return r._events[c]?r._events[c].fn?r._events[c]=[r._events[c],l]:r._events[c].push(l):(r._events[c]=l,r._eventsCount++),r}function Ss(r,t){--r._eventsCount===0?r._events=new ua:delete r._events[t]}function tn(){this._events=new ua,this._eventsCount=0}tn.prototype.eventNames=function(){var t=[],e,n;if(this._eventsCount===0)return t;for(n in e=this._events)I1.call(e,n)&&t.push(ln?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};tn.prototype.listeners=function(t){var e=ln?ln+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,l=n.length,c=new Array(l);ijr);wi(xi,"PeerErrorType",()=>It);wi(xi,"BaseConnectionErrorType",()=>Au);wi(xi,"DataConnectionErrorType",()=>Qu);wi(xi,"SerializationType",()=>$s);wi(xi,"SocketEventType",()=>Br);wi(xi,"ServerMessageType",()=>en);var jr=function(r){return r.Data="data",r.Media="media",r}({}),It=function(r){return r.BrowserIncompatible="browser-incompatible",r.Disconnected="disconnected",r.InvalidID="invalid-id",r.InvalidKey="invalid-key",r.Network="network",r.PeerUnavailable="peer-unavailable",r.SslUnavailable="ssl-unavailable",r.ServerError="server-error",r.SocketError="socket-error",r.SocketClosed="socket-closed",r.UnavailableID="unavailable-id",r.WebRTC="webrtc",r}({}),Au=function(r){return r.NegotiationFailed="negotiation-failed",r.ConnectionClosed="connection-closed",r}({}),Qu=function(r){return r.NotOpenYet="not-open-yet",r.MessageToBig="message-too-big",r}({}),$s=function(r){return r.Binary="binary",r.BinaryUTF8="binary-utf8",r.JSON="json",r.None="raw",r}({}),Br=function(r){return r.Message="message",r.Disconnected="disconnected",r.Error="error",r.Close="close",r}({}),en=function(r){return r.Heartbeat="HEARTBEAT",r.Candidate="CANDIDATE",r.Offer="OFFER",r.Answer="ANSWER",r.Open="OPEN",r.Error="ERROR",r.IdTaken="ID-TAKEN",r.InvalidKey="INVALID-KEY",r.Leave="LEAVE",r.Expire="EXPIRE",r}({});const tp="1.5.5";class B1 extends Zu.EventEmitter{constructor(t,e,n,i,l,c=5e3){super(),this.pingInterval=c,this._disconnected=!0,this._messagesQueue=[];const h=t?"wss://":"ws://";this._baseUrl=h+e+":"+n+i+"peerjs?key="+l}start(t,e){this._id=t;const n=`${this._baseUrl}&id=${t}&token=${e}`;this._socket||!this._disconnected||(this._socket=new WebSocket(n+"&version="+tp),this._disconnected=!1,this._socket.onmessage=i=>{let l;try{l=JSON.parse(i.data),Ce.log("Server message received:",l)}catch(c){Ce.log("Invalid server message",i.data);return}this.emit(Br.Message,l)},this._socket.onclose=i=>{this._disconnected||(Ce.log("Socket closed.",i),this._cleanup(),this._disconnected=!0,this.emit(Br.Disconnected))},this._socket.onopen=()=>{this._disconnected||(this._sendQueuedMessages(),Ce.log("Socket open"),this._scheduleHeartbeat())})}_scheduleHeartbeat(){this._wsPingTimer=setTimeout(()=>{this._sendHeartbeat()},this.pingInterval)}_sendHeartbeat(){if(!this._wsOpen()){Ce.log("Cannot send heartbeat, because socket closed");return}const t=JSON.stringify({type:en.Heartbeat});this._socket.send(t),this._scheduleHeartbeat()}_wsOpen(){return!!this._socket&&this._socket.readyState===1}_sendQueuedMessages(){const t=[...this._messagesQueue];this._messagesQueue=[];for(const e of t)this.send(e)}send(t){if(this._disconnected)return;if(!this._id){this._messagesQueue.push(t);return}if(!t.type){this.emit(Br.Error,"Invalid message");return}if(!this._wsOpen())return;const e=JSON.stringify(t);this._socket.send(e)}close(){this._disconnected||(this._cleanup(),this._disconnected=!0)}_cleanup(){this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(),this._socket=void 0),clearTimeout(this._wsPingTimer)}}class np{constructor(t){this.connection=t}startConnection(t){const e=this._startPeerConnection();if(this.connection.peerConnection=e,this.connection.type===jr.Media&&t._stream&&this._addTracksToConnection(t._stream,e),t.originator){const n=this.connection,i={ordered:!!t.reliable},l=e.createDataChannel(n.label,i);n._initializeDataChannel(l),this._makeOffer()}else this.handleSDP("OFFER",t.sdp)}_startPeerConnection(){Ce.log("Creating RTCPeerConnection.");const t=new RTCPeerConnection(this.connection.provider.options.config);return this._setupListeners(t),t}_setupListeners(t){const e=this.connection.peer,n=this.connection.connectionId,i=this.connection.type,l=this.connection.provider;Ce.log("Listening for ICE candidates."),t.onicecandidate=c=>{!c.candidate||!c.candidate.candidate||(Ce.log(`Received ICE candidates for ${e}:`,c.candidate),l.socket.send({type:en.Candidate,payload:{candidate:c.candidate,type:i,connectionId:n},dst:e}))},t.oniceconnectionstatechange=()=>{switch(t.iceConnectionState){case"failed":Ce.log("iceConnectionState is failed, closing connections to "+e),this.connection.emitError(Au.NegotiationFailed,"Negotiation of connection to "+e+" failed."),this.connection.close();break;case"closed":Ce.log("iceConnectionState is closed, closing connections to "+e),this.connection.emitError(Au.ConnectionClosed,"Connection to "+e+" closed."),this.connection.close();break;case"disconnected":Ce.log("iceConnectionState changed to disconnected on the connection with "+e);break;case"completed":t.onicecandidate=()=>{};break}this.connection.emit("iceStateChanged",t.iceConnectionState)},Ce.log("Listening for data channel"),t.ondatachannel=c=>{Ce.log("Received data channel");const h=c.channel;l.getConnection(e,n)._initializeDataChannel(h)},Ce.log("Listening for remote stream"),t.ontrack=c=>{Ce.log("Received remote stream");const h=c.streams[0],d=l.getConnection(e,n);if(d.type===jr.Media){const g=d;this._addStreamToMediaConnection(h,g)}}}cleanup(){Ce.log("Cleaning up PeerConnection to "+this.connection.peer);const t=this.connection.peerConnection;if(!t)return;this.connection.peerConnection=null,t.onicecandidate=t.oniceconnectionstatechange=t.ondatachannel=t.ontrack=()=>{};const e=t.signalingState!=="closed";let n=!1;const i=this.connection.dataChannel;i&&(n=!!i.readyState&&i.readyState!=="closed"),(e||n)&&t.close()}_makeOffer(){return tt(this,null,function*(){const t=this.connection.peerConnection,e=this.connection.provider;try{const n=yield t.createOffer(this.connection.options.constraints);Ce.log("Created offer."),this.connection.options.sdpTransform&&typeof this.connection.options.sdpTransform=="function"&&(n.sdp=this.connection.options.sdpTransform(n.sdp)||n.sdp);try{yield t.setLocalDescription(n),Ce.log("Set localDescription:",n,`for:${this.connection.peer}`);let i={sdp:n,type:this.connection.type,connectionId:this.connection.connectionId,metadata:this.connection.metadata};if(this.connection.type===jr.Data){const l=this.connection;i=Ut(st({},i),{label:l.label,reliable:l.reliable,serialization:l.serialization})}e.socket.send({type:en.Offer,payload:i,dst:this.connection.peer})}catch(i){i!="OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer"&&(e.emitError(It.WebRTC,i),Ce.log("Failed to setLocalDescription, ",i))}}catch(n){e.emitError(It.WebRTC,n),Ce.log("Failed to createOffer, ",n)}})}_makeAnswer(){return tt(this,null,function*(){const t=this.connection.peerConnection,e=this.connection.provider;try{const n=yield t.createAnswer();Ce.log("Created answer."),this.connection.options.sdpTransform&&typeof this.connection.options.sdpTransform=="function"&&(n.sdp=this.connection.options.sdpTransform(n.sdp)||n.sdp);try{yield t.setLocalDescription(n),Ce.log("Set localDescription:",n,`for:${this.connection.peer}`),e.socket.send({type:en.Answer,payload:{sdp:n,type:this.connection.type,connectionId:this.connection.connectionId},dst:this.connection.peer})}catch(i){e.emitError(It.WebRTC,i),Ce.log("Failed to setLocalDescription, ",i)}}catch(n){e.emitError(It.WebRTC,n),Ce.log("Failed to create answer, ",n)}})}handleSDP(t,e){return tt(this,null,function*(){e=new RTCSessionDescription(e);const n=this.connection.peerConnection,i=this.connection.provider;Ce.log("Setting remote description",e);const l=this;try{yield n.setRemoteDescription(e),Ce.log(`Set remoteDescription:${t} for:${this.connection.peer}`),t==="OFFER"&&(yield l._makeAnswer())}catch(c){i.emitError(It.WebRTC,c),Ce.log("Failed to setRemoteDescription, ",c)}})}handleCandidate(t){return tt(this,null,function*(){Ce.log("handleCandidate:",t);try{yield this.connection.peerConnection.addIceCandidate(t),Ce.log(`Added ICE candidate for:${this.connection.peer}`)}catch(e){this.connection.provider.emitError(It.WebRTC,e),Ce.log("Failed to handleCandidate, ",e)}})}_addTracksToConnection(t,e){if(Ce.log(`add tracks from stream ${t.id} to peer connection`),!e.addTrack)return Ce.error("Your browser does't support RTCPeerConnection#addTrack. Ignored.");t.getTracks().forEach(n=>{e.addTrack(n,t)})}_addStreamToMediaConnection(t,e){Ce.log(`add stream ${t.id} to media connection ${e.connectionId}`),e.addStream(t)}}class rp extends Zu.EventEmitter{emitError(t,e){Ce.error("Error:",e),this.emit("error",new F1(`${t}`,e))}}class F1 extends Error{constructor(t,e){typeof e=="string"?super(e):(super(),Object.assign(this,e)),this.type=t}}class ip extends rp{get open(){return this._open}constructor(t,e,n){super(),this.peer=t,this.provider=e,this.options=n,this._open=!1,this.metadata=n.metadata}}var Gu;const sa=class sa extends ip{get type(){return jr.Media}get localStream(){return this._localStream}get remoteStream(){return this._remoteStream}constructor(t,e,n){super(t,e,n),this._localStream=this.options._stream,this.connectionId=this.options.connectionId||sa.ID_PREFIX+pn.randomToken(),this._negotiator=new np(this),this._localStream&&this._negotiator.startConnection({_stream:this._localStream,originator:!0})}_initializeDataChannel(t){this.dataChannel=t,this.dataChannel.onopen=()=>{Ce.log(`DC#${this.connectionId} dc connection success`),this.emit("willCloseOnRemote")},this.dataChannel.onclose=()=>{Ce.log(`DC#${this.connectionId} dc closed for:`,this.peer),this.close()}}addStream(t){Ce.log("Receiving stream",t),this._remoteStream=t,super.emit("stream",t)}handleMessage(t){const e=t.type,n=t.payload;switch(t.type){case en.Answer:this._negotiator.handleSDP(e,n.sdp),this._open=!0;break;case en.Candidate:this._negotiator.handleCandidate(n.candidate);break;default:Ce.warn(`Unrecognized message type:${e} from peer:${this.peer}`);break}}answer(t,e={}){if(this._localStream){Ce.warn("Local stream already exists on this MediaConnection. Are you answering a call twice?");return}this._localStream=t,e&&e.sdpTransform&&(this.options.sdpTransform=e.sdpTransform),this._negotiator.startConnection(Ut(st({},this.options._payload),{_stream:t}));const n=this.provider._getMessages(this.connectionId);for(const i of n)this.handleMessage(i);this._open=!0}close(){this._negotiator&&(this._negotiator.cleanup(),this._negotiator=null),this._localStream=null,this._remoteStream=null,this.provider&&(this.provider._removeConnection(this),this.provider=null),this.options&&this.options._stream&&(this.options._stream=null),this.open&&(this._open=!1,super.emit("close"))}};Gu=new WeakMap,Xo(sa,Gu,sa.ID_PREFIX="mc_");let As=sa;class q1{constructor(t){this._options=t}_buildRequest(t){const e=this._options.secure?"https":"http",{host:n,port:i,path:l,key:c}=this._options,h=new URL(`${e}://${n}:${i}${l}${c}/${t}`);return h.searchParams.set("ts",`${Date.now()}${Math.random()}`),h.searchParams.set("version",tp),fetch(h.href,{referrerPolicy:this._options.referrerPolicy})}retrieveId(){return tt(this,null,function*(){try{const t=yield this._buildRequest("id");if(t.status!==200)throw new Error(`Error. Status:${t.status}`);return t.text()}catch(t){Ce.error("Error retrieving ID",t);let e="";throw this._options.path==="/"&&this._options.host!==pn.CLOUD_HOST&&(e=" If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer."),new Error("Could not get an ID from the server."+e)}})}listAllPeers(){return tt(this,null,function*(){try{const t=yield this._buildRequest("peers");if(t.status!==200){if(t.status===401){let e="";throw this._options.host===pn.CLOUD_HOST?e="It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key.":e="You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.",new Error("It doesn't look like you have permission to list peers IDs. "+e)}throw new Error(`Error. Status:${t.status}`)}return t.json()}catch(t){throw Ce.error("Error retrieving list peers",t),new Error("Could not get list peers from the server."+t)}})}}var Yu,Vu;const pi=class pi extends ip{get type(){return jr.Data}constructor(t,e,n){super(t,e,n),this.connectionId=this.options.connectionId||pi.ID_PREFIX+Jd(),this.label=this.options.label||this.connectionId,this.reliable=!!this.options.reliable,this._negotiator=new np(this),this._negotiator.startConnection(this.options._payload||{originator:!0,reliable:this.reliable})}_initializeDataChannel(t){this.dataChannel=t,this.dataChannel.onopen=()=>{Ce.log(`DC#${this.connectionId} dc connection success`),this._open=!0,this.emit("open")},this.dataChannel.onmessage=e=>{Ce.log(`DC#${this.connectionId} dc onmessage:`,e.data)},this.dataChannel.onclose=()=>{Ce.log(`DC#${this.connectionId} dc closed for:`,this.peer),this.close()}}close(t){if(t!=null&&t.flush){this.send({__peerData:{type:"close"}});return}this._negotiator&&(this._negotiator.cleanup(),this._negotiator=null),this.provider&&(this.provider._removeConnection(this),this.provider=null),this.dataChannel&&(this.dataChannel.onopen=null,this.dataChannel.onmessage=null,this.dataChannel.onclose=null,this.dataChannel=null),this.open&&(this._open=!1,super.emit("close"))}send(t,e=!1){if(!this.open){this.emitError(Qu.NotOpenYet,"Connection is not open. You should listen for the `open` event before sending messages.");return}return this._send(t,e)}handleMessage(t){return tt(this,null,function*(){const e=t.payload;switch(t.type){case en.Answer:yield this._negotiator.handleSDP(t.type,e.sdp);break;case en.Candidate:yield this._negotiator.handleCandidate(e.candidate);break;default:Ce.warn("Unrecognized message type:",t.type,"from peer:",this.peer);break}})}};Yu=new WeakMap,Vu=new WeakMap,Xo(pi,Yu,pi.ID_PREFIX="dc_"),Xo(pi,Vu,pi.MAX_BUFFERED_AMOUNT=8388608);let Cs=pi;class Ju extends Cs{get bufferSize(){return this._bufferSize}_initializeDataChannel(t){super._initializeDataChannel(t),this.dataChannel.binaryType="arraybuffer",this.dataChannel.addEventListener("message",e=>this._handleDataMessage(e))}_bufferedSend(t){(this._buffering||!this._trySend(t))&&(this._buffer.push(t),this._bufferSize=this._buffer.length)}_trySend(t){if(!this.open)return!1;if(this.dataChannel.bufferedAmount>Cs.MAX_BUFFERED_AMOUNT)return this._buffering=!0,setTimeout(()=>{this._buffering=!1,this._tryBuffer()},50),!1;try{this.dataChannel.send(t)}catch(e){return Ce.error(`DC#:${this.connectionId} Error when sending:`,e),this._buffering=!0,this.close(),!1}return!0}_tryBuffer(){if(!this.open||this._buffer.length===0)return;const t=this._buffer[0];this._trySend(t)&&(this._buffer.shift(),this._bufferSize=this._buffer.length,this._tryBuffer())}close(t){if(t!=null&&t.flush){this.send({__peerData:{type:"close"}});return}this._buffer=[],this._bufferSize=0,super.close()}constructor(...t){super(...t),this._buffer=[],this._bufferSize=0,this._buffering=!1}}class lu extends Ju{close(t){super.close(t),this._chunkedData={}}constructor(t,e,n){super(t,e,n),this.chunker=new Qd,this.serialization=$s.Binary,this._chunkedData={}}_handleDataMessage({data:t}){const e=vd(t),n=e.__peerData;if(n){if(n.type==="close"){this.close();return}this._handleChunk(e);return}this.emit("data",e)}_handleChunk(t){const e=t.__peerData,n=this._chunkedData[e]||{data:[],count:0,total:t.total};if(n.data[t.n]=new Uint8Array(t.data),n.count++,this._chunkedData[e]=n,n.total===n.count){delete this._chunkedData[e];const i=P1(n.data);this._handleDataMessage({data:i})}}_send(t,e){const n=yd(t);if(n instanceof Promise)return this._send_blob(n);if(!e&&n.byteLength>this.chunker.chunkedMTU){this._sendChunks(n);return}this._bufferedSend(n)}_send_blob(t){return tt(this,null,function*(){const e=yield t;if(e.byteLength>this.chunker.chunkedMTU){this._sendChunks(e);return}this._bufferedSend(e)})}_sendChunks(t){const e=this.chunker.chunk(t);Ce.log(`DC#${this.connectionId} Try to send ${e.length} chunks...`);for(const n of e)this.send(n,!0)}}class j1 extends Ju{_handleDataMessage({data:t}){super.emit("data",t)}_send(t,e){this._bufferedSend(t)}constructor(...t){super(...t),this.serialization=$s.None}}class $1 extends Ju{_handleDataMessage({data:t}){const e=this.parse(this.decoder.decode(t)),n=e.__peerData;if(n&&n.type==="close"){this.close();return}this.emit("data",e)}_send(t,e){const n=this.encoder.encode(this.stringify(t));if(n.byteLength>=pn.chunkedMTU){this.emitError(Qu.MessageToBig,"Message too big for JSON channel");return}this._bufferedSend(n)}constructor(...t){super(...t),this.serialization=$s.JSON,this.encoder=new TextEncoder,this.decoder=new TextDecoder,this.stringify=JSON.stringify,this.parse=JSON.parse}}var Ku;const la=class la extends rp{get id(){return this._id}get options(){return this._options}get open(){return this._open}get socket(){return this._socket}get connections(){const t=Object.create(null);for(const[e,n]of this._connections)t[e]=n;return t}get destroyed(){return this._destroyed}get disconnected(){return this._disconnected}constructor(t,e){super(),this._serializers={raw:j1,json:$1,binary:lu,"binary-utf8":lu,default:lu},this._id=null,this._lastServerId=null,this._destroyed=!1,this._disconnected=!1,this._open=!1,this._connections=new Map,this._lostMessages=new Map;let n;if(t&&t.constructor==Object?e=t:t&&(n=t.toString()),e=st({debug:0,host:pn.CLOUD_HOST,port:pn.CLOUD_PORT,path:"/",key:la.DEFAULT_KEY,token:pn.randomToken(),config:pn.defaultConfig,referrerPolicy:"strict-origin-when-cross-origin",serializers:{}},e),this._options=e,this._serializers=st(st({},this._serializers),this.options.serializers),this._options.host==="/"&&(this._options.host=window.location.hostname),this._options.path&&(this._options.path[0]!=="/"&&(this._options.path="/"+this._options.path),this._options.path[this._options.path.length-1]!=="/"&&(this._options.path+="/")),this._options.secure===void 0&&this._options.host!==pn.CLOUD_HOST?this._options.secure=pn.isSecure():this._options.host==pn.CLOUD_HOST&&(this._options.secure=!0),this._options.logFunction&&Ce.setLogFunction(this._options.logFunction),Ce.logLevel=this._options.debug||0,this._api=new q1(e),this._socket=this._createServerConnection(),!pn.supports.audioVideo&&!pn.supports.data){this._delayedAbort(It.BrowserIncompatible,"The current browser does not support WebRTC");return}if(n&&!pn.validateId(n)){this._delayedAbort(It.InvalidID,`ID "${n}" is invalid`);return}n?this._initialize(n):this._api.retrieveId().then(i=>this._initialize(i)).catch(i=>this._abort(It.ServerError,i))}_createServerConnection(){const t=new B1(this._options.secure,this._options.host,this._options.port,this._options.path,this._options.key,this._options.pingInterval);return t.on(Br.Message,e=>{this._handleMessage(e)}),t.on(Br.Error,e=>{this._abort(It.SocketError,e)}),t.on(Br.Disconnected,()=>{this.disconnected||(this.emitError(It.Network,"Lost connection to server."),this.disconnect())}),t.on(Br.Close,()=>{this.disconnected||this._abort(It.SocketClosed,"Underlying socket is already closed.")}),t}_initialize(t){this._id=t,this.socket.start(t,this._options.token)}_handleMessage(t){const e=t.type,n=t.payload,i=t.src;switch(e){case en.Open:this._lastServerId=this.id,this._open=!0,this.emit("open",this.id);break;case en.Error:this._abort(It.ServerError,n.msg);break;case en.IdTaken:this._abort(It.UnavailableID,`ID "${this.id}" is taken`);break;case en.InvalidKey:this._abort(It.InvalidKey,`API KEY "${this._options.key}" is invalid`);break;case en.Leave:Ce.log(`Received leave message from ${i}`),this._cleanupPeer(i),this._connections.delete(i);break;case en.Expire:this.emitError(It.PeerUnavailable,`Could not connect to peer ${i}`);break;case en.Offer:{const l=n.connectionId;let c=this.getConnection(i,l);if(c&&(c.close(),Ce.warn(`Offer received for existing Connection ID:${l}`)),n.type===jr.Media){const d=new As(i,this,{connectionId:l,_payload:n,metadata:n.metadata});c=d,this._addConnection(i,c),this.emit("call",d)}else if(n.type===jr.Data){const d=new this._serializers[n.serialization](i,this,{connectionId:l,_payload:n,metadata:n.metadata,label:n.label,serialization:n.serialization,reliable:n.reliable});c=d,this._addConnection(i,c),this.emit("connection",d)}else{Ce.warn(`Received malformed connection type:${n.type}`);return}const h=this._getMessages(l);for(const d of h)c.handleMessage(d);break}default:{if(!n){Ce.warn(`You received a malformed message from ${i} of type ${e}`);return}const l=n.connectionId,c=this.getConnection(i,l);c&&c.peerConnection?c.handleMessage(t):l?this._storeMessage(l,t):Ce.warn("You received an unrecognized message:",t);break}}}_storeMessage(t,e){this._lostMessages.has(t)||this._lostMessages.set(t,[]),this._lostMessages.get(t).push(e)}_getMessages(t){const e=this._lostMessages.get(t);return e?(this._lostMessages.delete(t),e):[]}connect(t,e={}){if(e=st({serialization:"default"},e),this.disconnected){Ce.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect, or call reconnect on this peer if you believe its ID to still be available."),this.emitError(It.Disconnected,"Cannot connect to new Peer after disconnecting from server.");return}const n=new this._serializers[e.serialization](t,this,e);return this._addConnection(t,n),n}call(t,e,n={}){if(this.disconnected){Ce.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect."),this.emitError(It.Disconnected,"Cannot connect to new Peer after disconnecting from server.");return}if(!e){Ce.error("To call a peer, you must provide a stream from your browser's `getUserMedia`.");return}const i=new As(t,this,Ut(st({},n),{_stream:e}));return this._addConnection(t,i),i}_addConnection(t,e){Ce.log(`add connection ${e.type}:${e.connectionId} to peerId:${t}`),this._connections.has(t)||this._connections.set(t,[]),this._connections.get(t).push(e)}_removeConnection(t){const e=this._connections.get(t.peer);if(e){const n=e.indexOf(t);n!==-1&&e.splice(n,1)}this._lostMessages.delete(t.connectionId)}getConnection(t,e){const n=this._connections.get(t);if(!n)return null;for(const i of n)if(i.connectionId===e)return i;return null}_delayedAbort(t,e){setTimeout(()=>{this._abort(t,e)},0)}_abort(t,e){Ce.error("Aborting!"),this.emitError(t,e),this._lastServerId?this.disconnect():this.destroy()}destroy(){this.destroyed||(Ce.log(`Destroy peer with ID:${this.id}`),this.disconnect(),this._cleanup(),this._destroyed=!0,this.emit("close"))}_cleanup(){for(const t of this._connections.keys())this._cleanupPeer(t),this._connections.delete(t);this.socket.removeAllListeners()}_cleanupPeer(t){const e=this._connections.get(t);if(e)for(const n of e)n.close()}disconnect(){if(this.disconnected)return;const t=this.id;Ce.log(`Disconnect peer with ID:${t}`),this._disconnected=!0,this._open=!1,this.socket.close(),this._lastServerId=t,this._id=null,this.emit("disconnected",t)}reconnect(){if(this.disconnected&&!this.destroyed)Ce.log(`Attempting reconnection to server with ID ${this._lastServerId}`),this._disconnected=!1,this._initialize(this._lastServerId);else{if(this.destroyed)throw new Error("This peer cannot reconnect to the server. It has already been destroyed.");if(!this.disconnected&&!this.open)Ce.error("In a hurry? We're still trying to make the initial connection!");else throw new Error(`Peer ${this.id} cannot reconnect because it is not disconnected from the server!`)}}listAllPeers(t=e=>{}){this._api.listAllPeers().then(e=>t(e)).catch(e=>this._abort(It.ServerError,e))}};Ku=new WeakMap,Xo(la,Ku,la.DEFAULT_KEY="peerjs");let Cu=la;var uA=Cu,ks={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ks.exports;(function(r,t){(function(){var e,n="4.17.21",i=200,l="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",h="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",g=500,p="__lodash_placeholder__",a=1,u=2,f=4,y=1,_=2,b=1,v=2,w=4,T=8,x=16,S=32,C=64,A=128,R=256,L=512,M=30,k="...",P=800,I=16,j=1,W=2,J=3,ee=1/0,oe=9007199254740991,V=17976931348623157e292,$=NaN,N=4294967295,H=N-1,G=N>>>1,ne=[["ary",A],["bind",b],["bindKey",v],["curry",T],["curryRight",x],["flip",L],["partial",S],["partialRight",C],["rearg",R]],X="[object Arguments]",U="[object Array]",Q="[object AsyncFunction]",ie="[object Boolean]",ae="[object Date]",de="[object DOMException]",we="[object Error]",Pe="[object Function]",Me="[object GeneratorFunction]",De="[object Map]",ze="[object Number]",xt="[object Null]",Je="[object Object]",le="[object Promise]",he="[object Proxy]",_e="[object RegExp]",be="[object Set]",ve="[object String]",Be="[object Symbol]",Le="[object Undefined]",Ee="[object WeakMap]",$e="[object WeakSet]",vt="[object ArrayBuffer]",Ve="[object DataView]",nn="[object Float32Array]",z="[object Float64Array]",ue="[object Int8Array]",pe="[object Int16Array]",Te="[object Int32Array]",Ae="[object Uint8Array]",Ie="[object Uint8ClampedArray]",at="[object Uint16Array]",wt="[object Uint32Array]",Ze=/\b__p \+= '';/g,yt=/\b(__p \+=) '' \+/g,Ht=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Kt=/&(?:amp|lt|gt|quot|#39);/g,Wn=/[&<>"']/g,zr=RegExp(Kt.source),ir=RegExp(Wn.source),Gr=/<%-([\s\S]+?)%>/g,Yr=/<%([\s\S]+?)%>/g,br=/<%=([\s\S]+?)%>/g,zn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Si=/^\w*$/,Ln=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Vr=/[\\^$.*+?()[\]{}|]/g,po=RegExp(Vr.source),Kr=/^\s+/,Oi=/\s/,Xr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Nt=/\{\n\/\* \[wrapped with (.+)\] \*/,go=/,? & /,mo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,vo=/[()=,{}\[\]\/\s]/,yo=/\\(\\)?/g,_o=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Bt=/\w*$/,bo=/^[-+]0x[0-9a-f]+$/i,wo=/^0b[01]+$/i,xo=/^\[object .+?Constructor\]$/,To=/^0o[0-7]+$/i,So=/^(?:0|[1-9]\d*)$/,Xt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,wr=/($^)/,Oo=/['\n\r\u2028\u2029\\]/g,xr="\\ud800-\\udfff",Eo="\\u0300-\\u036f",Ao="\\ufe20-\\ufe2f",Tr="\\u20d0-\\u20ff",Zr=Eo+Ao+Tr,or="\\u2700-\\u27bf",mn="a-z\\xdf-\\xf6\\xf8-\\xff",Qr="\\xac\\xb1\\xd7\\xf7",Co="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ko="\\u2000-\\u206f",Po=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ei="A-Z\\xc0-\\xd6\\xd8-\\xde",Ai="\\ufe0e\\ufe0f",ar=Qr+Co+ko+Po,sr="['’]",lr="["+xr+"]",Jr="["+ar+"]",ur="["+Zr+"]",Ci="\\d+",Ro="["+or+"]",ki="["+mn+"]",Pi="[^"+xr+ar+Ci+or+mn+Ei+"]",cr="\\ud83c[\\udffb-\\udfff]",Mo="(?:"+ur+"|"+cr+")",Ri="[^"+xr+"]",In="(?:\\ud83c[\\udde6-\\uddff]){2}",rn="[\\ud800-\\udbff][\\udc00-\\udfff]",Zt="["+Ei+"]",Tn="\\u200d",Mi="(?:"+ki+"|"+Pi+")",Sn="(?:"+Zt+"|"+Pi+")",Di="(?:"+sr+"(?:d|ll|m|re|s|t|ve))?",Li="(?:"+sr+"(?:D|LL|M|RE|S|T|VE))?",Ii=Mo+"?",Ni="["+Ai+"]?",Bi="(?:"+Tn+"(?:"+[Ri,In,rn].join("|")+")"+Ni+Ii+")*",Wt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fi="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ei=Ni+Ii+Bi,Sr="(?:"+[Ro,In,rn].join("|")+")"+ei,ti="(?:"+[Ri+ur+"?",ur,In,rn,lr].join("|")+")",Or=RegExp(sr,"g"),Do=RegExp(ur,"g"),Er=RegExp(cr+"(?="+cr+")|"+ti+ei,"g"),ni=RegExp([Zt+"?"+ki+"+"+Di+"(?="+[Jr,Zt,"$"].join("|")+")",Sn+"+"+Li+"(?="+[Jr,Zt+Mi,"$"].join("|")+")",Zt+"?"+Mi+"+"+Di,Zt+"+"+Li,Fi,Wt,Ci,Sr].join("|"),"g"),qi=RegExp("["+Tn+xr+Zr+Ai+"]"),On=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ji=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ri=-1,ht={};ht[nn]=ht[z]=ht[ue]=ht[pe]=ht[Te]=ht[Ae]=ht[Ie]=ht[at]=ht[wt]=!0,ht[X]=ht[U]=ht[vt]=ht[ie]=ht[Ve]=ht[ae]=ht[we]=ht[Pe]=ht[De]=ht[ze]=ht[Je]=ht[_e]=ht[be]=ht[ve]=ht[Ee]=!1;var ct={};ct[X]=ct[U]=ct[vt]=ct[Ve]=ct[ie]=ct[ae]=ct[nn]=ct[z]=ct[ue]=ct[pe]=ct[Te]=ct[De]=ct[ze]=ct[Je]=ct[_e]=ct[be]=ct[ve]=ct[Be]=ct[Ae]=ct[Ie]=ct[at]=ct[wt]=!0,ct[we]=ct[Pe]=ct[Ee]=!1;var E={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},F={"&":"&","<":"<",">":">",'"':""","'":"'"},K={"&":"&","<":"<",">":">",""":'"',"'":"'"},ce={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,Re=parseInt,nt=typeof bt=="object"&&bt&&bt.Object===Object&&bt,rt=typeof self=="object"&&self&&self.Object===Object&&self,Xe=nt||rt||Function("return this")(),ot=t&&!t.nodeType&&t,Tt=ot&&!0&&r&&!r.nodeType&&r,zt=Tt&&Tt.exports===ot,Ot=zt&&nt.process,dt=function(){try{var te=Tt&&Tt.require&&Tt.require("util").types;return te||Ot&&Ot.binding&&Ot.binding("util")}catch(fe){}}(),Lt=dt&&dt.isArrayBuffer,Nn=dt&&dt.isDate,En=dt&&dt.isMap,Gn=dt&&dt.isRegExp,Lo=dt&&dt.isSet,ii=dt&&dt.isTypedArray;function jt(te,fe,se){switch(se.length){case 0:return te.call(fe);case 1:return te.call(fe,se[0]);case 2:return te.call(fe,se[0],se[1]);case 3:return te.call(fe,se[0],se[1],se[2])}return te.apply(fe,se)}function Ig(te,fe,se,Oe){for(var He=-1,lt=te==null?0:te.length;++He-1}function rl(te,fe,se){for(var Oe=-1,He=te==null?0:te.length;++Oe-1;);return se}function Ac(te,fe){for(var se=te.length;se--&&$i(fe,te[se],0)>-1;);return se}function Wg(te,fe){for(var se=te.length,Oe=0;se--;)te[se]===fe&&++Oe;return Oe}var zg=sl(E),Gg=sl(F);function Yg(te){return"\\"+ce[te]}function Vg(te,fe){return te==null?e:te[fe]}function Ui(te){return qi.test(te)}function Kg(te){return On.test(te)}function Xg(te){for(var fe,se=[];!(fe=te.next()).done;)se.push(fe.value);return se}function fl(te){var fe=-1,se=Array(te.size);return te.forEach(function(Oe,He){se[++fe]=[He,Oe]}),se}function Cc(te,fe){return function(se){return te(fe(se))}}function kr(te,fe){for(var se=-1,Oe=te.length,He=0,lt=[];++se-1}function Bm(o,s){var m=this.__data__,O=Ha(m,o);return O<0?(++this.size,m.push([o,s])):m[O][1]=s,this}fr.prototype.clear=Dm,fr.prototype.delete=Lm,fr.prototype.get=Im,fr.prototype.has=Nm,fr.prototype.set=Bm;function hr(o){var s=-1,m=o==null?0:o.length;for(this.clear();++s=s?o:s)),o}function Pn(o,s,m,O,D,q){var Y,Z=s&a,re=s&u,ge=s&f;if(m&&(Y=D?m(o,O,D,q):m(o)),Y!==e)return Y;if(!Et(o))return o;var me=We(o);if(me){if(Y=$v(o),!Z)return un(o,Y)}else{var ye=Jt(o),xe=ye==Pe||ye==Me;if(Ir(o))return ff(o,Z);if(ye==Je||ye==X||xe&&!D){if(Y=re||xe?{}:Pf(o),!Z)return re?Pv(o,Jm(Y,o)):kv(o,jc(Y,o))}else{if(!ct[ye])return D?o:{};Y=Uv(o,ye,Z)}}q||(q=new Fn);var ke=q.get(o);if(ke)return ke;q.set(o,Y),oh(o)?o.forEach(function(qe){Y.add(Pn(qe,s,m,qe,o,q))}):rh(o)&&o.forEach(function(qe,Qe){Y.set(Qe,Pn(qe,s,m,Qe,o,q))});var Fe=ge?re?Bl:Nl:re?fn:$t,Ye=me?e:Fe(o);return An(Ye||o,function(qe,Qe){Ye&&(Qe=qe,qe=o[Qe]),$o(Y,Qe,Pn(qe,s,m,Qe,o,q))}),Y}function ev(o){var s=$t(o);return function(m){return $c(m,o,s)}}function $c(o,s,m){var O=m.length;if(o==null)return!O;for(o=_t(o);O--;){var D=m[O],q=s[D],Y=o[D];if(Y===e&&!(D in o)||!q(Y))return!1}return!0}function Uc(o,s,m){if(typeof o!="function")throw new Cn(c);return Vo(function(){o.apply(e,m)},s)}function Uo(o,s,m,O){var D=-1,q=Ea,Y=!0,Z=o.length,re=[],ge=s.length;if(!Z)return re;m&&(s=St(s,vn(m))),O?(q=rl,Y=!1):s.length>=i&&(q=Io,Y=!1,s=new si(s));e:for(;++DD?0:D+m),O=O===e||O>D?D:Ge(O),O<0&&(O+=D),O=m>O?0:sh(O);m0&&m(Z)?s>1?Gt(Z,s-1,m,O,D):Cr(D,Z):O||(D[D.length]=Z)}return D}var yl=vf(),zc=vf(!0);function Yn(o,s){return o&&yl(o,s,$t)}function _l(o,s){return o&&zc(o,s,$t)}function za(o,s){return Ar(s,function(m){return vr(o[m])})}function ui(o,s){s=Dr(s,o);for(var m=0,O=s.length;o!=null&&ms}function rv(o,s){return o!=null&&pt.call(o,s)}function iv(o,s){return o!=null&&s in _t(o)}function ov(o,s,m){return o>=Qt(s,m)&&o=120&&me.length>=120)?new si(Y&&me):e}me=o[0];var ye=-1,xe=Z[0];e:for(;++ye-1;)Z!==o&&Na.call(Z,re,1),Na.call(o,re,1);return o}function nf(o,s){for(var m=o?s.length:0,O=m-1;m--;){var D=s[m];if(m==O||D!==q){var q=D;mr(D)?Na.call(o,D,1):kl(o,D)}}return o}function El(o,s){return o+qa(Nc()*(s-o+1))}function yv(o,s,m,O){for(var D=-1,q=qt(Fa((s-o)/(m||1)),0),Y=se(q);q--;)Y[O?q:++D]=o,o+=m;return Y}function Al(o,s){var m="";if(!o||s<1||s>oe)return m;do s%2&&(m+=o),s=qa(s/2),s&&(o+=o);while(s);return m}function Ke(o,s){return Wl(Df(o,s,hn),o+"")}function _v(o){return qc(Ji(o))}function bv(o,s){var m=Ji(o);return ns(m,li(s,0,m.length))}function zo(o,s,m,O){if(!Et(o))return o;s=Dr(s,o);for(var D=-1,q=s.length,Y=q-1,Z=o;Z!=null&&++DD?0:D+s),m=m>D?D:m,m<0&&(m+=D),D=s>m?0:m-s>>>0,s>>>=0;for(var q=se(D);++O>>1,Y=o[q];Y!==null&&!_n(Y)&&(m?Y<=s:Y=i){var ge=s?null:Lv(o);if(ge)return Ca(ge);Y=!1,D=Io,re=new si}else re=s?[]:Z;e:for(;++O=O?o:Rn(o,s,m)}var cf=fm||function(o){return Xe.clearTimeout(o)};function ff(o,s){if(s)return o.slice();var m=o.length,O=Rc?Rc(m):new o.constructor(m);return o.copy(O),O}function Dl(o){var s=new o.constructor(o.byteLength);return new La(s).set(new La(o)),s}function Ov(o,s){var m=s?Dl(o.buffer):o.buffer;return new o.constructor(m,o.byteOffset,o.byteLength)}function Ev(o){var s=new o.constructor(o.source,Bt.exec(o));return s.lastIndex=o.lastIndex,s}function Av(o){return jo?_t(jo.call(o)):{}}function hf(o,s){var m=s?Dl(o.buffer):o.buffer;return new o.constructor(m,o.byteOffset,o.length)}function df(o,s){if(o!==s){var m=o!==e,O=o===null,D=o===o,q=_n(o),Y=s!==e,Z=s===null,re=s===s,ge=_n(s);if(!Z&&!ge&&!q&&o>s||q&&Y&&re&&!Z&&!ge||O&&Y&&re||!m&&re||!D)return 1;if(!O&&!q&&!ge&&o=Z)return re;var ge=m[O];return re*(ge=="desc"?-1:1)}}return o.index-s.index}function pf(o,s,m,O){for(var D=-1,q=o.length,Y=m.length,Z=-1,re=s.length,ge=qt(q-Y,0),me=se(re+ge),ye=!O;++Z1?m[D-1]:e,Y=D>2?m[2]:e;for(q=o.length>3&&typeof q=="function"?(D--,q):e,Y&&an(m[0],m[1],Y)&&(q=D<3?e:q,D=1),s=_t(s);++O-1?D[q?s[Y]:Y]:e}}function bf(o){return gr(function(s){var m=s.length,O=m,D=kn.prototype.thru;for(o&&s.reverse();O--;){var q=s[O];if(typeof q!="function")throw new Cn(c);if(D&&!Y&&es(q)=="wrapper")var Y=new kn([],!0)}for(O=Y?O:m;++O1&&it.reverse(),me&&reZ))return!1;var ge=q.get(o),me=q.get(s);if(ge&&me)return ge==s&&me==o;var ye=-1,xe=!0,ke=m&_?new si:e;for(q.set(o,s),q.set(s,o);++ye1?"& ":"")+s[O],s=s.join(m>2?", ":" "),o.replace(Xr,`{ /* [wrapped with `+s+`] */ `)}function Wv(o){return We(o)||hi(o)||!!(Lc&&o&&o[Lc])}function mr(o,s){var m=typeof o;return s=s==null?oe:s,!!s&&(m=="number"||m!="symbol"&&So.test(o))&&o>-1&&o%1==0&&o0){if(++s>=P)return arguments[0]}else s=0;return o.apply(e,arguments)}}function ns(o,s){var m=-1,O=o.length,D=O-1;for(s=s===e?O:s;++m1?o[s-1]:e;return m=typeof m=="function"?(o.pop(),m):e,zf(o,m)});function Gf(o){var s=B(o);return s.__chain__=!0,s}function t0(o,s){return s(o),o}function rs(o,s){return s(o)}var n0=gr(function(o){var s=o.length,m=s?o[0]:0,O=this.__wrapped__,D=function(q){return vl(q,o)};return s>1||this.__actions__.length||!(O instanceof et)||!mr(m)?this.thru(D):(O=O.slice(m,+m+(s?1:0)),O.__actions__.push({func:rs,args:[D],thisArg:e}),new kn(O,this.__chain__).thru(function(q){return s&&!q.length&&q.push(e),q}))});function r0(){return Gf(this)}function i0(){return new kn(this.value(),this.__chain__)}function o0(){this.__values__===e&&(this.__values__=ah(this.value()));var o=this.__index__>=this.__values__.length,s=o?e:this.__values__[this.__index__++];return{done:o,value:s}}function a0(){return this}function s0(o){for(var s,m=this;m instanceof Ua;){var O=qf(m);O.__index__=0,O.__values__=e,s?D.__wrapped__=O:s=O;var D=O;m=m.__wrapped__}return D.__wrapped__=o,s}function l0(){var o=this.__wrapped__;if(o instanceof et){var s=o;return this.__actions__.length&&(s=new et(this)),s=s.reverse(),s.__actions__.push({func:rs,args:[zl],thisArg:e}),new kn(s,this.__chain__)}return this.thru(zl)}function u0(){return lf(this.__wrapped__,this.__actions__)}var c0=Ka(function(o,s,m){pt.call(o,m)?++o[m]:dr(o,m,1)});function f0(o,s,m){var O=We(o)?bc:tv;return m&&an(o,s,m)&&(s=e),O(o,Ne(s,3))}function h0(o,s){var m=We(o)?Ar:Wc;return m(o,Ne(s,3))}var d0=_f(jf),p0=_f($f);function g0(o,s){return Gt(is(o,s),1)}function m0(o,s){return Gt(is(o,s),ee)}function v0(o,s,m){return m=m===e?1:Ge(m),Gt(is(o,s),m)}function Yf(o,s){var m=We(o)?An:Rr;return m(o,Ne(s,3))}function Vf(o,s){var m=We(o)?Ng:Hc;return m(o,Ne(s,3))}var y0=Ka(function(o,s,m){pt.call(o,m)?o[m].push(s):dr(o,m,[s])});function _0(o,s,m,O){o=cn(o)?o:Ji(o),m=m&&!O?Ge(m):0;var D=o.length;return m<0&&(m=qt(D+m,0)),us(o)?m<=D&&o.indexOf(s,m)>-1:!!D&&$i(o,s,m)>-1}var b0=Ke(function(o,s,m){var O=-1,D=typeof s=="function",q=cn(o)?se(o.length):[];return Rr(o,function(Y){q[++O]=D?jt(s,Y,m):Ho(Y,s,m)}),q}),w0=Ka(function(o,s,m){dr(o,m,s)});function is(o,s){var m=We(o)?St:Xc;return m(o,Ne(s,3))}function x0(o,s,m,O){return o==null?[]:(We(s)||(s=s==null?[]:[s]),m=O?e:m,We(m)||(m=m==null?[]:[m]),ef(o,s,m))}var T0=Ka(function(o,s,m){o[m?0:1].push(s)},function(){return[[],[]]});function S0(o,s,m){var O=We(o)?il:Sc,D=arguments.length<3;return O(o,Ne(s,4),m,D,Rr)}function O0(o,s,m){var O=We(o)?Bg:Sc,D=arguments.length<3;return O(o,Ne(s,4),m,D,Hc)}function E0(o,s){var m=We(o)?Ar:Wc;return m(o,ss(Ne(s,3)))}function A0(o){var s=We(o)?qc:_v;return s(o)}function C0(o,s,m){(m?an(o,s,m):s===e)?s=1:s=Ge(s);var O=We(o)?Xm:bv;return O(o,s)}function k0(o){var s=We(o)?Zm:xv;return s(o)}function P0(o){if(o==null)return 0;if(cn(o))return us(o)?Hi(o):o.length;var s=Jt(o);return s==De||s==be?o.size:Tl(o).length}function R0(o,s,m){var O=We(o)?ol:Tv;return m&&an(o,s,m)&&(s=e),O(o,Ne(s,3))}var M0=Ke(function(o,s){if(o==null)return[];var m=s.length;return m>1&&an(o,s[0],s[1])?s=[]:m>2&&an(s[0],s[1],s[2])&&(s=[s[0]]),ef(o,Gt(s,1),[])}),os=hm||function(){return Xe.Date.now()};function D0(o,s){if(typeof s!="function")throw new Cn(c);return o=Ge(o),function(){if(--o<1)return s.apply(this,arguments)}}function Kf(o,s,m){return s=m?e:s,s=o&&s==null?o.length:s,pr(o,A,e,e,e,e,s)}function Xf(o,s){var m;if(typeof s!="function")throw new Cn(c);return o=Ge(o),function(){return--o>0&&(m=s.apply(this,arguments)),o<=1&&(s=e),m}}var Yl=Ke(function(o,s,m){var O=b;if(m.length){var D=kr(m,Zi(Yl));O|=S}return pr(o,O,s,m,D)}),Zf=Ke(function(o,s,m){var O=b|v;if(m.length){var D=kr(m,Zi(Zf));O|=S}return pr(s,O,o,m,D)});function Qf(o,s,m){s=m?e:s;var O=pr(o,T,e,e,e,e,e,s);return O.placeholder=Qf.placeholder,O}function Jf(o,s,m){s=m?e:s;var O=pr(o,x,e,e,e,e,e,s);return O.placeholder=Jf.placeholder,O}function eh(o,s,m){var O,D,q,Y,Z,re,ge=0,me=!1,ye=!1,xe=!0;if(typeof o!="function")throw new Cn(c);s=Dn(s)||0,Et(m)&&(me=!!m.leading,ye="maxWait"in m,q=ye?qt(Dn(m.maxWait)||0,s):q,xe="trailing"in m?!!m.trailing:xe);function ke(Rt){var jn=O,_r=D;return O=D=e,ge=Rt,Y=o.apply(_r,jn),Y}function Fe(Rt){return ge=Rt,Z=Vo(Qe,s),me?ke(Rt):Y}function Ye(Rt){var jn=Rt-re,_r=Rt-ge,_h=s-jn;return ye?Qt(_h,q-_r):_h}function qe(Rt){var jn=Rt-re,_r=Rt-ge;return re===e||jn>=s||jn<0||ye&&_r>=q}function Qe(){var Rt=os();if(qe(Rt))return it(Rt);Z=Vo(Qe,Ye(Rt))}function it(Rt){return Z=e,xe&&O?ke(Rt):(O=D=e,Y)}function bn(){Z!==e&&cf(Z),ge=0,O=re=D=Z=e}function sn(){return Z===e?Y:it(os())}function wn(){var Rt=os(),jn=qe(Rt);if(O=arguments,D=this,re=Rt,jn){if(Z===e)return Fe(re);if(ye)return cf(Z),Z=Vo(Qe,s),ke(re)}return Z===e&&(Z=Vo(Qe,s)),Y}return wn.cancel=bn,wn.flush=sn,wn}var L0=Ke(function(o,s){return Uc(o,1,s)}),I0=Ke(function(o,s,m){return Uc(o,Dn(s)||0,m)});function N0(o){return pr(o,L)}function as(o,s){if(typeof o!="function"||s!=null&&typeof s!="function")throw new Cn(c);var m=function(){var O=arguments,D=s?s.apply(this,O):O[0],q=m.cache;if(q.has(D))return q.get(D);var Y=o.apply(this,O);return m.cache=q.set(D,Y)||q,Y};return m.cache=new(as.Cache||hr),m}as.Cache=hr;function ss(o){if(typeof o!="function")throw new Cn(c);return function(){var s=arguments;switch(s.length){case 0:return!o.call(this);case 1:return!o.call(this,s[0]);case 2:return!o.call(this,s[0],s[1]);case 3:return!o.call(this,s[0],s[1],s[2])}return!o.apply(this,s)}}function B0(o){return Xf(2,o)}var F0=Sv(function(o,s){s=s.length==1&&We(s[0])?St(s[0],vn(Ne())):St(Gt(s,1),vn(Ne()));var m=s.length;return Ke(function(O){for(var D=-1,q=Qt(O.length,m);++D=s}),hi=Yc(function(){return arguments}())?Yc:function(o){return Ct(o)&&pt.call(o,"callee")&&!Dc.call(o,"callee")},We=se.isArray,J0=Lt?vn(Lt):sv;function cn(o){return o!=null&&ls(o.length)&&!vr(o)}function Pt(o){return Ct(o)&&cn(o)}function e_(o){return o===!0||o===!1||Ct(o)&&on(o)==ie}var Ir=pm||ou,t_=Nn?vn(Nn):lv;function n_(o){return Ct(o)&&o.nodeType===1&&!Ko(o)}function r_(o){if(o==null)return!0;if(cn(o)&&(We(o)||typeof o=="string"||typeof o.splice=="function"||Ir(o)||Qi(o)||hi(o)))return!o.length;var s=Jt(o);if(s==De||s==be)return!o.size;if(Yo(o))return!Tl(o).length;for(var m in o)if(pt.call(o,m))return!1;return!0}function i_(o,s){return Wo(o,s)}function o_(o,s,m){m=typeof m=="function"?m:e;var O=m?m(o,s):e;return O===e?Wo(o,s,e,m):!!O}function Kl(o){if(!Ct(o))return!1;var s=on(o);return s==we||s==de||typeof o.message=="string"&&typeof o.name=="string"&&!Ko(o)}function a_(o){return typeof o=="number"&&Ic(o)}function vr(o){if(!Et(o))return!1;var s=on(o);return s==Pe||s==Me||s==Q||s==he}function nh(o){return typeof o=="number"&&o==Ge(o)}function ls(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=oe}function Et(o){var s=typeof o;return o!=null&&(s=="object"||s=="function")}function Ct(o){return o!=null&&typeof o=="object"}var rh=En?vn(En):cv;function s_(o,s){return o===s||xl(o,s,ql(s))}function l_(o,s,m){return m=typeof m=="function"?m:e,xl(o,s,ql(s),m)}function u_(o){return ih(o)&&o!=+o}function c_(o){if(Yv(o))throw new He(l);return Vc(o)}function f_(o){return o===null}function h_(o){return o==null}function ih(o){return typeof o=="number"||Ct(o)&&on(o)==ze}function Ko(o){if(!Ct(o)||on(o)!=Je)return!1;var s=Ia(o);if(s===null)return!0;var m=pt.call(s,"constructor")&&s.constructor;return typeof m=="function"&&m instanceof m&&Ra.call(m)==lm}var Xl=Gn?vn(Gn):fv;function d_(o){return nh(o)&&o>=-oe&&o<=oe}var oh=Lo?vn(Lo):hv;function us(o){return typeof o=="string"||!We(o)&&Ct(o)&&on(o)==ve}function _n(o){return typeof o=="symbol"||Ct(o)&&on(o)==Be}var Qi=ii?vn(ii):dv;function p_(o){return o===e}function g_(o){return Ct(o)&&Jt(o)==Ee}function m_(o){return Ct(o)&&on(o)==$e}var v_=Ja(Sl),y_=Ja(function(o,s){return o<=s});function ah(o){if(!o)return[];if(cn(o))return us(o)?Bn(o):un(o);if(No&&o[No])return Xg(o[No]());var s=Jt(o),m=s==De?fl:s==be?Ca:Ji;return m(o)}function yr(o){if(!o)return o===0?o:0;if(o=Dn(o),o===ee||o===-ee){var s=o<0?-1:1;return s*V}return o===o?o:0}function Ge(o){var s=yr(o),m=s%1;return s===s?m?s-m:s:0}function sh(o){return o?li(Ge(o),0,N):0}function Dn(o){if(typeof o=="number")return o;if(_n(o))return $;if(Et(o)){var s=typeof o.valueOf=="function"?o.valueOf():o;o=Et(s)?s+"":s}if(typeof o!="string")return o===0?o:+o;o=Oc(o);var m=wo.test(o);return m||To.test(o)?Re(o.slice(2),m?2:8):bo.test(o)?$:+o}function lh(o){return Vn(o,fn(o))}function __(o){return o?li(Ge(o),-oe,oe):o===0?o:0}function ft(o){return o==null?"":yn(o)}var b_=Ki(function(o,s){if(Yo(s)||cn(s)){Vn(s,$t(s),o);return}for(var m in s)pt.call(s,m)&&$o(o,m,s[m])}),uh=Ki(function(o,s){Vn(s,fn(s),o)}),cs=Ki(function(o,s,m,O){Vn(s,fn(s),o,O)}),w_=Ki(function(o,s,m,O){Vn(s,$t(s),o,O)}),x_=gr(vl);function T_(o,s){var m=Vi(o);return s==null?m:jc(m,s)}var S_=Ke(function(o,s){o=_t(o);var m=-1,O=s.length,D=O>2?s[2]:e;for(D&&an(s[0],s[1],D)&&(O=1);++m1),q}),Vn(o,Bl(o),m),O&&(m=Pn(m,a|u|f,Iv));for(var D=s.length;D--;)kl(m,s[D]);return m});function U_(o,s){return fh(o,ss(Ne(s)))}var H_=gr(function(o,s){return o==null?{}:mv(o,s)});function fh(o,s){if(o==null)return{};var m=St(Bl(o),function(O){return[O]});return s=Ne(s),tf(o,m,function(O,D){return s(O,D[0])})}function W_(o,s,m){s=Dr(s,o);var O=-1,D=s.length;for(D||(D=1,o=e);++Os){var O=o;o=s,s=O}if(m||o%1||s%1){var D=Nc();return Qt(o+D*(s-o+Ue("1e-"+((D+"").length-1))),s)}return El(o,s)}var tb=Xi(function(o,s,m){return s=s.toLowerCase(),o+(m?ph(s):s)});function ph(o){return Jl(ft(o).toLowerCase())}function gh(o){return o=ft(o),o&&o.replace(Xt,zg).replace(Do,"")}function nb(o,s,m){o=ft(o),s=yn(s);var O=o.length;m=m===e?O:li(Ge(m),0,O);var D=m;return m-=s.length,m>=0&&o.slice(m,D)==s}function rb(o){return o=ft(o),o&&ir.test(o)?o.replace(Wn,Gg):o}function ib(o){return o=ft(o),o&&po.test(o)?o.replace(Vr,"\\$&"):o}var ob=Xi(function(o,s,m){return o+(m?"-":"")+s.toLowerCase()}),ab=Xi(function(o,s,m){return o+(m?" ":"")+s.toLowerCase()}),sb=yf("toLowerCase");function lb(o,s,m){o=ft(o),s=Ge(s);var O=s?Hi(o):0;if(!s||O>=s)return o;var D=(s-O)/2;return Qa(qa(D),m)+o+Qa(Fa(D),m)}function ub(o,s,m){o=ft(o),s=Ge(s);var O=s?Hi(o):0;return s&&O>>0,m?(o=ft(o),o&&(typeof s=="string"||s!=null&&!Xl(s))&&(s=yn(s),!s&&Ui(o))?Lr(Bn(o),0,m):o.split(s,m)):[]}var mb=Xi(function(o,s,m){return o+(m?" ":"")+Jl(s)});function vb(o,s,m){return o=ft(o),m=m==null?0:li(Ge(m),0,o.length),s=yn(s),o.slice(m,m+s.length)==s}function yb(o,s,m){var O=B.templateSettings;m&&an(o,s,m)&&(s=e),o=ft(o),s=cs({},s,O,Of);var D=cs({},s.imports,O.imports,Of),q=$t(D),Y=cl(D,q),Z,re,ge=0,me=s.interpolate||wr,ye="__p += '",xe=hl((s.escape||wr).source+"|"+me.source+"|"+(me===br?_o:wr).source+"|"+(s.evaluate||wr).source+"|$","g"),ke="//# sourceURL="+(pt.call(s,"sourceURL")?(s.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ri+"]")+` `;o.replace(xe,function(qe,Qe,it,bn,sn,wn){return it||(it=bn),ye+=o.slice(ge,wn).replace(Oo,Yg),Qe&&(Z=!0,ye+=`' + __e(`+Qe+`) + '`),sn&&(re=!0,ye+=`'; `+sn+`; __p += '`),it&&(ye+=`' + ((__t = (`+it+`)) == null ? '' : __t) + '`),ge=wn+qe.length,qe}),ye+=`'; `;var Fe=pt.call(s,"variable")&&s.variable;if(!Fe)ye=`with (obj) { `+ye+` } `;else if(vo.test(Fe))throw new He(h);ye=(re?ye.replace(Ze,""):ye).replace(yt,"$1").replace(Ht,"$1;"),ye="function("+(Fe||"obj")+`) { `+(Fe?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(re?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+ye+`return __p }`;var Ye=vh(function(){return lt(q,ke+"return "+ye).apply(e,Y)});if(Ye.source=ye,Kl(Ye))throw Ye;return Ye}function _b(o){return ft(o).toLowerCase()}function bb(o){return ft(o).toUpperCase()}function wb(o,s,m){if(o=ft(o),o&&(m||s===e))return Oc(o);if(!o||!(s=yn(s)))return o;var O=Bn(o),D=Bn(s),q=Ec(O,D),Y=Ac(O,D)+1;return Lr(O,q,Y).join("")}function xb(o,s,m){if(o=ft(o),o&&(m||s===e))return o.slice(0,kc(o)+1);if(!o||!(s=yn(s)))return o;var O=Bn(o),D=Ac(O,Bn(s))+1;return Lr(O,0,D).join("")}function Tb(o,s,m){if(o=ft(o),o&&(m||s===e))return o.replace(Kr,"");if(!o||!(s=yn(s)))return o;var O=Bn(o),D=Ec(O,Bn(s));return Lr(O,D).join("")}function Sb(o,s){var m=M,O=k;if(Et(s)){var D="separator"in s?s.separator:D;m="length"in s?Ge(s.length):m,O="omission"in s?yn(s.omission):O}o=ft(o);var q=o.length;if(Ui(o)){var Y=Bn(o);q=Y.length}if(m>=q)return o;var Z=m-Hi(O);if(Z<1)return O;var re=Y?Lr(Y,0,Z).join(""):o.slice(0,Z);if(D===e)return re+O;if(Y&&(Z+=re.length-Z),Xl(D)){if(o.slice(Z).search(D)){var ge,me=re;for(D.global||(D=hl(D.source,ft(Bt.exec(D))+"g")),D.lastIndex=0;ge=D.exec(me);)var ye=ge.index;re=re.slice(0,ye===e?Z:ye)}}else if(o.indexOf(yn(D),Z)!=Z){var xe=re.lastIndexOf(D);xe>-1&&(re=re.slice(0,xe))}return re+O}function Ob(o){return o=ft(o),o&&zr.test(o)?o.replace(Kt,em):o}var Eb=Xi(function(o,s,m){return o+(m?" ":"")+s.toUpperCase()}),Jl=yf("toUpperCase");function mh(o,s,m){return o=ft(o),s=m?e:s,s===e?Kg(o)?rm(o):jg(o):o.match(s)||[]}var vh=Ke(function(o,s){try{return jt(o,e,s)}catch(m){return Kl(m)?m:new He(m)}}),Ab=gr(function(o,s){return An(s,function(m){m=Kn(m),dr(o,m,Yl(o[m],o))}),o});function Cb(o){var s=o==null?0:o.length,m=Ne();return o=s?St(o,function(O){if(typeof O[1]!="function")throw new Cn(c);return[m(O[0]),O[1]]}):[],Ke(function(O){for(var D=-1;++Doe)return[];var m=N,O=Qt(o,N);s=Ne(s),o-=N;for(var D=ul(O,s);++m0||s<0)?new et(m):(o<0?m=m.takeRight(-o):o&&(m=m.drop(o)),s!==e&&(s=Ge(s),m=s<0?m.dropRight(-s):m.take(s-o)),m)},et.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},et.prototype.toArray=function(){return this.take(N)},Yn(et.prototype,function(o,s){var m=/^(?:filter|find|map|reject)|While$/.test(s),O=/^(?:head|last)$/.test(s),D=B[O?"take"+(s=="last"?"Right":""):s],q=O||/^find/.test(s);D&&(B.prototype[s]=function(){var Y=this.__wrapped__,Z=O?[1]:arguments,re=Y instanceof et,ge=Z[0],me=re||We(Y),ye=function(Qe){var it=D.apply(B,Cr([Qe],Z));return O&&xe?it[0]:it};me&&m&&typeof ge=="function"&&ge.length!=1&&(re=me=!1);var xe=this.__chain__,ke=!!this.__actions__.length,Fe=q&&!xe,Ye=re&&!ke;if(!q&&me){Y=Ye?Y:new et(this);var qe=o.apply(Y,Z);return qe.__actions__.push({func:rs,args:[ye],thisArg:e}),new kn(qe,xe)}return Fe&&Ye?o.apply(this,Z):(qe=this.thru(ye),Fe?O?qe.value()[0]:qe.value():qe)})}),An(["pop","push","shift","sort","splice","unshift"],function(o){var s=ka[o],m=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",O=/^(?:pop|shift)$/.test(o);B.prototype[o]=function(){var D=arguments;if(O&&!this.__chain__){var q=this.value();return s.apply(We(q)?q:[],D)}return this[m](function(Y){return s.apply(We(Y)?Y:[],D)})}}),Yn(et.prototype,function(o,s){var m=B[s];if(m){var O=m.name+"";pt.call(Yi,O)||(Yi[O]=[]),Yi[O].push({name:s,func:m})}}),Yi[Xa(e,v).name]=[{name:"wrapper",func:e}],et.prototype.clone=Om,et.prototype.reverse=Em,et.prototype.value=Am,B.prototype.at=n0,B.prototype.chain=r0,B.prototype.commit=i0,B.prototype.next=o0,B.prototype.plant=s0,B.prototype.reverse=l0,B.prototype.toJSON=B.prototype.valueOf=B.prototype.value=u0,B.prototype.first=B.prototype.head,No&&(B.prototype[No]=a0),B},Wi=im();Tt?((Tt.exports=Wi)._=Wi,ot._=Wi):Xe._=Wi}).call(bt)})(ks,ks.exports);var cA=ks.exports;function U1(r,t){return r[13]=1,r[14]=t>>8,r[15]=t&255,r[16]=t>>8,r[17]=t&255,r}const op=112,ap=72,sp=89,lp=115;let uu;function H1(){const r=new Int32Array(256);for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;r[t]=e}return r}function W1(r){let t=-1;uu||(uu=H1());for(let e=0;e>>8;return t^-1}function z1(r){const t=r.length-1;for(let e=t;e>=4;e--)if(r[e-4]===9&&r[e-3]===op&&r[e-2]===ap&&r[e-1]===sp&&r[e]===lp)return e-3;return 0}function G1(r,t,e=!1){const n=new Uint8Array(13);t*=39.3701,n[0]=op,n[1]=ap,n[2]=sp,n[3]=lp,n[4]=t>>>24,n[5]=t>>>16,n[6]=t>>>8,n[7]=t&255,n[8]=n[4],n[9]=n[5],n[10]=n[6],n[11]=n[7],n[12]=1;const i=W1(n),l=new Uint8Array(4);if(l[0]=i>>>24,l[1]=i>>>16,l[2]=i>>>8,l[3]=i&255,e){const c=z1(r);return r.set(n,c),r.set(l,c+13),r}else{const c=new Uint8Array(4);c[0]=0,c[1]=0,c[2]=0,c[3]=9;const h=new Uint8Array(54);return h.set(r,0),h.set(c,33),h.set(n,37),h.set(l,50),h}}const Y1="AAlwSFlz",V1="AAAJcEhZ",K1="AAAACXBI";function X1(r){let t=r.indexOf(Y1);return t===-1&&(t=r.indexOf(V1)),t===-1&&(t=r.indexOf(K1)),t}const up="[modern-screenshot]",$r=typeof window!="undefined",Z1=$r&&"Worker"in window,Q1=$r&&"atob"in window,J1=$r&&"btoa"in window;var md;const ec=$r?(md=window.navigator)==null?void 0:md.userAgent:"",cp=ec.includes("Chrome"),Ps=ec.includes("AppleWebKit")&&!cp,tc=ec.includes("Firefox"),ew=r=>r&&"__CONTEXT__"in r,tw=r=>r.constructor.name==="CSSFontFaceRule",nw=r=>r.constructor.name==="CSSImportRule",tr=r=>r.nodeType===1,va=r=>typeof r.className=="object",fp=r=>r.tagName==="image",rw=r=>r.tagName==="use",ca=r=>tr(r)&&typeof r.style!="undefined"&&!va(r),iw=r=>r.nodeType===8,ow=r=>r.nodeType===3,so=r=>r.tagName==="IMG",Us=r=>r.tagName==="VIDEO",aw=r=>r.tagName==="CANVAS",sw=r=>r.tagName==="TEXTAREA",lw=r=>r.tagName==="INPUT",uw=r=>r.tagName==="STYLE",cw=r=>r.tagName==="SCRIPT",fw=r=>r.tagName==="SELECT",hw=r=>r.tagName==="SLOT",dw=r=>r.tagName==="IFRAME",pw=(...r)=>console.warn(up,...r);function gw(r){var e;const t=(e=r==null?void 0:r.createElement)==null?void 0:e.call(r,"canvas");return t&&(t.height=t.width=1),!!t&&"toDataURL"in t&&!!t.toDataURL("image/webp").includes("image/webp")}const ku=r=>r.startsWith("data:");function hp(r,t){if(r.match(/^[a-z]+:\/\//i))return r;if($r&&r.match(/^\/\//))return window.location.protocol+r;if(r.match(/^[a-z]+:/i)||!$r)return r;const e=Hs().implementation.createHTMLDocument(),n=e.createElement("base"),i=e.createElement("a");return e.head.appendChild(n),e.body.appendChild(i),t&&(n.href=t),i.href=r,i.href}function Hs(r){var t;return(t=r&&tr(r)?r==null?void 0:r.ownerDocument:r)!=null?t:window.document}const Ws="http://www.w3.org/2000/svg";function mw(r,t,e){const n=Hs(e).createElementNS(Ws,"svg");return n.setAttributeNS(null,"width",r.toString()),n.setAttributeNS(null,"height",t.toString()),n.setAttributeNS(null,"viewBox",`0 0 ${r} ${t}`),n}function vw(r,t){let e=new XMLSerializer().serializeToString(r);return t&&(e=e.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function yw(r,t){return new Promise((e,n)=>{const i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>n(i.error),i.onabort=()=>n(new Error(`Failed read blob to ${t}`)),i.readAsDataURL(r)})}const _w=r=>yw(r,"dataUrl");function io(r,t){const e=Hs(t).createElement("img");return e.decoding="sync",e.loading="eager",e.src=r,e}function fa(r,t){return new Promise(e=>{const{timeout:n,ownerDocument:i,onError:l,onWarn:c}=t!=null?t:{},h=typeof r=="string"?io(r,Hs(i)):r;let d=null,g=null;function p(){e(h),d&&clearTimeout(d),g==null||g()}if(n&&(d=setTimeout(p,n)),Us(h)){const a=h.currentSrc||h.src;if(!a)return h.poster?fa(h.poster,t).then(e):p();if(h.readyState>=2)return p();const u=p,f=y=>{c==null||c("Failed video load",a,y),l==null||l(y),p()};g=()=>{h.removeEventListener("loadeddata",u),h.removeEventListener("error",f)},h.addEventListener("loadeddata",u,{once:!0}),h.addEventListener("error",f,{once:!0})}else{const a=fp(h)?h.href.baseVal:h.currentSrc||h.src;if(!a)return p();const u=()=>tt(this,null,function*(){if(so(h)&&"decode"in h)try{yield h.decode()}catch(y){c==null||c("Failed to decode image, trying to render anyway",h.dataset.originalSrc||a,y)}p()}),f=y=>{c==null||c("Failed image load",h.dataset.originalSrc||a,y),p()};if(so(h)&&h.complete)return u();g=()=>{h.removeEventListener("load",u),h.removeEventListener("error",f)},h.addEventListener("load",u,{once:!0}),h.addEventListener("error",f,{once:!0})}})}function bw(r,t){return tt(this,null,function*(){ca(r)&&(so(r)||Us(r)?yield fa(r,t):yield Promise.all(["img","video"].flatMap(e=>Array.from(r.querySelectorAll(e)).map(n=>fa(n,t)))))})}const dp=function(){let t=0;const e=()=>`0000${(Math.random()*dn(36,4)<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)}();function pp(r){return r==null?void 0:r.split(",").map(t=>t.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}let Ph=0;function ww(r){const t=`${up}[#${Ph}]`;return Ph++,{time:e=>r&&console.time(`${t} ${e}`),timeEnd:e=>r&&console.timeEnd(`${t} ${e}`),warn:(...e)=>r&&pw(...e)}}function xw(r){return{cache:r?"no-cache":"force-cache"}}function zs(r,t){return tt(this,null,function*(){return ew(r)?r:Tw(r,Ut(st({},t),{autoDestruct:!0}))})}function Tw(r,t){return tt(this,null,function*(){var f,y,_,b,v;const{scale:e=1,workerUrl:n,workerNumber:i=1}=t||{},l=!!(t!=null&&t.debug),c=(f=t==null?void 0:t.features)!=null?f:!0,h=(y=r.ownerDocument)!=null?y:$r?window.document:void 0,d=(b=(_=r.ownerDocument)==null?void 0:_.defaultView)!=null?b:$r?window:void 0,g=new Map,p=Ut(st({width:0,height:0,quality:1,type:"image/png",scale:e,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:l,fetch:st({requestInit:xw((v=t==null?void 0:t.fetch)==null?void 0:v.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1},t==null?void 0:t.fetch),fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1},t),{__CONTEXT__:!0,log:ww(l),node:r,ownerDocument:h,ownerWindow:d,dpi:e===1?null:96*e,svgStyleElement:gp(h),svgDefsElement:h==null?void 0:h.createElementNS(Ws,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:Z1&&n&&i?i:0})].map(()=>{try{const w=new Worker(n);return w.onmessage=T=>tt(this,null,function*(){var C,A,R,L;const{url:x,result:S}=T.data;S?(A=(C=g.get(x))==null?void 0:C.resolve)==null||A.call(C,S):(L=(R=g.get(x))==null?void 0:R.reject)==null||L.call(R,new Error(`Error receiving message from worker: ${x}`))}),w.onmessageerror=T=>{var S,C;const{url:x}=T.data;(C=(S=g.get(x))==null?void 0:S.reject)==null||C.call(S,new Error(`Error receiving message from worker: ${x}`))},w}catch(w){return p.log.warn("Failed to new Worker",w),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[gw(h)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:g,drawImageCount:0,tasks:[],features:c,isEnable:w=>{var T,x;return w==="restoreScrollPosition"?typeof c=="boolean"?!1:(T=c[w])!=null?T:!1:typeof c=="boolean"?c:(x=c[w])!=null?x:!0},shadowRoots:[]});p.log.time("wait until load"),yield bw(r,{timeout:p.timeout,onWarn:p.log.warn}),p.log.timeEnd("wait until load");const{width:a,height:u}=Sw(r,p);return p.width=a,p.height=u,p})}function gp(r){if(!r)return;const t=r.createElement("style"),e=t.ownerDocument.createTextNode(` .______background-clip--text { background-clip: text; -webkit-background-clip: text; } `);return t.appendChild(e),t}function Sw(r,t){let{width:e,height:n}=t;if(tr(r)&&(!e||!n)){const i=r.getBoundingClientRect();e=e||i.width||Number(r.getAttribute("width"))||0,n=n||i.height||Number(r.getAttribute("height"))||0}return{width:e,height:n}}function Ow(r,t){return tt(this,null,function*(){const{log:e,timeout:n,drawImageCount:i,drawImageInterval:l}=t;e.time("image to canvas");const c=yield fa(r,{timeout:n,onWarn:t.log.warn}),{canvas:h,context2d:d}=Ew(r.ownerDocument,t),g=()=>{try{d==null||d.drawImage(c,0,0,h.width,h.height)}catch(p){t.log.warn("Failed to drawImage",p)}};if(g(),t.isEnable("fixSvgXmlDecode"))for(let p=0;p{setTimeout(()=>{d==null||d.clearRect(0,0,h.width,h.height),g(),a()},p+l)});return t.drawImageCount=0,e.timeEnd("image to canvas"),h})}function Ew(r,t){const{width:e,height:n,scale:i,backgroundColor:l,maximumCanvasSize:c}=t,h=r.createElement("canvas");h.width=Math.floor(e*i),h.height=Math.floor(n*i),h.style.width=`${e}px`,h.style.height=`${n}px`,c&&(h.width>c||h.height>c)&&(h.width>c&&h.height>c?h.width>h.height?(h.height*=c/h.width,h.width=c):(h.width*=c/h.height,h.height=c):h.width>c?(h.height*=c/h.width,h.width=c):(h.width*=c/h.height,h.height=c));const d=h.getContext("2d");return d&&l&&(d.fillStyle=l,d.fillRect(0,0,h.width,h.height)),{canvas:h,context2d:d}}function mp(r,t){if(r.ownerDocument)try{const l=r.toDataURL();if(l!=="data:,")return io(l,r.ownerDocument)}catch(l){t.log.warn("Failed to clone canvas",l)}const e=r.cloneNode(!1),n=r.getContext("2d"),i=e.getContext("2d");try{return n&&i&&i.putImageData(n.getImageData(0,0,r.width,r.height),0,0),e}catch(l){t.log.warn("Failed to clone canvas",l)}return e}function Aw(r,t){var e;try{if((e=r==null?void 0:r.contentDocument)!=null&&e.body)return nc(r.contentDocument.body,t)}catch(n){t.log.warn("Failed to clone iframe",n)}return r.cloneNode(!1)}function Cw(r){const t=r.cloneNode(!1);return r.currentSrc&&r.currentSrc!==r.src&&(t.src=r.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager"),t}function kw(r,t){return tt(this,null,function*(){if(r.ownerDocument&&!r.currentSrc&&r.poster)return io(r.poster,r.ownerDocument);const e=r.cloneNode(!1);e.crossOrigin="anonymous",r.currentSrc&&r.currentSrc!==r.src&&(e.src=r.currentSrc);const n=e.ownerDocument;if(n){let i=!0;if(yield fa(e,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return r.poster?io(r.poster,r.ownerDocument):e;e.currentTime=r.currentTime,yield new Promise(c=>{e.addEventListener("seeked",c,{once:!0})});const l=n.createElement("canvas");l.width=r.offsetWidth,l.height=r.offsetHeight;try{const c=l.getContext("2d");c&&c.drawImage(e,0,0,l.width,l.height)}catch(c){return t.log.warn("Failed to clone video",c),r.poster?io(r.poster,r.ownerDocument):e}return mp(l,t)}return e})}function Pw(r,t){return aw(r)?mp(r,t):dw(r)?Aw(r,t):so(r)?Cw(r):Us(r)?kw(r,t):r.cloneNode(!1)}function Rw(r){let t=r.sandbox;if(!t){const{ownerDocument:e}=r;try{e&&(t=e.createElement("iframe"),t.id=`__SANDBOX__${dp()}`,t.width="0",t.height="0",t.style.visibility="hidden",t.style.position="fixed",e.body.appendChild(t),t.srcdoc='',r.sandbox=t)}catch(n){r.log.warn("Failed to getSandBox",n)}}return t}const Mw=["width","height","-webkit-text-fill-color"],Dw=["stroke","fill"];function vp(r,t,e){const{defaultComputedStyles:n}=e,i=r.nodeName.toLowerCase(),l=va(r)&&i!=="svg",c=l?Dw.map(_=>[_,r.getAttribute(_)]).filter(([,_])=>_!==null):[],h=[l&&"svg",i,c.map((_,b)=>`${_}=${b}`).join(","),t].filter(Boolean).join(":");if(n.has(h))return n.get(h);const d=Rw(e),g=d==null?void 0:d.contentWindow;if(!g)return new Map;const p=g==null?void 0:g.document;let a,u;l?(a=p.createElementNS(Ws,"svg"),u=a.ownerDocument.createElementNS(a.namespaceURI,i),c.forEach(([_,b])=>{u.setAttributeNS(null,_,b)}),a.appendChild(u)):a=u=p.createElement(i),u.textContent=" ",p.body.appendChild(a);const f=g.getComputedStyle(u,t),y=new Map;for(let _=f.length,b=0;b<_;b++){const v=f.item(b);Mw.includes(v)||y.set(v,f.getPropertyValue(v))}return p.body.removeChild(a),n.set(h,y),y}function yp(r,t,e){var h;const n=new Map,i=[],l=new Map;if(e)for(const d of e)c(d);else for(let d=r.length,g=0;gn.set(a,p));function c(d){const g=r.getPropertyValue(d),p=r.getPropertyPriority(d),a=d.lastIndexOf("-"),u=a>-1?d.substring(0,a):void 0;if(u){let f=l.get(u);f||(f=new Map,l.set(u,f)),f.set(d,[g,p])}t.get(d)===g&&!p||(u?i.push(u):n.set(d,[g,p]))}return n}function Lw(r,t,e,n){var a,u,f,y;const{ownerWindow:i,includeStyleProperties:l,currentParentNodeStyle:c}=n,h=t.style,d=i.getComputedStyle(r),g=vp(r,null,n);c==null||c.forEach((_,b)=>{g.delete(b)});const p=yp(d,g,l);p.delete("transition-property"),p.delete("all"),p.delete("d"),p.delete("content"),e&&(p.delete("margin-top"),p.delete("margin-right"),p.delete("margin-bottom"),p.delete("margin-left"),p.delete("margin-block-start"),p.delete("margin-block-end"),p.delete("margin-inline-start"),p.delete("margin-inline-end"),p.set("box-sizing",["border-box",""])),((a=p.get("background-clip"))==null?void 0:a[0])==="text"&&t.classList.add("______background-clip--text"),cp&&(p.has("font-kerning")||p.set("font-kerning",["normal",""]),(((u=p.get("overflow-x"))==null?void 0:u[0])==="hidden"||((f=p.get("overflow-y"))==null?void 0:f[0])==="hidden")&&((y=p.get("text-overflow"))==null?void 0:y[0])==="ellipsis"&&r.scrollWidth===r.clientWidth&&p.set("text-overflow",["clip",""]));for(let _=h.length,b=0;b<_;b++)h.removeProperty(h.item(b));return p.forEach(([_,b],v)=>{h.setProperty(v,_,b)}),p}function Iw(r,t){(sw(r)||lw(r)||fw(r))&&t.setAttribute("value",r.value)}const Nw=[":before",":after"],Bw=[":-webkit-scrollbar",":-webkit-scrollbar-button",":-webkit-scrollbar-thumb",":-webkit-scrollbar-track",":-webkit-scrollbar-track-piece",":-webkit-scrollbar-corner",":-webkit-resizer"];function Fw(r,t,e,n,i){const{ownerWindow:l,svgStyleElement:c,svgStyles:h,currentNodeStyle:d}=n;if(!c||!l)return;function g(p){var T;const a=l.getComputedStyle(r,p);let u=a.getPropertyValue("content");if(!u||u==="none")return;i==null||i(u),u=u.replace(/(')|(")|(counter\(.+\))/g,"");const f=[dp()],y=vp(r,p,n);d==null||d.forEach((x,S)=>{y.delete(S)});const _=yp(a,y,n.includeStyleProperties);_.delete("content"),_.delete("-webkit-locale"),((T=_.get("background-clip"))==null?void 0:T[0])==="text"&&t.classList.add("______background-clip--text");const b=[`content: '${u}';`];if(_.forEach(([x,S],C)=>{b.push(`${C}: ${x}${S?" !important":""};`)}),b.length===1)return;try{t.className=[t.className,...f].join(" ")}catch(x){n.log.warn("Failed to copyPseudoClass",x);return}const v=b.join(` `);let w=h.get(v);w||(w=[],h.set(v,w)),w.push(`.${f[0]}:${p}`)}Nw.forEach(g),e&&Bw.forEach(g)}const Rh=new Set(["symbol"]);function Mh(r,t,e,n,i){return tt(this,null,function*(){if(tr(e)&&(uw(e)||cw(e))||n.filter&&!n.filter(e))return;Rh.has(t.nodeName)||Rh.has(e.nodeName)?n.currentParentNodeStyle=void 0:n.currentParentNodeStyle=n.currentNodeStyle;const l=yield nc(e,n,!1,i);n.isEnable("restoreScrollPosition")&&qw(r,l),t.appendChild(l)})}function Dh(r,t,e,n){return tt(this,null,function*(){var l;let i=r.firstChild;tr(r)&&r.shadowRoot&&(i=(l=r.shadowRoot)==null?void 0:l.firstChild,e.shadowRoots.push(r.shadowRoot));for(let c=i;c;c=c.nextSibling)if(!iw(c))if(tr(c)&&hw(c)&&typeof c.assignedNodes=="function"){const h=c.assignedNodes();for(let d=0;dr.clientHeight||r.scrollWidth>r.clientWidth)}const b=(a=y.get("text-transform"))==null?void 0:a[0],v=pp((u=y.get("font-family"))==null?void 0:u[0]),w=v?T=>{b==="uppercase"?T=T.toUpperCase():b==="lowercase"?T=T.toLowerCase():b==="capitalize"&&(T=T[0].toUpperCase()+T.substring(1)),v.forEach(x=>{let S=c.get(x);S||c.set(x,S=new Set),T.split("").forEach(C=>S.add(C))})}:void 0;return Fw(r,f,_,t,w),Iw(r,f),Us(r)||(yield Dh(r,f,t,w)),yield h==null?void 0:h(f),f}const d=r.cloneNode(!1);return yield Dh(r,d,t),yield h==null?void 0:h(d),d})}function Uw(r){if(r.ownerDocument=void 0,r.ownerWindow=void 0,r.svgStyleElement=void 0,r.svgDefsElement=void 0,r.svgStyles.clear(),r.defaultComputedStyles.clear(),r.sandbox){try{r.sandbox.remove()}catch(t){r.log.warn("Failed to destroyContext",t)}r.sandbox=void 0}r.workers=[],r.fontFamilies.clear(),r.fontCssTexts.clear(),r.requests.clear(),r.tasks=[],r.shadowRoots=[]}function Hw(r){const h=r,{url:t,timeout:e,responseType:n}=h,i=hs(h,["url","timeout","responseType"]),l=new AbortController,c=e?setTimeout(()=>l.abort(),e):void 0;return fetch(t,st({signal:l.signal},i)).then(d=>{if(!d.ok)throw new Error("Failed fetch, not 2xx response",{cause:d});switch(n){case"arrayBuffer":return d.arrayBuffer();case"dataUrl":return d.blob().then(_w);case"text":default:return d.text()}}).finally(()=>clearTimeout(c))}function ha(r,t){const{url:e,requestType:n="text",responseType:i="text",imageDom:l}=t;let c=e;const{timeout:h,acceptOfImage:d,requests:g,fetchFn:p,fetch:{requestInit:a,bypassingCache:u,placeholderImage:f},font:y,workers:_,fontFamilies:b}=r;n==="image"&&(Ps||tc)&&r.drawImageCount++;let v=g.get(e);if(!v){u&&u instanceof RegExp&&u.test(c)&&(c+=(/\?/.test(c)?"&":"?")+new Date().getTime());const w=n.startsWith("font")&&y&&y.minify,T=new Set;w&&n.split(";")[1].split(",").forEach(A=>{b.has(A)&&b.get(A).forEach(R=>T.add(R))});const x=w&&T.size,S=st({url:c,timeout:h,responseType:x?"arrayBuffer":i,headers:n==="image"?{accept:d}:void 0},a);v={type:n,resolve:void 0,reject:void 0,response:null},v.response=tt(this,null,function*(){if(p&&n==="image"){const C=yield p(e);if(C)return C}return!Ps&&e.startsWith("http")&&_.length?new Promise((C,A)=>{_[g.size&_.length-1].postMessage(st({rawUrl:e},S)),v.resolve=C,v.reject=A}):Hw(S)}).catch(C=>{if(g.delete(e),n==="image"&&f)return r.log.warn("Failed to fetch image base64, trying to use placeholder image",c),typeof f=="string"?f:f(l);throw C}),g.set(e,v)}return v.response}function _p(r,t,e,n){return tt(this,null,function*(){if(!bp(r))return r;for(const[i,l]of Ww(r,t))try{const c=yield ha(e,{url:l,requestType:n?"image":"text",responseType:"dataUrl"});r=r.replace(zw(i),`$1${c}$3`)}catch(c){e.log.warn("Failed to fetch css data url",i,c)}return r})}function bp(r){return/url\((['"]?)([^'"]+?)\1\)/.test(r)}const wp=/url\((['"]?)([^'"]+?)\1\)/g;function Ww(r,t){const e=[];return r.replace(wp,(n,i,l)=>(e.push([l,hp(l,t)]),n)),e.filter(([n])=>!ku(n))}function zw(r){const t=r.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}const Gw=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function Yw(r,t){return Gw.map(e=>{const n=r.getPropertyValue(e);return!n||n==="none"?null:((Ps||tc)&&t.drawImageCount++,_p(n,null,t,!0).then(i=>{!i||n===i||r.setProperty(e,i,r.getPropertyPriority(e))}))}).filter(Boolean)}function Vw(r,t){if(so(r)){const e=r.currentSrc||r.src;if(!ku(e))return[ha(t,{url:e,imageDom:r,requestType:"image",responseType:"dataUrl"}).then(n=>{n&&(r.srcset="",r.dataset.originalSrc=e,r.src=n||"")})];(Ps||tc)&&t.drawImageCount++}else if(va(r)&&!ku(r.href.baseVal)){const e=r.href.baseVal;return[ha(t,{url:e,imageDom:r,requestType:"image",responseType:"dataUrl"}).then(n=>{n&&(r.dataset.originalSrc=e,r.href.baseVal=n||"")})]}return[]}function Kw(r,t){var h;const{ownerDocument:e,svgDefsElement:n}=t,i=(h=r.getAttribute("href"))!=null?h:r.getAttribute("xlink:href");if(!i)return[];const[l,c]=i.split("#");if(c){const d=`#${c}`,g=t.shadowRoots.reduce((p,a)=>p!=null?p:a.querySelector(`svg ${d}`),e==null?void 0:e.querySelector(`svg ${d}`));if(l&&r.setAttribute("href",d),n!=null&&n.querySelector(d))return[];if(g)return n==null||n.appendChild(g.cloneNode(!0)),[];if(l)return[ha(t,{url:l,responseType:"text"}).then(p=>{n==null||n.insertAdjacentHTML("beforeend",p)})]}return[]}function xp(r,t){const{tasks:e}=t;tr(r)&&((so(r)||fp(r))&&e.push(...Vw(r,t)),rw(r)&&e.push(...Kw(r,t))),ca(r)&&e.push(...Yw(r.style,t)),r.childNodes.forEach(n=>{xp(n,t)})}function Xw(r,t){return tt(this,null,function*(){const{ownerDocument:e,svgStyleElement:n,fontFamilies:i,fontCssTexts:l,tasks:c,font:h}=t;if(!(!e||!n||!i.size))if(h&&h.cssText){const d=Ih(h.cssText,t);n.appendChild(e.createTextNode(`${d} `))}else{const d=Array.from(e.styleSheets).filter(p=>{try{return"cssRules"in p&&!!p.cssRules.length}catch(a){return t.log.warn(`Error while reading CSS rules from ${p.href}`,a),!1}});yield Promise.all(d.flatMap(p=>Array.from(p.cssRules).map((a,u)=>tt(this,null,function*(){if(nw(a)){let f=u+1;const y=a.href;let _="";try{_=yield ha(t,{url:y,requestType:"text",responseType:"text"})}catch(v){t.log.warn(`Error fetch remote css import from ${y}`,v)}const b=_.replace(wp,(v,w,T)=>v.replace(T,hp(T,y)));for(const v of Qw(b))try{p.insertRule(v,v.startsWith("@import")?f+=1:p.cssRules.length)}catch(w){t.log.warn("Error inserting rule from remote css import",{rule:v,error:w})}}})))),d.flatMap(p=>Array.from(p.cssRules)).filter(p=>{var a;return tw(p)&&bp(p.style.getPropertyValue("src"))&&((a=pp(p.style.getPropertyValue("font-family")))==null?void 0:a.some(u=>i.has(u)))}).forEach(p=>{const a=p,u=l.get(a.cssText);u?n.appendChild(e.createTextNode(`${u} `)):c.push(_p(a.cssText,a.parentStyleSheet?a.parentStyleSheet.href:null,t).then(f=>{f=Ih(f,t),l.set(a.cssText,f),n.appendChild(e.createTextNode(`${f} `))}))})}})}const Zw=/(\/\*[\s\S]*?\*\/)/g,Lh=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function Qw(r){if(r==null)return[];const t=[];let e=r.replace(Zw,"");for(;;){const l=Lh.exec(e);if(!l)break;t.push(l[0])}e=e.replace(Lh,"");const n=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let l=n.exec(e);if(l)i.lastIndex=n.lastIndex;else if(l=i.exec(e),l)n.lastIndex=i.lastIndex;else break;t.push(l[0])}return t}const Jw=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,ex=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ih(r,t){const{font:e}=t,n=e?e==null?void 0:e.preferredFormat:void 0;return n?r.replace(ex,i=>{for(;;){const[l,,c]=Jw.exec(i)||[];if(!c)return"";if(c===n)return`src: ${l};`}}):r}function tx(r,t){return tt(this,null,function*(){const e=yield zs(r,t);if(tr(e.node)&&va(e.node))return e.node;const{ownerDocument:n,log:i,tasks:l,svgStyleElement:c,svgDefsElement:h,svgStyles:d,font:g,progress:p,autoDestruct:a,onCloneNode:u,onEmbedNode:f,onCreateForeignObjectSvg:y}=e;i.time("clone node");const _=yield nc(e.node,e,!0);if(c&&n){let x="";d.forEach((S,C)=>{x+=`${S.join(`, `)} { ${C} } `}),c.appendChild(n.createTextNode(x))}i.timeEnd("clone node"),yield u==null?void 0:u(_),g!==!1&&tr(_)&&(i.time("embed web font"),yield Xw(_,e),i.timeEnd("embed web font")),i.time("embed node"),xp(_,e);const b=l.length;let v=0;const w=()=>tt(this,null,function*(){for(;;){const x=l.pop();if(!x)break;try{yield x}catch(S){e.log.warn("Failed to run task",S)}p==null||p(++v,b)}});p==null||p(v,b),yield Promise.all([...Array.from({length:4})].map(w)),i.timeEnd("embed node"),yield f==null?void 0:f(_);const T=nx(_,e);return h&&T.insertBefore(h,T.children[0]),c&&T.insertBefore(c,T.children[0]),a&&Uw(e),yield y==null?void 0:y(T),T})}function nx(r,t){const{width:e,height:n}=t,i=mw(e,n,r.ownerDocument),l=i.ownerDocument.createElementNS(i.namespaceURI,"foreignObject");return l.setAttributeNS(null,"x","0%"),l.setAttributeNS(null,"y","0%"),l.setAttributeNS(null,"width","100%"),l.setAttributeNS(null,"height","100%"),l.append(r),i.appendChild(l),i}function rx(r,t){return tt(this,null,function*(){var c;const e=yield zs(r,t),n=yield tx(e),i=vw(n,e.isEnable("removeControlCharacter"));e.autoDestruct||(e.svgStyleElement=gp(e.ownerDocument),e.svgDefsElement=(c=e.ownerDocument)==null?void 0:c.createElementNS(Ws,"defs"),e.svgStyles.clear());const l=io(i,n.ownerDocument);return yield Ow(l,e)})}function ix(r,t){return tt(this,null,function*(){const e=yield zs(r,t),{log:n,quality:i,type:l,dpi:c}=e,h=yield rx(e);n.time("canvas to data url");let d=h.toDataURL(l,i);if(["image/png","image/jpeg"].includes(l)&&c&&Q1&&J1){const[g,p]=d.split(",");let a=0,u=!1;if(l==="image/png"){const T=X1(p);T>=0?(a=Math.ceil((T+28)/3)*4,u=!0):a=33/3*4}else l==="image/jpeg"&&(a=18/3*4);const f=p.substring(0,a),y=p.substring(a),_=window.atob(f),b=new Uint8Array(_.length);for(let T=0;Tt.reduce((e,n)=>Pu(e,n,"",r),{})}const hA=ox(),Tp=1/60*1e3,ax=typeof performance!="undefined"?()=>performance.now():()=>Date.now(),Sp=typeof window!="undefined"?r=>window.requestAnimationFrame(r):r=>setTimeout(()=>r(ax()),Tp);function sx(r){let t=[],e=[],n=0,i=!1,l=!1;const c=new WeakSet,h={schedule:(d,g=!1,p=!1)=>{const a=p&&i,u=a?t:e;return g&&c.add(d),u.indexOf(d)===-1&&(u.push(d),a&&i&&(n=t.length)),d},cancel:d=>{const g=e.indexOf(d);g!==-1&&e.splice(g,1),c.delete(d)},process:d=>{if(i){l=!0;return}if(i=!0,[t,e]=[e,t],e.length=0,n=t.length,n)for(let g=0;g(r[t]=sx(()=>da=!0),r),{}),ux=ya.reduce((r,t)=>{const e=Gs[t];return r[t]=(n,i=!1,l=!1)=>(da||hx(),e.schedule(n,i,l)),r},{}),cx=ya.reduce((r,t)=>(r[t]=Gs[t].cancel,r),{});ya.reduce((r,t)=>(r[t]=()=>Gs[t].process(oo),r),{});const fx=r=>Gs[r].process(oo),Op=r=>{da=!1,oo.delta=Ru?Tp:Math.max(Math.min(r-oo.timestamp,lx),1),oo.timestamp=r,Mu=!0,ya.forEach(fx),Mu=!1,da&&(Ru=!1,Sp(Op))},hx=()=>{da=!0,Ru=!0,Mu||Sp(Op)},dx=()=>oo;function Ep(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);iMath.min(Math.max(e,r),t),fu=.001,px=.01,gx=10,mx=.05,vx=1;function yx({duration:r=800,bounce:t=.25,velocity:e=0,mass:n=1}){let i,l,c=1-t;c=Du(mx,vx,c),r=Du(px,gx,r/1e3),c<1?(i=g=>{const p=g*c,a=p*r,u=p-e,f=Lu(g,c),y=Math.exp(-a);return fu-u/f*y},l=g=>{const a=g*c*r,u=a*e+e,f=Math.pow(c,2)*Math.pow(g,2)*r,y=Math.exp(-a),_=Lu(Math.pow(g,2),c);return(-i(g)+fu>0?-1:1)*((u-f)*y)/_}):(i=g=>{const p=Math.exp(-g*r),a=(g-e)*r+1;return-fu+p*a},l=g=>{const p=Math.exp(-g*r),a=(e-g)*(r*r);return p*a});const h=5/r,d=bx(i,l,h);if(r=r*1e3,isNaN(d))return{stiffness:100,damping:10,duration:r};{const g=Math.pow(d,2)*n;return{stiffness:g,damping:c*2*Math.sqrt(n*g),duration:r}}}const _x=12;function bx(r,t,e){let n=e;for(let i=1;i<_x;i++)n=n-r(n)/t(n);return n}function Lu(r,t){return r*Math.sqrt(1-t*t)}const wx=["duration","bounce"],xx=["stiffness","damping","mass"];function Bh(r,t){return t.some(e=>r[e]!==void 0)}function Tx(r){let t=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},r);if(!Bh(r,xx)&&Bh(r,wx)){const e=yx(r);t=Object.assign(Object.assign(Object.assign({},t),e),{velocity:0,mass:1}),t.isResolvedFromDuration=!0}return t}function rc(r){var{from:t=0,to:e=1,restSpeed:n=2,restDelta:i}=r,l=Ep(r,["from","to","restSpeed","restDelta"]);const c={done:!1,value:t};let{stiffness:h,damping:d,mass:g,velocity:p,duration:a,isResolvedFromDuration:u}=Tx(l),f=Fh,y=Fh;function _(){const b=p?-(p/1e3):0,v=e-t,w=d/(2*Math.sqrt(h*g)),T=Math.sqrt(h/g)/1e3;if(i===void 0&&(i=Math.min(Math.abs(e-t)/100,.4)),w<1){const x=Lu(T,w);f=S=>{const C=Math.exp(-w*T*S);return e-C*((b+w*T*v)/x*Math.sin(x*S)+v*Math.cos(x*S))},y=S=>{const C=Math.exp(-w*T*S);return w*T*C*(Math.sin(x*S)*(b+w*T*v)/x+v*Math.cos(x*S))-C*(Math.cos(x*S)*(b+w*T*v)-x*v*Math.sin(x*S))}}else if(w===1)f=x=>e-Math.exp(-T*x)*(v+(b+T*v)*x);else{const x=T*Math.sqrt(w*w-1);f=S=>{const C=Math.exp(-w*T*S),A=Math.min(x*S,300);return e-C*((b+w*T*v)*Math.sinh(A)+x*v*Math.cosh(A))/x}}}return _(),{next:b=>{const v=f(b);if(u)c.done=b>=a;else{const w=y(b)*1e3,T=Math.abs(w)<=n,x=Math.abs(e-v)<=i;c.done=T&&x}return c.value=c.done?e:v,c},flipTarget:()=>{p=-p,[t,e]=[e,t],_()}}}rc.needsInterpolation=(r,t)=>typeof r=="string"||typeof t=="string";const Fh=r=>0,Ap=(r,t,e)=>{const n=t-r;return n===0?1:(e-r)/n},ic=(r,t,e)=>-e*r+e*t+r,Cp=(r,t)=>e=>Math.max(Math.min(e,t),r),oa=r=>r%1?Number(r.toFixed(5)):r,pa=/(-)?([\d]*\.?[\d])+/g,Iu=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Sx=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function _a(r){return typeof r=="string"}const Ys={test:r=>typeof r=="number",parse:parseFloat,transform:r=>r},kp=Object.assign(Object.assign({},Ys),{transform:Cp(0,1)}),dA=Object.assign(Object.assign({},Ys),{default:1}),oc=r=>({test:t=>_a(t)&&t.endsWith(r)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${r}`}),pA=oc("deg"),aa=oc("%"),gA=oc("px"),mA=Object.assign(Object.assign({},aa),{parse:r=>aa.parse(r)/100,transform:r=>aa.transform(r*100)}),ac=(r,t)=>e=>!!(_a(e)&&Sx.test(e)&&e.startsWith(r)||t&&Object.prototype.hasOwnProperty.call(e,t)),Pp=(r,t,e)=>n=>{if(!_a(n))return n;const[i,l,c,h]=n.match(pa);return{[r]:parseFloat(i),[t]:parseFloat(l),[e]:parseFloat(c),alpha:h!==void 0?parseFloat(h):1}},gi={test:ac("hsl","hue"),parse:Pp("hue","saturation","lightness"),transform:({hue:r,saturation:t,lightness:e,alpha:n=1})=>"hsla("+Math.round(r)+", "+aa.transform(oa(t))+", "+aa.transform(oa(e))+", "+oa(kp.transform(n))+")"},Ox=Cp(0,255),hu=Object.assign(Object.assign({},Ys),{transform:r=>Math.round(Ox(r))}),Fr={test:ac("rgb","red"),parse:Pp("red","green","blue"),transform:({red:r,green:t,blue:e,alpha:n=1})=>"rgba("+hu.transform(r)+", "+hu.transform(t)+", "+hu.transform(e)+", "+oa(kp.transform(n))+")"};function Ex(r){let t="",e="",n="",i="";return r.length>5?(t=r.substr(1,2),e=r.substr(3,2),n=r.substr(5,2),i=r.substr(7,2)):(t=r.substr(1,1),e=r.substr(2,1),n=r.substr(3,1),i=r.substr(4,1),t+=t,e+=e,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(e,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const Nu={test:ac("#"),parse:Ex,transform:Fr.transform},Vs={test:r=>Fr.test(r)||Nu.test(r)||gi.test(r),parse:r=>Fr.test(r)?Fr.parse(r):gi.test(r)?gi.parse(r):Nu.parse(r),transform:r=>_a(r)?r:r.hasOwnProperty("red")?Fr.transform(r):gi.transform(r)},Rp="${c}",Mp="${n}";function Ax(r){var t,e,n,i;return isNaN(r)&&_a(r)&&((e=(t=r.match(pa))===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0)+((i=(n=r.match(Iu))===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0)>0}function Dp(r){typeof r=="number"&&(r=`${r}`);const t=[];let e=0;const n=r.match(Iu);n&&(e=n.length,r=r.replace(Iu,Rp),t.push(...n.map(Vs.parse)));const i=r.match(pa);return i&&(r=r.replace(pa,Mp),t.push(...i.map(Ys.parse))),{values:t,numColors:e,tokenised:r}}function Lp(r){return Dp(r).values}function Ip(r){const{values:t,numColors:e,tokenised:n}=Dp(r),i=t.length;return l=>{let c=n;for(let h=0;htypeof r=="number"?0:r;function kx(r){const t=Lp(r);return Ip(r)(t.map(Cx))}const sc={test:Ax,parse:Lp,createTransformer:Ip,getAnimatableNone:kx},Px=new Set(["brightness","contrast","saturate","opacity"]);function Rx(r){let[t,e]=r.slice(0,-1).split("(");if(t==="drop-shadow")return r;const[n]=e.match(pa)||[];if(!n)return r;const i=e.replace(n,"");let l=Px.has(t)?1:0;return n!==e&&(l*=100),t+"("+l+i+")"}const Mx=/([a-z-]*)\(.*?\)/g,vA=Object.assign(Object.assign({},sc),{getAnimatableNone:r=>{const t=r.match(Mx);return t?t.map(Rx).join(" "):r}});function du(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*(2/3-e)*6:r}function qh({hue:r,saturation:t,lightness:e,alpha:n}){r/=360,t/=100,e/=100;let i=0,l=0,c=0;if(!t)i=l=c=e;else{const h=e<.5?e*(1+t):e+t-e*t,d=2*e-h;i=du(d,h,r+1/3),l=du(d,h,r),c=du(d,h,r-1/3)}return{red:Math.round(i*255),green:Math.round(l*255),blue:Math.round(c*255),alpha:n}}const Dx=(r,t,e)=>{const n=r*r,i=t*t;return Math.sqrt(Math.max(0,e*(i-n)+n))},Lx=[Nu,Fr,gi],jh=r=>Lx.find(t=>t.test(r)),Np=(r,t)=>{let e=jh(r),n=jh(t),i=e.parse(r),l=n.parse(t);e===gi&&(i=qh(i),e=Fr),n===gi&&(l=qh(l),n=Fr);const c=Object.assign({},i);return h=>{for(const d in c)d!=="alpha"&&(c[d]=Dx(i[d],l[d],h));return c.alpha=ic(i.alpha,l.alpha,h),e.transform(c)}},Ix=r=>typeof r=="number",Nx=(r,t)=>e=>t(r(e)),Bp=(...r)=>r.reduce(Nx);function Fp(r,t){return Ix(r)?e=>ic(r,t,e):Vs.test(r)?Np(r,t):jp(r,t)}const qp=(r,t)=>{const e=[...r],n=e.length,i=r.map((l,c)=>Fp(l,t[c]));return l=>{for(let c=0;c{const e=Object.assign(Object.assign({},r),t),n={};for(const i in e)r[i]!==void 0&&t[i]!==void 0&&(n[i]=Fp(r[i],t[i]));return i=>{for(const l in n)e[l]=n[l](i);return e}};function $h(r){const t=sc.parse(r),e=t.length;let n=0,i=0,l=0;for(let c=0;c{const e=sc.createTransformer(t),n=$h(r),i=$h(t);return n.numHSL===i.numHSL&&n.numRGB===i.numRGB&&n.numNumbers>=i.numNumbers?Bp(qp(n.parsed,i.parsed),e):c=>`${c>0?t:r}`},Fx=(r,t)=>e=>ic(r,t,e);function qx(r){if(typeof r=="number")return Fx;if(typeof r=="string")return Vs.test(r)?Np:jp;if(Array.isArray(r))return qp;if(typeof r=="object")return Bx}function jx(r,t,e){const n=[],i=e||qx(r[0]),l=r.length-1;for(let c=0;ce(Ap(r,t,n))}function Ux(r,t){const e=r.length,n=e-1;return i=>{let l=0,c=!1;if(i<=r[0]?c=!0:i>=r[n]&&(l=n-1,c=!0),!c){let d=1;for(;di||d===n);d++);l=d-1}const h=Ap(r[l],r[l+1],i);return t[l](h)}}function $p(r,t,{clamp:e=!0,ease:n,mixer:i}={}){const l=r.length;Nh(l===t.length),Nh(!n||!Array.isArray(n)||n.length===l-1),r[0]>r[l-1]&&(r=[].concat(r),t=[].concat(t),r.reverse(),t.reverse());const c=jx(t,n,i),h=l===2?$x(r,c):Ux(r,c);return e?d=>h(Du(r[0],r[l-1],d)):h}const Ks=r=>t=>1-r(1-t),lc=r=>t=>t<=.5?r(2*t)/2:(2-r(2*(1-t)))/2,Hx=r=>t=>Math.pow(t,r),Up=r=>t=>t*t*((r+1)*t-r),Wx=r=>{const t=Up(r);return e=>(e*=2)<1?.5*t(e):.5*(2-Math.pow(2,-10*(e-1)))},Hp=1.525,zx=4/11,Gx=8/11,Yx=9/10,Vx=r=>r,Wp=Hx(2),yA=Ks(Wp),Kx=lc(Wp),Xx=r=>1-Math.sin(Math.acos(r)),Zx=Ks(Xx),_A=lc(Zx),zp=Up(Hp),bA=Ks(zp),wA=lc(zp),xA=Wx(Hp),Qx=4356/361,Jx=35442/1805,eT=16061/1805,Bu=r=>{if(r===1||r===0)return r;const t=r*r;return rr<.5?.5*(1-Bu(1-r*2)):.5*Bu(r*2-1)+.5;function tT(r,t){return r.map(()=>t||Kx).splice(0,r.length-1)}function nT(r){const t=r.length;return r.map((e,n)=>n!==0?n/(t-1):0)}function rT(r,t){return r.map(e=>e*t)}function Os({from:r=0,to:t=1,ease:e,offset:n,duration:i=300}){const l={done:!1,value:r},c=Array.isArray(t)?t:[r,t],h=rT(n&&n.length===c.length?n:nT(c),i);function d(){return $p(h,c,{ease:Array.isArray(e)?e:tT(c,e)})}let g=d();return{next:p=>(l.value=g(p),l.done=p>=i,l),flipTarget:()=>{c.reverse(),g=d()}}}function iT({velocity:r=0,from:t=0,power:e=.8,timeConstant:n=350,restDelta:i=.5,modifyTarget:l}){const c={done:!1,value:t};let h=e*r;const d=t+h,g=l===void 0?d:l(d);return g!==d&&(h=g-t),{next:p=>{const a=-h*Math.exp(-p/n);return c.done=!(a>i||a<-i),c.value=c.done?g:g+a,c},flipTarget:()=>{}}}const Uh={keyframes:Os,spring:rc,decay:iT};function oT(r){if(Array.isArray(r.to))return Os;if(Uh[r.type])return Uh[r.type];const t=new Set(Object.keys(r));return t.has("ease")||t.has("duration")&&!t.has("dampingRatio")?Os:t.has("dampingRatio")||t.has("stiffness")||t.has("mass")||t.has("damping")||t.has("restSpeed")||t.has("restDelta")?rc:Os}function Gp(r,t,e=0){return r-t-e}function aT(r,t,e=0,n=!0){return n?Gp(t+-r,t,e):t-(r-t)+e}function sT(r,t,e,n){return n?r>=t+e:r<=-e}const lT=r=>{const t=({delta:e})=>r(e);return{start:()=>ux.update(t,!0),stop:()=>cx.update(t)}};function uT(r){var t,e,{from:n,autoplay:i=!0,driver:l=lT,elapsed:c=0,repeat:h=0,repeatType:d="loop",repeatDelay:g=0,onPlay:p,onStop:a,onComplete:u,onRepeat:f,onUpdate:y}=r,_=Ep(r,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:b}=_,v,w=0,T=_.duration,x,S=!1,C=!0,A;const R=oT(_);!((e=(t=R).needsInterpolation)===null||e===void 0)&&e.call(t,n,b)&&(A=$p([0,100],[n,b],{clamp:!1}),n=0,b=100);const L=R(Object.assign(Object.assign({},_),{from:n,to:b}));function M(){w++,d==="reverse"?(C=w%2===0,c=aT(c,T,g,C)):(c=Gp(c,T,g),d==="mirror"&&L.flipTarget()),S=!1,f&&f()}function k(){v.stop(),u&&u()}function P(j){if(C||(j=-j),c+=j,!S){const W=L.next(Math.max(0,c));x=W.value,A&&(x=A(x)),S=C?W.done:c<=0}y==null||y(x),S&&(w===0&&(T!=null||(T=c)),w{a==null||a(),v.stop()}}}function cT(r,t){return t?r*(1e3/t):0}function OA({from:r=0,velocity:t=0,min:e,max:n,power:i=.8,timeConstant:l=750,bounceStiffness:c=500,bounceDamping:h=10,restDelta:d=1,modifyTarget:g,driver:p,onUpdate:a,onComplete:u,onStop:f}){let y;function _(T){return e!==void 0&&Tn}function b(T){return e===void 0?n:n===void 0||Math.abs(e-T){var S;a==null||a(x),(S=T.onUpdate)===null||S===void 0||S.call(T,x)},onComplete:u,onStop:f}))}function w(T){v(Object.assign({type:"spring",stiffness:c,damping:h,restDelta:d},T))}if(_(r))w({from:r,velocity:t,to:b(r)});else{let T=i*t+r;typeof g!="undefined"&&(T=g(T));const x=b(T),S=x===e?-1:1;let C,A;const R=L=>{C=A,A=L,t=cT(L-C,dx().delta),(S===1&&L>x||S===-1&&Ly==null?void 0:y.stop()}}const Yp=(r,t)=>1-3*t+3*r,Vp=(r,t)=>3*t-6*r,Kp=r=>3*r,Rs=(r,t,e)=>((Yp(t,e)*r+Vp(t,e))*r+Kp(t))*r,Xp=(r,t,e)=>3*Yp(t,e)*r*r+2*Vp(t,e)*r+Kp(t),fT=1e-7,hT=10;function dT(r,t,e,n,i){let l,c,h=0;do c=t+(e-t)/2,l=Rs(c,n,i)-r,l>0?e=c:t=c;while(Math.abs(l)>fT&&++h=gT?mT(c,a,r,e):u===0?a:dT(c,h,h+ds,r,e)}return c=>c===0||c===1?c:Rs(l(c),t,n)}const Wr=(()=>{/*! * Copyright (c) 2021-2024 Momo Bassit. * Licensed under the MIT License (MIT) * https://github.com/mdbassit/Coloris * Version: 0.25.0 * NPM: https://github.com/melloware/coloris-npm */return((r,t,e,n)=>{const i=t.createElement("canvas").getContext("2d"),l={r:0,g:0,b:0,h:0,s:0,v:0,a:1};let c,h,d,g,p,a,u,f,y,_,b,v,w,T,x,S,C={};const A={el:"[data-coloris]",parent:"body",theme:"default",themeMode:"light",rtl:!1,wrap:!0,margin:2,format:"hex",formatToggle:!1,swatches:[],swatchesOnly:!1,alpha:!0,forceAlpha:!1,focusInput:!0,selectInput:!1,inline:!1,defaultColor:"#000000",clearButton:!1,clearLabel:"Clear",closeButton:!1,closeLabel:"Close",onChange:()=>n,a11y:{open:"Open color picker",close:"Close color picker",clear:"Clear the selected color",marker:"Saturation: {s}. Brightness: {v}.",hueSlider:"Hue slider",alphaSlider:"Opacity slider",input:"Color value field",format:"Color format",swatch:"Color swatch",instruction:"Saturation and brightness selector. Use up, down, left and right arrow keys to select."}},R={};let L="",M={},k=!1;function P(z){if(typeof z=="object")for(const ue in z)switch(ue){case"el":ee(z.el),z.wrap!==!1&&$(z.el);break;case"parent":c=z.parent instanceof HTMLElement?z.parent:t.querySelector(z.parent),c&&(c.appendChild(h),A.parent=z.parent,c===t.body&&(c=n));break;case"themeMode":A.themeMode=z.themeMode,z.themeMode==="auto"&&r.matchMedia&&r.matchMedia("(prefers-color-scheme: dark)").matches&&(A.themeMode="dark");case"theme":z.theme&&(A.theme=z.theme),h.className=`clr-picker clr-${A.theme} clr-${A.themeMode}`,A.inline&&V();break;case"rtl":A.rtl=!!z.rtl,Array.from(t.getElementsByClassName("clr-field")).forEach(Ae=>Ae.classList.toggle("clr-rtl",A.rtl));break;case"margin":z.margin*=1,A.margin=isNaN(z.margin)?A.margin:z.margin;break;case"wrap":z.el&&z.wrap&&$(z.el);break;case"formatToggle":A.formatToggle=!!z.formatToggle,Ee("clr-format").style.display=A.formatToggle?"block":"none",A.formatToggle&&(A.format="auto");break;case"swatches":if(Array.isArray(z.swatches)){const Ae=Ee("clr-swatches"),Ie=t.createElement("div");Ae.textContent="",z.swatches.forEach((at,wt)=>{const Ze=t.createElement("button");Ze.setAttribute("type","button"),Ze.setAttribute("id",`clr-swatch-${wt}`),Ze.setAttribute("aria-labelledby",`clr-swatch-label clr-swatch-${wt}`),Ze.style.color=at,Ze.textContent=at,Ie.appendChild(Ze)}),z.swatches.length&&Ae.appendChild(Ie),A.swatches=z.swatches.slice()}break;case"swatchesOnly":A.swatchesOnly=!!z.swatchesOnly,h.setAttribute("data-minimal",A.swatchesOnly);break;case"alpha":A.alpha=!!z.alpha,h.setAttribute("data-alpha",A.alpha);break;case"inline":if(A.inline=!!z.inline,h.setAttribute("data-inline",A.inline),A.inline){const Ae=z.defaultColor||A.defaultColor;T=X(Ae),V(),ne(Ae)}break;case"clearButton":typeof z.clearButton=="object"&&(z.clearButton.label&&(A.clearLabel=z.clearButton.label,u.innerHTML=A.clearLabel),z.clearButton=z.clearButton.show),A.clearButton=!!z.clearButton,u.style.display=A.clearButton?"block":"none";break;case"clearLabel":A.clearLabel=z.clearLabel,u.innerHTML=A.clearLabel;break;case"closeButton":A.closeButton=!!z.closeButton,A.closeButton?h.insertBefore(f,p):p.appendChild(f);break;case"closeLabel":A.closeLabel=z.closeLabel,f.innerHTML=A.closeLabel;break;case"a11y":const pe=z.a11y;let Te=!1;if(typeof pe=="object")for(const Ae in pe)pe[Ae]&&A.a11y[Ae]&&(A.a11y[Ae]=pe[Ae],Te=!0);if(Te){const Ae=Ee("clr-open-label"),Ie=Ee("clr-swatch-label");Ae.innerHTML=A.a11y.open,Ie.innerHTML=A.a11y.swatch,f.setAttribute("aria-label",A.a11y.close),u.setAttribute("aria-label",A.a11y.clear),y.setAttribute("aria-label",A.a11y.hueSlider),b.setAttribute("aria-label",A.a11y.alphaSlider),a.setAttribute("aria-label",A.a11y.input),d.setAttribute("aria-label",A.a11y.instruction)}break;default:A[ue]=z[ue]}}function I(z,ue){typeof z=="string"&&typeof ue=="object"&&(R[z]=ue,k=!0)}function j(z){delete R[z],Object.keys(R).length===0&&(k=!1,z===L&&J())}function W(z){if(k){const ue=["el","wrap","rtl","inline","defaultColor","a11y"];for(let pe in R){const Te=R[pe];if(z.matches(pe)){L=pe,M={},ue.forEach(Ae=>delete Te[Ae]);for(let Ae in Te)M[Ae]=Array.isArray(A[Ae])?A[Ae].slice():A[Ae];P(Te);break}}}}function J(){Object.keys(M).length>0&&(P(M),L="",M={})}function ee(z){z instanceof HTMLElement&&(z=[z]),Array.isArray(z)?z.forEach(ue=>{$e(ue,"click",oe),$e(ue,"input",H)}):($e(t,"click",z,oe),$e(t,"input",z,H))}function oe(z){A.inline||(W(z.target),w=z.target,x=w.value,T=X(x),h.classList.add("clr-open"),V(),ne(x),(A.focusInput||A.selectInput)&&(a.focus({preventScroll:!0}),a.setSelectionRange(w.selectionStart,w.selectionEnd)),A.selectInput&&a.select(),(S||A.swatchesOnly)&&Le().shift().focus(),w.dispatchEvent(new Event("open",{bubbles:!1})))}function V(){if(!h||!w&&!A.inline)return;const z=c,ue=r.scrollY,pe=h.offsetWidth,Te=h.offsetHeight,Ae={left:!1,top:!1};let Ie,at,wt,Ze={x:0,y:0};if(z&&(Ie=r.getComputedStyle(z),at=parseFloat(Ie.marginTop),wt=parseFloat(Ie.borderTopWidth),Ze=z.getBoundingClientRect(),Ze.y+=wt+ue),!A.inline){const yt=w.getBoundingClientRect();let Ht=yt.x,Kt=ue+yt.y+yt.height+A.margin;z?(Ht-=Ze.x,Kt-=Ze.y,Ht+pe>z.clientWidth&&(Ht+=yt.width-pe,Ae.left=!0),Kt+Te>z.clientHeight-at&&Te+A.margin<=yt.top-(Ze.y-ue)&&(Kt-=yt.height+Te+A.margin*2,Ae.top=!0),Kt+=z.scrollTop):(Ht+pe>t.documentElement.clientWidth&&(Ht+=yt.width-pe,Ae.left=!0),Kt+Te-ue>t.documentElement.clientHeight&&Te+A.margin<=yt.top&&(Kt=ue+yt.y-Te-A.margin,Ae.top=!0)),h.classList.toggle("clr-left",Ae.left),h.classList.toggle("clr-top",Ae.top),h.style.left=`${Ht}px`,h.style.top=`${Kt}px`,Ze.x+=h.offsetLeft,Ze.y+=h.offsetTop}C={width:d.offsetWidth,height:d.offsetHeight,x:d.offsetLeft+Ze.x,y:d.offsetTop+Ze.y}}function $(z){z instanceof HTMLElement?N(z):Array.isArray(z)?z.forEach(N):t.querySelectorAll(z).forEach(N)}function N(z){const ue=z.parentNode;if(!ue.classList.contains("clr-field")){const pe=t.createElement("div");let Te="clr-field";(A.rtl||z.classList.contains("clr-rtl"))&&(Te+=" clr-rtl"),pe.innerHTML='',ue.insertBefore(pe,z),pe.className=Te,pe.style.color=z.value,pe.appendChild(z)}}function H(z){const ue=z.target.parentNode;ue.classList.contains("clr-field")&&(ue.style.color=z.target.value)}function G(z){if(w&&!A.inline){const ue=w;z&&(w=n,x!==ue.value&&(ue.value=x,ue.dispatchEvent(new Event("input",{bubbles:!0})))),setTimeout(()=>{x!==ue.value&&ue.dispatchEvent(new Event("change",{bubbles:!0}))}),h.classList.remove("clr-open"),k&&J(),ue.dispatchEvent(new Event("close",{bubbles:!1})),A.focusInput&&ue.focus({preventScroll:!0}),w=n}}function ne(z){const ue=he(z),pe=le(ue);ie(pe.s,pe.v),Me(ue,pe),y.value=pe.h,h.style.color=`hsl(${pe.h}, 100%, 50%)`,_.style.left=`${pe.h/360*100}%`,g.style.left=`${C.width*pe.s/100}px`,g.style.top=`${C.height-C.height*pe.v/100}px`,b.value=pe.a*100,v.style.left=`${pe.a*100}%`}function X(z){const ue=z.substring(0,3).toLowerCase();return ue==="rgb"||ue==="hsl"?ue:"hex"}function U(z){z=z!==n?z:a.value,w&&(w.value=z,w.dispatchEvent(new Event("input",{bubbles:!0}))),A.onChange&&A.onChange.call(r,z,w),t.dispatchEvent(new CustomEvent("coloris:pick",{detail:{color:z,currentEl:w}}))}function Q(z,ue){const pe={h:y.value*1,s:z/C.width*100,v:100-ue/C.height*100,a:b.value/100},Te=xt(pe);ie(pe.s,pe.v),Me(Te,pe),U()}function ie(z,ue){let pe=A.a11y.marker;z=z.toFixed(1)*1,ue=ue.toFixed(1)*1,pe=pe.replace("{s}",z),pe=pe.replace("{v}",ue),g.setAttribute("aria-label",pe)}function ae(z){return{pageX:z.changedTouches?z.changedTouches[0].pageX:z.pageX,pageY:z.changedTouches?z.changedTouches[0].pageY:z.pageY}}function de(z){const ue=ae(z);let pe=ue.pageX-C.x,Te=ue.pageY-C.y;c&&(Te+=c.scrollTop),Pe(pe,Te),z.preventDefault(),z.stopPropagation()}function we(z,ue){let pe=g.style.left.replace("px","")*1+z,Te=g.style.top.replace("px","")*1+ue;Pe(pe,Te)}function Pe(z,ue){z=z<0?0:z>C.width?C.width:z,ue=ue<0?0:ue>C.height?C.height:ue,g.style.left=`${z}px`,g.style.top=`${ue}px`,Q(z,ue),g.focus()}function Me(z,ue){z===void 0&&(z={}),ue===void 0&&(ue={});let pe=A.format;for(const Ie in z)l[Ie]=z[Ie];for(const Ie in ue)l[Ie]=ue[Ie];const Te=_e(l),Ae=Te.substring(0,7);switch(g.style.color=Ae,v.parentNode.style.color=Ae,v.style.color=Te,p.style.color=Te,d.style.display="none",d.offsetHeight,d.style.display="",v.nextElementSibling.style.display="none",v.nextElementSibling.offsetHeight,v.nextElementSibling.style.display="",pe==="mixed"?pe=l.a===1?"hex":"rgb":pe==="auto"&&(pe=T),pe){case"hex":a.value=Te;break;case"rgb":a.value=be(l);break;case"hsl":a.value=ve(Je(l));break}t.querySelector(`.clr-format [value="${pe}"]`).checked=!0}function De(){const z=y.value*1,ue=g.style.left.replace("px","")*1,pe=g.style.top.replace("px","")*1;h.style.color=`hsl(${z}, 100%, 50%)`,_.style.left=`${z/360*100}%`,Q(ue,pe)}function ze(){const z=b.value/100;v.style.left=`${z*100}%`,Me({a:z}),U()}function xt(z){const ue=z.s/100,pe=z.v/100;let Te=ue*pe,Ae=z.h/60,Ie=Te*(1-e.abs(Ae%2-1)),at=pe-Te;Te=Te+at,Ie=Ie+at;const wt=e.floor(Ae)%6,Ze=[Te,Ie,at,at,Ie,Te][wt],yt=[Ie,Te,Te,Ie,at,at][wt],Ht=[at,at,Ie,Te,Te,Ie][wt];return{r:e.round(Ze*255),g:e.round(yt*255),b:e.round(Ht*255),a:z.a}}function Je(z){const ue=z.v/100,pe=ue*(1-z.s/100/2);let Te;return pe>0&&pe<1&&(Te=e.round((ue-pe)/e.min(pe,1-pe)*100)),{h:z.h,s:Te||0,l:e.round(pe*100),a:z.a}}function le(z){const ue=z.r/255,pe=z.g/255,Te=z.b/255,Ae=e.max(ue,pe,Te),Ie=e.min(ue,pe,Te),at=Ae-Ie,wt=Ae;let Ze=0,yt=0;return at&&(Ae===ue&&(Ze=(pe-Te)/at),Ae===pe&&(Ze=2+(Te-ue)/at),Ae===Te&&(Ze=4+(ue-pe)/at),Ae&&(yt=at/Ae)),Ze=e.floor(Ze*60),{h:Ze<0?Ze+360:Ze,s:e.round(yt*100),v:e.round(wt*100),a:z.a}}function he(z){const ue=/^((rgba)|rgb)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i;let pe,Te;return i.fillStyle="#000",i.fillStyle=z,pe=ue.exec(i.fillStyle),pe?Te={r:pe[3]*1,g:pe[4]*1,b:pe[5]*1,a:pe[6]*1}:(pe=i.fillStyle.replace("#","").match(/.{2}/g).map(Ae=>parseInt(Ae,16)),Te={r:pe[0],g:pe[1],b:pe[2],a:1}),Te}function _e(z){let ue=z.r.toString(16),pe=z.g.toString(16),Te=z.b.toString(16),Ae="";if(z.r<16&&(ue="0"+ue),z.g<16&&(pe="0"+pe),z.b<16&&(Te="0"+Te),A.alpha&&(z.a<1||A.forceAlpha)){const Ie=z.a*255|0;Ae=Ie.toString(16),Ie<16&&(Ae="0"+Ae)}return"#"+ue+pe+Te+Ae}function be(z){return!A.alpha||z.a===1&&!A.forceAlpha?`rgb(${z.r}, ${z.g}, ${z.b})`:`rgba(${z.r}, ${z.g}, ${z.b}, ${z.a})`}function ve(z){return!A.alpha||z.a===1&&!A.forceAlpha?`hsl(${z.h}, ${z.s}%, ${z.l}%)`:`hsla(${z.h}, ${z.s}%, ${z.l}%, ${z.a})`}function Be(){t.getElementById("clr-picker")||(c=n,h=t.createElement("div"),h.setAttribute("id","clr-picker"),h.className="clr-picker",h.innerHTML=`
${A.a11y.format}
`,t.body.appendChild(h),d=Ee("clr-color-area"),g=Ee("clr-color-marker"),u=Ee("clr-clear"),f=Ee("clr-close"),p=Ee("clr-color-preview"),a=Ee("clr-color-value"),y=Ee("clr-hue-slider"),_=Ee("clr-hue-marker"),b=Ee("clr-alpha-slider"),v=Ee("clr-alpha-marker"),ee(A.el),$(A.el),$e(h,"mousedown",z=>{h.classList.remove("clr-keyboard-nav"),z.stopPropagation()}),$e(d,"mousedown",z=>{$e(t,"mousemove",de)}),$e(d,"contextmenu",z=>{z.preventDefault()}),$e(d,"touchstart",z=>{t.addEventListener("touchmove",de,{passive:!1})}),$e(g,"mousedown",z=>{$e(t,"mousemove",de)}),$e(g,"touchstart",z=>{t.addEventListener("touchmove",de,{passive:!1})}),$e(a,"change",z=>{const ue=a.value;if(w||A.inline){const pe=ue===""?ue:ne(ue);U(pe)}}),$e(u,"click",z=>{U(""),G()}),$e(f,"click",z=>{U(),G()}),$e(Ee("clr-format"),"click",".clr-format input",z=>{T=z.target.value,Me(),U()}),$e(h,"click",".clr-swatches button",z=>{ne(z.target.textContent),U(),A.swatchesOnly&&G()}),$e(t,"mouseup",z=>{t.removeEventListener("mousemove",de)}),$e(t,"touchend",z=>{t.removeEventListener("touchmove",de)}),$e(t,"mousedown",z=>{S=!1,h.classList.remove("clr-keyboard-nav"),G()}),$e(t,"keydown",z=>{const ue=z.key,pe=z.target,Te=z.shiftKey,Ae=["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"];if(ue==="Escape"){G(!0);return}else if(ue==="Enter"&&pe.tagName!=="BUTTON"){G();return}else Ae.includes(ue)&&(S=!0,h.classList.add("clr-keyboard-nav"));if(ue==="Tab"&&pe.matches(".clr-picker *")){const Ie=Le(),at=Ie.shift(),wt=Ie.pop();Te&&pe===at?(wt.focus(),z.preventDefault()):!Te&&pe===wt&&(at.focus(),z.preventDefault())}}),$e(t,"click",".clr-field button",z=>{k&&J(),z.target.nextElementSibling.dispatchEvent(new Event("click",{bubbles:!0}))}),$e(g,"keydown",z=>{const ue={ArrowUp:[0,-1],ArrowDown:[0,1],ArrowLeft:[-1,0],ArrowRight:[1,0]};Object.keys(ue).includes(z.key)&&(we(...ue[z.key]),z.preventDefault())}),$e(d,"click",de),$e(y,"input",De),$e(b,"input",ze))}function Le(){return Array.from(h.querySelectorAll("input, button")).filter(pe=>!!pe.offsetWidth)}function Ee(z){return t.getElementById(z)}function $e(z,ue,pe,Te){const Ae=Element.prototype.matches||Element.prototype.msMatchesSelector;typeof pe=="string"?z.addEventListener(ue,Ie=>{Ae.call(Ie.target,pe)&&Te.call(Ie.target,Ie)}):(Te=pe,z.addEventListener(ue,Te))}function vt(z,ue){ue=ue!==n?ue:[],t.readyState!=="loading"?z(...ue):t.addEventListener("DOMContentLoaded",()=>{z(...ue)})}NodeList!==n&&NodeList.prototype&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);function Ve(z,ue){w=ue,x=w.value,W(ue),T=X(z),V(),ne(z),U(),x!==z&&w.dispatchEvent(new Event("change",{bubbles:!0}))}const nn=(()=>{const z={init:Be,set:P,wrap:$,close:G,setInstance:I,setColor:Ve,removeInstance:j,updatePosition:V,ready:vt};function ue(pe){vt(()=>{pe&&(typeof pe=="string"?ee(pe):P(pe))})}for(const pe in z)ue[pe]=function(){for(var Te=arguments.length,Ae=new Array(Te),Ie=0;Ie{r.addEventListener("resize",pe=>{ue.updatePosition()}),r.addEventListener("scroll",pe=>{ue.updatePosition()})}),ue})();return nn.coloris=nn,nn})(window,document,Math)})();Wr.coloris;Wr.init;Wr.set;Wr.wrap;Wr.close;Wr.setInstance;Wr.removeInstance;Wr.updatePosition;var vT=typeof global=="object"&&global&&global.Object===Object&&global,yT=typeof self=="object"&&self&&self.Object===Object&&self,Zp=vT||yT||Function("return this")(),Ms=Zp.Symbol,Qp=Object.prototype,_T=Qp.hasOwnProperty,bT=Qp.toString,Qo=Ms?Ms.toStringTag:void 0;function wT(r){var t=_T.call(r,Qo),e=r[Qo];try{r[Qo]=void 0;var n=!0}catch(l){}var i=bT.call(r);return n&&(t?r[Qo]=e:delete r[Qo]),i}var xT=Object.prototype,TT=xT.toString;function ST(r){return TT.call(r)}var OT="[object Null]",ET="[object Undefined]",Hh=Ms?Ms.toStringTag:void 0;function AT(r){return r==null?r===void 0?ET:OT:Hh&&Hh in Object(r)?wT(r):ST(r)}function CT(r){return r!=null&&typeof r=="object"}var kT="[object Symbol]";function PT(r){return typeof r=="symbol"||CT(r)&&AT(r)==kT}var RT=/\s/;function MT(r){for(var t=r.length;t--&&RT.test(r.charAt(t)););return t}var DT=/^\s+/;function LT(r){return r&&r.slice(0,MT(r)+1).replace(DT,"")}function Fu(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}var Wh=NaN,IT=/^[-+]0x[0-9a-f]+$/i,NT=/^0b[01]+$/i,BT=/^0o[0-7]+$/i,FT=parseInt;function zh(r){if(typeof r=="number")return r;if(PT(r))return Wh;if(Fu(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=Fu(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=LT(r);var e=NT.test(r);return e||BT.test(r)?FT(r.slice(2),e?2:8):IT.test(r)?Wh:+r}var pu=function(){return Zp.Date.now()},qT="Expected a function",jT=Math.max,$T=Math.min;function AA(r,t,e){var n,i,l,c,h,d,g=0,p=!1,a=!1,u=!0;if(typeof r!="function")throw new TypeError(qT);t=zh(t)||0,Fu(e)&&(p=!!e.leading,a="maxWait"in e,l=a?jT(zh(e.maxWait)||0,t):l,u="trailing"in e?!!e.trailing:u);function f(C){var A=n,R=i;return n=i=void 0,g=C,c=r.apply(R,A),c}function y(C){return g=C,h=setTimeout(v,t),p?f(C):c}function _(C){var A=C-d,R=C-g,L=t-A;return a?$T(L,l-R):L}function b(C){var A=C-d,R=C-g;return d===void 0||A>=t||A<0||a&&R>=l}function v(){var C=pu();if(b(C))return w(C);h=setTimeout(v,_(C))}function w(C){return h=void 0,u&&n?f(C):(n=i=void 0,c)}function T(){h!==void 0&&clearTimeout(h),g=0,n=d=i=h=void 0}function x(){return h===void 0?c:w(pu())}function S(){var C=pu(),A=b(C);if(n=arguments,i=this,d=C,A){if(h===void 0)return y(d);if(a)return clearTimeout(h),h=setTimeout(v,t),f(d)}return h===void 0&&(h=setTimeout(v,t)),c}return S.cancel=T,S.flush=x,S}function Vt(r,t,e,n){return new(e||(e=Promise))(function(i,l){function c(g){try{d(n.next(g))}catch(p){l(p)}}function h(g){try{d(n.throw(g))}catch(p){l(p)}}function d(g){var p;g.done?i(g.value):(p=g.value,p instanceof e?p:new e(function(a){a(p)})).then(c,h)}d((n=n.apply(r,t||[])).next())})}class ba{constructor(){this.listeners={}}on(t,e,n){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),n==null?void 0:n.once){const i=()=>{this.un(t,i),this.un(t,e)};return this.on(t,i),i}return()=>this.un(t,e)}un(t,e){var n;(n=this.listeners[t])===null||n===void 0||n.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(n=>n(...e))}}const ps={decode:function(r,t){return Vt(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(r).finally(()=>e.close())})},createBuffer:function(r,t){return typeof r[0]=="number"&&(r=[r]),function(e){const n=e[0];if(n.some(i=>i>1||i<-1)){const i=n.length;let l=0;for(let c=0;cl&&(l=h)}for(const c of e)for(let h=0;hr==null?void 0:r[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Jp(r,t){const e=t.xmlns?document.createElementNS(t.xmlns,r):document.createElement(r);for(const[n,i]of Object.entries(t))if(n==="children"&&i)for(const[l,c]of Object.entries(i))c instanceof Node?e.appendChild(c):typeof c=="string"?e.appendChild(document.createTextNode(c)):e.appendChild(Jp(l,c));else n==="style"?Object.assign(e.style,i):n==="textContent"?e.textContent=i:e.setAttribute(n,i.toString());return e}function Gh(r,t,e){const n=Jp(r,t||{});return e==null||e.appendChild(n),n}var UT=Object.freeze({__proto__:null,createElement:Gh,default:Gh});const HT={fetchBlob:function(r,t,e){return Vt(this,void 0,void 0,function*(){const n=yield fetch(r,e);if(n.status>=400)throw new Error(`Failed to fetch ${r}: ${n.status} (${n.statusText})`);return function(i,l){Vt(this,void 0,void 0,function*(){if(!i.body||!i.headers)return;const c=i.body.getReader(),h=Number(i.headers.get("Content-Length"))||0;let d=0;const g=a=>Vt(this,void 0,void 0,function*(){d+=(a==null?void 0:a.length)||0;const u=Math.round(d/h*100);l(u)}),p=()=>Vt(this,void 0,void 0,function*(){let a;try{a=yield c.read()}catch(u){return}a.done||(g(a.value),yield p())});p()})}(n.clone(),t),n.blob()})}};class WT extends ba{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,n){return this.media.addEventListener(t,e,n),()=>this.media.removeEventListener(t,e,n)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const n=this.getSrc();if(t&&n===t)return;this.revokeSrc();const i=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(n&&this.media.removeAttribute("src"),i||t)try{this.media.src=i}catch(l){this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load())}setMediaElement(t){this.media=t}play(){return Vt(this,void 0,void 0,function*(){try{return yield this.media.play()}catch(t){if(t instanceof DOMException&&t.name==="AbortError")return;throw t}})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class lo extends ba{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=t;const n=this.parentFromOptionsContainer(t.container);this.parent=n;const[i,l]=this.initHtml();n.appendChild(i),this.container=i,this.scrollContainer=l.querySelector(".scroll"),this.wrapper=l.querySelector(".wrapper"),this.canvasWrapper=l.querySelector(".canvases"),this.progressWrapper=l.querySelector(".progress"),this.cursor=l.querySelector(".cursor"),e&&l.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const n=this.wrapper.getBoundingClientRect(),i=e.clientX-n.left,l=e.clientY-n.top;return[i/n.width,l/n.height]};if(this.wrapper.addEventListener("click",e=>{const[n,i]=t(e);this.emit("click",n,i)}),this.wrapper.addEventListener("dblclick",e=>{const[n,i]=t(e);this.emit("dblclick",n,i)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:n,clientWidth:i}=this.scrollContainer,l=e/n,c=(e+i)/n;this.emit("scroll",l,c,e,e+i)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,n,i,l=3,c=0,h=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let g=()=>{};const p=a=>{if(a.button!==c)return;a.preventDefault(),a.stopPropagation();let u=a.clientX,f=a.clientY,y=!1;const _=Date.now(),b=S=>{if(S.preventDefault(),S.stopPropagation(),d&&Date.now()-_l||Math.abs(L)>l){const M=t.getBoundingClientRect(),{left:k,top:P}=M;y||(n==null||n(u-k,f-P),y=!0),e(R,L,C-k,A-P),u=C,f=A}},v=S=>{if(y){const C=S.clientX,A=S.clientY,R=t.getBoundingClientRect(),{left:L,top:M}=R;i==null||i(C-L,A-M)}g()},w=S=>{S.relatedTarget&&S.relatedTarget!==document.documentElement||v(S)},T=S=>{y&&(S.stopPropagation(),S.preventDefault())},x=S=>{y&&S.preventDefault()};document.addEventListener("pointermove",b),document.addEventListener("pointerup",v),document.addEventListener("pointerout",w),document.addEventListener("pointercancel",w),document.addEventListener("touchmove",x,{passive:!1}),document.addEventListener("click",T,{capture:!0}),g=()=>{document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",v),document.removeEventListener("pointerout",w),document.removeEventListener("pointercancel",w),document.removeEventListener("touchmove",x),setTimeout(()=>{document.removeEventListener("click",T,{capture:!0})},10)}};return t.addEventListener("pointerdown",p),()=>{g(),t.removeEventListener("pointerdown",p)}}(this.wrapper,(t,e,n)=>{this.emit("drag",Math.max(0,Math.min(1,n/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var n;const i=((n=this.audioData)===null||n===void 0?void 0:n.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const l=this.parent.clientHeight||128;return e!=null&&e.every(c=>!c.overlay)?l/i:l}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),n=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=` :host { user-select: none; min-width: 1px; } :host audio { display: block; width: 100%; } :host .scroll { overflow-x: auto; overflow-y: hidden; width: 100%; position: relative; } :host .noScrollbar { scrollbar-color: transparent; scrollbar-width: none; } :host .noScrollbar::-webkit-scrollbar { display: none; -webkit-appearance: none; } :host .wrapper { position: relative; overflow: visible; z-index: 2; } :host .canvases { min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px; } :host .canvases > div { position: relative; } :host canvas { display: block; position: absolute; top: 0; image-rendering: pixelated; } :host .progress { pointer-events: none; position: absolute; z-index: 2; top: 0; left: 0; width: 0; height: 100%; overflow: hidden; } :host .progress > div { position: relative; } :host .cursor { pointer-events: none; position: absolute; z-index: 5; top: 0; left: 0; height: 100%; border-radius: 2px; }
`,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,n=e*t;this.setScroll(n)}destroy(){var t,e;this.subscriptions.forEach(n=>n()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.unsubscribeOnScroll)===null||e===void 0||e.forEach(n=>n()),this.unsubscribeOnScroll=[]}createDelay(t=10){let e,n;const i=()=>{e&&clearTimeout(e),n&&n()};return this.timeouts.push(i),()=>new Promise((l,c)=>{i(),n=c,e=setTimeout(()=>{e=void 0,n=void 0,l()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),n=e.getContext("2d"),i=e.height*(window.devicePixelRatio||1),l=n.createLinearGradient(0,0,0,i),c=1/(t.length-1);return t.forEach((h,d)=>{const g=d*c;l.addColorStop(g,h)}),l}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,n,i){const l=t[0],c=t[1]||t[0],h=l.length,{width:d,height:g}=n.canvas,p=g/2,a=this.getPixelRatio(),u=e.barWidth?e.barWidth*a:1,f=e.barGap?e.barGap*a:e.barWidth?u/2:0,y=e.barRadius||0,_=d/(u+f)/h,b=y&&"roundRect"in n?"roundRect":"rect";n.beginPath();let v=0,w=0,T=0;for(let x=0;x<=h;x++){const S=Math.round(x*_);if(S>v){const R=Math.round(w*p*i),L=R+Math.round(T*p*i)||1;let M=p-R;e.barAlign==="top"?M=0:e.barAlign==="bottom"&&(M=g-L),n[b](v*(u+f),M,u,L,y),v=S,w=0,T=0}const C=Math.abs(l[x]||0),A=Math.abs(c[x]||0);C>w&&(w=C),A>T&&(T=A)}n.fill(),n.closePath()}renderLineWaveform(t,e,n,i){const l=c=>{const h=t[c]||t[0],d=h.length,{height:g}=n.canvas,p=g/2,a=n.canvas.width/d;n.moveTo(0,p);let u=0,f=0;for(let y=0;y<=d;y++){const _=Math.round(y*a);if(_>u){const v=p+(Math.round(f*p*i)||1)*(c===0?-1:1);n.lineTo(u,v),u=_,f=0}const b=Math.abs(h[y]||0);b>f&&(f=b)}n.lineTo(u,p)};n.beginPath(),l(0),l(1),n.fill(),n.closePath()}renderWaveform(t,e,n){if(n.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,n);let i=e.barHeight||1;if(e.normalize){const l=Array.from(t[0]).reduce((c,h)=>Math.max(c,Math.abs(h)),0);i=l?1/l:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,n,i):this.renderLineWaveform(t,e,n,i)}renderSingleCanvas(t,e,n,i,l,c,h){const d=this.getPixelRatio(),g=document.createElement("canvas");g.width=Math.round(n*d),g.height=Math.round(i*d),g.style.width=`${n}px`,g.style.height=`${i}px`,g.style.left=`${Math.round(l)}px`,c.appendChild(g);const p=g.getContext("2d");if(this.renderWaveform(t,e,p),g.width>0&&g.height>0){const a=g.cloneNode(),u=a.getContext("2d");u.drawImage(g,0,0),u.globalCompositeOperation="source-in",u.fillStyle=this.convertColorValues(e.progressColor),u.fillRect(0,0,g.width,g.height),h.appendChild(a)}}renderMultiCanvas(t,e,n,i,l,c){const h=this.getPixelRatio(),{clientWidth:d}=this.scrollContainer,g=n/h;let p=Math.min(lo.MAX_CANVAS_WIDTH,d,g),a={};if(e.barWidth||e.barGap){const b=e.barWidth||.5,v=b+(e.barGap||b/2);p%v!=0&&(p=Math.floor(p/v)*v)}if(p===0)return;const u=b=>{if(b<0||b>=f||a[b])return;a[b]=!0;const v=b*p;let w=Math.min(g-v,p);if(e.barWidth||e.barGap){const x=e.barWidth||.5,S=x+(e.barGap||x/2);w=Math.floor(w/S)*S}if(w<=0)return;const T=t.map(x=>{const S=Math.floor(v/g*x.length),C=Math.floor((v+w)/g*x.length);return x.slice(S,C)});this.renderSingleCanvas(T,e,w,i,v,l,c)},f=Math.ceil(g/p);if(!this.isScrollable){for(let b=0;b1){const b=this.on("scroll",()=>{const{scrollLeft:v}=this.scrollContainer,w=Math.floor(v/g*f);Object.keys(a).length>lo.MAX_NODES&&(l.innerHTML="",c.innerHTML="",a={}),u(w-1),u(w),u(w+1)});this.unsubscribeOnScroll.push(b)}}renderChannel(t,e,n,i){var{overlay:l}=e,c=function(p,a){var u={};for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&a.indexOf(f)<0&&(u[f]=p[f]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(f=Object.getOwnPropertySymbols(p);y0&&(h.style.marginTop=`-${d}px`),this.canvasWrapper.style.minHeight=`${d}px`,this.canvasWrapper.appendChild(h);const g=h.cloneNode();this.progressWrapper.appendChild(g),this.renderMultiCanvas(t,c,n,d,h,g)}render(t){return Vt(this,void 0,void 0,function*(){var e;this.timeouts.forEach(d=>d()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const n=this.getPixelRatio(),i=this.scrollContainer.clientWidth,l=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=l>i;const c=this.options.fillParent&&!this.isScrollable,h=(c?i:l)*n;if(this.wrapper.style.width=c?"100%":`${l}px`,this.scrollContainer.style.overflowX=this.isScrollable?"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.audioData=t,this.emit("render"),this.options.splitChannels)for(let d=0;d1&&d.push(t.getChannelData(1)),this.renderChannel(d,this.options,h,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(n=>n()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:n}=this.progressWrapper.getBoundingClientRect();let i=n-e;i*=2,i=i<0?Math.floor(i):Math.ceil(i),i/=2,this.scrollContainer.scrollLeft+=i}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:n,scrollWidth:i,clientWidth:l}=this.scrollContainer,c=t*i,h=n,d=n+l,g=l/2;if(this.isDragging)c+30>d?this.scrollContainer.scrollLeft+=30:c-30d)&&(this.scrollContainer.scrollLeft=c-(this.options.autoCenter?g:0));const p=c-n-g;e&&this.options.autoCenter&&p>0&&(this.scrollContainer.scrollLeft+=Math.min(p,10))}{const p=this.scrollContainer.scrollLeft,a=p/i,u=(p+l)/i;this.emit("scroll",a,u,p,p+l)}}renderProgress(t,e){if(isNaN(t))return;const n=100*t;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.transform=this.options.cursorWidth?`translateX(-${t*this.options.cursorWidth}px)`:"",this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,n){return Vt(this,void 0,void 0,function*(){const i=this.canvasWrapper.querySelectorAll("canvas");if(!i.length)throw new Error("No waveform data");if(n==="dataURL"){const l=Array.from(i).map(c=>c.toDataURL(t,e));return Promise.resolve(l)}return Promise.all(Array.from(i).map(l=>new Promise((c,h)=>{l.toBlob(d=>{d?c(d):h(new Error("Could not export image"))},t,e)})))})}}lo.MAX_CANVAS_WIDTH=8e3,lo.MAX_NODES=10;class zT extends ba{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class gu extends ba{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return Vt(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()}).then(e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e)).then(e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let e=this.playedDuration*this._playbackRate;(e>=this.duration||e<0)&&(e=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,e),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return Vt(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=t-this.currentTime,n=this.bufferNode;n==null||n.stop(this.audioContext.currentTime+e),n==null||n.addEventListener("ended",()=>{n===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return Vt(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playedDuration=t/this._playbackRate,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let n=0;n{this.emit("init");const{peaks:l,duration:c}=this.options;(i||l&&c)&&this.load(i,l,c).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))}),this.renderer.on("dblclick",(t,e)=>{this.emit("dblclick",t,e)}),this.renderer.on("scroll",(t,e,n,i)=>{const l=this.getDuration();this.emit("scroll",t*l,e*l,n,i)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",e=>{if(!this.options.interact)return;let n;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?n=0:this.options.dragToSeek===!0?n=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(n=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(e)},n),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=ps.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=ps.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){if(this.plugins.includes(t))return t;t._init(this),this.plugins.push(t);const e=t.once("destroy",()=>{this.plugins=this.plugins.filter(n=>n!==t),this.subscriptions=this.subscriptions.filter(n=>n!==e)});return this.subscriptions.push(e),t}unregisterPlugin(t){this.plugins=this.plugins.filter(e=>e!==t),t.destroy()}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,n,i){return Vt(this,void 0,void 0,function*(){var l;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!e&&!n){const h=this.options.fetchParams||{};window.AbortController&&!h.signal&&(this.abortController=new AbortController,h.signal=(l=this.abortController)===null||l===void 0?void 0:l.signal);const d=p=>this.emit("loading",p);e=yield HT.fetchBlob(t,d,h);const g=this.options.blobMimeType;g&&(e=new Blob([e],{type:g}))}this.setSrc(t,e);const c=yield new Promise(h=>{const d=i||this.getDuration();d?h(d):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>h(this.getDuration()),{once:!0}))});if(!t&&!e){const h=this.getMediaElement();h instanceof gu&&(h.duration=c)}if(n)this.decodedData=ps.createBuffer(n,c||0);else if(e){const h=yield e.arrayBuffer();this.decodedData=yield ps.decode(h,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,e,n){return Vt(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,n)}catch(i){throw this.emit("error",i),i}})}loadBlob(t,e,n){return Vt(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,n)}catch(i){throw this.emit("error",i),i}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:n=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const i=Math.min(t,this.decodedData.numberOfChannels),l=[];for(let c=0;cMath.abs(u)&&(u=y)}d.push(Math.round(u*n)/n)}l.push(d)}return l}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(t,e){const n=Object.create(null,{play:{get:()=>super.play}});return Vt(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const i=yield n.play.call(this);return e!=null&&(this.media instanceof gu?this.media.stopAt(e):this.stopAtPosition=e),i})}playPause(){return Vt(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return Vt(this,arguments,void 0,function*(t="image/png",e=1,n="dataURL"){return this.renderer.exportImage(t,e,n)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}Ds.BasePlugin=class extends ba{constructor(r){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=r}onInit(){}_init(r){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=r,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(r=>r()),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}},Ds.dom=UT;function eo(r,t,e){var h;let n=(h=e.initialDeps)!=null?h:[],i,l=!0;function c(){var d,g,p;let a;e.key&&((d=e.debug)!=null&&d.call(e))&&(a=Date.now());const u=r();if(!(u.length!==n.length||u.some((_,b)=>n[b]!==_)))return i;n=u;let y;if(e.key&&((g=e.debug)!=null&&g.call(e))&&(y=Date.now()),i=t(...u),e.key&&((p=e.debug)!=null&&p.call(e))){const _=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-y)*100)/100,v=b/16,w=(T,x)=>{for(T=String(T);T.length{n=d},c}function Yh(r,t){if(r===void 0)throw new Error("Unexpected undefined");return r}const YT=(r,t)=>Math.abs(r-t)<1.01,VT=(r,t,e)=>{let n;return function(...i){r.clearTimeout(n),n=r.setTimeout(()=>t.apply(this,i),e)}},Vh=r=>{const{offsetWidth:t,offsetHeight:e}=r;return{width:t,height:e}},KT=r=>r,XT=r=>{const t=Math.max(r.startIndex-r.overscan,0),e=Math.min(r.endIndex+r.overscan,r.count-1),n=[];for(let i=t;i<=e;i++)n.push(i);return n},CA=(r,t)=>{const e=r.scrollElement;if(!e)return;const n=r.targetWindow;if(!n)return;const i=c=>{const{width:h,height:d}=c;t({width:Math.round(h),height:Math.round(d)})};if(i(Vh(e)),!n.ResizeObserver)return()=>{};const l=new n.ResizeObserver(c=>{const h=()=>{const d=c[0];if(d!=null&&d.borderBoxSize){const g=d.borderBoxSize[0];if(g){i({width:g.inlineSize,height:g.blockSize});return}}i(Vh(e))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(h):h()});return l.observe(e,{box:"border-box"}),()=>{l.unobserve(e)}},Kh={passive:!0},Xh=typeof window=="undefined"?!0:"onscrollend"in window,kA=(r,t)=>{const e=r.scrollElement;if(!e)return;const n=r.targetWindow;if(!n)return;let i=0;const l=r.options.useScrollendEvent&&Xh?()=>{}:VT(n,()=>{t(i,!1)},r.options.isScrollingResetDelay),c=p=>()=>{const{horizontal:a,isRtl:u}=r.options;i=a?e.scrollLeft*(u&&-1||1):e.scrollTop,l(),t(i,p)},h=c(!0),d=c(!1);d(),e.addEventListener("scroll",h,Kh);const g=r.options.useScrollendEvent&&Xh;return g&&e.addEventListener("scrollend",d,Kh),()=>{e.removeEventListener("scroll",h),g&&e.removeEventListener("scrollend",d)}},ZT=(r,t,e)=>{if(t!=null&&t.borderBoxSize){const n=t.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return r[e.options.horizontal?"offsetWidth":"offsetHeight"]},PA=(r,{adjustments:t=0,behavior:e},n)=>{var i,l;const c=r+t;(l=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||l.call(i,{[n.options.horizontal?"left":"top"]:c,behavior:e})};class RA{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(i=>{i.forEach(l=>{const c=()=>{this._measureElement(l.target,l)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var i;(i=n())==null||i.disconnect(),e=null},observe:i=>{var l;return(l=n())==null?void 0:l.observe(i,{box:"border-box"})},unobserve:i=>{var l;return(l=n())==null?void 0:l.unobserve(i)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,i])=>{typeof i=="undefined"&&delete e[n]}),this.options=st({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:KT,rangeExtractor:XT,onChange:()=>{},measureElement:ZT,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1},e)},this.notify=e=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,e)},this.maybeNotify=eo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var i;var e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(i=(e=this.scrollElement)==null?void 0:e.window)!=null?i:null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,c)=>{this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){var e;return this.options.enabled?(this.scrollRect=(e=this.scrollRect)!=null?e:this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0)},this.getScrollOffset=()=>{var e;return this.options.enabled?(this.scrollOffset=(e=this.scrollOffset)!=null?e:typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset,this.scrollOffset):(this.scrollOffset=null,0)},this.getFurthestMeasurement=(e,n)=>{const i=new Map,l=new Map;for(let c=n-1;c>=0;c--){const h=e[c];if(i.has(h.lane))continue;const d=l.get(h.lane);if(d==null||h.end>d.end?l.set(h.lane,h):h.endc.end===h.end?c.index-h.index:c.end-h.end)[0]:void 0},this.getMeasurementOptions=eo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,i,l,c,h)=>(this.prevLanes!==void 0&&this.prevLanes!==h&&(this.lanesChangedFlag=!0),this.prevLanes=h,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:i,getItemKey:l,enabled:c,lanes:h}),{key:!1,skipInitialOnChange:!0,onChange:()=>{this.notify(this.isScrolling)}}),this.getMeasurements=eo(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:i,getItemKey:l,enabled:c,lanes:h},d)=>{if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const u of this.laneAssignments.keys())u>=e&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const g=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const p=this.measurementsCache.slice(0,g),a=new Array(h).fill(void 0);for(let u=0;u1){_=y;const x=a[_],S=x!==void 0?p[x]:void 0;b=S?S.end+this.options.gap:n+i}else{const x=this.options.lanes===1?p[u-1]:this.getFurthestMeasurement(p,u);b=x?x.end+this.options.gap:n+i,_=x?x.lane:u%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(u,_)}const v=d.get(f),w=typeof v=="number"?v:this.options.estimateSize(u),T=b+w;p[u]={index:u,start:b,size:w,end:T,key:f,lane:_},a[_]=u}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=eo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,i,l)=>this.range=e.length>0&&n>0?QT({measurements:e,outerSize:n,scrollOffset:i,lanes:l}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=eo(()=>{let e=null,n=null;const i=this.calculateRange();return i&&(e=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,i,l,c)=>l===null||c===null?[]:e({startIndex:l,endIndex:c,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,i=e.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(e,n)=>{const i=this.indexFromElement(e),l=this.measurementsCache[i];if(!l)return;const c=l.key,h=this.elementsCache.get(c);h!==e&&(h&&this.observer.unobserve(h),this.observer.observe(e),this.elementsCache.set(c,e)),e.isConnected&&this.resizeItem(i,this.options.measureElement(e,n,this))},this.resizeItem=(e,n)=>{var h;const i=this.measurementsCache[e];if(!i)return;const l=(h=this.itemSizeCache.get(i.key))!=null?h:i.size,c=n-l;c!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,c,this):i.start{if(!e){this.elementsCache.forEach((n,i)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(i))});return}this._measureElement(e,void 0)},this.getVirtualItems=eo(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const i=[];for(let l=0,c=e.length;lthis.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return Yh(n[eg(0,n.length-1,i=>Yh(n[i]).start,e)])},this.getOffsetForAlignment=(e,n,i=0)=>{const l=this.getSize(),c=this.getScrollOffset();n==="auto"&&(n=e>=c+l?"end":"start"),n==="center"?e+=(i-l)/2:n==="end"&&(e-=l);const h=this.getTotalSize()+this.options.scrollMargin-l;return Math.max(Math.min(h,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const i=this.measurementsCache[e];if(!i)return;const l=this.getSize(),c=this.getScrollOffset();if(n==="auto")if(i.end>=c+l-this.options.scrollPaddingEnd)n="end";else if(i.start<=c+this.options.scrollPaddingStart)n="start";else return[c,n];const h=n==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(h,n,i.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:n="start",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,n),{adjustments:void 0,behavior:i})},this.scrollToIndex=(e,{align:n="auto",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let l=0;const c=10,h=g=>{if(!this.targetWindow)return;const p=this.getOffsetForIndex(e,g);if(!p){console.warn("Failed to get offset for index:",e);return}const[a,u]=p;this._scrollToOffset(a,{adjustments:void 0,behavior:i}),this.targetWindow.requestAnimationFrame(()=>{const f=this.getScrollOffset(),y=this.getOffsetForIndex(e,u);if(!y){console.warn("Failed to get offset for index:",e);return}YT(y[0],f)||d(u)})},d=g=>{this.targetWindow&&(l++,lh(g)):console.warn(`Failed to scroll to index ${e} after ${c} attempts.`))};h(n)},this.scrollBy=(e,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var l;var e;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=(l=(e=n[n.length-1])==null?void 0:e.end)!=null?l:0;else{const c=Array(this.options.lanes).fill(null);let h=n.length-1;for(;h>=0&&c.some(d=>d===null);){const d=n[h];c[d.lane]===null&&(c[d.lane]=d.end),h--}i=Math.max(...c.filter(d=>d!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:i})=>{this.options.scrollToFn(e,{behavior:i,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const eg=(r,t,e,n)=>{for(;r<=t;){const i=(r+t)/2|0,l=e(i);if(ln)t=i-1;else return i}return r>0?r-1:0};function QT({measurements:r,outerSize:t,scrollOffset:e,lanes:n}){const i=r.length-1,l=d=>r[d].start;if(r.length<=n)return{startIndex:0,endIndex:i};let c=eg(0,i,l,e),h=c;if(n===1)for(;h1){const d=Array(n).fill(0);for(;hp=0&&g.some(p=>p>=e);){const p=r[c];g[p.lane]=p.start,c--}c=Math.max(0,c-c%n),h=Math.min(i,h+(n-1-h%n))}return{startIndex:c,endIndex:h}}const uo=Math.min,vi=Math.max,Ls=Math.round,gs=Math.floor,er=r=>({x:r,y:r}),JT={left:"right",right:"left",bottom:"top",top:"bottom"},eS={start:"end",end:"start"};function qu(r,t,e){return vi(r,uo(t,e))}function wa(r,t){return typeof r=="function"?r(t):r}function yi(r){return r.split("-")[0]}function xa(r){return r.split("-")[1]}function tg(r){return r==="x"?"y":"x"}function uc(r){return r==="y"?"height":"width"}const tS=new Set(["top","bottom"]);function qr(r){return tS.has(yi(r))?"y":"x"}function cc(r){return tg(qr(r))}function nS(r,t,e){e===void 0&&(e=!1);const n=xa(r),i=cc(r),l=uc(i);let c=i==="x"?n===(e?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=Is(c)),[c,Is(c)]}function rS(r){const t=Is(r);return[ju(r),t,ju(t)]}function ju(r){return r.replace(/start|end/g,t=>eS[t])}const Zh=["left","right"],Qh=["right","left"],iS=["top","bottom"],oS=["bottom","top"];function aS(r,t,e){switch(r){case"top":case"bottom":return e?t?Qh:Zh:t?Zh:Qh;case"left":case"right":return t?iS:oS;default:return[]}}function sS(r,t,e,n){const i=xa(r);let l=aS(yi(r),e==="start",n);return i&&(l=l.map(c=>c+"-"+i),t&&(l=l.concat(l.map(ju)))),l}function Is(r){return r.replace(/left|right|bottom|top/g,t=>JT[t])}function lS(r){return st({top:0,right:0,bottom:0,left:0},r)}function ng(r){return typeof r!="number"?lS(r):{top:r,right:r,bottom:r,left:r}}function Ns(r){const{x:t,y:e,width:n,height:i}=r;return{width:n,height:i,top:e,left:t,right:t+n,bottom:e+i,x:t,y:e}}function Jh(r,t,e){let{reference:n,floating:i}=r;const l=qr(t),c=cc(t),h=uc(c),d=yi(t),g=l==="y",p=n.x+n.width/2-i.width/2,a=n.y+n.height/2-i.height/2,u=n[h]/2-i[h]/2;let f;switch(d){case"top":f={x:p,y:n.y-i.height};break;case"bottom":f={x:p,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:a};break;case"left":f={x:n.x-i.width,y:a};break;default:f={x:n.x,y:n.y}}switch(xa(t)){case"start":f[c]-=u*(e&&g?-1:1);break;case"end":f[c]+=u*(e&&g?-1:1);break}return f}const uS=(r,t,e)=>tt(void 0,null,function*(){const{placement:n="bottom",strategy:i="absolute",middleware:l=[],platform:c}=e,h=l.filter(Boolean),d=yield c.isRTL==null?void 0:c.isRTL(t);let g=yield c.getElementRects({reference:r,floating:t,strategy:i}),{x:p,y:a}=Jh(g,n,d),u=n,f={},y=0;for(let _=0;_({name:"arrow",options:r,fn(e){return tt(this,null,function*(){const{x:n,y:i,placement:l,rects:c,platform:h,elements:d,middlewareData:g}=e,{element:p,padding:a=0}=wa(r,e)||{};if(p==null)return{};const u=ng(a),f={x:n,y:i},y=cc(l),_=uc(y),b=yield h.getDimensions(p),v=y==="y",w=v?"top":"left",T=v?"bottom":"right",x=v?"clientHeight":"clientWidth",S=c.reference[_]+c.reference[y]-f[y]-c.floating[_],C=f[y]-c.reference[y],A=yield h.getOffsetParent==null?void 0:h.getOffsetParent(p);let R=A?A[x]:0;(!R||!(yield h.isElement==null?void 0:h.isElement(A)))&&(R=d.floating[x]||c.floating[_]);const L=S/2-C/2,M=R/2-b[_]/2-1,k=uo(u[w],M),P=uo(u[T],M),I=k,j=R-b[_]-P,W=R/2-b[_]/2+L,J=qu(I,W,j),ee=!g.arrow&&xa(l)!=null&&W!==J&&c.reference[_]/2-(WJ<=0)){var P,I;const J=(((P=c.flip)==null?void 0:P.index)||0)+1,ee=R[J];if(ee&&(!(u==="alignment"?T!==qr(ee):!1)||k.every($=>qr($.placement)===T?$.overflows[0]>0:!0)))return{data:{index:J,overflows:k},reset:{placement:ee}};let oe=(I=k.filter(V=>V.overflows[0]<=0).sort((V,$)=>V.overflows[1]-$.overflows[1])[0])==null?void 0:I.placement;if(!oe)switch(y){case"bestFit":{var j;const V=(j=k.filter($=>{if(A){const N=qr($.placement);return N===T||N==="y"}return!0}).map($=>[$.placement,$.overflows.filter(N=>N>0).reduce((N,H)=>N+H,0)]).sort(($,N)=>$[1]-N[1])[0])==null?void 0:j[0];V&&(oe=V);break}case"initialPlacement":oe=d;break}if(l!==oe)return{reset:{placement:oe}}}return{}})}}},hS=new Set(["left","top"]);function dS(r,t){return tt(this,null,function*(){const{placement:e,platform:n,elements:i}=r,l=yield n.isRTL==null?void 0:n.isRTL(i.floating),c=yi(e),h=xa(e),d=qr(e)==="y",g=hS.has(c)?-1:1,p=l&&d?-1:1,a=wa(t,r);let{mainAxis:u,crossAxis:f,alignmentAxis:y}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return h&&typeof y=="number"&&(f=h==="end"?y*-1:y),d?{x:f*p,y:u*g}:{x:u*g,y:f*p}})}const pS=function(r){return r===void 0&&(r=0),{name:"offset",options:r,fn(e){return tt(this,null,function*(){var n,i;const{x:l,y:c,placement:h,middlewareData:d}=e,g=yield dS(e,r);return h===((n=d.offset)==null?void 0:n.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:l+g.x,y:c+g.y,data:Ut(st({},g),{placement:h})}})}}},gS=function(r){return r===void 0&&(r={}),{name:"shift",options:r,fn(e){return tt(this,null,function*(){const{x:n,y:i,placement:l}=e,v=wa(r,e),{mainAxis:c=!0,crossAxis:h=!1,limiter:d={fn:w=>{let{x:T,y:x}=w;return{x:T,y:x}}}}=v,g=hs(v,["mainAxis","crossAxis","limiter"]),p={x:n,y:i},a=yield rg(e,g),u=qr(yi(l)),f=tg(u);let y=p[f],_=p[u];if(c){const w=f==="y"?"top":"left",T=f==="y"?"bottom":"right",x=y+a[w],S=y-a[T];y=qu(x,y,S)}if(h){const w=u==="y"?"top":"left",T=u==="y"?"bottom":"right",x=_+a[w],S=_-a[T];_=qu(x,_,S)}const b=d.fn(Ut(st({},e),{[f]:y,[u]:_}));return Ut(st({},b),{data:{x:b.x-n,y:b.y-i,enabled:{[f]:c,[u]:h}}})})}}};function Xs(){return typeof window!="undefined"}function ho(r){return ig(r)?(r.nodeName||"").toLowerCase():"#document"}function xn(r){var t;return(r==null||(t=r.ownerDocument)==null?void 0:t.defaultView)||window}function rr(r){var t;return(t=(ig(r)?r.ownerDocument:r.document)||window.document)==null?void 0:t.documentElement}function ig(r){return Xs()?r instanceof Node||r instanceof xn(r).Node:!1}function Un(r){return Xs()?r instanceof Element||r instanceof xn(r).Element:!1}function nr(r){return Xs()?r instanceof HTMLElement||r instanceof xn(r).HTMLElement:!1}function ed(r){return!Xs()||typeof ShadowRoot=="undefined"?!1:r instanceof ShadowRoot||r instanceof xn(r).ShadowRoot}const mS=new Set(["inline","contents"]);function Ta(r){const{overflow:t,overflowX:e,overflowY:n,display:i}=Hn(r);return/auto|scroll|overlay|hidden|clip/.test(t+n+e)&&!mS.has(i)}const vS=new Set(["table","td","th"]);function yS(r){return vS.has(ho(r))}const _S=[":popover-open",":modal"];function Zs(r){return _S.some(t=>{try{return r.matches(t)}catch(e){return!1}})}const bS=["transform","translate","scale","rotate","perspective"],wS=["transform","translate","scale","rotate","perspective","filter"],xS=["paint","layout","strict","content"];function fc(r){const t=hc(),e=Un(r)?Hn(r):r;return bS.some(n=>e[n]?e[n]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||wS.some(n=>(e.willChange||"").includes(n))||xS.some(n=>(e.contain||"").includes(n))}function TS(r){let t=Ur(r);for(;nr(t)&&!co(t);){if(fc(t))return t;if(Zs(t))return null;t=Ur(t)}return null}function hc(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const SS=new Set(["html","body","#document"]);function co(r){return SS.has(ho(r))}function Hn(r){return xn(r).getComputedStyle(r)}function Qs(r){return Un(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Ur(r){if(ho(r)==="html")return r;const t=r.assignedSlot||r.parentNode||ed(r)&&r.host||rr(r);return ed(t)?t.host:t}function og(r){const t=Ur(r);return co(t)?r.ownerDocument?r.ownerDocument.body:r.body:nr(t)&&Ta(t)?t:og(t)}function ga(r,t,e){var n;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=og(r),l=i===((n=r.ownerDocument)==null?void 0:n.body),c=xn(i);if(l){const h=$u(c);return t.concat(c,c.visualViewport||[],Ta(i)?i:[],h&&e?ga(h):[])}return t.concat(i,ga(i,[],e))}function $u(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function ag(r){const t=Hn(r);let e=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=nr(r),l=i?r.offsetWidth:e,c=i?r.offsetHeight:n,h=Ls(e)!==l||Ls(n)!==c;return h&&(e=l,n=c),{width:e,height:n,$:h}}function dc(r){return Un(r)?r:r.contextElement}function ao(r){const t=dc(r);if(!nr(t))return er(1);const e=t.getBoundingClientRect(),{width:n,height:i,$:l}=ag(t);let c=(l?Ls(e.width):e.width)/n,h=(l?Ls(e.height):e.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!h||!Number.isFinite(h))&&(h=1),{x:c,y:h}}const OS=er(0);function sg(r){const t=xn(r);return!hc()||!t.visualViewport?OS:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ES(r,t,e){return t===void 0&&(t=!1),!e||t&&e!==xn(r)?!1:t}function _i(r,t,e,n){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=r.getBoundingClientRect(),l=dc(r);let c=er(1);t&&(n?Un(n)&&(c=ao(n)):c=ao(r));const h=ES(l,e,n)?sg(l):er(0);let d=(i.left+h.x)/c.x,g=(i.top+h.y)/c.y,p=i.width/c.x,a=i.height/c.y;if(l){const u=xn(l),f=n&&Un(n)?xn(n):n;let y=u,_=$u(y);for(;_&&n&&f!==y;){const b=ao(_),v=_.getBoundingClientRect(),w=Hn(_),T=v.left+(_.clientLeft+parseFloat(w.paddingLeft))*b.x,x=v.top+(_.clientTop+parseFloat(w.paddingTop))*b.y;d*=b.x,g*=b.y,p*=b.x,a*=b.y,d+=T,g+=x,y=xn(_),_=$u(y)}}return Ns({width:p,height:a,x:d,y:g})}function Js(r,t){const e=Qs(r).scrollLeft;return t?t.left+e:_i(rr(r)).left+e}function lg(r,t){const e=r.getBoundingClientRect(),n=e.left+t.scrollLeft-Js(r,e),i=e.top+t.scrollTop;return{x:n,y:i}}function AS(r){let{elements:t,rect:e,offsetParent:n,strategy:i}=r;const l=i==="fixed",c=rr(n),h=t?Zs(t.floating):!1;if(n===c||h&&l)return e;let d={scrollLeft:0,scrollTop:0},g=er(1);const p=er(0),a=nr(n);if((a||!a&&!l)&&((ho(n)!=="body"||Ta(c))&&(d=Qs(n)),nr(n))){const f=_i(n);g=ao(n),p.x=f.x+n.clientLeft,p.y=f.y+n.clientTop}const u=c&&!a&&!l?lg(c,d):er(0);return{width:e.width*g.x,height:e.height*g.y,x:e.x*g.x-d.scrollLeft*g.x+p.x+u.x,y:e.y*g.y-d.scrollTop*g.y+p.y+u.y}}function CS(r){return Array.from(r.getClientRects())}function kS(r){const t=rr(r),e=Qs(r),n=r.ownerDocument.body,i=vi(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),l=vi(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let c=-e.scrollLeft+Js(r);const h=-e.scrollTop;return Hn(n).direction==="rtl"&&(c+=vi(t.clientWidth,n.clientWidth)-i),{width:i,height:l,x:c,y:h}}const td=25;function PS(r,t){const e=xn(r),n=rr(r),i=e.visualViewport;let l=n.clientWidth,c=n.clientHeight,h=0,d=0;if(i){l=i.width,c=i.height;const p=hc();(!p||p&&t==="fixed")&&(h=i.offsetLeft,d=i.offsetTop)}const g=Js(n);if(g<=0){const p=n.ownerDocument,a=p.body,u=getComputedStyle(a),f=p.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,y=Math.abs(n.clientWidth-a.clientWidth-f);y<=td&&(l-=y)}else g<=td&&(l+=g);return{width:l,height:c,x:h,y:d}}const RS=new Set(["absolute","fixed"]);function MS(r,t){const e=_i(r,!0,t==="fixed"),n=e.top+r.clientTop,i=e.left+r.clientLeft,l=nr(r)?ao(r):er(1),c=r.clientWidth*l.x,h=r.clientHeight*l.y,d=i*l.x,g=n*l.y;return{width:c,height:h,x:d,y:g}}function nd(r,t,e){let n;if(t==="viewport")n=PS(r,e);else if(t==="document")n=kS(rr(r));else if(Un(t))n=MS(t,e);else{const i=sg(r);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Ns(n)}function ug(r,t){const e=Ur(r);return e===t||!Un(e)||co(e)?!1:Hn(e).position==="fixed"||ug(e,t)}function DS(r,t){const e=t.get(r);if(e)return e;let n=ga(r,[],!1).filter(h=>Un(h)&&ho(h)!=="body"),i=null;const l=Hn(r).position==="fixed";let c=l?Ur(r):r;for(;Un(c)&&!co(c);){const h=Hn(c),d=fc(c);!d&&h.position==="fixed"&&(i=null),(l?!d&&!i:!d&&h.position==="static"&&!!i&&RS.has(i.position)||Ta(c)&&!d&&ug(r,c))?n=n.filter(p=>p!==c):i=h,c=Ur(c)}return t.set(r,n),n}function LS(r){let{element:t,boundary:e,rootBoundary:n,strategy:i}=r;const c=[...e==="clippingAncestors"?Zs(t)?[]:DS(t,this._c):[].concat(e),n],h=c[0],d=c.reduce((g,p)=>{const a=nd(t,p,i);return g.top=vi(a.top,g.top),g.right=uo(a.right,g.right),g.bottom=uo(a.bottom,g.bottom),g.left=vi(a.left,g.left),g},nd(t,h,i));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function IS(r){const{width:t,height:e}=ag(r);return{width:t,height:e}}function NS(r,t,e){const n=nr(t),i=rr(t),l=e==="fixed",c=_i(r,!0,l,t);let h={scrollLeft:0,scrollTop:0};const d=er(0);function g(){d.x=Js(i)}if(n||!n&&!l)if((ho(t)!=="body"||Ta(i))&&(h=Qs(t)),n){const f=_i(t,!0,l,t);d.x=f.x+t.clientLeft,d.y=f.y+t.clientTop}else i&&g();l&&!n&&i&&g();const p=i&&!n&&!l?lg(i,h):er(0),a=c.left+h.scrollLeft-d.x-p.x,u=c.top+h.scrollTop-d.y-p.y;return{x:a,y:u,width:c.width,height:c.height}}function mu(r){return Hn(r).position==="static"}function rd(r,t){if(!nr(r)||Hn(r).position==="fixed")return null;if(t)return t(r);let e=r.offsetParent;return rr(r)===e&&(e=e.ownerDocument.body),e}function cg(r,t){const e=xn(r);if(Zs(r))return e;if(!nr(r)){let i=Ur(r);for(;i&&!co(i);){if(Un(i)&&!mu(i))return i;i=Ur(i)}return e}let n=rd(r,t);for(;n&&yS(n)&&mu(n);)n=rd(n,t);return n&&co(n)&&mu(n)&&!fc(n)?e:n||TS(r)||e}const BS=function(r){return tt(this,null,function*(){const t=this.getOffsetParent||cg,e=this.getDimensions,n=yield e(r.floating);return{reference:NS(r.reference,yield t(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}})};function FS(r){return Hn(r).direction==="rtl"}const qS={convertOffsetParentRelativeRectToViewportRelativeRect:AS,getDocumentElement:rr,getClippingRect:LS,getOffsetParent:cg,getElementRects:BS,getClientRects:CS,getDimensions:IS,getScale:ao,isElement:Un,isRTL:FS};function fg(r,t){return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height}function jS(r,t){let e=null,n;const i=rr(r);function l(){var h;clearTimeout(n),(h=e)==null||h.disconnect(),e=null}function c(h,d){h===void 0&&(h=!1),d===void 0&&(d=1),l();const g=r.getBoundingClientRect(),{left:p,top:a,width:u,height:f}=g;if(h||t(),!u||!f)return;const y=gs(a),_=gs(i.clientWidth-(p+u)),b=gs(i.clientHeight-(a+f)),v=gs(p),T={rootMargin:-y+"px "+-_+"px "+-b+"px "+-v+"px",threshold:vi(0,uo(1,d))||1};let x=!0;function S(C){const A=C[0].intersectionRatio;if(A!==d){if(!x)return c();A?c(!1,A):n=setTimeout(()=>{c(!1,1e-7)},1e3)}A===1&&!fg(g,r.getBoundingClientRect())&&c(),x=!1}try{e=new IntersectionObserver(S,Ut(st({},T),{root:i.ownerDocument}))}catch(C){e=new IntersectionObserver(S,T)}e.observe(r)}return c(!0),l}function MA(r,t,e,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:d=!1}=n,g=dc(r),p=i||l?[...g?ga(g):[],...ga(t)]:[];p.forEach(v=>{i&&v.addEventListener("scroll",e,{passive:!0}),l&&v.addEventListener("resize",e)});const a=g&&h?jS(g,e):null;let u=-1,f=null;c&&(f=new ResizeObserver(v=>{let[w]=v;w&&w.target===g&&f&&(f.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var T;(T=f)==null||T.observe(t)})),e()}),g&&!d&&f.observe(g),f.observe(t));let y,_=d?_i(r):null;d&&b();function b(){const v=_i(r);_&&!fg(_,v)&&e(),_=v,y=requestAnimationFrame(b)}return e(),()=>{var v;p.forEach(w=>{i&&w.removeEventListener("scroll",e),l&&w.removeEventListener("resize",e)}),a==null||a(),(v=f)==null||v.disconnect(),f=null,d&&cancelAnimationFrame(y)}}const DA=pS,LA=gS,IA=fS,NA=cS,BA=(r,t,e)=>{const n=new Map,i=st({platform:qS},e),l=Ut(st({},i.platform),{_c:n});return uS(r,t,Ut(st({},i),{platform:l}))},hg=6048e5,$S=864e5,US=6e4,HS=36e5,WS=1e3,id=Symbol.for("constructDateFrom");function mt(r,t){return typeof r=="function"?r(t):r&&typeof r=="object"&&id in r?r[id](t):r instanceof Date?new r.constructor(t):new Date(t)}function je(r,t){return mt(t||r,r)}function el(r,t,e){const n=je(r,e==null?void 0:e.in);return isNaN(t)?mt((e==null?void 0:e.in)||r,NaN):(t&&n.setDate(n.getDate()+t),n)}function tl(r,t,e){const n=je(r,e==null?void 0:e.in);if(isNaN(t))return mt(r,NaN);if(!t)return n;const i=n.getDate(),l=mt(r,n.getTime());l.setMonth(n.getMonth()+t+1,0);const c=l.getDate();return i>=c?l:(n.setFullYear(l.getFullYear(),l.getMonth(),i),n)}function FA(r,t,e){const{years:n=0,months:i=0,weeks:l=0,days:c=0,hours:h=0,minutes:d=0,seconds:g=0}=t,p=je(r,e==null?void 0:e.in),a=i||n?tl(p,i+n*12):p,u=c||l?el(a,c+l*7):a,f=d+h*60,_=(g+f*60)*1e3;return mt(r,+u+_)}let zS={};function Ti(){return zS}function Hr(r,t){var h,d,g,p,a,u,f,y;const e=Ti(),n=(y=(f=(p=(g=t==null?void 0:t.weekStartsOn)!=null?g:(d=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:d.weekStartsOn)!=null?p:e.weekStartsOn)!=null?f:(u=(a=e.locale)==null?void 0:a.options)==null?void 0:u.weekStartsOn)!=null?y:0,i=je(r,t==null?void 0:t.in),l=i.getDay(),c=(l=l.getTime()?n+1:e.getTime()>=h.getTime()?n:n-1}function Bs(r){const t=je(r),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+r-+e}function Sa(r,...t){const e=mt.bind(null,t.find(n=>typeof n=="object"));return t.map(e)}function od(r,t){const e=je(r,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function GS(r,t,e){const[n,i]=Sa(e==null?void 0:e.in,r,t),l=od(n),c=od(i),h=+l-Bs(l),d=+c-Bs(c);return Math.round((h-d)/$S)}function YS(r,t){const e=dg(r,t),n=mt(r,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),fo(n)}function VS(r,t,e){return tl(r,t*3,e)}function KS(r,t,e){return tl(r,t*12,e)}function ad(r,t){const e=+je(r)-+je(t);return e<0?-1:e>0?1:e}function XS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function ZS(r){return!(!XS(r)&&typeof r!="number"||isNaN(+je(r)))}function qA(r,t){const e=je(r,t==null?void 0:t.in);return Math.trunc(e.getMonth()/3)+1}function QS(r,t,e){const[n,i]=Sa(e==null?void 0:e.in,r,t);return n.getFullYear()-i.getFullYear()}function JS(r){return t=>{const n=(r?Math[r]:Math.trunc)(t);return n===0?0:n}}function jA(r,t,e){const[n,i]=Sa(e==null?void 0:e.in,r,t),l=ad(n,i),c=Math.abs(QS(n,i));n.setFullYear(1584),i.setFullYear(1584);const h=ad(n,i)===-l,d=l*(c-+h);return d===0?0:d}function pg(r,t){const[e,n]=Sa(r,t.start,t.end);return{start:e,end:n}}function $A(r,t){const{start:e,end:n}=pg(t==null?void 0:t.in,r);let i=+e>+n;const l=i?+e:+n,c=i?n:e;c.setHours(0,0,0,0);let h=1;const d=[];for(;+c<=l;)d.push(mt(e,c)),c.setDate(c.getDate()+h),c.setHours(0,0,0,0);return i?d.reverse():d}function no(r,t){const e=je(r,t==null?void 0:t.in),n=e.getMonth(),i=n-n%3;return e.setMonth(i,1),e.setHours(0,0,0,0),e}function UA(r,t){const{start:e,end:n}=pg(t==null?void 0:t.in,r);let i=+e>+n;const l=i?+no(e):+no(n);let c=no(i?n:e),h=1;const d=[];for(;+c<=l;)d.push(mt(e,c)),c=VS(c,h);return i?d.reverse():d}function HA(r,t){const e=je(r,t==null?void 0:t.in);return e.setDate(1),e.setHours(0,0,0,0),e}function WA(r,t){const e=je(r,t==null?void 0:t.in),n=e.getFullYear();return e.setFullYear(n+1,0,0),e.setHours(23,59,59,999),e}function eO(r,t){const e=je(r,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}function zA(r,t){var h,d,g,p,a,u,f,y;const e=Ti(),n=(y=(f=(p=(g=t==null?void 0:t.weekStartsOn)!=null?g:(d=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:d.weekStartsOn)!=null?p:e.weekStartsOn)!=null?f:(u=(a=e.locale)==null?void 0:a.options)==null?void 0:u.weekStartsOn)!=null?y:0,i=je(r,t==null?void 0:t.in),l=i.getDay(),c=(l{let n;const i=tO[r];return typeof i=="string"?n=i:t===1?n=i.one:n=i.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+n:n+" ago":n};function vu(r){return(t={})=>{const e=t.width?String(t.width):r.defaultWidth;return r.formats[e]||r.formats[r.defaultWidth]}}const rO={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},iO={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},oO={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},aO={date:vu({formats:rO,defaultWidth:"full"}),time:vu({formats:iO,defaultWidth:"full"}),dateTime:vu({formats:oO,defaultWidth:"full"})},sO={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lO=(r,t,e,n)=>sO[r];function Jo(r){return(t,e)=>{const n=e!=null&&e.context?String(e.context):"standalone";let i;if(n==="formatting"&&r.formattingValues){const c=r.defaultFormattingWidth||r.defaultWidth,h=e!=null&&e.width?String(e.width):c;i=r.formattingValues[h]||r.formattingValues[c]}else{const c=r.defaultWidth,h=e!=null&&e.width?String(e.width):r.defaultWidth;i=r.values[h]||r.values[c]}const l=r.argumentCallback?r.argumentCallback(t):t;return i[l]}}const uO={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},cO={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},fO={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},hO={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},dO={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},pO={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},gO=(r,t)=>{const e=Number(r),n=e%100;if(n>20||n<10)switch(n%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},mO={ordinalNumber:gO,era:Jo({values:uO,defaultWidth:"wide"}),quarter:Jo({values:cO,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Jo({values:fO,defaultWidth:"wide"}),day:Jo({values:hO,defaultWidth:"wide"}),dayPeriod:Jo({values:dO,defaultWidth:"wide",formattingValues:pO,defaultFormattingWidth:"wide"})};function ea(r){return(t,e={})=>{const n=e.width,i=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],l=t.match(i);if(!l)return null;const c=l[0],h=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],d=Array.isArray(h)?yO(h,a=>a.test(c)):vO(h,a=>a.test(c));let g;g=r.valueCallback?r.valueCallback(d):d,g=e.valueCallback?e.valueCallback(g):g;const p=t.slice(c.length);return{value:g,rest:p}}}function vO(r,t){for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&t(r[e]))return e}function yO(r,t){for(let e=0;e{const n=t.match(r.matchPattern);if(!n)return null;const i=n[0],l=t.match(r.parsePattern);if(!l)return null;let c=r.valueCallback?r.valueCallback(l[0]):l[0];c=e.valueCallback?e.valueCallback(c):c;const h=t.slice(i.length);return{value:c,rest:h}}}const bO=/^(\d+)(th|st|nd|rd)?/i,wO=/\d+/i,xO={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},TO={any:[/^b/i,/^(a|c)/i]},SO={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},OO={any:[/1/i,/2/i,/3/i,/4/i]},EO={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},AO={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},CO={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},kO={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},PO={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},RO={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},MO={ordinalNumber:_O({matchPattern:bO,parsePattern:wO,valueCallback:r=>parseInt(r,10)}),era:ea({matchPatterns:xO,defaultMatchWidth:"wide",parsePatterns:TO,defaultParseWidth:"any"}),quarter:ea({matchPatterns:SO,defaultMatchWidth:"wide",parsePatterns:OO,defaultParseWidth:"any",valueCallback:r=>r+1}),month:ea({matchPatterns:EO,defaultMatchWidth:"wide",parsePatterns:AO,defaultParseWidth:"any"}),day:ea({matchPatterns:CO,defaultMatchWidth:"wide",parsePatterns:kO,defaultParseWidth:"any"}),dayPeriod:ea({matchPatterns:PO,defaultMatchWidth:"any",parsePatterns:RO,defaultParseWidth:"any"})},gg={code:"en-US",formatDistance:nO,formatLong:aO,formatRelative:lO,localize:mO,match:MO,options:{weekStartsOn:0,firstWeekContainsDate:1}};function DO(r,t){const e=je(r,t==null?void 0:t.in);return GS(e,eO(e))+1}function mg(r,t){const e=je(r,t==null?void 0:t.in),n=+fo(e)-+YS(e);return Math.round(n/hg)+1}function pc(r,t){var p,a,u,f,y,_,b,v;const e=je(r,t==null?void 0:t.in),n=e.getFullYear(),i=Ti(),l=(v=(b=(f=(u=t==null?void 0:t.firstWeekContainsDate)!=null?u:(a=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:a.firstWeekContainsDate)!=null?f:i.firstWeekContainsDate)!=null?b:(_=(y=i.locale)==null?void 0:y.options)==null?void 0:_.firstWeekContainsDate)!=null?v:1,c=mt((t==null?void 0:t.in)||r,0);c.setFullYear(n+1,0,l),c.setHours(0,0,0,0);const h=Hr(c,t),d=mt((t==null?void 0:t.in)||r,0);d.setFullYear(n,0,l),d.setHours(0,0,0,0);const g=Hr(d,t);return+e>=+h?n+1:+e>=+g?n:n-1}function LO(r,t){var h,d,g,p,a,u,f,y;const e=Ti(),n=(y=(f=(p=(g=t==null?void 0:t.firstWeekContainsDate)!=null?g:(d=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:d.firstWeekContainsDate)!=null?p:e.firstWeekContainsDate)!=null?f:(u=(a=e.locale)==null?void 0:a.options)==null?void 0:u.firstWeekContainsDate)!=null?y:1,i=pc(r,t),l=mt((t==null?void 0:t.in)||r,0);return l.setFullYear(i,0,n),l.setHours(0,0,0,0),Hr(l,t)}function vg(r,t){const e=je(r,t==null?void 0:t.in),n=+Hr(e,t)-+LO(e,t);return Math.round(n/hg)+1}function gt(r,t){const e=r<0?"-":"",n=Math.abs(r).toString().padStart(t,"0");return e+n}const Nr={y(r,t){const e=r.getFullYear(),n=e>0?e:1-e;return gt(t==="yy"?n%100:n,t.length)},M(r,t){const e=r.getMonth();return t==="M"?String(e+1):gt(e+1,2)},d(r,t){return gt(r.getDate(),t.length)},a(r,t){const e=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(r,t){return gt(r.getHours()%12||12,t.length)},H(r,t){return gt(r.getHours(),t.length)},m(r,t){return gt(r.getMinutes(),t.length)},s(r,t){return gt(r.getSeconds(),t.length)},S(r,t){const e=t.length,n=r.getMilliseconds(),i=Math.trunc(n*Math.pow(10,e-3));return gt(i,t.length)}},to={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},sd={G:function(r,t,e){const n=r.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(n,{width:"abbreviated"});case"GGGGG":return e.era(n,{width:"narrow"});case"GGGG":default:return e.era(n,{width:"wide"})}},y:function(r,t,e){if(t==="yo"){const n=r.getFullYear(),i=n>0?n:1-n;return e.ordinalNumber(i,{unit:"year"})}return Nr.y(r,t)},Y:function(r,t,e,n){const i=pc(r,n),l=i>0?i:1-i;if(t==="YY"){const c=l%100;return gt(c,2)}return t==="Yo"?e.ordinalNumber(l,{unit:"year"}):gt(l,t.length)},R:function(r,t){const e=dg(r);return gt(e,t.length)},u:function(r,t){const e=r.getFullYear();return gt(e,t.length)},Q:function(r,t,e){const n=Math.ceil((r.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return gt(n,2);case"Qo":return e.ordinalNumber(n,{unit:"quarter"});case"QQQ":return e.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,t,e){const n=Math.ceil((r.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return gt(n,2);case"qo":return e.ordinalNumber(n,{unit:"quarter"});case"qqq":return e.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,t,e){const n=r.getMonth();switch(t){case"M":case"MM":return Nr.M(r,t);case"Mo":return e.ordinalNumber(n+1,{unit:"month"});case"MMM":return e.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(n,{width:"wide",context:"formatting"})}},L:function(r,t,e){const n=r.getMonth();switch(t){case"L":return String(n+1);case"LL":return gt(n+1,2);case"Lo":return e.ordinalNumber(n+1,{unit:"month"});case"LLL":return e.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(n,{width:"wide",context:"standalone"})}},w:function(r,t,e,n){const i=vg(r,n);return t==="wo"?e.ordinalNumber(i,{unit:"week"}):gt(i,t.length)},I:function(r,t,e){const n=mg(r);return t==="Io"?e.ordinalNumber(n,{unit:"week"}):gt(n,t.length)},d:function(r,t,e){return t==="do"?e.ordinalNumber(r.getDate(),{unit:"date"}):Nr.d(r,t)},D:function(r,t,e){const n=DO(r);return t==="Do"?e.ordinalNumber(n,{unit:"dayOfYear"}):gt(n,t.length)},E:function(r,t,e){const n=r.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(n,{width:"short",context:"formatting"});case"EEEE":default:return e.day(n,{width:"wide",context:"formatting"})}},e:function(r,t,e,n){const i=r.getDay(),l=(i-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(l);case"ee":return gt(l,2);case"eo":return e.ordinalNumber(l,{unit:"day"});case"eee":return e.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(i,{width:"short",context:"formatting"});case"eeee":default:return e.day(i,{width:"wide",context:"formatting"})}},c:function(r,t,e,n){const i=r.getDay(),l=(i-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(l);case"cc":return gt(l,t.length);case"co":return e.ordinalNumber(l,{unit:"day"});case"ccc":return e.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(i,{width:"narrow",context:"standalone"});case"cccccc":return e.day(i,{width:"short",context:"standalone"});case"cccc":default:return e.day(i,{width:"wide",context:"standalone"})}},i:function(r,t,e){const n=r.getDay(),i=n===0?7:n;switch(t){case"i":return String(i);case"ii":return gt(i,t.length);case"io":return e.ordinalNumber(i,{unit:"day"});case"iii":return e.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(n,{width:"short",context:"formatting"});case"iiii":default:return e.day(n,{width:"wide",context:"formatting"})}},a:function(r,t,e){const i=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,t,e){const n=r.getHours();let i;switch(n===12?i=to.noon:n===0?i=to.midnight:i=n/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,t,e){const n=r.getHours();let i;switch(n>=17?i=to.evening:n>=12?i=to.afternoon:n>=4?i=to.morning:i=to.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,t,e){if(t==="ho"){let n=r.getHours()%12;return n===0&&(n=12),e.ordinalNumber(n,{unit:"hour"})}return Nr.h(r,t)},H:function(r,t,e){return t==="Ho"?e.ordinalNumber(r.getHours(),{unit:"hour"}):Nr.H(r,t)},K:function(r,t,e){const n=r.getHours()%12;return t==="Ko"?e.ordinalNumber(n,{unit:"hour"}):gt(n,t.length)},k:function(r,t,e){let n=r.getHours();return n===0&&(n=24),t==="ko"?e.ordinalNumber(n,{unit:"hour"}):gt(n,t.length)},m:function(r,t,e){return t==="mo"?e.ordinalNumber(r.getMinutes(),{unit:"minute"}):Nr.m(r,t)},s:function(r,t,e){return t==="so"?e.ordinalNumber(r.getSeconds(),{unit:"second"}):Nr.s(r,t)},S:function(r,t){return Nr.S(r,t)},X:function(r,t,e){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return ud(n);case"XXXX":case"XX":return di(n);case"XXXXX":case"XXX":default:return di(n,":")}},x:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"x":return ud(n);case"xxxx":case"xx":return di(n);case"xxxxx":case"xxx":default:return di(n,":")}},O:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ld(n,":");case"OOOO":default:return"GMT"+di(n,":")}},z:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ld(n,":");case"zzzz":default:return"GMT"+di(n,":")}},t:function(r,t,e){const n=Math.trunc(+r/1e3);return gt(n,t.length)},T:function(r,t,e){return gt(+r,t.length)}};function ld(r,t=""){const e=r>0?"-":"+",n=Math.abs(r),i=Math.trunc(n/60),l=n%60;return l===0?e+String(i):e+String(i)+t+gt(l,2)}function ud(r,t){return r%60===0?(r>0?"-":"+")+gt(Math.abs(r)/60,2):di(r,t)}function di(r,t=""){const e=r>0?"-":"+",n=Math.abs(r),i=gt(Math.trunc(n/60),2),l=gt(n%60,2);return e+i+t+l}const cd=(r,t)=>{switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},yg=(r,t)=>{switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},IO=(r,t)=>{const e=r.match(/(P+)(p+)?/)||[],n=e[1],i=e[2];if(!i)return cd(r,t);let l;switch(n){case"P":l=t.dateTime({width:"short"});break;case"PP":l=t.dateTime({width:"medium"});break;case"PPP":l=t.dateTime({width:"long"});break;case"PPPP":default:l=t.dateTime({width:"full"});break}return l.replace("{{date}}",cd(n,t)).replace("{{time}}",yg(i,t))},Uu={p:yg,P:IO},NO=/^D+$/,BO=/^Y+$/,FO=["D","DD","YY","YYYY"];function _g(r){return NO.test(r)}function bg(r){return BO.test(r)}function Hu(r,t,e){const n=qO(r,t,e);if(console.warn(n),FO.includes(r))throw new RangeError(n)}function qO(r,t,e){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${t}\`) for formatting ${n} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const jO=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$O=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,UO=/^'([^]*?)'?$/,HO=/''/g,WO=/[a-zA-Z]/;function YA(r,t,e){var p,a,u,f,y,_,b,v,w,T,x,S,C,A,R,L,M,k;const n=Ti(),i=(a=(p=e==null?void 0:e.locale)!=null?p:n.locale)!=null?a:gg,l=(T=(w=(_=(y=e==null?void 0:e.firstWeekContainsDate)!=null?y:(f=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)!=null?_:n.firstWeekContainsDate)!=null?w:(v=(b=n.locale)==null?void 0:b.options)==null?void 0:v.firstWeekContainsDate)!=null?T:1,c=(k=(M=(A=(C=e==null?void 0:e.weekStartsOn)!=null?C:(S=(x=e==null?void 0:e.locale)==null?void 0:x.options)==null?void 0:S.weekStartsOn)!=null?A:n.weekStartsOn)!=null?M:(L=(R=n.locale)==null?void 0:R.options)==null?void 0:L.weekStartsOn)!=null?k:0,h=je(r,e==null?void 0:e.in);if(!ZS(h))throw new RangeError("Invalid time value");let d=t.match($O).map(P=>{const I=P[0];if(I==="p"||I==="P"){const j=Uu[I];return j(P,i.formatLong)}return P}).join("").match(jO).map(P=>{if(P==="''")return{isToken:!1,value:"'"};const I=P[0];if(I==="'")return{isToken:!1,value:zO(P)};if(sd[I])return{isToken:!0,value:P};if(I.match(WO))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return{isToken:!1,value:P}});i.localize.preprocessor&&(d=i.localize.preprocessor(h,d));const g={firstWeekContainsDate:l,weekStartsOn:c,locale:i};return d.map(P=>{if(!P.isToken)return P.value;const I=P.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&bg(I)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&_g(I))&&Hu(I,t,String(r));const j=sd[I[0]];return j(h,I,i.localize,g)}).join("")}function zO(r){const t=r.match(UO);return t?t[1].replace(HO,"'"):r}function VA(r,t){return je(r,t==null?void 0:t.in).getDay()}function GO(r,t){const e=je(r,t==null?void 0:t.in),n=e.getFullYear(),i=e.getMonth(),l=mt(e,0);return l.setFullYear(n,i+1,0),l.setHours(0,0,0,0),l.getDate()}function YO(){return Object.assign({},Ti())}function KA(r,t){return je(r,t==null?void 0:t.in).getHours()}function VO(r,t){const e=je(r,t==null?void 0:t.in).getDay();return e===0?7:e}function XA(r,t){return je(r,t==null?void 0:t.in).getMinutes()}function ZA(r,t){return je(r,t==null?void 0:t.in).getMonth()}function QA(r){return je(r).getSeconds()}function JA(r,t){return je(r,t==null?void 0:t.in).getFullYear()}function eC(r,t){return+je(r)>+je(t)}function tC(r,t){return+je(r)<+je(t)}function nC(r,t){return+je(r)==+je(t)}function KO(r,t){const e=XO(t)?new t(0):mt(t,0);return e.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),e.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),e}function XO(r){var t;return typeof r=="function"&&((t=r.prototype)==null?void 0:t.constructor)===r}const ZO=10;class wg{constructor(){Se(this,"subPriority",0)}validate(t,e){return!0}}class QO extends wg{constructor(t,e,n,i,l){super(),this.value=t,this.validateValue=e,this.setValue=n,this.priority=i,l&&(this.subPriority=l)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,n){return this.setValue(t,e,this.value,n)}}class JO extends wg{constructor(e,n){super();Se(this,"priority",ZO);Se(this,"subPriority",-1);this.context=e||(i=>mt(n,i))}set(e,n){return n.timestampIsSet?e:mt(e,KO(e,this.context))}}class ut{run(t,e,n,i){const l=this.parse(t,e,n,i);return l?{setter:new QO(l.value,this.validate,this.set,this.priority,this.subPriority),rest:l.rest}:null}validate(t,e,n){return!0}}class eE extends ut{constructor(){super(...arguments);Se(this,"priority",140);Se(this,"incompatibleTokens",["R","u","t","T"])}parse(e,n,i){switch(n){case"G":case"GG":case"GGG":return i.era(e,{width:"abbreviated"})||i.era(e,{width:"narrow"});case"GGGGG":return i.era(e,{width:"narrow"});case"GGGG":default:return i.era(e,{width:"wide"})||i.era(e,{width:"abbreviated"})||i.era(e,{width:"narrow"})}}set(e,n,i){return n.era=i,e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}}const Mt={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Xn={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Dt(r,t){return r&&{value:t(r.value),rest:r.rest}}function At(r,t){const e=t.match(r);return e?{value:parseInt(e[0],10),rest:t.slice(e[0].length)}:null}function Zn(r,t){const e=t.match(r);if(!e)return null;if(e[0]==="Z")return{value:0,rest:t.slice(1)};const n=e[1]==="+"?1:-1,i=e[2]?parseInt(e[2],10):0,l=e[3]?parseInt(e[3],10):0,c=e[5]?parseInt(e[5],10):0;return{value:n*(i*HS+l*US+c*WS),rest:t.slice(e[0].length)}}function xg(r){return At(Mt.anyDigitsSigned,r)}function kt(r,t){switch(r){case 1:return At(Mt.singleDigit,t);case 2:return At(Mt.twoDigits,t);case 3:return At(Mt.threeDigits,t);case 4:return At(Mt.fourDigits,t);default:return At(new RegExp("^\\d{1,"+r+"}"),t)}}function Fs(r,t){switch(r){case 1:return At(Mt.singleDigitSigned,t);case 2:return At(Mt.twoDigitsSigned,t);case 3:return At(Mt.threeDigitsSigned,t);case 4:return At(Mt.fourDigitsSigned,t);default:return At(new RegExp("^-?\\d{1,"+r+"}"),t)}}function gc(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function Tg(r,t){const e=t>0,n=e?t:1-t;let i;if(n<=50)i=r||100;else{const l=n+50,c=Math.trunc(l/100)*100,h=r>=l%100;i=r+c-(h?100:0)}return e?i:1-i}function Sg(r){return r%400===0||r%4===0&&r%100!==0}class tE extends ut{constructor(){super(...arguments);Se(this,"priority",130);Se(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(e,n,i){const l=c=>({year:c,isTwoDigitYear:n==="yy"});switch(n){case"y":return Dt(kt(4,e),l);case"yo":return Dt(i.ordinalNumber(e,{unit:"year"}),l);default:return Dt(kt(n.length,e),l)}}validate(e,n){return n.isTwoDigitYear||n.year>0}set(e,n,i){const l=e.getFullYear();if(i.isTwoDigitYear){const h=Tg(i.year,l);return e.setFullYear(h,0,1),e.setHours(0,0,0,0),e}const c=!("era"in n)||n.era===1?i.year:1-i.year;return e.setFullYear(c,0,1),e.setHours(0,0,0,0),e}}class nE extends ut{constructor(){super(...arguments);Se(this,"priority",130);Se(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(e,n,i){const l=c=>({year:c,isTwoDigitYear:n==="YY"});switch(n){case"Y":return Dt(kt(4,e),l);case"Yo":return Dt(i.ordinalNumber(e,{unit:"year"}),l);default:return Dt(kt(n.length,e),l)}}validate(e,n){return n.isTwoDigitYear||n.year>0}set(e,n,i,l){const c=pc(e,l);if(i.isTwoDigitYear){const d=Tg(i.year,c);return e.setFullYear(d,0,l.firstWeekContainsDate),e.setHours(0,0,0,0),Hr(e,l)}const h=!("era"in n)||n.era===1?i.year:1-i.year;return e.setFullYear(h,0,l.firstWeekContainsDate),e.setHours(0,0,0,0),Hr(e,l)}}class rE extends ut{constructor(){super(...arguments);Se(this,"priority",130);Se(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(e,n){return Fs(n==="R"?4:n.length,e)}set(e,n,i){const l=mt(e,0);return l.setFullYear(i,0,4),l.setHours(0,0,0,0),fo(l)}}class iE extends ut{constructor(){super(...arguments);Se(this,"priority",130);Se(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(e,n){return Fs(n==="u"?4:n.length,e)}set(e,n,i){return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}}class oE extends ut{constructor(){super(...arguments);Se(this,"priority",120);Se(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,n,i){switch(n){case"Q":case"QQ":return kt(n.length,e);case"Qo":return i.ordinalNumber(e,{unit:"quarter"});case"QQQ":return i.quarter(e,{width:"abbreviated",context:"formatting"})||i.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(e,{width:"wide",context:"formatting"})||i.quarter(e,{width:"abbreviated",context:"formatting"})||i.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,n){return n>=1&&n<=4}set(e,n,i){return e.setMonth((i-1)*3,1),e.setHours(0,0,0,0),e}}class aE extends ut{constructor(){super(...arguments);Se(this,"priority",120);Se(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,n,i){switch(n){case"q":case"qq":return kt(n.length,e);case"qo":return i.ordinalNumber(e,{unit:"quarter"});case"qqq":return i.quarter(e,{width:"abbreviated",context:"standalone"})||i.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(e,{width:"wide",context:"standalone"})||i.quarter(e,{width:"abbreviated",context:"standalone"})||i.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,n){return n>=1&&n<=4}set(e,n,i){return e.setMonth((i-1)*3,1),e.setHours(0,0,0,0),e}}class sE extends ut{constructor(){super(...arguments);Se(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Se(this,"priority",110)}parse(e,n,i){const l=c=>c-1;switch(n){case"M":return Dt(At(Mt.month,e),l);case"MM":return Dt(kt(2,e),l);case"Mo":return Dt(i.ordinalNumber(e,{unit:"month"}),l);case"MMM":return i.month(e,{width:"abbreviated",context:"formatting"})||i.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(e,{width:"wide",context:"formatting"})||i.month(e,{width:"abbreviated",context:"formatting"})||i.month(e,{width:"narrow",context:"formatting"})}}validate(e,n){return n>=0&&n<=11}set(e,n,i){return e.setMonth(i,1),e.setHours(0,0,0,0),e}}class lE extends ut{constructor(){super(...arguments);Se(this,"priority",110);Se(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(e,n,i){const l=c=>c-1;switch(n){case"L":return Dt(At(Mt.month,e),l);case"LL":return Dt(kt(2,e),l);case"Lo":return Dt(i.ordinalNumber(e,{unit:"month"}),l);case"LLL":return i.month(e,{width:"abbreviated",context:"standalone"})||i.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(e,{width:"wide",context:"standalone"})||i.month(e,{width:"abbreviated",context:"standalone"})||i.month(e,{width:"narrow",context:"standalone"})}}validate(e,n){return n>=0&&n<=11}set(e,n,i){return e.setMonth(i,1),e.setHours(0,0,0,0),e}}function uE(r,t,e){const n=je(r,e==null?void 0:e.in),i=vg(n,e)-t;return n.setDate(n.getDate()-i*7),je(n,e==null?void 0:e.in)}class cE extends ut{constructor(){super(...arguments);Se(this,"priority",100);Se(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(e,n,i){switch(n){case"w":return At(Mt.week,e);case"wo":return i.ordinalNumber(e,{unit:"week"});default:return kt(n.length,e)}}validate(e,n){return n>=1&&n<=53}set(e,n,i,l){return Hr(uE(e,i,l),l)}}function fE(r,t,e){const n=je(r,e==null?void 0:e.in),i=mg(n,e)-t;return n.setDate(n.getDate()-i*7),n}class hE extends ut{constructor(){super(...arguments);Se(this,"priority",100);Se(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(e,n,i){switch(n){case"I":return At(Mt.week,e);case"Io":return i.ordinalNumber(e,{unit:"week"});default:return kt(n.length,e)}}validate(e,n){return n>=1&&n<=53}set(e,n,i){return fo(fE(e,i))}}const dE=[31,28,31,30,31,30,31,31,30,31,30,31],pE=[31,29,31,30,31,30,31,31,30,31,30,31];class gE extends ut{constructor(){super(...arguments);Se(this,"priority",90);Se(this,"subPriority",1);Se(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(e,n,i){switch(n){case"d":return At(Mt.date,e);case"do":return i.ordinalNumber(e,{unit:"date"});default:return kt(n.length,e)}}validate(e,n){const i=e.getFullYear(),l=Sg(i),c=e.getMonth();return l?n>=1&&n<=pE[c]:n>=1&&n<=dE[c]}set(e,n,i){return e.setDate(i),e.setHours(0,0,0,0),e}}class mE extends ut{constructor(){super(...arguments);Se(this,"priority",90);Se(this,"subpriority",1);Se(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(e,n,i){switch(n){case"D":case"DD":return At(Mt.dayOfYear,e);case"Do":return i.ordinalNumber(e,{unit:"date"});default:return kt(n.length,e)}}validate(e,n){const i=e.getFullYear();return Sg(i)?n>=1&&n<=366:n>=1&&n<=365}set(e,n,i){return e.setMonth(0,i),e.setHours(0,0,0,0),e}}function mc(r,t,e){var a,u,f,y,_,b,v,w;const n=Ti(),i=(w=(v=(y=(f=e==null?void 0:e.weekStartsOn)!=null?f:(u=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:u.weekStartsOn)!=null?y:n.weekStartsOn)!=null?v:(b=(_=n.locale)==null?void 0:_.options)==null?void 0:b.weekStartsOn)!=null?w:0,l=je(r,e==null?void 0:e.in),c=l.getDay(),d=(t%7+7)%7,g=7-i,p=t<0||t>6?t-(c+g)%7:(d+g)%7-(c+g)%7;return el(l,p,e)}class vE extends ut{constructor(){super(...arguments);Se(this,"priority",90);Se(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(e,n,i){switch(n){case"E":case"EE":case"EEE":return i.day(e,{width:"abbreviated",context:"formatting"})||i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(e,{width:"wide",context:"formatting"})||i.day(e,{width:"abbreviated",context:"formatting"})||i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"})}}validate(e,n){return n>=0&&n<=6}set(e,n,i,l){return e=mc(e,i,l),e.setHours(0,0,0,0),e}}class yE extends ut{constructor(){super(...arguments);Se(this,"priority",90);Se(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(e,n,i,l){const c=h=>{const d=Math.floor((h-1)/7)*7;return(h+l.weekStartsOn+6)%7+d};switch(n){case"e":case"ee":return Dt(kt(n.length,e),c);case"eo":return Dt(i.ordinalNumber(e,{unit:"day"}),c);case"eee":return i.day(e,{width:"abbreviated",context:"formatting"})||i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"});case"eeeee":return i.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(e,{width:"wide",context:"formatting"})||i.day(e,{width:"abbreviated",context:"formatting"})||i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"})}}validate(e,n){return n>=0&&n<=6}set(e,n,i,l){return e=mc(e,i,l),e.setHours(0,0,0,0),e}}class _E extends ut{constructor(){super(...arguments);Se(this,"priority",90);Se(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(e,n,i,l){const c=h=>{const d=Math.floor((h-1)/7)*7;return(h+l.weekStartsOn+6)%7+d};switch(n){case"c":case"cc":return Dt(kt(n.length,e),c);case"co":return Dt(i.ordinalNumber(e,{unit:"day"}),c);case"ccc":return i.day(e,{width:"abbreviated",context:"standalone"})||i.day(e,{width:"short",context:"standalone"})||i.day(e,{width:"narrow",context:"standalone"});case"ccccc":return i.day(e,{width:"narrow",context:"standalone"});case"cccccc":return i.day(e,{width:"short",context:"standalone"})||i.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(e,{width:"wide",context:"standalone"})||i.day(e,{width:"abbreviated",context:"standalone"})||i.day(e,{width:"short",context:"standalone"})||i.day(e,{width:"narrow",context:"standalone"})}}validate(e,n){return n>=0&&n<=6}set(e,n,i,l){return e=mc(e,i,l),e.setHours(0,0,0,0),e}}function bE(r,t,e){const n=je(r,e==null?void 0:e.in),i=VO(n,e),l=t-i;return el(n,l,e)}class wE extends ut{constructor(){super(...arguments);Se(this,"priority",90);Se(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(e,n,i){const l=c=>c===0?7:c;switch(n){case"i":case"ii":return kt(n.length,e);case"io":return i.ordinalNumber(e,{unit:"day"});case"iii":return Dt(i.day(e,{width:"abbreviated",context:"formatting"})||i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"}),l);case"iiiii":return Dt(i.day(e,{width:"narrow",context:"formatting"}),l);case"iiiiii":return Dt(i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"}),l);case"iiii":default:return Dt(i.day(e,{width:"wide",context:"formatting"})||i.day(e,{width:"abbreviated",context:"formatting"})||i.day(e,{width:"short",context:"formatting"})||i.day(e,{width:"narrow",context:"formatting"}),l)}}validate(e,n){return n>=1&&n<=7}set(e,n,i){return e=bE(e,i),e.setHours(0,0,0,0),e}}class xE extends ut{constructor(){super(...arguments);Se(this,"priority",80);Se(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(e,n,i){switch(n){case"a":case"aa":case"aaa":return i.dayPeriod(e,{width:"abbreviated",context:"formatting"})||i.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(e,{width:"wide",context:"formatting"})||i.dayPeriod(e,{width:"abbreviated",context:"formatting"})||i.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,n,i){return e.setHours(gc(i),0,0,0),e}}class TE extends ut{constructor(){super(...arguments);Se(this,"priority",80);Se(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(e,n,i){switch(n){case"b":case"bb":case"bbb":return i.dayPeriod(e,{width:"abbreviated",context:"formatting"})||i.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(e,{width:"wide",context:"formatting"})||i.dayPeriod(e,{width:"abbreviated",context:"formatting"})||i.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,n,i){return e.setHours(gc(i),0,0,0),e}}class SE extends ut{constructor(){super(...arguments);Se(this,"priority",80);Se(this,"incompatibleTokens",["a","b","t","T"])}parse(e,n,i){switch(n){case"B":case"BB":case"BBB":return i.dayPeriod(e,{width:"abbreviated",context:"formatting"})||i.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(e,{width:"wide",context:"formatting"})||i.dayPeriod(e,{width:"abbreviated",context:"formatting"})||i.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,n,i){return e.setHours(gc(i),0,0,0),e}}class OE extends ut{constructor(){super(...arguments);Se(this,"priority",70);Se(this,"incompatibleTokens",["H","K","k","t","T"])}parse(e,n,i){switch(n){case"h":return At(Mt.hour12h,e);case"ho":return i.ordinalNumber(e,{unit:"hour"});default:return kt(n.length,e)}}validate(e,n){return n>=1&&n<=12}set(e,n,i){const l=e.getHours()>=12;return l&&i<12?e.setHours(i+12,0,0,0):!l&&i===12?e.setHours(0,0,0,0):e.setHours(i,0,0,0),e}}class EE extends ut{constructor(){super(...arguments);Se(this,"priority",70);Se(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(e,n,i){switch(n){case"H":return At(Mt.hour23h,e);case"Ho":return i.ordinalNumber(e,{unit:"hour"});default:return kt(n.length,e)}}validate(e,n){return n>=0&&n<=23}set(e,n,i){return e.setHours(i,0,0,0),e}}class AE extends ut{constructor(){super(...arguments);Se(this,"priority",70);Se(this,"incompatibleTokens",["h","H","k","t","T"])}parse(e,n,i){switch(n){case"K":return At(Mt.hour11h,e);case"Ko":return i.ordinalNumber(e,{unit:"hour"});default:return kt(n.length,e)}}validate(e,n){return n>=0&&n<=11}set(e,n,i){return e.getHours()>=12&&i<12?e.setHours(i+12,0,0,0):e.setHours(i,0,0,0),e}}class CE extends ut{constructor(){super(...arguments);Se(this,"priority",70);Se(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(e,n,i){switch(n){case"k":return At(Mt.hour24h,e);case"ko":return i.ordinalNumber(e,{unit:"hour"});default:return kt(n.length,e)}}validate(e,n){return n>=1&&n<=24}set(e,n,i){const l=i<=24?i%24:i;return e.setHours(l,0,0,0),e}}class kE extends ut{constructor(){super(...arguments);Se(this,"priority",60);Se(this,"incompatibleTokens",["t","T"])}parse(e,n,i){switch(n){case"m":return At(Mt.minute,e);case"mo":return i.ordinalNumber(e,{unit:"minute"});default:return kt(n.length,e)}}validate(e,n){return n>=0&&n<=59}set(e,n,i){return e.setMinutes(i,0,0),e}}class PE extends ut{constructor(){super(...arguments);Se(this,"priority",50);Se(this,"incompatibleTokens",["t","T"])}parse(e,n,i){switch(n){case"s":return At(Mt.second,e);case"so":return i.ordinalNumber(e,{unit:"second"});default:return kt(n.length,e)}}validate(e,n){return n>=0&&n<=59}set(e,n,i){return e.setSeconds(i,0),e}}class RE extends ut{constructor(){super(...arguments);Se(this,"priority",30);Se(this,"incompatibleTokens",["t","T"])}parse(e,n){const i=l=>Math.trunc(l*Math.pow(10,-n.length+3));return Dt(kt(n.length,e),i)}set(e,n,i){return e.setMilliseconds(i),e}}class ME extends ut{constructor(){super(...arguments);Se(this,"priority",10);Se(this,"incompatibleTokens",["t","T","x"])}parse(e,n){switch(n){case"X":return Zn(Xn.basicOptionalMinutes,e);case"XX":return Zn(Xn.basic,e);case"XXXX":return Zn(Xn.basicOptionalSeconds,e);case"XXXXX":return Zn(Xn.extendedOptionalSeconds,e);case"XXX":default:return Zn(Xn.extended,e)}}set(e,n,i){return n.timestampIsSet?e:mt(e,e.getTime()-Bs(e)-i)}}class DE extends ut{constructor(){super(...arguments);Se(this,"priority",10);Se(this,"incompatibleTokens",["t","T","X"])}parse(e,n){switch(n){case"x":return Zn(Xn.basicOptionalMinutes,e);case"xx":return Zn(Xn.basic,e);case"xxxx":return Zn(Xn.basicOptionalSeconds,e);case"xxxxx":return Zn(Xn.extendedOptionalSeconds,e);case"xxx":default:return Zn(Xn.extended,e)}}set(e,n,i){return n.timestampIsSet?e:mt(e,e.getTime()-Bs(e)-i)}}class LE extends ut{constructor(){super(...arguments);Se(this,"priority",40);Se(this,"incompatibleTokens","*")}parse(e){return xg(e)}set(e,n,i){return[mt(e,i*1e3),{timestampIsSet:!0}]}}class IE extends ut{constructor(){super(...arguments);Se(this,"priority",20);Se(this,"incompatibleTokens","*")}parse(e){return xg(e)}set(e,n,i){return[mt(e,i),{timestampIsSet:!0}]}}const NE={G:new eE,y:new tE,Y:new nE,R:new rE,u:new iE,Q:new oE,q:new aE,M:new sE,L:new lE,w:new cE,I:new hE,d:new gE,D:new mE,E:new vE,e:new yE,c:new _E,i:new wE,a:new xE,b:new TE,B:new SE,h:new OE,H:new EE,K:new AE,k:new CE,m:new kE,s:new PE,S:new RE,X:new ME,x:new DE,t:new LE,T:new IE},BE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,FE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,qE=/^'([^]*?)'?$/,jE=/''/g,$E=/\S/,UE=/[a-zA-Z]/;function rC(r,t,e,n){var b,v,w,T,x,S,C,A,R,L,M,k,P,I,j,W,J,ee;const i=()=>mt((n==null?void 0:n.in)||e,NaN),l=YO(),c=(v=(b=n==null?void 0:n.locale)!=null?b:l.locale)!=null?v:gg,h=(L=(R=(S=(x=n==null?void 0:n.firstWeekContainsDate)!=null?x:(T=(w=n==null?void 0:n.locale)==null?void 0:w.options)==null?void 0:T.firstWeekContainsDate)!=null?S:l.firstWeekContainsDate)!=null?R:(A=(C=l.locale)==null?void 0:C.options)==null?void 0:A.firstWeekContainsDate)!=null?L:1,d=(ee=(J=(I=(P=n==null?void 0:n.weekStartsOn)!=null?P:(k=(M=n==null?void 0:n.locale)==null?void 0:M.options)==null?void 0:k.weekStartsOn)!=null?I:l.weekStartsOn)!=null?J:(W=(j=l.locale)==null?void 0:j.options)==null?void 0:W.weekStartsOn)!=null?ee:0;if(!t)return r?i():je(e,n==null?void 0:n.in);const g={firstWeekContainsDate:h,weekStartsOn:d,locale:c},p=[new JO(n==null?void 0:n.in,e)],a=t.match(FE).map(oe=>{const V=oe[0];if(V in Uu){const $=Uu[V];return $(oe,c.formatLong)}return oe}).join("").match(BE),u=[];for(let oe of a){!(n!=null&&n.useAdditionalWeekYearTokens)&&bg(oe)&&Hu(oe,t,r),!(n!=null&&n.useAdditionalDayOfYearTokens)&&_g(oe)&&Hu(oe,t,r);const V=oe[0],$=NE[V];if($){const{incompatibleTokens:N}=$;if(Array.isArray(N)){const G=u.find(ne=>N.includes(ne.token)||ne.token===V);if(G)throw new RangeError(`The format string mustn't contain \`${G.fullToken}\` and \`${oe}\` at the same time`)}else if($.incompatibleTokens==="*"&&u.length>0)throw new RangeError(`The format string mustn't contain \`${oe}\` and any other token at the same time`);u.push({token:V,fullToken:oe});const H=$.run(r,oe,c.match,g);if(!H)return i();p.push(H.setter),r=H.rest}else{if(V.match(UE))throw new RangeError("Format string contains an unescaped latin alphabet character `"+V+"`");if(oe==="''"?oe="'":V==="'"&&(oe=HE(oe)),r.indexOf(oe)===0)r=r.slice(oe.length);else return i()}}if(r.length>0&&$E.test(r))return i();const f=p.map(oe=>oe.priority).sort((oe,V)=>V-oe).filter((oe,V,$)=>$.indexOf(oe)===V).map(oe=>p.filter(V=>V.priority===oe).sort((V,$)=>$.subPriority-V.subPriority)).map(oe=>oe[0]);let y=je(e,n==null?void 0:n.in);if(isNaN(+y))return i();const _={};for(const oe of f){if(!oe.validate(y,g))return i();const V=oe.set(y,_,g);Array.isArray(V)?(y=V[0],Object.assign(_,V[1])):y=V}return y}function HE(r){return r.match(qE)[1].replace(jE,"'")}function iC(r,t,e){const[n,i]=Sa(e==null?void 0:e.in,r,t);return+no(n)==+no(i)}function WE(r,t,e){return el(r,-t,e)}function oC(r,t){var p,a;const e=(p=t==null?void 0:t.nearestTo)!=null?p:1;if(e<1||e>30)return mt(r,NaN);const n=je(r,t==null?void 0:t.in),i=n.getSeconds()/60,l=n.getMilliseconds()/1e3/60,c=n.getMinutes()+i+l,h=(a=t==null?void 0:t.roundingMethod)!=null?a:"round",g=JS(h)(c/e)*e;return n.setMinutes(g,0,0),n}function zE(r,t,e){const n=je(r,e==null?void 0:e.in),i=n.getFullYear(),l=n.getDate(),c=mt(r,0);c.setFullYear(i,t,15),c.setHours(0,0,0,0);const h=GO(c);return n.setMonth(t,Math.min(l,h)),n}function aC(r,t,e){let n=je(r,e==null?void 0:e.in);return isNaN(+n)?mt(r,NaN):(t.year!=null&&n.setFullYear(t.year),t.month!=null&&(n=zE(n,t.month)),t.date!=null&&n.setDate(t.date),t.hours!=null&&n.setHours(t.hours),t.minutes!=null&&n.setMinutes(t.minutes),t.seconds!=null&&n.setSeconds(t.seconds),t.milliseconds!=null&&n.setMilliseconds(t.milliseconds),n)}function sC(r,t,e){const n=je(r,e==null?void 0:e.in);return n.setMilliseconds(t),n}function lC(r,t,e){const n=je(r,e==null?void 0:e.in);return n.setSeconds(t),n}function uC(r,t,e){const n=je(r,e==null?void 0:e.in);return isNaN(+n)?mt(r,NaN):(n.setFullYear(t),n)}function GE(r,t,e){return tl(r,-t,e)}function cC(r,t,e){const{years:n=0,months:i=0,weeks:l=0,days:c=0,hours:h=0,minutes:d=0,seconds:g=0}=t,p=GE(r,i+n*12,e),a=WE(p,c+l*7,e),u=d+h*60,y=(g+u*60)*1e3;return mt(r,+a-y)}function fC(r,t,e){return KS(r,-t,e)}function YE(r,t,e="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:r,timeZoneName:e}).format(t).split(/\s/g).slice(2).join(" ")}const yu={},ra={};function mi(r,t){try{const n=(yu[r]||(yu[r]=new Intl.DateTimeFormat("en-US",{timeZone:r,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return n in ra?ra[n]:fd(n,n.split(":"))}catch(e){if(r in ra)return ra[r];const n=r==null?void 0:r.match(VE);return n?fd(r,n.slice(1)):NaN}}const VE=/([+-]\d\d):?(\d\d)?/;function fd(r,t){const e=+(t[0]||0),n=+(t[1]||0),i=+(t[2]||0)/60;return ra[r]=e*60+n>0?e*60+n+i:e*60-n-i}class Qn extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(mi(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),Og(this),Wu(this)):this.setTime(Date.now())}static tz(t,...e){return e.length?new Qn(...e,t):new Qn(Date.now(),t)}withTimeZone(t){return new Qn(+this,t)}getTimezoneOffset(){const t=-mi(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Wu(this),+this}[Symbol.for("constructDateFrom")](t){return new Qn(+new Date(t),this.timeZone)}}const hd=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(r=>{if(!hd.test(r))return;const t=r.replace(hd,"$1UTC");Qn.prototype[t]&&(r.startsWith("get")?Qn.prototype[r]=function(){return this.internal[t]()}:(Qn.prototype[r]=function(){return Date.prototype[t].apply(this.internal,arguments),KE(this),+this},Qn.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Wu(this),+this}))});function Wu(r){r.internal.setTime(+r),r.internal.setUTCSeconds(r.internal.getUTCSeconds()-Math.round(-mi(r.timeZone,r)*60))}function KE(r){Date.prototype.setFullYear.call(r,r.internal.getUTCFullYear(),r.internal.getUTCMonth(),r.internal.getUTCDate()),Date.prototype.setHours.call(r,r.internal.getUTCHours(),r.internal.getUTCMinutes(),r.internal.getUTCSeconds(),r.internal.getUTCMilliseconds()),Og(r)}function Og(r){const t=mi(r.timeZone,r),e=t>0?Math.floor(t):Math.ceil(t),n=new Date(+r);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+r).getTimezoneOffset(),l=-new Date(+n).getTimezoneOffset(),c=i-l,h=Date.prototype.getHours.apply(r)!==r.internal.getUTCHours();c&&h&&r.internal.setUTCMinutes(r.internal.getUTCMinutes()+c);const d=i-e;d&&Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+d);const g=new Date(+r);g.setUTCSeconds(0);const p=i>0?g.getSeconds():(g.getSeconds()-60)%60,a=Math.round(-(mi(r.timeZone,r)*60))%60;(a||p)&&(r.internal.setUTCSeconds(r.internal.getUTCSeconds()+a),Date.prototype.setUTCSeconds.call(r,Date.prototype.getUTCSeconds.call(r)+a+p));const u=mi(r.timeZone,r),f=u>0?Math.floor(u):Math.ceil(u),_=-new Date(+r).getTimezoneOffset()-f,b=f!==e,v=_-d;if(b&&v){Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+v);const w=mi(r.timeZone,r),T=w>0?Math.floor(w):Math.ceil(w),x=f-T;x&&(r.internal.setUTCMinutes(r.internal.getUTCMinutes()+x),Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+x))}}class ia extends Qn{static tz(t,...e){return e.length?new ia(...e,t):new ia(Date.now(),t)}toISOString(){const[t,e,n]=this.tzComponents(),i=`${t}${e}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,e,n,i]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${n} ${e} ${i}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[e,n,i]=this.tzComponents();return`${t} GMT${e}${n}${i} (${YE(this.timeZone,this)})`}toLocaleString(t,e){return Date.prototype.toLocaleString.call(this,t,Ut(st({},e),{timeZone:(e==null?void 0:e.timeZone)||this.timeZone}))}toLocaleDateString(t,e){return Date.prototype.toLocaleDateString.call(this,t,Ut(st({},e),{timeZone:(e==null?void 0:e.timeZone)||this.timeZone}))}toLocaleTimeString(t,e){return Date.prototype.toLocaleTimeString.call(this,t,Ut(st({},e),{timeZone:(e==null?void 0:e.timeZone)||this.timeZone}))}tzComponents(){const t=this.getTimezoneOffset(),e=t>0?"-":"+",n=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),i=String(Math.abs(t)%60).padStart(2,"0");return[e,n,i]}withTimeZone(t){return new ia(+this,t)}[Symbol.for("constructDateFrom")](t){return new ia(+new Date(t),this.timeZone)}}var XE={exports:{}};/*! * Quill Editor v1.3.7 * https://quilljs.com/ * Copyright (c) 2014, Jason Chen * Copyright (c) 2013, salesforce.com */(function(r,t){(function(n,i){r.exports=i()})(typeof self!="undefined"?self:bt,function(){return function(e){var n={};function i(l){if(n[l])return n[l].exports;var c=n[l]={i:l,l:!1,exports:{}};return e[l].call(c.exports,c,c.exports,i),c.l=!0,c.exports}return i.m=e,i.c=n,i.d=function(l,c,h){i.o(l,c)||Object.defineProperty(l,c,{configurable:!1,enumerable:!0,get:h})},i.n=function(l){var c=l&&l.__esModule?function(){return l.default}:function(){return l};return i.d(c,"a",c),c},i.o=function(l,c){return Object.prototype.hasOwnProperty.call(l,c)},i.p="",i(i.s=109)}([function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=i(17),c=i(18),h=i(19),d=i(45),g=i(46),p=i(47),a=i(48),u=i(49),f=i(12),y=i(32),_=i(33),b=i(31),v=i(1),w={Scope:v.Scope,create:v.create,find:v.find,query:v.query,register:v.register,Container:l.default,Format:c.default,Leaf:h.default,Embed:a.default,Scroll:d.default,Block:p.default,Inline:g.default,Text:u.default,Attributor:{Attribute:f.default,Class:y.default,Style:_.default,Store:b.default}};n.default=w},function(e,n,i){var l=this&&this.__extends||function(){var b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,w){v.__proto__=w}||function(v,w){for(var T in w)w.hasOwnProperty(T)&&(v[T]=w[T])};return function(v,w){b(v,w);function T(){this.constructor=v}v.prototype=w===null?Object.create(w):(T.prototype=w.prototype,new T)}}();Object.defineProperty(n,"__esModule",{value:!0});var c=function(b){l(v,b);function v(w){var T=this;return w="[Parchment] "+w,T=b.call(this,w)||this,T.message=w,T.name=T.constructor.name,T}return v}(Error);n.ParchmentError=c;var h={},d={},g={},p={};n.DATA_KEY="__blot";var a;(function(b){b[b.TYPE=3]="TYPE",b[b.LEVEL=12]="LEVEL",b[b.ATTRIBUTE=13]="ATTRIBUTE",b[b.BLOT=14]="BLOT",b[b.INLINE=7]="INLINE",b[b.BLOCK=11]="BLOCK",b[b.BLOCK_BLOT=10]="BLOCK_BLOT",b[b.INLINE_BLOT=6]="INLINE_BLOT",b[b.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",b[b.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",b[b.ANY=15]="ANY"})(a=n.Scope||(n.Scope={}));function u(b,v){var w=y(b);if(w==null)throw new c("Unable to create "+b+" blot");var T=w,x=b instanceof Node||b.nodeType===Node.TEXT_NODE?b:T.create(v);return new T(x,v)}n.create=u;function f(b,v){return v===void 0&&(v=!1),b==null?null:b[n.DATA_KEY]!=null?b[n.DATA_KEY].blot:v?f(b.parentNode,v):null}n.find=f;function y(b,v){v===void 0&&(v=a.ANY);var w;if(typeof b=="string")w=p[b]||h[b];else if(b instanceof Text||b.nodeType===Node.TEXT_NODE)w=p.text;else if(typeof b=="number")b&a.LEVEL&a.BLOCK?w=p.block:b&a.LEVEL&a.INLINE&&(w=p.inline);else if(b instanceof HTMLElement){var T=(b.getAttribute("class")||"").split(/\s+/);for(var x in T)if(w=d[T[x]],w)break;w=w||g[b.tagName]}return w==null?null:v&a.LEVEL&w.scope&&v&a.TYPE&w.scope?w:null}n.query=y;function _(){for(var b=[],v=0;v1)return b.map(function(x){return _(x)});var w=b[0];if(typeof w.blotName!="string"&&typeof w.attrName!="string")throw new c("Invalid definition");if(w.blotName==="abstract")throw new c("Cannot register abstract class");if(p[w.blotName||w.attrName]=w,typeof w.keyName=="string")h[w.keyName]=w;else if(w.className!=null&&(d[w.className]=w),w.tagName!=null){Array.isArray(w.tagName)?w.tagName=w.tagName.map(function(x){return x.toUpperCase()}):w.tagName=w.tagName.toUpperCase();var T=Array.isArray(w.tagName)?w.tagName:[w.tagName];T.forEach(function(x){(g[x]==null||w.className==null)&&(g[x]=w)})}return w}n.register=_},function(e,n,i){var l=i(51),c=i(11),h=i(3),d=i(20),g="\0",p=function(a){Array.isArray(a)?this.ops=a:a!=null&&Array.isArray(a.ops)?this.ops=a.ops:this.ops=[]};p.prototype.insert=function(a,u){var f={};return a.length===0?this:(f.insert=a,u!=null&&typeof u=="object"&&Object.keys(u).length>0&&(f.attributes=u),this.push(f))},p.prototype.delete=function(a){return a<=0?this:this.push({delete:a})},p.prototype.retain=function(a,u){if(a<=0)return this;var f={retain:a};return u!=null&&typeof u=="object"&&Object.keys(u).length>0&&(f.attributes=u),this.push(f)},p.prototype.push=function(a){var u=this.ops.length,f=this.ops[u-1];if(a=h(!0,{},a),typeof f=="object"){if(typeof a.delete=="number"&&typeof f.delete=="number")return this.ops[u-1]={delete:f.delete+a.delete},this;if(typeof f.delete=="number"&&a.insert!=null&&(u-=1,f=this.ops[u-1],typeof f!="object"))return this.ops.unshift(a),this;if(c(a.attributes,f.attributes)){if(typeof a.insert=="string"&&typeof f.insert=="string")return this.ops[u-1]={insert:f.insert+a.insert},typeof a.attributes=="object"&&(this.ops[u-1].attributes=a.attributes),this;if(typeof a.retain=="number"&&typeof f.retain=="number")return this.ops[u-1]={retain:f.retain+a.retain},typeof a.attributes=="object"&&(this.ops[u-1].attributes=a.attributes),this}}return u===this.ops.length?this.ops.push(a):this.ops.splice(u,0,a),this},p.prototype.chop=function(){var a=this.ops[this.ops.length-1];return a&&a.retain&&!a.attributes&&this.ops.pop(),this},p.prototype.filter=function(a){return this.ops.filter(a)},p.prototype.forEach=function(a){this.ops.forEach(a)},p.prototype.map=function(a){return this.ops.map(a)},p.prototype.partition=function(a){var u=[],f=[];return this.forEach(function(y){var _=a(y)?u:f;_.push(y)}),[u,f]},p.prototype.reduce=function(a,u){return this.ops.reduce(a,u)},p.prototype.changeLength=function(){return this.reduce(function(a,u){return u.insert?a+d.length(u):u.delete?a-u.delete:a},0)},p.prototype.length=function(){return this.reduce(function(a,u){return a+d.length(u)},0)},p.prototype.slice=function(a,u){a=a||0,typeof u!="number"&&(u=1/0);for(var f=[],y=d.iterator(this.ops),_=0;_0&&f.next(_.retain-b)}for(var v=new p(y);u.hasNext()||f.hasNext();)if(f.peekType()==="insert")v.push(f.next());else if(u.peekType()==="delete")v.push(u.next());else{var w=Math.min(u.peekLength(),f.peekLength()),T=u.next(w),x=f.next(w);if(typeof x.retain=="number"){var S={};typeof T.retain=="number"?S.retain=w:S.insert=T.insert;var C=d.attributes.compose(T.attributes,x.attributes,typeof T.retain=="number");if(C&&(S.attributes=C),v.push(S),!f.hasNext()&&c(v.ops[v.ops.length-1],S)){var A=new p(u.rest());return v.concat(A).chop()}}else typeof x.delete=="number"&&typeof T.retain=="number"&&v.push(x)}return v.chop()},p.prototype.concat=function(a){var u=new p(this.ops.slice());return a.ops.length>0&&(u.push(a.ops[0]),u.ops=u.ops.concat(a.ops.slice(1))),u},p.prototype.diff=function(a,u){if(this.ops===a.ops)return new p;var f=[this,a].map(function(w){return w.map(function(T){if(T.insert!=null)return typeof T.insert=="string"?T.insert:g;var x=w===a?"on":"with";throw new Error("diff() called "+x+" non-document")}).join("")}),y=new p,_=l(f[0],f[1],u),b=d.iterator(this.ops),v=d.iterator(a.ops);return _.forEach(function(w){for(var T=w[1].length;T>0;){var x=0;switch(w[0]){case l.INSERT:x=Math.min(v.peekLength(),T),y.push(v.next(x));break;case l.DELETE:x=Math.min(T,b.peekLength()),b.next(x),y.delete(x);break;case l.EQUAL:x=Math.min(b.peekLength(),v.peekLength(),T);var S=b.next(x),C=v.next(x);c(S.insert,C.insert)?y.retain(x,d.attributes.diff(S.attributes,C.attributes)):y.push(C).delete(x);break}T-=x}}),y.chop()},p.prototype.eachLine=function(a,u){u=u||` `;for(var f=d.iterator(this.ops),y=new p,_=0;f.hasNext();){if(f.peekType()!=="insert")return;var b=f.peek(),v=d.length(b)-f.peekLength(),w=typeof b.insert=="string"?b.insert.indexOf(u,v)-v:-1;if(w<0)y.push(f.next());else if(w>0)y.push(f.next(w));else{if(a(y,f.next(1).attributes||{},_)===!1)return;_+=1,y=new p}}y.length()>0&&a(y,{},_)},p.prototype.transform=function(a,u){if(u=!!u,typeof a=="number")return this.transformPosition(a,u);for(var f=d.iterator(this.ops),y=d.iterator(a.ops),_=new p;f.hasNext()||y.hasNext();)if(f.peekType()==="insert"&&(u||y.peekType()!=="insert"))_.retain(d.length(f.next()));else if(y.peekType()==="insert")_.push(y.next());else{var b=Math.min(f.peekLength(),y.peekLength()),v=f.next(b),w=y.next(b);if(v.delete)continue;w.delete?_.push(w):_.retain(b,d.attributes.transform(v.attributes,w.attributes,u))}return _.chop()},p.prototype.transformPosition=function(a,u){u=!!u;for(var f=d.iterator(this.ops),y=0;f.hasNext()&&y<=a;){var _=f.peekLength(),b=f.peekType();if(f.next(),b==="delete"){a-=Math.min(_,a-y);continue}else b==="insert"&&(y0&&(j1&&arguments[1]!==void 0?arguments[1]:!1;if(W&&(j===0||j>=this.length()-A)){var J=this.clone();return j===0?(this.parent.insertBefore(J,this),this):(this.parent.insertBefore(J,this.next),J)}else{var ee=c(P.prototype.__proto__||Object.getPrototypeOf(P.prototype),"split",this).call(this,j,W);return this.cache={},ee}}}]),P}(u.default.Block);L.blotName="block",L.tagName="P",L.defaultChild="break",L.allowedChildren=[b.default,u.default.Embed,w.default];function M(k){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return k==null||(typeof k.formats=="function"&&(P=(0,d.default)(P,k.formats())),k.parent==null||k.parent.blotName=="scroll"||k.parent.statics.scope!==k.statics.scope)?P:M(k.parent,P)}n.bubbleFormats=M,n.BlockEmbed=R,n.default=L},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.overload=n.expandConfig=void 0;var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(V){return typeof V}:function(V){return V&&typeof Symbol=="function"&&V.constructor===Symbol&&V!==Symbol.prototype?"symbol":typeof V},c=function(){function V($,N){var H=[],G=!0,ne=!1,X=void 0;try{for(var U=$[Symbol.iterator](),Q;!(G=(Q=U.next()).done)&&(H.push(Q.value),!(N&&H.length===N));G=!0);}catch(ie){ne=!0,X=ie}finally{try{!G&&U.return&&U.return()}finally{if(ne)throw X}}return H}return function($,N){if(Array.isArray($))return $;if(Symbol.iterator in Object($))return V($,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){function V($,N){for(var H=0;H2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof N!="string"){var X=N.attrName||N.blotName;typeof X=="string"?this.register("formats/"+X,N,H):Object.keys(N).forEach(function(U){G.register(U,N[U],H)})}else this.imports[N]!=null&&!ne&&I.warn("Overwriting "+N+" with",H),this.imports[N]=H,(N.startsWith("blots/")||N.startsWith("formats/"))&&H.blotName!=="abstract"?v.default.register(H):N.startsWith("modules")&&typeof H.register=="function"&&H.register()}}]);function V($){var N=this,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(P(this,V),this.options=W($,H),this.container=this.options.container,this.container==null)return I.error("Invalid Quill container",$);this.options.debug&&V.debug(this.options.debug);var G=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new f.default,this.scroll=v.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new a.default(this.scroll),this.selection=new T.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(f.default.events.EDITOR_CHANGE,function(X){X===f.default.events.TEXT_CHANGE&&N.root.classList.toggle("ql-blank",N.editor.isBlank())}),this.emitter.on(f.default.events.SCROLL_UPDATE,function(X,U){var Q=N.selection.lastRange,ie=Q&&Q.length===0?Q.index:void 0;J.call(N,function(){return N.editor.update(null,U,ie)},X)});var ne=this.clipboard.convert(`
`+G+"


");this.setContents(ne),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return h(V,[{key:"addContainer",value:function(N){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof N=="string"){var G=N;N=document.createElement("div"),N.classList.add(G)}return this.container.insertBefore(N,H),N}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(N,H,G){var ne=this,X=ee(N,H,G),U=c(X,4);return N=U[0],H=U[1],G=U[3],J.call(this,function(){return ne.editor.deleteText(N,H)},G,N,-1*H)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(N),this.container.classList.toggle("ql-disabled",!N)}},{key:"focus",value:function(){var N=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=N,this.scrollIntoView()}},{key:"format",value:function(N,H){var G=this,ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.default.sources.API;return J.call(this,function(){var X=G.getSelection(!0),U=new g.default;if(X==null)return U;if(v.default.query(N,v.default.Scope.BLOCK))U=G.editor.formatLine(X.index,X.length,k({},N,H));else{if(X.length===0)return G.selection.format(N,H),U;U=G.editor.formatText(X.index,X.length,k({},N,H))}return G.setSelection(X,f.default.sources.SILENT),U},ne)}},{key:"formatLine",value:function(N,H,G,ne,X){var U=this,Q=void 0,ie=ee(N,H,G,ne,X),ae=c(ie,4);return N=ae[0],H=ae[1],Q=ae[2],X=ae[3],J.call(this,function(){return U.editor.formatLine(N,H,Q)},X,N,0)}},{key:"formatText",value:function(N,H,G,ne,X){var U=this,Q=void 0,ie=ee(N,H,G,ne,X),ae=c(ie,4);return N=ae[0],H=ae[1],Q=ae[2],X=ae[3],J.call(this,function(){return U.editor.formatText(N,H,Q)},X,N,0)}},{key:"getBounds",value:function(N){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,G=void 0;typeof N=="number"?G=this.selection.getBounds(N,H):G=this.selection.getBounds(N.index,N.length);var ne=this.container.getBoundingClientRect();return{bottom:G.bottom-ne.top,height:G.height,left:G.left-ne.left,right:G.right-ne.left,top:G.top-ne.top,width:G.width}}},{key:"getContents",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-N,G=ee(N,H),ne=c(G,2);return N=ne[0],H=ne[1],this.editor.getContents(N,H)}},{key:"getFormat",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof N=="number"?this.editor.getFormat(N,H):this.editor.getFormat(N.index,N.length)}},{key:"getIndex",value:function(N){return N.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(N){return this.scroll.leaf(N)}},{key:"getLine",value:function(N){return this.scroll.line(N)}},{key:"getLines",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof N!="number"?this.scroll.lines(N.index,N.length):this.scroll.lines(N,H)}},{key:"getModule",value:function(N){return this.theme.modules[N]}},{key:"getSelection",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return N&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-N,G=ee(N,H),ne=c(G,2);return N=ne[0],H=ne[1],this.editor.getText(N,H)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(N,H,G){var ne=this,X=arguments.length>3&&arguments[3]!==void 0?arguments[3]:V.sources.API;return J.call(this,function(){return ne.editor.insertEmbed(N,H,G)},X,N)}},{key:"insertText",value:function(N,H,G,ne,X){var U=this,Q=void 0,ie=ee(N,0,G,ne,X),ae=c(ie,4);return N=ae[0],Q=ae[2],X=ae[3],J.call(this,function(){return U.editor.insertText(N,H,Q)},X,N,H.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(N,H,G){this.clipboard.dangerouslyPasteHTML(N,H,G)}},{key:"removeFormat",value:function(N,H,G){var ne=this,X=ee(N,H,G),U=c(X,4);return N=U[0],H=U[1],G=U[3],J.call(this,function(){return ne.editor.removeFormat(N,H)},G,N)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(N){var H=this,G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f.default.sources.API;return J.call(this,function(){N=new g.default(N);var ne=H.getLength(),X=H.editor.deleteText(0,ne),U=H.editor.applyDelta(N),Q=U.ops[U.ops.length-1];Q!=null&&typeof Q.insert=="string"&&Q.insert[Q.insert.length-1]===` `&&(H.editor.deleteText(H.getLength()-1,1),U.delete(1));var ie=X.compose(U);return ie},G)}},{key:"setSelection",value:function(N,H,G){if(N==null)this.selection.setRange(null,H||V.sources.API);else{var ne=ee(N,H,G),X=c(ne,4);N=X[0],H=X[1],G=X[3],this.selection.setRange(new w.Range(N,H),G),G!==f.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(N){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f.default.sources.API,G=new g.default().insert(N);return this.setContents(G,H)}},{key:"update",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f.default.sources.USER,H=this.scroll.update(N);return this.selection.update(N),H}},{key:"updateContents",value:function(N){var H=this,G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f.default.sources.API;return J.call(this,function(){return N=new g.default(N),H.editor.applyDelta(N,G)},G,!0)}}]),V}();j.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},j.events=f.default.events,j.sources=f.default.sources,j.version="1.3.7",j.imports={delta:g.default,parchment:v.default,"core/module":_.default,"core/theme":L.default};function W(V,$){if($=(0,S.default)(!0,{container:V,modules:{clipboard:!0,keyboard:!0,history:!0}},$),!$.theme||$.theme===j.DEFAULTS.theme)$.theme=L.default;else if($.theme=j.import("themes/"+$.theme),$.theme==null)throw new Error("Invalid theme "+$.theme+". Did you register it?");var N=(0,S.default)(!0,{},$.theme.DEFAULTS);[N,$].forEach(function(ne){ne.modules=ne.modules||{},Object.keys(ne.modules).forEach(function(X){ne.modules[X]===!0&&(ne.modules[X]={})})});var H=Object.keys(N.modules).concat(Object.keys($.modules)),G=H.reduce(function(ne,X){var U=j.import("modules/"+X);return U==null?I.error("Cannot load "+X+" module. Are you sure you registered it?"):ne[X]=U.DEFAULTS||{},ne},{});return $.modules!=null&&$.modules.toolbar&&$.modules.toolbar.constructor!==Object&&($.modules.toolbar={container:$.modules.toolbar}),$=(0,S.default)(!0,{},j.DEFAULTS,{modules:G},N,$),["bounds","container","scrollingContainer"].forEach(function(ne){typeof $[ne]=="string"&&($[ne]=document.querySelector($[ne]))}),$.modules=Object.keys($.modules).reduce(function(ne,X){return $.modules[X]&&(ne[X]=$.modules[X]),ne},{}),$}function J(V,$,N,H){if(this.options.strict&&!this.isEnabled()&&$===f.default.sources.USER)return new g.default;var G=N==null?null:this.getSelection(),ne=this.editor.delta,X=V();if(G!=null&&(N===!0&&(N=G.index),H==null?G=oe(G,X,$):H!==0&&(G=oe(G,N,H,$)),this.setSelection(G,f.default.sources.SILENT)),X.length()>0){var U,Q=[f.default.events.TEXT_CHANGE,X,ne,$];if((U=this.emitter).emit.apply(U,[f.default.events.EDITOR_CHANGE].concat(Q)),$!==f.default.sources.SILENT){var ie;(ie=this.emitter).emit.apply(ie,Q)}}return X}function ee(V,$,N,H,G){var ne={};return typeof V.index=="number"&&typeof V.length=="number"?typeof $!="number"?(G=H,H=N,N=$,$=V.length,V=V.index):($=V.length,V=V.index):typeof $!="number"&&(G=H,H=N,N=$,$=0),(typeof N=="undefined"?"undefined":l(N))==="object"?(ne=N,G=H):typeof N=="string"&&(H!=null?ne[N]=H:G=N),G=G||f.default.sources.API,[V,$,ne,G]}function oe(V,$,N,H){if(V==null)return null;var G=void 0,ne=void 0;if($ instanceof g.default){var X=[V.index,V.index+V.length].map(function(ae){return $.transformPosition(ae,H!==f.default.sources.USER)}),U=c(X,2);G=U[0],ne=U[1]}else{var Q=[V.index,V.index+V.length].map(function(ae){return ae<$||ae===$&&H===f.default.sources.USER?ae:N>=0?ae+N:Math.max($,ae+N)}),ie=c(Q,2);G=ie[0],ne=ie[1]}return new w.Range(G,ne-G)}n.expandConfig=W,n.overload=ee,n.default=j},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function b(v,w){for(var T=0;T0){var x=this.parent.isolate(this.offset(),this.length());this.moveChildren(x),x.wrap(this)}}}],[{key:"compare",value:function(T,x){var S=v.order.indexOf(T),C=v.order.indexOf(x);return S>=0||C>=0?S-C:T===x?0:T1?C-1:0),R=1;R1&&arguments[1]!==void 0?arguments[1]:{};l(this,h),this.quill=d,this.options=g};c.DEFAULTS={},n.default=c},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=["error","warn","log","info"],c="warn";function h(g){if(l.indexOf(g)<=l.indexOf(c)){for(var p,a=arguments.length,u=Array(a>1?a-1:0),f=1;f0&&typeof u[0]!="number")}function a(u,f,y){var _,b;if(g(u)||g(f)||u.prototype!==f.prototype)return!1;if(h(u))return h(f)?(u=l.call(u),f=l.call(f),d(u,f,y)):!1;if(p(u)){if(!p(f)||u.length!==f.length)return!1;for(_=0;_=0;_--)if(v[_]!=w[_])return!1;for(_=v.length-1;_>=0;_--)if(b=v[_],!d(u[b],f[b],y))return!1;return typeof u==typeof f}},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=i(1),c=function(){function h(d,g,p){p===void 0&&(p={}),this.attrName=d,this.keyName=g;var a=l.Scope.TYPE&l.Scope.ATTRIBUTE;p.scope!=null?this.scope=p.scope&l.Scope.LEVEL|a:this.scope=l.Scope.ATTRIBUTE,p.whitelist!=null&&(this.whitelist=p.whitelist)}return h.keys=function(d){return[].map.call(d.attributes,function(g){return g.name})},h.prototype.add=function(d,g){return this.canAdd(d,g)?(d.setAttribute(this.keyName,g),!0):!1},h.prototype.canAdd=function(d,g){var p=l.query(d,l.Scope.BLOT&(this.scope|l.Scope.TYPE));return p==null?!1:this.whitelist==null?!0:typeof g=="string"?this.whitelist.indexOf(g.replace(/["']/g,""))>-1:this.whitelist.indexOf(g)>-1},h.prototype.remove=function(d){d.removeAttribute(this.keyName)},h.prototype.value=function(d){var g=d.getAttribute(this.keyName);return this.canAdd(d,g)&&g?g:""},h}();n.default=c},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Code=void 0;var l=function(){function R(L,M){var k=[],P=!0,I=!1,j=void 0;try{for(var W=L[Symbol.iterator](),J;!(P=(J=W.next()).done)&&(k.push(J.value),!(M&&k.length===M));P=!0);}catch(ee){I=!0,j=ee}finally{try{!P&&W.return&&W.return()}finally{if(I)throw j}}return k}return function(L,M){if(Array.isArray(L))return L;if(Symbol.iterator in Object(L))return R(L,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(){function R(L,M){for(var k=0;k=k+P)){var J=this.newlineIndex(k,!0)+1,ee=W-J+1,oe=this.isolate(J,ee),V=oe.next;oe.format(I,j),V instanceof L&&V.formatAt(0,k-J+P-ee,I,j)}}}},{key:"insertAt",value:function(k,P,I){if(I==null){var j=this.descendant(v.default,k),W=l(j,2),J=W[0],ee=W[1];J.insertAt(ee,P)}}},{key:"length",value:function(){var k=this.domNode.textContent.length;return this.domNode.textContent.endsWith(` `)?k:k+1}},{key:"newlineIndex",value:function(k){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(P)return this.domNode.textContent.slice(0,k).lastIndexOf(` `);var I=this.domNode.textContent.slice(k).indexOf(` `);return I>-1?k+I:-1}},{key:"optimize",value:function(k){this.domNode.textContent.endsWith(` `)||this.appendChild(a.default.create("text",` `)),h(L.prototype.__proto__||Object.getPrototypeOf(L.prototype),"optimize",this).call(this,k);var P=this.next;P!=null&&P.prev===this&&P.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===P.statics.formats(P.domNode)&&(P.optimize(k),P.moveChildren(this),P.remove())}},{key:"replace",value:function(k){h(L.prototype.__proto__||Object.getPrototypeOf(L.prototype),"replace",this).call(this,k),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(P){var I=a.default.find(P);I==null?P.parentNode.removeChild(P):I instanceof a.default.Embed?I.remove():I.unwrap()})}}],[{key:"create",value:function(k){var P=h(L.__proto__||Object.getPrototypeOf(L),"create",this).call(this,k);return P.setAttribute("spellcheck",!1),P}},{key:"formats",value:function(){return!0}}]),L}(f.default);A.blotName="code-block",A.tagName="PRE",A.TAB=" ",n.Code=C,n.default=A},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(V){return typeof V}:function(V){return V&&typeof Symbol=="function"&&V.constructor===Symbol&&V!==Symbol.prototype?"symbol":typeof V},c=function(){function V($,N){var H=[],G=!0,ne=!1,X=void 0;try{for(var U=$[Symbol.iterator](),Q;!(G=(Q=U.next()).done)&&(H.push(Q.value),!(N&&H.length===N));G=!0);}catch(ie){ne=!0,X=ie}finally{try{!G&&U.return&&U.return()}finally{if(ne)throw X}}return H}return function($,N){if(Array.isArray($))return $;if(Symbol.iterator in Object($))return V($,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){function V($,N){for(var H=0;H=ne&&!ae.endsWith(` `)&&(G=!0),H.scroll.insertAt(X,ae);var de=H.scroll.line(X),we=c(de,2),Pe=we[0],Me=we[1],De=(0,k.default)({},(0,w.bubbleFormats)(Pe));if(Pe instanceof T.default){var ze=Pe.descendant(f.default.Leaf,Me),xt=c(ze,1),Je=xt[0];De=(0,k.default)(De,(0,w.bubbleFormats)(Je))}ie=a.default.attributes.diff(De,ie)||{}}else if(l(U.insert)==="object"){var le=Object.keys(U.insert)[0];if(le==null)return X;H.scroll.insertAt(X,le,U.insert[le])}ne+=Q}return Object.keys(ie).forEach(function(he){H.scroll.formatAt(X,Q,he,ie[he])}),X+Q},0),N.reduce(function(X,U){return typeof U.delete=="number"?(H.scroll.deleteAt(X,U.delete),X):X+(U.retain||U.insert.length||1)},0),this.scroll.batchEnd(),this.update(N)}},{key:"deleteText",value:function(N,H){return this.scroll.deleteAt(N,H),this.update(new g.default().retain(N).delete(H))}},{key:"formatLine",value:function(N,H){var G=this,ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(ne).forEach(function(X){if(!(G.scroll.whitelist!=null&&!G.scroll.whitelist[X])){var U=G.scroll.lines(N,Math.max(H,1)),Q=H;U.forEach(function(ie){var ae=ie.length();if(!(ie instanceof _.default))ie.format(X,ne[X]);else{var de=N-ie.offset(G.scroll),we=ie.newlineIndex(de+Q)-de+1;ie.formatAt(de,we,X,ne[X])}Q-=ae})}}),this.scroll.optimize(),this.update(new g.default().retain(N).retain(H,(0,A.default)(ne)))}},{key:"formatText",value:function(N,H){var G=this,ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(ne).forEach(function(X){G.scroll.formatAt(N,H,X,ne[X])}),this.update(new g.default().retain(N).retain(H,(0,A.default)(ne)))}},{key:"getContents",value:function(N,H){return this.delta.slice(N,N+H)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(N,H){return N.concat(H.delta())},new g.default)}},{key:"getFormat",value:function(N){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,G=[],ne=[];H===0?this.scroll.path(N).forEach(function(U){var Q=c(U,1),ie=Q[0];ie instanceof T.default?G.push(ie):ie instanceof f.default.Leaf&&ne.push(ie)}):(G=this.scroll.lines(N,H),ne=this.scroll.descendants(f.default.Leaf,N,H));var X=[G,ne].map(function(U){if(U.length===0)return{};for(var Q=(0,w.bubbleFormats)(U.shift());Object.keys(Q).length>0;){var ie=U.shift();if(ie==null)return Q;Q=ee((0,w.bubbleFormats)(ie),Q)}return Q});return k.default.apply(k.default,X)}},{key:"getText",value:function(N,H){return this.getContents(N,H).filter(function(G){return typeof G.insert=="string"}).map(function(G){return G.insert}).join("")}},{key:"insertEmbed",value:function(N,H,G){return this.scroll.insertAt(N,H,G),this.update(new g.default().retain(N).insert(I({},H,G)))}},{key:"insertText",value:function(N,H){var G=this,ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return H=H.replace(/\r\n/g,` `).replace(/\r/g,` `),this.scroll.insertAt(N,H),Object.keys(ne).forEach(function(X){G.scroll.formatAt(N,H.length,X,ne[X])}),this.update(new g.default().retain(N).insert(H,(0,A.default)(ne)))}},{key:"isBlank",value:function(){if(this.scroll.children.length==0)return!0;if(this.scroll.children.length>1)return!1;var N=this.scroll.children.head;return N.statics.blotName!==T.default.blotName||N.children.length>1?!1:N.children.head instanceof S.default}},{key:"removeFormat",value:function(N,H){var G=this.getText(N,H),ne=this.scroll.line(N+H),X=c(ne,2),U=X[0],Q=X[1],ie=0,ae=new g.default;U!=null&&(U instanceof _.default?ie=U.newlineIndex(Q)-Q+1:ie=U.length()-Q,ae=U.delta().slice(Q,Q+ie-1).insert(` `));var de=this.getContents(N,H+ie),we=de.diff(new g.default().insert(G).concat(ae)),Pe=new g.default().retain(N).concat(we);return this.applyDelta(Pe)}},{key:"update",value:function(N){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,ne=this.delta;if(H.length===1&&H[0].type==="characterData"&&H[0].target.data.match(W)&&f.default.find(H[0].target)){var X=f.default.find(H[0].target),U=(0,w.bubbleFormats)(X),Q=X.offset(this.scroll),ie=H[0].oldValue.replace(v.default.CONTENTS,""),ae=new g.default().insert(ie),de=new g.default().insert(X.value()),we=new g.default().retain(Q).concat(ae.diff(de,G));N=we.reduce(function(Pe,Me){return Me.insert?Pe.insert(Me.insert,U):Pe.push(Me)},new g.default),this.delta=ne.compose(N)}else this.delta=this.getDelta(),(!N||!(0,L.default)(ne.compose(N),this.delta))&&(N=ne.diff(this.delta,G));return N}}]),V}();function ee(V,$){return Object.keys($).reduce(function(N,H){return V[H]==null||($[H]===V[H]?N[H]=$[H]:Array.isArray($[H])?$[H].indexOf(V[H])<0&&(N[H]=$[H].concat([V[H]])):N[H]=[$[H],V[H]]),N},{})}function oe(V){return V.reduce(function($,N){if(N.insert===1){var H=(0,A.default)(N.attributes);return delete H.image,$.insert({image:N.attributes.image},H)}if(N.attributes!=null&&(N.attributes.list===!0||N.attributes.bullet===!0)&&(N=(0,A.default)(N),N.attributes.list?N.attributes.list="ordered":(N.attributes.list="bullet",delete N.attributes.bullet)),typeof N.insert=="string"){var G=N.insert.replace(/\r\n/g,` `).replace(/\r/g,` `);return $.insert(G,N.attributes)}return $.push(N)},new g.default)}n.default=J},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Range=void 0;var l=function(){function R(L,M){var k=[],P=!0,I=!1,j=void 0;try{for(var W=L[Symbol.iterator](),J;!(P=(J=W.next()).done)&&(k.push(J.value),!(M&&k.length===M));P=!0);}catch(ee){I=!0,j=ee}finally{try{!P&&W.return&&W.return()}finally{if(I)throw j}}return k}return function(L,M){if(Array.isArray(L))return L;if(Symbol.iterator in Object(L))return R(L,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(){function R(L,M){for(var k=0;k1&&arguments[1]!==void 0?arguments[1]:0;T(this,R),this.index=L,this.length=M},C=function(){function R(L,M){var k=this;T(this,R),this.emitter=M,this.scroll=L,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=d.default.create("cursor",this),this.lastRange=this.savedRange=new S(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){k.mouseDown||setTimeout(k.update.bind(k,y.default.sources.USER),1)}),this.emitter.on(y.default.events.EDITOR_CHANGE,function(P,I){P===y.default.events.TEXT_CHANGE&&I.length()>0&&k.update(y.default.sources.SILENT)}),this.emitter.on(y.default.events.SCROLL_BEFORE_UPDATE,function(){if(k.hasFocus()){var P=k.getNativeRange();P!=null&&P.start.node!==k.cursor.textNode&&k.emitter.once(y.default.events.SCROLL_UPDATE,function(){try{k.setNativeRange(P.start.node,P.start.offset,P.end.node,P.end.offset)}catch(I){}})}}),this.emitter.on(y.default.events.SCROLL_OPTIMIZE,function(P,I){if(I.range){var j=I.range,W=j.startNode,J=j.startOffset,ee=j.endNode,oe=j.endOffset;k.setNativeRange(W,J,ee,oe)}}),this.update(y.default.sources.SILENT)}return c(R,[{key:"handleComposition",value:function(){var M=this;this.root.addEventListener("compositionstart",function(){M.composing=!0}),this.root.addEventListener("compositionend",function(){if(M.composing=!1,M.cursor.parent){var k=M.cursor.restore();if(!k)return;setTimeout(function(){M.setNativeRange(k.startNode,k.startOffset,k.endNode,k.endOffset)},1)}})}},{key:"handleDragging",value:function(){var M=this;this.emitter.listenDOM("mousedown",document.body,function(){M.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){M.mouseDown=!1,M.update(y.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(M,k){if(!(this.scroll.whitelist!=null&&!this.scroll.whitelist[M])){this.scroll.update();var P=this.getNativeRange();if(!(P==null||!P.native.collapsed||d.default.query(M,d.default.Scope.BLOCK))){if(P.start.node!==this.cursor.textNode){var I=d.default.find(P.start.node,!1);if(I==null)return;if(I instanceof d.default.Leaf){var j=I.split(P.start.offset);I.parent.insertBefore(this.cursor,j)}else I.insertBefore(this.cursor,P.start.node);this.cursor.attach()}this.cursor.format(M,k),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(M){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,P=this.scroll.length();M=Math.min(M,P-1),k=Math.min(M+k,P-1)-M;var I=void 0,j=this.scroll.leaf(M),W=l(j,2),J=W[0],ee=W[1];if(J==null)return null;var oe=J.position(ee,!0),V=l(oe,2);I=V[0],ee=V[1];var $=document.createRange();if(k>0){$.setStart(I,ee);var N=this.scroll.leaf(M+k),H=l(N,2);if(J=H[0],ee=H[1],J==null)return null;var G=J.position(ee,!0),ne=l(G,2);return I=ne[0],ee=ne[1],$.setEnd(I,ee),$.getBoundingClientRect()}else{var X="left",U=void 0;return I instanceof Text?(ee0&&(X="right")),{bottom:U.top+U.height,height:U.height,left:U[X],right:U[X],top:U.top,width:0}}}},{key:"getNativeRange",value:function(){var M=document.getSelection();if(M==null||M.rangeCount<=0)return null;var k=M.getRangeAt(0);if(k==null)return null;var P=this.normalizeNative(k);return x.info("getNativeRange",P),P}},{key:"getRange",value:function(){var M=this.getNativeRange();if(M==null)return[null,null];var k=this.normalizedToRange(M);return[k,M]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(M){var k=this,P=[[M.start.node,M.start.offset]];M.native.collapsed||P.push([M.end.node,M.end.offset]);var I=P.map(function(J){var ee=l(J,2),oe=ee[0],V=ee[1],$=d.default.find(oe,!0),N=$.offset(k.scroll);return V===0?N:$ instanceof d.default.Container?N+$.length():N+$.index(oe,V)}),j=Math.min(Math.max.apply(Math,w(I)),this.scroll.length()-1),W=Math.min.apply(Math,[j].concat(w(I)));return new S(W,j-W)}},{key:"normalizeNative",value:function(M){if(!A(this.root,M.startContainer)||!M.collapsed&&!A(this.root,M.endContainer))return null;var k={start:{node:M.startContainer,offset:M.startOffset},end:{node:M.endContainer,offset:M.endOffset},native:M};return[k.start,k.end].forEach(function(P){for(var I=P.node,j=P.offset;!(I instanceof Text)&&I.childNodes.length>0;)if(I.childNodes.length>j)I=I.childNodes[j],j=0;else if(I.childNodes.length===j)I=I.lastChild,j=I instanceof Text?I.data.length:I.childNodes.length+1;else break;P.node=I,P.offset=j}),k}},{key:"rangeToNative",value:function(M){var k=this,P=M.collapsed?[M.index]:[M.index,M.index+M.length],I=[],j=this.scroll.length();return P.forEach(function(W,J){W=Math.min(j-1,W);var ee=void 0,oe=k.scroll.leaf(W),V=l(oe,2),$=V[0],N=V[1],H=$.position(N,J!==0),G=l(H,2);ee=G[0],N=G[1],I.push(ee,N)}),I.length<2&&(I=I.concat(I)),I}},{key:"scrollIntoView",value:function(M){var k=this.lastRange;if(k!=null){var P=this.getBounds(k.index,k.length);if(P!=null){var I=this.scroll.length()-1,j=this.scroll.line(Math.min(k.index,I)),W=l(j,1),J=W[0],ee=J;if(k.length>0){var oe=this.scroll.line(Math.min(k.index+k.length,I)),V=l(oe,1);ee=V[0]}if(!(J==null||ee==null)){var $=M.getBoundingClientRect();P.top<$.top?M.scrollTop-=$.top-P.top:P.bottom>$.bottom&&(M.scrollTop+=P.bottom-$.bottom)}}}}},{key:"setNativeRange",value:function(M,k){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:M,I=arguments.length>3&&arguments[3]!==void 0?arguments[3]:k,j=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(x.info("setNativeRange",M,k,P,I),!(M!=null&&(this.root.parentNode==null||M.parentNode==null||P.parentNode==null))){var W=document.getSelection();if(W!=null)if(M!=null){this.hasFocus()||this.root.focus();var J=(this.getNativeRange()||{}).native;if(J==null||j||M!==J.startContainer||k!==J.startOffset||P!==J.endContainer||I!==J.endOffset){M.tagName=="BR"&&(k=[].indexOf.call(M.parentNode.childNodes,M),M=M.parentNode),P.tagName=="BR"&&(I=[].indexOf.call(P.parentNode.childNodes,P),P=P.parentNode);var ee=document.createRange();ee.setStart(M,k),ee.setEnd(P,I),W.removeAllRanges(),W.addRange(ee)}}else W.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(M){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.default.sources.API;if(typeof k=="string"&&(P=k,k=!1),x.info("setRange",M),M!=null){var I=this.rangeToNative(M);this.setNativeRange.apply(this,w(I).concat([k]))}else this.setNativeRange(null);this.update(P)}},{key:"update",value:function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y.default.sources.USER,k=this.lastRange,P=this.getRange(),I=l(P,2),j=I[0],W=I[1];if(this.lastRange=j,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,u.default)(k,this.lastRange)){var J;!this.composing&&W!=null&&W.native.collapsed&&W.start.node!==this.cursor.textNode&&this.cursor.restore();var ee=[y.default.events.SELECTION_CHANGE,(0,p.default)(this.lastRange),(0,p.default)(k),M];if((J=this.emitter).emit.apply(J,[y.default.events.EDITOR_CHANGE].concat(ee)),M!==y.default.sources.SILENT){var oe;(oe=this.emitter).emit.apply(oe,ee)}}}}]),R}();function A(R,L){try{L.parentNode}catch(M){return!1}return L instanceof Text&&(L=L.parentNode),R.contains(L)}n.Range=S,n.default=C},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function y(_,b){for(var v=0;v0&&(f+=1),[this.parent.domNode,f]},p.prototype.value=function(){var a;return a={},a[this.statics.blotName]=this.statics.value(this.domNode)||!0,a},p.scope=h.Scope.INLINE_BLOT,p}(c.default);n.default=d},function(e,n,i){var l=i(11),c=i(3),h={attributes:{compose:function(g,p,a){typeof g!="object"&&(g={}),typeof p!="object"&&(p={});var u=c(!0,{},p);a||(u=Object.keys(u).reduce(function(y,_){return u[_]!=null&&(y[_]=u[_]),y},{}));for(var f in g)g[f]!==void 0&&p[f]===void 0&&(u[f]=g[f]);return Object.keys(u).length>0?u:void 0},diff:function(g,p){typeof g!="object"&&(g={}),typeof p!="object"&&(p={});var a=Object.keys(g).concat(Object.keys(p)).reduce(function(u,f){return l(g[f],p[f])||(u[f]=p[f]===void 0?null:p[f]),u},{});return Object.keys(a).length>0?a:void 0},transform:function(g,p,a){if(typeof g!="object")return p;if(typeof p=="object"){if(!a)return p;var u=Object.keys(p).reduce(function(f,y){return g[y]===void 0&&(f[y]=p[y]),f},{});return Object.keys(u).length>0?u:void 0}}},iterator:function(g){return new d(g)},length:function(g){return typeof g.delete=="number"?g.delete:typeof g.retain=="number"?g.retain:typeof g.insert=="string"?g.insert.length:1}};function d(g){this.ops=g,this.index=0,this.offset=0}d.prototype.hasNext=function(){return this.peekLength()<1/0},d.prototype.next=function(g){g||(g=1/0);var p=this.ops[this.index];if(p){var a=this.offset,u=h.length(p);if(g>=u-a?(g=u-a,this.index+=1,this.offset=0):this.offset+=g,typeof p.delete=="number")return{delete:g};var f={};return p.attributes&&(f.attributes=p.attributes),typeof p.retain=="number"?f.retain=g:typeof p.insert=="string"?f.insert=p.insert.substr(a,g):f.insert=p.insert,f}else return{retain:1/0}},d.prototype.peek=function(){return this.ops[this.index]},d.prototype.peekLength=function(){return this.ops[this.index]?h.length(this.ops[this.index])-this.offset:1/0},d.prototype.peekType=function(){return this.ops[this.index]?typeof this.ops[this.index].delete=="number"?"delete":typeof this.ops[this.index].retain=="number"?"retain":"insert":"retain"},d.prototype.rest=function(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);var g=this.offset,p=this.index,a=this.next(),u=this.ops.slice(this.index);return this.offset=g,this.index=p,[a].concat(u)}else return[]},e.exports=h},function(e,n){var i=function(){function l(_,b){return b!=null&&_ instanceof b}var c;try{c=Map}catch(_){c=function(){}}var h;try{h=Set}catch(_){h=function(){}}var d;try{d=Promise}catch(_){d=function(){}}function g(_,b,v,w,T){typeof b=="object"&&(v=b.depth,w=b.prototype,T=b.includeNonEnumerable,b=b.circular);var x=[],S=[],C=typeof Buffer!="undefined";typeof b=="undefined"&&(b=!0),typeof v=="undefined"&&(v=1/0);function A(R,L){if(R===null)return null;if(L===0)return R;var M,k;if(typeof R!="object")return R;if(l(R,c))M=new c;else if(l(R,h))M=new h;else if(l(R,d))M=new d(function($,N){R.then(function(H){$(A(H,L-1))},function(H){N(A(H,L-1))})});else if(g.__isArray(R))M=[];else if(g.__isRegExp(R))M=new RegExp(R.source,y(R)),R.lastIndex&&(M.lastIndex=R.lastIndex);else if(g.__isDate(R))M=new Date(R.getTime());else{if(C&&Buffer.isBuffer(R))return Buffer.allocUnsafe?M=Buffer.allocUnsafe(R.length):M=new Buffer(R.length),R.copy(M),M;l(R,Error)?M=Object.create(R):typeof w=="undefined"?(k=Object.getPrototypeOf(R),M=Object.create(k)):(M=Object.create(w),k=w)}if(b){var P=x.indexOf(R);if(P!=-1)return S[P];x.push(R),S.push(M)}l(R,c)&&R.forEach(function($,N){var H=A(N,L-1),G=A($,L-1);M.set(H,G)}),l(R,h)&&R.forEach(function($){var N=A($,L-1);M.add(N)});for(var I in R){var j;k&&(j=Object.getOwnPropertyDescriptor(k,I)),!(j&&j.set==null)&&(M[I]=A(R[I],L-1))}if(Object.getOwnPropertySymbols)for(var W=Object.getOwnPropertySymbols(R),I=0;I0){if(ee instanceof u.BlockEmbed||N instanceof u.BlockEmbed){this.optimize();return}if(ee instanceof v.default){var H=ee.newlineIndex(ee.length(),!0);if(H>-1&&(ee=ee.split(H+1),ee===N)){this.optimize();return}}else if(N instanceof v.default){var G=N.newlineIndex(0);G>-1&&N.split(G+1)}var ne=N.children.head instanceof _.default?null:N.children.head;ee.moveChildren(N,ne),ee.remove()}this.optimize()}},{key:"enable",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",I)}},{key:"formatAt",value:function(I,j,W,J){this.whitelist!=null&&!this.whitelist[W]||(h(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"formatAt",this).call(this,I,j,W,J),this.optimize())}},{key:"insertAt",value:function(I,j,W){if(!(W!=null&&this.whitelist!=null&&!this.whitelist[j])){if(I>=this.length())if(W==null||g.default.query(j,g.default.Scope.BLOCK)==null){var J=g.default.create(this.statics.defaultChild);this.appendChild(J),W==null&&j.endsWith(` `)&&(j=j.slice(0,-1)),J.insertAt(0,j,W)}else{var ee=g.default.create(j,W);this.appendChild(ee)}else h(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"insertAt",this).call(this,I,j,W);this.optimize()}}},{key:"insertBefore",value:function(I,j){if(I.statics.scope===g.default.Scope.INLINE_BLOT){var W=g.default.create(this.statics.defaultChild);W.appendChild(I),I=W}h(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"insertBefore",this).call(this,I,j)}},{key:"leaf",value:function(I){return this.path(I).pop()||[null,-1]}},{key:"line",value:function(I){return I===this.length()?this.line(I-1):this.descendant(R,I)}},{key:"lines",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,W=function J(ee,oe,V){var $=[],N=V;return ee.children.forEachAt(oe,V,function(H,G,ne){R(H)?$.push(H):H instanceof g.default.Container&&($=$.concat(J(H,G,N))),N-=ne}),$};return W(this,I,j)}},{key:"optimize",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch!==!0&&(h(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"optimize",this).call(this,I,j),I.length>0&&this.emitter.emit(a.default.events.SCROLL_OPTIMIZE,I,j))}},{key:"path",value:function(I){return h(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"path",this).call(this,I).slice(1)}},{key:"update",value:function(I){if(this.batch!==!0){var j=a.default.sources.USER;typeof I=="string"&&(j=I),Array.isArray(I)||(I=this.observer.takeRecords()),I.length>0&&this.emitter.emit(a.default.events.SCROLL_BEFORE_UPDATE,j,I),h(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"update",this).call(this,I.concat([])),I.length>0&&this.emitter.emit(a.default.events.SCROLL_UPDATE,j,I)}}}]),k}(g.default.Scroll);L.blotName="scroll",L.className="ql-editor",L.tagName="DIV",L.defaultChild="block",L.allowedChildren=[f.default,u.BlockEmbed,T.default],n.default=L},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SHORTKEY=n.default=void 0;var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},c=function(){function U(Q,ie){var ae=[],de=!0,we=!1,Pe=void 0;try{for(var Me=Q[Symbol.iterator](),De;!(de=(De=Me.next()).done)&&(ae.push(De.value),!(ie&&ae.length===ie));de=!0);}catch(ze){we=!0,Pe=ze}finally{try{!de&&Me.return&&Me.return()}finally{if(we)throw Pe}}return ae}return function(Q,ie){if(Array.isArray(Q))return Q;if(Symbol.iterator in Object(Q))return U(Q,ie);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){function U(Q,ie){for(var ae=0;ae1&&arguments[1]!==void 0?arguments[1]:{},we=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Pe=X(ae);if(Pe==null||Pe.key==null)return W.warn("Attempted to add invalid keyboard binding",Pe);typeof de=="function"&&(de={handler:de}),typeof we=="function"&&(we={handler:we}),Pe=(0,f.default)(Pe,de,we),this.bindings[Pe.key]=this.bindings[Pe.key]||[],this.bindings[Pe.key].push(Pe)}},{key:"listen",value:function(){var ae=this;this.quill.root.addEventListener("keydown",function(de){if(!de.defaultPrevented){var we=de.which||de.keyCode,Pe=(ae.bindings[we]||[]).filter(function(z){return Q.match(de,z)});if(Pe.length!==0){var Me=ae.quill.getSelection();if(!(Me==null||!ae.quill.hasFocus())){var De=ae.quill.getLine(Me.index),ze=c(De,2),xt=ze[0],Je=ze[1],le=ae.quill.getLeaf(Me.index),he=c(le,2),_e=he[0],be=he[1],ve=Me.length===0?[_e,be]:ae.quill.getLeaf(Me.index+Me.length),Be=c(ve,2),Le=Be[0],Ee=Be[1],$e=_e instanceof T.default.Text?_e.value().slice(0,be):"",vt=Le instanceof T.default.Text?Le.value().slice(Ee):"",Ve={collapsed:Me.length===0,empty:Me.length===0&&xt.length()<=1,format:ae.quill.getFormat(Me),offset:Je,prefix:$e,suffix:vt},nn=Pe.some(function(z){if(z.collapsed!=null&&z.collapsed!==Ve.collapsed||z.empty!=null&&z.empty!==Ve.empty||z.offset!=null&&z.offset!==Ve.offset)return!1;if(Array.isArray(z.format)){if(z.format.every(function(ue){return Ve.format[ue]==null}))return!1}else if(l(z.format)==="object"&&!Object.keys(z.format).every(function(ue){return z.format[ue]===!0?Ve.format[ue]!=null:z.format[ue]===!1?Ve.format[ue]==null:(0,a.default)(z.format[ue],Ve.format[ue])}))return!1;return z.prefix!=null&&!z.prefix.test(Ve.prefix)||z.suffix!=null&&!z.suffix.test(Ve.suffix)?!1:z.handler.call(ae,Me,Ve)!==!0});nn&&de.preventDefault()}}}})}}]),Q}(L.default);ee.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},ee.DEFAULTS={bindings:{bold:ne("bold"),italic:ne("italic"),underline:ne("underline"),indent:{key:ee.keys.TAB,format:["blockquote","indent","list"],handler:function(Q,ie){if(ie.collapsed&&ie.offset!==0)return!0;this.quill.format("indent","+1",S.default.sources.USER)}},outdent:{key:ee.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(Q,ie){if(ie.collapsed&&ie.offset!==0)return!0;this.quill.format("indent","-1",S.default.sources.USER)}},"outdent backspace":{key:ee.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(Q,ie){ie.format.indent!=null?this.quill.format("indent","-1",S.default.sources.USER):ie.format.list!=null&&this.quill.format("list",!1,S.default.sources.USER)}},"indent code-block":G(!0),"outdent code-block":G(!1),"remove tab":{key:ee.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(Q){this.quill.deleteText(Q.index-1,1,S.default.sources.USER)}},tab:{key:ee.keys.TAB,handler:function(Q){this.quill.history.cutoff();var ie=new _.default().retain(Q.index).delete(Q.length).insert(" ");this.quill.updateContents(ie,S.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(Q.index+1,S.default.sources.SILENT)}},"list empty enter":{key:ee.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(Q,ie){this.quill.format("list",!1,S.default.sources.USER),ie.format.indent&&this.quill.format("indent",!1,S.default.sources.USER)}},"checklist enter":{key:ee.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(Q){var ie=this.quill.getLine(Q.index),ae=c(ie,2),de=ae[0],we=ae[1],Pe=(0,f.default)({},de.formats(),{list:"checked"}),Me=new _.default().retain(Q.index).insert(` `,Pe).retain(de.length()-we-1).retain(1,{list:"unchecked"});this.quill.updateContents(Me,S.default.sources.USER),this.quill.setSelection(Q.index+1,S.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:ee.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(Q,ie){var ae=this.quill.getLine(Q.index),de=c(ae,2),we=de[0],Pe=de[1],Me=new _.default().retain(Q.index).insert(` `,ie.format).retain(we.length()-Pe-1).retain(1,{header:null});this.quill.updateContents(Me,S.default.sources.USER),this.quill.setSelection(Q.index+1,S.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(Q,ie){var ae=ie.prefix.length,de=this.quill.getLine(Q.index),we=c(de,2),Pe=we[0],Me=we[1];if(Me>ae)return!0;var De=void 0;switch(ie.prefix.trim()){case"[]":case"[ ]":De="unchecked";break;case"[x]":De="checked";break;case"-":case"*":De="bullet";break;default:De="ordered"}this.quill.insertText(Q.index," ",S.default.sources.USER),this.quill.history.cutoff();var ze=new _.default().retain(Q.index-Me).delete(ae+1).retain(Pe.length()-2-Me).retain(1,{list:De});this.quill.updateContents(ze,S.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(Q.index-ae,S.default.sources.SILENT)}},"code exit":{key:ee.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(Q){var ie=this.quill.getLine(Q.index),ae=c(ie,2),de=ae[0],we=ae[1],Pe=new _.default().retain(Q.index+de.length()-we-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(Pe,S.default.sources.USER)}},"embed left":oe(ee.keys.LEFT,!1),"embed left shift":oe(ee.keys.LEFT,!0),"embed right":oe(ee.keys.RIGHT,!1),"embed right shift":oe(ee.keys.RIGHT,!0)}};function oe(U,Q){var ie,ae=U===ee.keys.LEFT?"prefix":"suffix";return ie={key:U,shiftKey:Q,altKey:null},k(ie,ae,/^$/),k(ie,"handler",function(we){var Pe=we.index;U===ee.keys.RIGHT&&(Pe+=we.length+1);var Me=this.quill.getLeaf(Pe),De=c(Me,1),ze=De[0];return ze instanceof T.default.Embed?(U===ee.keys.LEFT?Q?this.quill.setSelection(we.index-1,we.length+1,S.default.sources.USER):this.quill.setSelection(we.index-1,S.default.sources.USER):Q?this.quill.setSelection(we.index,we.length+1,S.default.sources.USER):this.quill.setSelection(we.index+we.length+1,S.default.sources.USER),!1):!0}),ie}function V(U,Q){if(!(U.index===0||this.quill.getLength()<=1)){var ie=this.quill.getLine(U.index),ae=c(ie,1),de=ae[0],we={};if(Q.offset===0){var Pe=this.quill.getLine(U.index-1),Me=c(Pe,1),De=Me[0];if(De!=null&&De.length()>1){var ze=de.formats(),xt=this.quill.getFormat(U.index-1,1);we=v.default.attributes.diff(ze,xt)||{}}}var Je=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(Q.prefix)?2:1;this.quill.deleteText(U.index-Je,Je,S.default.sources.USER),Object.keys(we).length>0&&this.quill.formatLine(U.index-Je,Je,we,S.default.sources.USER),this.quill.focus()}}function $(U,Q){var ie=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(Q.suffix)?2:1;if(!(U.index>=this.quill.getLength()-ie)){var ae={},de=0,we=this.quill.getLine(U.index),Pe=c(we,1),Me=Pe[0];if(Q.offset>=Me.length()-1){var De=this.quill.getLine(U.index+1),ze=c(De,1),xt=ze[0];if(xt){var Je=Me.formats(),le=this.quill.getFormat(U.index,1);ae=v.default.attributes.diff(Je,le)||{},de=xt.length()}}this.quill.deleteText(U.index,ie,S.default.sources.USER),Object.keys(ae).length>0&&this.quill.formatLine(U.index+de-1,ie,ae,S.default.sources.USER)}}function N(U){var Q=this.quill.getLines(U),ie={};if(Q.length>1){var ae=Q[0].formats(),de=Q[Q.length-1].formats();ie=v.default.attributes.diff(de,ae)||{}}this.quill.deleteText(U,S.default.sources.USER),Object.keys(ie).length>0&&this.quill.formatLine(U.index,1,ie,S.default.sources.USER),this.quill.setSelection(U.index,S.default.sources.SILENT),this.quill.focus()}function H(U,Q){var ie=this;U.length>0&&this.quill.scroll.deleteAt(U.index,U.length);var ae=Object.keys(Q.format).reduce(function(de,we){return T.default.query(we,T.default.Scope.BLOCK)&&!Array.isArray(Q.format[we])&&(de[we]=Q.format[we]),de},{});this.quill.insertText(U.index,` `,ae,S.default.sources.USER),this.quill.setSelection(U.index+1,S.default.sources.SILENT),this.quill.focus(),Object.keys(Q.format).forEach(function(de){ae[de]==null&&(Array.isArray(Q.format[de])||de!=="link"&&ie.quill.format(de,Q.format[de],S.default.sources.USER))})}function G(U){return{key:ee.keys.TAB,shiftKey:!U,format:{"code-block":!0},handler:function(ie){var ae=T.default.query("code-block"),de=ie.index,we=ie.length,Pe=this.quill.scroll.descendant(ae,de),Me=c(Pe,2),De=Me[0],ze=Me[1];if(De!=null){var xt=this.quill.getIndex(De),Je=De.newlineIndex(ze,!0)+1,le=De.newlineIndex(xt+ze+we),he=De.domNode.textContent.slice(Je,le).split(` `);ze=0,he.forEach(function(_e,be){U?(De.insertAt(Je+ze,ae.TAB),ze+=ae.TAB.length,be===0?de+=ae.TAB.length:we+=ae.TAB.length):_e.startsWith(ae.TAB)&&(De.deleteAt(Je+ze,ae.TAB.length),ze-=ae.TAB.length,be===0?de-=ae.TAB.length:we-=ae.TAB.length),ze+=_e.length+1}),this.quill.update(S.default.sources.USER),this.quill.setSelection(de,we,S.default.sources.SILENT)}}}}function ne(U){return{key:U[0].toUpperCase(),shortKey:!0,handler:function(ie,ae){this.quill.format(U,!ae.format[U],S.default.sources.USER)}}}function X(U){if(typeof U=="string"||typeof U=="number")return X({key:U});if((typeof U=="undefined"?"undefined":l(U))==="object"&&(U=(0,g.default)(U,!1)),typeof U.key=="string")if(ee.keys[U.key.toUpperCase()]!=null)U.key=ee.keys[U.key.toUpperCase()];else if(U.key.length===1)U.key=U.key.toUpperCase().charCodeAt(0);else return null;return U.shortKey&&(U[J]=U.shortKey,delete U.shortKey),U}n.default=ee,n.SHORTKEY=J},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function v(w,T){var x=[],S=!0,C=!1,A=void 0;try{for(var R=w[Symbol.iterator](),L;!(S=(L=R.next()).done)&&(x.push(L.value),!(T&&x.length===T));S=!0);}catch(M){C=!0,A=M}finally{try{!S&&R.return&&R.return()}finally{if(C)throw A}}return x}return function(w,T){if(Array.isArray(w))return w;if(Symbol.iterator in Object(w))return v(w,T);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function v(w,T,x){w===null&&(w=Function.prototype);var S=Object.getOwnPropertyDescriptor(w,T);if(S===void 0){var C=Object.getPrototypeOf(w);return C===null?void 0:v(C,T,x)}else{if("value"in S)return S.value;var A=S.get;return A===void 0?void 0:A.call(x)}},h=function(){function v(w,T){for(var x=0;x-1}n.default=f,n.sanitize=y},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},c=function(){function b(v,w){for(var T=0;T1&&arguments[1]!==void 0?arguments[1]:!1,x=this.container.querySelector(".ql-selected");if(w!==x&&(x!=null&&x.classList.remove("ql-selected"),w!=null&&(w.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(w.parentNode.children,w),w.hasAttribute("data-value")?this.label.setAttribute("data-value",w.getAttribute("data-value")):this.label.removeAttribute("data-value"),w.hasAttribute("data-label")?this.label.setAttribute("data-label",w.getAttribute("data-label")):this.label.removeAttribute("data-label"),T))){if(typeof Event=="function")this.select.dispatchEvent(new Event("change"));else if((typeof Event=="undefined"?"undefined":l(Event))==="object"){var S=document.createEvent("Event");S.initEvent("change",!0,!0),this.select.dispatchEvent(S)}this.close()}}},{key:"update",value:function(){var w=void 0;if(this.select.selectedIndex>-1){var T=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];w=this.select.options[this.select.selectedIndex],this.selectItem(T)}else this.selectItem(null);var x=w!=null&&w!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",x)}}]),b}();n.default=_},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=i(0),c=W(l),h=i(5),d=W(h),g=i(4),p=W(g),a=i(16),u=W(a),f=i(25),y=W(f),_=i(24),b=W(_),v=i(35),w=W(v),T=i(6),x=W(T),S=i(22),C=W(S),A=i(7),R=W(A),L=i(55),M=W(L),k=i(42),P=W(k),I=i(23),j=W(I);function W(J){return J&&J.__esModule?J:{default:J}}d.default.register({"blots/block":p.default,"blots/block/embed":g.BlockEmbed,"blots/break":u.default,"blots/container":y.default,"blots/cursor":b.default,"blots/embed":w.default,"blots/inline":x.default,"blots/scroll":C.default,"blots/text":R.default,"modules/clipboard":M.default,"modules/history":P.default,"modules/keyboard":j.default}),c.default.register(p.default,u.default,b.default,x.default,C.default,R.default),n.default=d.default},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=i(1),c=function(){function h(d){this.domNode=d,this.domNode[l.DATA_KEY]={blot:this}}return Object.defineProperty(h.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),h.create=function(d){if(this.tagName==null)throw new l.ParchmentError("Blot definition missing tagName");var g;return Array.isArray(this.tagName)?(typeof d=="string"&&(d=d.toUpperCase(),parseInt(d).toString()===d&&(d=parseInt(d))),typeof d=="number"?g=document.createElement(this.tagName[d-1]):this.tagName.indexOf(d)>-1?g=document.createElement(d):g=document.createElement(this.tagName[0])):g=document.createElement(this.tagName),this.className&&g.classList.add(this.className),g},h.prototype.attach=function(){this.parent!=null&&(this.scroll=this.parent.scroll)},h.prototype.clone=function(){var d=this.domNode.cloneNode(!1);return l.create(d)},h.prototype.detach=function(){this.parent!=null&&this.parent.removeChild(this),delete this.domNode[l.DATA_KEY]},h.prototype.deleteAt=function(d,g){var p=this.isolate(d,g);p.remove()},h.prototype.formatAt=function(d,g,p,a){var u=this.isolate(d,g);if(l.query(p,l.Scope.BLOT)!=null&&a)u.wrap(p,a);else if(l.query(p,l.Scope.ATTRIBUTE)!=null){var f=l.create(this.statics.scope);u.wrap(f),f.format(p,a)}},h.prototype.insertAt=function(d,g,p){var a=p==null?l.create("text",g):l.create(g,p),u=this.split(d);this.parent.insertBefore(a,u)},h.prototype.insertInto=function(d,g){g===void 0&&(g=null),this.parent!=null&&this.parent.children.remove(this);var p=null;d.children.insertBefore(this,g),g!=null&&(p=g.domNode),(this.domNode.parentNode!=d.domNode||this.domNode.nextSibling!=p)&&d.domNode.insertBefore(this.domNode,p),this.parent=d,this.attach()},h.prototype.isolate=function(d,g){var p=this.split(d);return p.split(g),p},h.prototype.length=function(){return 1},h.prototype.offset=function(d){return d===void 0&&(d=this.parent),this.parent==null||this==d?0:this.parent.children.offset(this)+this.parent.offset(d)},h.prototype.optimize=function(d){this.domNode[l.DATA_KEY]!=null&&delete this.domNode[l.DATA_KEY].mutations},h.prototype.remove=function(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},h.prototype.replace=function(d){d.parent!=null&&(d.parent.insertBefore(this,d.next),d.remove())},h.prototype.replaceWith=function(d,g){var p=typeof d=="string"?l.create(d,g):d;return p.replace(this),p},h.prototype.split=function(d,g){return d===0?this:this.next},h.prototype.update=function(d,g){},h.prototype.wrap=function(d,g){var p=typeof d=="string"?l.create(d,g):d;return this.parent!=null&&this.parent.insertBefore(p,this.next),p.appendChild(this),p},h.blotName="abstract",h}();n.default=c},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=i(12),c=i(32),h=i(33),d=i(1),g=function(){function p(a){this.attributes={},this.domNode=a,this.build()}return p.prototype.attribute=function(a,u){u?a.add(this.domNode,u)&&(a.value(this.domNode)!=null?this.attributes[a.attrName]=a:delete this.attributes[a.attrName]):(a.remove(this.domNode),delete this.attributes[a.attrName])},p.prototype.build=function(){var a=this;this.attributes={};var u=l.default.keys(this.domNode),f=c.default.keys(this.domNode),y=h.default.keys(this.domNode);u.concat(f).concat(y).forEach(function(_){var b=d.query(_,d.Scope.ATTRIBUTE);b instanceof l.default&&(a.attributes[b.attrName]=b)})},p.prototype.copy=function(a){var u=this;Object.keys(this.attributes).forEach(function(f){var y=u.attributes[f].value(u.domNode);a.format(f,y)})},p.prototype.move=function(a){var u=this;this.copy(a),Object.keys(this.attributes).forEach(function(f){u.attributes[f].remove(u.domNode)}),this.attributes={}},p.prototype.values=function(){var a=this;return Object.keys(this.attributes).reduce(function(u,f){return u[f]=a.attributes[f].value(a.domNode),u},{})},p}();n.default=g},function(e,n,i){var l=this&&this.__extends||function(){var g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,a){p.__proto__=a}||function(p,a){for(var u in a)a.hasOwnProperty(u)&&(p[u]=a[u])};return function(p,a){g(p,a);function u(){this.constructor=p}p.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}();Object.defineProperty(n,"__esModule",{value:!0});var c=i(12);function h(g,p){var a=g.getAttribute("class")||"";return a.split(/\s+/).filter(function(u){return u.indexOf(p+"-")===0})}var d=function(g){l(p,g);function p(){return g!==null&&g.apply(this,arguments)||this}return p.keys=function(a){return(a.getAttribute("class")||"").split(/\s+/).map(function(u){return u.split("-").slice(0,-1).join("-")})},p.prototype.add=function(a,u){return this.canAdd(a,u)?(this.remove(a),a.classList.add(this.keyName+"-"+u),!0):!1},p.prototype.remove=function(a){var u=h(a,this.keyName);u.forEach(function(f){a.classList.remove(f)}),a.classList.length===0&&a.removeAttribute("class")},p.prototype.value=function(a){var u=h(a,this.keyName)[0]||"",f=u.slice(this.keyName.length+1);return this.canAdd(a,f)?f:""},p}(c.default);n.default=d},function(e,n,i){var l=this&&this.__extends||function(){var g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,a){p.__proto__=a}||function(p,a){for(var u in a)a.hasOwnProperty(u)&&(p[u]=a[u])};return function(p,a){g(p,a);function u(){this.constructor=p}p.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}();Object.defineProperty(n,"__esModule",{value:!0});var c=i(12);function h(g){var p=g.split("-"),a=p.slice(1).map(function(u){return u[0].toUpperCase()+u.slice(1)}).join("");return p[0]+a}var d=function(g){l(p,g);function p(){return g!==null&&g.apply(this,arguments)||this}return p.keys=function(a){return(a.getAttribute("style")||"").split(";").map(function(u){var f=u.split(":");return f[0].trim()})},p.prototype.add=function(a,u){return this.canAdd(a,u)?(a.style[h(this.keyName)]=u,!0):!1},p.prototype.remove=function(a){a.style[h(this.keyName)]="",a.getAttribute("style")||a.removeAttribute("style")},p.prototype.value=function(a){var u=a.style[h(this.keyName)];return this.canAdd(a,u)?u:""},p}(c.default);n.default=d},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function d(g,p){for(var a=0;aL&&this.stack.undo.length>0){var M=this.stack.undo.pop();R=R.compose(M.undo),C=M.redo.compose(C)}else this.lastRecorded=L;this.stack.undo.push({redo:C,undo:R}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(C){this.stack.undo.forEach(function(A){A.undo=C.transform(A.undo,!0),A.redo=C.transform(A.redo,!0)}),this.stack.redo.forEach(function(A){A.undo=C.transform(A.undo,!0),A.redo=C.transform(A.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),x}(a.default);b.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};function v(T){var x=T.ops[T.ops.length-1];return x==null?!1:x.insert!=null?typeof x.insert=="string"&&x.insert.endsWith(` `):x.attributes!=null?Object.keys(x.attributes).some(function(S){return h.default.query(S,h.default.Scope.BLOCK)!=null}):!1}function w(T){var x=T.reduce(function(C,A){return C+=A.delete||0,C},0),S=T.length()-x;return v(T)&&(S-=1),S}n.default=b,n.getLastChangeIndex=w},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BaseTooltip=void 0;var l=function(){function H(G,ne){for(var X=0;X0&&arguments[0]!==void 0?arguments[0]:"link",U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),U!=null?this.textbox.value=U:X!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+X)||""),this.root.setAttribute("data-mode",X)}},{key:"restoreFocus",value:function(){var X=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=X}},{key:"save",value:function(){var X=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":{var U=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",X,u.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",X,u.default.sources.USER)),this.quill.root.scrollTop=U;break}case"video":X=$(X);case"formula":{if(!X)break;var Q=this.quill.getSelection(!0);if(Q!=null){var ie=Q.index+Q.length;this.quill.insertEmbed(ie,this.root.getAttribute("data-mode"),X,u.default.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(ie+1," ",u.default.sources.USER),this.quill.setSelection(ie+2,u.default.sources.USER)}break}}this.textbox.value="",this.hide()}}]),G}(R.default);function $(H){var G=H.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||H.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return G?(G[1]||"https")+"://www.youtube.com/embed/"+G[2]+"?showinfo=0":(G=H.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(G[1]||"https")+"://player.vimeo.com/video/"+G[2]+"/":H}function N(H,G){var ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;G.forEach(function(X){var U=document.createElement("option");X===ne?U.setAttribute("selected","selected"):U.setAttribute("value",X),H.appendChild(U)})}n.BaseTooltip=V,n.default=oe},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function c(){this.head=this.tail=null,this.length=0}return c.prototype.append=function(){for(var h=[],d=0;d1&&this.append.apply(this,h.slice(1))},c.prototype.contains=function(h){for(var d,g=this.iterator();d=g();)if(d===h)return!0;return!1},c.prototype.insertBefore=function(h,d){h&&(h.next=d,d!=null?(h.prev=d.prev,d.prev!=null&&(d.prev.next=h),d.prev=h,d===this.head&&(this.head=h)):this.tail!=null?(this.tail.next=h,h.prev=this.tail,this.tail=h):(h.prev=null,this.head=this.tail=h),this.length+=1)},c.prototype.offset=function(h){for(var d=0,g=this.head;g!=null;){if(g===h)return d;d+=g.length(),g=g.next}return-1},c.prototype.remove=function(h){this.contains(h)&&(h.prev!=null&&(h.prev.next=h.next),h.next!=null&&(h.next.prev=h.prev),h===this.head&&(this.head=h.next),h===this.tail&&(this.tail=h.prev),this.length-=1)},c.prototype.iterator=function(h){return h===void 0&&(h=this.head),function(){var d=h;return h!=null&&(h=h.next),d}},c.prototype.find=function(h,d){d===void 0&&(d=!1);for(var g,p=this.iterator();g=p();){var a=g.length();if(hy?g(f,h-y,Math.min(d,y+b-h)):g(f,0,Math.min(b,h+d-y)),y+=b}},c.prototype.map=function(h){return this.reduce(function(d,g){return d.push(h(g)),d},[])},c.prototype.reduce=function(h,d){for(var g,p=this.iterator();g=p();)d=h(d,g);return d},c}();n.default=l},function(e,n,i){var l=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var y in f)f.hasOwnProperty(y)&&(u[y]=f[y])};return function(u,f){a(u,f);function y(){this.constructor=u}u.prototype=f===null?Object.create(f):(y.prototype=f.prototype,new y)}}();Object.defineProperty(n,"__esModule",{value:!0});var c=i(17),h=i(1),d={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},g=100,p=function(a){l(u,a);function u(f){var y=a.call(this,f)||this;return y.scroll=y,y.observer=new MutationObserver(function(_){y.update(_)}),y.observer.observe(y.domNode,d),y.attach(),y}return u.prototype.detach=function(){a.prototype.detach.call(this),this.observer.disconnect()},u.prototype.deleteAt=function(f,y){this.update(),f===0&&y===this.length()?this.children.forEach(function(_){_.remove()}):a.prototype.deleteAt.call(this,f,y)},u.prototype.formatAt=function(f,y,_,b){this.update(),a.prototype.formatAt.call(this,f,y,_,b)},u.prototype.insertAt=function(f,y,_){this.update(),a.prototype.insertAt.call(this,f,y,_)},u.prototype.optimize=function(f,y){var _=this;f===void 0&&(f=[]),y===void 0&&(y={}),a.prototype.optimize.call(this,y);for(var b=[].slice.call(this.observer.takeRecords());b.length>0;)f.push(b.pop());for(var v=function(S,C){C===void 0&&(C=!0),!(S==null||S===_)&&S.domNode.parentNode!=null&&(S.domNode[h.DATA_KEY].mutations==null&&(S.domNode[h.DATA_KEY].mutations=[]),C&&v(S.parent))},w=function(S){S.domNode[h.DATA_KEY]==null||S.domNode[h.DATA_KEY].mutations==null||(S instanceof c.default&&S.children.forEach(w),S.optimize(y))},T=f,x=0;T.length>0;x+=1){if(x>=g)throw new Error("[Parchment] Maximum optimize iterations reached");for(T.forEach(function(S){var C=h.find(S.target,!0);C!=null&&(C.domNode===S.target&&(S.type==="childList"?(v(h.find(S.previousSibling,!1)),[].forEach.call(S.addedNodes,function(A){var R=h.find(A,!1);v(R,!1),R instanceof c.default&&R.children.forEach(function(L){v(L,!1)})})):S.type==="attributes"&&v(C.prev)),v(C))}),this.children.forEach(w),T=[].slice.call(this.observer.takeRecords()),b=T.slice();b.length>0;)f.push(b.pop())}},u.prototype.update=function(f,y){var _=this;y===void 0&&(y={}),f=f||this.observer.takeRecords(),f.map(function(b){var v=h.find(b.target,!0);return v==null?null:v.domNode[h.DATA_KEY].mutations==null?(v.domNode[h.DATA_KEY].mutations=[b],v):(v.domNode[h.DATA_KEY].mutations.push(b),null)}).forEach(function(b){b==null||b===_||b.domNode[h.DATA_KEY]==null||b.update(b.domNode[h.DATA_KEY].mutations||[],y)}),this.domNode[h.DATA_KEY].mutations!=null&&a.prototype.update.call(this,this.domNode[h.DATA_KEY].mutations,y),this.optimize(f,y)},u.blotName="scroll",u.defaultChild="block",u.scope=h.Scope.BLOCK_BLOT,u.tagName="DIV",u}(c.default);n.default=p},function(e,n,i){var l=this&&this.__extends||function(){var p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var f in u)u.hasOwnProperty(f)&&(a[f]=u[f])};return function(a,u){p(a,u);function f(){this.constructor=a}a.prototype=u===null?Object.create(u):(f.prototype=u.prototype,new f)}}();Object.defineProperty(n,"__esModule",{value:!0});var c=i(18),h=i(1);function d(p,a){if(Object.keys(p).length!==Object.keys(a).length)return!1;for(var u in p)if(p[u]!==a[u])return!1;return!0}var g=function(p){l(a,p);function a(){return p!==null&&p.apply(this,arguments)||this}return a.formats=function(u){if(u.tagName!==a.tagName)return p.formats.call(this,u)},a.prototype.format=function(u,f){var y=this;u===this.statics.blotName&&!f?(this.children.forEach(function(_){_ instanceof c.default||(_=_.wrap(a.blotName,!0)),y.attributes.copy(_)}),this.unwrap()):p.prototype.format.call(this,u,f)},a.prototype.formatAt=function(u,f,y,_){if(this.formats()[y]!=null||h.query(y,h.Scope.ATTRIBUTE)){var b=this.isolate(u,f);b.format(y,_)}else p.prototype.formatAt.call(this,u,f,y,_)},a.prototype.optimize=function(u){p.prototype.optimize.call(this,u);var f=this.formats();if(Object.keys(f).length===0)return this.unwrap();var y=this.next;y instanceof a&&y.prev===this&&d(f,y.formats())&&(y.moveChildren(this),y.remove())},a.blotName="inline",a.scope=h.Scope.INLINE_BLOT,a.tagName="SPAN",a}(c.default);n.default=g},function(e,n,i){var l=this&&this.__extends||function(){var g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,a){p.__proto__=a}||function(p,a){for(var u in a)a.hasOwnProperty(u)&&(p[u]=a[u])};return function(p,a){g(p,a);function u(){this.constructor=p}p.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}();Object.defineProperty(n,"__esModule",{value:!0});var c=i(18),h=i(1),d=function(g){l(p,g);function p(){return g!==null&&g.apply(this,arguments)||this}return p.formats=function(a){var u=h.query(p.blotName).tagName;if(a.tagName!==u)return g.formats.call(this,a)},p.prototype.format=function(a,u){h.query(a,h.Scope.BLOCK)!=null&&(a===this.statics.blotName&&!u?this.replaceWith(p.blotName):g.prototype.format.call(this,a,u))},p.prototype.formatAt=function(a,u,f,y){h.query(f,h.Scope.BLOCK)!=null?this.format(f,y):g.prototype.formatAt.call(this,a,u,f,y)},p.prototype.insertAt=function(a,u,f){if(f==null||h.query(u,h.Scope.INLINE)!=null)g.prototype.insertAt.call(this,a,u,f);else{var y=this.split(a),_=h.create(u,f);y.parent.insertBefore(_,y)}},p.prototype.update=function(a,u){navigator.userAgent.match(/Trident/)?this.build():g.prototype.update.call(this,a,u)},p.blotName="block",p.scope=h.Scope.BLOCK_BLOT,p.tagName="P",p}(c.default);n.default=d},function(e,n,i){var l=this&&this.__extends||function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,p){g.__proto__=p}||function(g,p){for(var a in p)p.hasOwnProperty(a)&&(g[a]=p[a])};return function(g,p){d(g,p);function a(){this.constructor=g}g.prototype=p===null?Object.create(p):(a.prototype=p.prototype,new a)}}();Object.defineProperty(n,"__esModule",{value:!0});var c=i(19),h=function(d){l(g,d);function g(){return d!==null&&d.apply(this,arguments)||this}return g.formats=function(p){},g.prototype.format=function(p,a){d.prototype.formatAt.call(this,0,this.length(),p,a)},g.prototype.formatAt=function(p,a,u,f){p===0&&a===this.length()?this.format(u,f):d.prototype.formatAt.call(this,p,a,u,f)},g.prototype.formats=function(){return this.statics.formats(this.domNode)},g}(c.default);n.default=h},function(e,n,i){var l=this&&this.__extends||function(){var g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,a){p.__proto__=a}||function(p,a){for(var u in a)a.hasOwnProperty(u)&&(p[u]=a[u])};return function(p,a){g(p,a);function u(){this.constructor=p}p.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}();Object.defineProperty(n,"__esModule",{value:!0});var c=i(19),h=i(1),d=function(g){l(p,g);function p(a){var u=g.call(this,a)||this;return u.text=u.statics.value(u.domNode),u}return p.create=function(a){return document.createTextNode(a)},p.value=function(a){var u=a.data;return u.normalize&&(u=u.normalize()),u},p.prototype.deleteAt=function(a,u){this.domNode.data=this.text=this.text.slice(0,a)+this.text.slice(a+u)},p.prototype.index=function(a,u){return this.domNode===a?u:-1},p.prototype.insertAt=function(a,u,f){f==null?(this.text=this.text.slice(0,a)+u+this.text.slice(a),this.domNode.data=this.text):g.prototype.insertAt.call(this,a,u,f)},p.prototype.length=function(){return this.text.length},p.prototype.optimize=function(a){g.prototype.optimize.call(this,a),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof p&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},p.prototype.position=function(a,u){return[this.domNode,a]},p.prototype.split=function(a,u){if(u===void 0&&(u=!1),!u){if(a===0)return this;if(a===this.length())return this.next}var f=h.create(this.domNode.splitText(a));return this.parent.insertBefore(f,this.next),this.text=this.statics.value(this.domNode),f},p.prototype.update=function(a,u){var f=this;a.some(function(y){return y.type==="characterData"&&y.target===f.domNode})&&(this.text=this.statics.value(this.domNode))},p.prototype.value=function(){return this.text},p.blotName="text",p.scope=h.Scope.INLINE_BLOT,p}(c.default);n.default=d},function(e,n,i){var l=document.createElement("div");if(l.classList.toggle("test-class",!1),l.classList.contains("test-class")){var c=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(h,d){return arguments.length>1&&!this.contains(h)==!d?d:c.call(this,h)}}String.prototype.startsWith||(String.prototype.startsWith=function(h,d){return d=d||0,this.substr(d,h.length)===h}),String.prototype.endsWith||(String.prototype.endsWith=function(h,d){var g=this.toString();(typeof d!="number"||!isFinite(d)||Math.floor(d)!==d||d>g.length)&&(d=g.length),d-=h.length;var p=g.indexOf(h,d);return p!==-1&&p===d}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(d){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof d!="function")throw new TypeError("predicate must be a function");for(var g=Object(this),p=g.length>>>0,a=arguments[1],u,f=0;fS.length?x:S,R=x.length>S.length?S:x,L=A.indexOf(R);if(L!=-1)return C=[[l,A.substring(0,L)],[c,R],[l,A.substring(L+R.length)]],x.length>S.length&&(C[0][0]=C[2][0]=i),C;if(R.length==1)return[[i,x],[l,S]];var M=f(x,S);if(M){var k=M[0],P=M[1],I=M[2],j=M[3],W=M[4],J=h(k,I),ee=h(P,j);return J.concat([[c,W]],ee)}return g(x,S)}function g(x,S){for(var C=x.length,A=S.length,R=Math.ceil((C+A)/2),L=R,M=2*R,k=new Array(M),P=new Array(M),I=0;IC)ee+=2;else if(ne>A)J+=2;else if(W){var X=L+j-N;if(X>=0&&X=U)return p(x,S,G,ne)}}}for(var Q=-$+oe;Q<=$-V;Q+=2){var X=L+Q,U;Q==-$||Q!=$&&P[X-1]C)V+=2;else if(ie>A)oe+=2;else if(!W){var H=L+j-Q;if(H>=0&&H=U)return p(x,S,G,ne)}}}}return[[i,x],[l,S]]}function p(x,S,C,A){var R=x.substring(0,C),L=S.substring(0,A),M=x.substring(C),k=S.substring(A),P=h(R,L),I=h(M,k);return P.concat(I)}function a(x,S){if(!x||!S||x.charAt(0)!=S.charAt(0))return 0;for(var C=0,A=Math.min(x.length,S.length),R=A,L=0;CS.length?x:S,A=x.length>S.length?S:x;if(C.length<4||A.length*2=ee.length?[G,ne,X,U,H]:null}var L=R(C,A,Math.ceil(C.length/4)),M=R(C,A,Math.ceil(C.length/2)),k;if(!L&&!M)return null;M?L?k=L[4].length>M[4].length?L:M:k=M:k=L;var P,I,j,W;x.length>S.length?(P=k[0],I=k[1],j=k[2],W=k[3]):(j=k[0],W=k[1],P=k[2],I=k[3]);var J=k[4];return[P,I,j,W,J]}function y(x){x.push([c,""]);for(var S=0,C=0,A=0,R="",L="",M;S1?(C!==0&&A!==0&&(M=a(L,R),M!==0&&(S-C-A>0&&x[S-C-A-1][0]==c?x[S-C-A-1][1]+=L.substring(0,M):(x.splice(0,0,[c,L.substring(0,M)]),S++),L=L.substring(M),R=R.substring(M)),M=u(L,R),M!==0&&(x[S][1]=L.substring(L.length-M)+x[S][1],L=L.substring(0,L.length-M),R=R.substring(0,R.length-M))),C===0?x.splice(S-A,C+A,[l,L]):A===0?x.splice(S-C,C+A,[i,R]):x.splice(S-C-A,C+A,[i,R],[l,L]),S=S-C-A+(C?1:0)+(A?1:0)+1):S!==0&&x[S-1][0]==c?(x[S-1][1]+=x[S][1],x.splice(S,1)):S++,A=0,C=0,R="",L="";break}x[x.length-1][1]===""&&x.pop();var k=!1;for(S=1;S0&&A.splice(R+2,0,[M[0],k]),T(A,R,3)}else return x}function w(x){for(var S=!1,C=function(M){return M.charCodeAt(0)>=56320&&M.charCodeAt(0)<=57343},A=function(M){return M.charCodeAt(M.length-1)>=55296&&M.charCodeAt(M.length-1)<=56319},R=2;R0&&L.push(x[R]);return L}function T(x,S,C){for(var A=S+C-1;A>=0&&A>=S-1;A--)if(A+1\r?\n +\<"),this.convert();var ve=this.quill.getFormat(this.quill.selection.savedRange.index);if(ve[A.default.blotName]){var Be=this.container.innerText;return this.container.innerHTML="",new a.default().insert(Be,I({},A.default.blotName,ve[A.default.blotName]))}var Le=this.prepareMatching(),Ee=c(Le,2),$e=Ee[0],vt=Ee[1],Ve=Q(this.container,$e,vt);return X(Ve,` `)&&Ve.ops[Ve.ops.length-1].attributes==null&&(Ve=Ve.compose(new a.default().retain(Ve.length()-1).delete(1))),ee.log("convert",this.container.innerHTML,Ve),this.container.innerHTML="",Ve}},{key:"dangerouslyPasteHTML",value:function(be,ve){var Be=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_.default.sources.API;if(typeof be=="string")this.quill.setContents(this.convert(be),ve),this.quill.setSelection(0,_.default.sources.SILENT);else{var Le=this.convert(ve);this.quill.updateContents(new a.default().retain(be).concat(Le),Be),this.quill.setSelection(be+Le.length(),_.default.sources.SILENT)}}},{key:"onPaste",value:function(be){var ve=this;if(!(be.defaultPrevented||!this.quill.isEnabled())){var Be=this.quill.getSelection(),Le=new a.default().retain(Be.index),Ee=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(_.default.sources.SILENT),setTimeout(function(){Le=Le.concat(ve.convert()).delete(Be.length),ve.quill.updateContents(Le,_.default.sources.USER),ve.quill.setSelection(Le.length()-Be.length,_.default.sources.SILENT),ve.quill.scrollingContainer.scrollTop=Ee,ve.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var be=this,ve=[],Be=[];return this.matchers.forEach(function(Le){var Ee=c(Le,2),$e=Ee[0],vt=Ee[1];switch($e){case Node.TEXT_NODE:Be.push(vt);break;case Node.ELEMENT_NODE:ve.push(vt);break;default:[].forEach.call(be.container.querySelectorAll($e),function(Ve){Ve[oe]=Ve[oe]||[],Ve[oe].push(vt)});break}}),[ve,Be]}}]),he}(T.default);H.DEFAULTS={matchers:[],matchVisual:!0};function G(le,he,_e){return(typeof he=="undefined"?"undefined":l(he))==="object"?Object.keys(he).reduce(function(be,ve){return G(be,ve,he[ve])},le):le.reduce(function(be,ve){return ve.attributes&&ve.attributes[he]?be.push(ve):be.insert(ve.insert,(0,g.default)({},I({},he,_e),ve.attributes))},new a.default)}function ne(le){if(le.nodeType!==Node.ELEMENT_NODE)return{};var he="__ql-computed-style";return le[he]||(le[he]=window.getComputedStyle(le))}function X(le,he){for(var _e="",be=le.ops.length-1;be>=0&&_e.length-1}function Q(le,he,_e){return le.nodeType===le.TEXT_NODE?_e.reduce(function(be,ve){return ve(le,be)},new a.default):le.nodeType===le.ELEMENT_NODE?[].reduce.call(le.childNodes||[],function(be,ve){var Be=Q(ve,he,_e);return ve.nodeType===le.ELEMENT_NODE&&(Be=he.reduce(function(Le,Ee){return Ee(ve,Le)},Be),Be=(ve[oe]||[]).reduce(function(Le,Ee){return Ee(ve,Le)},Be)),be.concat(Be)},new a.default):new a.default}function ie(le,he,_e){return G(_e,le,!0)}function ae(le,he){var _e=f.default.Attributor.Attribute.keys(le),be=f.default.Attributor.Class.keys(le),ve=f.default.Attributor.Style.keys(le),Be={};return _e.concat(be).concat(ve).forEach(function(Le){var Ee=f.default.query(Le,f.default.Scope.ATTRIBUTE);Ee!=null&&(Be[Ee.attrName]=Ee.value(le),Be[Ee.attrName])||(Ee=$[Le],Ee!=null&&(Ee.attrName===Le||Ee.keyName===Le)&&(Be[Ee.attrName]=Ee.value(le)||void 0),Ee=N[Le],Ee!=null&&(Ee.attrName===Le||Ee.keyName===Le)&&(Ee=N[Le],Be[Ee.attrName]=Ee.value(le)||void 0))}),Object.keys(Be).length>0&&(he=G(he,Be)),he}function de(le,he){var _e=f.default.query(le);if(_e==null)return he;if(_e.prototype instanceof f.default.Embed){var be={},ve=_e.value(le);ve!=null&&(be[_e.blotName]=ve,he=new a.default().insert(be,_e.formats(le)))}else typeof _e.formats=="function"&&(he=G(he,_e.blotName,_e.formats(le)));return he}function we(le,he){return X(he,` `)||he.insert(` `),he}function Pe(){return new a.default}function Me(le,he){var _e=f.default.query(le);if(_e==null||_e.blotName!=="list-item"||!X(he,` `))return he;for(var be=-1,ve=le.parentNode;!ve.classList.contains("ql-clipboard");)(f.default.query(ve)||{}).blotName==="list"&&(be+=1),ve=ve.parentNode;return be<=0?he:he.compose(new a.default().retain(he.length()-1).retain(1,{indent:be}))}function De(le,he){return X(he,` `)||(U(le)||he.length()>0&&le.nextSibling&&U(le.nextSibling))&&he.insert(` `),he}function ze(le,he){if(U(le)&&le.nextElementSibling!=null&&!X(he,` `)){var _e=le.offsetHeight+parseFloat(ne(le).marginTop)+parseFloat(ne(le).marginBottom);le.nextElementSibling.offsetTop>le.offsetTop+_e*1.5&&he.insert(` `)}return he}function xt(le,he){var _e={},be=le.style||{};return be.fontStyle&&ne(le).fontStyle==="italic"&&(_e.italic=!0),be.fontWeight&&(ne(le).fontWeight.startsWith("bold")||parseInt(ne(le).fontWeight)>=700)&&(_e.bold=!0),Object.keys(_e).length>0&&(he=G(he,_e)),parseFloat(be.textIndent||0)>0&&(he=new a.default().insert(" ").concat(he)),he}function Je(le,he){var _e=le.data;if(le.parentNode.tagName==="O:P")return he.insert(_e.trim());if(_e.trim().length===0&&le.parentNode.classList.contains("ql-clipboard"))return he;if(!ne(le.parentNode).whiteSpace.startsWith("pre")){var be=function(Be,Le){return Le=Le.replace(/[^\u00a0]/g,""),Le.length<1&&Be?" ":Le};_e=_e.replace(/\r\n/g," ").replace(/\n/g," "),_e=_e.replace(/\s\s+/g,be.bind(be,!0)),(le.previousSibling==null&&U(le.parentNode)||le.previousSibling!=null&&U(le.previousSibling))&&(_e=_e.replace(/^\s+/,be.bind(be,!1))),(le.nextSibling==null&&U(le.parentNode)||le.nextSibling!=null&&U(le.nextSibling))&&(_e=_e.replace(/\s+$/,be.bind(be,!1)))}return he.insert(_e)}n.default=H,n.matchAttributor=ae,n.matchBlot=de,n.matchNewline=De,n.matchSpacing=ze,n.matchText=Je},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function y(_,b){for(var v=0;v '},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function y(_,b){for(var v=0;vf.right&&(_=f.right-y.right,this.root.style.left=a+_+"px"),y.leftf.bottom){var b=y.bottom-y.top,v=p.bottom-p.top+b;this.root.style.top=u-v+"px",this.root.classList.add("ql-flip")}return _}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),d}();n.default=h},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function M(k,P){var I=[],j=!0,W=!1,J=void 0;try{for(var ee=k[Symbol.iterator](),oe;!(j=(oe=ee.next()).done)&&(I.push(oe.value),!(P&&I.length===P));j=!0);}catch(V){W=!0,J=V}finally{try{!j&&ee.return&&ee.return()}finally{if(W)throw J}}return I}return function(k,P){if(Array.isArray(k))return k;if(Symbol.iterator in Object(k))return M(k,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function M(k,P,I){k===null&&(k=Function.prototype);var j=Object.getOwnPropertyDescriptor(k,P);if(j===void 0){var W=Object.getPrototypeOf(k);return W===null?void 0:M(W,P,I)}else{if("value"in j)return j.value;var J=j.get;return J===void 0?void 0:J.call(I)}},h=function(){function M(k,P){for(var I=0;I','','',''].join(""),n.default=R},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=i(29),c=ve(l),h=i(36),d=i(38),g=i(64),p=i(65),a=ve(p),u=i(66),f=ve(u),y=i(67),_=ve(y),b=i(37),v=i(26),w=i(39),T=i(40),x=i(56),S=ve(x),C=i(68),A=ve(C),R=i(27),L=ve(R),M=i(69),k=ve(M),P=i(70),I=ve(P),j=i(71),W=ve(j),J=i(72),ee=ve(J),oe=i(73),V=ve(oe),$=i(13),N=ve($),H=i(74),G=ve(H),ne=i(75),X=ve(ne),U=i(57),Q=ve(U),ie=i(41),ae=ve(ie),de=i(28),we=ve(de),Pe=i(59),Me=ve(Pe),De=i(60),ze=ve(De),xt=i(61),Je=ve(xt),le=i(108),he=ve(le),_e=i(62),be=ve(_e);function ve(Be){return Be&&Be.__esModule?Be:{default:Be}}c.default.register({"attributors/attribute/direction":d.DirectionAttribute,"attributors/class/align":h.AlignClass,"attributors/class/background":b.BackgroundClass,"attributors/class/color":v.ColorClass,"attributors/class/direction":d.DirectionClass,"attributors/class/font":w.FontClass,"attributors/class/size":T.SizeClass,"attributors/style/align":h.AlignStyle,"attributors/style/background":b.BackgroundStyle,"attributors/style/color":v.ColorStyle,"attributors/style/direction":d.DirectionStyle,"attributors/style/font":w.FontStyle,"attributors/style/size":T.SizeStyle},!0),c.default.register({"formats/align":h.AlignClass,"formats/direction":d.DirectionClass,"formats/indent":g.IndentClass,"formats/background":b.BackgroundStyle,"formats/color":v.ColorStyle,"formats/font":w.FontClass,"formats/size":T.SizeClass,"formats/blockquote":a.default,"formats/code-block":N.default,"formats/header":f.default,"formats/list":_.default,"formats/bold":S.default,"formats/code":$.Code,"formats/italic":A.default,"formats/link":L.default,"formats/script":k.default,"formats/strike":I.default,"formats/underline":W.default,"formats/image":ee.default,"formats/video":V.default,"formats/list/item":y.ListItem,"modules/formula":G.default,"modules/syntax":X.default,"modules/toolbar":Q.default,"themes/bubble":he.default,"themes/snow":be.default,"ui/icons":ae.default,"ui/picker":we.default,"ui/icon-picker":ze.default,"ui/color-picker":Me.default,"ui/tooltip":Je.default},!0),n.default=c.default},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.IndentClass=void 0;var l=function(){function _(b,v){for(var w=0;w0&&this.children.tail.format(A,R)}},{key:"formats",value:function(){return y({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:"insertBefore",value:function(A,R){if(A instanceof w)c(S.prototype.__proto__||Object.getPrototypeOf(S.prototype),"insertBefore",this).call(this,A,R);else{var L=R==null?this.length():R.offset(this),M=this.split(L);M.parent.insertBefore(A,M)}}},{key:"optimize",value:function(A){c(S.prototype.__proto__||Object.getPrototypeOf(S.prototype),"optimize",this).call(this,A);var R=this.next;R!=null&&R.prev===this&&R.statics.blotName===this.statics.blotName&&R.domNode.tagName===this.domNode.tagName&&R.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(R.moveChildren(this),R.remove())}},{key:"replace",value:function(A){if(A.statics.blotName!==this.statics.blotName){var R=d.default.create(this.statics.defaultChild);A.moveChildren(R),this.appendChild(R)}c(S.prototype.__proto__||Object.getPrototypeOf(S.prototype),"replace",this).call(this,A)}}]),S}(u.default);T.blotName="list",T.scope=d.default.Scope.BLOCK_BLOT,T.tagName=["OL","UL"],T.defaultChild="list-item",T.allowedChildren=[w],n.ListItem=w,n.default=T},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=i(56),c=h(l);function h(u){return u&&u.__esModule?u:{default:u}}function d(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}function g(u,f){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:u}function p(u,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);u.prototype=Object.create(f&&f.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(u,f):u.__proto__=f)}var a=function(u){p(f,u);function f(){return d(this,f),g(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(c.default);a.blotName="italic",a.tagName=["EM","I"],n.default=a},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function y(_,b){for(var v=0;v-1?x?this.domNode.setAttribute(T,x):this.domNode.removeAttribute(T):c(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"format",this).call(this,T,x)}}],[{key:"create",value:function(T){var x=c(v.__proto__||Object.getPrototypeOf(v),"create",this).call(this,T);return typeof T=="string"&&x.setAttribute("src",this.sanitize(T)),x}},{key:"formats",value:function(T){return y.reduce(function(x,S){return T.hasAttribute(S)&&(x[S]=T.getAttribute(S)),x},{})}},{key:"match",value:function(T){return/\.(jpe?g|gif|png)$/.test(T)||/^data:image\/.+;base64/.test(T)}},{key:"sanitize",value:function(T){return(0,g.sanitize)(T,["http","https","data"])?T:"//:0"}},{key:"value",value:function(T){return T.getAttribute("src")}}]),v}(d.default.Embed);_.blotName="image",_.tagName="IMG",n.default=_},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function b(v,w){for(var T=0;T-1?x?this.domNode.setAttribute(T,x):this.domNode.removeAttribute(T):c(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"format",this).call(this,T,x)}}],[{key:"create",value:function(T){var x=c(v.__proto__||Object.getPrototypeOf(v),"create",this).call(this,T);return x.setAttribute("frameborder","0"),x.setAttribute("allowfullscreen",!0),x.setAttribute("src",this.sanitize(T)),x}},{key:"formats",value:function(T){return y.reduce(function(x,S){return T.hasAttribute(S)&&(x[S]=T.getAttribute(S)),x},{})}},{key:"sanitize",value:function(T){return g.default.sanitize(T)}},{key:"value",value:function(T){return T.getAttribute("src")}}]),v}(h.BlockEmbed);_.blotName="video",_.className="ql-video",_.tagName="IFRAME",n.default=_},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.FormulaBlot=void 0;var l=function(){function T(x,S){for(var C=0;C0||this.cachedText==null)&&(this.domNode.innerHTML=L(M),this.domNode.normalize(),this.attach()),this.cachedText=M)}}]),A}(y.default);T.className="ql-syntax";var x=new d.default.Attributor.Class("token","hljs",{scope:d.default.Scope.INLINE}),S=function(C){w(A,C),l(A,null,[{key:"register",value:function(){p.default.register(x,!0),p.default.register(T,!0)}}]);function A(R,L){b(this,A);var M=v(this,(A.__proto__||Object.getPrototypeOf(A)).call(this,R,L));if(typeof M.options.highlight!="function")throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var k=null;return M.quill.on(p.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(k),k=setTimeout(function(){M.highlight(),k=null},M.options.interval)}),M.highlight(),M}return l(A,[{key:"highlight",value:function(){var L=this;if(!this.quill.selection.composing){this.quill.update(p.default.sources.USER);var M=this.quill.getSelection();this.quill.scroll.descendants(T).forEach(function(k){k.highlight(L.options.highlight)}),this.quill.update(p.default.sources.SILENT),M!=null&&this.quill.setSelection(M,p.default.sources.SILENT)}}}]),A}(u.default);S.DEFAULTS={highlight:function(){return window.hljs==null?null:function(C){var A=window.hljs.highlightAuto(C);return A.value}}(),interval:1e3},n.CodeBlock=T,n.CodeToken=x,n.default=S},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n){e.exports=' '},function(e,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BubbleTooltip=void 0;var l=function A(R,L,M){R===null&&(R=Function.prototype);var k=Object.getOwnPropertyDescriptor(R,L);if(k===void 0){var P=Object.getPrototypeOf(R);return P===null?void 0:A(P,L,M)}else{if("value"in k)return k.value;var I=k.get;return I===void 0?void 0:I.call(M)}},c=function(){function A(R,L){for(var M=0;M0&&W===p.default.sources.USER){k.show(),k.root.style.left="0px",k.root.style.width="",k.root.style.width=k.root.offsetWidth+"px";var J=k.quill.getLines(I.index,I.length);if(J.length===1)k.position(k.quill.getBounds(I));else{var ee=J[J.length-1],oe=k.quill.getIndex(ee),V=Math.min(ee.length()-1,I.index+I.length-oe),$=k.quill.getBounds(new f.Range(oe,V));k.position($)}}else document.activeElement!==k.textbox&&k.quill.hasFocus()&&k.hide()}),k}return c(R,[{key:"listen",value:function(){var M=this;l(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){M.root.classList.remove("ql-editing")}),this.quill.on(p.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!M.root.classList.contains("ql-hidden")){var k=M.quill.getSelection();k!=null&&M.position(M.quill.getBounds(k))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(M){var k=l(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"position",this).call(this,M),P=this.root.querySelector(".ql-tooltip-arrow");if(P.style.marginLeft="",k===0)return k;P.style.marginLeft=-1*k-P.offsetWidth/2+"px"}}]),R}(a.BaseTooltip);C.TEMPLATE=['','
','','',"
"].join(""),n.BubbleTooltip=C,n.default=S},function(e,n,i){e.exports=i(63)}]).default})})(XE);var Jn=-1,$n=1,gn=0;function ma(r,t,e,n){if(r===t)return r?[[gn,r]]:[];if(e!=null){var i=tA(r,t,e);if(i)return i}var l=vc(r,t),c=r.substring(0,l);r=r.substring(l),t=t.substring(l),l=yc(r,t);var h=r.substring(r.length-l);r=r.substring(0,r.length-l),t=t.substring(0,t.length-l);var d=ZE(r,t);return c&&d.unshift([gn,c]),h&&d.push([gn,h]),Eg(d,n),d}function ZE(r,t){var e;if(!r)return[[$n,t]];if(!t)return[[Jn,r]];var n=r.length>t.length?r:t,i=r.length>t.length?t:r,l=n.indexOf(i);if(l!==-1)return e=[[$n,n.substring(0,l)],[gn,i],[$n,n.substring(l+i.length)]],r.length>t.length&&(e[0][0]=e[2][0]=Jn),e;if(i.length===1)return[[Jn,r],[$n,t]];var c=JE(r,t);if(c){var h=c[0],d=c[1],g=c[2],p=c[3],a=c[4],u=ma(h,g),f=ma(d,p);return u.concat([[gn,a]],f)}return QE(r,t)}function QE(r,t){for(var e=r.length,n=t.length,i=Math.ceil((e+n)/2),l=i,c=2*i,h=new Array(c),d=new Array(c),g=0;ge)f+=2;else if(x>n)u+=2;else if(a){var S=l+p-v;if(S>=0&&S=C)return dd(r,t,T,x)}}}for(var A=-b+y;A<=b-_;A+=2){var S=l+A,C;A===-b||A!==b&&d[S-1]e)_+=2;else if(R>n)y+=2;else if(!a){var w=l+p-A;if(w>=0&&w=C)return dd(r,t,T,x)}}}}return[[Jn,r],[$n,t]]}function dd(r,t,e,n){var i=r.substring(0,e),l=t.substring(0,n),c=r.substring(e),h=t.substring(n),d=ma(i,l),g=ma(c,h);return d.concat(g)}function vc(r,t){if(!r||!t||r.charAt(0)!==t.charAt(0))return 0;for(var e=0,n=Math.min(r.length,t.length),i=n,l=0;et.length?r:t,n=r.length>t.length?t:r;if(e.length<4||n.length*2=f.length?[T,x,S,C,w]:null}var l=i(e,n,Math.ceil(e.length/4)),c=i(e,n,Math.ceil(e.length/2)),h;if(!l&&!c)return null;c?l?h=l[4].length>c[4].length?l:c:h=c:h=l;var d,g,p,a;r.length>t.length?(d=h[0],g=h[1],p=h[2],a=h[3]):(p=h[0],a=h[1],d=h[2],g=h[3]);var u=h[4];return[d,g,p,a,u]}function Eg(r,t){r.push([gn,""]);for(var e=0,n=0,i=0,l="",c="",h;e=0&&Pg(r[d][1])){var g=r[d][1].slice(-1);if(r[d][1]=r[d][1].slice(0,-1),l=g+l,c=g+c,!r[d][1]){r.splice(d,1),e--;var p=d-1;r[p]&&r[p][0]===$n&&(i++,c=r[p][1]+c,p--),r[p]&&r[p][0]===Jn&&(n++,l=r[p][1]+l,p--),d=p}}if(kg(r[e][1])){var g=r[e][1].charAt(0);r[e][1]=r[e][1].slice(1),l+=g,c+=g}}if(e0||c.length>0){l.length>0&&c.length>0&&(h=vc(c,l),h!==0&&(d>=0?r[d][1]+=c.substring(0,h):(r.splice(0,0,[gn,c.substring(0,h)]),e++),c=c.substring(h),l=l.substring(h)),h=yc(c,l),h!==0&&(r[e][1]=c.substring(c.length-h)+r[e][1],c=c.substring(0,c.length-h),l=l.substring(0,l.length-h)));var a=i+n;l.length===0&&c.length===0?(r.splice(e-a,a),e=e-a):l.length===0?(r.splice(e-a,a,[$n,c]),e=e-a+1):c.length===0?(r.splice(e-a,a,[Jn,l]),e=e-a+1):(r.splice(e-a,a,[Jn,l],[$n,c]),e=e-a+2)}e!==0&&r[e-1][0]===gn?(r[e-1][1]+=r[e][1],r.splice(e,1)):e++,i=0,n=0,l="",c="";break}}r[r.length-1][1]===""&&r.pop();var u=!1;for(e=1;e=55296&&r<=56319}function Cg(r){return r>=56320&&r<=57343}function kg(r){return Cg(r.charCodeAt(0))}function Pg(r){return Ag(r.charCodeAt(r.length-1))}function eA(r){for(var t=[],e=0;e0&&t.push(r[e]);return t}function _u(r,t,e,n){return Pg(r)||kg(n)?null:eA([[gn,r],[Jn,t],[$n,e],[gn,n]])}function tA(r,t,e){var n=typeof e=="number"?{index:e,length:0}:e.oldRange,i=typeof e=="number"?null:e.newRange,l=r.length,c=t.length;if(n.length===0&&(i===null||i.length===0)){var h=n.index,d=r.slice(0,h),g=r.slice(h),p=i?i.index:null;e:{var a=h+c-l;if(p!==null&&p!==a||a<0||a>c)break e;var u=t.slice(0,a),f=t.slice(a);if(f!==g)break e;var y=Math.min(h,a),_=d.slice(0,y),b=u.slice(0,y);if(_!==b)break e;var v=d.slice(y),w=u.slice(y);return _u(_,v,w,g)}e:{if(p!==null&&p!==h)break e;var T=h,u=t.slice(0,T),f=t.slice(T);if(u!==d)break e;var x=Math.min(l-T,c-T),S=g.slice(g.length-x),C=f.slice(f.length-x);if(S!==C)break e;var v=g.slice(0,g.length-x),w=f.slice(0,f.length-x);return _u(d,v,w,S)}}if(n.length>0&&i&&i.length===0)e:{var _=r.slice(0,n.index),S=r.slice(n.index+n.length),y=_.length,x=S.length;if(c-1}function _o(E,F){var K=this.__data__,ce=or(K,E);return ce<0?K.push([E,F]):K[ce][1]=F,this}Nt.prototype.clear=go,Nt.prototype.delete=mo,Nt.prototype.get=vo,Nt.prototype.has=yo,Nt.prototype.set=_o;function Bt(E){var F=-1,K=E?E.length:0;for(this.clear();++F-1&&E%1==0&&E-1&&E%1==0&&E<=i}function On(E){var F=typeof E;return!!E&&(F=="object"||F=="function")}function ji(E){return!!E&&typeof E=="object"}function ri(E){return Or(E)?Tr(E):Ai(E)}function ht(){return[]}function ct(){return!1}r.exports=Fi})(qs,qs.exports);var Rg=qs.exports,js={exports:{}};js.exports;(function(r,t){var e=200,n="__lodash_hash_undefined__",i=1,l=2,c=9007199254740991,h="[object Arguments]",d="[object Array]",g="[object AsyncFunction]",p="[object Boolean]",a="[object Date]",u="[object Error]",f="[object Function]",y="[object GeneratorFunction]",_="[object Map]",b="[object Number]",v="[object Null]",w="[object Object]",T="[object Promise]",x="[object Proxy]",S="[object RegExp]",C="[object Set]",A="[object String]",R="[object Symbol]",L="[object Undefined]",M="[object WeakMap]",k="[object ArrayBuffer]",P="[object DataView]",I="[object Float32Array]",j="[object Float64Array]",W="[object Int8Array]",J="[object Int16Array]",ee="[object Int32Array]",oe="[object Uint8Array]",V="[object Uint8ClampedArray]",$="[object Uint16Array]",N="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,G=/^\[object .+?Constructor\]$/,ne=/^(?:0|[1-9]\d*)$/,X={};X[I]=X[j]=X[W]=X[J]=X[ee]=X[oe]=X[V]=X[$]=X[N]=!0,X[h]=X[d]=X[k]=X[p]=X[P]=X[a]=X[u]=X[f]=X[_]=X[b]=X[w]=X[S]=X[C]=X[A]=X[M]=!1;var U=typeof bt=="object"&&bt&&bt.Object===Object&&bt,Q=typeof self=="object"&&self&&self.Object===Object&&self,ie=U||Q||Function("return this")(),ae=t&&!t.nodeType&&t,de=ae&&!0&&r&&!r.nodeType&&r,we=de&&de.exports===ae,Pe=we&&U.process,Me=function(){try{return Pe&&Pe.binding&&Pe.binding("util")}catch(E){}}(),De=Me&&Me.isTypedArray;function ze(E,F){for(var K=-1,ce=E==null?0:E.length,Ue=0,Re=[];++K-1}function So(E,F){var K=this.__data__,ce=ar(K,E);return ce<0?(++this.size,K.push([E,F])):K[ce][1]=F,this}Bt.prototype.clear=bo,Bt.prototype.delete=wo,Bt.prototype.get=xo,Bt.prototype.has=To,Bt.prototype.set=So;function Xt(E){var F=-1,K=E==null?0:E.length;for(this.clear();++Frt))return!1;var ot=Re.get(E);if(ot&&Re.get(F))return ot==F;var Tt=-1,zt=!0,Ot=K&l?new Tr:void 0;for(Re.set(E,F),Re.set(F,E);++Tt-1&&E%1==0&&E-1&&E%1==0&&E<=c}function qi(E){var F=typeof E;return E!=null&&(F=="object"||F=="function")}function On(E){return E!=null&&typeof E=="object"}var ji=De?he(De):ki;function ri(E){return ti(E)?Ai(E):Pi(E)}function ht(){return[]}function ct(){return!1}r.exports=Do})(js,js.exports);var Mg=js.exports,_c={},Dg=bt&&bt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(_c,"__esModule",{value:!0});var rA=Dg(Rg),iA=Dg(Mg),zu;(function(r){function t(l,c,h){l===void 0&&(l={}),c===void 0&&(c={}),typeof l!="object"&&(l={}),typeof c!="object"&&(c={});var d=rA.default(c);h||(d=Object.keys(d).reduce(function(p,a){return d[a]!=null&&(p[a]=d[a]),p},{}));for(var g in l)l[g]!==void 0&&c[g]===void 0&&(d[g]=l[g]);return Object.keys(d).length>0?d:void 0}r.compose=t;function e(l,c){l===void 0&&(l={}),c===void 0&&(c={}),typeof l!="object"&&(l={}),typeof c!="object"&&(c={});var h=Object.keys(l).concat(Object.keys(c)).reduce(function(d,g){return iA.default(l[g],c[g])||(d[g]=c[g]===void 0?null:c[g]),d},{});return Object.keys(h).length>0?h:void 0}r.diff=e;function n(l,c){l===void 0&&(l={}),c===void 0&&(c={}),l=l||{};var h=Object.keys(c).reduce(function(d,g){return c[g]!==l[g]&&l[g]!==void 0&&(d[g]=c[g]),d},{});return Object.keys(l).reduce(function(d,g){return l[g]!==c[g]&&c[g]===void 0&&(d[g]=null),d},h)}r.invert=n;function i(l,c,h){if(h===void 0&&(h=!1),typeof l!="object")return c;if(typeof c=="object"){if(!h)return c;var d=Object.keys(c).reduce(function(g,p){return l[p]===void 0&&(g[p]=c[p]),g},{});return Object.keys(d).length>0?d:void 0}}r.transform=i})(zu||(zu={}));_c.default=zu;var ms={},vs={},pd;function oA(){if(pd)return vs;pd=1;var r=bt&&bt.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(vs,"__esModule",{value:!0});var t=r(Lg()),e=function(){function n(i){this.ops=i,this.index=0,this.offset=0}return n.prototype.hasNext=function(){return this.peekLength()<1/0},n.prototype.next=function(i){i||(i=1/0);var l=this.ops[this.index];if(l){var c=this.offset,h=t.default.length(l);if(i>=h-c?(i=h-c,this.index+=1,this.offset=0):this.offset+=i,typeof l.delete=="number")return{delete:i};var d={};return l.attributes&&(d.attributes=l.attributes),typeof l.retain=="number"?d.retain=i:typeof l.insert=="string"?d.insert=l.insert.substr(c,i):d.insert=l.insert,d}else return{retain:1/0}},n.prototype.peek=function(){return this.ops[this.index]},n.prototype.peekLength=function(){return this.ops[this.index]?t.default.length(this.ops[this.index])-this.offset:1/0},n.prototype.peekType=function(){return this.ops[this.index]?typeof this.ops[this.index].delete=="number"?"delete":typeof this.ops[this.index].retain=="number"?"retain":"insert":"retain"},n.prototype.rest=function(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);var i=this.offset,l=this.index,c=this.next(),h=this.ops.slice(this.index);return this.offset=i,this.index=l,[c].concat(h)}else return[]},n}();return vs.default=e,vs}var gd;function Lg(){if(gd)return ms;gd=1;var r=bt&&bt.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ms,"__esModule",{value:!0});var t=r(oA()),e;return function(n){function i(c){return new t.default(c)}n.iterator=i;function l(c){return typeof c.delete=="number"?c.delete:typeof c.retain=="number"?c.retain:typeof c.insert=="string"?c.insert.length:1}n.length=l}(e||(e={})),ms.default=e,ms}var Oa=bt&&bt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},ys=Oa(nA),aA=Oa(Rg),bu=Oa(Mg),ta=Oa(_c),Yt=Oa(Lg()),sA="\0";(function(){function r(t){Array.isArray(t)?this.ops=t:t!=null&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]}return r.prototype.insert=function(t,e){var n={};return typeof t=="string"&&t.length===0?this:(n.insert=t,e!=null&&typeof e=="object"&&Object.keys(e).length>0&&(n.attributes=e),this.push(n))},r.prototype.delete=function(t){return t<=0?this:this.push({delete:t})},r.prototype.retain=function(t,e){if(t<=0)return this;var n={retain:t};return e!=null&&typeof e=="object"&&Object.keys(e).length>0&&(n.attributes=e),this.push(n)},r.prototype.push=function(t){var e=this.ops.length,n=this.ops[e-1];if(t=aA.default(t),typeof n=="object"){if(typeof t.delete=="number"&&typeof n.delete=="number")return this.ops[e-1]={delete:n.delete+t.delete},this;if(typeof n.delete=="number"&&t.insert!=null&&(e-=1,n=this.ops[e-1],typeof n!="object"))return this.ops.unshift(t),this;if(bu.default(t.attributes,n.attributes)){if(typeof t.insert=="string"&&typeof n.insert=="string")return this.ops[e-1]={insert:n.insert+t.insert},typeof t.attributes=="object"&&(this.ops[e-1].attributes=t.attributes),this;if(typeof t.retain=="number"&&typeof n.retain=="number")return this.ops[e-1]={retain:n.retain+t.retain},typeof t.attributes=="object"&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this},r.prototype.chop=function(){var t=this.ops[this.ops.length-1];return t&&t.retain&&!t.attributes&&this.ops.pop(),this},r.prototype.filter=function(t){return this.ops.filter(t)},r.prototype.forEach=function(t){this.ops.forEach(t)},r.prototype.map=function(t){return this.ops.map(t)},r.prototype.partition=function(t){var e=[],n=[];return this.forEach(function(i){var l=t(i)?e:n;l.push(i)}),[e,n]},r.prototype.reduce=function(t,e){return this.ops.reduce(t,e)},r.prototype.changeLength=function(){return this.reduce(function(t,e){return e.insert?t+Yt.default.length(e):e.delete?t-e.delete:t},0)},r.prototype.length=function(){return this.reduce(function(t,e){return t+Yt.default.length(e)},0)},r.prototype.slice=function(t,e){t===void 0&&(t=0),e===void 0&&(e=1/0);for(var n=[],i=Yt.default.iterator(this.ops),l=0;l0&&n.next(l.retain-c)}for(var h=new r(i);e.hasNext()||n.hasNext();)if(n.peekType()==="insert")h.push(n.next());else if(e.peekType()==="delete")h.push(e.next());else{var d=Math.min(e.peekLength(),n.peekLength()),g=e.next(d),p=n.next(d);if(typeof p.retain=="number"){var a={};typeof g.retain=="number"?a.retain=d:a.insert=g.insert;var u=ta.default.compose(g.attributes,p.attributes,typeof g.retain=="number");if(u&&(a.attributes=u),h.push(a),!n.hasNext()&&bu.default(h.ops[h.ops.length-1],a)){var f=new r(e.rest());return h.concat(f).chop()}}else typeof p.delete=="number"&&typeof g.retain=="number"&&h.push(p)}return h.chop()},r.prototype.concat=function(t){var e=new r(this.ops.slice());return t.ops.length>0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e},r.prototype.diff=function(t,e){if(this.ops===t.ops)return new r;var n=[this,t].map(function(d){return d.map(function(g){if(g.insert!=null)return typeof g.insert=="string"?g.insert:sA;var p=d===t?"on":"with";throw new Error("diff() called "+p+" non-document")}).join("")}),i=new r,l=ys.default(n[0],n[1],e),c=Yt.default.iterator(this.ops),h=Yt.default.iterator(t.ops);return l.forEach(function(d){for(var g=d[1].length;g>0;){var p=0;switch(d[0]){case ys.default.INSERT:p=Math.min(h.peekLength(),g),i.push(h.next(p));break;case ys.default.DELETE:p=Math.min(g,c.peekLength()),c.next(p),i.delete(p);break;case ys.default.EQUAL:p=Math.min(c.peekLength(),h.peekLength(),g);var a=c.next(p),u=h.next(p);bu.default(a.insert,u.insert)?i.retain(p,ta.default.diff(a.attributes,u.attributes)):i.push(u).delete(p);break}g-=p}}),i.chop()},r.prototype.eachLine=function(t,e){e===void 0&&(e=` `);for(var n=Yt.default.iterator(this.ops),i=new r,l=0;n.hasNext();){if(n.peekType()!=="insert")return;var c=n.peek(),h=Yt.default.length(c)-n.peekLength(),d=typeof c.insert=="string"?c.insert.indexOf(e,h)-h:-1;if(d<0)i.push(n.next());else if(d>0)i.push(n.next(d));else{if(t(i,n.next(1).attributes||{},l)===!1)return;l+=1,i=new r}}i.length()>0&&t(i,{},l)},r.prototype.invert=function(t){var e=new r;return this.reduce(function(n,i){if(i.insert)e.delete(Yt.default.length(i));else{if(i.retain&&i.attributes==null)return e.retain(i.retain),n+i.retain;if(i.delete||i.retain&&i.attributes){var l=i.delete||i.retain,c=t.slice(n,n+l);return c.forEach(function(h){i.delete?e.push(h):i.retain&&i.attributes&&e.retain(Yt.default.length(h),ta.default.invert(i.attributes,h.attributes))}),n+l}}return n},0),e.chop()},r.prototype.transform=function(t,e){if(e===void 0&&(e=!1),e=!!e,typeof t=="number")return this.transformPosition(t,e);for(var n=t,i=Yt.default.iterator(this.ops),l=Yt.default.iterator(n.ops),c=new r;i.hasNext()||l.hasNext();)if(i.peekType()==="insert"&&(e||l.peekType()!=="insert"))c.retain(Yt.default.length(i.next()));else if(l.peekType()==="insert")c.push(l.next());else{var h=Math.min(i.peekLength(),l.peekLength()),d=i.next(h),g=l.next(h);if(d.delete)continue;g.delete?c.push(g):c.retain(h,ta.default.transform(d.attributes,g.attributes,e))}return c.chop()},r.prototype.transformPosition=function(t,e){e===void 0&&(e=!1),e=!!e;for(var n=Yt.default.iterator(this.ops),i=0;n.hasNext()&&i<=t;){var l=n.peekLength(),c=n.peekType();if(n.next(),c==="delete"){t-=Math.min(l,t-i);continue}else c==="insert"&&(i