UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

1 lines • 733 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1053,3930],{11053:(e,t,i)=>{i.d(t,{c:()=>s,g:()=>n});var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}},98764:(e,t,i)=>{i.d(t,{Y0:()=>u,lO:()=>h});var s=i(73941),n=i(16930),r=i(21325);const a=new n.A(s.fv),o=new n.A(s.FY),l=new n.A(s.LJ),u=new n.A(s.Ro);function h(e){const t=d.get(e);if(t)return t;let i=a;if(e)if(e===o)i=o;else if(e===l)i=l;else{const t=e.wkid,s=e.latestWkid;if(null!=t||null!=s)(0,r.tl)(t)||(0,r.tl)(s)?i=o:((0,r.ZL)(t)||(0,r.ZL)(s))&&(i=l);else{const t=e.wkt2??e.wkt;if(t){const e=t.toUpperCase();e===c?i=o:e===p&&(i=l)}}}return d.set(e,i),i}const d=new Map,c=o.wkt.toUpperCase(),p=l.wkt.toUpperCase()},64422:(e,t,i)=>{i.d(t,{A:()=>c});var s=i(90237),n=i(69540),r=i(25482),a=i(10107),o=(i(44208),i(53966),i(87811),i(40608)),l=i(86738),u=i(39829),h=i(82799);let d=class extends(n.A.ClonableMixin(r.A)){constructor(e){super(e),this.frameCenter=null,this.frameOutline=null,this.lineOfSight=null,this.sensorLocation=null,this.sensorTrail=null}};(0,s._)([(0,a.MZ)({type:l.A})],d.prototype,"frameCenter",void 0),(0,s._)([(0,a.MZ)({type:u.A})],d.prototype,"frameOutline",void 0),(0,s._)([(0,a.MZ)({type:h.A})],d.prototype,"lineOfSight",void 0),(0,s._)([(0,a.MZ)({type:l.A})],d.prototype,"sensorLocation",void 0),(0,s._)([(0,a.MZ)({type:h.A})],d.prototype,"sensorTrail",void 0),d=(0,s._)([(0,o.$)("esri.layers.support.TelemetryData")],d);const c=d},3930:(e,t,i)=>{i.r(t),i.d(t,{default:()=>Nd});var s=i(90237),n=i(69622),r=i(53966),a=i(34727),o=i(36708),l=i(78888),u=i(56058);class h extends EventTarget{constructor(){super(...arguments),this._readyState=0,this._responseType="",this.timeout=0,this._withCredentials=!1,this.onabort=null,this.onerror=null,this.onload=null,this.onloadend=null,this.onloadstart=null,this.onprogress=null,this.ontimeout=null,this.onreadystatechange=null,this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this._abortController=null,this._error=null,this._options={},this._response=null,this._sendFlag=!1,this._url=""}get readyState(){return this._readyState}get response(){return""===this.responseType||"text"===this.responseType?this.responseText:this.readyState!==this.DONE||this._error||!this._response?null:this._response.data}get responseText(){return""!==this.responseType&&"text"!==this.responseType&&this._throwDOMException(),this.readyState!==this.DONE?"":this._response?this._response.data:null!=this._error?.raw?"string"==typeof this._error.raw?this._error.raw:JSON.stringify(this._error.raw):""}get responseType(){return this._responseType}set responseType(e){("document"!==e||globalThis instanceof Window)&&(this.readyState!==this.LOADING&&this.readyState!==this.DONE||this._throwDOMException(),this._responseType=e)}get responseURL(){return(this._response||this._error)?.url??""}get responseXML(){return""!==this.responseType&&"document"!==this.responseType&&this._throwDOMException(),this.readyState!==this.DONE?null:this._response?.data??null}get status(){return(this._response||this._error)?.httpStatus??0}get statusText(){return""}get upload(){return console.warn("upload not implemented"),null}get withCredentials(){return this._withCredentials}set withCredentials(e){this.readyState!==this.UNSENT&&this.readyState!==this.OPENED&&this._throwDOMException(),this._withCredentials=e}abort(){this.readyState===this.OPENED&&this._sendFlag||this.readyState===this.HEADERS_RECEIVED||this.readyState===this.LOADING?(this._sendFlag=!1,this._error=null,this._response=null,this._abortController?.abort(),this._updateReadyState(this.DONE),this._dispatchProgressEvent("abort"),this._dispatchProgressEvent("loadend")):this.readyState===this.DONE&&this._updateReadyState(this.UNSENT)}getAllResponseHeaders(){let e="";const t=(this._response||this._error)?.getAllHeaders?.();if(t)for(const[i,s]of t)e+=`${i}: ${s}\r\n`;return e}getResponseHeader(e){return(this._response||this._error)?.getHeader?.(e)??null}open(e,t){switch(this._sendFlag=!1,this._options={},e){case"GET":this._options.method="auto";break;case"POST":this._options.method="post";break;case"HEAD":this._options.method="head";break;case"DELETE":this._options.method="delete";break;case"PUT":this._options.method="put"}this._url=t,this._error=null,this._response=null,this._abortController=new AbortController,this._updateReadyState(this.OPENED)}overrideMimeType(e){throw new Error("overrideMimeType not implemented")}send(e){(this.readyState!==this.OPENED||this._sendFlag)&&this._throwDOMException(),this._sendFlag=!0,this._updateReadyState(this.LOADING),this._dispatchProgressEvent("loadstart");const t=this._options;e instanceof URLSearchParams?t.body=e.toString():t.body=e,t.responseType=""===this.responseType?"text":"arraybuffer"===this.responseType?"array-buffer":this.responseType,t.signal=this._abortController?.signal,this.timeout&&(t.timeout=this.timeout),this.withCredentials&&(t.withCredentials=!0),(0,l.A)(this._url,t).then((e=>{this._response=e,this._updateReadyState(this.DONE),this._dispatchProgressEvent("load")})).catch((e=>{this._sendFlag&&(this._error=e.details,this._updateReadyState(this.DONE),(0,u.c8)(e)?this._dispatchProgressEvent("timeout"):"AbortError"===e.name?this._dispatchProgressEvent("abort"):this._dispatchProgressEvent("error"))})).finally((()=>{this._sendFlag&&this._dispatchProgressEvent("loadend")}))}setRequestHeader(e,t){(this.readyState!==this.OPENED||this._sendFlag)&&this._throwDOMException(),this._options.headers??={},this._options.headers[e]=t}_dispatchProgressEvent(e){const t=new ProgressEvent(e,{loaded:0,total:0});this.dispatchEvent(t),this[`on${e}`]?.(t)}_throwDOMException(){throw new DOMException("","InvalidStateError")}_updateReadyState(e){if(this._readyState!==e&&(this._readyState=e,e!==this.UNSENT)){const e=new Event("readystatechange");this.dispatchEvent(e),this.onreadystatechange?.(e)}}}h.UNSENT=0,h.OPENED=1,h.HEADERS_RECEIVED=2,h.LOADING=3,h.DONE=4;var d=i(10107),c=(i(44208),i(87811),i(40608)),p=i(29242),m=i(51850),g=i(77690),f=i(38954),y=i(86738),_=i(16930),b=i(98764),v=i(9762),T=i(79258),S=i(48457);const E=Math.PI/180;let w=class extends n.A{constructor(e){super(),this.averageElevation=0,this.imageHeight=0,this.imageWidth=0,this.metadataSupportsTransforms=!1,this.platformHeadingAngle=0,this.platformPitchAngle=0,this.platformRollAngle=0,this.sensorHeadingAngle=0,this.sensorAltitude=0,this.sensorHorizontalFieldOfView=0,this.sensorLatitude=0,this.sensorLongitude=0,this.sensorPitchAngle=0,this.sensorRollAngle=0,this.sensorVerticalFieldOfView=0,this.vttMetadata=new Map,this._createMat3FromValues=e=>{const t=e[0],i=e[1],s=e[2];return(0,p.fA)(t[0],i[0],s[0],t[1],i[1],s[1],t[2],i[2],s[2])},this._multiplyMat3=(e,t)=>{const i=(0,p.vt)();return(0,g.lw)(i,e,t),i},this._transposeMat3=e=>{const t=(0,p.vt)();return(0,g.mg)(t,e),t},this._calculateCameraFovForward=()=>this._createMat3FromValues([[0,0,1],[Math.tan(.5*this.sensorHorizontalFieldOfView*E),0,0],[0,Math.tan(.5*this.sensorVerticalFieldOfView*E),0]]),this._calculateCameraFovReverse=()=>this._createMat3FromValues([[0,1/Math.tan(.5*this.sensorHorizontalFieldOfView*E),0],[0,0,1/Math.tan(.5*this.sensorVerticalFieldOfView*E)],[1,0,0]]),this._calculateCameraLook=()=>this._getRotationMatrixZYX(this.sensorHeadingAngle*E,this.sensorPitchAngle*E,this.sensorRollAngle*E),this._calculateImageDimensionsForward=()=>this._createMat3FromValues([[2/this.imageWidth,0,-1],[0,-2/this.imageHeight,-1],[0,0,1]]),this._calculateImageDimensionsReverse=()=>this._createMat3FromValues([[this.imageWidth/2,0,this.imageWidth/2],[0,-this.imageHeight/2,-this.imageHeight/2],[0,0,1]]),this._calculatePlatformPositionMatrix=()=>{const e=Math.sin(this.sensorLatitude*E),t=Math.cos(this.sensorLatitude*E),i=Math.sin(this.sensorLongitude*E),s=Math.cos(this.sensorLongitude*E);return this._createMat3FromValues([[-e*s,-i,-t*s],[-e*i,s,-t*i],[t,0,-e]])},this._calculatePlatformOrientation=()=>this._getRotationMatrixZYX(this.platformHeadingAngle*E,this.platformPitchAngle*E,this.platformRollAngle*E),this._extractValues=e=>{this.imageWidth=e.get(S.a1.EsriVideoWidth)?.value,this.imageHeight=e.get(S.a1.EsriVideoHeight)?.value;const t=e.get(S.a1.SensorEllipsoidHeight)?.value;this.sensorAltitude=t??e.get(S.a1.SensorTrueAltitude)?.value,this.sensorLatitude=e.get(S.a1.SensorLatitude)?.value,this.sensorLongitude=e.get(S.a1.SensorLongitude)?.value,this.sensorHeadingAngle=e.get(S.a1.SensorAzimuthAngle)?.value,this.sensorPitchAngle=e.get(S.a1.SensorElevationAngle)?.value,this.sensorRollAngle=e.get(S.a1.SensorRollAngle)?.value,this.sensorHorizontalFieldOfView=e.get(S.a1.SensorHorizontalFOV)?.value,this.sensorVerticalFieldOfView=e.get(S.a1.SensorVerticalFOV)?.value,this.platformHeadingAngle=e.get(S.a1.PlatformHeadingAngle)?.value,this.platformPitchAngle=e.get(S.a1.PlatformPitchAngle)?.value,this.platformRollAngle=e.get(S.a1.PlatformRollAngle)?.value,this.averageElevation=e.get(S.a1.FrameCenterElevation)?.value||0},this._getRotationMatrixZYX=(e,t,i)=>{const s=Math.cos(e),n=Math.sin(e),r=Math.cos(t),a=Math.sin(t),o=Math.cos(i),l=Math.sin(i);return this._createMat3FromValues([[s*r,s*a*l-o*n,n*l+s*o*a],[r*n,s*o+n*a*l,o*n*a-s*l],[-a,r*l,r*o]])},this._initCameraSensor=()=>{const e=this._calculateCameraFovForward(),t=this._calculateCameraFovReverse(),i=this._calculateCameraLook(),s=this._calculateImageDimensionsForward(),n=this._calculateImageDimensionsReverse(),r=this._calculatePlatformPositionMatrix(),a=this._calculatePlatformOrientation(),o=this._multiplyMat3(this._multiplyMat3(r,a),i);this._imageToEarthTransform=this._multiplyMat3(this._multiplyMat3(o,e),s);const l=this._multiplyMat3(n,t);this._earthToImageTransform=this._multiplyMat3(l,this._transposeMat3(o)),this._platformPositionEcef=this._projectPointToECEF(this.sensorLongitude,this.sensorLatitude,this.sensorAltitude||this.averageElevation)},this._metadataSupportsTransforms=e=>{if(!e?.size)return!1;const t=e.get(S.a1.EsriVideoWidth)?.value??0,i=e.get(S.a1.EsriVideoHeight)?.value??0;if(t<=0||i<=0)return!1;const s=e.get(S.a1.SensorEllipsoidHeight)?.value,n=e.get(S.a1.SensorTrueAltitude)?.value,r=e.get(S.a1.SensorLatitude)?.value,a=e.get(S.a1.SensorLongitude)?.value;if(null==s&&null==n||null==r||null==a)return!1;const o=e.get(S.a1.PlatformHeadingAngle)?.value,l=e.get(S.a1.PlatformPitchAngle)?.value,u=e.get(S.a1.PlatformRollAngle)?.value;if(null==o||null==l||null==u)return!1;const h=e.get(S.a1.SensorHorizontalFOV)?.value,d=e.get(S.a1.SensorVerticalFOV)?.value;if(null==h||null==d)return!1;const c=e.get(S.a1.SensorAzimuthAngle)?.value,p=e.get(S.a1.SensorElevationAngle)?.value,m=e.get(S.a1.SensorRollAngle)?.value;return null!=c&&null!=p&&null!=m},this._projectPointToECEF=(e,t,i)=>{const s=[];return(0,v.projectBuffer)([e,t,i],_.A.WGS84,0,s,b.Y0,0),new y.A({x:s[0],y:s[1],z:s[2],spatialReference:b.Y0})},this._projectImageVectorToEllipsoid=(e,t)=>{const i=T.$O.semiMajorAxis+t,s=T.$O.semiMinorAxis+t,n=s/i,r=i/s,{x:a,y:o,z:l}=this._platformPositionEcef,u=l??this.averageElevation,h=(0,m.fA)(a,o,r*u),d=(0,f.f)(e,e),c=(0,f.f)(e,h),p=(0,f.f)(h,h)-i*i,g=(-c-Math.sqrt(c*c-d*p))/d;if(g<0)return[NaN,NaN,NaN];const y=(0,m.vt)();return(0,f.b)(y,h,e,g),y[2]=y[2]*n,y};const t=e?.videoMetadata;this._set("metadataSupportsTransforms",this._metadataSupportsTransforms(t)),this.metadataSupportsTransforms&&(this._extractValues(t),this._initCameraSensor())}transformGeoToImage(e,t,i){const s=this._platformPositionEcef;if(!s)return[0,0];const{x:n,y:r,z:a}=s,o=(0,m.fA)(n,r,a),l=this._projectPointToECEF(e,t,i||this.averageElevation),u=(0,m.vt)(),h=(0,m.fA)(l.x,l.y,l.z);(0,f.d)(u,h,o),(0,f.q)(u,u,this._earthToImageTransform);const d=u[0],c=u[1],p=u[2];let g=(0,m.fA)(NaN,NaN,NaN);return isNaN(p)||(g=(0,m.fA)(d/p,c/p,p/p)),[g[0],g[1]]}transformImageToGeo(e,t){const i=(0,m.fA)(e,t,1),s=(0,m.vt)();(0,f.q)(s,i,this._imageToEarthTransform);const n=this._projectImageVectorToEllipsoid(s,this.averageElevation);let r;if(!isNaN(n[0])){const e=[];(0,v.projectBuffer)([n[0],n[1],n[2]],b.Y0,0,e,_.A.WGS84,0),r=new y.A({x:e[0],y:e[1],z:e[2],spatialReference:_.A.WGS84})}return r}};(0,s._)([(0,d.MZ)()],w.prototype,"averageElevation",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"imageHeight",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"imageWidth",void 0),(0,s._)([(0,d.MZ)({readOnly:!0})],w.prototype,"metadataSupportsTransforms",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"platformHeadingAngle",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"platformPitchAngle",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"platformRollAngle",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"sensorHeadingAngle",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"sensorAltitude",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"sensorHorizontalFieldOfView",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"sensorLatitude",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"sensorLongitude",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"sensorPitchAngle",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"sensorRollAngle",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"sensorVerticalFieldOfView",void 0),(0,s._)([(0,d.MZ)()],w.prototype,"vttMetadata",void 0),w=(0,s._)([(0,c.$)("esri.layers.video.VideoCameraSensorModel")],w);const C=w;var k,x,I=i(11053);function A(){return x?k:(x=1,e="undefined"!=typeof window?window:void 0!==I.c?I.c:"undefined"!=typeof self?self:{},k=e);var e}const D=(0,I.g)(A());var P,L,O,N,M,R,U,B,F,q,j,V,H,$,z,W,G,X,K,Y,Q,Z,J,ee,te,ie;function se(){if(L)return P;L=1;var e=Array.prototype.slice;return P=function(t,i){"length"in t||(t=[t]),t=e.call(t);for(;t.length;){var s=t.shift(),n=i(s);if(n)return n;s.childNodes&&s.childNodes.length&&(t=e.call(s.childNodes).concat(t))}}}function ne(){return B?U:(B=1,U=function(e){var t=this,i=e.type;e.target||(e.target=t),t.listeners||(t.listeners={});var s=t.listeners[i];if(s)return s.forEach((function(i){e.currentTarget=t,"function"==typeof i?i(e):i.handleEvent(e)}));t.parentNode&&t.parentNode.dispatchEvent(e)})}function re(){return q?F:(q=1,F=function(e,t){var i=this;i.listeners||(i.listeners={}),i.listeners[e]||(i.listeners[e]=[]),-1===i.listeners[e].indexOf(t)&&i.listeners[e].push(t)})}function ae(){return V?j:(V=1,j=function(e,t){var i=this;if(i.listeners&&i.listeners[e]){var s=i.listeners[e],n=s.indexOf(t);-1!==n&&s.splice(n,1)}})}function oe(){if(W)return z;W=1;var e=se(),t=ne(),i=re(),s=ae(),n=function(){if($)return H;$=1;var e=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function t(e){switch(e.nodeType){case 3:return a(e.data);case 8:return"\x3c!--"+e.data+"--\x3e";default:return i(e)}}function i(i){var s=[],o=i.tagName;return"http://www.w3.org/1999/xhtml"===i.namespaceURI&&(o=o.toLowerCase()),s.push("<"+o+r(i)+function(e){var t=e.dataset,i=[];for(var s in t)i.push({name:"data-"+s,value:t[s]});return i.length?n(i):""}(i)),e.indexOf(o)>-1?s.push(" />"):(s.push(">"),i.childNodes.length?s.push.apply(s,i.childNodes.map(t)):i.textContent||i.innerText?s.push(a(i.textContent||i.innerText)):i.innerHTML&&s.push(i.innerHTML),s.push("</"+o+">")),s.join("")}function s(e,t){var i=typeof e[t];return"style"===t&&Object.keys(e.style).length>0||e.hasOwnProperty(t)&&("string"===i||"boolean"===i||"number"===i)&&"nodeName"!==t&&"className"!==t&&"tagName"!==t&&"textContent"!==t&&"innerText"!==t&&"namespaceURI"!==t&&"innerHTML"!==t}function n(e){var t=[];return e.forEach((function(e){var i=e.name,s=e.value;"style"===i&&(s=function(e){if("string"==typeof e)return e;var t="";return Object.keys(e).forEach((function(i){var s=e[i];i=i.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})),t+=i+":"+s+";"})),t}(s)),t.push(i+'="'+function(e){return a(e).replace(/"/g,"&quot;")}(s)+'"')})),t.length?" "+t.join(" "):""}function r(e){var t=[];for(var i in e)s(e,i)&&t.push({name:i,value:e[i]});for(var r in e._attributes)for(var a in e._attributes[r]){var o=e._attributes[r][a],l=(o.prefix?o.prefix+":":"")+a;t.push({name:l,value:o.value})}return e.className&&t.push({name:"class",value:e.className}),t.length?n(t):""}function a(e){var t="";return"string"==typeof e?t=e:e&&(t=e.toString()),t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}return H=t}(),r="http://www.w3.org/1999/xhtml";function a(e,t,i){if(!(this instanceof a))return new a(e);var s=void 0===i?r:i||null;this.tagName=s===r?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=t||null,this.namespaceURI=s,this._attributes={},"INPUT"===this.tagName&&(this.type="text")}return z=a,a.prototype.type="DOMElement",a.prototype.nodeType=1,a.prototype.appendChild=function(e){return e.parentNode&&e.parentNode.removeChild(e),this.childNodes.push(e),e.parentNode=this,e},a.prototype.replaceChild=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=this.childNodes.indexOf(t);return t.parentNode=null,this.childNodes[i]=e,e.parentNode=this,t},a.prototype.removeChild=function(e){var t=this.childNodes.indexOf(e);return this.childNodes.splice(t,1),e.parentNode=null,e},a.prototype.insertBefore=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=null==t?-1:this.childNodes.indexOf(t);return i>-1?this.childNodes.splice(i,0,e):this.childNodes.push(e),e.parentNode=this,e},a.prototype.setAttributeNS=function(e,t,i){var s=null,n=t,r=t.indexOf(":");r>-1&&(s=t.substr(0,r),n=t.substr(r+1)),"INPUT"===this.tagName&&"type"===t?this.type=i:(this._attributes[e]||(this._attributes[e]={}))[n]={value:i,prefix:s}},a.prototype.getAttributeNS=function(e,t){var i=this._attributes[e],s=i&&i[t]&&i[t].value;return"INPUT"===this.tagName&&"type"===t?this.type:"string"!=typeof s?null:s},a.prototype.removeAttributeNS=function(e,t){var i=this._attributes[e];i&&delete i[t]},a.prototype.hasAttributeNS=function(e,t){var i=this._attributes[e];return!!i&&t in i},a.prototype.setAttribute=function(e,t){return this.setAttributeNS(null,e,t)},a.prototype.getAttribute=function(e){return this.getAttributeNS(null,e)},a.prototype.removeAttribute=function(e){return this.removeAttributeNS(null,e)},a.prototype.hasAttribute=function(e){return this.hasAttributeNS(null,e)},a.prototype.removeEventListener=s,a.prototype.addEventListener=i,a.prototype.dispatchEvent=t,a.prototype.focus=function(){},a.prototype.toString=function(){return n(this)},a.prototype.getElementsByClassName=function(t){var i=t.split(" "),s=[];return e(this,(function(e){if(1===e.nodeType){var t=(e.className||"").split(" ");i.every((function(e){return-1!==t.indexOf(e)}))&&s.push(e)}})),s},a.prototype.getElementsByTagName=function(t){t=t.toLowerCase();var i=[];return e(this.childNodes,(function(e){1!==e.nodeType||"*"!==t&&e.tagName.toLowerCase()!==t||i.push(e)})),i},a.prototype.contains=function(t){return e(this,(function(e){return t===e}))||!1},z}function le(){if(ie)return te;ie=1;var e,t=void 0!==I.c?I.c:"undefined"!=typeof window?window:{},i=function(){if(ee)return J;ee=1;var e=function(){if(Z)return Q;Z=1;var e=se(),t=function(){if(N)return O;function e(t,i){if(!(this instanceof e))return new e(t,i);this.data=t,this.nodeValue=t,this.length=t.length,this.ownerDocument=i||null}return N=1,O=e,e.prototype.nodeType=8,e.prototype.nodeName="#comment",e.prototype.toString=function(){return"[object Comment]"},O}(),i=function(){if(R)return M;function e(t,i){if(!(this instanceof e))return new e(t);this.data=t||"",this.length=this.data.length,this.ownerDocument=i||null}return R=1,M=e,e.prototype.type="DOMTextNode",e.prototype.nodeType=3,e.prototype.nodeName="#text",e.prototype.toString=function(){return this.data},e.prototype.replaceData=function(e,t,i){var s=this.data,n=s.substring(0,e),r=s.substring(e+t,s.length);this.data=n+i+r,this.length=this.data.length},M}(),s=oe(),n=function(){if(X)return G;X=1;var e=oe();function t(e){if(!(this instanceof t))return new t;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}return G=t,t.prototype.type="DocumentFragment",t.prototype.nodeType=11,t.prototype.nodeName="#document-fragment",t.prototype.appendChild=e.prototype.appendChild,t.prototype.replaceChild=e.prototype.replaceChild,t.prototype.removeChild=e.prototype.removeChild,t.prototype.toString=function(){return this.childNodes.map((function(e){return String(e)})).join("")},G}(),r=function(){if(Y)return K;function e(e){}return Y=1,K=e,e.prototype.initEvent=function(e,t,i){this.type=e,this.bubbles=t,this.cancelable=i},e.prototype.preventDefault=function(){},K}(),a=ne(),o=re(),l=ae();function u(){if(!(this instanceof u))return new u;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}Q=u;var h=u.prototype;return h.createTextNode=function(e){return new i(e,this)},h.createElementNS=function(e,t){var i=null===e?null:String(e);return new s(t,this,i)},h.createElement=function(e){return new s(e,this)},h.createDocumentFragment=function(){return new n(this)},h.createEvent=function(e){return new r(e)},h.createComment=function(e){return new t(e,this)},h.getElementById=function(t){return t=String(t),e(this.childNodes,(function(e){if(String(e.id)===t)return e}))||null},h.getElementsByClassName=s.prototype.getElementsByClassName,h.getElementsByTagName=s.prototype.getElementsByTagName,h.contains=s.prototype.contains,h.removeEventListener=l,h.addEventListener=o,h.dispatchEvent=a,Q}();return J=new e}();return"undefined"!=typeof document?e=document:(e=t["__GLOBAL_DOCUMENT_CACHE@4"])||(e=t["__GLOBAL_DOCUMENT_CACHE@4"]=i),te=e}const ue=(0,I.g)(le());var he,de,ce,pe,me,ge,fe,ye,_e,be,ve={exports:{}},Te={exports:{}};const Se=(0,I.g)(function(){if(be)return ve.exports;be=1;var e=A(),t=(he||(he=1,function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(null,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Te)),Te.exports),i=function(){if(ce)return de;ce=1,de=function(t){if(!t)return!1;var i=e.call(t);return"[object Function]"===i||"function"==typeof t&&"[object RegExp]"!==i||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString;return de}(),s=function(){if(me)return pe;function e(e,i){var s="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(s)return(s=s.call(e)).next.bind(s);if(Array.isArray(e)||(s=t(e))||i){s&&(e=s);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(e,t){if(e){if("string"==typeof e)return i(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);return"Object"===s&&e.constructor&&(s=e.constructor.name),"Map"===s||"Set"===s?Array.from(e):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);i<t;i++)s[i]=e[i];return s}return me=1,pe=function(){function t(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var i=t.prototype;return i.getIsEnabled=function(){return this.enabled_},i.enable=function(){this.enabled_=!0},i.disable=function(){this.enabled_=!1},i.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},i.addInterceptor=function(e,t){this.typeToInterceptorsMap_.has(e)||this.typeToInterceptorsMap_.set(e,new Set);var i=this.typeToInterceptorsMap_.get(e);return!i.has(t)&&(i.add(t),!0)},i.removeInterceptor=function(e,t){var i=this.typeToInterceptorsMap_.get(e);return!(!i||!i.has(t)||(i.delete(t),0))},i.clearInterceptorsByType=function(e){return!!this.typeToInterceptorsMap_.get(e)&&(this.typeToInterceptorsMap_.delete(e),this.typeToInterceptorsMap_.set(e,new Set),!0)},i.clear=function(){return!!this.typeToInterceptorsMap_.size&&(this.typeToInterceptorsMap_=new Map,!0)},i.getForType=function(e){return this.typeToInterceptorsMap_.get(e)||new Set},i.execute=function(t,i){for(var s,n=e(this.getForType(t));!(s=n()).done;){var r=s.value;try{i=r(i)}catch(e){}}return i},t}()}(),n=function(){if(fe)return ge;fe=1;var e=function(){function e(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var i=e.prototype;return i.getIsEnabled=function(){return this.enabled_},i.enable=function(){this.enabled_=!0},i.disable=function(){this.enabled_=!1},i.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},i.getMaxAttempts=function(){return this.maxAttempts_},i.setMaxAttempts=function(e){this.maxAttempts_=e},i.getDelayFactor=function(){return this.delayFactor_},i.setDelayFactor=function(e){this.delayFactor_=e},i.getFuzzFactor=function(){return this.fuzzFactor_},i.setFuzzFactor=function(e){this.fuzzFactor_=e},i.getInitialDelay=function(){return this.initialDelay_},i.setInitialDelay=function(e){this.initialDelay_=e},i.createRetry=function(e){var i=void 0===e?{}:e,s=i.maxAttempts,n=i.delayFactor,r=i.fuzzFactor,a=i.initialDelay;return new t({maxAttempts:s||this.maxAttempts_,delayFactor:n||this.delayFactor_,fuzzFactor:r||this.fuzzFactor_,initialDelay:a||this.initialDelay_})},e}(),t=function(){function e(e){this.maxAttempts_=e.maxAttempts,this.delayFactor_=e.delayFactor,this.fuzzFactor_=e.fuzzFactor,this.currentDelay_=e.initialDelay,this.currentAttempt_=1}var t=e.prototype;return t.moveToNextAttempt=function(){this.currentAttempt_++;var e=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+e},t.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},t.getCurrentDelay=function(){return this.currentDelay_},t.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},t.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},t.getCurrentFuzzedDelay=function(){var e=this.getCurrentMinPossibleDelay(),t=this.getCurrentMaxPossibleDelay();return e+Math.random()*(t-e)},e}();return ge=e}();o.httpHandler=function(){if(_e)return ye;_e=1;var e=A();return ye=function(t,i){return void 0===i&&(i=!1),function(s,n,r){if(s)t(s);else if(n.statusCode>=400&&n.statusCode<=599){var a=r;if(i)if(e.TextDecoder){var o=function(e){return void 0===e&&(e=""),e.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),s=i[0],n=i[1];return"charset"===s.trim()?n.trim():e}),"utf-8")}(n.headers&&n.headers["content-type"]);try{a=new TextDecoder(o).decode(r)}catch(e){}}else a=String.fromCharCode.apply(null,new Uint8Array(r));t({cause:a})}else t(null,r)}}}(),o.requestInterceptorsStorage=new s,o.responseInterceptorsStorage=new s,o.retryManager=new n;var r=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),s=e.slice(0,i).trim().toLowerCase(),n=e.slice(i+1).trim();void 0===t[s]?t[s]=n:Array.isArray(t[s])?t[s].push(n):t[s]=[t[s],n]})),t):t};function a(e,s,n){var r=e;return i(s)?(n=s,"string"==typeof e&&(r={uri:e})):r=t({},s,{uri:e}),r.callback=n,r}function o(e,t,i){return l(t=a(e,t,i))}function l(e){if(void 0===e.callback)throw new Error("callback argument missing");if(e.requestType&&o.requestInterceptorsStorage.getIsEnabled()){var t={uri:e.uri||e.url,headers:e.headers||{},body:e.body,metadata:e.metadata||{},retry:e.retry,timeout:e.timeout},i=o.requestInterceptorsStorage.execute(e.requestType,t);e.uri=i.uri,e.headers=i.headers,e.body=i.body,e.metadata=i.metadata,e.retry=i.retry,e.timeout=i.timeout}var s=!1,n=function(t,i,n){s||(s=!0,e.callback(t,i,n))};function a(){var e=void 0;if(e=p.response?p.response:p.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(p),v)try{e=JSON.parse(e)}catch(e){}return e}function u(t){if(clearTimeout(m),clearTimeout(e.retryTimeout),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,c||!o.retryManager.getIsEnabled()||!e.retry||!e.retry.shouldRetry()){if(e.requestType&&o.responseInterceptorsStorage.getIsEnabled()){var i={headers:T.headers||{},body:T.body,responseUrl:p.responseURL,responseType:p.responseType},s=o.responseInterceptorsStorage.execute(e.requestType,i);T.body=s.body,T.headers=s.headers}return n(t,T)}e.retryTimeout=setTimeout((function(){e.retry.moveToNextAttempt(),e.xhr=p,l(e)}),e.retry.getCurrentFuzzedDelay())}function h(){if(!c){var t;clearTimeout(m),clearTimeout(e.retryTimeout),t=e.useXDR&&void 0===p.status?200:1223===p.status?204:p.status;var i=T,s=null;if(0!==t?(i={body:a(),statusCode:t,method:f,headers:{},url:g,rawRequest:p},p.getAllResponseHeaders&&(i.headers=r(p.getAllResponseHeaders()))):s=new Error("Internal XMLHttpRequest Error"),e.requestType&&o.responseInterceptorsStorage.getIsEnabled()){var l={headers:i.headers||{},body:i.body,responseUrl:p.responseURL,responseType:p.responseType},u=o.responseInterceptorsStorage.execute(e.requestType,l);i.body=u.body,i.headers=u.headers}return n(s,i,i.body)}}var d,c,p=e.xhr||null;p||(p=e.cors||e.useXDR?new o.XDomainRequest:new o.XMLHttpRequest);var m,g=p.url=e.uri||e.url,f=p.method=e.method||"GET",y=e.body||e.data,_=p.headers=e.headers||{},b=!!e.sync,v=!1,T={body:void 0,headers:{},statusCode:0,method:f,url:g,rawRequest:p};if("json"in e&&!1!==e.json&&(v=!0,_.accept||_.Accept||(_.Accept="application/json"),"GET"!==f&&"HEAD"!==f&&(_["content-type"]||_["Content-Type"]||(_["Content-Type"]="application/json"),y=JSON.stringify(!0===e.json?y:e.json))),p.onreadystatechange=function(){4!==p.readyState||o.responseInterceptorsStorage.getIsEnabled()||setTimeout(h,0)},p.onload=h,p.onerror=u,p.onprogress=function(){},p.onabort=function(){c=!0,clearTimeout(e.retryTimeout)},p.ontimeout=u,p.open(f,g,!b,e.username,e.password),b||(p.withCredentials=!!e.withCredentials),!b&&e.timeout>0&&(m=setTimeout((function(){if(!c){c=!0,p.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",u(e)}}),e.timeout)),p.setRequestHeader)for(d in _)_.hasOwnProperty(d)&&p.setRequestHeader(d,_[d]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(p.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(p),p.send(y||null),p}return ve.exports=o,ve.exports.default=o,o.XMLHttpRequest=e.XMLHttpRequest||function(){},o.XDomainRequest="withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:e.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],(function(e){o["delete"===e?"del":e]=function(t,i,s){return(i=a(t,i,s)).method=e.toUpperCase(),l(i)}})),ve.exports}());var Ee,we,Ce,ke,xe,Ie,Ae,De={exports:{}};function Pe(){if(we)return Ee;we=1;var e=le(),t=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function i(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function s(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+(0|s)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function n(){this.values=t(null)}function r(e,t,i,s){var n=s?e.split(s):[e];for(var r in n)if("string"==typeof n[r]){var a=n[r].split(i);2===a.length&&t(a[0].trim(),a[1].trim())}}function a(e,t,a){var o=e;function l(){var t=s(e);if(null===t)throw new i(i.Errors.BadTimeStamp,"Malformed timestamp: "+o);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function u(){e=e.replace(/^\s+/,"")}if(u(),t.startTime=l(),u(),"--\x3e"!==e.substr(0,3))throw new i(i.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+o);e=e.substr(3),u(),t.endTime=l(),u(),function(e,t){var i=new n;r(e,(function(e,t){switch(e){case"region":for(var s=a.length-1;s>=0;s--)if(a[s].id===t){i.set(e,a[s].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var n=t.split(","),r=n[0];i.integer(e,r),i.percent(e,r)&&i.set("snapToLines",!1),i.alt(e,r,["auto"]),2===n.length&&i.alt("lineAlign",n[1],["start","center","end"]);break;case"position":n=t.split(","),i.percent(e,n[0]),2===n.length&&i.alt("positionAlign",n[1],["start","center","end"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");try{t.line=i.get("line","auto")}catch(e){}t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100);try{t.align=i.get("align","center")}catch(e){t.align=i.get("align","middle")}try{t.position=i.get("position","auto")}catch(e){t.position=i.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=i.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}i.prototype=t(Error.prototype),i.prototype.constructor=i,i.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},n.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var s=0;s<i.length;++s)if(t===i[s]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var o=e.createElement&&e.createElement("textarea"),l={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},u={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},h={v:"title",lang:"lang"},d={rt:"ruby"};function c(e,t){function i(){if(!t)return null;var e=t.match(/^([^<]*)(<[^>]*>?)?/);return function(e){return t=t.substr(e.length),e}(e[1]?e[1]:e[2])}function n(e){return o.innerHTML=e,e=o.textContent,o.textContent="",e}function r(e,t){return!d[t.localName]||d[t.localName]===e.localName}function a(t,i){var s=l[t];if(!s)return null;var n=e.document.createElement(s),r=h[t];return r&&i&&(n[r]=i.trim()),n}for(var c,p=e.document.createElement("div"),m=p,g=[];null!==(c=i());)if("<"!==c[0])m.appendChild(e.document.createTextNode(n(c)));else{if("/"===c[1]){g.length&&g[g.length-1]===c.substr(2).replace(">","")&&(g.pop(),m=m.parentNode);continue}var f,y=s(c.substr(1,c.length-2));if(y){f=e.document.createProcessingInstruction("timestamp",y),m.appendChild(f);continue}var _=c.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!_)continue;if(!(f=a(_[1],_[3])))continue;if(!r(m,f))continue;if(_[2]){var b=_[2].split(".");b.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(u.hasOwnProperty(i)){var s=t?"background-color":"color",n=u[i];f.style[s]=n}})),f.className=b.join(" ")}g.push(_[1]),m.appendChild(f),m=f}return p}var p=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function m(e){for(var t=0;t<p.length;t++){var i=p[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function g(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function s(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function n(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var r=i.match(/^.*(\n|\r)/);return r?(e.length=0,r[0]):i}return"ruby"===t.tagName?n(e):t.childNodes?(s(e,t),n(e)):void 0}for(s(t,e);i=n(t);)for(var r=0;r<i.length;r++)if(m(i.charCodeAt(r)))return"rtl";return"ltr"}function f(){}function y(e,t,i){f.call(this),this.cue=t,this.cueDiv=c(e,t.text);var s={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:g(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv);var n=0;switch(t.positionAlign){case"start":case"line-left":n=t.position;break;case"center":n=t.position-t.size/2;break;case"end":case"line-right":n=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(n,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(n,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function _(e){var t,i,s,n;if(e.div){i=e.div.offsetHeight,s=e.div.offsetWidth,n=e.div.offsetTop;var r=(r=e.div.childNodes)&&(r=r[0])&&r.getClientRects&&r.getClientRects();e=e.div.getBoundingClientRect(),t=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0}this.left=e.left,this.right=e.right,this.top=e.top||n,this.height=e.height||i,this.bottom=e.bottom||n+(e.height||i),this.width=e.width||s,this.lineHeight=void 0!==t?t:e.lineHeight}function b(e,t,i,s){var n=new _(t),r=t.cue,a=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,s=0,n=0;n<i.length&&i[n]!==t;n++)"showing"===i[n].mode&&s++;return-1*++s}(r),o=[];if(r.snapToLines){var l;switch(r.vertical){case"":o=["+y","-y"],l="height";break;case"rl":o=["+x","-x"],l="width";break;case"lr":o=["-x","+x"],l="width"}var u=n.lineHeight,h=u*Math.round(a),d=i[l]+u,c=o[0];Math.abs(h)>d&&(h=h<0?-1:1,h*=Math.ceil(d/u)*u),a<0&&(h+=""===r.vertical?i.height:i.width,o=o.reverse()),n.move(c,h)}else{var p=n.lineHeight/i.height*100;switch(r.lineAlign){case"center":a-=p/2;break;case"end":a-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(a,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(a,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(a,"%")})}o=["+y","-x","+x","-y"],n=new _(t)}var m=function(e,t){for(var n,r=new _(e),a=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(s);)e.move(t[o]);if(e.within(i))return e;var l=e.intersectPercentage(i);a>l&&(n=new _(e),a=l),e=new _(r)}return n||r}(n,o);t.move(m.toCSSCompatValues(i))}function v(){}return f.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},f.prototype.formatStyle=function(e,t){return 0===e?0:e+t},y.prototype=t(f.prototype),y.prototype.constructor=y,_.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},_.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},_.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},_.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},_.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},_.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},_.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},_.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},v.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},v.convertCueToDOMTree=function(e,t){return e&&t?c(e,t):null},v.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin="1.5%",i.appendChild(s),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var n=[],r=_.getSimpleBoxPosition(s),a={font:Math.round(.05*r.height*100)/100+"px sans-serif"};!function(){for(var i,o,l=0;l<t.length;l++)o=t[l],i=new y(e,o,a),s.appendChild(i.div),b(0,i,r,n),o.displayState=i.div,n.push(_.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)s.appendChild(t[o].displayState)},v.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},v.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof i))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function o(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var s=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),s}function l(e){var i=new n;if(r(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var s=t.split(",");if(2!==s.length)break;var r=new n;if(r.percent("x",s[0]),r.percent("y",s[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var s=new(t.vttjs.VTTRegion||t.window.VTTRegion);s.width=i.get("width",100),s.lines=i.get("lines",3),s.regionAnchorX=i.get("regionanchorX",0),s.regionAnchorY=i.get("regionanchorY",100),s.viewportAnchorX=i.get("viewportanchorX",0),s.viewportAnchorY=i.get("viewportanchorY",100),s.scroll=i.get("scroll",""),t.onregion&&t.onregion(s),t.regionList.push({id:i.get("id"),region:s})}}function u(e){var i=new n;r(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",s(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}function h(e){e.match(/X-TIMESTAMP-MAP/)?r(e,(function(e,t){"X-TIMESTAMP-MAP"===e&&u(t)}),/=/):r(e,(function(e,t){"Region"===e&&l(t)}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var d;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var c=(d=o()).match(/^WEBVTT([ \t].*)?$/);if(!c||!c[0])throw new i(i.Errors.BadSignature);t.state="HEADER"}for(var p=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(p?p=!1:d=o(),t.state){case"HEADER":/:/.test(d)?h(d):d||(t.state="ID");continue;case"NOTE":d||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(d)){t.state="NOTE";break}if(!d)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(e){t.cue.align="middle"}if(t.state="CUE",-1===d.indexOf("--\x3e")){t.cue.id=d;continue}case"CUE":try{a(d,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var m=-1!==d.indexOf("--\x3e");if(!d||m&&(p=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=d.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":d||(t.state="ID");continue}}}catch(e){t.reportOrThrowError(e),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new i(i.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}},Ee=v}function Le(){if(ke)return Ce;ke=1;var e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function i(t){return"string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase()}function s(e){return"string"==typeof e&&!!t[e.toLowerCase()]&&e.toLowerCase()}function n(e,t,n){this.hasBeenReset=!1;var r="",a=!1,o=e,l=t,u=n,h=null,d="",c=!0,p="auto",m="start",g="auto",f="auto",y=100,_="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(e){r=""+e}},pauseOnExit:{enumerable:!0,get:function(){return a},set:function(e){a=!!e}},startTime:{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");o=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");l=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return u},set:function(e){u=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return h},set:function(e){h=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return d},set:function(e){var t=i(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");d=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return p},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");p=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return m},set:function(e){var t=s(e);t?(m=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return g},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");g=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=s(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return y},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");y=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return _},set:function(e){var t=s(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");_=t,this.hasBeenReset=!0}}}),this.displayState=void 0}return n.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Ce=n}function Oe(){if(Ie)return xe;Ie=1;var e={"":!0,up:!0};function t(t){return"string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase()}function i(e){return"number"==typeof e&&e>=0&&e<=100}return xe=function(){var e=100,s=3,n=0,r=100,a=0,o=100,l="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!i(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");s=e}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(e){if(!i(e))throw new Error("RegionAnchorX must be between 0 and 100.");r=e}},regionAnchorX:{enumerable:!0